MCPcopy Create free account
hub / github.com/colmap/colmap / SetImageSpecColorSpace

Function SetImageSpecColorSpace

src/colmap/sensor/bitmap.cc:95–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void SetImageSpecColorSpace(OIIO::ImageSpec& image_spec,
96 const OIIO::string_view& colorspace) {
97 EnsureOpenImageIOInitialized();
98#if OIIO_VERSION >= OIIO_MAKE_VERSION(3, 0, 0)
99 image_spec.set_colorspace(colorspace);
100#else
101 // Extract logic from 3.0.0 version for backwards compatibility.
102 const OIIO::string_view oldspace =
103 image_spec.get_string_attribute("oiio:ColorSpace");
104 if (oldspace.size() && colorspace.size() && oldspace == colorspace) {
105 return;
106 }
107
108 if (colorspace.empty()) {
109 image_spec.erase_attribute("oiio:ColorSpace");
110 } else {
111 image_spec.attribute("oiio:ColorSpace", colorspace);
112 }
113
114 if (colorspace != "sRGB") {
115 image_spec.erase_attribute("Exif:ColorSpace");
116 }
117
118 image_spec.erase_attribute("tiff:ColorSpace");
119 image_spec.erase_attribute("tiff:PhotometricInterpretation");
120 image_spec.erase_attribute("oiio:Gamma");
121#endif
122}
123
124bool IsEquivalentColorSpace(const std::string_view& colorspace1,
125 const std::string_view& colorspace2) {

Callers 2

BitmapMethod · 0.85
WriteMethod · 0.85

Calls 3

sizeMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected