I'm trying to take an image of a pencil sketch (http://www.vangoghgallery.com/catalog/image/1442/Sower-with-Setting-Sun.jpg) and colorize the different segments based on the texture. So in this image, the sky and the man and the wheat in the background would all be a different color.

I've found I can sort of use texture-based segmentation with a gabor filter (https://reference.wolfram.com/legacy/v9/example/TextureBasedSegmentation.html) but it doesn't exactly get what I'm looking for. It isn't able to colorize the dots or the blank space in the sky.

Any other methods that are obvious that I should try?


1 Answer 1


This will get you fairly solid regions for the sky, the sun, and the path, with the small components produced by the field removed (black). Unfortunately the dude in the hat got deleted too. I played around a lot with the parameters but couldn't capture him in a contiguous segment.

   FillingTransform[GradientFilter[img, 2], 0.05, Padding -> 1], 
   Method -> "Basins"]
  , 4000, CornerNeighbors -> True] // Colorize



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.