0

I want to be able to see the "preview" image of my webcam on a pictureBox, in case I just show an image captured in the pictureBox when I use MediaCapture.PrepareLowLagPhotoCaptureAsync, soon does not show what the camera sees, but rather just one tidara photo at a time, which takes around 1 second to take

When I google how to do this i intend, it always returns as a solution the use of CaptureElement, but this class is not available in c# .NET 7 Form/WPF/WinUI3, it is only available in the UWP

So to solve my problem have 2 options, or I can use CapturElement in.NET 7 Form or another alternative way to do what I intend to do without CapturElement... So How do I solve my problem?

https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.captureelement?view=winrt-22621

https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/simple-camera-preview-access

Edit1: I can fully use MediaCapture, my problem implementing this (https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/simple-camera-preview-access) in an application forms

Edit2: in my project already has net7.0-windows10.0.17763.0 to the main added

Edit3: My problem is not using MediaCapture, I can use it on my Form. The problem is being able to use it to keep the camera on and take the images of what she sees in real time and send it to a PictureBox in Form. From what I researched used the CaptureElement, which is only available in the UWP

  • Add `net7.0-windows10.0.17763.0` to the main `` – Jimi Feb 07 '23 at 00:51
  • Well, look at this one: [MediaCapture API in WPF or Windows Forms](https://stackoverflow.com/a/74949797/7444103). Do you agree it's a duplicate? – Jimi Feb 07 '23 at 00:53
  • Does this answer your question? [MediaCapture API in WPF or Windows Forms](https://stackoverflow.com/questions/74947130/mediacapture-api-in-wpf-or-windows-forms) – Rajat Shenoi Feb 07 '23 at 14:05
  • My problem is not using MediaCapture, I can use it on my Form. The problem is being able to use it to keep the camera on and take the images of what she sees in real time and send it to a PictureBox in Form. From what I researched used the CaptureElement, which is only available in the UWP – Gabriel Frigo Feb 07 '23 at 21:49
  • The answer there shows how to use `CaptureAsync()` for that – Jimi Feb 08 '23 at 01:32

1 Answers1

0

Problem

I couldn't do what I wanted using MediaControl. Soon I was forced to find another solution, which in this case was OpenCV.

Solution

OpenCV managed to provide everything I needed, so I started using it. But because it is more comprehensive and complicated, I decided to create WebCam-Sharp

WebCam-Sharp

WebCam-Sharp is a C# lib I created that simply provides the basics of WebCam using OpenCV and other Windows tools to easily get features of the devices used (ie, it only works on Windows).