本文整理汇总了C++中exifdata::const_iterator::value方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::value方法的具体用法?C++ const_iterator::value怎么用?C++ const_iterator::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exifdata::const_iterator
的用法示例。
在下文中一共展示了const_iterator::value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exifPrint
void exifPrint(const ExifData& exifData)
{
ExifData::const_iterator i = exifData.begin();
for (; i != exifData.end(); ++i) {
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
}
示例2: Error
void Rw2Image::readMetadata()
{
#ifdef DEBUG
std::cerr << "Reading RW2 file " << io_->path() << "\n";
#endif
if (io_->open() != 0) {
throw Error(9, io_->path(), strError());
}
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (!isRw2Type(*io_, false)) {
if (io_->error() || io_->eof()) throw Error(14);
throw Error(3, "RW2");
}
clearMetadata();
std::ofstream devnull;
printStructure(devnull, kpsRecursive, 0);
ByteOrder bo = Rw2Parser::decode(exifData_,
iptcData_,
xmpData_,
io_->mmap(),
io_->size());
setByteOrder(bo);
// A lot more metadata is hidden in the embedded preview image
// Todo: This should go into the Rw2Parser, but for that it needs the Image
PreviewManager loader(*this);
PreviewPropertiesList list = loader.getPreviewProperties();
// Todo: What if there are more preview images?
if (list.size() > 1) {
#ifndef SUPPRESS_WARNINGS
EXV_WARNING << "RW2 image contains more than one preview. None used.\n";
#endif
}
if (list.size() != 1) return;
ExifData exifData;
PreviewImage preview = loader.getPreviewImage(*list.begin());
Image::AutoPtr image = ImageFactory::open(preview.pData(), preview.size());
if (image.get() == 0) {
#ifndef SUPPRESS_WARNINGS
EXV_WARNING << "Failed to open RW2 preview image.\n";
#endif
return;
}
image->readMetadata();
ExifData& prevData = image->exifData();
if (!prevData.empty()) {
// Filter duplicate tags
for (ExifData::const_iterator pos = exifData_.begin(); pos != exifData_.end(); ++pos) {
if (pos->ifdId() == panaRawId) continue;
ExifData::iterator dup = prevData.findKey(ExifKey(pos->key()));
if (dup != prevData.end()) {
#ifdef DEBUG
std::cerr << "Filtering duplicate tag " << pos->key()
<< " (values '" << pos->value()
<< "' and '" << dup->value() << "')\n";
#endif
prevData.erase(dup);
}
}
}
// Remove tags not applicable for raw images
static const char* filteredTags[] = {
"Exif.Photo.ComponentsConfiguration",
"Exif.Photo.CompressedBitsPerPixel",
"Exif.Panasonic.ColorEffect",
"Exif.Panasonic.Contrast",
"Exif.Panasonic.NoiseReduction",
"Exif.Panasonic.ColorMode",
"Exif.Panasonic.OpticalZoomMode",
"Exif.Panasonic.Contrast",
"Exif.Panasonic.Saturation",
"Exif.Panasonic.Sharpness",
"Exif.Panasonic.FilmMode",
"Exif.Panasonic.SceneMode",
"Exif.Panasonic.WBRedLevel",
"Exif.Panasonic.WBGreenLevel",
"Exif.Panasonic.WBBlueLevel",
"Exif.Photo.ColorSpace",
"Exif.Photo.PixelXDimension",
"Exif.Photo.PixelYDimension",
"Exif.Photo.SceneType",
"Exif.Photo.CustomRendered",
"Exif.Photo.DigitalZoomRatio",
"Exif.Photo.SceneCaptureType",
"Exif.Photo.GainControl",
"Exif.Photo.Contrast",
"Exif.Photo.Saturation",
"Exif.Photo.Sharpness",
"Exif.Image.PrintImageMatching",
"Exif.Image.YCbCrPositioning"
};
for (unsigned int i = 0; i < EXV_COUNTOF(filteredTags); ++i) {
ExifData::iterator pos = prevData.findKey(ExifKey(filteredTags[i]));
if (pos != prevData.end()) {
#ifdef DEBUG
std::cerr << "Exif tag " << pos->key() << " removed\n";
#endif
prevData.erase(pos);
}
//.........这里部分代码省略.........
示例3: if
//.........这里部分代码省略.........
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.Image.ApertureValue"));
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.Photo.ApertureValue"));
if (i != exifData.end())
meta->aperture = i->toFloat();
i = exifData.findKey(ExifKey("Exif.Image.FocalLength"));
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.Photo.FocalLength"));
if (i != exifData.end())
meta->focallength = i->toFloat()-0.01;
#if EXIV2_TEST_VERSION(0,19,0)
i = isoSpeed(exifData);
if (i != exifData.end())
meta->iso = i->toLong();
/* Text based Lens Identifier */
i = lensName(exifData);
if (i != exifData.end())
{
TypeId type = i->typeId();
if (type == unsignedShort || type == unsignedLong || type == signedShort || type == signedLong || type == unsignedByte || type == signedByte)
meta->lens_id = i->toLong();
else if (type == asciiString || type == string)
meta->fixed_lens_identifier = g_strdup(i->toString().c_str());
}
#endif
/* Canon*/
i = exifData.findKey(ExifKey("Exif.CanonCs.Lens"));
if (i != exifData.end()
&& i->value().count() >= 3
&& i->value().typeId() == unsignedShort)
{
float fu = i->value().toFloat(2);
if (fu != 0.0)
{
meta->lens_min_focal = i->toFloat(0) / fu;
meta->lens_max_focal = i->toFloat(1) /fu;
}
}
i = exifData.findKey(ExifKey("Exif.CanonCs.MinAperture"));
if (i != exifData.end())
meta->lens_min_aperture = (gfloat) exp(CanonEv(i->toFloat())*log(2)/2);
i = exifData.findKey(ExifKey("Exif.CanonCs.MaxAperture"));
if (i != exifData.end())
meta->lens_max_aperture = (gfloat) exp(CanonEv(i->toFloat())*log(2)/2);
/* Olympus */
i = exifData.findKey(ExifKey("Exif.OlympusEq.MinFocalLength"));
if (i != exifData.end())
meta->lens_min_focal = i->toFloat();
i = exifData.findKey(ExifKey("Exif.OlympusEq.MaxFocalLength"));
if (i != exifData.end())
meta->lens_max_focal = i->toFloat();
/* Nikon */
i = exifData.findKey(ExifKey("Exif.NikonLd1.MinFocalLength"));
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd2.MinFocalLength"));
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd3.MinFocalLength"));
if (i != exifData.end())