Esempio n. 1
0
        /// <summary>
        /// Generate a intrinsic/extrinsic calibration from an initial set of four marker points.
        /// </summary>
        /// <param name="finals">List of ellipses</param>
        /// <param name="marker_ids">Ellipse ids of detected marker-ellipses</param>
        /// <param name="icp">Resulting intrinsic calibration</param>
        /// <param name="ecp">Resulting extrinsic calibration</param>
        /// <param name="size">Image size</param>
        private void ApproximatePlane(List <DetectedEllipse> finals, int[] marker_ids, out Emgu.CV.IntrinsicCameraParameters icp, out Emgu.CV.ExtrinsicCameraParameters ecp, System.Drawing.Size size)
        {
            // Currently the marker points correspond to corner points in the rectangular pattern.
            Vector[] object_points = new Vector[] {
                this.ObjectPoints[0],
                this.ObjectPoints[_number_circle_centers.Width - 1],
                this.ObjectPoints[_number_circle_centers.Width * (_number_circle_centers.Height - 1)],
                this.ObjectPoints[_number_circle_centers.Width * _number_circle_centers.Height - 1]
            };

            System.Drawing.PointF[] image_points =
                marker_ids.Select(id => { return(finals[id].Ellipse.MCvBox2D.center); }).ToArray();

            Parsley.Core.IntrinsicCalibration ic = new Parsley.Core.IntrinsicCalibration(object_points, size);
            ic.AddView(image_points);
            icp = ic.Calibrate();
            Parsley.Core.ExtrinsicCalibration ec = new Parsley.Core.ExtrinsicCalibration(object_points, icp);
            ecp = ec.Calibrate(image_points);
        }
Esempio n. 2
0
    /// <summary>
    /// Generate a intrinsic/extrinsic calibration from an initial set of four marker points.
    /// </summary>
    /// <param name="finals">List of ellipses</param>
    /// <param name="marker_ids">Ellipse ids of detected marker-ellipses</param>
    /// <param name="icp">Resulting intrinsic calibration</param>
    /// <param name="ecp">Resulting extrinsic calibration</param>
    /// <param name="size">Image size</param>
    private void ApproximatePlane(List<DetectedEllipse> finals, int[] marker_ids, out Emgu.CV.IntrinsicCameraParameters icp, out Emgu.CV.ExtrinsicCameraParameters ecp, System.Drawing.Size size) {
      // Currently the marker points correspond to corner points in the rectangular pattern.
      Vector[] object_points = new Vector[] {
        this.ObjectPoints[0], 
        this.ObjectPoints[_number_circle_centers.Width - 1],
        this.ObjectPoints[_number_circle_centers.Width * (_number_circle_centers.Height-1)],
        this.ObjectPoints[_number_circle_centers.Width * _number_circle_centers.Height - 1]};

      System.Drawing.PointF[] image_points =
        marker_ids.Select(id => { return finals[id].Ellipse.MCvBox2D.center; }).ToArray();
      
      Parsley.Core.IntrinsicCalibration ic = new Parsley.Core.IntrinsicCalibration(object_points, size);
      ic.AddView(image_points);
      icp = ic.Calibrate();
      Parsley.Core.ExtrinsicCalibration ec = new Parsley.Core.ExtrinsicCalibration(object_points, icp);
      ecp = ec.Calibrate(image_points);
    }