Replace image background [closed]
Hi all,
I'm new to OpenCV and I was wondering if someone could point me in the right direction for a simple program I'm trying to write. Well, the project may not be that simple but it should be simple to explain!
Given the picture of a blocknote, extract the content of the page and put it on a white background.
For example transforms the image on the left into the on on the right:
This picture is a super simple scenario, the notebook does not have lines (which I will need to delete) but I don't need OCR or anything else.
In my mind I would write something like:
- identify the rectangle page
- delete everything outside the rectangle
- identify the color of the page (frequency distribution of colors, the x% most common -> next step)
- replace the color of the page with "#ffffff" (eg the 10% most common colors)
Like I said, if you can point me in the right direction would be greatly appreciated! I'm also open to collaboration if anyone is interested!
Thanks, Luca
please take a look at opencv's existing tutorials, it's all in there.
there are also tons of samples to detect a rectangle (e.g. on this site). please search, and try something on your own before asking, right now, we cannot really help you.
Thanks Berak, I'm sorry! I didn't mean to waste anyone's time! I know how to detect rectangles but the problem is quite mode complex and I just hoped that more experienced developers could point me in the right direction. I apologize!