Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compute focal length when images lack EXIF data? #669

Closed
zharvey-welltok opened this issue Nov 4, 2016 · 8 comments
Closed

How to compute focal length when images lack EXIF data? #669

zharvey-welltok opened this issue Nov 4, 2016 · 8 comments

Comments

@zharvey-welltok
Copy link

zharvey-welltok commented Nov 4, 2016

In a previous question I was using openMVG_main_SfMInit_ImageListing without the -f argument. I was also using images that did not have focal length info in their EXIF data, and so the resulting sfm_data.json had (essentially) UINTMAX set for each view's id_intrinsic value.

In that question I was advised by @pmoulon to re-run openMVG_main_SfMInit_ImageListing with a focal length of -f 1.2*1920 = -f 2304.

I'm wondering what the two magic numbers (1.2 and 1920) came from, and how to derive them on other image sets in the future. Any ideas? Thanks in advance!

@polto
Copy link

polto commented Nov 5, 2016

@zharvey-welltok , 1920 was supposed to be the width of your sensor in pixels and 1.2µ sensor's pixel size.
You should be able to find both parameters from sensor documentation.
Regards.

@zharvey-welltok
Copy link
Author

zharvey-welltok commented Nov 5, 2016

Thanks @polto but how did @pmoulon know what my sensor was?!? My point being that he somehow found out what my sensor was (my smart phone) and was able to look up the width & pixel size. I'm wondering how he did that since I will be processing images from cameras and sources whose make/model info I will not have access to.

So there has to be something in the EXIF data, or some other way to detect sensor make/model info.

@pmoulon
Copy link
Member

pmoulon commented Nov 5, 2016

Here the explanation about the values:

  • 1920 comes from max (width,height) for your dataset,
  • 1.2 is a scaling_ratio coming from the FoV of your camera
    • For example if we simulate a 45 degrees of viewing angle
      • the focal_ratio will be => 0.5/tan(0.5 * FoV) => 0.5/tan(0.5 * 45/180*3.14) => 1.2

Then according those you can approximate the focal length as focal_ratio * max(w,h) => 1.2 * 1920

This formula provides a good guess for SfM if your camera have a "classical fov" near than 45.

@zharvey-welltok
Copy link
Author

Thanks @pmoulon, this is all starting to make sense! When you say:

"1920 comes from max (width,height) for your dataset"

...do you mean that my sfm_data.json contained width/height information, and that's where you obtained the 1920 from?

@pmoulon
Copy link
Member

pmoulon commented Nov 5, 2016

You can either look to the max size from the JSON or just open the image properties and look to the image size.

@zharvey-welltok
Copy link
Author

As always, thanks @pmoulon 👍

@pmoulon
Copy link
Member

pmoulon commented Nov 5, 2016

You're welcome, I'm happy to help and explain things.
Perhaps those information must be somehow expressed into the online sphinx documentation ...

@caomw
Copy link

caomw commented Nov 5, 2016

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants