habi.gna.ch

Jump to content

Additional information

Categories

Recent Comments

Meta


Posts tagged ‘imagej’


panoramas from (low quality) movies [update]

Apr 2009
10

when­ever i’m spend­ing a day out­door, i love to take pic­tures, many of them turn out to be panora­mas.

some­times i leave my cam­era at home and only have my mobile phone with me. shooth­ing panora­mas with the iphone is pos­si­ble with panolab [link opens itunes], but very cum­ber­some. and i try to keep the annoy­ance of nina as low as pos­si­ble while stop­ping on the slopes, so fid­dling with my phone for longer than a minute or two is not an option.

recently i was think­ing about a quick-and-dirty way of cre­at­ing panorams with the iphone: wouldn’t it be pos­si­ble to extract the images of a movie shot while pan­ning the scenery and stitch those together to gen­er­ate a panorama? today was the per­fect way to test this out, on the slopes of the won­der­ful stock­horn.

the whole process is fairly easy, you only need

all these — very fine — pieces of soft­ware are freely avail­able, most of them even free as in beer and as in speech.

step 1:
shoot a movie.

below are the movies i’ve used for this tuto­r­ial. both are made with the excel­lent cycoder.app, only for jail­bro­ken iphones. use any other movie if you don’t have an iphone :) the movies are 384x288 pix­els in size, as shown below, just press the play-button.



step 2:
get the movies off your iphone.

cyber­duck and SFTP are my weapons of choice, YMMV, but there are tons of tuto­ri­als on the web, here’s one for the mac and here’s one for win­dows.
now you should have some movies on your hard-disk. cycoder has the nice fea­ture to pro­duce quicktime-compatible .mov-files, if you don’t have one of those handy, again, YMMV. (use the excel­lent hand­brake to con­vert to and fro). quick­time is nice for the next step.

step 3:
import the movies into imageJ.

if you’re on a mac, this is just sim­ple drag-and-drop, on win­dows you might be quicker alto­gether if you con­vert your movies to .avi-files, since installing quick­time for java can be a bit of a has­sle, but can be done.

this opens your quick­time movie as a stack of images you can then scroll through. this image-stack can then eas­ily be exported as an image-sequence using “File > Save as > Image Sequence…”. rotate the images if you’ve been dumb enough to hold the iphone wrong :)

then you’ll have a bunch of sin­gle images on your hard­disk. if you’ve panned quite slowly like i have done, you’re prob­a­bly gonna have much too many images (167 for the first and 139 for the sec­ond movie) to eas­ily stich a panorama. for these movies, i’ve removed some images from the stack using the slice remover plu­gin. remove slices that are unnec­es­sary like the ones at the begin­ning and the end, where your glove cov­ers the lens. now hav­ing 20 and 32 images from both movies, pro­ceed to the next step.

step 4:
import the images from the step above into hugin, align and stitch.

yes, that’s it, it’s really that easy.for the movies shown above i’ve also deleted some bad con­trol points and stitched the panora­mas nor­mally and enfused, but this is entirely optional.the end-result looks like the images below. click them to see them bigger.

stockhorn_panorama1_fused.jpg
stockhorn_panorama2.jpg

i know that both panora­mas are not per­fect. both are quite small, espe­cially the sec­ond one has some arti­facts and both have vary­ing expo­sure. but keep in mind that i’ve only both­ered nina for 29 sec­onds, the total time of both movies. not too shabby!

update:

arru from swe­den left a com­ment about extract­ing the frames of videos using VLC, which is great, because it plays pretty much any movie-format.

since i couldn’t find it, i asked him to out­line it for me via email. he agreed that i share his howto, which you can find below:

Extract frames in VLC:

  • Open VLC pref­er­ences, select “all” (as opposed to “basic”)
  • Go to Video->Out­put modules
  • Select ‘Image video out­put’ (this must be reverted to ‘stan­dard’ when you’re done, to use VLC as a nor­mal video player again)
  • Flip down the sub­group next to Out­put mod­ules and select Image file’
  • Choose PNG as for­mat (JPEG works too, but there will be some unnec­es­sary qual­ity loss)
  • Set ‘record­ing ratio’ to 10 (deter­mines the num­ber of video frames skipped between images — may need to exper­i­ment with this value if images don’t over­lap correctly)
  • Press ‘save’ to exit VLC preferences
  • Open and play the video in ques­tion as you nor­mally would (notice: there will be no pic­ture — sound how­ever, if applic­a­ble, and the VLC con­trols will move to show you the progress of the conversion)
  • Images are saved to the root of the main HDD on Mac OS X ( / ), on Win­dows I can only assume it will be C:
  • Don’t for­get to reset step 2 to ‘Stan­dard’ when you’re done
  • Throw images into Hugin and run one of the autopano scripts, and so forth

Thanks for that info, Arru!


Paging

Tags

Archives

Credits

Template designed by praegnanz.de.