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

Can't set VideoResolution

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

Can't set VideoResolution

Postby AforgeConfusion » Mon Nov 04, 2013 1:02 am

I was quite happily using DesiredFrameSize until it was made obsolete. Apparently I now have to use VideoResolution.... Great.... So can anyone educate me on how I should be using the new method, as simply changing DesiredFrameSize to VideoResolution causes a type casting error.

I've searched the forums, the sdk, and google in general to no avail.....

//Check if the video device provides a list of supported resolutions
if (FinalVideoSource.VideoCapabilities.Length > 0)
string highestSolution = "0;0";
//Search for the highest resolution
for (int i = 0; i < FinalVideoSource.VideoCapabilities.Length; i++)
if (FinalVideoSource.VideoCapabilities[i].FrameSize.Width > Convert.ToInt32(highestSolution.Split(';')[0]))
highestSolution = FinalVideoSource.VideoCapabilities[i].FrameSize.Width.ToString() + ";" + i.ToString();

//Set the highest resolution as active
// The line below is the obsolete line of code that used to work
FinalVideoSource.DesiredFrameSize= FinalVideoSource.VideoCapabilities[Convert.ToInt32(highestSolution.Split(';')[1])].FrameSize;
Posts: 1
Joined: Mon Nov 04, 2013 12:55 am

Return to AForge.NET Framework