How to clear captured frames

Hello,

We have a system that comprises of 3 IMX377 cameras.

We have developed software that captures and stores images on event from all three cameras sequentially using the Argus library.

There appears to be a problem and sometimes one of the cameras will return an image from a previous timestamp.

Is there a way to clear the frames prior to each capture ?

Here is a sample of our code in case it helps.

while(iSession->isRepeating()){
  cout<<"Stuck on request wait till finish\n";
}     
status = iSession->waitForIdle(7);
if(status != Argus::STATUS_OK) {
  cout<<"Problem on request "<<status<<"\n";
  iSession->cancelRequests();
}

uint32_t requestId = iSession->capture(request.get());
if(!requestId) {
  cout<<"Failed to submit capture request\n";
  return -3;
}

Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame());
EGLStream::IFrame *iFrame = Argus::interface_cast<EGLStream::IFrame>(frame);

if(!iFrame) {
  cout<<"Failed to get IFrame interface\n";
  return -1;
}

EGLStream::Image *image = iFrame->getImage();
if(!image) {
  cout<<"Failed to get Image from iFrame->getImage()\n";
  return -1;
}
    
EGLStream::IImageJPEG *iImageJPEG = Argus::interface_cast<EGLStream::IImageJPEG>(image);
if(!iImageJPEG) {
  cout<<"Failed to get ImageJPEG Interface\n";
  return -1;
}

status = iImageJPEG->writeJPEG(filename.c_str());
if(status!=Argus::STATUS_OK) {
  cout<<"Failed to write JPEG\n";
  return -1;
}

Ideally, I would like to purge any remaining frames at the end of this function.

Thank you in advance.

hello pavlos.stavrou,

there’s low-level driver to handle remaining queue buffers in the end of capture.
you could refer to below function calls for reference, thanks

sources/r28.x/kernel/kernel-4.4/drivers/media/platform/tegra/camera/vi/vi2_fops.c
static void tegra_channel_capture_done(){...}

Hello,

Thank you for the reply.

One thing I do not yet undestand is if the argus library buffers frames internally and if so, is there a way to reset the captured frames ? Each frame has a frameNo and timestamp associated with it. Those are assigned by arguslib correct ?

hello pavlos.stavrou,

  1. is there a way to reset the captured frames
    may I know what’s your use-case, could you please have some description of the process and what’s the expect result.

  2. if you’re working with libargus, then frame number and sensor timestamp is assigned by it, the timestamp here is a shutter timestamp which slightly later as CSI start.