Exemple #1
0
        private void ComputeVelocities(TrajectoryKinematics kinematics, CalibrationHelper calibrationHelper)
        {
            if (kinematics.Length <= 2)
            {
                PadVelocities(kinematics);
                return;
            }

            for (int i = 1; i < kinematics.Length - 1; i++)
            {
                PointF a = kinematics.Coordinates(i - 1);
                PointF b = kinematics.Coordinates(i + 1);
                float  t = calibrationHelper.GetTime(2);

                kinematics.Speed[i] = (double)calibrationHelper.ConvertSpeed(GetSpeed(a, b, t, Component.Magnitude));
                kinematics.HorizontalVelocity[i] = (double)calibrationHelper.ConvertSpeed(GetSpeed(a, b, t, Component.Horizontal));
                kinematics.VerticalVelocity[i]   = (double)calibrationHelper.ConvertSpeed(GetSpeed(a, b, t, Component.Vertical));
            }

            PadVelocities(kinematics);

            double        constantVelocitySpan = 40;
            MovingAverage filter = new MovingAverage();

            kinematics.Speed = filter.FilterSamples(kinematics.Speed, calibrationHelper.CaptureFramesPerSecond, constantVelocitySpan, 1);
            kinematics.HorizontalVelocity = filter.FilterSamples(kinematics.HorizontalVelocity, calibrationHelper.CaptureFramesPerSecond, constantVelocitySpan, 1);
            kinematics.VerticalVelocity   = filter.FilterSamples(kinematics.VerticalVelocity, calibrationHelper.CaptureFramesPerSecond, constantVelocitySpan, 1);
        }
Exemple #2
0
        private void ComputeAngularAccelerations(TrajectoryKinematics kinematics, CalibrationHelper calibrationHelper)
        {
            if (kinematics.Length <= 4)
            {
                PadAngularAccelerations(kinematics);
                return;
            }

            for (int i = 2; i < kinematics.Length - 2; i++)
            {
                double d1  = GetDisplacementAngle(kinematics, i - 1, i - 2);
                double d2  = GetDisplacementAngle(kinematics, i, i - 1);
                double d3  = GetDisplacementAngle(kinematics, i + 1, i);
                double d4  = GetDisplacementAngle(kinematics, i + 2, i + 1);
                float  t02 = calibrationHelper.GetTime(2);
                float  t24 = calibrationHelper.GetTime(2);
                float  t13 = calibrationHelper.GetTime(2);

                float v1 = (float)((d1 + d2) / t02);
                float v2 = (float)((d3 + d4) / t24);
                float a  = (float)((v2 - v1) / t13);
                kinematics.AngularAcceleration[i] = calibrationHelper.ConvertAngularAcceleration(a);
            }

            PadAngularAccelerations(kinematics);
        }
