Ask Your Question

Revision history [back]

I have done some work with this tool, and struggled with the same error. The key is to see what happens in pyramid segmentation - at each level in the pyramid the image becomes half the size, and the function does not cope if there are not an even number of pixels to reduce at each step.

Therefore you have to ensure before calling the function that the number of pixels in width and height can be divided by 2^n where n is your value for level parameter. If your image is large you might crop a few pixels off, if it is small you could resample to a different size or add a black border.