Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to combine the integral image with the adaptive threshold?

Hi! The integral image is three-channel. I got it. After converting to a single channel, using adaptive thresholding to process the image ,the result is blank. How to solve it?

import cv2  
import numpy as np  

image = cv2.imread("image.png")
rows,cols,dims=image.shape  

sum = np.zeros((rows,cols),np.int32)  
imageIntegral = cv2.integral(image,sum)

##imageIntegral = imageIntegral.astype(np.uint8)
dst1 = np.zeros((rows,cols)).astype("uint8")
cv2.split(imageIntegral,dst1)

dst = cv2.adaptiveThreshold(dst1, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 75, 10);

cv2.namedWindow('image')
cv2.imshow("image",image)
cv2.namedWindow('imageIntegral')
cv2.imshow("imageIntegral",imageIntegral)
cv2.namedWindow('dst')
cv2.imshow("dst",dst)
cv2.imwrite("1.jpg",dst)
waitKey(0)