X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Dec 2014 08:45 AM by  anon
SVM - floating point pixel type
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
22 Dec 2014 08:45 AM
    I have some troubles understanding the problem I encounter when trying to classify an aerial image where shadows have been removed. I created a mask by thresholding all shadows in my RGB+NIR+NDVI raster composite. The mask is a tif file (unsigned integer) with nodata values within the shadows and the value 1 for everything outside the shadows. Using raster calculator (ArcMap) I multiplied each raster band (also unsigned integer) of my multiband composite individually with the mask to get 5 new bands with nodata values where there were shadows before and the original values where there are no shadows. The bands were then added together to get a new 5 band composite without shadows. The output bands looks fine but are now floating points instead of integers, even though both inputs were integers and the values are the same as before. I added Int() before and within the expression but the output pixel type was still floating point. I'm thinking this might have something to do with the nodata values. Next I want to classify my image using SVM in ENVI, this is where the problems start. Firstly, when I open the new image in ENVI classic and select to visualize 3 bands I get a black/white image instead of color, however, if I do the same in ENVI (not classic) it gives me a color image. Unfortunately the ROI tool is only available through ENVI classic. Because of this I created region of interests (ROI) in ENVI classic using the original image instead of the shadow free one. However, when I try to run SVM classification using the shadowfree image and the imported ROIs the output from the classification is always only 1 class (there are 3 classes in the ROI). I am not sure why this is happening as I have tried classifying the original image with the same ROI and it works fine. I suspect the problem might be that my raster now are floating point so I converted the bands individually in raster calculator to integers ( intband1=Int(floatband1) ) and added them together to a new composite. When I try to open this new integer composite in ENVI, IDL stops responding and when I try it in classic I get the error message "Histogram: Illegal binsize or max/min. The result might be invalid." and the result is just a black image. It opens perfectly and have correct values in ArcMap however. I realize this became a very messy description of my problem but this is really confusing me at the moment. Best regards

    Deleted User



    Basic Member


    Posts:228
    Basic Member


    --
    24 Dec 2014 12:54 PM
    I'm thinking that the problem may be related to the no data values in your file. When you import this image into ENVI, what values do you see for the pixels with no data values? For example, if you click the Cursor Value tool then browse around in the parts of your image with no data? Are the pixel values shown as 0? Or NaN (not a number)? My guess is that they are interpreted as NaN, which is is a numeric data type value representing an undefined or unrepresentable value. NaN is not available for integer data types, because there is no undefinable integer. So that is probably why your data have been converted to floating point, which can have NaN values. ENVI does not really have a concept of "no data". So, in general, I recommend that you make a mask image that is the same dimensions as your image and has pixel values of 1 where you want to do processing, but pixel values of 0 in the shadow areas that you want to leave out of processing. Then when you go to apply classifications, you can specify the mask band to tell ENVI which areas to leave out of the classification. Now, when you browse with the Cursor Value tool on the areas that don't have no data (sorry for the double negative) do you see reasonable pixel values? I am guessing that the reason the new image looks black and white in ENVI Classic is that the NaN values where you don't have data are messing up the calculation of the histogram used for the image stretch. But that if you apply a custom stretch and play around enough, you can probably see real image data in those areas. It sounds like the default ENVI interface handles NaN values better during the contrast stretch. In ENVI 5.2 there is a ROI tool in the default interface. So if there is another problem with the way ENVI is reading your data, perhaps it will be gone in ENVI 5.2. Beyond this point, I'm not sure I understand what you are describing, so it's difficult to comment. It sounds like your ROIs result in a decent classification of the original image. But when applied to the shadow-free image, which contains all of the NaN values (I'm guessing), the results are not good. I think again here it may be the NaN pixel values messing up the image and ROI statistics on which the classification is based. My guess about ENVI not responding when you try to read your integer version of the data is that ENVI doesn't know what to do with pixels that don't have values but are integer data type. ENVI really expects to find a valid value in the specified data type for every pixel in an image. Peg Exelis VIS

    Deleted User



    New Member


    Posts:
    New Member


    --
    28 Dec 2014 05:06 AM
    Thank you for taking the time to answer. The NaN values indeed seem to be the problem. The default ENVI interface displays the floating point image and the NaN values successfully before I converted the image back to integer so I am going to try to run a classification on this image using the 5.2 version instead. Specifying a mask band on my original integer image before subtracting the shadows (or after giving the shadows the value 0 instead on NaN and therefore keeping the data type) would have been perfect but SVM does not support this option, has it been added in 5.2?

    Deleted User



    Basic Member


    Posts:228
    Basic Member


    --
    20 Jan 2015 09:57 AM
    Sorry, no, the ability to use masks with SVM classification has not been added in ENVI 5.2. There is still an open request to add that ability in a future release. Peg Exelis VIS
    You are not authorized to post a reply.