我有一个骨架图像(如下所示)。
我想得到直线的交点。我尝试了下面的方法,skeleton
是一个 openCV 图像,算法返回一个坐标列表:
def getSkeletonIntersection(skeleton):
image = skeleton.copy();
image = image/255;
intersections = list();
for y in range(1,len(image)-1):
for x in range(1,len(image[y])-1):
if image[y][x] == 1:
neighbourCount = 0;
neighbours = neighbourCoords(x,y);
for n in neighbours:
if (image[n[1]][n[0]] == 1):
neighbourCount += 1;
if(neighbourCount > 2):
print(neighbourCount,x,y);
intersections.append((x,y));
return intersections;
它找到有两个以上相邻像素的白色像素的坐标。我认为这只会返回角球,但它不会 - 它会返回更多的分数。
这是在图像上标记了检测到的点的输出。这是因为它检测到下面显示的一些不是交叉点的示例。
0 0 0 1 1 0 0 1 1
1 1 1 0 1 0 1 1 0
0 0 1 0 0 1 0 0 0
还有更多例子。我应该看看另一种检测交叉点的方法吗?感谢所有输入和想法,谢谢。
最佳答案
关于python - 在 python opencv 中查找骨架化图像的交集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41705405/