WPF integrating with web cam

前端 未结 2 1045
攒了一身酷
攒了一身酷 2021-01-16 07:15

How do you integrate a PictureBox to display a video through WPF?

相关标签:
2条回答
  • 2021-01-16 08:05

    You probably don't want to use PictureBox to display images in WPF because it's a Windows Forms control and therefore suffers from interop limitations.

    To display an image in WPF, use the Image element. Set its Source to be, typically, a BitmapImage whose UriSource is the URI of the bitmap file (which might be on the file system). (You can use another ImageSource type if that's an easier way to interface with the webcam.)

    To display video, use the MediaElement element. To display a video file, set MediaElement's Source property to the URI of the video (which again might be on the file system). If you need to pull images from the webcam in order to form the video, you need to use the MediaElement in "clock mode," which is described in the MediaElement class topic in MSDN. See also "Multimedia Overview" in the WPF SDK (http://msdn.microsoft.com/en-us/library/aa970915.aspx).

    0 讨论(0)
  • 2021-01-16 08:11

    Also try WPF MediaKit. The WPF MediaKit has a VideoCaptureElement control for WebCam support!

    0 讨论(0)
提交回复
热议问题