I will do my best to give complete info, starting from the beginning:
I am trying to mosaic two files together in a way so that one class of one file is replaced by the numerous classes of the other file. The first file (image1) is a classification file that divides the image into three classes and a background/masked out class. The second file (image2) is also a classification file that was created by classifying to more detail one of the classes in image1. This was done by creating a mask file with image1, applying it to the original data, and performing a supervised classification. This generated 4 classes, plus of course the background/masked areas. The basic statistics for these files are the following:
Image1: (ENVI Classification file, byte order host (intel), data type byte, interleave BSQ)
Band 1: min 0, max 3, mean .6546, stddev .8980
Histogram Band 1: DN 0, Npts 8231941; DN 1, 4740897; DN 2, 640429; DN 3, 1219678
Image2: (ENVI Classification file, byte order host (intel), data type byte, interleave BSQ)
Band 1: min 0, max 4, mean 0.689, stdev 1.143
Histogram Band 1: DN 0, Npts 10092048; DN1, Npts 1188063; DN 2, Npts 2334481; DN 3, Npts 509549; DN 4, Npts 708804.
(note that in image2, DN values 1,2,3,4 added together equal DN 1 from image 1; this is the class in image1 that was further classified in image2).
Because image1 and image 2 had overlapping data values that i did not want to be in the same classes, i reclassed image1, using mminari's instructions for bandmath. This generated Image3:
Image3: (ENVI Standard, Byte order Host (intel), Data type integer, interleave BSQ)
Histogram, Band1: DN 0, Npts 12972838; DN 14, Npts 640429; DN 24, 1219678; (note: DN 1-13 and DN 15-23 are all 0)
I then took Image3 and changed its format to an ENVI classification file in the header file with 3 classes. I chose colors for a background class, class#1 and class#2. However, when I then open this image, both values 14 and 24 are classed in class#2 and given that color and there is no apparent class#1. I will call this Image3b
Image 3b: (ENVI Classification, Byte Order Host (intel), Data type Integer, Interleave BSQ.)
Histogram: Band1, DN 0, Npts 12972838; DN 14, Npts 640429; DN 24, Npts 1219678. Again DN 1-13 and DN 15-23 are all 0.
Side note: I tried to change the data type to byte format and it produced a very strange image, so i left it as integer.
I continued to the mosaic stage, by mosaicing the Image3b (ENVI Classification) with Image2. This produced an ENVI classification image with everything correct, except that the same problem that was present in Image3b perpetuated, in that values 14 and 24 were both lumped into the same class. I hadn't expected the mosaic to solve the problem, so this did not come as a surprise.
I hope this is the information that is helpful for solving this. If not, please specify what else is needed. thank you once again
|