0
我已经在Matlab中存在以下问题:我有一个2D闭合轮廓(点的一组2D的坐标)表示像这样的图像中的对象: 转换轮廓在图像虚线Matlab的
我想把它转换成像下面这样的虚线:dot-line-space-dot-line-space等
有没有办法在Matlab中解决这个问题? 谢谢你非常非常
我已经在Matlab中存在以下问题:我有一个2D闭合轮廓(点的一组2D的坐标)表示像这样的图像中的对象: 转换轮廓在图像虚线Matlab的
我想把它转换成像下面这样的虚线:dot-line-space-dot-line-space等
有没有办法在Matlab中解决这个问题? 谢谢你非常非常
您可以使用imfill
对象首先填充,然后使用bwboundaries
跟踪它,并绘制使用plot
与a given line style的结果。
% Load the image in and convert to binary
img = imread('http://i.stack.imgur.com/G4NLh.png');
img = img(:,:,1) > 170;
% Fill in the middle hole and compute the boundary
boundary = bwboundaries(imfill(img, 'holes'));
% Plot the boundary on a black background
plot(boundary{1}(:,2), boundary{1}(:,1), ...
'LineStyle', '-.', ...
'Marker', 'none')
axis image
axis ij
更新
哦......你已经有X/Y点。好吧!只需使用阴谋的LineStyle
属性来完成你想要的。