Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.

I try to get picture from on-board webcam on a windows8 tablet with C#(Visual Studio 2010).

I've tried some libraries (DirectShowNet, OpenCvSharp, Versatile WebCam C# library)
and I can get 640x320 pictures from on-board webcam.
But when I try to get another resolution(800x600, 1024x720 etc), the library
don't return picture.

When I connect external webcam and use the libraries, I can get another resolution picture.
Bellow is a summany.

Webcam resolution result
on-board 640x480 can get
on-board 800x600 can't get <--I can't understand why.
external 640x480 can get
external 800x600 can get

Could you help me how to get it?

Thank you.

What I have tried:

I used some libraries(DirectShowNet, OpenCvSharp, Versatile WebCam C# library) and all NG.
I used external webcam and it's OK.
Posted
Comments
lukeer 25-Jul-16 3:17am    
Looks like the internal cam has a native resolution of 640x480 and therefore cannot provide a larger image.
The external one resolves 800x600 and can deliver a smaller image, maybe a detail (centered or upper-left-aligned) of the native image.

Tried to get an image with an insanely high resolution from the external camera? If that works, it would defy my theory.
If not, does the external camera image show the same image content or are things left out when getting the lower-resolution image?
tomo5996 25-Jul-16 4:38am    
Thank you for your response.
I tried other resolution with the external one. When I set 3200x2400, it returned 1600x1200 picture.And when 64x48 ,returned 160x120. The code using VideoInputSharp is like this.

In external cam, when (w,h) = (3200,2400), SetupDevice() success and (actualW, axtualH) returned (1600,1200).
In internal cam, when (w,h) = (320,240),(800,600) etc, SetupDevice() fails.

using (VideoInput vi = new VideoInput())
{
vi.SetIdealFramerate(indexCamera, frameRate);

if (vi.SetupDevice(indexCamera, w, h))
{
int actualW = vi.GetWidth(indexCamera);
int axtualH = vi.GetHeight(indexCamera);
byte[] buffer = new byte[vi.GetSize(indexCamera)];

if (vi.GetPixels(indexCamera, buffer))
{
}
}
}


When I use an application "Mam WebCam Photo", the internal one can return 1280x960 picture.
But I can't get it with C# libralies.
lukeer 26-Jul-16 2:45am    
Sorry to say, but I'm out of ideas right now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900