【发布时间】:2021-02-16 12:46:56
【问题描述】:
我的图像有多个胎盘(白色和灰色的物体)。胎盘不是完整的椭圆。我已经在 OpenCV 中使用 fitEllipse 估计了完整的椭圆。但是,需要帮助找到估计椭圆的周长。
Image with multiple placentomes
Image with drawn ellipses in red on the placentomes
下面是我用来在胎盘上绘制椭圆的代码:-
img = cv2.imread('placentome.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
th, threshed = cv2.threshold(gray, 100, 255, cv2.THRESH_BINARY)
# Find countours of placentomes
cnts, hiers = cv2.findContours(threshed, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[-2:]
# Draws ellipse onto objects using the contours found
for cnt in cnts:
ellipse = cv2.fitEllipse(cnt)
cv2.ellipse(img, ellipse, (0,0, 255), 1, cv2.LINE_AA)
【问题讨论】:
-
欢迎来到 SO。请编辑您的帖子。并尝试更清楚地解释您的问题。您可以访问并查看how to ask a good question