You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in our app we are using this library and running 3 camera's , in that 2 camera's are monochrome camera's and one is RGB camera.
when they are running amost 50% of CPU is occupying
Each camera is running on different thread
modified your usbcamera.cs class which will return byte[] after some processing steps, They are
Fliiping the camera feed , Compressing the image quality and converting to byte[]
Here is the modified class
' public byte[] BufferToBitmap_Bytes_V2(byte[] buffer)
{
if (buffer == null || buffer.Length == 0)
return null;
try
{
// Step 1: Create OpenCV Mat directly from the buffer
using (var mat = new OpenCvSharp.Mat(Height, Width, OpenCvSharp.MatType.CV_8UC3, buffer))
{
// Step 2: Flip the Mat vertically
//OpenCvSharp.Cv2.Flip(mat, mat, OpenCvSharp.FlipMode.X);
// Step 3: Compress the Mat to JPEG
int[] compressionParams =
{
(int)OpenCvSharp.ImwriteFlags.JpegQuality,
OCT_Config.IRIS_Image_Quality_For_Transfer
};
OpenCvSharp.Cv2.ImEncode(".jpg", mat, out var jpegData, compressionParams);
return jpegData;
}
}
catch (Exception ex)
{
// Log the error for debugging purposes
ConsoleWrapper.WriteLine($"Error in BufferToBitmap_Bytes: {ex.Message}");
return null;
}
}`
Can we optimize the performance and is there anyway to run the calculations on GPU
The text was updated successfully, but these errors were encountered:
As I check your modified BufferToBitmap_Bytes_V2().
original BuffetToBitmap is designed to return non compressed image data, but you compress image to jpeg file.
(this is your modified version, it is okey.)
compressing image may require some CPU power. You had better do not compress image?
You are now using OpenCvSharp function.
I think it may because you have to read monochrome image type(called Y8 or Y800).
I have never use monochrome Y800 image format, but as I googled, it is not so difficult to read data.
If you do not use OpenCvSharp and read Y800 by yourself, it may be possible to reduce CPU usage.
in our app we are using this library and running 3 camera's , in that 2 camera's are monochrome camera's and one is RGB camera.
when they are running amost 50% of CPU is occupying
Each camera is running on different thread
modified your usbcamera.cs class which will return byte[] after some processing steps, They are
Fliiping the camera feed , Compressing the image quality and converting to byte[]
Here is the modified class
Can we optimize the performance and is there anyway to run the calculations on GPU
The text was updated successfully, but these errors were encountered: