I am using this image as an example:
What I want, is to identify a bounding rectangle that's close to the original rectangle part, ignoring most of the imperfections outside of it.
What I get right now is this (contour and bounding rectangle created from that contour):
How can I, more or less, ignore that small area when creating my bounding rectangle, so that it's not included in it? In other words: what I need is a bounding rectangle that's as close as possible to the original "rectangle part".