// Detects Corners with Detector Framework and Draws Keypoints to outMat
    void CornerDetection()
    {
        // Creating Detector
        int   octaves        = 6;
        float corner_thresh  = 0.015f;
        float dog_thresh     = 0.015f;
        int   max_detections = 5;
        HarrisLaplaceFeatureDetector detector = HarrisLaplaceFeatureDetector.create(
            octaves, corner_thresh, dog_thresh, max_detections);

        // Finding corners
        // imageMat = cached_initMat;
        Core.flip(cached_initMat, imageMat, 0);
        keyMat = new MatOfKeyPoint();
        detector.detect(imageMat, keyMat);

        // Draw corners
        Features2d.drawKeypoints(imageMat, keyMat, outMat);
    }
示例#2
0
    void ComputerVisionAlgo(IntPtr greyscale)
    {
        Utils.copyToMat(greyscale, imageMat);

        // Creating Detector (Red Circle)
        MatOfKeyPoint keyMat = new MatOfKeyPoint();
        HarrisLaplaceFeatureDetector detector = HarrisLaplaceFeatureDetector.create(6, 0.015f, 0.015f, 5);

        // Finding circles
        Debug.Log(keyMat.size());
        detector.detect(imageMat, keyMat);
        if (keyMat.size().height > 0)
        {
            double blob_x = keyMat.get(0, 0)[0];
            double blob_y = keyMat.get(0, 0)[1];
            double blob_r = keyMat.get(0, 0)[2];
        }

        // Visualizing detected circles
        // m_ImageInfo.text = string.Format("Circle Count: {0}\n Circle[0]: {1} x {2} -- {3}",
        // keyMat.size().height, blob_x, blob_y, blob_r);

        Features2d.drawKeypoints(imageMat, keyMat, outMat);
    }