简体   繁体   中英

How can I capture frames from a Bodelin ProScope HR using AVCaptureSession on Mac OS X Lion?

I am attempting to grab frames and preview the video from a Bodelin Proscope HR USB microscope. I have a simple Cocoa app using an AVCaptureSession with an AVCaptureDeviceInput for the Proscope HR and a AVCaptureVideoPreviewLayer displaying the output.

All of this works fine with the built-in iSight camera, but the output from the Proscope HR is garbled beyond recognition.

Using the bundled Proscope software, I sometimes see the same garbling when trying to use the higher resolutions. My suspicion is that the hardware used is rather under-spec'd, and this is bolstered by the fact that at the lowest 320x200 resolution the bundled software grabs at 30fps, but when you bump up the resolutions the frame rates drop dramatically, down to 15fps at 640x480, all the way down to 3.75fps at the maximum resolution of 1600x1200.

EDIT: I originally thought that perhaps the frame rate being attempted by the AVCaptureSession was too high, but I have since confirmed that (at least in theory) the capture session is requesting the frame rate advertised by the AVCaptureDevice.

I should note that I have already tried all of the standard AVCaptureSessionPreset* constant presets defined in the headers, and none of them improved the results from the Proscope HR. (They did however appear to affect the built-in iSight in approximately the expected manner.)

Here is a screen capture showing the garbled output from the ProScope HR:

ProScope HR输出

And just for comparison, the output from a generic WebCam:

通用WebCam输出

According to the documentation you should configure AVCaptureDevice rather than AVCaptureSession .

EDIT: The AV framework is developed on top of IOKit and it fully relies on the fact that you have no problems with hardware. In your case, it looks like the root of your problem is hardware-related so you should consider using IOKit directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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