使用cv android进行对象检测

时间:2015-03-13 06:50:36

标签: opencv

我正在使用Open CV来检测对象的边缘。当我使用相机拍摄图像并应用canny边缘也进行形态学操作但它没有给出物体的实际边缘点。我怎样才能得到这一点?enter image description here

2 个答案:

答案 0 :(得分:0)

您可以使用其他边缘检测算法或不同的阈值进行边缘检测。

答案 1 :(得分:0)

我正在使用扩张和高斯模糊和扩张进行边缘检测。

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); 
相关问题