Exemple #3
0
        private void ComputeAcceleration(TimeSeriesCollection tsc, CalibrationHelper calibrationHelper)
        {
            if (tsc.Length <= 2)
            {
                PadAccelerations(tsc);
                return;
            }

            for (int i = 1; i < tsc.Length - 1; i++)
            {
                float v1    = velocities[i - 1];
                float v2    = velocities[i + 1];
                float t     = calibrationHelper.GetTime(2);
                float alpha = (v2 - v1) / t;

                tsc[Kinematics.AngularAcceleration][i] = (double)calibrationHelper.ConvertAngularAcceleration(alpha);

                float at = radii[i] * alpha;
                tsc[Kinematics.TangentialAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(at);

                float ac = radii[i] * velocities[i] * velocities[i];
                tsc[Kinematics.CentripetalAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(ac);

                float a = (float)Math.Sqrt(at * at + ac * ac);
                tsc[Kinematics.ResultantLinearAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(a);
            }

            PadAccelerations(tsc);
        }
Exemple #4
0
 public void UpdateOrigin()
 {
     if (CalibrationHelper != null)
     {
         points["0"] = CalibrationHelper.GetImagePoint(PointF.Empty);
     }
 }
Exemple #5
0
        private static void AlignPointPerpendicular(GenericPosture posture, CalibrationHelper calibrationHelper, GenericPosturePerpendicularAlign impact)
        {
            // The point is moved so that it stays on a perpendicular segment relatively to another segment.

            if (impact == null)
            {
                return;
            }

            PointF pivot       = posture.PointList[impact.Origin];
            PointF leg1        = posture.PointList[impact.Leg1];
            PointF pointToMove = posture.PointList[impact.PointToMove];

            if (pivot == leg1)
            {
                return;
            }

            PointF pivotPlane = calibrationHelper.GetPoint(pivot);
            PointF leg1Plane  = calibrationHelper.GetPoint(leg1);
            PointF pointPlane = calibrationHelper.GetPoint(pointToMove);

            PointF resultPlane = GeometryHelper.GetPointAtAngle(pivotPlane, leg1Plane, pointPlane, 90);
            PointF result      = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[impact.PointToMove] = result;
        }
        private void DrawPositions(SolidBrush brushFill, Color baseBrushFillColor, int alphaBackground, double opacity, Graphics canvas, IImageToViewportTransformer transformer, List <Point> points)
        {
            foreach (GenericPosturePosition position in genericPosture.Positions)
            {
                if (!IsActive(position.OptionGroup))
                {
                    continue;
                }

                PointF untransformedP = position.Point >= 0 ? genericPosture.PointList[position.Point] : GetUntransformedComputedPoint(position.Point);
                string label          = CalibrationHelper.GetPointText(untransformedP, true, true, infosFading.ReferenceTimestamp);

                if (!string.IsNullOrEmpty(position.Symbol))
                {
                    label = string.Format("{0} = {1}", position.Symbol, label);
                }

                PointF p = position.Point >= 0 ? points[position.Point] : GetComputedPoint(position.Point, transformer);

                brushFill.Color = position.Color == Color.Transparent ? baseBrushFillColor : Color.FromArgb(alphaBackground, position.Color);
                DrawPointText(p, label, canvas, opacity, transformer, brushFill);
            }

            brushFill.Color = baseBrushFillColor;
        }
Exemple #7
0
        public override void MoveDrawing(float dx, float dy, Keys modifierKeys, bool zooming)
        {
            if (zooming)
            {
                return;
            }

            if (CalibrationHelper == null)
            {
                return;
            }

            if ((modifierKeys & Keys.Alt) == Keys.Alt)
            {
                // Change the number of divisions.
                styleHelper.GridDivisions = styleHelper.GridDivisions + (int)((dx - dy) / 4);
                styleHelper.GridDivisions = Math.Min(Math.Max(styleHelper.GridDivisions, minimumSubdivisions), maximumSubdivisions);
            }
            else
            {
                if (!styleHelper.Perspective)
                {
                    quadImage.Translate(dx, dy);
                    CalibrationHelper.CalibrationByPlane_Update(Id, quadImage);
                }
            }

            SignalAllTrackablePointsMoved();
        }
        private void DrawDistances(SolidBrush brushFill, Color baseBrushFillColor, int alphaBackground, double opacity, Graphics canvas, IImageToViewportTransformer transformer, List <Point> points)
        {
            foreach (GenericPostureDistance distance in genericPosture.Distances)
            {
                if (!IsActive(distance.OptionGroup))
                {
                    continue;
                }

                PointF untransformedA = distance.Point1 >= 0 ? genericPosture.PointList[distance.Point1] : GetUntransformedComputedPoint(distance.Point1);
                PointF untransformedB = distance.Point2 >= 0 ? genericPosture.PointList[distance.Point2] : GetUntransformedComputedPoint(distance.Point2);
                string label          = CalibrationHelper.GetLengthText(untransformedA, untransformedB, true, true);

                if (!string.IsNullOrEmpty(distance.Symbol))
                {
                    label = string.Format("{0} = {1}", distance.Symbol, label);
                }

                PointF a = distance.Point1 >= 0 ? points[distance.Point1] : GetComputedPoint(distance.Point1, transformer);
                PointF b = distance.Point2 >= 0 ? points[distance.Point2] : GetComputedPoint(distance.Point2, transformer);

                brushFill.Color = distance.Color == Color.Transparent ? baseBrushFillColor : Color.FromArgb(alphaBackground, distance.Color);
                DrawDistanceText(a, b, label, canvas, opacity, transformer, brushFill);
            }

            brushFill.Color = baseBrushFillColor;
        }
Exemple #9
0
 private static void ProcessPointImpacts(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF old)
 {
     foreach (GenericPostureAbstractImpact impact in posture.Handles[handle].Impacts)
     {
         ProcessPointImpact(posture, calibrationHelper, impact, handle, old);
     }
 }
Exemple #10
0
        public FormCalibrateDistortion(Bitmap currentImage, List <List <PointF> > points, CalibrationHelper calibrationHelper)
        {
            this.currentImage      = currentImage;
            this.calibrationHelper = calibrationHelper;

            if (calibrationHelper.DistortionHelper == null || !calibrationHelper.DistortionHelper.Initialized)
            {
                distorter.Initialize(DistortionParameters.Default, calibrationHelper.ImageSize);
                bmpUndistorted = currentImage;
            }
            else
            {
                distorter.Initialize(calibrationHelper.DistortionHelper.Parameters, calibrationHelper.ImageSize);
            }

            calibrator = new CameraCalibrator(points, calibrationHelper.ImageSize);

            InitializeComponent();
            LocalizeForm();

            mnuOpen.Click          += (s, e) => Open();
            mnuSave.Click          += (s, e) => Save();
            mnuImportAgisoft.Click += (s, e) => ImportAgisoft();
            mnuDefault.Click       += (s, e) => RestoreDefaults();
            mnuQuit.Click          += (s, e) => Close();

            if (currentImage == null)
            {
                tabPages.TabPages.Remove(tabImage);
            }

            btnCalibrate.Enabled = calibrator.Valid;

            Populate();
        }
Exemple #11
0
        public static void MoveHandle(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point, Keys modifiers)
        {
            try
            {
                // Update the point(s) attached to the handle based on the constraints.
                // Update all other points that may have been impacted.
                switch (posture.Handles[handle].Type)
                {
                case HandleType.Point:
                    MovePointHandle(posture, calibrationHelper, handle, point, modifiers);
                    break;

                case HandleType.Segment:
                    MoveSegmentHandle(posture, calibrationHelper, handle, point);
                    break;

                case HandleType.Ellipse:
                case HandleType.Circle:
                    MoveCircleHandle(posture, handle, point);
                    break;
                }
            }
            catch (Exception e)
            {
                log.DebugFormat("Error while moving handle");
                log.DebugFormat(e.ToString());
            }
        }
        private string GetExtraDataText(long currentTimestamp)
        {
            if (trackExtraData == TrackExtraData.None)
            {
                return("");
            }

            string displayText = "###";

            switch (trackExtraData)
            {
            case TrackExtraData.Name:
                displayText = name;
                break;

            case TrackExtraData.TotalDistance:
                PointF o = CalibrationHelper.GetOrigin();
                displayText = CalibrationHelper.GetLengthText(o, points["0"], true, true);
                break;

            case TrackExtraData.Position:
            default:
                displayText = CalibrationHelper.GetPointText(points["0"], true, true, currentTimestamp);
                break;
            }

            return(displayText);
        }
        private void LocalizeForm()
        {
            this.Text        = "   " + ScreenManagerLang.dlgConfigureMeasure_Title;
            btnCancel.Text   = ScreenManagerLang.Generic_Cancel;
            btnOK.Text       = ScreenManagerLang.Generic_Apply;
            grpConfig.Text   = ScreenManagerLang.Generic_Configuration;
            lblRealSize.Text = ScreenManagerLang.dlgConfigureMeasure_lblRealSize.Replace("\\n", "\n");

            // Combo Units (MUST be filled in the order of the enum)
            cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Centimeters + " (" + CalibrationHelper.GetLengthAbbreviationFromUnit(LengthUnits.Centimeters) + ")");
            cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Meters + " (" + CalibrationHelper.GetLengthAbbreviationFromUnit(LengthUnits.Meters) + ")");
            cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Inches + " (" + CalibrationHelper.GetLengthAbbreviationFromUnit(LengthUnits.Inches) + ")");
            cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Feet + " (" + CalibrationHelper.GetLengthAbbreviationFromUnit(LengthUnits.Feet) + ")");
            cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Yards + " (" + CalibrationHelper.GetLengthAbbreviationFromUnit(LengthUnits.Yards) + ")");

            // Update with current values.
            if (m_Metadata.CalibrationHelper.CurrentLengthUnit == LengthUnits.Pixels)
            {
                // Default to 50 cm if no unit selected yet.
                tbMeasure.Text       = "50";
                cbUnit.SelectedIndex = (int)LengthUnits.Centimeters;
            }
            else
            {
                tbMeasure.Text       = String.Format("{0:0.00}", m_fCurrentLengthReal);
                cbUnit.SelectedIndex = (int)m_Metadata.CalibrationHelper.CurrentLengthUnit;
            }
        }
