Hi guys,
I’m trying to read a large-size video (3840*2160) from opencv and then convert it to texture2d in unity frame by
frame, in order to show it as background of a 3d scene. The way I’m using is as follows:
in cpp:
mat opencvimg;
…
byte* imgdata=new byte[widhheight3];
memcpy(imgdata,opencvimg.data,widhheight3);
in c#:
Texture2d texture0
texture0.LoadRawTextureData(imgdata);
texture0.Apply();
GUITexture backgroundtexture;
backgroundtexture.texture=texture0;
When the size of the video is of size 1920*1080, it went smoothly.
However, I found that texture0.Apply() is quite quite slow that the video cannot be played normally.
Could anyone please give me some suggestions on how to do in real time please?
Thank you!