dmitry.vavilov Posted September 14, 2021 Share Posted September 14, 2021 hello. do we have some changes about showing webcam video or video from file after that topic? maybe not openCV? i have module that takes 4K image from webcam to openCV Mat in separate C# Thread. then there's this code somewhere in PostUpdate: // cimage is Unigine Image instance var ptr = cimage.GetPixels2D(); Marshal.Copy(cimg.Bytes, 0, ptr, cimg.Bytes.Length); ctexture.SetImage(cimage); maybe marshalling is not best appoach for this. so do Unigine have high-speed method for changing texture pixels? Link to comment
rohit.gonsalves Posted September 14, 2021 Share Posted September 14, 2021 Dear @dmitry.vavilov, Yesterday I have tried to answer the same question in the following thread I am taking images from Intel RealSense D455. But I don't take them in RGBA color space but UYVY color space. Which webcam is this? 4K? The thing is Quote maybe marshalling is not best approach for this. No This is wrong conclusion. The problem lies here. Quote ctexture.SetImage(cimage); You can profile for this call using UNIGINE Profiling. Whichever is the engine, UNIGINE, Unreal or Unity, we must use correct approaches to solve this problem as the problem lies in PCIe transfers (Bandwidth cap per second). RGBA data length is width X height X 4 and UYVY for same texture is width X height X 2. There is a small loss of quality (in terms of chrominance) which our brain is not capable of understanding. Then On GPU you convert UYVY 4K stream to RGBA 4K. It is 10 times faster than receiving 4K through PCIE. Please refer to the above thread for suitable answers. Rohit. 2 Link to comment
d.vavilov Posted September 25, 2021 Share Posted September 25, 2021 @rohit.gonsalves thank You Rohit! i can't rapidly generate UYVY on my version of OpenCV, but created ring of Texture objects and change their BGRA pixels in other threads, material texture is binding on every Update(). Firstly got a lot of access violations on the way of course, but now can show 4K camera in Unigine 2 Link to comment
Recommended Posts