Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
import cv2
import numpy as np

snap = np.ones((3,3),dtype='uint8')
print(snap)

intergral_image = cv2.integral( snap )
print(intergral_image)

# if you dont want the top row/left column pad
intergral_image = intergral_image[1:,1:]
print(intergral_image)

#OUTPUT:
[[1 1 1]
 [1 1 1]
 [1 1 1]]
[[0 0 0 0]
 [0 1 2 3]
 [0 2 4 6]
 [0 3 6 9]]
[[1 2 3]
 [2 4 6]
 [3 6 9]]