Jump to content

openCV slow frame reading. Part 2


photo

Recommended Posts

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

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.

  • Like 1
Link to comment
×
×
  • Create New...