Get the smallest rectangle from image

loop over the contours and check contourArea()

there are several ways to determine, if a contour is a rectangle, probably the most simple one is getting the minAreaRect() and compare the size with the contour’s area again

1 Like