Greetings Mr. Neteler
I’m implementing a methodology in GRASS to eliminate training_areas outliers. What I do?
1- first I pick up the current training areas for a class and I calculate mean vector and covariance matrix
2- Invert the covariance matrix
3- Compare each pixel, that is included in a training_area, with a defined threshold and if it’s OK, It’s still labeled as 1 or, otherwise, it’s eliminated.
It would be pointless in developing this function from scratch in GRASS so I used i.gensig that is used to calculate mean vector and covariance matrix for training areas. (This means that step 1 and 2 (by a simple implementation) is covered. (Do anyone suggest other function instead of this?)
My problem is with the third step (I’m still not very familiar with some GRASS programming functions/functionalities)
I have created a cycle that goes for each row and col and I get the correct raster pixel value from group but I’m not being able to retrieve the classification. This is an overview of the approach:
for row=0, row<nrows, row++
for col=0, col<ncols, cols++
Check in training area if the pixel value is >-1 (this is the problem I’m not being able to get thiS)
for band=0, pband<nbands, pband++
pband[band]=cell_value for band “band”, in row=row, col=col and that is included in the training area.
- Then apply the compare (easy)
- write (I think it’s not a problem)
}
}
}
In what am I a bit lost:
1- How can I get the value from training areas raster?
2- How can I only apply this rule only to the pixels that are included in a training_area?
Can anyone give me a few tips?
Thanks
Katrin