void setFeature(PixeLINK.Feature feature, Slider slider, TextBox box) { CameraFeature features = new CameraFeature(); if (!features.IsSupported) { return; } slider.Minimum = features.parameters[0].MinimumValue; slider.Maximum = features.parameters[0].MaximumValue; ReturnCode rc = cam.GetFeatureByParms(feature, ref flags, ref parms); box.Text = parms[0].ToString(); }
void SetSlidersandInitialValue(PixeLINK.Feature feature, Slider slider, TextBox box, float multiplier) { CameraFeature features = cam.GetFeature(feature); if (!features.IsSupported) { slider.IsEnabled = false; return; } slider.Minimum = features.parameters[0].MinimumValue * multiplier; slider.Maximum = features.parameters[0].MaximumValue * multiplier; ReturnCode rc = cam.GetFeatureByParms(feature, ref flags, ref parms); box.Text = (parms[0] * multiplier).ToString(); }
public CameraFeature SetFeatureandWait(PixeLINK.Feature feature, float[] parms, FeatureFlags flag = FeatureFlags.Manual) { CameraFeature features = new CameraFeature(); ReturnCode rc = Api.SetFeature(m_hCamera, feature, flag, parms.Count(), parms); if (rc != ReturnCode.Success) { MessageBox.Show("bad parm"); } ((App)Application.Current).logger.MyLogFile("SetFeature ", "Stop /start camera "); // rc = Api.SetStreamState(m_hCamera, StreamState.Start); // Api.SetStreamState(m_hCamera, StreamState.Start); return(features); }
private void Reset_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { CameraFeature features = cam.GetFeature(PixeLINK.Feature.Roi); RoiSizes[0] = features.parameters[0].MinimumValue; //left RoiSizes[1] = features.parameters[1].MinimumValue; //top RoiSizes[2] = features.parameters[2].MaximumValue; //width RoiSizes[3] = features.parameters[3].MaximumValue; //height cam.StopCamera(); cam.SetFeature(Feature.Roi, RoiSizes); cam.StartCamera(); ((App)Application.Current).logger.MyLogFile("Reset ", string.Format("ROI {0} {1} {2} {3} ", RoiSizes[0], RoiSizes[1], RoiSizes[2], RoiSizes[3])); ReturnCode rc = cam.GetFeatureByParms(Feature.Roi, ref flags, ref RoiSizes); top.Text = startRoiSizes[(int)rectSides.top].ToString(); left.Text = startRoiSizes[(int)rectSides.left].ToString(); width.Text = startRoiSizes[(int)rectSides.width].ToString(); height.Text = startRoiSizes[(int)rectSides.height].ToString(); RoiValues.Visibility = Visibility.Visible; }
public void LoadCameraFeatures() { // ClearFeatures(); // Determine how much memory to allocate for the CAMERA_FEATURES struct. // API Note: By passing NULL in the second parameter, we are telling the // API that we don't want it to populate our CAMERA_FEATURES structure // yet - instead we just want it to tell us how much memory it will // need when it does populate it. CameraFeature featureInfo = new CameraFeature(); foreach (Features feature in Enum.GetValues(typeof(Features))) { switch (feature) { case Features.FEATURE_SHUTTER: ReturnCode rc = Api.GetCameraFeatures(m_hCamera, Feature.Shutter, ref featureInfo); break; case Features.FEATURE_BRIGHTNESS: rc = Api.GetCameraFeatures(m_hCamera, Feature.Brightness, ref featureInfo); break; case Features.FEATURE_FRAME_RATE: Api.GetCameraFeatures(m_hCamera, Feature.FrameRate, ref featureInfo); break; case Features.FEATURE_ROI: Api.GetCameraFeatures(m_hCamera, Feature.Roi, ref featureInfo); break; } camfeatures.Add(featureInfo); } }
private void Preview_Loaded(object sender, RoutedEventArgs e) { _ROIoriginalLeft = Canvas.GetLeft(roi); _ROIoriginalTop = Canvas.GetTop(roi); roi.MouseMove += new MouseEventHandler(Window1_MouseMove); roi.MouseLeftButtonDown += new MouseButtonEventHandler(Window1_MouseLeftButtonDown); roi.MouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler); this.KeyDown += new KeyEventHandler(roi_KeyDown); roi.Focusable = true; //get the max roi for camera CameraFeature features = cam.GetFeature(PixeLINK.Feature.Roi); if (!features.IsSupported) { Reset.IsEnabled = false; } else { string temp = string.Format("{0}", features.parameters[2].MaximumValue); temp += " X "; temp += string.Format("{0}", features.parameters[3].MaximumValue); Reset.Content = temp; } //get the current roi ReturnCode rc = cam.GetFeatureByParms(Feature.Roi, ref flags, ref RoiSizes); startRoiSizes = RoiSizes; top.Text = startRoiSizes[(int)rectSides.top].ToString(); left.Text = startRoiSizes[(int)rectSides.left].ToString(); width.Text = startRoiSizes[(int)rectSides.width].ToString(); height.Text = startRoiSizes[(int)rectSides.height].ToString(); selected = true; e.Handled = true; }
/** * Function: FeatureSupportsFlag * Purpose: Return true if the feature supports the given FEATURE_FLAG. */ public bool FeatureSupportsFlag(int featureId, UInt32 flag) { CameraFeature camFeature = camfeatures[featureId]; return(((int)camFeature.flags & flag) != 0); }