I have two ndvi images having values -1 to 1 as min/max....i want to subtract 2nd image from 1st or vice-versa but when i am doing that it is giving me raster with 0 value...which i think it should be like that as we subtract one band from other or one image from another....kindly help me where i am getting wrong.....here is the code which i am using to see the change....
b3<-raster(stackIm1,3) #band 3 of first input image
b4<-raster(stackIm1,4) #band 4 of first input image
ndvi1<-(b4-b3)/(b4+b3) #calculating NDVI for first image
b3<-raster(stackIm2,3) #band 3 of second image
b4<-raster(stackIm2,4) #band 4 of second image
ndvi2<-(b4-b3)/(b4+b3) #calculating NDVI for second image
ndvi <- ndvi1-ndvi2 #subtracting second ndvi image from first
Thanks in advance