I'm new with raster in QGIS. I have a three-band (RGB) georeferenced raster similar to this: (Reference)
And I would like to extract the pixels with similar color like in the following image by given a tolerance value as in Photoshop. In Photoshop, you can change color range to be selected using tolerance value. Two different results depending on the value 32 and 70 are seen in the two images below. (In both images, the darker blue area was clicked by "The Magic Wand Tool")
I was only able to find the following two posts that are most relevant to this topic. But they don't meet my need.
- Extracting GeoTIFF colours and adding to equal geometry shapefile
- Extracting shapefile attributes from raster colors using PyQGIS?
So, how can I extract the pixels using a color tolerance, as in Photoshop? It doesn't have to be a tolerance value, my ultimate goal is to extract pixels of similar color, but, somehow, I need to be able to set the similarity.
Best Answer
There is the Magic Wand plugin in QGIS that works similar to the magic wand tool known from graphic software. Install the plugin, then simply click on the map canvas and the plugin creates a polygon layer with the selection.
You could use this polygon to rasterize and use the Raster Calculator to mask the colors in the initial raster - or simply use the polygon layer for that.
You can change the
Accuracy
(Fast to Precise) andColor Threshold
(Ambiguous to Strict).One single click on the Ottoman Empire was enough to create Polygon styled in red hachures: