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

Find the Focal Length #22

Open
ycuskun opened this issue Apr 7, 2022 · 26 comments
Open

Find the Focal Length #22

ycuskun opened this issue Apr 7, 2022 · 26 comments

Comments

@ycuskun
Copy link

ycuskun commented Apr 7, 2022

Hello,

I have reviewed many stitching works. But your work is very successful, I congratulate you for this.
I want to use it in my own work. But I don't know how to calculate the focal length value. Can you help with this?

@SSARCandy
Copy link
Owner

please refer to this
5096a28

@ycuskun
Copy link
Author

ycuskun commented Apr 7, 2022

How can I learn from the AutoStitch demo application?
Or how did you calculate it?

@SSARCandy
Copy link
Owner

you can try this logic:
image

@ycuskun
Copy link
Author

ycuskun commented Apr 7, 2022

I want to ask one last question;
Can you verify the variables in the image?
p:sensor width
w:object width
f: focal length (the value I need to find)
d: distance from object

Thank you.

@ghost
Copy link

ghost commented Apr 18, 2022

Dear Colleagues,

First of all thank you @SSARCandy for your contribution... Your code is amazing: I ran the code for your sample datasets and it worked perfectly!

However, now I am trying to use it to generate an equirectangular panorama from my own data (Drone Imagery) and the focal length of my data in pixels seems to be too high… so the code is not responding.

I have tried several methods:
First, extracting the focal length from the image exif_metadata:
2BA4010C-BAA6-4DAF-B926-6B9FC40F0FF2

And second, by computing it with the following formula (knowing that my drone has a CMOS sensor of 1´y found the CCD width is 13.2 mm and the focal length in mm 28 (eq. 35mm):
A3C9F289-8050-4B67-A940-6359E9A91A6E

In any case the resulting focal length values are greater than 10000 pixels and the code doesn’t work.
Could you pleas tell me what I am doing wrong?

Thank you very much for your help!

Greetings,
Sebastian

@SSARCandy
Copy link
Owner

hmm is it possible to point out where the code gets stuck?

@ycuskun
Copy link
Author

ycuskun commented Apr 19, 2022

I am also getting the same error as @Sebasmedd26. The code doesn't work when I try it with the pictures I took. The shift value is always zero. Sample output;

5

The part to the left of the stitched image is the first image I took. The part on the right is the fifth. Each new image is overwritten on the right.

@SSARCandy
Copy link
Owner

could you provide test data? I will try reproduce it.

@ycuskun
Copy link
Author

ycuskun commented Apr 19, 2022

panoramic_images.zip

I calculated the focal length as 1600. I calculated like @Sebasmedd26.

@ghost
Copy link

ghost commented Apr 19, 2022 via email

@ycuskun
Copy link
Author

ycuskun commented Apr 19, 2022

yasincuskun@gmail.com

@ghost
Copy link

ghost commented Apr 21, 2022

@SSARCandy I cannot upload the dataset here. It is too heavy (251 mb in .zip).
@ycuskun I already share it with you on GoogleDrive.

Greetings!

@Ning-yuan118
Copy link

@SSARCandy I cannot upload the dataset here. It is too heavy (251 mb in .zip). @ycuskun I already share it with you on GoogleDrive.

Greetings!

I have the same problem as @ycuskun, please help me.

@Ning-yuan118
Copy link

I am also getting the same error as @Sebasmedd26. The code doesn't work when I try it with the pictures I took. The shift value is always zero. Sample output;

5

The part to the left of the stitched image is the first image I took. The part on the right is the fifth. Each new image is overwritten on the right.

Did you solve the problem, please help me!!!!

@SSARCandy
Copy link
Owner

could you check the environment? recommand

  • python3.6
  • opencv3

@Ning-yuan118
Copy link

could you check the environment? recommand

  • python3.6
  • opencv3

I checked the environment, but the shift was always zero. while i used autostitch, the perfomance looks well.

@Ning-yuan118
Copy link

could you check the environment? recommand

  • python3.6
  • opencv3

I don't know whether it's the problem with focal length. Is it a problem with my calculations?

@Ning-yuan118
Copy link

1690786558352
like this

@SSARCandy
Copy link
Owner

hmm I guess some bug in RANSAC algo

@Ning-yuan118
Copy link

thanks for your reply. when i used demo image, it works well. maybe my data is not suitable for the orignal parameters?

@Ning-yuan118
Copy link

my bug is like @ycuskun issue. did you give some solutions to him?

@SSARCandy
Copy link
Owner

RANSAC_THRES_DISTANCE = 3

try adjust this value

@Ning-yuan118
Copy link

1690853409961
I have changed the distance value to 500, but the result seems worse than the past. that's duing to the value focal_length.

@SSARCandy
Copy link
Owner

const.MATCHING_Y_RANGE can also be tune

@Ning-yuan118
Copy link

It still not work well, the image has a resolution of 2560 * 1440. Can it be a problem with image resolution?

@SSARCandy
Copy link
Owner

the matching algo works better if horizontal Y is not offset too much

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

3 participants