Delphi XE5 Firemonkey Video Frame Grab and Display


There’s a Stackoverflow thread elsewhere that points out that Firemonkey has to display video through the primary thread. I am trying to use a DirectX camera to snag a series of images (in Win8.1 for now–other OS’s can wait). So I use the SampleBufferReady and SampleBufferSync approaches in the Embarcadero example code (that just has a TImage on a form), but with enough changes that I never see anything. I need to do my display in a TImageViewer; pointing the tbitmap in the SampleBufferSync at that tbitmap is easy. But nothing displays. From a procedural viewpoint, pseudocode of what I want is

setup whatever
repeat until framecaptured {what SampleBufferReady should do — only fire when ready}
Imageviewer.repaint {inside SampleBufferReady?}
inc(mycounter) {inside SampleBufferReady?}
until (mycounter>mylimit) or (user interrupts video input)

One could add a ttimer to slow things down. What I don’t “get” is

must I define my own TEvent to find out that the camera’s snagged an image, or does this even already exist? I would have thought that SampleBufferReady would respond to the arrival of an image and I could process whatever inside that event.
to display an image in something other than a TImage, will I need to turn off the camera, paint the bitmap, then turn the camera back on? If so, will I need to have SampleBufferReady contain a command to turn the camera off? Boy, does that sound clunky!


Comments are closed.