Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you need the individual regions, use connectedComponentsWithStats. It will give you the bounding box of each region, then use this to crop the image.

If you need to crop out the zone which contains all the black patches, make a horizontal and vertical sum on the image using cv2.reduce. Then look for the first and last column/row where the sum of elements is greater than 0.