【推荐】用Python/OpenCV实现增强现实

2017 年 11 月 16 日 机器学习研究会
【推荐】用Python/OpenCV实现增强现实


点击上方 “机器学习研究会”可以订阅
摘要
 

转自:爱可可-爱生活

You may (or may not) have heard of or seen the augmented reality Invizimals video game or theTopps 3D baseball cards. The main idea is to render in the screen of a tablet, PC or smartphone a 3D model of a specific figure on top of a card according to the position and orientation of the card. 

Figure 1: Invizimal augmented reality cards. Source: 

Well, this past semester I took a course in Computer Vision where we studied some aspects of projective geometry and thought it would be an entertaining project to develop my own implementation of a card based augmented reality application. I warn you that we will need a bit of algebra to make it work but I’ll try to keep it as light as possible. To make the most out of it you should be comfortable working with different coordinate systems and transformation matrices.


First, this post does not pretend to be a tutorial, a comprehensive guide or an explanation of the Computer Vision techniques involved and I will just mention the essentials required to follow the post. However, I encourage you to dig deeper in the concepts that will appear along the way.

Secondly, do not expect some professional looking results. I did this just for fun and there are plenty of decisions I made that could have been done better. The main idea is to develop a proof of concept application.


With that said, here it goes my take on it.


Where do we start?

Looking at the project as a whole may make it seem more difficult than it really is. Luckily for us, we will be able to divide it into smaller parts that, when combined one on top of another, will allow us to have our augmented reality application working. The question now is, which are these smaller chunks that we need? 


Let’s take a closer look into what we want to achieve. As stated before, we want to project in a screen a 3D model of a figure whose position and orientation matches the position and orientation of some predefined flat surface. Furthermore, we want to do it in real time, so that if the surface changes its position or orientation the projected model does so accordingly.


To achieve this we first have to be able to identify the flat surface of reference in an image or video frame. Once identified, we can easily determine the transformation from the reference surface image (2D) to the target image (2D). This transformation is called homography. However, if what we want is to project a 3D model placed on top of the reference surface to the target image we need to extend the previous transformation to handle cases were the height of the point to project in the reference surface coordinate system is different than zero. This can be achieved with a bit of algebra. Finally, we should apply this transformation to our 3D model and draw it on the screen. Bearing the previous points in mind our project can be divided into:

          1.  Recognize the reference flat surface.

          2.  Estimate the homography.

          3.  Derive from the homography the transformation from the reference surface coordinate system to the target image coordinate system.

          4.  Project our 3D model in the image (pixel space) and draw it.


链接:

https://bitesofcode.wordpress.com/2017/09/12/augmented-reality-with-python-and-opencv-part-1/


原文链接:

https://m.weibo.cn/status/4174455095988780

“完整内容”请点击【阅读原文】
↓↓↓
登录查看更多
5

相关内容

一个跨平台的计算机视觉处理库,全称是Open Source Computer Vision。
小贴士
相关资讯
OpenCV特征提取与图像检索实现(附代码)
Python机器学习教程资料/代码
机器学习研究会
5+阅读 · 2018年2月22日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
6+阅读 · 2017年12月5日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
16+阅读 · 2017年11月5日
【推荐】树莓派/OpenCV/dlib人脸定位/瞌睡检测
机器学习研究会
8+阅读 · 2017年10月24日
【推荐】视频目标分割基础
机器学习研究会
6+阅读 · 2017年9月19日
【推荐】深度学习目标检测全面综述
机器学习研究会
17+阅读 · 2017年9月13日
【推荐】深度学习目标检测概览
机器学习研究会
9+阅读 · 2017年9月1日
【推荐】SVM实例教程
机器学习研究会
12+阅读 · 2017年8月26日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
相关VIP内容
【精通OpenCV 4】Mastering OpenCV 4 - Third Edition 随书代码
专知会员服务
14+阅读 · 2019年11月13日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
43+阅读 · 2019年10月12日
开源书:PyTorch深度学习起步
专知会员服务
20+阅读 · 2019年10月11日
强化学习最新教程,17页pdf
专知会员服务
45+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
18+阅读 · 2019年10月11日
[综述]深度学习下的场景文本检测与识别
专知会员服务
29+阅读 · 2019年10月10日
机器学习入门的经验与建议
专知会员服务
28+阅读 · 2019年10月10日
相关论文
Blockchain for Future Smart Grid: A Comprehensive Survey
Muhammad Baqer Mollah,Jun Zhao,Dusit Niyato,Kwok-Yan Lam,Xin Zhang,Amer M. Y. M. Ghias,Leong Hai Koh,Lei Yang
8+阅读 · 2019年11月8日
The Measure of Intelligence
François Chollet
3+阅读 · 2019年11月5日
Fabio Petroni,Tim Rocktäschel,Patrick Lewis,Anton Bakhtin,Yuxiang Wu,Alexander H. Miller,Sebastian Riedel
5+阅读 · 2019年9月4日
Risk-Aware Active Inverse Reinforcement Learning
Daniel S. Brown,Yuchen Cui,Scott Niekum
4+阅读 · 2019年1月8日
Elias Pimenidis,Nikolaos Polatidis,Haralambos Mouratidis
7+阅读 · 2018年5月6日
Jianxin Lin,Yingce Xia,Tao Qin,Zhibo Chen,Tie-Yan Liu
3+阅读 · 2018年5月1日
Kaiming He,Georgia Gkioxari,Piotr Dollár,Ross Girshick
7+阅读 · 2018年1月24日
Ankur Sharma,Felix Martin Schuhknecht,Jens Dittrich
3+阅读 · 2018年1月17日
Tanya Piplani,David Bamman
11+阅读 · 2018年1月11日
Rajesh Doriya,Paresh Sao,Vinit Payal,Vibhav Anand,Pavan Chakraborty
4+阅读 · 2017年1月29日
Top