Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

AdaptiveThreshold with non-square block sizes

Is there an elegant way, in C++, to use the adaptiveThreshold with a non-square block size? e.g. 5x1 or 3x15 In my case, I want the threshold to be calculated only in X and Y direction separately.

Using python, I can realize that by slicing the image into its rows and columns.

e.g. for row in range(0, img.shape[0]): imgThr[row:row+1, :] = cv2.adaptiveThreshold(img[row:row+1, :], 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11, 0)

click to hide/show revision 2
None

updated 2018-12-13 03:53:04 -0600

berak gravatar image

AdaptiveThreshold with non-square block sizes

Is there an elegant way, in C++, to use the adaptiveThreshold with a non-square block size? e.g. 5x1 or 3x15 In my case, I want the threshold to be calculated only in X and Y direction separately.

Using python, I can realize that by slicing the image into its rows and columns.

e.g. e.g.

for row in range(0, img.shape[0]):
  imgThr[row:row+1, :] = cv2.adaptiveThreshold(img[row:row+1, :], 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11, 0)

0)