This post will show how to stitch a panoramic, equirectangular video with sound using free and open source hugin, nona and enblend programs in three easy steps.
When mounting Nikon FC-E8 conversion lenses the two Canon A570 IS cameras of the streetview rig can record video at 640×480 pixel and 30 fps as circular fisheye videos:
Step 1:
Extract all frames from the two source videos using Avidemux:
Open the left cameras video, set the Start Marker to the start and the End Marker to the end of the video using the horizontal scrollbar. In the menu: File -> Save -> Save Selection as JPEG images. Pick a folder. Repeat with the right cameras video and a different folder. Rename all the files to something like 0000l.jpg and 0001r.jpg. On Ubuntu Linux the Thunar File Manager is very good for this. Copy all files into the a folder named “in”.
For two video files of each ca. 200 MB and 2:17 minutes length you should have 8840 .jpg files sized 25kb to 35kb. All together ca. 250 MB.
Step2:
Stitch panoramas with hugin.
Start hugin. In the menu click File -> Open. Open the “in” folder and mark the files 0001l.jpg and 0001r.jpg. Click OK. In the Camera and Lens data pop-up set Lens Type to “Circular Fisheye” and HFOV (v) to 190. Click OK. In the Images tab mark image 1 (0000r.jpg) and enter 180 for yaw. Mark both images and enter 270 for roll. In the Camera and Lens tab mark image 1 and click New Lens. In the Crop tab mark image 0, untick “Always center crop on d,e”. Resize and move the white circle to match the images circle. Repeat with image 1.
On the Control Points tab load the left image into the left and the right image into the right window. Untick auto fine tune, auto add and auto estimate. Set Zoom to 200%. Scroll the left windows to the very left and the right window to the very right. Set ca. 6 control points by clicking the exact same spot in the left window, then the right window and then click Add. Repeat this for the other side of the motive.
Load the left image twice. Trace 3 vertical lines (e.g. a rainwater pipe) by clicking the start point in the left window and the end point in the right window. Click add. Do this for a vertical line at the left, in the middle and the right site of the motive. Repeat for the other image. Click File -> Save. OK.
On the Optimizer tab set Optimize to “the custom parameters below”. Untick all check boxes. Tick v0, v1, d0, d1 and e0, e1. Click Optimize! Yes. Open the Fast preview panorama window (GL icon).
You should see this:
Tick “Show control points”. You might want to change EV temporarily from 1 to 2 to see the orange control points better.
Untick everything.
Tick y0, optimize, Yes. Untick it. Tick y1, optimise. Yes. Untick it.
Tick p0, optimize, Yes. Untick it. Tick p1, optimise. Yes. Untick it.
Tick r0, optimize, Yes. Untick it. Tick r1, optimise. Yes. Untick it.
Open the Show control points list and click on the Distance column header twice to sort it.
Control Points
The larger the distance the worse the quality of the control point. Delete the worst control point(s). I am deleting one (20.30). Repeat the whole of optimizing. Delete the e.g. three worst control points. Repeat optimizing. Check the quality of the alignment on the Assistant tab.
You should read:
Images are connected by 15 control points.
Mean error after optimization: 2.1 pixel, max 7.1 Good fit.
Don’t spend to much time on trying to improve this result.
On the Stitcher tab click “Calculate Optimal Size”. Set “Normal Output” to JPEG and Quality to 80. Click “Stitch Now!”. Name the file 0000. File size should be ca. 49kb:
Now stitch all image pairs in the “in” folder. Download stitch.sh version 0.6 from the DIY streetview Software forum. Save a copy of the 0000l-0000r.pto project file as template.pto. Edit it to change the file names from 0000l.jpg and 0000r.jpg to replacemel.jpg and replacemer.jpg.
On my Centrino Duo notebook the stitching of the 8840 files needed nearly 2 hours. Certainly not the appropriate platform for number crunching like this.
Please donate to speed things up.
Step3:
Create new video with sound.
These command lines will encode all .jpg files in the “out” folder into a video: