Example #1
0
        static public Calibrator GetCalibrator(CalibratorType type)
        {
            return(new CalibratorE());

#if false
            switch (type)
            {
            case CalibratorType.A:
                return(new CalibratorA());

            case CalibratorType.B:
                return(new CalibratorB());

            case CalibratorType.C:
                return(new CalibratorC());

            case CalibratorType.D:
                return(new CalibratorD());

            case CalibratorType.E:
                return(new CalibratorE());

            default:
                return(null);
            }
#endif
        }
Example #2
0
        public string cal_Description(CalibratorType calType)
        {
            return("Calibrator E");

#if false
            switch (calType)
            {
            case CalibratorType.A:
                return("Calibrator A");

            case CalibratorType.B:
                return("Calibrator B");

            case CalibratorType.C:
                return("Calibrator C");

            case CalibratorType.D:
                return("Calibrator D");

            case CalibratorType.E:
                return("Calibrator E");

            default:
                return(null);
            }
#endif
        }
        public void ReadXml(XmlReader r, PointF scale, Size imageSize)
        {
            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "CalibrationPlane":
                    calibratorType = CalibratorType.Plane;
                    calibrator     = calibrationPlane;
                    calibrationPlane.ReadPlaneXml(r, scale);
                    ComputeCoordinateSystemGrid();
                    break;

                case "CalibrationLine":
                    calibratorType = CalibratorType.Line;
                    //calibrator = calibrationLine;
                    calibrator = calibrationPlane;
                    calibrationPlane.ReadLineXml(r, scale);
                    //calibrationLine.ReadXml(r, scale);
                    break;

                case "CalibrationDrawingId":
                    Guid result;
                    bool parsed = Guid.TryParse(r.ReadElementContentAsString(), out result);
                    if (parsed)
                    {
                        calibrationDrawingId = result;
                    }
                    break;

                case "Unit":
                    lengthUnit = (LengthUnit)Enum.Parse(typeof(LengthUnit), r.ReadElementContentAsString());
                    break;

                case "CameraCalibration":
                    DistortionParameters parameters = DistortionSerializer.Deserialize(r, imageSize);
                    distortionHelper.Initialize(parameters, imageSize);
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            r.ReadEndElement();

            AfterCalibrationChanged();
        }
Example #4
0
        public void Reset()
        {
            SetOrigin(imageSize.Center());
            calibratorType  = CalibratorType.Line;
            calibrationLine = new CalibrationLine();
            calibrator      = calibrationLine;

            distortionHelper = new DistortionHelper();

            lengthUnit       = LengthUnit.Pixels;
            speedUnit        = SpeedUnit.PixelsPerSecond;
            accelerationUnit = AccelerationUnit.PixelsPerSecondSquared;

            ComputeCoordinateSystemGrid();
        }
Example #5
0
        public void SetCalibratorFromType(CalibratorType type)
        {
            // Used by calibration dialogs to force a calibration method for further computations.
            // Each time the user calibrates, we switch to the method he just used.
            calibratorType = type;

            switch (type)
            {
            case CalibratorType.Line:
                calibrator = calibrationLine;
                break;

            case CalibratorType.Plane:
                calibrator = calibrationPlane;
                break;
            }
        }
Example #6
0
        public void Reset()
        {
            calibratorType   = CalibratorType.Line;
            calibrationPlane = new CalibrationPlane();

            PointF center = imageSize.Center();

            calibrationPlane.Initialize(100, center, new PointF(center.X + 100, center.Y), CalibrationAxis.LineHorizontal);

            calibrator = calibrationPlane;

            distortionHelper = new DistortionHelper();

            lengthUnit = LengthUnit.Pixels;

            ComputeCoordinateSystemGrid();
        }
        public void Reset()
        {
            calibratorType   = CalibratorType.Line;
            calibrationPlane = new CalibrationPlane();

            PointF center = imageSize.Center();

            calibrationPlane.Initialize(100, center, new PointF(center.X + 100, center.Y));

            //SetOrigin(imageSize.Center());
            calibrator = calibrationPlane;

            distortionHelper = new DistortionHelper();

            lengthUnit       = LengthUnit.Pixels;
            speedUnit        = SpeedUnit.PixelsPerSecond;
            accelerationUnit = AccelerationUnit.PixelsPerSecondSquared;

            ComputeCoordinateSystemGrid();
        }
 public void SetCalibratorFromType(CalibratorType type)
 {
     // Used by calibration dialogs to force a calibration method for further computations.
     // Each time the user calibrates, we switch to the method he just used.
     calibratorType = type;
 }