Exemple #14
0
        public override int HitTest(PointF point, long currentTimestamp, DistortionHelper distorter, IImageToViewportTransformer transformer, bool zooming)
        {
            // Convention: miss = -1, object = 0, handle = n.
            if (!Visible)
            {
                return(-1);
            }

            int result = -1;

            if (HitTester.HitTest(points["0"], point, transformer))
            {
                return(1);
            }

            if (showGrid || showGraduations || showAxis)
            {
                CoordinateSystemGrid grid = CalibrationHelper.GetCoordinateSystemGrid();

                if (grid.HorizontalAxis != null && IsPointOnRectifiedLine(point, grid.HorizontalAxis.Start, grid.HorizontalAxis.End, distorter, transformer))
                {
                    result = 2;
                }
                else if (grid.VerticalAxis != null && IsPointOnRectifiedLine(point, grid.VerticalAxis.Start, grid.VerticalAxis.End, distorter, transformer))
                {
                    result = 3;
                }
            }

            return(result);
        }
Exemple #15
0
        private static void MovePointHandleByRotationSteps(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point, GenericPostureConstraintRotationSteps constraint)
        {
            if (constraint == null)
            {
                return;
            }

            PointF parent = posture.PointList[constraint.Origin];
            PointF leg1   = posture.PointList[constraint.Leg1];

            if (parent == leg1 || constraint.Step == 0)
            {
                return;
            }

            PointF candidate = point;

            if (constraint.KeepDistance)
            {
                PointF leg2     = posture.PointList[posture.Handles[handle].Reference];
                float  distance = GeometryHelper.GetDistance(parent, leg2);
                candidate = GeometryHelper.GetPointAtDistance(parent, point, distance);
            }

            int constraintAngleSubdivisions = 360 / constraint.Step;

            posture.PointList[posture.Handles[handle].Reference] = GeometryHelper.GetPointAtClosestRotationStep(parent, leg1, candidate, constraintAngleSubdivisions);
        }
