/// <summary>
        /// get parameters of selected webcam
        /// </summary>
        public CameraParam getParameter(CameraParam property)
        {
            // TODO DEBUG setting is correctly get from webcam but not set to object
            try
            {
                //get property ranges
                bool success = this.videoDeviceForCapture.GetCameraPropertyRange(property.propertyType, out property.minValue, out property.maxValue, out property.stepSize, out property.defaultValue, out property.ctrFlag);

                Console.Write("minValue: " + property.minValue.ToString() + "\r\n" +
                              "maxValue: " + property.maxValue.ToString() + "\r\n" +
                              "stepSize: " + property.stepSize.ToString() + "\r\n" +
                              "defaultValue: " + property.defaultValue.ToString() + "\r\n" +
                              "CameraControlFlags: " + property.ctrFlag.ToString() + "\r\n" +
                              "returnValue(success): " + success.ToString() + "\r\n");
                // set min & max to ezro if property is not adjustable
                if (property.ctrFlag.ToString().Contains("None"))
                {
                    property.minValue = 0;
                    property.maxValue = 0;
                }
            }
            catch (System.ArgumentException ArgEx)
            {
                Console.WriteLine("System.ArgumentException: Video source is not specified - device moniker is not set. Exception message: " + ArgEx.Message);
            }
            catch (System.ApplicationException AppEx)
            {
                Console.WriteLine("System.ApplicationException: Failed creating device object for moniker. Exception message: " + AppEx.Message);
            }
            catch (System.NotSupportedException NotSupporterEx)
            {
                Console.WriteLine("System.NotSupportedException: The video source does not support camera control. Exception message: " + NotSupporterEx.Message);
            }
            try
            {
                // get current property values
                this.videoDeviceForCapture.GetCameraProperty(property.propertyType, out property.currentValue, out property.currentCtrlFlag);
                Console.Write("currentValue: " + property.currentValue.ToString() + "\r\n" +
                              "currentCameraControlFlags: " + property.currentCtrlFlag.ToString() + "\r\n");
                // check if property is adjustable
                Console.WriteLine("IsAvailable " + property.propertyType.ToString() + " is ajustable?: " + property.isAdjustable.ToString());
            }
            catch (ArgumentException argEx)
            {
                ConsoleBuddy.WriteException(argEx, "getParameter");
            }
            catch (ApplicationException appEx)
            {
                ConsoleBuddy.WriteException(appEx, "getParameter");
            }
            catch (NotSupportedException notSuppEx)
            {
                ConsoleBuddy.WriteException(notSuppEx, "getParameter");
            }
            return(property);
        }
예제 #2
0
 private void show_param_values(CameraParam webcamParam)
 {
     webcamParam = this.webcamClass.getParameter(webcamParam);
     this.label_top_value_read_only1.setValue(webcamParam.minValue);
     this.label_top_value_read_only2.setValue(webcamParam.defaultValue);
     this.label_top_value_read_only3.setValue(webcamParam.maxValue);
     this.label_top_value_read_only4.setValue(webcamParam.ctrFlag.ToString());
     this.label_top_value_read_only5.setValue(webcamParam.currentValue);
     this.label_top_value_read_only6.setValue(webcamParam.currentCtrlFlag.ToString());
     this.label1.Text = webcamParam.propertyType.ToString();
 }