Merge and wrap UIImage on mug

徘徊边缘 提交于 2020-01-11 10:49:49

问题


I have two images and I want to merge those two images like I have a image of mug and second image is any image. Now I want to merge with it to mug how could I achieve this like the image which will placed on mug must wrap up first like I take pic from camera and than paste that into mug but how I wrap that image!


回答1:


@Akhil: You are asking a very complicated question that goes out of the realm of simple iOS development. If your question is specifically, "wrap an image on a mug," then it can be approached as, "apply a texture to a mesh object," in which case you'll want to be using OpenGL ES, and have predefined models (with UV mapping) to apply the image/texture on to.

In addition, you could use OpenGL and perform a grid mesh translation (mesh warping)—that is to say you'll take an image on a mesh (with a (grid) resolution) and then manipulate all of the points to create the warp effect. Also, GLKit may help in this process and Core Image may also provide a simple solution.

If you're question is, I have a random image and I want to derive the 3D shape of it, then apply a second image to the derived shape and composite them together, that's even trickier as the first part will take advanced image processing to determine the original object/selection shape.

Here is some additional information:

  • Apple's GLCameraRipple sample code: http://developer.apple.com/library/ios/#samplecode/GLCameraRipple/Introduction/Intro.html
  • Paper on Image Warping (PDF): http://www.seas.upenn.edu/~cse399b/Lectures/CSE399b-07-warp-mesh.pdf
  • OpenGL reference for image warping: http://paulbourke.net/dataformats/meshwarp/
  • Tutorials for GLKit: http://maniacdev.com/ios-5-sdk-tutorial-and-guide/glkit/
  • Tutorials for Core Image: http://maniacdev.com/ios-5-sdk-tutorial-and-guide/core-image-example/
  • A handout from NTU on image warping (PDF): http://www.csie.ntu.edu.tw/~cyy/courses/vfx/05spring/lectures/handouts/lec03_morphing_4up.pdf
  • Associated information from StackOverflow: iOS images in a bubble effect

Cheers and good luck!



来源:https://stackoverflow.com/questions/11737828/merge-and-wrap-uiimage-on-mug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!