Exemple #16
0
        private static void ExportImage(CalibrationHelper calibrationHelper, CoordinateSystemGrid grid)
        {
            //Bitmap bitmap = new Bitmap((int)(calibrationHelper.ImageSize.Width + 100), (int)(calibrationHelper.ImageSize.Height + 100), PixelFormat.Format24bppRgb);
            Bitmap   bitmap = new Bitmap((int)(calibrationHelper.ImageSize.Width), (int)(calibrationHelper.ImageSize.Height), PixelFormat.Format24bppRgb);
            Graphics g      = Graphics.FromImage(bitmap);

            g.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height);

            if (grid.VerticalAxis != null)
            {
                g.DrawLine(Pens.Blue, grid.VerticalAxis.Start, grid.VerticalAxis.End);
            }

            if (grid.HorizontalAxis != null)
            {
                g.DrawLine(Pens.Blue, grid.HorizontalAxis.Start, grid.HorizontalAxis.End);
            }

            foreach (GridLine line in grid.GridLines)
            {
                g.DrawLine(Pens.Red, line.Start, line.End);
            }

            string filename = GetRandomString(10);

            bitmap.Save(Path.Combine(@"C:\Users\Joan\Videos\Kinovea\Video Testing\Projective\infinite plane\rnd", string.Format("{0}.png", filename)));
        }
Exemple #17
0
        public void Update(PointF o, PointF a, PointF b, int radius, Color color, CalibrationHelper calibration, IImageToViewportTransformer transformer)
        {
            if (o == a || o == b)
            {
                return;
            }

            Origin = o;
            Angle  = ComputeAngle(o, a, b, false);
            Color  = color;

            if (calibration == null)
            {
                CalibratedAngle = Angle;
            }
            else if (calibration.CalibratorType == CalibratorType.Plane)
            {
                PointF calibratedO = calibration.GetPoint(o);
                PointF calibratedA = calibration.GetPoint(a);
                PointF calibratedB = calibration.GetPoint(b);
                CalibratedAngle = ComputeAngle(calibratedO, calibratedA, calibratedB, true);
            }
            else if (calibration.CalibratorType == CalibratorType.Line)
            {
                // Note that direction of Y-axis is not the same that the one used for the uncalibrated space.
                PointF calibratedO = calibration.GetPoint(o);
                PointF calibratedA = calibration.GetPoint(a);
                PointF calibratedB = calibration.GetPoint(b);
                CalibratedAngle = ComputeAngle(calibratedO, calibratedA, calibratedB, true);
            }

            ComputeBoundingBox(o, a, b, (float)radius);
            ComputeTextPosition(Angle, transformer);
            ComputeHitRegion(BoundingBox, Angle);
        }
        public FormCalibrateDistortion(Bitmap currentImage, List <List <PointF> > points, CalibrationHelper calibrationHelper)
        {
            this.bmpCurrentImage   = currentImage;
            this.calibrationHelper = calibrationHelper;

            if (calibrationHelper.DistortionHelper == null || !calibrationHelper.DistortionHelper.Initialized)
            {
                distortionParameters = new DistortionParameters(calibrationHelper.ImageSize);
            }
            else
            {
                distortionParameters = calibrationHelper.DistortionHelper.Parameters;
            }

            distorter.Initialize(distortionParameters, calibrationHelper.ImageSize);
            calibrator = new CameraCalibrator(points, calibrationHelper.ImageSize);

            InitializeComponent();
            LocalizeForm();

            SetupStyle();
            PopulateStyleElements();

            mnuOpen.Click          += (s, e) => Open();
            mnuSave.Click          += (s, e) => Save();
            mnuImportAgisoft.Click += (s, e) => ImportAgisoft();
            mnuDefault.Click       += (s, e) => RestoreDefaults();
            mnuQuit.Click          += (s, e) => Close();

            btnCalibrate.Enabled = calibrator.Valid;
            AfterImport();
            PopulatePhysicalParameters();
            PopulateValues();
            UpdateDistortionGrid();
        }
