Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imitating the "magic wand" photoshop tool in OpenCV

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?

like image 561
Chris Abbott Avatar asked Aug 16 '16 23:08

Chris Abbott


1 Answers

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

like image 106
BPL Avatar answered Sep 19 '22 02:09

BPL