1

I have QGIS 2.18. I have the ground truth of land type for France. That is a paletted raster (i think.. i'm new and maybe it is not the correct word)

I loaded a style.qml file for this raster and I get this:

0 : no data
1 : urban
2: Roads
...
21 : water

(all these values have an associate color on the raster visualisation ofc)

Based on that, can I split my raster into 21 different rasters, each one representing a single mask?

(And then merge them into one TIFF file and use it as the ground truth for a deep segmentation algorithm)

EDIT: I found a basic solution: I save my ground truth raster and I exclude all the values excepted the value I care about (e.g 17: trees). So I have to do it manually for my 21 classes.

  • QGIS has split vector layer, but I don't know of any equivalent tool for rasters. You could polygonize the raster, run split vector layer on the polygonized layer, then clip raster by mask layer. It doesn't seem much easier than exporting 21 different classes manually, though. – csk Apr 16 at 18:02
  • What are you trying to achieve by splitting up the raster, then merging it back together? Wouldn't that just give you the same thing you started with? – csk Apr 16 at 18:04
  • I want to have a tensor shape for my neural network like this : (Width, Height, nb_of_classes) with 0 or 1 for each elements. – Antoine Mathu Apr 17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.