insta 360

Asked by Emmanuel on 2019-02-08

Hello,

I'm using a insta360 pro (6 fisheyes lenses) and I would like to create a script to automate stitching by using hugin command line.

I have a bunch of questions :
- How can I know the HFOV/Focal length and crop factor, the only thing I've found on the insta360 specs is the focal length of 1.9
- How the control point finding is depending on this 3 parameters ? As If I change the FOV/focal length/crop factor cpfind is not able to find the same number of points.
- Is it possible to constraint cpfind to find more points, my average control point is around 100 for 6 pictures (30 points per picture)
- with the 6 fixed lenses of the insta360 would it be possible to manually set the control points and reuse the control points to stitch another image as the hardware and the focal/aperture is fixed ?

Here is a sample
https://framadrop.org/r/ars6U6UUbY#BIjhfaiN2UJOyL+HHpq8YyCMZUAE+wj9pged6zi1oBg=

Thanks for your help and for your work on this great open source tool.
Emmanuel.

Question information

Language:
English Edit question
Status:
Answered
For:
Hugin Edit question
Assignee:
No assignee Edit question
Last query:
2019-02-13
Last reply:
2019-02-13
tmodes (tmodes) said : #1

> I'm using a insta360 pro (6 fisheyes lenses) and I would like to create a script to
> automate stitching by using hugin command line.
For this use case have a look at https://wiki.panotools.org/Panorama_scripting_in_a_nutshell#Simple_command-line_stitching which is probably suited for your use case.

>- How can I know the HFOV/Focal length and crop factor, the only thing I've found
> on the insta360 specs is the focal length of 1.9
Try a HFOV of 180...190 deg and "circular fisheye" projection. Don't forget the mask the black edges as first step after loading.

>- How the control point finding is depending on this 3 parameters ? As If I change
> the FOV/focal length/crop factor cpfind is not able to find the same number of points.
see https://wiki.panotools.org/Cpfind#Rectilinear_and_fisheye_images

> - Is it possible to constraint cpfind to find more points, my average control point is
> around 100 for 6 pictures (30 points per picture)
Play around with the sieve parameters. see FAQ https://wiki.panotools.org/Hugin_FAQ#cpfind:_not_enough_control_points_generated and more details in cpfind description https://wiki.panotools.org/Cpfind#Extended_options

