
선형 색상 공간이 있어야 한다고 생각되는 tiff 이미지가 있습니다.
exiftool alps.tif
ExifTool Version Number : 11.88
File Name : alps.tif
Directory : .
File Size : 2.1 GB
File Modification Date/Time : 2022:05:15 14:13:32+02:00
File Access Date/Time : 2022:06:09 18:42:11+02:00
File Inode Change Date/Time : 2022:06:08 17:03:37+02:00
File Permissions : rw-------
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Image Width : 38160
Image Height : 15930
Bits Per Sample : 32
Compression : LZW
Photometric Interpretation : BlackIsZero
Samples Per Pixel : 1
Planar Configuration : Chunky
Predictor : None
Tile Width : 256
Tile Length : 256
Tile Offsets : (Binary data 99752 bytes, use -b option to extract)
Tile Byte Counts : (Binary data 63037 bytes, use -b option to extract)
Sample Format : Float
Pixel Scale : 0.000277777777777778 0.000277777777777778 0
Model Tie Point : 0 0 0 5.79999999999998 48.1251388888889 0
Geo Tiff Version : 1.1.0
GT Model Type : Geographic
GT Raster Type : Pixel Is Area
Geographic Type : WGS 84
Geog Citation : WGS 84
Geog Angular Units : Angular Degree
Geog Semi Major Axis : 6378137
Geog Inv Flattening : 298.257223563
Image Size : 38160x15930
Megapixels : 607.9
이 이미지를 김프 2.10에서 열면 sRGB라고 나옵니다.
김프 2.10에서 내보낸 이미지의 Exiftool은 다음과 같습니다.
exiftool /dev/shm/slask.tiff
ExifTool Version Number : 11.88
File Name : slask.tiff
Directory : /dev/shm
File Size : 1217 kB
File Modification Date/Time : 2022:06:09 18:51:55+02:00
File Access Date/Time : 2022:06:09 18:52:07+02:00
File Inode Change Date/Time : 2022:06:09 18:51:55+02:00
File Permissions : rw-rw-r--
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Image Width : 512
Image Height : 512
Bits Per Sample : 32
Compression : Uncompressed
Photometric Interpretation : BlackIsZero
Document Name : /dev/shm/slask.tiff
Image Description : Created with GIMP
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 128
X Resolution : 300
Y Resolution : 300
Planar Configuration : Chunky
Page Name : Bakgrund
Resolution Unit : inches
Subfile Type : Reduced-resolution image
Strip Offsets : 1049421
Strip Byte Counts : 196608
Sample Format : Float
Profile CMM Type : Little CMS
Profile Version : 4.3.0
Profile Class : Display Device Profile
Color Space Data : GRAY
Profile Connection Space : XYZ
Profile Date Time : 2022:06:09 16:48:40
Profile File Signature : acsp
Primary Platform : Apple Computer Inc.
CMM Flags : Not Embedded, Independent
Device Manufacturer :
Device Model :
Device Attributes : Reflective, Glossy, Positive, Color
Rendering Intent : Perceptual
Connection Space Illuminant : 0.9642 1 0.82491
Profile Creator : Little CMS
Profile ID : 0
Profile Description : GIMP built-in D65 Linear Grayscale
Profile Copyright : Public Domain
Media White Point : 0.95045 1 1.08905
Gray Tone Reproduction Curve : (Binary data 16 bytes, use -b option to extract)
Device Mfg Desc : GIMP
Device Model Desc : D65 Linear Grayscale
Image Size : 512x512
Megapixels : 0.262
Thumbnail TIFF : (Binary data 196824 bytes, use -b option to extract)
/dev/shm/slask.tiff
내 가설을 테스트하기 위해 색상 해석 데이터를 에서 까지 할당하고 싶습니다 alps.tif
. 픽셀 값을 변경하고 싶지 않습니다. 메타데이터만 업데이트하고 싶은데 김프를 통해서는 불가능한 것 같습니다.
사용할 수는 있지만 tificc
GeoTIFF 태그가 제거되는 것으로 보이며 geotifcp를 사용하여 태그를 다시 추가하려고 하면 강도 해석이 사라집니다.
답변1
이 솔루션이 실제로 만족스럽지는 않지만 내 스스로 작업을 수행하고 픽셀 값을 exr 파일에 덤프할 수 있습니다.
//@ {"target":{"name":"geotiff2exr.o", "pkgconfig_libs":["OpenEXR"]}}
#include "./geotiff_loader.hpp"
#include "./file.hpp"
#include <OpenEXR/ImfIO.h>
#include <OpenEXR/ImfOutputFile.h>
#include <OpenEXR/ImfChannelList.h>
int main(int argc, char** argv)
{
if(argc != 3)
{
fprintf(stderr, "Usage: geotiff2exr input output\n");
return 1;
}
auto tiff = make_tiff(argv[1]);
auto const info = get_image_info(tiff.get());
auto pixels = load_floats(tiff.get(), info);
auto src_ptr = static_cast<float const*>(pixels.get());
auto const w = info.size.sizes[0];
auto const h = info.size.sizes[1];
Imf::Header header{static_cast<int>(w), static_cast<int>(h)};
header.channels().insert("Y", Imf::Channel{Imf::FLOAT});
Imf::FrameBuffer fb;
fb.insert("Y",
Imf::Slice{Imf::FLOAT,
(char*)(src_ptr),
sizeof(float),
sizeof(float) * w});
Imf::OutputFile dest{argv[2], header};
dest.setFrameBuffer(fb);
dest.writePixels(h);
return 0;
}