Why am I getting an error warning about extrasamples with geotiffwrite ?
13 views (last 30 days)
Show older comments
When I call geotiffwrite I receive an error warning, and I do not understand why. My call is as follows ...
geotiffwrite(FilenameOutput,RGBdata,R,‘CoordRefSysCode’,‘EPSG:4283');
RGBdata is 9601 x 13441 x 3 (double)
R is a GeographicCellsReference with properties that include RasterSize: [9601 13441] that is consistent with RGBdata
I cannot see where there are any ExtraSamples (e.g., Alpha informtion) in my call. I am trying to supply just 3 Photometric color channels per pixel.
I have placed a Service Request (case 03924628), but surprisingly and with disappointment, I am not getting useful assistance. I am hoping that someone else may be able to help.
The warning is ...
=====
Warning: Sum of Photometric color channels and ExtraSamples does not match the value specified in SamplesPerPixel.
Writing with this configuration will error in a future release. To correct the configuration, define the non-color channels as ExtraSamples.
In Tiff/writeAllTiles (line 2254)
In Tiff/write (line 1480)
In geotiffwrite>writeImage (line 1510)
In geotiffwrite>writeGeoTiffFile (line 1492)
In geotiffwrite (line 271)
In HSI_image (line 582)
In HSI_2019_FAA_B1_20191216 (line 259)
=====
2 Comments
Accepted Answer
Walter Roberson
on 21 Dec 2019
geotiffwrite function assignTiffTags assumes that RGB images are only uint8 or uint16 . You are passing in double, so it thinks you are doing a grayscale image with Extra Samples, except that it does not construct an Extra Samples tag to account for the possibility.
The workaround is
geotiffwrite([FilenameOutput '_test'],RGBdata,R,'CoordRefSysCode',['EPSG:4283'], 'tifftags', struct('Photometric', Tiff.Photometric.RGB));
4 Comments
More Answers (0)
See Also
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!