Exemple #19
0
        private string GetExtraDataText()
        {
            if (trackExtraData == TrackExtraData.None)
            {
                return("");
            }

            string displayText = "###";

            switch (trackExtraData)
            {
            case TrackExtraData.Name:
                displayText = name;
                break;

            case TrackExtraData.TotalDistance:
            default:
                PointF a = new PointF(points["a"].X, points["a"].Y);
                PointF b = new PointF(points["b"].X, points["b"].Y);
                displayText = CalibrationHelper.GetLengthText(a, b, true, true);
                break;
            }

            return(displayText);
        }
Exemple #20
0
        public override void MoveHandle(PointF point, int handleNumber, Keys modifiers)
        {
            int handle = handleNumber - 1;

            quadImage[handle] = point;

            if (inPerspective)
            {
                planeIsConvex = quadImage.IsConvex;
            }
            else
            {
                if ((modifiers & Keys.Shift) == Keys.Shift)
                {
                    quadImage.MakeSquare(handle);
                }
                else
                {
                    quadImage.MakeRectangle(handle);
                }
            }

            SignalTrackablePointMoved(handle);
            CalibrationHelper.CalibrationByPlane_Update(quadImage);
        }
Exemple #21
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp);

            if (tracking)
            {
                opacityFactor = 1.0;
            }

            if (opacityFactor <= 0)
            {
                return;
            }

            int   iAlpha = (int)(opacityFactor * 255);
            Point c      = transformer.Transform(points["0"]);

            using (Pen p = styleHelper.GetPen(iAlpha))
                using (SolidBrush b = styleHelper.GetBrush((int)(opacityFactor * defaultBackgroundAlpha)))
                {
                    canvas.DrawLine(p, c.X - defaultRadius, c.Y, c.X + defaultRadius, c.Y);
                    canvas.DrawLine(p, c.X, c.Y - defaultRadius, c.X, c.Y + defaultRadius);
                    canvas.FillEllipse(b, c.Box(defaultRadius + 1));
                }

            if (ShowMeasurableInfo)
            {
                labelCoordinates.SetText(CalibrationHelper.GetPointText(new PointF(points["0"].X, points["0"].Y), true, true, infosFading.ReferenceTimestamp));
                labelCoordinates.Draw(canvas, transformer, opacityFactor);
            }
        }
Exemple #22
0
        public FormCalibrateLine(CalibrationHelper calibrationHelper, DrawingLine line)
        {
            this.calibrationHelper = calibrationHelper;
            this.line = line;

            InitializeComponent();
            LocalizeForm();
            InitializeValues();
        }
Exemple #23
0
        private static void MovePointHandle(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point, Keys modifiers)
        {
            // Constraints. (position of the point managed by this handle).
            GenericPostureAbstractConstraint constraint = posture.Handles[handle].Constraint;
            PointF old = posture.PointList[posture.Handles[handle].Reference];

            PrepareImpacts(posture, handle);

            if (constraint == null ||
                (!string.IsNullOrEmpty(constraint.OptionGroup) && !posture.OptionGroups[constraint.OptionGroup]))
            {
                MovePointHandleFreely(posture, handle, point);
            }
            else
            {
                switch (constraint.Type)
                {
                case ConstraintType.None:
                    MovePointHandleFreely(posture, handle, point);
                    break;

                case ConstraintType.LineSlide:
                    MovePointHandleAlongLine(posture, handle, point, constraint as GenericPostureConstraintLineSlide);
                    break;

                case ConstraintType.VerticalSlide:
                    MovePointHandleAlongVertical(posture, calibrationHelper, handle, point);
                    break;

                case ConstraintType.HorizontalSlide:
                    MovePointHandleAlongHorizontal(posture, handle, point);
                    break;

                case ConstraintType.DistanceToPoint:
                    MovePointHandleAtDistance(posture, handle, point, constraint as GenericPostureConstraintDistanceToPoint, modifiers);
                    break;

                case ConstraintType.RotationSteps:
                    MovePointHandleByRotationSteps(posture, calibrationHelper, handle, point, constraint as GenericPostureConstraintRotationSteps);
                    break;

                case ConstraintType.PerpendicularSlide:
                    MovePointHandleAlongPerpendicular(posture, calibrationHelper, handle, point, constraint as GenericPostureConstraintPerpendicularSlide);
                    break;

                case ConstraintType.ParallelSlide:
                    MovePointHandleAlongParallel(posture, calibrationHelper, handle, point, constraint as GenericPostureConstraintParallelSlide);
                    break;

                case ConstraintType.LockedInPlace:
                    break;
                }
            }

            ProcessPointImpacts(posture, calibrationHelper, handle, old);
        }
Exemple #24
0
        public void SetTrackablePointValue(string name, PointF value)
        {
            if (!points.ContainsKey(name))
            {
                throw new ArgumentException("This point is not bound.");
            }

            points[name] = value;
            CalibrationHelper.SetOrigin(value);
        }
Exemple #25
0
        public FormCalibratePlane(CalibrationHelper calibrationHelper, DrawingPlane drawingPlane)
        {
            this.calibrationHelper = calibrationHelper;
            this.drawingPlane      = drawingPlane;
            this.quadrilateral     = drawingPlane.QuadImage;

            InitializeComponent();
            LocalizeForm();
            InitializeValues();
        }
Exemple #26
0
        public void SetTrackablePointValue(string name, PointF value)
        {
            int p = int.Parse(name);

            quadImage[p] = new PointF(value.X, value.Y);

            projectiveMapping.Update(quadPlane, quadImage);
            CalibrationHelper.CalibrationByPlane_Update(quadImage);
            planeIsConvex = quadImage.IsConvex;
        }
Exemple #27
0
        private static void MovePointHandleAlongVertical(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point)
        {
            /*PointF source = calibrationHelper.GetPoint(posture.Points[posture.Handles[handle].Reference]);
             * PointF target = calibrationHelper.GetPoint(point.ToPointF());
             *
             * PointF result = new PointF(source.X, target.Y);
             * PointF resultImage = calibrationHelper.GetImagePoint(result);
             *
             * posture.Points[posture.Handles[handle].Reference] = resultImage;*/

            posture.Points[posture.Handles[handle].Reference] = new PointF(posture.Points[posture.Handles[handle].Reference].X, point.Y);
        }
Exemple #28
0
        private void ComputeFilteredCoordinates(TrajectoryKinematics kinematics, CalibrationHelper calibrationHelper)
        {
            double framerate = calibrationHelper.CaptureFramesPerSecond;

            ButterworthFilter filter = new ButterworthFilter();
            int bestCutoffIndex;

            kinematics.FilterResultXs = filter.FilterSamples(kinematics.RawXs, framerate, 100, out bestCutoffIndex);
            kinematics.XCutoffIndex   = bestCutoffIndex;

            kinematics.FilterResultYs = filter.FilterSamples(kinematics.RawYs, framerate, 100, out bestCutoffIndex);
            kinematics.YCutoffIndex   = bestCutoffIndex;
        }
Exemple #29
0
        public static CoordinateSystemGrid Find(CalibrationHelper calibrationHelper)
        {
            switch (calibrationHelper.CalibratorType)
            {
            case CalibratorType.Line:
                return(FindForLineCalibration(calibrationHelper));

            case CalibratorType.Plane:
                return(FindForPlaneCalibration(calibrationHelper));
            }

            return(null);
        }
Exemple #30
0
        public void SetTrackablePointValue(string name, PointF value)
        {
            if (!points.ContainsKey(name))
            {
                throw new ArgumentException("This point is not bound.");
            }

            points[name] = value;
            if (CalibrationHelper != null)
            {
                CalibrationHelper.CalibrationByLine_Update(Id, points["a"], points["b"]);
            }
        }