在下面的代码中,即在图像上画圆时,发生了错误。我尝试解决它,但找不到问题。
figure('color', [1 1 1]);
clf;
imshow(inputVol(:,:,85),[]);
drawcircle([blobSlice(ind,2),blobSlice(ind,1)],round(sqrt(3)*blobSlice(ind,4)),50,'-','g', 1); % Error
例如:
I = imread('Img.jpg');
% blobSlice(ind,2) = 179;
% blobSlice(ind,1) = 206;
% round(sqrt(3)*blobSlice(ind,4)) = 9;
imshow(I,[]);
drawcircle(gca, [179, 206], 9, 500, '-', 'g', 1); % Error is here.
错误是:
Error using images.roi.internal.ROI/parseInputs
ROI parent must be a valid Axes object.
Error in images.roi.Circle
Error in drawcircle (line 165)
h = images.roi.Circle(varargin{:});
Error in tumor2dVis (line 18)
drawcircle([blobSlice(ind,2),blobSlice(ind,1)],round(sqrt(3)*blobSlice(ind,4)),500,'-','g', 1);
Error in Blob3D_Detection (line 38)
tumor2dVis(volume_image, 85, nonMaxOutput, 1);
那么,如何解决关于画圆线的错误?
答案 0 :(得分:4)
在代码中,添加当前轴(如果要在其中绘制圆):
figure('color', [1 1 1]);clf;
imshow(inputVol(:,:,85),[]);
% Get current axis (gca):
ax=gca;
% add them to the function.
drawcircle(ax,...);
一个例子是:
drawcircle(gca,'Center',[206,179],'Radius',9,'StripeColor','g');
drawcircle
似乎并不存在。