本文整理汇总了C++中exiv2::exifdata::iterator::count方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::count方法的具体用法?C++ iterator::count怎么用?C++ iterator::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::exifdata::iterator
的用法示例。
在下文中一共展示了iterator::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getImageOrientation
MetaEngine::ImageOrientation MetaEngine::getImageOrientation() const
{
try
{
Exiv2::ExifData exifData(d->exifMetadata());
Exiv2::ExifData::iterator it;
long orientation;
ImageOrientation imageOrient = ORIENTATION_NORMAL;
// -- Standard Xmp tag --------------------------------
#ifdef _XMP_SUPPORT_
bool ok = false;
QString str = getXmpTagString("Xmp.tiff.Orientation");
if (!str.isEmpty())
{
orientation = str.toLong(&ok);
if (ok)
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "Orientation => Xmp.tiff.Orientation => " << (int)orientation;
return (ImageOrientation)orientation;
}
}
#endif // _XMP_SUPPORT_
// Because some camera set a wrong standard exif orientation tag,
// We need to check makernote tags in first!
// -- Minolta Cameras ----------------------------------
Exiv2::ExifKey minoltaKey1("Exif.MinoltaCs7D.Rotation");
it = exifData.findKey(minoltaKey1);
if (it != exifData.end() && it->count())
{
orientation = it->toLong();
qCDebug(DIGIKAM_METAENGINE_LOG) << "Orientation => Exif.MinoltaCs7D.Rotation => " << (int)orientation;
switch(orientation)
{
case 76:
imageOrient = ORIENTATION_ROT_90;
break;
case 82:
imageOrient = ORIENTATION_ROT_270;
break;
}
return imageOrient;
}
Exiv2::ExifKey minoltaKey2("Exif.MinoltaCs5D.Rotation");
it = exifData.findKey(minoltaKey2);
if (it != exifData.end() && it->count())
{
orientation = it->toLong();
qCDebug(DIGIKAM_METAENGINE_LOG) << "Orientation => Exif.MinoltaCs5D.Rotation => " << (int)orientation;
switch(orientation)
{
case 76:
imageOrient = ORIENTATION_ROT_90;
break;
case 82:
imageOrient = ORIENTATION_ROT_270;
break;
}
return imageOrient;
}
// -- Standard Exif tag --------------------------------
Exiv2::ExifKey keyStd("Exif.Image.Orientation");
it = exifData.findKey(keyStd);
if (it != exifData.end() && it->count())
{
orientation = it->toLong();
qCDebug(DIGIKAM_METAENGINE_LOG) << "Orientation => Exif.Image.Orientation => " << (int)orientation;
return (ImageOrientation)orientation;
}
}
catch( Exiv2::Error& e )
{
d->printExiv2ExceptionError(QString::fromLatin1("Cannot parse Exif Orientation tag using Exiv2 "), e);
}
catch(...)
{
qCCritical(DIGIKAM_METAENGINE_LOG) << "Default exception from Exiv2";
}
return ORIENTATION_UNSPECIFIED;
}
示例2: getImageDimensions
QSize MetaEngine::getImageDimensions() const
{
try
{
long width=-1, height=-1;
// Try to get Exif.Photo tags
Exiv2::ExifData exifData(d->exifMetadata());
Exiv2::ExifKey key("Exif.Photo.PixelXDimension");
Exiv2::ExifData::iterator it = exifData.findKey(key);
if (it != exifData.end() && it->count())
width = it->toLong();
Exiv2::ExifKey key2("Exif.Photo.PixelYDimension");
Exiv2::ExifData::iterator it2 = exifData.findKey(key2);
if (it2 != exifData.end() && it2->count())
height = it2->toLong();
if (width != -1 && height != -1)
return QSize(width, height);
// Try to get Exif.Image tags
width = -1;
height = -1;
Exiv2::ExifKey key3("Exif.Image.ImageWidth");
Exiv2::ExifData::iterator it3 = exifData.findKey(key3);
if (it3 != exifData.end() && it3->count())
width = it3->toLong();
Exiv2::ExifKey key4("Exif.Image.ImageLength");
Exiv2::ExifData::iterator it4 = exifData.findKey(key4);
if (it4 != exifData.end() && it4->count())
height = it4->toLong();
if (width != -1 && height != -1)
return QSize(width, height);
#ifdef _XMP_SUPPORT_
// Try to get Xmp.tiff tags
width = -1;
height = -1;
bool wOk = false;
bool hOk = false;
QString str = getXmpTagString("Xmp.tiff.ImageWidth");
if (!str.isEmpty())
width = str.toInt(&wOk);
str = getXmpTagString("Xmp.tiff.ImageLength");
if (!str.isEmpty())
height = str.toInt(&hOk);
if (wOk && hOk)
return QSize(width, height);
// Try to get Xmp.exif tags
width = -1;
height = -1;
wOk = false;
hOk = false;
str = getXmpTagString("Xmp.exif.PixelXDimension");
if (!str.isEmpty())
width = str.toInt(&wOk);
str = getXmpTagString("Xmp.exif.PixelYDimension");
if (!str.isEmpty())
height = str.toInt(&hOk);
if (wOk && hOk)
return QSize(width, height);
#endif // _XMP_SUPPORT_
}
catch( Exiv2::Error& e )
{
d->printExiv2ExceptionError(QString::fromLatin1("Cannot parse image dimensions tag using Exiv2 "), e);
}
catch(...)
{
qCCritical(DIGIKAM_METAENGINE_LOG) << "Default exception from Exiv2";
}
return QSize();
}