简体   繁体   English

cr2提取具有特定焦距的图像

[英]cr2 extract images with a specific focal length

I have some cr2 files. 我有一些cr2文件。

I would like to make a C++ program, or write a script, that separates the different cr2 files with different focal lengths, and puts them in separate directories. 我想制作一个C ++程序或编写一个脚本,以不同的焦距分隔不同的cr2文件,并将它们放在单独的目录中。

How can I do that ? 我怎样才能做到这一点 ?

I have access to the Canon EDSDK and LibRaw but i am not sure where i can find the focal length information. 我可以访问佳能EDSDK和LibRaw,但不确定在哪里可以找到焦距信息。

I also have a little utility "ExifTool" that can read the metadata - but i don't know how to get it to do something i want - and the gui version seems to crash when reading 5000 files over the network... 我还有一个小的实用程序“ ExifTool”,可以读取元数据-但我不知道如何使它做我想做的事-通过网络读取5000个文件时,gui版本似乎崩溃了...

Please can somebody give me a suggestion ? 请有人可以给我一个建议吗?

The EXIF specification can be found here: 可在此处找到EXIF规范:

http://www.exif.org/specifications.html http://www.exif.org/specifications.html

You will need to read the EXIF data, and find the entry which contains a "tag" of 37386 or 0x920A. 您将需要读取EXIF数据,并找到包含37386或0x920A的“标记”的条目。 This is followed by a "RATIONAL" number, which is essentially two unsigned integers forming a fraction, for example 400/20 = 20 mm, as is 80/5 or 20/1. 这之后是“ RATIONAL”数字,该数字实质上是两个无符号整数,形成一个分数,例如400/5/20 = 20 mm,80/5或20/1。 A 14.5mm lens would have to be (at least) stored as 29/2, but could be stored as 145/10 or 1450/100 - or a large number of other variants. 14.5mm的镜头必须(至少)以29/2的形式存储,但可以以145/10或1450/100的形式存储-或存储大量其他变体。

Of course, if you use for example ExifTool, you can easily do this with a script, or use it's Perl binding to write a script in Perl. 当然,如果使用例如ExifTool,则可以使用脚本轻松完成此操作,或者使用它的Perl绑定在Perl中编写脚本。

There is also a C++ interface to use with exiftool: http://owl.phy.queensu.ca/~phil/cpp_exiftool/ 还有一个与exiftool一起使用的C ++接口: http ://owl.phy.queensu.ca/~phil/cpp_exiftool/

Using the TagInfo that you get back from ImageInfo() , it should be possible to find the FocalLength and move the files accordingly. 使用从TagInfo ImageInfo()返回的TagInfo ,应该可以找到FocalLength并相应地移动文件。

I'm not going to write the code for you, but the above information should be able to give you an idea. 我不会为您编写代码,但是以上信息应该可以使您有所了解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM