简体   繁体   English

Delphi XE5 Firemonkey视频帧抓取和显示

[英]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. 其他地方有一个Stackoverflow线程,指出Firemonkey必须通过主线程显示视频。 I am trying to use a DirectX camera to snag a series of images (in Win8.1 for now--other OS's can wait). 我正在尝试使用DirectX摄像机捕获一系列图像(目前在Win8.1中-其他操作系统可以等待)。 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. 因此,我在Embarcadero示例代码(在表单上只有TImage)中使用了SampleBufferReady和SampleBufferSync方法,但是进行了足够的更改,以至于我什么都看不到。 I need to do my display in a TImageViewer; 我需要在TImageViewer中显示; pointing the tbitmap in the SampleBufferSync at that tbitmap is easy. 将SampleBufferSync中的tbitmap指向该tbitmap很容易。 But nothing displays. 但是什么也没显示。 From a procedural viewpoint, pseudocode of what I want is 从过程的角度来看,我想要的伪代码是

setup whatever
camera.startcapture 
repeat
 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)
camera

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? 我必须定义我自己的TEvent来发现相机捕捉到图像,还是已经存在? I would have thought that SampleBufferReady would respond to the arrival of an image and I could process whatever inside that event. 我本以为SampleBufferReady会响应图像的到达,并且我可以处理该事件中的任何内容。
  • 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? 要以TImage以外的其他方式显示图像,我是否需要关闭相机,绘制位图,然后重新打开相机? If so, will I need to have SampleBufferReady contain a command to turn the camera off? 如果是这样,我是否需要让SampleBufferReady包含关闭相机的命令? Boy, does that sound clunky! 男孩,听起来笨拙!

Suggestions? 建议?

here is a complete code source that i test the c++ version that is same as pascal in term of function calls and mechanism, only the syntax differ: download here the pascal version . 这是一个完整的代码源,我在功能调用和机制方面测试了与pascal相同的c ++版本,只有语法不同: 在此处下载pascal版本

the code work fine for both android and desktop( i test the c++ version). 该代码在android和台式机上都可以正常工作(我测试了c ++版本)。 so download, test and confirm for me the pascal code. 因此,请为我下载,测试并确认Pascal代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM