All necessary tags completed
This commit is contained in:
parent
779f9d9bab
commit
0a74bc8b34
61
TIFF.cpp
61
TIFF.cpp
@ -5,6 +5,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
static const std::map<TiffTag, std::string> tagDescriptions = {
|
static const std::map<TiffTag, std::string> tagDescriptions = {
|
||||||
{NEW_SUBFILE_TYPE, "New subfile type"},
|
{NEW_SUBFILE_TYPE, "New subfile type"},
|
||||||
@ -37,7 +38,33 @@ static const std::map<TiffTag, std::string> tagDescriptions = {
|
|||||||
{DATE_TIME_ORIGINAL, "Date/time original"},
|
{DATE_TIME_ORIGINAL, "Date/time original"},
|
||||||
{FOCAL_LENGTH, "Focal length (mm)"},
|
{FOCAL_LENGTH, "Focal length (mm)"},
|
||||||
{TIFF_EP_STANDARD_ID, "TIFF/EP standard ID"},
|
{TIFF_EP_STANDARD_ID, "TIFF/EP standard ID"},
|
||||||
{COPYRIGHT_NOTICE, "Copyright notice"}
|
{COPYRIGHT_NOTICE, "Copyright notice"},
|
||||||
|
{DNG_VERSION, "DNG version"},
|
||||||
|
{DNG_BACKWARD_VERSION, "DNG backward version"},
|
||||||
|
{UNIQUE_CAMERA_MODEL, "Unique camera model"},
|
||||||
|
{CFA_PLANE_COLOR, "CFA plane color"},
|
||||||
|
{CFA_LAYOUT, "CFA spatial layout"},
|
||||||
|
{BLACK_LEVEL_REPEAT_DIM, "Black level repeat pattern size"},
|
||||||
|
{BLACK_LEVEL, "Black level"},
|
||||||
|
{WHITE_LEVEL, "White level"},
|
||||||
|
{DEFAULT_SCALE, "Default scale"},
|
||||||
|
{DEFAULT_CROP_ORIGIN, "Default crop origin"},
|
||||||
|
{DEFAULT_CROP_SIZE, "Default crop size"},
|
||||||
|
{COLOR_MATRIX_1, "Color matrix 1"},
|
||||||
|
{COLOR_MATRIX_2, "Color matrix 2"},
|
||||||
|
{CAMERA_CALIBRATION_1, "Camera calibration 1"},
|
||||||
|
{CAMERA_CALIBRATION_2, "Camera calibration 2"},
|
||||||
|
{AS_SHOT_NEUTRAL, "White balance at time of capture"},
|
||||||
|
{BASELINE_EXPOSURE, "Baseline exposure (EV units)"},
|
||||||
|
{CALIBRATION_ILLUMINANT_1, "Calibration illuminant 1"},
|
||||||
|
{CALIBRATION_ILLUMINANT_2, "Calibration illuminant 2"},
|
||||||
|
{ACTIVE_AREA, "Active area of sensor (pixels)"},
|
||||||
|
{FORWARD_MATRIX_1, "Forward matrix 1"},
|
||||||
|
{FORWARD_MATRIX_2, "Forward matrix 2"},
|
||||||
|
{OPCODE_LIST_1, "Opcode list 1"},
|
||||||
|
{OPCODE_LIST_2, "Opcode list 2"},
|
||||||
|
{OPCODE_LIST_3, "Opcode list 3"},
|
||||||
|
{NOISE_PROFILE, "Noise profile"}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &stream, Compression compression) {
|
std::ostream &operator<<(std::ostream &stream, Compression compression) {
|
||||||
@ -107,6 +134,27 @@ std::ostream& operator<<(std::ostream& stream, PlanarConfiguration conf) {
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, CFALayout layout) {
|
||||||
|
switch (layout) {
|
||||||
|
case RECTANGULAR: stream << "rectangular"; break;
|
||||||
|
case STAGGERED_LAYOUT_A: stream << "even columns are offset down by 1/2 row"; break;
|
||||||
|
case STAGGERED_LAYOUT_B: stream << "even columns are offset up by 1/2 row"; break;
|
||||||
|
case STAGGERED_LAYOUT_C: stream << "even rows are offset right by 1/2 column"; break;
|
||||||
|
case STAGGERED_LAYOUT_D: stream << "even rows are offset left by 1/2 column"; break;
|
||||||
|
case STAGGERED_LAYOUT_E: stream << "even rows are offset up by 1/2 row, even columns are offset left by 1/2 column"; break;
|
||||||
|
case STAGGERED_LAYOUT_F: stream << "even rows are offset up by 1/2 row, even columns are offset right by 1/2 column"; break;
|
||||||
|
case STAGGERED_LAYOUT_G: stream << "even rows are offset down by 1/2 row, even columns are offset left by 1/2 column"; break;
|
||||||
|
case STAGGERED_LAYOUT_H: stream << "even rows are offset down by 1/2 row, even columns are offset right by 1/2 column"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, uint8_t value) {
|
||||||
|
stream << (int)value;
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
||||||
size_t vSize = vector.size();
|
size_t vSize = vector.size();
|
||||||
@ -117,7 +165,7 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
|||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << std::setw(0) << "[";
|
ss << std::setw(0) << "[";
|
||||||
for(size_t i = 0; i < vSize; ++i) {
|
for(size_t i = 0; i < vSize; ++i) {
|
||||||
ss << vector[i];
|
ss << vector[i];
|
||||||
if(i < vSize - 1) {
|
if(i < vSize - 1) {
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
}
|
}
|
||||||
@ -176,6 +224,7 @@ void ImageFileDirectory::parseValue(char *filePtr, IfdEntry *entry) {
|
|||||||
case PLANAR_CONFIGURATION: parseValueImpl<PlanarConfiguration>(filePtr, entry); break;
|
case PLANAR_CONFIGURATION: parseValueImpl<PlanarConfiguration>(filePtr, entry); break;
|
||||||
case CFA_REPEAT_PATTERN_DIM: parseValueImpl<CFAPatternDim>(filePtr, entry); break;
|
case CFA_REPEAT_PATTERN_DIM: parseValueImpl<CFAPatternDim>(filePtr, entry); break;
|
||||||
case CFA_PATTERN: parseValueImpl<CFAPattern>(filePtr, entry); break;
|
case CFA_PATTERN: parseValueImpl<CFAPattern>(filePtr, entry); break;
|
||||||
|
case CFA_LAYOUT: parseValueImpl<CFALayout>(filePtr, entry); break;
|
||||||
default: parseValueImpl<T>(filePtr, entry); break;
|
default: parseValueImpl<T>(filePtr, entry); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,16 +290,16 @@ std::optional<ImageFileDirectory::EntryValueType> ImageFileDirectory::operator[]
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImageFileDirectory::dumpInfo() const {
|
void ImageFileDirectory::dumpInfo() const {
|
||||||
std::cout << "=== IFD ====================================================================================================================" << std::endl;
|
std::cout << "=== IFD ====================================================================================================================================" << std::endl;
|
||||||
std::cout << "| Tag | Description | Value |" << std::endl;
|
std::cout << "| Tag | Description | Value |" << std::endl;
|
||||||
std::cout << "----------------------------------------------------------------------------------------------------------------------------" << std::endl;
|
std::cout << "---------------------------------------------------------------------------------------------------------------------------------------------" << std::endl;
|
||||||
std::ios state(nullptr);
|
std::ios state(nullptr);
|
||||||
state.copyfmt(std::cout);
|
state.copyfmt(std::cout);
|
||||||
for(auto const& [key, val]: _entriesMap) {
|
for(auto const& [key, val]: _entriesMap) {
|
||||||
std::visit([key](auto&& arg) {
|
std::visit([key](auto&& arg) {
|
||||||
auto iter = tagDescriptions.find(key);
|
auto iter = tagDescriptions.find(key);
|
||||||
std::string description = iter != tagDescriptions.end() ? iter->second : "";
|
std::string description = iter != tagDescriptions.end() ? iter->second : "";
|
||||||
std::cout << "| " << std::left << std::setw(5) << key << " | " << std::setw(29) << description << " | " << std::setw(80) << arg << " |" << std::endl;
|
std::cout << "| " << std::left << std::setw(5) << key << " | " << std::setw(32) << description << " | " << std::setw(94) << arg << " |" << std::endl;
|
||||||
}, val);
|
}, val);
|
||||||
}
|
}
|
||||||
std::cout.copyfmt(state);
|
std::cout.copyfmt(state);
|
||||||
|
|||||||
42
TIFF.h
42
TIFF.h
@ -61,8 +61,33 @@ enum TiffTag: uint16_t {
|
|||||||
ISO_SPEED_RATINGS = 0x8827,
|
ISO_SPEED_RATINGS = 0x8827,
|
||||||
DATE_TIME_ORIGINAL = 0x9003,
|
DATE_TIME_ORIGINAL = 0x9003,
|
||||||
FOCAL_LENGTH = 0x920A,
|
FOCAL_LENGTH = 0x920A,
|
||||||
TIFF_EP_STANDARD_ID = 0x9216
|
TIFF_EP_STANDARD_ID = 0x9216,
|
||||||
|
DNG_VERSION = 0xC612,
|
||||||
|
DNG_BACKWARD_VERSION = 0xC613,
|
||||||
|
UNIQUE_CAMERA_MODEL = 0xC614,
|
||||||
|
CFA_PLANE_COLOR = 0xC616,
|
||||||
|
CFA_LAYOUT = 0xC617,
|
||||||
|
BLACK_LEVEL_REPEAT_DIM = 0xC619,
|
||||||
|
BLACK_LEVEL = 0xC61A,
|
||||||
|
WHITE_LEVEL = 0xC61D,
|
||||||
|
DEFAULT_SCALE = 0xC61E,
|
||||||
|
DEFAULT_CROP_ORIGIN = 0xC61F,
|
||||||
|
DEFAULT_CROP_SIZE = 0xC620,
|
||||||
|
COLOR_MATRIX_1 = 0xC621,
|
||||||
|
COLOR_MATRIX_2 = 0xC622,
|
||||||
|
CAMERA_CALIBRATION_1 = 0xC623,
|
||||||
|
CAMERA_CALIBRATION_2 = 0xC624,
|
||||||
|
AS_SHOT_NEUTRAL = 0xC628,
|
||||||
|
BASELINE_EXPOSURE = 0xC62A,
|
||||||
|
CALIBRATION_ILLUMINANT_1 = 0xC65A,
|
||||||
|
CALIBRATION_ILLUMINANT_2 = 0xC65B,
|
||||||
|
ACTIVE_AREA = 0xC68D,
|
||||||
|
FORWARD_MATRIX_1 = 0xC714,
|
||||||
|
FORWARD_MATRIX_2 = 0xC715,
|
||||||
|
OPCODE_LIST_1 = 0xC740,
|
||||||
|
OPCODE_LIST_2 = 0xC741,
|
||||||
|
OPCODE_LIST_3 = 0xC74E,
|
||||||
|
NOISE_PROFILE = 0xC761
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PhotometricInterpretation: uint16_t {
|
enum PhotometricInterpretation: uint16_t {
|
||||||
@ -137,6 +162,18 @@ enum CFAPattern: uint8_t {
|
|||||||
WHITE = 6
|
WHITE = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CFALayout: uint16_t {
|
||||||
|
RECTANGULAR = 1,
|
||||||
|
STAGGERED_LAYOUT_A = 2,
|
||||||
|
STAGGERED_LAYOUT_B = 3,
|
||||||
|
STAGGERED_LAYOUT_C = 4,
|
||||||
|
STAGGERED_LAYOUT_D = 5,
|
||||||
|
STAGGERED_LAYOUT_E = 6,
|
||||||
|
STAGGERED_LAYOUT_F = 7,
|
||||||
|
STAGGERED_LAYOUT_G = 8,
|
||||||
|
STAGGERED_LAYOUT_H = 9
|
||||||
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, Compression compression);
|
std::ostream& operator<<(std::ostream& stream, Compression compression);
|
||||||
std::ostream& operator<<(std::ostream& stream, PhotometricInterpretation pr);
|
std::ostream& operator<<(std::ostream& stream, PhotometricInterpretation pr);
|
||||||
template<typename T> std::ostream& operator<<(std::ostream& stream, const RationalType<T>& rational);
|
template<typename T> std::ostream& operator<<(std::ostream& stream, const RationalType<T>& rational);
|
||||||
@ -153,6 +190,7 @@ public:
|
|||||||
PlanarConfiguration, std::vector<PlanarConfiguration>,
|
PlanarConfiguration, std::vector<PlanarConfiguration>,
|
||||||
CFAPatternDim, std::vector<CFAPatternDim>,
|
CFAPatternDim, std::vector<CFAPatternDim>,
|
||||||
CFAPattern, std::vector<CFAPattern>,
|
CFAPattern, std::vector<CFAPattern>,
|
||||||
|
CFALayout, std::vector<CFALayout>,
|
||||||
std::vector<uint8_t>, std::vector<uint16_t>, std::vector<uint32_t>, std::vector<Rational>,
|
std::vector<uint8_t>, std::vector<uint16_t>, std::vector<uint32_t>, std::vector<Rational>,
|
||||||
std::vector<int8_t>, std::vector<int16_t>, std::vector<int32_t>, std::vector<SRational>,
|
std::vector<int8_t>, std::vector<int16_t>, std::vector<int32_t>, std::vector<SRational>,
|
||||||
std::vector<float>, std::vector<double>>;
|
std::vector<float>, std::vector<double>>;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user