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

Linux: Image join issue while stitching using command #27

Open
juniorwebunitygames opened this issue Jun 27, 2017 · 26 comments
Open

Linux: Image join issue while stitching using command #27

juniorwebunitygames opened this issue Jun 27, 2017 · 26 comments

Comments

@juniorwebunitygames
Copy link

When i am trying to stitch gear360 image using command from linux. Image not join properly.
image

@ultramango
Copy link
Owner

Is the image coming from first or second generation of Gear360? For the second generation of Gear360 the template is still far from perfect.

And anyway - I would expect the template not to fit all photos properly.

@evertvorster
Copy link

I suspect that the Gear360 cameras are not 100% exactly same placed in all the cameras. I'm working on making a tutorial to calibrate the .pto for each camera

@ultramango
Copy link
Owner

Correct.

I was also thinking about a tutorial how to tune the .pto but you might actually beat me to it.

There's also a possibility to try make Hugin to automatically adjust the lens' parameters, but I expect the result to be poor.

@neuhaus
Copy link
Contributor

neuhaus commented Jul 4, 2017

Such a tutorial would be great. I sometimes take hundreds of pictures with a car rooftop mount so creating a pto for this purpose would be worthwhile.

@ftoledo
Copy link

ftoledo commented Jul 5, 2017

very good!

@evertvorster
Copy link

Hugin video template generation.txt

Lens_Calibrations.zip

That is the beginnings of the guide on how to calibrate lenses to your Samsung Gear360.

-Evert-

@utack
Copy link

utack commented Nov 22, 2017

Can this optimizer step be included in the .cmd?
I am not educated about hugin exactly works, but could you use the control points from the preset .pto, apply the transformation to get the approximate results, as it is done right now, and then run an additional hugin step that optimizes the initial estimate further, based on how well the content at the border matches?
Or is there some fundamental flaw in my expectation of what hugin does/can do?
Thanks

@ultramango
Copy link
Owner

Hi,

You can't use control points from pto file to get better alignment (1). If you try to do it you would end-up with the same or similar alignment. Think about it that Hugin doesn't know anything about the image(s) behind the control points - all it does it tries its best to transform (think: adjusting some numbers) the_control_points from both images so that they fit well.
So... having the same control points you will end up with same/similar transformation (1) ergo same problem with alignment.

Generic solution would be to detect control points on both halves of the photo - unfortunately for double circular fish-eye it doesn't work very well (it doesn't work) - so control points have to be placed manually.

The pto files are based (mostly) on my camera, I suppose it works well for most of them, but, as someone already mentioned somewhere, every camera will differ a bit and for you the difference.

Please use this video as a starting guide: https://www.youtube.com/watch?v=QKQGT8VUN8g using your photo and add more control points, then play with optimise.

After your post I will try harder to create a better guide to creation of control points and what effect each parameter has in the optimisation pane.

(1) to be 100% correct it is theoretically possible that you could end-up with a better fit, i.e. "better" optimum solution for this optimisation problem.

L.

@ultramango
Copy link
Owner

To extend a bit more the part about the control points, for things to work the way you think you'd have to know how those pieces have to match together to make the alignment better - for human it's easy to say, for machine - that's a pretty hard problem.

@utack
Copy link

utack commented Nov 22, 2017

oh yes, that makes a lot of sense what you explained, thank you!
What I mostly saw as disturbing artifarct was, that horizontal lines do not match
Do you think there is a way to transform all control points in one hemisphere slightly up or down based on a parameter, to account for that, without going through the entire process of re-calibrating for every camera?
It sounds complicated though, because you can't just add a single offset to all points

@ultramango
Copy link
Owner

There are a couple of parameters that can be adjusted and "straighten" the photo (not sure if it is always possible). But it is beyond this commend to explain it (various distortions, rotations, etc.). It looks like one lens needs more "distortion" + slight position adjustment.

What you can do - use the video tutorial, stop at the moment when two photos are added (as separate lenses) then select from File "Apply template" and select pto file apprioprate for your camera.
Then select "Fast Preview panorama" (toolbar icon with "GL") and then select "Move/Drag" tab - you will be then able to move photos around by dragging them (left-click and hold).

L.

@utack
Copy link

utack commented Dec 12, 2017

Can I also open the pto in hugin an manually adjust the control points, based on images from my camera?

@ultramango
Copy link
Owner

Hmm... yes.

There are two ways of doing it (sorry, not verified, straight from my memory).

Method 1.

  1. Inspect .pto file what's the name of the image (I think it is dummy.jpg).
  2. Rename your image file to file from point 1.
  3. Open .pto file in Hugin.
  4. You should see the .ptos control points.

Method 2.

  1. Open Hugin.
  2. Add image file twice (follow the video tutorial) - images have to have separate lenses.
  3. File -> Apply Template and then select the template file.
  4. Original control points from .pto file will not be visible.

L.

@utack
Copy link

utack commented Dec 12, 2017

@ultramango i have gotten that far, and adjusted a few control points
so far i see no effect on the outcome, but i guess once i adjusted them all correctly, it should show good results?

@ultramango
Copy link
Owner

Once you have control points - play with "optimisation" tab/options. Or just find "Optimise" button - this should find new, hopefully, better panorama parameters.

@utack
Copy link

utack commented Dec 12, 2017

can I also move the existing ones, by eye?

@ultramango
Copy link
Owner

Well, best if you removed existing (I mean the "old" ones) datapoints as they apply for a different photo, not yours.

@utack
Copy link

utack commented Dec 12, 2017

I moved some of them to better match my image, but the stitched result from your script using the new pto is exactly the same
Am I missing something here?

@ultramango
Copy link
Owner

Ensure new .pto file is saved.
Check output file(s) date and time (has they really been updated)?
Use "-a" parameter that will force regeneration of the files.

@utack
Copy link

utack commented Dec 12, 2017

Edit:
Works now
Maybe @juniorwebunitygames my file works better for your camera too

gear360sm-c200_.zip

@evertvorster
Copy link

evertvorster commented Dec 14, 2017 via email

@utack
Copy link

utack commented Dec 15, 2017

Is it possible my lens is poorly shaped?
I have tried to set control points and optimize twice, from scratch, and wasted about 4h with this.
Every time i got a fit that worked perfectly on one stitch side, but had quite the offset on the other stitch side

@evertvorster
Copy link

evertvorster commented Dec 16, 2017 via email

@utack
Copy link

utack commented Dec 16, 2017

@evertvorster I finally got it
Thank you for writing up this tutorial again 👍

@utack
Copy link

utack commented Dec 26, 2017

Can I just copy and paste my custom viewfield, pitch/roll/yaw and d parameter from my photo .pto into the 4k video.pto, or is it more tricky to adopt that file?
I noticed this repo has entirely different lens parmaters for photo, 4k video and 2k video .pto
Thanks

@evertvorster
Copy link

evertvorster commented Dec 27, 2017 via email

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

6 participants