2015-03-13 54 views
1

我使用Open CV来检测对象的边缘。当我使用相机捕捉图像并应用Canny边缘也可以进行形态学操作,但它不会给出对象的实际边缘点。我怎样才能得到这个观点? enter image description here使用cv进行对象检测android

+0

请任何人都知道这个为android给答案asap ... – 2015-03-14 04:17:23

回答

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); 
0

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