Suggestions for optimizing filtration method.
I made using OpenCv a program, which first checks the most occurring color, and based on that color creates a mask, which then is used to create a binary image based on the mask.
The problem is though this solution doesn't seems so robust for certain color combination.
ex.
But for some reason does it work perfectly on these pictures.. http://imgur.com/V73gG1U) (http://imgur.com/tVtw75O,IAerON9#1)
The code is here.. http://pastebin.com/KujpZs6r
Any suggestion for improvements ?
by a quick view on your code, the following:
should be:
and this:
causes an infinite loop, please discard the
while()
loop. Now regarding your problem, I think using just a unique value in order to determine a colour is not a good technique. Colours in your image would have avariety and therefore you would need to specify a range for the specific colour rather than a specific peak/unique value. Have a look in these answers here and here.