How to identify lenses / request: lens id hash for lens_info

Started by Marsu42, August 25, 2013, 04:56:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marsu42

I would like to make some ml settings lens-dependent, i.e. auto-switch them when changing lenses. Question is: How to I tell one lens from the other the easiest way, ideally w/o comparing strings like name (do have all lenses this field?) and multiple properties like min/max aperture?

If there is no easy way atm, I'd like to request a lens_id field for the lens_info struct where all unique lens properties are distilled into one easy, unique hash or number you that can be quickly compared and saved in a config value. Rather than doing this in a module imho this should be so useful it'd be better done in the ml core and added to lens.h

a1ex

Yep, a lens_id field sounds very good. IIRC, g3gg0 also found a lens serial number.

Marsu42

Quote from: a1ex on August 25, 2013, 04:59:42 PM
Yep, a lens_id field sounds very good. IIRC, g3gg0 also found a lens serial number.

Question again is if all lenses have a serial number (I doubt it, I remember some of mine not having one), plus a unique id like a serial number always privacy issues if it's not used just internally but saved to a config file. So imho distilling all the unique properties of a lens into a hash s reasonable, the danger of hash collisions with a small hash like crc8/16 should be low.

Walter Schulz

I'm sure you both know it for a long time ...
Here are the known lens IDs and their associated names:
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#LensType

No lens ID for lenses without electronic coupling, of course: Samyang (aka Walimex, aka Walimex) and everything coupled by M42 adapters and so on.

Ciao
Walter

Marsu42

Quote from: Walter Schulz on August 25, 2013, 05:42:52 PM
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#LensType

... it says "Decimal values have been added to differentiate lenses which would otherwise have the same LensType, and are used by the Composite LensID tag when attempting to identify the specific lens model."

According to the exiftool source Canon.pm this is what Phil Harvey does: "Attempt to identify the specific lens if multiple lenses have the same LensType, Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength, 4) MaxAperture, 5) LensModel" ... that's probably also what ml should do, no need to invent the wheel twice as pravdomil recently stated :-)