0

我想在下图中(通过使用 Python):

1.) 找到骨骼的轮廓(只有侧面可以)

2.) 识别并绘制所有轮廓。

它可能看起来像这样:

更好的轮廓甚至是好的。我不完全确定如何解决这个问题,

图像的梯度为:

4

2 回答 2

1

您应该首先应用一个阈值cv2.threshold来清除您不想要的对象中的图像,尝试不同的强度值来捕捉边界,然后应用一些形态学操作,例如OPENINGCLOSINGwithcv2.morphologyEx来清理一点图像,填充和最后应用cv2.findContourscv2.drawContours获得骨骼轮廓的最终图像。

检查 opencv 库上的这些命令 您会在 stackoverflow 和互联网上找到非常好的示例,尝试使您的代码适应这些示例。希望这对您有很好的帮助。

于 2017-05-05T14:42:53.867 回答
1

解决这个问题的初始方法是使用精确的边缘检测,使用正确的阈值,然后找到轮廓。

import cv2

# Load the image
img = cv2.imread("/home/tribta/Desktop/feet.png")

# Find the contours
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(img,60,200)
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

hierarchy = hierarchy[0] # get the actual inner list of hierarchy descriptions

# For each contour, find the bounding rectangle and draw it
cv2.drawContours(img, contours, -1, (0,255,0), 3)

# Finally show the image
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

然后你可以添加一些生物医学处理标准来区分不同的轮廓并验证它是否真的是骨头。

于 2017-05-05T15:03:53.630 回答