Esempio n. 1
0
            public override void Detect(int cameraId, Aruco.Dictionary dictionary, Cv.Mat image)
            {
                base.Detect(cameraId, dictionary, image);

                ArucoMarkerTracker markerTracker = arucoTracker.MarkerTracker;

                Std.VectorVectorPoint2f diamondCorners = null;
                Std.VectorVec4i         diamondIds     = null;

                if (markerTracker.DetectedMarkers[cameraId][dictionary] > 0)
                {
                    if (arucoCameraUndistortion == null)
                    {
                        Aruco.DetectCharucoDiamond(image, markerTracker.MarkerCorners[cameraId][dictionary], markerTracker.MarkerIds[cameraId][dictionary],
                                                   DetectSquareMarkerLengthRate, out diamondCorners, out diamondIds);
                    }
                    else
                    {
                        Aruco.DetectCharucoDiamond(image, markerTracker.MarkerCorners[cameraId][dictionary], markerTracker.MarkerIds[cameraId][dictionary],
                                                   DetectSquareMarkerLengthRate, out diamondCorners, out diamondIds, arucoCameraUndistortion.RectifiedCameraMatrices[cameraId],
                                                   arucoCameraUndistortion.UndistortedDistCoeffs[cameraId]);
                    }
                }

                DiamondCorners[cameraId][dictionary]   = diamondCorners;
                DiamondIds[cameraId][dictionary]       = diamondIds;
                DetectedDiamonds[cameraId][dictionary] = (diamondIds != null) ? (int)diamondIds.Size() : 0;
            }
Esempio n. 2
0
            /// <summary>
            /// <see cref="ArucoObjectTracker.Detect(int, Dictionary, HashSet{ArucoObject})"/>
            /// </summary>
            public override void Detect(int cameraId, Aruco.Dictionary dictionary)
            {
                if (!IsActivated)
                {
                    return;
                }

                CameraParameters cameraParameters = arucoTracker.ArucoCamera.CameraParameters;

                Std.VectorVectorPoint2f diamondCorners = null;
                Std.VectorVec4i         diamondIds     = null;

                if (arucoTracker.MarkerTracker.DetectedMarkers[cameraId][dictionary] > 0)
                {
                    if (cameraParameters == null)
                    {
                        Aruco.DetectCharucoDiamond(arucoTracker.ArucoCamera.Images[cameraId], arucoTracker.MarkerTracker.MarkerCorners[cameraId][dictionary],
                                                   arucoTracker.MarkerTracker.MarkerIds[cameraId][dictionary], DETECT_SQUARE_MARKER_LENGTH_RATE, out diamondCorners, out diamondIds);
                    }
                    else
                    {
                        Aruco.DetectCharucoDiamond(arucoTracker.ArucoCamera.Images[cameraId], arucoTracker.MarkerTracker.MarkerCorners[cameraId][dictionary],
                                                   arucoTracker.MarkerTracker.MarkerIds[cameraId][dictionary], DETECT_SQUARE_MARKER_LENGTH_RATE, out diamondCorners, out diamondIds,
                                                   cameraParameters.CamerasMatrix[cameraId], cameraParameters.DistCoeffs[cameraId]);
                    }
                }

                DiamondCorners[cameraId][dictionary]   = diamondCorners;
                DiamondIds[cameraId][dictionary]       = diamondIds;
                DetectedDiamonds[cameraId][dictionary] = (diamondIds != null) ? (int)diamondIds.Size() : 0;
            }