Ask Your Question

Revision history [back]

You should print the dimensions of the rectangles prior to calling the OpenCV function and see if they are as expected. I have a feeling that the thresholding and closing operations may give you some different results than what you expect and that may result in an exception.