Easy use webcam or video capture card
$ dotnet add package QSoft.MediaCaptureif submodule Direct or DirectCore show new version, please don't update
var allcameras = QSoft.DevCon.DevConExtension.KSCATEGORY_VIDEO_CAMERA.DevicesFromInterface()
.Select(x => new
{
symbollink = x.DevicePath(),
panel = x.As().Panel()
});
var firstcamera = allcameras.FirstOrDefault();
if(firstcamera is null) return;
var camera = WebCam_MF.CreateFromSymbollink(firstcamera.symbollink);
await camera.InitCaptureEngine(new WebCam_MF_Setting()
{
IsMirror = firstcamera.panel==CameraPanel.Front
});
await camera.StartPreview(host.Child.Handle);
var camera = QSoft.MediaCapture.WebCam_MF.GetAllWebCams()
.Find(x => x.FriendName == "USB2.0 HD UVC WebCam");
if(camera != null)
{
await camera.InitCaptureEngine();
await camera.SetPreviewSize(x => x.FirstOrDefault(y=>y.Width>=640));
await camera.StartPreview(host.Child.Handle);
}
var camera = QSoft.MediaCapture.WebCam_MF.GetAllWebCams()
.Find(x => x.FriendName == "USB2.0 HD UVC WebCam");
if(camera != null)
{
await camera.InitCaptureEngine();
await camera.SetPreviewSize(x => x.FirstOrDefault(y=>y.Width>=640));
await camera.StartPreview(bmp=>this.image.Source = bmp);
}
var camera = QSoft.MediaCapture.WebCam_MF.GetAllWebCams()
.Find(x => x.FriendName == "USB2.0 HD UVC WebCam");
if(camera != null)
{
await camera.TakePhtot("123.jpg");
}
var camera = QSoft.MediaCapture.WebCam_MF.GetAllWebCams()
.Find(x => x.FriendName == "USB2.0 HD UVC WebCam");
if(camera != null)
{
await camera.StartRecord("123.mp4");
await Task.Delay(5000);
await camera.StopRecord();
}
first check this device support this function after Init camera success
if (camera.WhiteBalanceControl.IsSupport)
{
//can set predefined value
camera.WhiteBalanceControl.Preset = ColorTemperaturePreset.Auto;
}
first check this device support this function after Init camera success
if(camera.FlashLight?.IsSupported)
{
//Flash support function
var supportfunc = camera.FlashLight.SupportStates;
//below usually use state if camera supports flashlight
camera.FlashLight.SetState(FlashState.OFF);
camera.FlashLight.SetState(FlashState.ON);
camera.FlashLight.SetState(FlashState.AUTO);
}
first check this device support this function after Init camera success
if(camera.TorchLight?.IsSupported)
{
//Flash support function
var supportfunc = camera.TorchLight.SupportStates;
//below usually use state if camera supports torch light
camera.TorchLight.SetState(FlashState.OFF);
camera.TorchLight.SetState(FlashState.ON);
}
first check this device support this function after Init camera success
if(camera.EyeGazeCorrection?.IsSupported)
{
//Flash support function
var supportfunc = camera.TorchLight.SupportStates;
//below usually use state if camera supports torch light
camera.EyeGazeCorrection.SetState(EyeGazeCorrectionState.OFF);
camera.EyeGazeCorrection.SetState(EyeGazeCorrectionState.ON);
}
first check this device support this function after Init camera success
if(camera.BackgroundSegmentation?.IsSupported)
{
//Flash support function
var supportfunc = camera.TorchLight.SupportStates;
//below usually use state if camera supports torch light
camera.BackgroundSegmentation.SetState(BackgroundSegmentationState.OFF);
camera.BackgroundSegmentation.SetState(BackgroundSegmentationState.Blur);
}
first check this device support this function after Init camera success
if(camera.DigitalWindow?.IsSupported)
{
//Flash support function
var supportfunc = camera.TorchLight.SupportStates;
//below usually use state if camera supports torch light
camera.DigitalWindow.SetState(DigitalWindowState.Manual);
camera.DigitalWindow.SetState(DigitalWindowState.AutoFaceFraming);
}