如何使用HUGIN拼接鱼眼视频制作街景 兼谈全景视频播放

 尼采科技注:通常我们谈到视频全景时,昂贵的设备让我们望而却步。目前而言,我们通常会用到ladybug(PTGREY公司),DODECA (IMC公司)。以及一些旁门左道,比如抛物线反光镜等(如pano-pro 的产品)。事实上,视频全景和图片全景的差别在于一个是多帧的,一个是单帧的,于是,化整为零就是不错的解决方法。HUGIN是一个免费的全景拼接程序,对于视频拼接同样可以使用。思路,视频分解为图片。拼接后,整合为视频。虽然繁琐,但是即使是昂贵的LADYBUG的硬件压缩程序原理也是如此。只是全自动了,现在我们要低成本的解决,如何做呢?请看这篇文章。http://www.diy-streetview.org/2010/07/01/streetview-video-by-free-hugin/ 

时间有限,就不翻译了。文中的设备比较老旧,可以升级了。

顺便说下全景视频的播放,目前为止,基于PV3D的比较多,散落于网间,有兴趣的可以搜索下,比较早且名气比较大的是比利时的Quentin Lengelé,基于PV3D的flash全景视频播放器。地址http://www.cornflex.org/?p=1      (博客开篇之作,评论部分也相当精彩。IMC公司的Fuad也留言了,不过感到不快,谴责Quentin没打招呼用了他们的视频内容,Quentin说还给你做了一个免费的广告呢)。

此外,独立开发且效果比较好的推荐如下:

1、推荐长沙尼采科技代理的krpano  (全球最强全景播放器,支持超大图片动态加载、对象全景、视频全景,各种格式全兼容,特效绚丽多姿,开放式插件开发环境...);KRPANO可以最大限度地发挥您的创意,举个例子,利用KRPANO甚至可以模拟球幕电影的效果!这可能是独一无二的!在极端的应用和环境中通常能体现出软件的品质,一句话,有见识的人都用KRPANO !

2、 86rm(老朋友王西杰先生),

