使用 cv android 进行对象检测

Object detection using cv android

我正在使用 Open CV 检测物体的边缘。当我使用相机捕获图像并应用 canny edge 时也进行形态学操作,但它没有给出对象的实际边缘点。我怎样才能得到这些积分?

您可以使用另一种边缘检测算法或不同的边缘检测阈值。

我正在使用扩张和高斯模糊以及边缘检测的扩张。

Imgproc.GaussianBlur(imgSource, imgSource, new Size(11, 11), 0);
        // Imgproc.Canny(imgSource, imgSource, 20, 60);

        // 2) AdaptiveThreshold -> classify as either black or white
        Imgproc.adaptiveThreshold(imgSource, imgSource, 255,
                Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 5, 2);

        // 3) Invert the image -> so most of the image is black
        Core.bitwise_not(imgSource, imgSource);

        // 4) Dilate -> fill the image using the MORPH_DILATE
        Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_DILATE,
                new Size(3, 3), new Point(1, 1));
        Imgproc.dilate(imgSource, imgSource, kernel);