{"id":2552,"date":"2016-10-10T00:00:23","date_gmt":"2016-10-10T07:00:23","guid":{"rendered":"http:\/\/192.168.3.4\/?p=2552"},"modified":"2022-06-06T06:15:16","modified_gmt":"2022-06-06T13:15:16","slug":"linear-panoramas-with-hugin","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=2552","title":{"rendered":"Linear Panoramas with Hugin"},"content":{"rendered":"<p>We have covered panorama creation using Hugin in previous posts. \u00a0The method used was taking pictures from a singular point and stitching the images together to create an immersive experience. \u00a0In this post we will use Hugin to create panoramic scenes, however the images will be sourced from a moving video camera.<\/p>\n<p>There are a few challenges from our source video. \u00a0First, the camera used has a wide angle lens. \u00a0The images will be distorted by the lens and we will need to correct this using GIMP. \u00a0Second, this lens correction comes at a cost. \u00a0We will then need to crop the images because the edges will still have artifacts from our lens correction. \u00a0Again, this can be done in GIMP. \u00a0The next challenge will be the selection of our source images. \u00a0Using every frame extracted from the video source and processing them would be horribly inefficient. \u00a0We will want a limited number of source images so Hugin isn&#8217;t overburdened, yet enough so it can stitch effectively.<\/p>\n<p><a href=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2556 size-large\" src=\"http:\/\/192.168.3.4\/wp-content\/uploads\/2016\/10\/00351-00431-1024x222.png\" alt=\"00351-00431\" width=\"640\" height=\"139\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431-1024x222.png 1024w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431-300x65.png 300w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431-768x166.png 768w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431-604x131.png 604w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/10\/00351-00431.png 1848w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>The first step in this process is selecting a video source that meets the requirements of a linear panorama. \u00a0In my example, I used an action camera that was mounted on the back rack of my mountain bike, with it facing perpendicular to my movement.<\/p>\n<p>Now that the video source has been selected, now it is time to extract the frames into a series of images. \u00a0To do that we&#8217;ll run the following command.<\/p>\n<pre>avconv -i \/home\/local\/Desktop\/HLP\/HLP.mp4 -r 30 -f image2 \/home\/local\/Desktop\/HLP\/HLP\/%05d.png<\/pre>\n<p>The number of images will depend on the length of the video file and the number of frames per second. \u00a0We also want to narrow our image selection so processing is efficient. \u00a0 I settled on 30 images for my Hugin source files.<\/p>\n<p>The action camera has a wide angle lens. This is useful for the raw video footage it can capture, but causes problems if used directly with Hugin. \u00a0This is why some post processing with GIMP is used to prepare the images for Hugin.<\/p>\n<p>The first thing we&#8217;ll change is the lens distortion by removing the fisheye effect. We&#8217;ll use GIMP&#8217;s lens distort filter to remove the curves. \u00a0This does a good job of correcting the image, but the outside edges remain distorted.<\/p>\n<p>It is pointless to try and fix this. \u00a0The stitching will give us what we want anyway. \u00a0So the next thing that GIMP will be used for is cropping our image. \u00a0In my images, I found that removing 200 pixels from the left and right side of the image worked well.<\/p>\n<p>What remains will be the finished image set that we&#8217;ll use in Hugin. \u00a0Hugin should auto detect the control points, but there is a chance that we&#8217;ll need to create some manually. \u00a0Once all the CPs are plotted, we will be ready to stitch our panorama. \u00a0If all goes well we should end up with a linear panoramic view.<\/p>\n<p>The process is a bit manual intensive, especially GIMP. \u00a0There are ways to run scripts in GIMP automate the process a bit. \u00a0Another method to use is the modification of the video source. \u00a0This can be done with VitualDub and a fisheye filter. \u00a0The video edit method is appealing because it is much easier to apply both edits, lens distortion and image cropping.<\/p>\n<p>Regardless of the way we use, Hugin will work best with a limited number of source images that provide the most common point overlapping.<\/p>\n<p>Linear panoramic images are a great way to view places that span spaces. \u00a0It can give the observer a view of the forest instead of the trees.<\/p>\n<p>Further reading<\/p>\n<p><a href=\"http:\/\/hugin.sourceforge.net\/tutorials\/Mosaic-mode\/en.shtml\">Hugin tutorial \u2014 Stitching murals using mosaic mode<\/a><br \/>\n<a href=\"https:\/\/panospace.wordpress.com\/2010\/09\/19\/linear-panoramas-mosaic-tutorial\/\">Linear Panoramas (Mosaic) Tutorial<\/a><br \/>\n<a href=\"http:\/\/www.dojoe.net\/tutorials\/linear-pano\/\">Creating linear panoramas with Hugin<\/a><br \/>\n<a href=\"http:\/\/www.jaysenmarais.com\/blog\/20080402\/making-linear-panoramas-that-dont-suck\">Making nodal panoramas that don\u2019t suck<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have covered panorama creation using Hugin in previous posts. \u00a0The method used was taking pictures from a singular point and stitching the images together to create an immersive experience. \u00a0In this post we will use Hugin to create panoramic scenes, however the images will be sourced from a moving video camera. There are a few challenges from our source video. \u00a0First, the camera used has a wide angle lens. \u00a0The images will be distorted by the lens and we&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=2552\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,3],"tags":[],"class_list":["post-2552","post","type-post","status-publish","format-standard","hentry","category-computer-vision","category-rd"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2552"}],"version-history":[{"count":6,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2552\/revisions"}],"predecessor-version":[{"id":4052,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2552\/revisions\/4052"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}