iOS - 2d 图像变成 3d [英] iOS - 2d image turn into a 3d

查看:26
本文介绍了iOS - 2d 图像变成 3d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看这款名为 展示了 morfo 如何使用模板机制进行转换.即在输入 2D 图像后,需要设置人脸的边界、眼睛所在的位置、大小和大小.嘴唇的长度.然后它开始将其转换为 3D 模型.这部分是怎么做的?他们可能会使用哪些框架或库?

解决方案

这是一个广泛的问题,但我可以为您指出 3D 渲染如何工作的正确方向,相信我,这是一个巨大的主题,背后有数十年的工作和很多放在这里.不确定您在 3D 渲染技术方面的速度如何,所以我会给您一个基本的纹理概念,并为您提供一套很好的教程.

  1. 他们是怎么做到的?
    这个想法是在 3D 渲染中,3D 模型可以使用称为纹理贴图的 2d 图像进行纹理化.您使用 2D 图像并将其包裹在 3d 模型周围,可以是简单的原始模型(如立方体球体)或更高级的模型(如经典茶壶或人头模型等).纹理可以从任何地方拍摄,我过去曾使用相机馈送用来自相机流的视频来纹理网格,我使用了相机中的照片,这是如何做到的.这就是面部渲染到 3D 模型的方式.

  2. 这样有效吗?
    在 iOS 和大多数移动设备上,3D 渲染使用利用 OpenGLES 的硬件加速.关于您的问题,这真的很快,具体取决于您实现渲染代码的方式.

anticyclope 提到的它使用映射(视频中的缩放旋转模板)的方式允许您使纹理适合模型,并放置作为渲染代码一部分的眼睛.

因此,如果您想学习这个,我建议您阅读从头开始"的 Jeff Lamarche 教程:

http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html

其次,我已经阅读了大约 4 本书关于 OpenGLES,用于一般设计和平台细节.我推荐这本书:

http://www.amazon.co.uk/iPhone-Programming-Developing-Graphical-Applications/dp/0596804822/ref=sr_1_1?ie=UTF8&qid=1331114559&sr=8-1

I was checking out this cool app called Morfo. According to their product description -

Use Morfo to quickly turn a photo of your friend's face into a talking, dancing, crazy 3D character! Once captured, you can make your friend say anything you want in a silly voice, rock out, wear makeup, sport a pair of huge green cat eyes, suddenly gain 300lbs, and more.

So if you take a normal 2D image of steve jobs & feed it to this app it converts it into a 3D model of that image & the user can interact with it.

My questions are as following -

  1. How are they doing this?
  2. How is this possible in iPad?
  3. Isn't it computationally intensive to render and convert 2D image into 3D?

Any pointers, links to websites or libraries in objectiveC which do this is very much appreciated.

UPDATE: this demo of this product here shows how morfo, uses a template mechanism to do the conversion. i.e. after a 2D image is fed, one needs to set the boundaries of the face, where the eyes are located, size & length of lips. then it goes off to convert it into a 3D model. How is this part done? What frameworks or libraries they might be using?

解决方案

This is a broad question but i can point you in the right direction of how 3D Rendering works, trust me this is a huge subject with decades of work behind it and to much to put here. Not sure how up to speed you are on 3D Rendering techniques so i will give you a basic idea of texturing and point you to a good set of tutorials.

  1. How are they doing this?
    The idea is that in 3D Rendering, 3D models can be textured with a 2d image known as a texture map. You use a 2D image and wrap it around a 3d model, be that a simple primitive like a sphere of a cube or more advanced such as the classic teapot or the model of a human head e.t.c. A texture can be taken from anywhere, I have used the camera feed in the past to texture meshes with the video from the camera stream, I have used photos from the camera which s how there doing it. So this is how the face is rendered to the 3D Model.

  2. Is this efficient?
    On iOS and most mobile devices 3D rendering uses hardware acceleration utilizing OpenGLES. In regards to your question this is really fast depending on how you implement your render code.

The way it uses the mapping (scale rotate template in the video) as mentioned by anticyclope allows you to make the texture fit a model and also place the eyes which are part of there render code.

So if you want to pick this up i recommend reading Jeff Lamarche Tutorial "from the ground up" as a primer:

http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html

Second to that i have read about 4 books on OpenGLES, for general design and for platforms specifics. I recommend this book:

http://www.amazon.co.uk/iPhone-Programming-Developing-Graphical-Applications/dp/0596804822/ref=sr_1_1?ie=UTF8&qid=1331114559&sr=8-1

这篇关于iOS - 2d 图像变成 3d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