Page 1 of 1

Fast Access to Camera Frames

Posted: Thu Jul 14, 2016 2:26 pm
by cjb
Hi,

I'm thinking of using RVMedia for my application for video capture from USB and IP cameras. The thing is I need fast access to the actual frames being captured, since I have to transfer these to 3D textures to build into another graphical framework.

Can you tell me if there is a solution to capture frame data in real-time, perhaps via an event e.g. OnNewFrame ? If not, would you be able to add this into the TRVCamera class or wherever appropriate?

Thanks

Posted: Thu Jul 14, 2016 5:17 pm
by Sergey Tkachenko
TRVCamera.OnGetImage event.
You can see how it can be used in Demos\Cameras\MotionDetect\ demo.

Posted: Fri Jul 15, 2016 6:56 am
by cjb
Ah thanks I will try this out...

Posted: Wed Jul 20, 2016 1:07 pm
by cjb
I've hit a problem integrating the OnGetImage handler into my application. It appears that the 'Img: TRVMBitmap' parameter is freed immediately after the event callback is called. Can you confirm this please?

The reason this causes a problem for me is that I want to wake up another processing thread from within the OnGetImage handler, then just pass across a pointer to the data buffer '@Img.Data[0]'. But when the processing thread wakes up to read the image data and copy it elsewhere, accessing the memory location gives an immediate AV error. If I call the same processing code from within the OnGetImage handler then there's no problem.

Is it possible that you could extend the lifetime of the TRVMBitmap instance, or maybe recycle it for successive frames, or use a small 'pool' of TRVMBitmap instances and cycle round them? Performance when processing large frame images is a big deal for my app and ideally I want to avoid unnecessary copying of frame image data.

Thanks.

Posted: Wed Jul 20, 2016 2:12 pm
by Sergey Tkachenko
Yes, it is freed by the component.
If you need a persistent image, copy it to your object.