Reading webcam resolution
|
05-03-2014, 09:14 PM
Post: #1
|
|||
|
|||
Reading webcam resolution
Does Video lab have a fairly easy way to query a USB WebCam to see what resolutions the camera is capable of?
I am playing with two Logitech web cams and going back and forth between the Logitech software and a version of the AdvancedVideoCapture demo just to see what resolutions I can actually set that will work. Not every resolution that can be set in the Logitech software will work when set in VLDSCapture->VideoSize. Some just revert the camera back to 640X680. What I have discovered that seems to always work is whatever the cameras max resolution is and of course 640X480. One camera will do 1920X1080 the other will do 1440X1080. I would like to be able to get these values from the camera and not have to ask the user to figure out what they are and enter them in setup. I need to know because the video output needs to always be 4:3 aspect and I will have to crop the sides of the wide screen cameras. Would be really nice If the software could read the cameras Direct Show aspect and resolution. Hope I have given you enough info to be able to point me in the right direction. |
|||
05-04-2014, 01:06 AM
Post: #2
|
|||
|
|||
RE: Reading webcam resolution
What i usually do to read actual values from a capture-source is connect a VLGenericFilter to the source, declare some global variables like Width, Height and in the GenericFilters OnProcessData event
read in these values using Width=InBuffer.GetWidth() and Height=Inbuffer.GetHeight(). Then use a Timer to show these values on a label for example. Regards, Dave |
|||
05-06-2014, 08:40 PM
Post: #3
|
|||
|
|||
RE: Reading webcam resolution
Thanks Dave,
I'll play with it. Looks like I may need to provide a small utility to help the user determine what resolution values can be used for whatever webcam he has connected. I'll just create a stripped down version of the AdvancedVideoCapture demo. Also decided to just place a button on the configuration screen that brings up the manufactures Camera Control utility. I wasn't getting consistent results between different cameras trying to use VLDSCapture CameraControl properties. I am thinking Logitech does some magic between the Camera and the Direct Show interface to be able to do everything the Logitech software does. |
|||
05-12-2014, 09:02 PM
Post: #4
|
|||
|
|||
RE: Reading webcam resolution
A little update... Before I posted this question I had sent Boian an Emil asking almost the same question. He pointed me to VLDSCapture1->VideoModes which I was able to figure out and worked great.
Below is the code I ended up with, it populates a TComboBox I named ResolPickBox and stores the actual height and width numbers in a struct. I was only interested in 640x480 and above with an aspect of 1.33. The aspect was converted to a string to provide consistent truncation of the decimal places for a comparison to what I was looking for. One thing I didn't (and still don't) understand is without the line that looks for a duplicate entry I get two sets of identical resolution numbers. I looked at the other data fields returned in TVLVideoModeFormat and couldn't find anything that was different between the duplicate listings. For example, Format returned vfRGB24 in all cases. Code: void TCamera::GetCamResolutions(void) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)