- Home /
import video from camera
Hello, For my project I have to display live videos from Camera. I am receiving video frames in a different framework (Visual Studio), from there I have to send frames to unity3d. Now framework uses openCv library and so stores images in IplImage format AND from there I have to send these frames to unity3d (which uses Texture2D class), so I am stuck with this...
In IplImage format I can directly use Image Data (with pointer image->imageData), Is there anyway to access Texture2D image data also, so that I can fill colors from IplImage to Texture2D image ??
Answer by StephanK · Jul 16, 2010 at 09:03 AM
You can access the pixels of an Iplimage. So what you'll have to do is convert the iplimage to use the correct color format (i think it's rgba32) and send this data backt to unity to modify your texture2d. The fastest way (imo) to do this is create a Texture2D or pixel(Color) array in unity, then send a pointer to that array to opencv and memcpy the pixels of your currentframe to the pointer. Best thing is to do this in a separate thread so your webcams framerate won't block your games fps.
Answer by RustemKamun · Jan 31, 2011 at 09:04 AM
Do you mean to send necessary data through the network(sockets) ? Or there exists other way to send info from unity to opencv and vice versa
Answer by Arjun · Feb 02, 2011 at 01:48 PM
no no, not through sockets. actually i used some plugin /dll stuff to do this, i dont remember by now to do this. but i finally did it. if u need info, i will try to go through old source code files.
I have the same question, and I also use plugin / dll, can u share the source code with me, thank u very much.
Your answer
Follow this Question
Related Questions
fast way for converting from opencv mat to texture2d 1 Answer
Image Stitching without external libraries 0 Answers
android display h264 byte[] stream 0 Answers
Using of Texture2D.LoadImage 0 Answers
QueryFrame changes resolution of camera 0 Answers