Author Topic: How to identify lenses / request: lens id hash for lens_info  (Read 4503 times)

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
How to identify lenses / request: lens id hash for lens_info
« on: August 25, 2013, 04:56:14 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 12562
Re: How to identify lenses / request: lens id hash for lens_info
« Reply #1 on: August 25, 2013, 04:59:42 PM »
Yep, a lens_id field sounds very good. IIRC, g3gg0 also found a lens serial number.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: How to identify lenses / request: lens id hash for lens_info
« Reply #2 on: August 25, 2013, 05:05:02 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

  • Contributor
  • Hero Member
  • *****
  • Posts: 7879
Re: How to identify lenses / request: lens id hash for lens_info
« Reply #3 on: August 25, 2013, 05:42:52 PM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: How to identify lenses / request: lens id hash for lens_info
« Reply #4 on: August 25, 2013, 06:00:43 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 :-)