Jeff is right - you can solve this in band math and using masking, although you don't have to actually make a mask file, it can be done in the band math equation itself. Here is an example:
b1*(b1 gt 0) + b2*(b2 gt 0) + b3*(b3 gt 0)
The above equation is taking the variable 'b1' and multiplying it by a mask of itself (b1 gt 0) so it returns only the pixels with values greater than 0. Then it adds it to the other variables b2 and b3 (or as many variables as you have classification images), so that the result includes all classification results greater than 0 (unclassified). Note that this only works if classes 1, 2, 3.. n are consistent across classified images. That is, whatever class '1' is in one image also needs to be represented as a value of '1' in all input images or you will get undesired class combinations. If your classification values are not consistent, you will need to perform a bit more prep on the files and possibly reclass some classes.
With regards to Ziad Aly's questions:
- if you move your Cursor Location/Value tool around the black areas, are they actually 0 or do they return a value? If they have a value, it might be a data stretching issue. Try changing the stretch type in the display under the Enhance menu. If the values are actually 0 when they should not be, it could be a problem with the band math equation.
- The result of band math will be an 'ENVI Standard' file type. To change this back to an 'ENVI Classification' file type, go to File ->Edit ENVI Header and select the band math result file. In the Header Info dialog, select the drop down arrow next to 'File Type' and choose 'ENVI Classification'. You will be prompted to enter the number of classes. You should enter the number of known classes + 1 for 'unclassified' in this dialog. In the next dialog, you can assign colors and class names to the classes. Save the header and now the grayscale image will be displayed as a Classification type image.
|