利用红蓝分色原理制作三维图片及三维视频
利用红蓝分色原理制作三维图片与三维视频

using namespace cv;
int main()
{
Mat left = imread("211.jpg");//加载图片
Mat right = imread("212.jpg");
int i, j;
for (i = 0; i < left.rows; i++)
第一组:
成品:
第二组:
成品:
第三组:
成品:
第四组:
成品:
第五组:
成品:
第六组:
成品:
五、心得与体会
效果:
3d图片的效果部分不是很明显,比如第一张和第三张,有很严重的重影。但第二张和第五张的效果比较好,尤其是第二张,几乎没有重影,能看到比较明显的3d效果。
3d视频的效果比较差,可能是拍摄的时候的角度和位置没有取好,而且画面的移动幅度过大,速度过快,观看时有一种晕眩的感觉,重影也比较严重。
困难及解决方法:
代码方面,3d图片的代码比较简单,主要在于获取图片每个像素点的通道并进行转移,再将新图片输出显示。3d视频较复杂,主要在于需要用逐帧动画的方法来合成视频,即获取视频后,将视频按帧看做一张张图片,并用3d图片转换法转换每一张图片,即完成视频的转换,最后将视频保存并输出,输出大小为1920*1080。
CL.open(VedioLPath);//逐贞打开视频
CR.open(VedioRPath);
if (!CL.isOpened()){
cout << "无法打开1.mov文件\n";
waitKey(0);
}
if (!CR.isOpened()){
AE中的红蓝3D特效制作指南

AE中的红蓝3D特效制作指南Adobe After Effects(简称AE)是一款专业的视频后期处理软件,能够为影片添加各种特效和动画效果。
其中,红蓝3D特效是一种常见的视觉效果,可以给观众带来身临其境的观影体验。
在本篇文章中,我们将为您介绍如何使用AE制作红蓝3D特效。
首先,打开AE并创建一个新的合成。
确保合成的大小和分辨率与您的素材一致。
导入您要添加3D效果的素材,并将其拖拽到合成中。
接下来,选中素材图层,点击“效果”菜单,然后选择“透视”效果。
这个效果可以增强3D效果的真实感。
在透视效果的属性面板中,您可以根据需要调整“视角”、“远和近的焦距”等参数,以达到理想的效果。
接着,点击“效果”菜单,选择“3D Channel Extractor”效果。
这个效果可以将素材图层分解为红色通道和蓝色通道,从而制作3D效果所需的红蓝分离效果。
在属性面板中,将“Output Channel”设置为“RGB Split”,然后将“Separation”参数调整为适度的数值,以使红、蓝两个通道的距离合适。
接下来,将两个图层复制一份,并分别对复制的两个图层进行处理。
为了让3D效果更加立体,分别选中两个图层,并添加“移动”效果。
您可以调整“X轴移动”、“Y轴移动”和“Z轴移动”参数,以使两个图层在空间中产生一定的位移。
在一个图层上,选中红色通道,并将其位置稍微向左或向右移动。
在另一个图层上,选中蓝色通道,并将其位置向相反的方向移动。
这样,红色通道和蓝色通道就会在3D空间中错位,产生出立体的效果。
此外,您还可以使用AE中的其他特效工具进一步增强红蓝3D特效的效果。
例如,可以使用“色阶”效果调整每个通道的对比度和颜色,使得特效更加明亮和鲜艳。
还可以使用“模糊”效果产生景深效果,使得素材在3D空间中看起来更加真实。
最后,将合成导出为视频文件或动画序列,以便在其他平台或设备上观看。
在导出设置中,确保选择适当的视频编解码器和分辨率,以满足您的需求。
Photoshop做红蓝立体图像

Photoshop做红蓝立体图像
现在有2种方法:
第一种方法
1、先读取2个黑白立体的数据,再读取其中的一个副本,共3个图像
2、选择其中一个图像,之后在“通道”小窗口中选择合并通道:
3、弹出对话框:
4、选择RGB颜色,并点击“确定”,就弹出三个通道文件对话框:
5、选择好文件之后,点击确定按钮,就ok了。
6、根据两个立体像对的相对位置(上下错位还是左右错位,如果是上下错位,那么与人的
双眼位置不匹配,所以要旋转90度才行)来确定图像是否旋转
7、移动一个图层,形成立体像对。
第二种方法
1、读取两个图像
2、将一个图像拖动到另一个图像中,形成两个新的图层
3、设置透明度50%,进行位置对齐
4、这时候再将透明度设置为0,并右击(或双击)弹出菜单:
之后选择混合选项,弹出对话框:
去掉R通道。
(当然一个图层仅仅选择R通道,另一个图层选择G通道最好)
5、根据两个立体像对的相对位置(上下错位还是左右错位,如果是上下错位,那么与人的
双眼位置不匹配,所以要旋转90度才行)来确定图像是否旋转
6、移动一个图层,形成立体像对。
红蓝立体原理解析

红蓝立体原理解析一、引言立体感是人类视觉系统对于物体在三维空间中位置和深度的感知能力。
红蓝立体原理是一种常见的立体感制造方法,通过运用颜色滤光片的原理来实现视觉立体效果。
本文将深入探讨红蓝立体原理的工作原理、应用以及存在的问题。
二、工作原理红蓝立体原理基于人类的视觉系统对红色和蓝色滤光片的敏感性不同。
人眼对红色光线最为敏感,而对蓝色光线相对不敏感。
基于这一原理,利用红色和蓝色滤光片的组合可以使视觉产生立体感。
2.1 创建立体图像使用红蓝立体方法创建立体图像的步骤如下: 1. 在计算机上创建一副立体图像。
2. 根据立体图像的特点,将左眼和右眼分别用红色和蓝色过滤。
3. 将左眼过滤后的图像和右眼过滤后的图像分别保存。
2.2 观看立体图像观看立体图像的过程如下: 1. 戴上红蓝立体眼镜,确保左眼透过蓝色滤光片,右眼透过红色滤光片。
2. 将左眼过滤后的图像放在右眼前,将右眼过滤后的图像放在左眼前。
3. 通过红蓝立体眼镜,我们可以同时看到左眼和右眼的图像,从而产生立体感。
三、红蓝立体原理的应用红蓝立体原理被广泛应用于各个领域,包括电影、游戏以及印刷业等。
3.1 电影制作在电影制作中,红蓝立体原理被用于制作3D电影。
通过特殊的摄影技术,左眼和右眼的图像可以同时记录在一部电影中。
观众在观影时,戴上红蓝立体眼镜,能够感受到真实的立体效果,增强了电影的观赏体验。
3.2 游戏设计红蓝立体原理也被广泛应用于游戏设计中。
游戏开发者利用红蓝立体原理,制作出具有立体感的游戏画面,增加了游戏的沉浸感和视觉效果。
3.3 印刷业在印刷业中,红蓝立体原理被用于制作3D印刷品。
通过在印刷品上使用红蓝滤光片的技术,可以使平面图像产生立体效果,给读者带来更加生动的视觉体验。
四、红蓝立体原理存在的问题红蓝立体原理虽然被广泛应用,但也存在一些问题。
4.1 颜色失真红蓝滤光片的使用会导致图像颜色的失真,使得图像的亮度和色彩产生变化,降低了图像的真实感。
UG模型的红蓝3D立体图做法

UG模型的红蓝3D立体图做法
1.打开一个ug建好的模型;
2.打开透视开关;
3.右击cameras ,新建一个视图;
4.编辑摄像机,调整观察位置,确定。
两个坐标系相当于眼睛位置和焦点位置
眼睛位置
眼睛视线焦点位置预览图
左右眼看到的图像有一个角度差,既在大脑中形成立体感。
所以要导出两张图片,分别作为左眼看到图和右眼看到的图部件导航
里
5. 建立第一个视图,表示右眼看到的图像,可以在真实着色下导出tiff 图片,
材质、光线、反射等自己定义
6. 复制此视图
,重命名一下
,表示左眼看到的图像。
然后右击—编辑一下
同样导出一张tiff 图片。
(可以多导出几个不同角度大小的图,合成后选立体视觉效果较好的一张)
7. 然后打开ps ,打开两张导出来的图片。
8. 将右眼图像框选,复制到左眼图像中,
点这里旋转-5°
旋转多少度自己调整,角度越大
景深越深。
做成立体图后,可以看到,位于焦点前面的图像凸出电脑屏幕,焦点后面
的图像变得更远,于是形成层次感,既立体感。
焦点处的图像和电脑屏幕在同一平面,可以根据喜好自定义其位置。
PS 里的图层窗口
9.
10. 11.
右眼看到的效果。
12.然后可以另存为jpg格式,效果如图。
不同旋转角度的
景深效果对比
旋转角度小,景深效果浅旋转角度大,景深效果深,此
图的手比左图凸出屏幕更多
%%也可以用其它专业3D合成软件,合成红蓝、红青、左右立体图等。
Mr.陈制作
2012-7-25。
如何使用i3D Photo制作红蓝3D立体图片

如何使用i3D Photo制作红蓝3D立体图片
1、准备2张图片,要左右格式的,也就是用相机分别模拟左眼和右眼拍摄的图片
2、打开i3D Photo,双击鼠标左键,运行它,运行后的界面
3、开始合成自己用手机拍摄的图片了:
将两张左右格式的图片合成,这时,红绿(互补色)格式的立体图便制成,快戴上眼镜看看效果。
如果合成后观看的效果满意,就可以跳过编辑过程到裁剪立体图这一环节,如果不满意,就可以往下:
至些,几个重要的调整环节完成,在调节过程中可边调节边用眼镜观看一下效果,直到满意。
当然,如果此时还是没能达到自己的要求,那么送君一句话:放弃就是明天重拍的动力。
如果达到了要求,那就往下吧:
作品完成,是不是很有成就感呢,当然也有挫败感的,这才叫矛盾,这就是生活。
本教程由3D立体网收集并整理。
红蓝3D影片技术与红蓝影片会展广告行业中的应用

如有何形的蓝色的和绿红蓝本文件版权归有发生将追究形式的泄露、红蓝3D 电 红蓝3d 蓝色内容,只的眼镜过滤不图为影片《如何判断看电影的时绿色的综合色蓝3D 影归摩丁创想公究法律责任。
如使用和损害电影d 电影是指一只看到红色部不同的颜色而《阿凡达》红断是红蓝电时候,有模糊色。
但还应该影片技术公司所有。
除如贵公司决定害。
一般左眼红部分,右眼过而看到不同的红蓝3D 版,电影糊的边,一般该是蓝色深一术与红除贵公司外,任定不采用摩丁色镜片右眼过滤掉红色,的影像。
剧照-(需带般边是绿色的一些。
红蓝影片任何人或单位丁创想的顾问眼蓝色,画面左右眼看到带红蓝眼镜看的比较明显。
片会展广位未经许可不问和建议,亦面也是红蓝错到不同画面而看3D 效果)。
可以肯定就广告行不得复印、传亦应保证摩丁错位的,这样而产生立体感就是红绿。
红行业中的传递和使用本丁创想的知识样左眼的镜片感。
红蓝电影红蓝的不太清的应用本文件中的内识产权不会受片会过滤掉画影是通过不清楚,有点容,受到任画面同颜蓝色眼镜当它红蓝3D 电 关键是镜看红蓝3d红蓝3D 电● 优点:● 缺点:关键是和蓝色感觉挺很难有 所以观看设备互补式,又红蓝眼镜 左放映它通过蓝色镜电影的效果是你要选一副电影。
电影优缺点成本低,周图片颜色会是这个“红蓝色,常见的还挺好,自己买有完美的效果以,最好选用备-红蓝眼镜又称色差式的镜原理映机的画面通镜片(右眼)时果副滤色比较干点周期短---制作会有部分丢失”的颜色没有还有黄色、绿的时候就没果 用专门为影片镜简介的3D 眼镜。
通过红色镜片时大部分被过干净的红蓝眼作周期跟成本失。
从原理上有标准,不同绿色、青色、没法完全匹配片匹配色准的 红蓝眼镜片(左眼),拍过滤掉,只留眼镜。
只要有本以及实现技上说挺简单,同电影采用的洋红色等,配了,颜色差的红蓝镜。
是一种新型拍摄时剔除掉留下非常昏暗有一副不错技术相对其他但自己买眼的红蓝颜色实在电影院时一点红色过型的影视产品掉的红色像素暗的画面,这的眼镜,效果他3D 技术较眼镜看的时候实际是有区别时候眼镜是根过滤不完或者品,用于辅助素自动还原,这就很容易果相当震撼较快。
3D红蓝图制作(英文版)Apr_06_web

I would have been disappointed for the 3D Center’s loss, but I would have been delighted for stereographers and I would have applauded the decision to place the collection in a facility such as these. I do not know of any such offers; however, I do know of two other offers which would have left the collection intact. The 3D Center offered to take the full collection on loan from theNSA and house it, store portions of the collection and rotate other portions through the Center display cases and public areas. The Center would continue to offer research capability for those interested in using the materials, articles and images from the collection. The collection would continue to be owned by the NSA, with the NSA contributing $1000 a year to itsmaintenance, storage, and display. The advantages are obvious. The NSA would receive great press among the stereoscopicworld and in general news releases to the public. A permanent thank you notice would be posted at the Center reminding visitors that the NSA had placed this valuable collection on loan at the Center. NSA would also receive recognition as aFriend of the Center at the $1000 a year level and a link to theNSA website. The 3D Center would get great press for having the collection, would be helped by the $1000 a year which could be used for better display cases, inventory, and cataloging of the Library articles and information. However this offer was declined. Perhaps correctly the NSA Board did not want to own the Holmes Library collection any longer or take on the responsibility for seeing that it was appropriately housed and preserved.The second offer was also made by the 3D Center. The Center offered to pay all costs of moving the collection to Portland if NSA would gift the Holmes collection to the Center. This would cost NSA nothing, would preserve the collection intact, would help the 3D Center in terms of publicity and prestige, and would be a wonderful solution to the preservation of the history of stereography. This offer was also declined. Instead the NSA Board has decided to sell much of the collection on eBay and at NSA conventions to private collectors. A couple of nice pieces will be given to other museums not specifi cally dedicated to stereoscopy, and the papers and more contemporary images will be boxed up and sent to the 3D Center at the expense of the Center. A major part of the mission statement of the Center includes research and history and we are glad to be able to step up and take this heritage. But it is a bittersweet gift when one thinks about what a loss it is for stereoscopy that the Holmes collection is being dismantled and much of it sold off when it could have been kept intact at no cost to NSA. I suspect this is what the donors intendedwhen they made their gifts to the Holmes Library.The 3D communityis facing a terrible loss. In a decision announced last month, the Board of the National StereoscopicAssociation (NSA) has decided to liquidate the Oliver Wendell Holmes Stereoscopic Research Library. Although the decision to “get out of the museum business” may be a wise one for the NSA, a nonprofi t group of nearly 4,000 members dedicated to the promotion and preservation of 3D photography, the dismantling of this valuable resource for stereographers is a tragedy. With no central headquarters and with national conventions moving from one part of the country to another each year, it was diffi cult for NSA to run and promote the Library.The Oliver Wendell Holmes Stereoscopic Research Library was a by-product of a total vision for stereoscopic history and research - formulated and developed by the founders of the NSA. Established on February 20, 1979 the collection was later moved twice, fi nally to Cincinnati, Ohio. The library had no public hours, but was open by appointment with Wolfgang and Mary Ann Sell serving as library curators for many years. Operating solely on donations, the library was an invaluable reference tool to many students and researchers including PBS who used many of the library’s images when producing their award winning series on the Civil War.Although the library operated primarily as a research facility, there were future plans including expanding its services to include periodic projections of 3D slides as well as demonstrations and workshops on stereo techniques. It was hoped that as the library expanded, it would present the many facets of stereo photography to researchersand others interested in this medium. An Internet site was created to give instant access to information within the library including many of its stereoscopic images. To call it a library is perhaps limiting. The Library was stocked with donated items from stereographers who wanted to preserve the legacy of stereo imagery and to establish a space dedicatedto the history of stereoscopy. There were more than 20,000 vintage stereo views housed in the library as well as several thousand modern 3D color slides. There were more than 400 books and several hundred articles in the library’s collection making it the largest assortment of 3D information compiled within one place anywhere in the world. The largest holding within the library was the Helen Dupre Moseley Collection that was gifted to the library in 1985. Consisting of over 14,000 views, this contribution elevated the library to a major repository of not just books on the subject of stereoscopy but ownership of an image collection which provides researchers with an opportunity to study a great variety of historical photographs.Although vintage stereo views comprised the base of the library’s inventory, other forms of 3D such as anaglyph posters and comic books, lenticular images, holograms and View Master reels were also represented in the library’s collection. The library served as a lending source for donated slide programs and works with stereo clubs throughout the country in this regard.Many have never heard of the Library or are unaware of what it held. There were fewvisitors and little publicity about the Library or its contents. If there had been no place to move this collection, one could understand the decision of the NSA Board. If the Smithsonian or the museum in Riverside had offered to take the Holmes collection and display and preserve it,Vol. 3 No. 2 April 2006Published QuarterlyCENTERNEWSPublished by 1928 NW Lovejoy Street, Portland, OR 97209Center Receives Bittersweet Gift from Ashes of the Oliver Wendell Holmes LibraryThis image and the one to the right show some of the items on display in the HolmesLibrary. The pictures were taken in 2002 for an article which appearedin Stereo Views , March 2002 (the issue is available on the CSC web-site: ). Photos: Wolfgang Sell and MelMittermiller Oliver Wendell Holmes Stereoscopic Research Libraryis being closed and the collection is being scattered.Saleable items will be sold off on EBay and auctionedto private collectors. A few pieces will be distributed tonon-profi t institutions. The 3D Center will receive his-torical papers and archives. Photo: Mary AnnSellBy Diane E. Rulien, Director, 3D Center of Art and PhotographyLittle Details Improve 3DCenterCenter volunteer, Tim Nickles, brings his own images during his shift to show visitors how transparencies can be mounted in cardboard or RBT mounts.Photo: Ron Kriesel The Center now has a credit card swipe machine, an upgrade from the old style “knucklebuster” which we had at the beginning. The swipe machine makes charges easier, faster, and costs the Center a smaller percentage of the sale.Annie completely reorganized the interior and gift shop to givea fresh new look for repeat visitors. The images in the viewers werechanged and some new signage added to better explain 3D imagery.The landlord shared the price of a new awning. The clean and bright awning with bright white letters helps passersby to notice us. Photo: Shab LevyApril 6 through May 21May 25 through July 2The Strange Case of Dr. Addison and the Crosswell Twins Human Nature: Scenic Observations via StereographsStereo Theatre:Christopher Schneberger’sIn the Gallery: Ron Kriesel’s“In the spring of 1908, Dr. Charles Addison disappeared. The noted botanist, amateur zoologist, and photographer, had been making a series of images of a young girl named Regina Crosswell. Regina’s twin sister, Lydia, had died in the winter, though the circumstances were unclear. Dr. Addison, however, had become convinced that Lydia had not entirely departed from our earthly plane. Peruse the photographs Addison made and draw your own conclusions.”Combining a love of stereo photography with an appreciation for the beauty of a landscapes, Ron Kriesel has produced an impressive num-ber of breathtaking stereoscopic landscapes over more than 20 years as a stereographer. These large side by side stereo prints are a visual treat, especially when viewed with David Lee large format mirrored viewers.Stereo Theatre: Simon Bell’sLos Caros Viejos: Classic American Cars in CubaIn the Gallery: Amazing StereoJetsby Jim GaspariniSimon Bell’s passion for photography began when he was given a “box-brownie” camera at six years of age. That early interest developed into career inphotography, multimedia and 3D imagery that continues today.While in Cuba, Bell was fascinated by the vast numbers of classic American cars he saw on the streets. Locked in by the American embargo on trade with Cuba established in the 1960s after Fidel Castro took power, and the inability of Cuban citizens to replace older American cars with new ones, the American cars in Cuba were maintained and valued. With his ever present eye for beauty and the unusual, Bell started taking stereo images of the cars and the people. The result was a stereo slide show which won 3rd place at the NSA convention in 2004. The images of cars and people on the streets of Cuba are accompanied by native Cuban music. It is like being transported to another part of the world.First Thursday opens new exhibition with artist’s recep-tion for Jim Gasparini seen here greeting guests, answering questionsand enjoying a glass of wine. Gasparini, who lives in the Bay area, flew to Portland to help set up his show of 20 backlit stereojets, Amaz-ing StereoJets, the first such exhibition held at the Center. Gasparini’s stereojets in-cluded images from Burning Man (see When She Beckons shown as a stereo pair below), scenic lo-cations and a hippopotamus in a tank (a favorite amongvisitors). The images were a sensation for first time visitors as well as veteran stereographers. The experience was enhanced by Gasparini being available to answer questions about the locations and the process of making stereojets.Besides enjoying a glass of wine and light refreshments, visi-tors watched Simon Bell’s award winning slide show, Caros Viejos.Fundraising: the Never Ending Work of a Non-Profit MuseumDoes it seem like we are always fundraising? We are. The Portland Symphony, established more than 40 years ago, recently published that they receive less than 50% of their operating budget from ticket sales. This is not an uncommon statistic for non-profit symphonies, ballets, museums, art galleries, and theatres. The 3D Center is no exception. In 2004, our first year, 90% of our funding came from individual donations of 3D enthusiasts all over the U.S. The other 10 % came from admissions and gift shop sales. In 2005, we dramatically increased the number of visitors. Consequently, the amount of income from admissions and gift shop sales increased from 10% to 25% of our funding. Our costs also rose in 2005 as we hired a part-time employee.In an effort to expand our financial base, theCenter has submitted more than 37 grant proposals to foundations and businessessince December. The competition for this type of funding is fierce and weare just learning the ropes. Some have already sent usrejection letters; others are still considering our proposals. We received a $1000 grant from the Oregon Arts Commission last month and we got our first Corporate Friend membership from MacNaughton, Inc. Check our webpage under Friends for a link to their website. This month mailings for Friends renewals and solicitations for new Friends memberships will be mailed. Please support the Center with as generous a giftas you can. Each mailing you get is prepared, stuffed, addressed and mailed by volunteers because we need your support this year.D o l l a r s I n c o m e 2005D o l l a r sE x p e n d i t u r e s 2005New Acquisition Our thanks to John Little forhis donation of a dual stereo microscope, four eyepieces andRealist stereo camera. The dual stereo eyepieces allowone to observe and photo-graph in stereo at the sametime.Photo: Greg Marshall。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
}
}
Mat img;
resize(left, img, Size(800, 600), 0, 0, CV_INTER_LINEAR);//固定输出图片大小
namedWindow("output");
imshow("output", img);
waitKey(0);
using namespace std;
using namespace cv;
//帧合并
void VedioTransfer(Mat_<Vec3b> &VedioL, Mat_<Vec3b> &VedioR){
for (int row = 0; row < VedioL.rows; row++){
uchar *dataLeft = VedioL.ptr<uchar>(row);//获取矩阵像素
第一组:
成品:
第二组:
成品:
第三组:
成品:
第四组:
成品:
第五组:
成品:
第六组:
成品:
五、心得与体会
效果:
3d图片的效果部分不是很明显,比如第一张和第三张,有很严重的重影。但第二张和第五张的效果比较好,尤其是第二张,几乎没有重影,能看到比较明显的3d效果。
{
uchar *p = left.ptr<uchar>(i);//获取像素
uchar *q = right.ptr<uchar>(i);
for (j = 0; j < left.cols; j++)
{
//左图BG通道转换为右图的BG通道,R通道不变
p[j * 3] = q[j * 3];
p[j * 3 + 1] = q[j * 3 + 1];
}
}
}
int main(int argc, char* argv[]){
Mat_<Vec3b> VedioL;
Mat_<Vec3b> VedioR;
VideoCapture CL;
VideoCapture CR;
const char* VedioLPath = "1.mov";//获取视频途径
const char* VedioRPath = "2.mp4";
实验二
一、
根据人眼三维视觉形成的原理,利用红蓝分色原理制作三维图片与三维视频。
二、
三维图像:
步骤:
1.利用手机/相机等摄像设备,拍摄大小相同的左眼图与右眼图
2.利用OpenCV读入左眼图与右眼图,假设左眼图像第i个像素颜色向量为(R1_i,G1_i,B1_i);右眼图像第i个像素颜色为(R2_i,G2_i,B2_i),则合成后的立体图像第i个像素为(R1_i,G2_i,B2_i);利用OpenCV显示并保存合成后的图像
CL.open(VedioLPath);//逐贞打开视频
CR.open(VedioRPath);
if (!CL.isOpened()){
cout << "无法打开1.mov文件\n";
waitKey(0);
}
if (!CR.isOpened()){
cout << "无法打开2.mp4文件\n";
waitKey(0);
uchar *dataRight = VedioR.ptr<uchar>(row);
for (int col = 0; col < VedioL.cols; col++){
dataLeft[col * 3] = dataRight[col * 3];//同理转换左视频BG通道
dataLeft[col * 3 + 1] = dataRight[col * 3 + 1];
imshow("frameVedio", VedioL);
if (waitKey(30) == 30){
isStop = true;
}//读取时间,遇到esc退出
}
else{
isStop = true;
} //播放完毕
}outputvideo源自release();return 0;
}
四、
六组3d图片:
CL >> VedioL;//captureVedio.read(frameVedio);
CR >> VedioR;
if (VedioL.data&&VedioR.data){//循环获得视频文件的帧
VedioTransfer(VedioL, VedioR);
outputvideo << VedioL;
}
//视频转换
bool isStop = false;
namedWindow("frameVedio", 1);
VideoWriter outputvideo;
outputvideo.open("3d.avi", 0, 24, Size(1920, 1080), true);//输出
while (!isStop){//判断视频文件结束
using namespace std;
using namespace cv;
int main()
{
Mat left = imread("211.jpg");//加载图片
Mat right = imread("212.jpg");
int i, j;
for (i = 0; i < left.rows; i++)
三维视频:
利用拍摄图片的方法拍摄左眼视频与右眼视频,然后利用OpenCV读取左眼与右眼视频中的每一帧图像,利用上述方法合成三维图像,并利用OpenCV保存成.avi格式的视频。
难点:如何保持左眼视频与右眼视频在时间上的同步
三、
1.主模块设计
三维图片:
#include"iostream"
#include"cmath"
3.利用红蓝眼镜观察立体效果是否明显,如果不明显,请重复1~2
难点:
在拍摄左眼图与右眼图时有技巧:由于人的两眼间存在一个不足5厘米的间距,因此在盯住同一景物时,两个眼球的角度并不相同。因此我们的拍摄也必须模拟这一原理,对同一景物拍摄两张照片,而且拍摄时需要略微变换一下拍摄角度(这个角度很小,约5~10度)。其次为了达到更好的合成效果,目标最好选择一些前背景比较分明的景物,如果能用单反拍摄出背景虚化的照片就更好。
}
三维视频
#include <opencv\cv.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<iostream>
#include<cmath>