Any ability to use web camera STILL image mode to take picture? #24
-
|
I want to take a still image. Not just save a random frame from a video stream. Using the Windows Media Foundation API ( not DirectX ) If you use Windows 10 Camera app, say on a surface pro. Downloaded latest MF pack and don't see this ability. So not sure if it is there and missing something. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 22 replies
-
|
Hello, Depending on the hardware a still image, snap-shot or freeze-frame kan be taken from it's still image pin. For this you have to use DirectShow. Capturing an Image From a Still Image Pin Media Foundation does have this ability. There are 2 scenarios: 1# In combination with the WIC (which is also part of MfPack), it is possible to pick a frame from the videostream and convert this frame to the proper format. as been suggested here A good readable "how to" can be found here on Code Project 2# By using the IMFCapturePhotoSink interface (WinApi.MediaFoundationApi.MfCaptureEngine.pas), you can extract still images from a video stream, as explained here. Greetings, Tony. |
Beta Was this translation helpful? Give feedback.
-
|
I might look into doing a sample project demonstrating webcam to still image capture. It seems like one of the few remaining use cases that is not covered. |
Beta Was this translation helpful? Give feedback.
-
This can be done by implementing the TCPreview class from sample MfCaptureD3D9. Here the class will show the preview processed by IMFSourceReaderCallback.OnReadSample. The only thing you have to do is create a Window class like for instance TPanel to show the preview. I'll try to implement this. |
Beta Was this translation helpful? Give feedback.
-
|
My suggestion is: To adjust camera properties ( like brightness, format etc.) a sink should be implemented in OnReadSample, when a sample is token. Therefore you should use the interfaces from WinApi.MediaFoundationApi.CameraUIControl.pas. I think that is more likely the way to implement a preview and conversion for supported formats see here |
Beta Was this translation helpful? Give feedback.
-
|
OK, I'd wrote a function that doesn't need a session or d3d9 surface to get a preview. I did not test it yet, but I think in theory it should work with your sample. |
Beta Was this translation helpful? Give feedback.
-
|
I wonder why there is a function IsInputSupported and why the list of supported formats is limited to the list in function SetSupportedInputs(); |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Checking to see how things on this are progressing? This issue haunts my dreams for years now. Came back up yesterday. |
Beta Was this translation helpful? Give feedback.
-
|
MFCaptureEngineVideoCapture sample has been fixed. |
Beta Was this translation helpful? Give feedback.
MFCaptureEngineVideoCapture sample has been fixed.
Also the different format on a SurfacePro is caused by it's camera pin preview format.
A preview format has always a lower quality than the actual camera format.
So, a clip from a preview snapshot has always a lower quality as a result.
Therefore you should not get a snapshot from a preview, but from the actual camera presentation.