Recognize an area inside Image

I have an image that has a yellow box inside. How can I crop the image so that only the yellow box remains?

I am asking because inside the box is text I want to read. There is also text behind the box and it messes up the OCR reading. (OCR is compulsory in this case). If the image is cropped so that only yellow box remains, the text reads correctly. The yellow box changes its shape, size and position in a way that I cannot know where to crop the image beforehand.

Example image of my case: example

There probably is a better solution, could you could loop through the images pixels (using Bitmap) to look for the first instance (top left) and last instance (bottom right) of that particular colour (yellow - as long as that colour doesn’t appear on the page anywhere else. This would give you your area for the image (you need to calculate the height and width)
You can then use this Crop Image to crop your image.

Hope this helps :slight_smile: or gives you a starting point.

1 Like