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

2017 年 11 月 16 日 机器学习研究会


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

转自:爱可可-爱生活

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

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

相关内容

增强现实(Augmented Reality,简称 AR),是一种实时地计算摄影机影像的位置及角度并加上相应图像的技术,这种技术的目标是在屏幕上把虚拟世界套在现实世界并进行互动。
【精通OpenCV 4】Mastering OpenCV 4 - Third Edition 随书代码
专知会员服务
35+阅读 · 2019年11月13日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
143+阅读 · 2019年10月12日
开源书:PyTorch深度学习起步
专知会员服务
49+阅读 · 2019年10月11日
强化学习最新教程,17页pdf
专知会员服务
167+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
35+阅读 · 2019年10月11日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
机器学习入门的经验与建议
专知会员服务
89+阅读 · 2019年10月10日
OpenCV特征提取与图像检索实现(附代码)
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
10+阅读 · 2017年12月5日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
【推荐】树莓派/OpenCV/dlib人脸定位/瞌睡检测
机器学习研究会
9+阅读 · 2017年10月24日
【推荐】视频目标分割基础
机器学习研究会
9+阅读 · 2017年9月19日
【推荐】深度学习目标检测全面综述
机器学习研究会
21+阅读 · 2017年9月13日
【推荐】深度学习目标检测概览
机器学习研究会
10+阅读 · 2017年9月1日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
The Measure of Intelligence
Arxiv
6+阅读 · 2019年11月5日
Arxiv
6+阅读 · 2019年9月4日
Risk-Aware Active Inverse Reinforcement Learning
Arxiv
7+阅读 · 2019年1月8日
Arxiv
8+阅读 · 2018年5月1日
Arxiv
7+阅读 · 2018年1月24日
Arxiv
11+阅读 · 2018年1月11日
VIP会员
相关VIP内容
【精通OpenCV 4】Mastering OpenCV 4 - Third Edition 随书代码
专知会员服务
35+阅读 · 2019年11月13日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
143+阅读 · 2019年10月12日
开源书:PyTorch深度学习起步
专知会员服务
49+阅读 · 2019年10月11日
强化学习最新教程,17页pdf
专知会员服务
167+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
35+阅读 · 2019年10月11日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
机器学习入门的经验与建议
专知会员服务
89+阅读 · 2019年10月10日
相关资讯
OpenCV特征提取与图像检索实现(附代码)
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
10+阅读 · 2017年12月5日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
【推荐】树莓派/OpenCV/dlib人脸定位/瞌睡检测
机器学习研究会
9+阅读 · 2017年10月24日
【推荐】视频目标分割基础
机器学习研究会
9+阅读 · 2017年9月19日
【推荐】深度学习目标检测全面综述
机器学习研究会
21+阅读 · 2017年9月13日
【推荐】深度学习目标检测概览
机器学习研究会
10+阅读 · 2017年9月1日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
相关论文
The Measure of Intelligence
Arxiv
6+阅读 · 2019年11月5日
Arxiv
6+阅读 · 2019年9月4日
Risk-Aware Active Inverse Reinforcement Learning
Arxiv
7+阅读 · 2019年1月8日
Arxiv
8+阅读 · 2018年5月1日
Arxiv
7+阅读 · 2018年1月24日
Arxiv
11+阅读 · 2018年1月11日
Top
微信扫码咨询专知VIP会员