79776825

Date: 2025-09-27 14:44:58
Score: 1.5
Natty:
Report link

For OpenCV - I'm not familiar with it, but I know, that there is a FindContours-Method in OpenCV. As far as I know this Method is only for binary images.

Here's my imagination of how you could do this in OpenCV:

- Extract the blue color channel from the image.
- Threshold this by a threshold of about 128, make sure you return a binary image.
- Pass this binary image to the FindContours method of OpenCV.
- Select the correct contour from the results.
- From this contour, display [and save] the enclosed portion of the *original image*.

Considerations:

- Add some logic to automatically get the correct threshold.
- Add some logic to make the selection of the correct chainCode/Contour more reliable for different backgrounds. E.G.: Test the "rectangularity" of the, say 10, largest area ChainCodes, or look at the Gradient, or the Entropy, to decide, if the processed ChainCode is the right one. Or, if the written part always contains some same words/letters, you could correlate the picture with a testimage to get the right contour... There's a lot of options to select the correct part of the orig img, depending on e.g.: performance, or "the parameters" of the problem itself.

Here's a screenshot of a quickly setup Winforms app doimg this

Regards,
Thorsten

Reasons:
  • Blacklisted phrase (1): Regards
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Thorsten Gudera