3、日本的Ryubin (一位IT翻译人员,08年初和笔者交流过,我向其推荐了我们国内优秀的86RM,这位作者大概写出了全球第一个flash全景视频播放<2007年初>,IMC就是用其产品。此外对于静态全景就更不必说了,绝对是高手。要学更多,看其网站链接 http://www.ryubin.com/panolab/panoflash/links.html   PS,对于高手网站的友情链接不可小觑,如鄙人的友情链接 :)还是搜罗了不少好东西哦,PPS,笔者曾发现有个小朋友COPY我网站的内容,甚至连友情链接都COPY,不过做了编辑,如果这位朋友看到了,希望注意下哦 )

4、除此之外还有很多,比如乌克兰的老朋友舒拉科夫sp.zdt.ru(笔者曾为其做过全景漫游产品“sp_vtb”的汉化,pano-pro的播放器就是出自舒拉科夫之手)

5、以及pano2vr也可以支持视频全景播放,只是需要将视频经过比较繁琐的转换。

6、.日本会津大学的frank教授(或是副教授)开发的interactive_video   官方网址    http://www.imatronics.com/,这位可以说典型的学者型软件工程师。很早就在做这方面的工作,而且相当扎实,笔者曾在2007将其软件的帮助文件打印出来阅读,好几百页。Frank做的都是GUI(图形用户界面)程序。对用户体验很看重,界面也很漂亮。不过在PanoGuide.com常常遭人打击 (囧,鄙人也曾遭遇过,对panoguide既爱又恨)。注:Frank的播放器基于PV3D开发

7 、LUCID VIEW(作者Jason Villmer,美籍意大利人,07年和笔者有过交流,这个播放器的定价还参考了笔者的意见:)

8、VideoWarp Player for Flash    预览地址 http://www.eyesee360.com/videowarp/flash/   基于开源的PanoSalado.

9、可能是即将会发布的。DevalVR平台的全景视频播放,静态的就不必说了,小小的插件,超好的效果,现在硬件都搞出来了,软件也一定能会配套。

最后简单总结下,以上能做全景视频播放开发的,对于静态全景的功夫肯定是相当不错的。另外,国内部分作者把以上所提到的全景播放器进行包装然后贴上自己的标签,改个名字,剔除原作者的LOGO和链接,声称原创,这样的行为值得反思,目前国内市面上原创的只有86RM的全景视频播放器。

关于全景视频的应用,目前看来还是处于一个萌芽阶段。但笔者发现这么一个招标公告“山东省乳山市政府采购银滩三维视频全景(动态)展示平台公开招标公告”开标文件地址:http://www.whgp.gov.cn/newsnr.aspx?newsid=7554       下载    中标企业:北京盈科视野信息技术有限公司   中标金额  ¥2800000.00元  (人民币贰佰捌拾万元整) 。完工时间 2010-9-9 ,挺快的。遗憾的是这么一家颇具实力的公司,从未在业内听闻过。经查得知该公司注册时间是2010-04-14  ,开业四个月就收获280万的大单,可喜可贺!无论如何,这个单子给我们树立了一个好的榜样,肯定了全景视频的社会价值、商业价值,是件好事情。

接下来看一段海地地震后的全景视频 BY IMC.

 

如果你对全景视频还想更多了解,可以阅读这篇 中国互联网第一篇对全景视频解析的文章 ,小谈全景视频:http://chinapano.com/article/25.htm

下一篇准备写写全景视频硬件的DIY,以及国内外的研究现状。

下下一篇写krpano深入剖析和相关GUI介绍。

以上内容系长沙尼采科技原创,转载须保持原文一致,并给出原文链接。

接下来看看 DIY-streetview.org 是如何用HUGIN拼接街景视频的。

 

 

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:

0000.jpg

To save the 0000l-0000r.pto hugin project file click File -> Save. OK.

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.

Run stitch.sh from the command line like this:

/home/me/stitch.sh \
/home/me/in \
/home/me/out \
4 \
/home/me/template.pto
> /home/me/logfile.log

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:

cd /out
mencoder mf://*.jpg -mf w=842:h=421:fps=30:type=jpg -of lavf -ffourcc FLV1 -ovc lavc -lavcopts vcodec=flv -o ‘/videos/video.avi’

Extract the audio from one of the original video files:

mplayer -vc dummy -vo null -ao pcm:file=/audio/audio.wav ‘/testshots/0021_r.AVI’

Copy the audio to the new video:

mencoder -audiofile ‘/audio/audio.wav’ -srate 8000 -oac mp3lame -ovc copy ‘/videos/video.avi’ -o ‘/videos/video_with_sound.avi’

Sound can certainly be improved to stereo or even Dolby surround.
If you figure it out, please tell me:
janmartin AT diy-streetview DOT org

All suggestions for improvements are strongly welcome!

以上英文部分转自 http://www.diy-streetview.org/2010/07/01/streetview-video-by-free-hugin/  

 

 

 




[本日志由 admin 于 2010-09-19 09:17 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 鱼眼 街景 视频拼接 HUGIN
评论: 3 | 引用: 0 | 查看次数: 9146
720pano[2010-08-31 04:43 PM | del]
谢谢老师分享!
admin[2010-08-24 00:46 AM | del]
谢谢前辈指点!
Softmagic[2010-08-23 11:57 PM | del]
资深玩家,欣赏你的钻研精神,看似简单的总结,背后却凝聚着你多年的心血。在三维全景领域,目前国内少有你这样沉下来做科研的研究人员。我接触这个领域十多年了,见的人经的事也不少,看到太多浅尝辄止的发烧友。但看到你的网站的时候,我真的感觉耳目一新,很多的原创内容,而且相当有分量,特别是在分享这一点,难能可贵!另外,希望能开发下市场,就你公司目前的水平来说,当属一流水准,希望能更好地服务于市场。毕竟生存是必须的。观望着,并祝福你!
发表评论
你没有权限发表留言!