07-06-2020 03:33 AM
I need to devolve my test area (training) polygons into points in order to create more samples for a Random Forest classifier. I have not had any success figuring out how to do this in ERDAS IMAGINE and I wondered if it is even possible. I assume that the process uses the raster to assign one point for every pixel that falls within the polygon area?
I am grateful for any advice you might have.
Thank you very much.
Solved! Go to Solution.
07-06-2020 07:24 AM
As Ruth says, Create Random Points is the easiest route to go and what I often use for Random Forest classification.
If you want to extract a point for every pixel though, I use a variant of the Dice approach:
...set to grid every pixel (or you could sample every nth pixel) and convert to a center point (and keep just the points that fall within the original training polygons). I should probably write it up as a Spatial Recipe one of these days, if people are interested? Id also recommend logging an Idea asking for a specific function to convert pixels to points.
07-07-2020 07:31 AM
Thank you very much for your responses, I am grateful. I am attempting to implement both methods that you suggest so that I learn as much as possible from your answers.
I have run into difficulty implementing the Create Random Points function. I am accessing this under Accuracy Assessment but before it will allow me to create random points it looks like I must first open a classified image (otherwise the create random points function is greyed out). I haven't yet performed my classification as I'm devolving my training polygons into points as inputs to a RF classifier. Is there a way to implement the Create Random Points function without using a classified image?
I am also working on the Dice method, but I first need to get my head around the Spatial Modeler (which I've never used before) so it will be a little while longer before I can confirm that this method has worked for me. Ultimately, I think I will need to use this method as I want to maximise the number of points within my polygons by having a point generated for every pixel, but I also want to ensure that no pixel contains more than one point.
07-07-2020 07:47 AM
Hi @sarahs ,
I think @Ruth was referring to the Spatial Modeler as well - the Create Random Points operator:
If you are new to Spatial Modeler you might want to check out the eTraining courses here:
...and expand the Courses listing at upper right to see what's available.
07-07-2020 10:08 AM
This is the approach I took when I wanted to create a "regular" array of points for all non-background pixels:
You could easily modify that bottom leg of the model to take in your training polygons and select just the pixel locations that fall within them. Then use those points with the Add Attributes by Location operator to collect the training values for Machine Learning.
07-10-2020 01:11 AM
This is so helpful, thank you. Unfortunately I have realised that I have an insufficient number of pixels (samples) to pursue a RF classification so I won't be taking this approach further for this project. But I'm grateful to know about the current options for devolving polygons into points and for assigning points to pixels in a raster.
Thank you very much for your help, I am most grateful.