Today I have been practicing with part 3 of these nice tutorials about NIR hyperspectral image. The author (@eefieg) leaves some parts without code in order that the reader practice and get the same or similar results. For example compare two classification images obteined with two different methods, so if we substract one from the other, in the best of the cases, we would not see any frames, just a uniform color (the color which represents the zero value).
Finally I got (I think) the same residual image as Aoife, in the article.
r_PC1<-Im1_PC1[,]<= -2
r_PC1<-1*r_PC1
g_PC1<-(Im1_PC1[,]> -2)&(Im1_PC1[,]<=0.7)
g_PC1<-3*g_PC1
b_PC1<-(Im1_PC1[,])>0.7
b_PC1<-2*b_PC1
col_PC1<-r_PC1+g_PC1+b_PC1
dev.new();
image(col_PC1)
diff<-col_PC1 - Im1_Classr_PC1<-1*r_PC1
g_PC1<-(Im1_PC1[,]> -2)&(Im1_PC1[,]<=0.7)
g_PC1<-3*g_PC1
b_PC1<-(Im1_PC1[,])>0.7
b_PC1<-2*b_PC1
col_PC1<-r_PC1+g_PC1+b_PC1
dev.new();
image(col_PC1)
dev.new();
image(diff)