我正在使用Exiv2获取照片的元数据。我想使用这些元数据的一些价值。但我不知道如何将exiv2值转换为int。这是我的绳索。如何将const Exiv2 :: Value转换为int
int metadetascanner(const char* img)
{
try
{
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(img);
image->readMetadata();
Exiv2::ExifData &exif = image->exifData();
Exiv2::Exifdatum &rotation = exif["Exif.Image.Orientation"];
if (exif.empty())
{
cerr << "no exif" << endl;
return -1;
}
int a = rotation.value();
return a;
}
catch (Exiv2::Error& e)
{
cout << e.what() << endl;
return -1;
}
}
我只写“int a = rotation.value();”但我知道它不能这样。
如果你能帮助我,我将非常感激你。
我在下面编辑了我的答案。希望它有帮助。 –