Thanks all for the hints. I should have given more background: this
is not about speed / performance. I used a catadioptric lens as a
poor man solution to the lack of equipment. I recorded the
interaction between barristers and the bench in a moot court room. If
I had the means, I would have pointed one fixed video recorder on the
bench and one on the barrister.
I ended up dewarping one frame with the software that is delivered
with the lens, and then reconstructing the same in ImageMagick to
create an equirectangular image. From the equirectangular, Hugin
helped me to visually frame the two streams I needed. Next I will
script nona to mass-process the frames, and use ImageMagick and avconv
again to compose and put the movie back together. The process is
almost finished scripting and will run sometimes in the next days.
The relevant part for the dewarping (and for making 0-360 catadioptric
lenses usable with Open Source software) is to first square the circle
-- determine the square side and the coordinate offset from the top of
the image, then transform with ImageMagick.
One obstacle I encountered was that the TIFF output of avconv is not
processed well by Hugin (weird lines and coloring) nor by ImageMagick
(weird coloring), so I ended up extracting the frames as PNG (JPG
quality was horrible). On my machine avconv PNG extraction is about
six times slower than its TIFF extraction, but it is a batch process
so time is relative.
Then I tried to reconstruct with ImageMagick the same output that the
0-360 proprietary software produces. The bash script is below. I am
still trying to figure out why ImageMagick's image size is 70% of the
proprietary software image size and whether that matters (i.e.: am I
losing resolution with my current ImageMagick process, or is the
proprietary software product pixel-inflated)?
Next step would be cool to do this with panotools directly, and maybe
add functionality to Hugin (or another kind of dedicated front-end
GUI) to automatically determine the center of the donut and use it to
unwrap this kind of photo/video.
For those with better skill and more time than me, here are:
- original image [1]
- unwrapped by 0-360 software [2]
- unwrapped by ImageMagick with the command below [3]
I am happy with my process as it stands now (and I don't have time to
fiddle with it more than that anyway). I do not expect to have any
more footage like this to process in the next three months. I can
provide access to original footage; to higher resolution images taken
with the lens (I have an adapter to use it with my dSLR); and to the
lens itself if somebody wants to take this to the next level.
Thanks again for all the help
Yuv
----- BASH SCRIPT -----
#!/bin/bash
# project from the catadioptric lens to equirectangular
square_side=901
offset_x=451
offset_y=41
crop="${square_side}x${square_side}+${offset_x}+${offset_y}"
# center of the circle x and y coordinates, as well as radius of the
circle, are the same
c=$(echo "scale=1;$square_side/2" | bc)
# for the final equirect image height it must be integer
h=$(echo "scale=0;$square_side/2" | bc)
infile=000001.png
outfile=000001.tif
# reconstruct the output from the 0-360 unwrapper software. It was
1288x389, black space cropped.
# the lens according to
0-360.com specs: (52.5° above horizon, 62.5°
below horizon)
# must add 37.5 deegrees of black above, then target to equirect size
# from the same input footage ImageMagick yields 901 horizontal
resolution
# and here is the magick line:
convert $infile -crop $crop -distort DePolar "$c 0 $c $c -180 180" -
flip -resize 100%x39%! +repage -gravity south -background black -
extent ${square_side}x${h} 01$outfile
[1] <
https://www.dropbox.com/s/uq7rqzvy7fmlx9u/Frame00001.png>
[2] <
https://www.dropbox.com/s/5d27ceqq35i4ksy/Proprietary0-360.jpg>
[3] <
https://www.dropbox.com/s/hyn9vgzu4nxkmts/ImageMagick901.tif>