Imitating the "magic wand" photoshop tool in OpenCV

Issue

I’m trying to isolate the sky region from a series of grayscale images in OpenCV. All of the images are fairly similar: the top of the image is always a sky region, and is always a bright, gray-white colour. I’ve attempted contour-based approaches, and written my own algorithm to extract the line of the horizon and divide the image into two masks accordingly. However, I’ve noticed that the reliability of the magic wand tool in Photoshop on this image set is MUCH more accurate.

Here’s the image that I’m processing:

enter image description here

and the result that I hope to achieve:

enter image description here

How can this be imitated in OpenCV?

Solution

I think what you’re looking for is the grabcut algorithm

Answered By – BPL

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published