import cv2
# read image
im = cv2.imread('robot.jpg')
gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
# compute integral image
intim = cv2.integral(gray)
# normalize and save
intim = (255.0*intim) / intim.max()
cv2.imwrite('result.jpg',intim)

cv2.imshow('image',intim)
cv2.waitKey(0)
cv2.destroyAllWindows()