Fast Access to Camera Frames

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
cjb
Posts: 12
Joined: Wed Jun 08, 2016 8:47 am

Fast Access to Camera Frames

Post 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
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRVCamera.OnGetImage event.
You can see how it can be used in Demos\Cameras\MotionDetect\ demo.
cjb
Posts: 12
Joined: Wed Jun 08, 2016 8:47 am

Post by cjb »

Ah thanks I will try this out...
cjb
Posts: 12
Joined: Wed Jun 08, 2016 8:47 am

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, it is freed by the component.
If you need a persistent image, copy it to your object.
Post Reply