- Home /
How do I paste an frame of a video source to a specified area of an object surface? (Or how do I manipulate specific pixels of a texture?)
Hey everybody : ) I'm rather new to Unity and I'm working on a 3D reconstruction project. My purpose is to aquire one or several frames from a camera and then to paste them to some corresponding area on the surfaces of some objects such as planes standing for ground and walls, etc. The issue is that i have no idea how to get the pixels in the video source and how to manipulate specific pixels in the target texutre. The video source provides a Texture2D, and the Texutre2D is delivered to the mainTexture of a quad's material in the demo. We want to, however, deform the shape of the Texture2D (namely texutre), and paste it to, for example, a trapezoid area at some appointed location on a plane's surface. When I use "Color32[] vedioPixels = texture.GetPixels32();" ,Unity reports "Invalid texture". Moreover, when I use "Color[] vedioPixels = texture.GetPixels();" ,Unity reports "texture has no data". Any help would be appreciated. Looking forward to your favourable replys. Many thanks. :D
Your answer
Follow this Question
Related Questions
Is it possible to determine a color of a pixel under if that pixel is under a game object? 1 Answer
Playing Video in Unity 5 (on mobile) 4 Answers
Switching Videoclips for VideoPlayer in Unity degrades FPS drastically 0 Answers
Cut a sphereMovie texture into multiple halves in Unity and play a different video on each half 0 Answers