本文整理汇总了C++中exiv2::exifdata::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exifDataToString
QString exifDataToString(Exiv2::ExifData exifData) {
if (exifData.empty()) {
return QString(QObject::tr("No EXIF found"));
}
try {
Exiv2::ExifData::const_iterator end = exifData.end();
QString tmpExif, final;
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
const char* tn = i->typeName();
/*std::string str = i->key() << " ";
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< (tn ? tn : "Unknown") << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";*/
tmpExif = "<span style='color:#1cb495;'>" + QString::fromStdString(i->key()).split(".").at(2) + "</span> " +
//QString::number(i->tag()) + "\t" +
//(tn ? tn : "Unknown") + "\t" +
//QString::number(i->count()) + "\t" +
QString::fromStdString(i->value().toString()) + "<br />";
final.append(tmpExif);
}
return final;
} catch(Exiv2::Error& e) {
示例2: getRawExifTag
bool NegativeProcessor::getRawExifTag(const char* exifTagName, dng_string* value) {
Exiv2::ExifData::const_iterator it = m_RawExif.findKey(Exiv2::ExifKey(exifTagName));
if (it == m_RawExif.end()) return false;
value->Set_ASCII((it->print(&m_RawExif)).c_str()); value->TrimLeadingBlanks(); value->TrimTrailingBlanks();
return true;
}
示例3: key
Profile::Ptr Profile::loadFromExiv2Image(const Exiv2::Image* image)
{
Profile::Ptr ptr;
cmsHPROFILE hProfile = 0;
const Exiv2::ExifData& exifData = image->exifData();
Exiv2::ExifKey key("Exif.Image.InterColorProfile");
Exiv2::ExifData::const_iterator it = exifData.findKey(key);
if (it == exifData.end()) {
LOG("No profile found");
return ptr;
}
int size = it->size();
LOG("size:" << size);
QByteArray data;
data.resize(size);
it->copy(reinterpret_cast<Exiv2::byte*>(data.data()), Exiv2::invalidByteOrder);
hProfile = cmsOpenProfileFromMem(data, size);
if (hProfile) {
ptr = new Profile(hProfile);
}
return ptr;
}
示例4: pixelWidth
int RafImage::pixelWidth() const
{
Exiv2::ExifData::const_iterator widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
if (widthIter != exifData_.end() && widthIter->count() > 0) {
return widthIter->toLong();
}
return 0;
}
示例5: pixelHeight
int RafImage::pixelHeight() const
{
Exiv2::ExifData::const_iterator heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
if (heightIter != exifData_.end() && heightIter->count() > 0) {
return heightIter->toLong();
}
return 0;
}
示例6:
const double getExiv2ValueDouble(Exiv2::ExifData& exifData, Exiv2::ExifData::const_iterator it)
{
if(it!=exifData.end() && it->count())
{
return it->toFloat();
}
return 0;
};
示例7: StrTrim
const std::string getExiv2ValueString(Exiv2::ExifData& exifData,Exiv2::ExifData::const_iterator it)
{
if(it!=exifData.end() && it->count())
{
return hugin_utils::StrTrim(it->toString());
};
return std::string("");
};
示例8: getInterpretedRawExifTag
bool NegativeProcessor::getInterpretedRawExifTag(const char* exifTagName, int32 component, uint32* value) {
Exiv2::ExifData::const_iterator it = m_RawExif.findKey(Exiv2::ExifKey(exifTagName));
if (it == m_RawExif.end()) return false;
std::stringstream interpretedValue; it->write(interpretedValue, &m_RawExif);
uint32 tmp;
for (int i = 0; (i <= component) && !interpretedValue.fail(); i++) interpretedValue >> tmp;
if (interpretedValue.fail()) return false;
*value = tmp;
return true;
}
示例9: showExifData
// uses the exiv2 class to readout the exifdata from images
int ExifScout::showExifData(std::string a){
try {
Ui_MainWindow::textEdit->clear();
std::cerr << "ImageFactory::open ";
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(a);
std::cerr << "DONE\n";
assert(image.get() != 0);
std::cerr << "image->readMetadata() ";
image->readMetadata();
std::cerr << "DONE\n";
std::cerr << "Exiv2::ExifData& exifData = image->exifData() ";
Exiv2::ExifData exifData = image->exifData();
std::cerr << "DONE\n";
cout << "Number of found exiv2 data: " << exifData.count() << endl;
if (exifData.empty()) {
Ui_MainWindow::textEdit->setPlainText("No Exif data found in file");
return 1;
}
Exiv2::ExifData::const_iterator end = exifData.end();
std::cerr << "Generate the exif-output ";
QString output;
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
std::string tagname = i->tagName();
if(tagname != std::string("MakerNote") and
tagname.substr(0,2) != "0x"){
// Print out the exif-data in the QtextEdit Field
std::ostringstream oss;
oss << i->tagName() << ":\n " << i->value() << "\n";
output = output+(QString)oss.str().c_str();
}
}
std::cerr << "Done\n";
Ui_MainWindow::textEdit->setPlainText(output);
return 0;
}
//catch (std::exception& e) {
//catch (Exiv2::AnyError& e) {
catch (Exiv2::Error& e) {
std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
return -1;
}
}
示例10: updateExifInfo
void ThumbView::updateExifInfo(QString imageFullPath)
{
Exiv2::Image::AutoPtr exifImage;
QString key;
QString val;
try {
exifImage = Exiv2::ImageFactory::open(imageFullPath.toStdString());
exifImage->readMetadata();
}
catch (Exiv2::Error &error) {
return;
}
Exiv2::ExifData &exifData = exifImage->exifData();
if (!exifData.empty()) {
Exiv2::ExifData::const_iterator end = exifData.end();
infoView->addTitleEntry("Exif");
for (Exiv2::ExifData::const_iterator md = exifData.begin(); md != end; ++md) {
key = QString::fromUtf8(md->tagName().c_str());
val = QString::fromUtf8(md->print().c_str());
infoView->addEntry(key, val);
}
}
Exiv2::IptcData &iptcData = exifImage->iptcData();
if (!iptcData.empty()) {
Exiv2::IptcData::iterator end = iptcData.end();
infoView->addTitleEntry("IPTC");
for (Exiv2::IptcData::iterator md = iptcData.begin(); md != end; ++md) {
key = QString::fromUtf8(md->tagName().c_str());
val = QString::fromUtf8(md->print().c_str());
infoView->addEntry(key, val);
}
}
Exiv2::XmpData &xmpData = exifImage->xmpData();
if (!xmpData.empty()) {
Exiv2::XmpData::iterator end = xmpData.end();
infoView->addTitleEntry("XMP");
for (Exiv2::XmpData::iterator md = xmpData.begin(); md != end; ++md) {
key = QString::fromUtf8(md->tagName().c_str());
val = QString::fromUtf8(md->print().c_str());
infoView->addEntry(key, val);
}
}
}
示例11: print
void print(const std::string& file)
{
Exiv2::ExifData ed;
int rc = ed.read(file);
if (rc) {
std::string error = Exiv2::ExifData::strError(rc, file);
throw Exiv2::Error(error);
}
Exiv2::ExifData::const_iterator end = ed.end();
for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< 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";
}
}
示例12: print
void print(const std::string& file)
{
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData &ed = image->exifData();
Exiv2::ExifData::const_iterator end = ed.end();
for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< 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";
}
}
示例13: ReadMeta
// This is weird because iptc and exif have not been "unified". Once
// they are unified, this DLL should not have to know
// about either... just generic images, keys, values, etc.
//
// buffsize should be the total size of *buff (including space for null)
// Note that if there is more than one entry (for some IPTC datasets) this
// returns the first one found. Currently no way to get the others.
// Returns 0 on success
EXIVSIMPLE_API int ReadMeta(HIMAGE img, const char *key, char *buff, int buffsize)
{
assert(img && key && buff);
if (img==0 || key==0 || buff==0 || buffsize==0) return -1;
ImageWrapper *imgWrap = (ImageWrapper*)img;
int rc = 2;
Exiv2::IptcData &iptcData = imgWrap->image->iptcData();
Exiv2::ExifData &exifData = imgWrap->image->exifData();
try {
// First try iptc
Exiv2::IptcKey iptcKey(key);
rc = 1;
Exiv2::IptcData::const_iterator iter = iptcData.findKey(iptcKey);
if (iter != iptcData.end()) {
strncpy(buff, iter->value().toString().c_str(), buffsize);
buff[buffsize-1] = 0;
rc = 0;
}
}
catch(const Exiv2::AnyError&) {
}
if (rc) {
// No iptc value, so try exif
try {
Exiv2::ExifKey exifKey(key);
rc = 1;
Exiv2::ExifData::const_iterator iter = exifData.findKey(exifKey);
if (iter != exifData.end()) {
strncpy(buff, iter->value().toString().c_str(), buffsize);
buff[buffsize-1] = 0;
rc = 0;
}
}
catch(const Exiv2::AnyError&) {
}
}
return rc;
}
示例14: getExifData
// tries to find a specified exif tag in a specified file
QString ExifScout::getExifData(QString fname, QString etag){
std::string filename = fname.toAscii().data();
std::string exiftag = etag.toAscii().data();
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData exifData = image->exifData();
if (!exifData.empty()) {
Exiv2::ExifData::const_iterator end = exifData.end();
QString output;
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
if(i->tagName()==exiftag){
std::ostringstream oss;
oss << i->value();
return (QString)oss.str().c_str();
}
}
}
return NULL;
}
示例15: main
int main(int argc, char* const argv[])
try {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " file\n";
return 1;
}
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
if (image.get() == 0) {
std::string error(argv[1]);
error += " : Could not read file or unknown image type";
throw Exiv2::Error(error);
}
// Load existing metadata
int rc = image->readMetadata();
if (rc) {
std::string error = Exiv2::Image::strError(rc, argv[1]);
throw Exiv2::Error(error);
}
Exiv2::ExifData &exifData = image->exifData();
Exiv2::ExifData::const_iterator end = exifData.end();
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
std::cout << std::setw(53) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::dec << i->value()
<< "\n";
}
return rc;
}
catch (Exiv2::Error& e) {
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return -1;
}