2016-06-29 23 views
0

我想在我的深度圖上找到大約物體。 現在我的過程是這樣的:1。 正常化深度 2閾值的只得到最接近的對象 3.高斯模糊 4. Canny邊緣檢測 5.輪廓檢測在深度圖上檢測大約物體

不過,我米無法找到我的對象周圍的框。其實,我不知道這種深度圖是否可能...

我在桌上有三個物體:一盒食物和兩個杯子。

Normalisation of the depth map

我想找到大約在我的對象框。

enter image description here

有沒有辦法只是通過圖像處理辦呢? 任何幫助,將不勝感激。

非常感謝您提前。

回答

1

你可以使用OpenCV來做到這一點。看看下面的解決方案。

我用問題中提供的深度圖作爲我的輸入圖像。我所執行的深度圖

ret,th = cv2.threshold(gray,127,255, 1) 

的灰度圖像的二進制閾值,並且獲得以下:

enter image description here

現在,爲了填補圖像中的空白,我執行形態接近操作

kernel = np.ones((15,15),np.uint8) 
dilate = cv2.morphologyEx(th, cv2.MORPH_CLOSE, kernel, 3) 

enter image description here

後來我發現輪廓使用:

contours,hierarchy = cv2.findContours(dilate,2,1) 

,並使用拉他們:

cv2.drawContours(img, contours, -1, (0,255,0), 3) 

最終得到這樣的:

enter image description here

希望這是你要找的:)