AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Webcam not capturing image in Win8

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Webcam not capturing image in Win8

Postby dhelawat » Mon Jun 01, 2015 10:17 am

Hello,

I am using windows 8 in laptop and my application is using Aforge for webcam in my application.But now problem is one front camera is working fine but back camera not starting when I switch the camera. I have lenova thinkpad.

Even i tried simple player to see whether that is working or not and that even doesnt work. Please help!!

Default webcam app of tablet is working fine.

Can you help me with the issue.

Using below code:

private void OnStartVideo()
{
CameraNotInitialized = _videoDevices.Count == 0;

if (CameraNotInitialized)
return;

_videoSource = new VideoCaptureDevice(_videoDevices[_activeDeviceIndex].MonikerString);

_videoSource.NewFrame += VideoNewFrame;
_videoSource.Start();

StopCamera.RaiseCanExecuteChanged();
}

private void OnSwitchCamera()
{
if (_videoDevices.Count > 1)
{
_activeDeviceIndex = _activeDeviceIndex == 0 ? 1 : 0;
}
else
_activeDeviceIndex = 0;

if (_videoSource == null) return;

if (_videoSource.IsRunning)
_videoSource.Stop();

UserSettings.DefaultCameraIndex = _activeDeviceIndex;
UserSettings.Save();

OnStartVideo();
}

Thanks
Anand
dhelawat
 
Posts: 11
Joined: Mon Feb 02, 2015 3:14 pm



Return to AForge.NET Framework