for modis truecolor images?<br><br>--Nikos<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 4:44 PM, Brian Case <span dir="ltr">&lt;<a href="mailto:rush@winkey.org">rush@winkey.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Jonathan<br>
<br>
I don&#39;t know about worldview, but with modis I wound up using multiple<br>
ranges<br>
<br>
0:0,750:110,1500:160,3000:210,4750:240,6375:255<br>
<br>
see &lt;lut&gt;  in the vrt tutorial<br>
<font color="#888888"><br>
Brian<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On Thu, 2011-06-09 at 12:39 -0700, Jonathan Greenberg wrote:<br>
&gt; Brian:<br>
&gt;<br>
&gt;<br>
&gt; Thanks!  Great solution, definitely saved me some time.  The main<br>
&gt; issue (in terms of doing this entirely within GDAL) is getting the<br>
&gt; right scaling to make the image look good.  I was able to figure out<br>
&gt; the correct scale range within ENVI, and then apply the scales as you<br>
&gt; suggested below.  Nikos&#39; suggestion to use rgb2pct makes me wonder if<br>
&gt; there is some way to figure out the optimal scale (which, AFAIK, is<br>
&gt; part of how rgb2pct is functioning) to apply to this image.<br>
&gt;<br>
&gt;<br>
&gt; Incidentally, what I&#39;m trying to do is load Worldview-2 data onto an<br>
&gt; iPad 2 for use with the GISRoam mobile mapping app.  Worldview-2 is<br>
&gt; 16-bit per band, 8 band data, with a very high dynamic range (we have<br>
&gt; snow in our image, so we have lots of VERY bright pixels which throw<br>
&gt; off the adjustment if using -scale without any parameters).  99%<br>
&gt; (100%?) of mobile mapping applications need 3-band data, usually with<br>
&gt; only 8 bits per band.<br>
&gt;<br>
&gt;<br>
&gt; Pushing forward, but if someone knows how to figure out an optimal set<br>
&gt; of scale values to use within GDAL, please post the solution.<br>
&gt;<br>
&gt;<br>
&gt; --j<br>
&gt;<br>
&gt; On Wed, Jun 8, 2011 at 9:45 PM, Brian Case &lt;<a href="mailto:rush@winkey.org">rush@winkey.org</a>&gt; wrote:<br>
&gt;         Jonathan<br>
&gt;<br>
&gt;         you can do scaling on individual bands.<br>
&gt;<br>
&gt;         gdal_translate -b 1 -scale 0 5000 -ot Byte -of VRT infile<br>
&gt;         outfile1.vrt<br>
&gt;         gdal_translate -b 2 -scale 0 4000 -ot Byte -of VRT infile<br>
&gt;         outfile2.vrt<br>
&gt;         gdal_translate -b 3 -scale 0 3000 -ot Byte -of VRT infile<br>
&gt;         outfile3.vrt<br>
&gt;<br>
&gt;         gdalbuildvrt -separate output.vrt outfile1.vrt outfile2.vrt<br>
&gt;         outfile3.vrt<br>
&gt;<br>
&gt;         gdal_translate -of gtiff output.vrt output.tif<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         for more complicated scaling you may need to hand write a vrt<br>
&gt;<br>
&gt;         <a href="http://www.gdal.org/gdal_vrttut.html" target="_blank">http://www.gdal.org/gdal_vrttut.html</a><br>
&gt;<br>
&gt;         Brian<br>
&gt;<br>
&gt;<br>
&gt;         On Wed, 2011-06-08 at 19:31 -0700, Jonathan Greenberg wrote:<br>
&gt;         &gt; Nikos and GDALers:<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; This is CLOSE to what I&#39;m looking to do, but I&#39;m having a<br>
&gt;         hard time<br>
&gt;         &gt; getting it working properly.  Here&#39;s my input dataset<br>
&gt;         gdalinfo dump:<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; ***<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; Driver: ENVI/ENVI .hdr Labelled<br>
&gt;         &gt; Files:<br>
&gt;         10SEP10191223-M2AS-052377832030_01_P003_ps_gs_bl_tc.envi<br>
&gt;         &gt;<br>
&gt;          10SEP10191223-M2AS-052377832030_01_P003_ps_gs_bl_tc.hdr<br>
&gt;         &gt; Size is 42255, 51712<br>
&gt;         &gt; Coordinate System is:<br>
&gt;         &gt; GEOGCS[&quot;WGS 84&quot;,<br>
&gt;         &gt;     DATUM[&quot;WGS_1984&quot;,<br>
&gt;         &gt;         SPHEROID[&quot;WGS 84&quot;,6378137,298.257223563,<br>
&gt;         &gt;             AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],<br>
&gt;         &gt;         TOWGS84[0,0,0,0,0,0,0],<br>
&gt;         &gt;         AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],<br>
&gt;         &gt;     PRIMEM[&quot;Greenwich&quot;,0,<br>
&gt;         &gt;         AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],<br>
&gt;         &gt;     UNIT[&quot;degree&quot;,0.0174532925199433,<br>
&gt;         &gt;         AUTHORITY[&quot;EPSG&quot;,&quot;9108&quot;]],<br>
&gt;         &gt;     AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]<br>
&gt;         &gt; Origin = (-120.066479999999999,39.271554000000002)<br>
&gt;         &gt; Pixel Size = (0.000004500000005,-0.000004500000005)<br>
&gt;         &gt; Image Structure Metadata:<br>
&gt;         &gt;   INTERLEAVE=BAND<br>
&gt;         &gt; Corner Coordinates:<br>
&gt;         &gt; Upper Left  (-120.0664800,  39.2715540) (120d 3&#39;59.33&quot;W,<br>
&gt;         &gt; 39d16&#39;17.59&quot;N)<br>
&gt;         &gt; Lower Left  (-120.0664800,  39.0388500) (120d 3&#39;59.33&quot;W, 39d<br>
&gt;         &gt; 2&#39;19.86&quot;N)<br>
&gt;         &gt; Upper Right (-119.8763325,  39.2715540) (119d52&#39;34.80&quot;W,<br>
&gt;         &gt; 39d16&#39;17.59&quot;N)<br>
&gt;         &gt; Lower Right (-119.8763325,  39.0388500) (119d52&#39;34.80&quot;W, 39d<br>
&gt;         &gt; 2&#39;19.86&quot;N)<br>
&gt;         &gt; Center      (-119.9714062,  39.1552020) (119d58&#39;17.06&quot;W, 39d<br>
&gt;         &gt; 9&#39;18.73&quot;N)<br>
&gt;         &gt; Band 1 Block=42255x1 Type=UInt16, ColorInterp=Undefined<br>
&gt;         &gt; Band 2 Block=42255x1 Type=UInt16, ColorInterp=Undefined<br>
&gt;         &gt; Band 3 Block=42255x1 Type=UInt16, ColorInterp=Undefined<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; ***<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; I need to end up with a Byte TIF image with good color<br>
&gt;         balance from<br>
&gt;         &gt; this input.  Running rgb2pct.py on this dataset just<br>
&gt;         outputted a<br>
&gt;         &gt; &quot;blank&quot; (grey) image.  Running gdal_translate -of GTiff -ot<br>
&gt;         Byte<br>
&gt;         &gt; -scale [min] [max] worked somewhat, but its near impossible<br>
&gt;         to get<br>
&gt;         &gt; this looking right, since the scaling I want to do differs<br>
&gt;         from band<br>
&gt;         &gt; to band (e.g. if there any way to use -scale to adjust each<br>
&gt;         band<br>
&gt;         &gt; separately)?  Alternatively, how would I get rgb2pct.py<br>
&gt;         working on the<br>
&gt;         &gt; above image correctly?  Thanks!<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; --j<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; On Wed, Jun 8, 2011 at 4:10 PM, Nikolaos Hatzopoulos<br>
&gt;         &gt; &lt;<a href="mailto:nhatzop@gmail.com">nhatzop@gmail.com</a>&gt; wrote:<br>
&gt;         &gt;         why you don&#39;t try rgb2pct<br>
&gt;         <a href="http://www.gdal.org/rgb2pct.html" target="_blank">http://www.gdal.org/rgb2pct.html</a>?<br>
&gt;         &gt;<br>
&gt;         &gt;         --Nikos Hatzopoulos<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;         On Wed, Jun 8, 2011 at 2:20 PM, Jonathan Greenberg<br>
&gt;         &gt;         &lt;<a href="mailto:greenberg@ucdavis.edu">greenberg@ucdavis.edu</a>&gt; wrote:<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;                 Folks:<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;                 I am using a piece of software which is<br>
&gt;         relying on an<br>
&gt;         &gt;                 older version of GDAL that doesn&#39;t have the<br>
&gt;         &quot;fix&quot; to<br>
&gt;         &gt;                 deal with &gt; 8 bit geotiffs (it is trying to<br>
&gt;         make a<br>
&gt;         &gt;                 jpeg overlay but can&#39;t from a 16 bit image.<br>
&gt;          I think<br>
&gt;         &gt;                 this is the issue:<br>
&gt;         &gt;<br>
&gt;         <a href="http://trac.osgeo.org/gdal/wiki/TIFF12BitJPEG" target="_blank">http://trac.osgeo.org/gdal/wiki/TIFF12BitJPEG</a>), but<br>
&gt;         &gt;                 when I do a straight convert (-ot Byte) the<br>
&gt;         output<br>
&gt;         &gt;                 image looks really washed out.  Any hints<br>
&gt;         for getting<br>
&gt;         &gt;                 the best quality output from a 16 bit to to<br>
&gt;         an 8 bit<br>
&gt;         &gt;                 conversion of a Geotiff?<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;                 --j<br>
&gt;         &gt;<br>
&gt;         &gt;                 --<br>
&gt;         &gt;                 Jonathan A. Greenberg, PhD<br>
&gt;         &gt;                 Assistant Project Scientist<br>
&gt;         &gt;                 Center for Spatial Technologies and Remote<br>
&gt;         Sensing<br>
&gt;         &gt;                 (CSTARS)<br>
&gt;         &gt;                 Department of Land, Air and Water Resources<br>
&gt;         &gt;                 University of California, Davis<br>
&gt;         &gt;                 One Shields Avenue<br>
&gt;         &gt;                 Davis, CA 95616<br>
&gt;         &gt;                 Phone: <a href="tel:415-763-5476" value="+14157635476">415-763-5476</a><br>
&gt;         &gt;                 AIM: jgrn307, MSN: <a href="mailto:jgrn307@hotmail.com">jgrn307@hotmail.com</a>,<br>
&gt;         Gchat: jgrn307<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         _______________________________________________<br>
&gt;         &gt;                 gdal-dev mailing list<br>
&gt;         &gt;                 <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt;         &gt;<br>
&gt;         <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; --<br>
&gt;         &gt; Jonathan A. Greenberg, PhD<br>
&gt;         &gt; Assistant Project Scientist<br>
&gt;         &gt; Center for Spatial Technologies and Remote Sensing (CSTARS)<br>
&gt;         &gt; Department of Land, Air and Water Resources<br>
&gt;         &gt; University of California, Davis<br>
&gt;         &gt; One Shields Avenue<br>
&gt;         &gt; Davis, CA 95616<br>
&gt;         &gt; Phone: <a href="tel:415-763-5476" value="+14157635476">415-763-5476</a><br>
&gt;         &gt; AIM: jgrn307, MSN: <a href="mailto:jgrn307@hotmail.com">jgrn307@hotmail.com</a>, Gchat: jgrn307<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; _______________________________________________<br>
&gt;         &gt; gdal-dev mailing list<br>
&gt;         &gt; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt;         &gt; <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Jonathan A. Greenberg, PhD<br>
&gt; Assistant Project Scientist<br>
&gt; Center for Spatial Technologies and Remote Sensing (CSTARS)<br>
&gt; Department of Land, Air and Water Resources<br>
&gt; University of California, Davis<br>
&gt; One Shields Avenue<br>
&gt; Davis, CA 95616<br>
&gt; Phone: <a href="tel:415-763-5476" value="+14157635476">415-763-5476</a><br>
&gt; AIM: jgrn307, MSN: <a href="mailto:jgrn307@hotmail.com">jgrn307@hotmail.com</a>, Gchat: jgrn307<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gdal-dev mailing list<br>
&gt; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>