How to get current image without buffer image in libcamera?

Dear Wong,
As per your guidance I have successfully installed libcamera c++ and getting image . But now I have an issue with grabbing image from camera, while I try to grab image from camera using

LibcameraOutData frameData;
    bool flag=camera.readFrame(& frameData);//camera is libcamera variable
     if(!flag)
      {
       return;
       }
      cv::Mat im(640,480,CV_8UC3, frameData.imageData);
       Display_image(); // convert cv::Mat  to Qimage and display in qpainter
       Camera.returnFrameBuffer(frameData);

I only getting past buffer image .is there any option to set buffer size (or) any other options , please give some advice regarding this issue. Thank you in Advance

Hi, Balaji

You can set the number of buffers as indicated in the figure above.

The sample code given to you before can be found on line 32 of the LibCamera.cpp file.

In the example, I set bufferCount in main.cpp. As shown in FIG.

Dear yang,
by setting camera buffer while init camera as 0
int ret = cam.initCamera(width, height, formats::RGB888, 0, 0);
I am still getting past image from camera ,while click pushbutton for first 5 times it gives past image at 6th time it gives current image.is there any buffer need to clear in camera or system hardware.if its need to clear buffer in hardware please give an instruction to clear it . Thank you in Advance

Dear yang,
by setting camera buffer while init camera as 1
int ret = cam.initCamera(width, height, formats::RGB888, 1, 0);
I am still getting past image from camera ,while click pushbutton for first 2 times it gives past image at
3rd time it gives current image.at default it stores 2 past image as buffer .

hi, Balaji

In the sample code, when bufferCount is set to 0, the if branch cannot be entered, resulting in the inability to set bufferCount, and the default bufferCount is finally used. You can remove “if (bufferCount)” and have a try.

When bufferCount is set to 1. The previous two images are still in the past because they should be cached. Currently, clearing the buffer is not supported.

Hi yang,
is there any way clear that cache memory, please give some advice regarding this issue . Thank you in Advance

hi, Balaji

Sorry, I don’t know any way to clear the buffer.

You can try to save the read image to the queue, and then get the latest frame of image from the queue.

Hi yang,
is that possible to get latest frame from queue. And how to store cv::Mat frame in queue. Please give me an example.

Hi yang,
Please give an response as soon as possible. Thank you in Advance.

hi, Balaji

Sorry, we do not have examples in this regard.

This is beyond the scope of our support. Regarding software implementation, you need to explore it yourself

Hi Balaji and yang,
did you guys find any solution to this problem?