【发布时间】:2021-06-09 05:55:13
【问题描述】:
我是图像处理的新手。我有一个已转换为灰度的深度图像,如下所示:
通过
depth_image_raw = np.asanyarray(depth_frame.get_data())
to_grayscale = cv2.convertScaleAbs(depth_image_raw, alpha=0.30)
ret, Thresh = cv2.threshold(to_grayscale, 60, 155, 0)
contours, hierarchy = cv2.findContours(Thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(to_grayscale, contours, 0, (0, 0, 255), 2)
这没有用。当我做print(countours) 时,我可以看到坐标列表,但它不是由cv2.drawCountours 绘制的。
我哪里错了?
我试图做这样的事情:1:Detect approximately objects on depth map
【问题讨论】:
-
你显示的图片是
cv2.imshow吗? -
我们能有完整的代码和原始图像一起玩吗?
-
@stateMachine 是,通过 cv2.imshow
-
@pippo1980 这是相机的输出图像。摄像头是 RealSense D435
-
是的,我知道,但是缺少导入,并不是我们都有相机,所以要测试您的代码并希望了解有关 pyrealsense2 的任何信息,我需要 ''depth_frame.get_data()'' 来测试您的代码,我理解它是来自套件的流,但在这里我们应该讨论有效的代码,即输入代码输出。很抱歉我的咆哮,但我在尝试理解新事物时感到沮丧
标签: python opencv image-processing opencv-python opencv-contour