如何以编程方式拍摄快照时关闭相机灯?

时间:2014-10-01 10:00:20

标签: objective-c macos camera

我正在开发一个应用程序,其中我想在运行时捕获图像。 它必须适用于 MAC PRO& Mac mini(如果连接了网络摄像头)。当相机拍照时小光会在拍摄时拍摄,不应该来。它不是关于 flash。

代码段

- (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
{
    // If we already have an image we should use that instead
    if ( currentImage ) return;

    // Retain the videoFrame so it won't disappear
    // don't forget to release!
    CVBufferRetain(videoFrame);

    // The Apple docs state that this action must be synchronized
    // as this method will be run on another thread
    @synchronized (self) {
        currentImage = videoFrame;
    }

    // As stated above, this method will be called on another thread, so
    // we perform the selector that handles the image on the main thread
    [self performSelectorOnMainThread:@selector(saveImage) withObject:nil waitUntilDone:NO];
}

要捕捉图片,我正在使用上述方法。提前致谢

1 个答案:

答案 0 :(得分:2)

根据this article,一些较旧的MacBook'通过直接连接到电路板逻辑可以避开相机LED。

据我所知,不再有这个安全漏洞,Objective-C中也没有可用的API来禁用相机LED。