Author Topic: Apply adjustment factor to {lens} variable?  (Read 4758 times)

Offline jr_ed

  • Newcomer
  • *
  • Posts: 17
    • View Profile
Apply adjustment factor to {lens} variable?
« on: November 15, 2014, 06:17:04 PM »
I was hoping to report the 35mm lens equivalent for a super-zoom camera I am using (Fujifilm X-S1), but both the {lens} and {lens35} variable report the actual focal length for this camera. Is there any way to set my own adjustment factor to get {lens35} (or some variable) to report the 35mm-equivalent focal length? Or more generally, is there any way to apply simple math to a variable (so if {lens} reports 50 and I have a scale factor of 4, I can get it to print out 200 by using an equation of variable*4)?

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Apply adjustment factor to {lens} variable?
« Reply #1 on: November 15, 2014, 06:51:10 PM »
I was hoping to report the 35mm lens equivalent for a super-zoom camera I am using (Fujifilm X-S1), but both the {lens} and {lens35} variable report the actual focal length for this camera. Is there any way to set my own adjustment factor to get {lens35} (or some variable) to report the 35mm-equivalent focal length? Or more generally, is there any way to apply simple math to a variable (so if {lens} reports 50 and I have a scale factor of 4, I can get it to print out 200 by using an equation of variable*4)?

You can't do any mathematics in variables expansion, but you can certainly use Code Replacement to map lens values to any other value you like.

http://wiki.camerabits.com/en/index.php?title=User_Manual_Flat_View#Code_Replacement

-Kirk

Offline jr_ed

  • Newcomer
  • *
  • Posts: 17
    • View Profile
Re: Apply adjustment factor to {lens} variable?
« Reply #2 on: November 17, 2014, 11:26:28 PM »
Perhaps I'm missing something, but code replacement is a limited to replacing one string with another string, correct? Thus if I had fields with discrete values I could build a look-up table (say to translate \{iso}\ to display DIN values). But for something like focal length that is reported as a floating-point value like 26.7 and 158.6, I'm not sure how I could translate that.
« Last Edit: November 17, 2014, 11:28:30 PM by jr_ed »

Offline Mick O (Camera Bits)

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 553
    • View Profile
    • Camera Bits
Re: Apply adjustment factor to {lens} variable?
« Reply #3 on: November 18, 2014, 02:53:44 PM »
Hi jr_ed,

We rely on the manufacturer to add lens35 data, and unfortunately Fuji is not doing that with the X-S1

So, what I did is use Excel to create a table with all the focal lengths from f=6.1 - 158.6 mm,  incremented by .1 and then did a 2nd column multiplying that by 4 and rounding it off to whole numbers.  I saved this as a Tab Separated text file.

Then, in case you ever wanted to use numbers in other Code Replacements, I added a prefix of lens35- to each line.  I've attached the file for you to try, though since I don't have an XS-1 I can't test it out.

Once you load this file into Photo Mechanic,  using the Code Replacement of  \lens35-{lens}\  in your metadata in Photo Mechanic *should* then return your 35mm equivalent focal length.

Let me know if this works.

-Mick


[attachment deleted by admin]
Mick O
Camera Bits

Offline jr_ed

  • Newcomer
  • *
  • Posts: 17
    • View Profile
Re: Apply adjustment factor to {lens} variable?
« Reply #4 on: February 26, 2015, 12:31:59 AM »
Sorry for the very slow reply (I haven't used this camera in a while), but your concept worked.

To add a bit more detail for anyone else who may want to use this technique, my lens' actual focal length is listed as 6.1-158.6mm, which is listed as being 24-624mm in 35mm equivalent range. I have also found a few EXIF entries where {lens} evaluates to 6, so I created a table like you starting with 6.0 and increasing in 0.1 increments up to 158.6. I then took each of those values and multiplied them by (624/158.6) to create the 35mm equivalent (which is more precise than the approximate 4x value I gave you before that you used to create your table). I then added the lens35- prefex to that first column as you did, saved it as tab-delimited text file, and have attached the resulting file.

This has allowed me to enter a string like this (containing shooting info):

X-S1 @ {lens}mm (\lens35-{lens}\mm) f{f} {ss}s ISO{iso}

which then evaluates to strings like these (where the code replacement gives the 35mm-equivalent in the parenthesis):

X-S1 @ 158.6mm (624mm) f5.6 1/250s ISO1000
X-S1 @ 6mm (24mm) f2.8 1/30s ISO250
X-S1 @ 31.1mm (122mm) f4.5 1/160s ISO1000

So this meets my needs. (Now we just need someone to create a simple script of some kind to generate tables like this for other cameras where people know the actual and 35mm-equivalent focal ranges for those who may not be handy in Excel.)

Thanks again for your help.


[attachment deleted by admin]