> - with the 6 fixed lenses of the insta360 would it be possible to manually set the
> control points and reuse the control points to stitch another image as the
> hardware and the focal/aperture is fixed ?
If the lenses are fixed it should be possible to create a template once and then reuse this template without the need to create new control points and without doing re-optimizations. Either use the template (in GUI File>Apply template or pto_template) on the new pto file or use the template directly with nona and specify only the new image names (as described in https://wiki.panotools.org/Panorama_scripting_in_a_nutshell#Simple_command-line_stitching )

Emmanuel (emmanuel-sale) said : #2

Thanks for your ansers, I am already using the scripting nutshell.

pto_gen -p 2 -f 170 -o template.pto origin_0.tif origin_1.tif origin_2.tif origin_3.tif origin_4.tif origin_5.tif
cpfind -celeste --sieve1size=1000 --sieve1width=20 --sieve1height=20 --fullscale -o template.pto template.pto
celeste_standalone -i template.pto -o template.pto
linefind -o template.pto template.pto
cpclean -o template.pto template.pto
autooptimiser -a -l -s -m -o template.pto template.pto
nona -o out -m TIFF_m template.pto origin_0.tif origin_1.tif origin_2.tif origin_3.tif origin_4.tif origin_5.tif
enblend --primary-seam-generator=nft -o out.tif out0000.tif out0001.tif out0002.tif out0003.tif out0004.tif out0005.tif

I've tried several value for f : 170 180 190 160 130 ... without any success
My input file are circle cropped with transparent background to match the fisheye circle. Is it ok or do I need to add mask even if the outside circle is already transparent ?

tmodes (tmodes) said : #3

> I've tried several value for f : 170 180 190 160 130 ... without any success
That's difficult to say with this. It works fine here with a fov of 180...190.
Open the generated pto file before remapping and check what's wrongs.

>My input file are circle cropped with transparent background to match the
>fisheye circle. Is it ok or do I need to add mask even if the outside circle is
>already transparent ?
That should be ok. I tested with your provided jpg image. And these don't contain an alpha channel.

There are some minor issues with your script:
cpfind -celeste ..
celeste_standalone -i template.pto -o template.pto ...
This is running twice the same code. When using cpfind with --celeste you don't need an additional call to celeste_standalone. This has already take into account by cpfind --celeste.

pto_gen -p 2 -f 170 -o template.pto origin_0.tif origin_1.tif ...
nona -o out -m TIFF_m template.pto origin_0.tif origin_1.tif ...
When you provide the image name to pto_gen you don't need to specify the same names to nona. There are already saved in the pto file and are used by default.

Emmanuel (emmanuel-sale) said : #4

--> This is running twice the same code. When using cpfind with --celeste you don't need an additional call to celeste_standalone. This has already take into account by cpfind --celeste.
--> When you provide the image name to pto_gen you don't need to specify the same names to nona. There are already saved in the pto file and are used by default.

Right , I've correct this part.

but I can't figure out what is wrong in the pto project.
Please find attached the picture and the project, maybe you will spot the issue.
https://framadrop.org/r/_oAzFHma7A#6f8Qg83pxSmK1TvUHvbjeNTeHKoodFoUK7LbUNLeS5o=

Thanks for your help, I don't understand, I can get a proper equi panorama from these pictures.

Emmanuel (emmanuel-sale) said : #5

This is the script that I'm using to generate the pano from

pto_gen -p 2 -f 167.9 -o template.pto origin_3.tif origin_4.tif origin_5.tif origin_0.tif origin_1.tif origin_2.tif
pto_var --opt "v,d,e,g,t,Er,Eb,Vb,Vc,Vd,Vx,Vy,Ra,Rb,Rc,Rd,Re,y,p,r,TrX,TrY,TrZ,b" -o template.pto
cpfind --celeste --sieve1size=1000 --sieve1width=20 --sieve1height=20 --sieve2width=20 --sieve2height=20 --sieve2size=5 -o template.pto template.pto
linefind -o template.pto template.pto
cpclean -o template.pto template.pto
autooptimiser -a -l -s -m -o template.pto template.pto
nona -o out -m TIFF_m template.pto
enblend --primary-seam-generator=nft -o out.tif out0000.tif out0001.tif out0002.tif out0003.tif out0004.tif out0005.tif

what ever the fov I've used the result is bad.

tmodes (tmodes) said : #6

> but I can't figure out what is wrong in the pto project.
You did not mask all of the black borders. There is still a small remaining part of the black border.
This is visible in the preview.
The second issue is fov is in Hugin the *horizontal* field of view. In the first example you used landscape images, in the second the images were in portrait orientation. So either use only one orientation, or you need different fov for landscape and portrait images.
(so 180-190 for landscape and 140-150 for portrait images). But I would recommend to stick to one orientation and not rotate the images.
I recommend always to do all steps first in the GUI. Only when it works there and you know which steps are needed then you can go to the scripting.

>pto_var --opt "v,d,e,g,t,Er,Eb,Vb,Vc,Vd,Vx,Vy,Ra,Rb,Rc,Rd,Re,y,p,r,TrX,TrY,TrZ,b" -o template.pto
>autooptimiser -a -l -s -m -o template.pto template.pto
The autooptimiser -a switch ignores the seated optimization variables. Also trying to optimize all parameters (incl. TrXYZ) on a complete unoptimized panorama will probably go haywire. Here applies also what I wrote above. Try it first in the GUI, when you know the steps, then it easier to translate it to a script.

Emmanuel (emmanuel-sale) said : #7

I understand what you tell me, I've tried a lot of time on the GUI to make it works, but without any success.

Here are the original pictures coming from the insta360. (no rotation,no cropping)
https://framadrop.org/r/SXG3iHHqtg#mK5WlkPKb7pBxd6FmIsqF7Y1iH9oIQTsIobwFtEvdAw=

I am about to give up as I can't find a way to stitch them at all.

tmodes (tmodes) said : #8

I don't know what's the problem. It works fine here.
I did the following steps.
1.) Load images
2.) Set lens projection to fisheye circular and hfov to 190 deg.
3.) Set the crop in the mask tab in the panorama editor.
4.) Set roll to -90 for all images for correct detection of vertical lines (Panorama editor, photos tab, select all images, context menu Edit image variables -> set roll to -90
5.) Run assistant (Fast panorama preview> align
6.) After running assistant, delete 2 line control points on the ceiling which were incorrectly detected at the timbers.
7.) Run assistant again
8.) Stitch

The stitched jpeg image and the corresponding pto file can be found at
https://framadrop.org/r/VpxXcrkS_d#IK0Ut2RzEQWKGZMjuFGbAlWSwqML0QnU7eFXmvSMKm4=

Otherwise you should be more precise what's wrong.

PS: Steps 2 and 3 needs only be done once. After stitching a first panorama these settings are stored in the lens database and automatically used when adding now a image from the same camera to a new project.

Can you help with this problem?

Provide an answer of your own, or ask Emmanuel for more information if necessary.

To post a message you must log in.