# How to combine the integral image with the adaptive threshold? [closed]

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

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)

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)

edit retag reopen merge delete

### Closed for the following reason question is not relevant or outdated by sturkmen close date 2020-10-21 07:39:41.666104

• why are you trying to use an integral image here ?
• it will have the same number of channels, as the input
• splitting it into uchar channels does not make any sense (you're loosing all significant bits in the conversion)

• have a look at the docs , again.

( 2018-05-11 02:05:10 -0600 )edit

enter code here

# -*- coding: utf-8 -*-
import sys
import numpy as np
import cv2
#第一步：对图像矩阵进行均值平滑
I_smooth = cv2.boxFilter(I,cv2.CV_32FC1,winSize)
#I_smooth = cv2.medianBlur(I,winSize)
#第二步：原图像矩阵与平滑结果做差
out = I - (1.0-ratio)*I_smooth
#第三步：对 out 进行全局阈值处理，差值大于等于零，输出值为255，反之为零
out[out>=0] = 255
out[out<0] = 0
out = out.astype(np.uint8)
return out

if __name__ =="__main__":