在MATLAB中使用improfile时,不确定我的代码出错了 [英] Not sure where my code is going wrong when using improfile in MATLAB

查看:330
本文介绍了在MATLAB中使用improfile时,不确定我的代码出错了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正致力于处理一堆图像的代码,并计算这些堆栈的强度分布,以便将它们与另一堆图像进行比较。

I am currently working on code which takes a stack of images and calculates the intensity profiles of these stacks to compare them with another stack of images.

这是我的代码:

for i = 1:c_frames
    d_Img(:,:) = d_I(i,:,:);
    c_Img(:,:) = c_I(i,:,:);
    c_d = improfile(d_Img);
    c_c = improfile(c_Img); 
end

这些是一组错误(当然都与一个错误有关)我得到:

These are the set of errors (all pertaining to one error of course) that I get:

当我<$ c时$ c> whos d_I和c_I,这就是我得到的:

When I whos d_I and c_I, this is what I get:

那么错误究竟是什么意思,我试着查看文档,但我不确定 N 意思是。

So what exactly does the error mean, I tried to look into the documentation, but I wasn't sure as to what the N meant.

感谢您的回答,请不要犹豫,提出任何可以进一步澄清问题的问题。

Thank you for your answers and please do not hesitate to ask any questions that will further clarify the question.

推荐答案

当然这是一个神秘的错误信息,我认为你提供给 improfile 功能不完整。如果你清楚地看一下 https://www.mathworks.com/help/images/ ref / improfile.html ,你看到 improfile(n)语法需要一个标量'n'(不是图像),这就是点数在个人资料中包含。

Granted that this is a cryptic error message, I think the set of inputs you are providing to the improfile function isn't complete. If you look clearly at https://www.mathworks.com/help/images/ref/improfile.html, you see that the improfile(n) syntax needs a scalar 'n' (not an image), which is the number of points to include, in the profile.

没有语法允许仅传入图像。您还必须包含要在其上生成配置文件的线段的端点的x和y坐标。例如,

There is no syntax that allows passing in only an image. You'd have to also include the x and y coordinates of the endpoints of the line segments you want to generate a profile on. For example,

load mri
D = squeeze(D)
dSlice = D(:,:,16);
x = [19 35 65 77];
y = [96 45 27 33];
improfile(dSlice, x, y)  % x and y are required inputs.

有效。至于错误信息,如果你真的很好奇,试试

works. As for the error message, if you're really curious, try

edit improfile

我相信N代表你指定的点数,你称之为扼杀这种逻辑。

I believe N stands for the number of points you've specified, the way you call it chokes this logic.

这篇关于在MATLAB中使用improfile时,不确定我的代码出错了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