Skip to content

Commit

Permalink
StImageLoader - detect SBS format for QooCam EGO image files
Browse files Browse the repository at this point in the history
  • Loading branch information
gkv311 committed Sep 28, 2024
1 parent 086e1e3 commit eee665a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
10 changes: 7 additions & 3 deletions StImageViewer/StImageLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,13 @@ bool StImageLoader::loadImage(const StHandle<StFileNode>& theSource,
anEntry.changeValue() = aTime;
}
}
if(myStFormatByUser == StFormat_AUTO
&& aParser.getSrcFormat() != StFormat_AUTO) {
aSrcFormatCurr = aParser.getSrcFormat();
if(myStFormatByUser == StFormat_AUTO) {
if(aParser.getSrcFormat() != StFormat_AUTO) {
aSrcFormatCurr = aParser.getSrcFormat();
} else if(!anImg1.isNull() && anImg2.isNull()
&& anImg1->getQooCamMakerNote(aSrcFormatCurr)) {
//
}
}
aSrcPanorama = aParser.getPanorama();

Expand Down
4 changes: 4 additions & 0 deletions StShared/StExifDir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ bool StExifDir::readDirectory(StExifDir::List& theParentList,
aSubDir = new StExifDir();
aSubDir->IsFileBE = false;
aSubDir->Type = DType_MakerCanon;
} else if(CameraMaker.isStartsWith(stCString("Kandao"))) {
aSubDir = new StExifDir();
aSubDir->IsFileBE = IsFileBE;
aSubDir->Type = DType_MakerKandao;
}
if(!aSubDir.isNull()) {
ST_DEBUG_LOG("StExifDir, reading " + CameraMaker + " maker notes");
Expand Down
25 changes: 25 additions & 0 deletions StShared/StJpegParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,31 @@ bool StJpegParser::Image::get360PanoMakerNote(bool& theIsStereo) const {
return false;
}

bool StJpegParser::Image::getQooCamMakerNote(StFormat& theFormat) const {
if(SizeX != 8000 || SizeY != 3000) {
return false;
}

// we don't have maker note specification - just consider side-by-side pair by side information
StExifDir::Query aQueryMake(StExifDir::DType_General, StExifTags::Image_Make, StExifEntry::FMT_STRING);
if(!StExifDir::findEntry(Exif, aQueryMake)
|| ::strncmp((char* )aQueryMake.Entry.ValuePtr, "Kandao", 6) != 0) {
return false;
}

StExifDir::Query aQueryComment(StExifDir::DType_General, StExifTags::Image_UserComment, StExifEntry::FMT_UNDEFINED);
if(!StExifDir::findEntry(Exif, aQueryComment)
|| aQueryComment.Entry.Components < 9
|| ::strncmp((char* )aQueryComment.Entry.ValuePtr, "ASCII\0\0\0", 8) != 0
|| ::strstr((char* )aQueryComment.Entry.ValuePtr + 8, "EXPINFO0=") == NULL
|| ::strstr((char* )aQueryComment.Entry.ValuePtr + 8, "EXPINFO1=") == NULL) {
return false;
}

theFormat = StFormat_SideBySide_LR;
return true;
}

bool StJpegParser::Image::getParallax(double& theParallax) const {
StExifDir::Query aQuery(StExifDir::DType_MakerFuji, StExifTags::Fuji_Parallax);
if(!StExifDir::findEntry(Exif, aQuery)
Expand Down
1 change: 1 addition & 0 deletions include/StImage/StExifDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class StExifDir {
DType_MakerOlypm, //!< Maker Note sub-directory ("OLYMP")
DType_MakerCanon, //!< Maker Note sub-directory ("Canon")
DType_MakerFuji, //!< Maker Note sub-directory ("FUJIFILM")
DType_MakerKandao,//!< Maker Note sub-directory ("Kandao")
DType_MPO, //!< MP extensions
};

Expand Down
5 changes: 5 additions & 0 deletions include/StImage/StExifTags.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ namespace StExifTags {
extern const StExifTag OLYMP_TAGS[];

enum Image {
Image_ImageWidth = 0x0100,
Image_ImageLength = 0x0101,
Image_Orientation = 0x0112,
Image_DateTime = 0x0132,
Image_Make = 0x010F,
Image_Model = 0x0110,
Image_MakerNote = 0x927C, // matches TAG_MAKER_NOTE
Image_UserComment = 0x9286,
};

enum Fuji {
Expand Down
5 changes: 5 additions & 0 deletions include/StImage/StJpegParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class StJpegParser : public StRawFile {
*/
ST_CPPEXPORT StString getDateTime() const;

/**
* Read QooCam metadata.
*/
ST_CPPEXPORT bool getQooCamMakerNote(StFormat& theFormat) const;

/**
* Read 360Mono and 360Stereo EXIF property.
*/
Expand Down

0 comments on commit eee665a

Please sign in to comment.