I want to use a raster to stratify an image using different texture. I have a raster image (ndvi_2019) for which I want to extract random coordinates as points from each classes. First, I want to form these create these classes I want to extract these coordinates by classing the values in the ndvi raster object as below;
class 1= <0
class 2= 0:0.1
class 3= 0.1:0.2
class 4 = >0.2
The assumption is that the classification forms the different strata which can then indicate different strata.
ndvi_2019<- (choma_clip[[4]]- choma_clip[[3]])/(choma_clip[[4]]+choma_clip[[3]])
r<- ndvi_2019
Attempt:
r<- setValues(r, rnorm(ncell(r)))
pts<- spsample(as(extent(r@extent, "SpatialPolygons"), 30, type="random")) class1<- r/r <0
class2<- r/r[r== 0:0.1]]
class3<- r/r[[r== 0.1:0.2]]
class4 <- r/r>0.2