Opened 17 years ago
Closed 9 years ago
#1867 closed enhancement (invalid)
HFARasterBand::GetColorInterpretation can't report RGB colorspace
Reported by: | mrosen | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | Kyle Shannon |
Description
HFARasterBand::GetColorInterpretation can't report RGB colorspace.
I'm attaching two files to illustrate the issue
- an AUX file for an RGB image.
- an IMG file for a grayscale image.
In both cases gdalinfo reports ColorInterp=Undefined for all bands. Using the fix below, the bands are reported correctly. ==========================
/************************************************************************/ /* GetColorInterpretation() */ /************************************************************************/ GDALColorInterp HFARasterBand::GetColorInterpretation() { HFADataset *poHDS = (HFADataset *) poDS; if (poHDS->nBands == 3) { switch (nBand) { case 1: return GCI_BlueBand; case 2: return GCI_GreenBand; case 3: return GCI_RedBand; } } else if (poCT != NULL) { return GCI_PaletteIndex; } else if (poHDS->nBands == 1) return GCI_GrayIndex; return GCI_Undefined; /* if( poCT != NULL ) return GCI_PaletteIndex; else return GCI_Undefined; */ }
Attachments (1)
Change History (6)
by , 17 years ago
Attachment: | AuxFileTest.aux added |
---|
comment:1 by , 17 years ago
the IMG file was too big to attach. see me if you need it. the patch is pretty straightforward though.
comment:2 by , 13 years ago
Is there a reason considering that a 3 band should be always interpreted as RGB ?
comment:3 by , 13 years ago
In general, it seems like it's more right than wrong. I imagine there are cases where is this wrong (BGR and NIR-G-B come to mind -- though I don't know if there are such HFA files in practice).
It would be great if the driver could read metadata to ensure that colorinterp is reported correctly... but I could not see how that would work. Absent that, I think that assuming a 3 band image is RGB is a better choice than saying it's undefined ... at least it was for cases we were dealing with ;-).
comment:4 by , 9 years ago
Cc: | added |
---|
comment:5 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
AFAIK the ERDAS Imagine HFA format is not made to support such interpretation. Layers are labeled individually to thematic/athematic layers. Format does not assign certain source bands to fixed R G B channel for visualization. For example the example in ERDAS Field guide on page 135 shows athematic layers 3-2-1 as R-G-B http://www.ltrs.uri.edu/teaching/FieldGuide.pdf.
Closing as invalid. Reopen if you do not agree and add some clarification why.
rgb aux file