I’m making an application that will run on a tablet device that has two webcams built in. One of the requirements is to be able to capture images and save them.
So far I have been able to get the preview of the webcam’s output using this code
Dim Job As New LiveJob
Dim source As LiveDeviceSource
source = Job.AddDeviceSource(EncoderDevices.FindDevices(EncoderDeviceType.Video).Item(0), Nothing)
source.PreviewWindow = New PreviewWindow(New HandleRef(Me.panPreview, Me.panPreview.Handle))
Job.ActivateSource(source)
This displays the preview in a hosted winforms panel. The question is how do I capture an image from this stream and return a new image object for later processing?
I have tried capturing the winforms host using RenderTargetBitmap but just returns a black rectangle and it wont let me render the winforms panel.