Hi Nathan, My initial suspicion might just be that the scaling the data provider did to go from the raw data to a human-eye-friendly RGB composite isn't the conversion you're assuming.
I know that with the data I regularly work with, it may be provided as Uint16, but the data range doesn't extend all the way to 65535. If you compare the values in the separate R and G images to the RGB composite, do they appear to match the conversion you're assuming, or is there a different scaling (and possibly offset)? Cheers, Daniel On Mon, 22 Apr 2024, 15:20 Raley, Nathan via gdal-dev, < gdal-dev@lists.osgeo.org> wrote: > I currently have a RGB geotiff composite image that has a Byte datatype. > I also have individual band images for R, G, Redge, and NIR that are UInt16 > datatypes. Since I’m missing the Blue band from the individual bands, I > was attempting to extract the blue band from the RGB composite image, scale > it up to the UInt16 datatype, and build a composite VRT with R, G, B, NIR, > RE bands included in it. I was then attempting to extract the RGB bands > from the multispec VRT in order to see if the process was working as > intended, but I’m getting an extremely blue image. > > Can anyone shed some light as to what I may be doing wrong here? > > I started by building a VRT for each band: > > gdal_translate source_RGB.tif b.vrt -ot UInt16 -of VRT -b 3 -scale 0 255 0 > 65535 > > gdalbuildvrt -b 1 r.vrt source_R.tif > gdalbuildvrt -b 1 g.vrt source_G.tif > gdalbuildvrt -b 1 nir.vrt source_NIR.tif > gdalbuildvrt -b 1 re.vrt source_RE.tif > > > > I then merged the VRTs: > > gdalbuildvrt -separate multispec.vrt r.vrt g.vrt b.vrt nir.vrt re.vrt > > > > I now have a multispec.vrt with the R, G, B, NIR, and RE bands, all with a > UInt16 datatype. > > > > Now, I attempted to rebuild a RGB GeoTiff from the composite VRT with > something like: > > gdal_translate -ot Byte -of GTiff -b 1 -b 2 -b 3 -scale 0 65535 0 255 -co > PHOTOMETRIC=RGB multispec.vrt multispec.tif > > > > Viewing the result in QGIS appears overly blue. What am I doing wrong > here? > > > > Thanks, > > Nathan > > > ------------------------------ > This email transmission, including any attachments, is intended solely for > the addressee named above, and may contain confidential or privileged > information. If you are not the intended recipient, be aware that any > disclosure, copying, distribution or use of the contents of this e-mail is > prohibited. If you have received this e-mail in error, please notify the > sender immediately by reply email and destroy the message and its > attachments. > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev