diff --git a/TinyEXIF.cpp b/TinyEXIF.cpp index 203276f..29d2942 100644 --- a/TinyEXIF.cpp +++ b/TinyEXIF.cpp @@ -934,6 +934,9 @@ int EXIFInfo::parseFromXMPSegment(const uint8_t* buf, unsigned len) { document->QueryDoubleAttribute("drone-dji:GimbalRollDegree", &GeoLocation.RollDegree); document->QueryDoubleAttribute("drone-dji:GimbalPitchDegree", &GeoLocation.PitchDegree); document->QueryDoubleAttribute("drone-dji:GimbalYawDegree", &GeoLocation.YawDegree); + document->QueryDoubleAttribute("drone-dji:CalibratedFocalLength", &Calibration.FocalLength); + document->QueryDoubleAttribute("drone-dji:CalibratedOpticalCenterX", &Calibration.OpticalCenterX); + document->QueryDoubleAttribute("drone-dji:CalibratedOpticalCenterY", &Calibration.OpticalCenterY); } return PARSE_SUCCESS; @@ -1025,6 +1028,11 @@ void EXIFInfo::clear() { ProjectionType = 0; SubjectArea.clear(); + // Calibration + Calibration.FocalLength = 0; + Calibration.OpticalCenterX = 0; + Calibration.OpticalCenterY = 0; + // LensInfo LensInfo.FocalLengthMax = 0; LensInfo.FocalLengthMin = 0; diff --git a/TinyEXIF.h b/TinyEXIF.h index 689fab0..8be452a 100644 --- a/TinyEXIF.h +++ b/TinyEXIF.h @@ -239,6 +239,11 @@ public: // 2: location of the main subject as coordinates (first value is the X coordinate and second is the Y coordinate) // 3: area of the main subject as a circle (first value is the center X coordinate, second is the center Y coordinate, and third is the diameter) // 4: area of the main subject as a rectangle (first value is the center X coordinate, second is the center Y coordinate, third is the width of the area, and fourth is the height of the area) + struct TINYEXIF_LIB Calibration_t { // Camera calibration information + double FocalLength; // Focal length (pixels) + double OpticalCenterX; // Principal point X (pixels) + double OpticalCenterY; // Principal point Y (pixels) + } Calibration; struct TINYEXIF_LIB LensInfo_t { // Lens information double FStopMin; // Min aperture (f-stop) double FStopMax; // Max aperture (f-stop) diff --git a/main.cpp b/main.cpp index 9d6686f..8ef1538 100644 --- a/main.cpp +++ b/main.cpp @@ -100,6 +100,12 @@ int main(int argc, const char** argv) std::cout << "MeteringMode " << imageEXIF.MeteringMode << "\n"; std::cout << "LightSource " << imageEXIF.LightSource << "\n"; std::cout << "ProjectionType " << imageEXIF.ProjectionType << "\n"; + if (imageEXIF.Calibration.FocalLength != 0) + std::cout << "Calibration.FocalLength " << imageEXIF.Calibration.FocalLength << " pixels" << "\n"; + if (imageEXIF.Calibration.OpticalCenterX != 0) + std::cout << "Calibration.OpticalCenterX " << imageEXIF.Calibration.OpticalCenterX << " pixels" << "\n"; + if (imageEXIF.Calibration.OpticalCenterY != 0) + std::cout << "Calibration.OpticalCenterY " << imageEXIF.Calibration.OpticalCenterY << " pixels" << "\n"; std::cout << "LensInfo.FStopMin " << imageEXIF.LensInfo.FStopMin << "\n"; std::cout << "LensInfo.FStopMax " << imageEXIF.LensInfo.FStopMax << "\n"; std::cout << "LensInfo.FocalLengthMin " << imageEXIF.LensInfo.FocalLengthMin << " mm" << "\n";