Using cv reduce in Python
I'm trying to use cv reduce to get the projection of an image onto the x and y axis.
I used:
x_sum = cv2.reduce(img, 0, cv2.cv.CV_REDUCE_SUM, cv2.CV_32S)
I get this error:
OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and output array formats) in reduce.
I can't find any more detailed documentation on how to use reduce in Python. Does anyone know where I've gone wrong?
Alternatively, is there another method I could use? calcHist() seems to only find the colour histogram of the image.
what is 'img' ?
img is actually the edges of my original picture
Try to use CV_32F or CV_64F instead of CV_32S
@pi-null-mezon I have tried these and keep getting the same error.
Do not know what to say... In C++ your code works for CV_32S, CV_32F and CV_64F and throws same error for CV_16U, CV_16S. Maybe something wrong with the 'x_sum', how you initialize it?
@pi-null-mezon I haven't initialized it. In Python there is normally no need to initialize. Should I initialize?