SSARCandy / panoramas-image-stitching

🖼 Stitching images into 360 panoramas
https://ssarcandy.tw/2017/05/26/panorama-image-stitching/
214 stars 52 forks source link

Find the Focal Length #22

Open ycuskun opened 2 years ago

ycuskun commented 2 years ago

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 commented 2 years ago

please refer to this https://github.com/SSARCandy/panoramas-image-stitching/commit/5096a286a9e06f647909e4d18105040bb4e6b07a

ycuskun commented 2 years ago

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

SSARCandy commented 2 years ago

you can try this logic: image

ycuskun commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

ycuskun commented 2 years ago

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 commented 2 years ago

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

ycuskun commented 2 years ago

panoramic_images.zip

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

ghost commented 2 years ago

Hey, thank you for the fast reply. Can you give me please an E-Mail address to give you access to the dataset from my Google Drive?

ycuskun @.***> schrieb am Di. 19. Apr. 2022 um 13:10:

Uploading panoramic_images.zip… I calculated the focal length as 1600. I calculated like @Sebasmedd26 https://github.com/Sebasmedd26.

— Reply to this email directly, view it on GitHub https://github.com/SSARCandy/panoramas-image-stitching/issues/22#issuecomment-1102514331, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATQ3B3EKM343T6AYEL4NIJDVF2ICZANCNFSM5SYMO63A . You are receiving this because you were mentioned.Message ID: @.***>

ycuskun commented 2 years ago

yasincuskun@gmail.com

ghost commented 2 years ago

@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 commented 11 months ago

@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 commented 11 months ago

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 commented 11 months ago

could you check the environment? recommand

Ning-yuan118 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

1690786558352 like this

SSARCandy commented 11 months ago

hmm I guess some bug in RANSAC algo

Ning-yuan118 commented 11 months ago

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

Ning-yuan118 commented 11 months ago

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

SSARCandy commented 11 months ago

RANSAC_THRES_DISTANCE = 3

try adjust this value

Ning-yuan118 commented 11 months ago

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 commented 11 months ago

const.MATCHING_Y_RANGE can also be tune

Ning-yuan118 commented 11 months ago

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

SSARCandy commented 11 months ago

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