14 Jan 2013 01:09 PM |
|
Hi,
I currently am using a program that requires two images both with a data type of 1 (as indicated in the header file) and then performs image processing with the two images. When the program was originally written both of the images used were from the same sensor, so they were both the same data type (1) but now I'm trying to use one from that sensor and one from another sensor that produces images of data type 2. I am trying to convert that second image from data type 2 to data type 1 but am having difficulty. The only way in ENVI I've seen that looks like it's supposed to work is using band math, either the function byte(b1) or bytscl(b1) however I needed the scaling so byte(b1) did not give me correct results. Even when I try bytscl it produces an image with strange dark and light bands across it. Are there any suggestions for what I should do to convert from data type 2 to data type 1?
Thank you
|
|
|
|
Deleted User New Member
Posts:  
14 Jan 2013 02:56 PM |
|
In ENVI and IDL data type 1 is byte(0-255) and data type 2 is integer(-32768 to + 32767). What you should consider is promoting data type 1 to 2 by using FIX. Consider the following example expression from the ENVI Help under Basic Tools > Band Math > IDL Tips for Use in Band Math:
fix(b1) + b2
|
|
|
|
Deleted User New Member
Posts:  
15 Jan 2013 07:21 PM |
|
Thank you for your reply, but the problem with converting the data type 1 to 2 is that the code I'm using outside of ENVI must have data type 1 image files (it expects to be dealing with bytes rather than integers). It seems to me bytscl should work for converting the data type 2 (integer) to 1 (byte), is this not correct?
Thanks again.
|
|
|
|
MariM Veteran Member
Posts:2396  
16 Jan 2013 06:16 AM |
|
You can also use the Stretch Data tool which allows you to set the data type and the min/max you want.
|
|
|
|
Deleted User New Member
Posts:  
15 Aug 2013 02:12 PM |
|
We also have gotten striping after trying to convert an integer image using bytscl. We compared images that should be identical after byte-scaling the second one, and found that the striping in that image was entirely due to the green band (band 2 in Landsat). That is, for any pixel in the striped areas, all band values matched except for the green band. In the areas between stripes, all band values matched. This is a serious bug! We have put in a tech support request separately from my reply here.
|
|
|
|
Deleted User New Member
Posts:7  
25 Nov 2013 06:11 AM |
|
Hi MariM:
Thank you very much. Your response helped me also. Now my image data has changed from integer format to byte format.
Muhammad
|
|
|
|