检测深度图上的近似对象 [英] Detect approximately objects on depth map
问题描述
我想在我的深度图上找到大约对象.现在我的流程如下:1. 深度归一化2. 只获取最近对象的阈值3. 高斯模糊4. Canny 边缘检测5. 轮廓检测
I would like to find approximately object on my depth map. For now my process is the following : 1. Normalization of the depth 2. Threshold to get only the closest object 3. Gaussian blur 4. Canny edge detection 5. Contour detection
但是,我找不到对象周围的框.其实我不知道这种深度图能不能实现...
However, I'm not able to find the box around my object. Actually, I don't know if it's possible with this kind of depth map...
我桌上有三个东西:一盒食物和两个杯子.
I have three object on the table : a box of food and two mugs.
我想在我的对象周围找到大约一个框.
I would like to find approximately a box around my object.
有没有办法只通过图像处理来做到这一点?任何帮助将不胜感激.
Is there a way to do it just by image processing ? Any help would be appreciated.
非常感谢您.
推荐答案
您可以使用 OpenCV 执行此操作.看看下面的解决方案.
You can do this using OpenCV. Have a look at the following solution.
我使用问题中提供的深度图作为我的输入图像.我对深度图的灰度图像进行了二值化阈值
I used the depth map provided in the question as my input image. I performed binary threshold of the gray scale image of the depth map
ret,th = cv2.threshold(gray,127,255, 1)
并获得以下内容:
现在为了填补图像中的空白,我进行了形态闭合操作
Now in order to fill the gaps in the image, I performed morphological close operation
kernel = np.ones((15,15),np.uint8)
dilate = cv2.morphologyEx(th, cv2.MORPH_CLOSE, kernel, 3)
然后我发现轮廓使用:
contours,hierarchy = cv2.findContours(dilate,2,1)
并使用以下方法绘制它们:
and drew them using:
cv2.drawContours(img, contours, -1, (0,255,0), 3)
终于得到了:
希望这就是你要找的 :)
Hope this is what you were looking for :)
这篇关于检测深度图上的近似对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!