I have an image from NASA PDS archive, named 2n289977682xylb0eop1965l0m1, with .IMG extension. It’s a multiband image in BSQ format; the file starts with a label (which is also downloaded separately as .LBL file); the important part of the label is this one:
/* IMAGE DATA ELEMENTS */
OBJECT = IMAGE
INTERCHANGE_FORMAT = BINARY
LINES = 1024
LINE_SAMPLES = 1024
SAMPLE_TYPE = IEEE_REAL
SAMPLE_BITS = 32
BANDS = 3
BAND_STORAGE_TYPE = BAND_SEQUENTIAL
CHECKSUM = 1.57131e+09
FIRST_LINE = 1
FIRST_LINE_SAMPLE = 1
MAXIMUM = 4016.0
MEAN = 1498.52
MEDIAN = 1450.0
MINIMUM = 0.0
SAMPLE_BIT_MASK = 2#0000111111111111#
STANDARD_DEVIATION = 296.218
INVALID_CONSTANT = (0.0,0.0,0.0)
MISSING_CONSTANT = (0.0,0.0,0.0)
END_OBJECT
It’s a “Band SeQuential” image (BSQ); its size is 1024x1024. The file contains 3 different “bands”, which represent X, Y and Z coordinates of a 3d object.
A direct conversion to “something visible” results in this:
Instead, what I need to get is a greyscale image where each pixel has a gray value representing the Z value of the model, which is known as “depth map”:
By loading a depth map together with a companion image in this page, you get a 3d model.
I think the above RGB image has been obtained by merging the 3 bands; Instead I need to extract the 3 bands in 3 separated images.
An alternative useful output would be a text file in XYZ format, where each line contains just 3 values separated by space: each line contains values from the 3 bands, in this way:
Can G’MIC be used for these tasks? I am on Windows 10.
I found a strange page which converts online IMG file into text; it’s quite slow in converting 1 million bytes into several millions characters, but after some experiments I ended up converting a part of the image, which gives an idea of how the 3d model should look: it’s very elongated going away from the observer, and very low; ideally it would fit in a 100 x 10 x 1000 box.