繁体   English   中英

圆与二进制图像的交点MATLAB

[英]Point of intersection of circle and binary image MATLAB

二进制图像

我已经骨架化了二进制图像和路口信息。 我想在以交界点为中心绘制圆,并想找到圆和二值图像的交点。 我写了以下代码:

 BW = imread('circles.png');
 imshow(BW);
 BW2 = bwmorph(BW,'remove');
 figure, imshow(BW2)
 BW3 = bwmorph(BW,'skel',Inf);
 figure, imshow(BW3)
 BW3t = bwmorph(BW3,'thin');
 figure, imshow(BW3t)


 [rj, cj, re, ce] = findendsjunctions(BW3t, 1);
 hold on 
 plot(cj(1),rj(1),'ob')
 hold on
 circle([cj(1),rj(1)],4,50,':r');

findendsjunctions.m和相关文件show.m可以从这里下载: http://www.csse.uwa.edu.au/~pk/research/matlabfns/LineSegments/findendsjunctions.m这里HTTP://www.csse。 uwa.edu.au/~pk/research/matlabfns/Misc/show.m 您可以从这里下载circle.m: http : //www.mathworks.co.uk/matlabcentral/fileexchange/2876-draw-a-circle/content/circle.m

我想确定圆是否与周围的2、3或4个血管相交(在图像中标记为星形)。 即使单个容器横越许多圈,但输出应为每个容器一个交叉点。

请提出如何找到圆和二元容器的交点。

谢谢

我找到了圆和二值图像的交点以及3个点的坐标(在我的问题提供的图像中标记为星形)。 我更改了功能circle.m(在上面的问题中提到),以输出圆的所有X和Y坐标,然后编写了以下matlab代码:

   [H, X, Y]=circle([cj(1),rj(1)],4,50,':r');
   c = improfile(BW3t,X,Y)
   x=1:length(c)
   figure
   plot(x, c,'r')

峰数表示圆在哪里切割了二进制图像

   [maxtab, mintab]=peakdet(c, 1)
   [pks,locs] = findpeaks(c)
   pt1=[X(locs(1)) Y(locs(1))]
   pt2=[X(locs(2)) Y(locs(2))]
   pt3=[X(locs(3)) Y(locs(3))]

   hold on
   plot(pt1(1),pt1(2),'om','LineWidth',2)
   hold on
   plot(pt2(1),pt2(2),'og','LineWidth',2)
   hold on
   plot(pt3(1),pt3(2),'ob','LineWidth',2)

pt1,pt2,pt3是圆切割二进制图像的三个点

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM