【发布时间】:2020-02-14 10:42:54
【问题描述】:
我尝试的是使用以下几行绘制外部轮廓
cnts, hierarchy = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(orig, cnts, -1, (0, 255, 0), 3) # this draws the external contour
参考以下 [![在此处输入图片描述][1]][1]
我怎样才能得到下面的答案?
[![在此处输入图片描述][2]][2]
【问题讨论】:
-
哦,太难了。 answers.opencv.org/question/44580/how-to-resize-a-contour 是 C++ 中的解决方案。不要认为转换为 Python 解决方案太难。稍后我有时间时会这样做。您的算法应该找到轮廓中心。轮廓 - 中心。比例,新轮廓+中心