【问题标题】:How to solve an error about drawcircle in Matlab?如何解决Matlab中关于drawcircle的错误?
【发布时间】:2019-01-29 11:16:38
【问题描述】:

在下面的代码中,即在图像上画一个圆时,发生了错误。我试图解决它,但我找不到问题。

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);

那么,如何解决drawcircle的线错误?

【问题讨论】:

  • 根据文档,drawcircle 的第一个输入应该是一个 axes 对象,引用您要在其中绘制圆的绘图。这也是错误所说的。在您的代码中,这不是您给出的第一个输入。如果没有minimal reproducible example,我们将无法提供更多帮助
  • @Ander Biguri:好的
  • 如果您解释这些值的含义,我将使用工作代码更新答案

标签: matlab image-processing


【解决方案1】:

For MATLAB 2018b

在您的代码中,添加当前轴,如果您想在其中绘制圆:

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');

对于其他 MATLAB

drawcircle 似乎不存在,除非您正在使用某些工具箱功能。

【讨论】:

  • 我已经检查过了,但是:Error using images.roi.Circle/set Invalid parameter/value pair arguments. and Error in images.roi.internal.ROI/parseInputs
  • @eli 你读过文档吗? uk.mathworks.com/help/images/ref/drawcircle.html你没有调用函数
  • @eli 是的,因为参数不正确,它们不是调用函数的方式,如文档中明确说明的那样
  • @eli 很抱歉您不同意 MATLAB 文档,如果是这种情况,我无法为您提供更多帮助。
  • drawcircle(gca, [179, 206], 9, 500, '-', 'g', 1) 不正确,gca 未定义,其他参数对此函数没有意义。
猜你喜欢
  • 1970-01-01
  • 2023-02-09
  • 2013-12-30
  • 1970-01-01
  • 2020-12-14
  • 1970-01-01
  • 2021-03-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多