How to get FoV/DoF/HF for resized images?

Started by Marsu42, April 12, 2015, 05:01:23 PM

Previous topic - Next topic

Marsu42

There are a couple of calculated composite values with "(this value and any derived values may be incorrect if the image has been resized)". I wonder if it wouldn't be possible to have an override for these as running exiftool on images that were exported from an editor should be a very common scenario.

I understand the basic problem is that the original metapixie count isn't known and not contained in the usual tags? If so, exiftool could either have a lookup table for the common camera models or at least give the user the option to specify the well-known sensor resolution like in (example off the top of my hat):

exiftool -SensorSize=5568x3708 -DoF exported_from_adobe.jpg

Phil Harvey

The solution I would recommend is to write FocalLengthIn35mmFormat for all of the resized images, something like this:

exiftool "-FocalLengthIn35mmFormat<${focalLength;$_*=1.5}" DIR

(which imposes a ScaleFactor35efl of 1.5 on all images in DIR)

This has the advantage of fixing the problem at the source, so that afterward you don't need any special arguments when extracting your DOF from various files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Marsu42

Quote from: Phil Harvey on April 12, 2015, 08:29:16 PM
The solution I would recommend is to write FocalLengthIn35mmFormat for all of the resized images, something like this:
exiftool "-FocalLengthIn35mmFormat<${focalLength;$_*=1.5}" DIR
(which imposes a ScaleFactor35efl of 1.5 on all images in DIR)

1. I already saw your comment on having both FocalLength and FocalLengthIn35mmFormat in another thread (https://exiftool.org/forum/index.php/topic,6369.msg31603.html#msg31603) and was about to ask anyway b/c I might be misunderstanding these tags: I've got a Canon 6d, i.e. a "full frame" camera with a 35mm-ish sensor. The cr2/whatever files only contain the FocalLength tags. In this case, shouldn't be both equivalent?

2. Sorry to have caused confusion, but what I'd like to do is to calculate FoV/DoF/HF for a *cropped*, but *not* resized image - which (at least for me, ymmv) is the usual state after image editing with Lightroom. I then feed this full-res, but cropped image to a script for tagging & watermarking with ImageMagick and exiftool.

2a) FoV of the cropped image: For this calculation, exiftool would need the original image/sensor size, that's why I came up with giving -SensorSize=a*b in the first place.

2b) DoF & HF of the cropped image: This should be the same no matter how much the image was cropped, so if I get around the (in the ff case, questionable?) requirement for FocalLengthIn35mmFormat, everything should be fine?

Phil Harvey

Quote from: Marsu42 on April 12, 2015, 09:02:12 PM
1. I already saw your comment on having both FocalLength and FocalLengthIn35mmFormat in another thread (https://exiftool.org/forum/index.php/topic,6369.msg31603.html#msg31603) and was about to ask anyway b/c I might be misunderstanding these tags: I've got a Canon 6d, i.e. a "full frame" camera with a 35mm-ish sensor. The cr2/whatever files only contain the FocalLength tags. In this case, shouldn't be both equivalent?

Sure, they are equivalent, so just do this:

exiftool "-focallengthin35mmformat<focallength" DIR

And doing so will allow ExifTool to calculate the scaling factor (which is 1).

Quote2. Sorry to have caused confusion, but what I'd like to do is to calculate FoV/DoF/HF for a *cropped*, but *not* resized image

Oh. Then you will have to specify the appropriate crop factor (not 1).

Quote2a) FoV of the cropped image: For this calculation, exiftool would need the original image/sensor size, that's why I came up with giving -SensorSize=a*b in the first place.

ExifTool needs only FocalLength and ScaleFactor35efl to calculate FoV. 

Quote2b) DoF & HF of the cropped image: This should be the same no matter how much the image was cropped, so if I get around the (in the ff case, questionable?) requirement for FocalLengthIn35mmFormat, everything should be fine?

I don't have a lot of time to think about this now.  Intuitively one would think that DoF does not change when the image is cropped.  But it does.  I can't explain this right now, but the equations bear this out.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Marsu42

Quote from: Phil Harvey on April 13, 2015, 07:30:03 AM
I don't have a lot of time to think about this now.  Intuitively one would think that DoF does not change when the image is cropped.  But it does.  I can't explain this right now, but the equations bear this out.

Riiiight ... I guess the logic as that by cropping, you're actually magnifying (given the same view parameters) the blur spot, so the DoF gets thinner? I'll inquire in a photography forum, this is all too confusing for my limited understanding :-o, but thanks for the insight so far.