amtalee 46关攻略 哪位大神有种子帮帮忙 谢谢哦!

matlab中的fspecial中有一个功能叫‘motion’。哪位大神帮帮忙解释一下那段代码什么意思。急!!!_百度知道
matlab中的fspecial中有一个功能叫‘motion’。哪位大神帮帮忙解释一下那段代码什么意思。急!!!
% distance perpendicular to the line
rad = sqrt(x.^2 + y,end+[1,[0;
half = (len-1)/
dist2line(lastpix) = sqrt(dist2line(lastpix):end]-1) = dist2
cosphi = cos(phi);2;
dist2line = linewdt + eps - abs(dist2line);0;% rotate half length around center
phi = mod(p3。求各位帮帮忙吧
case '180* % Motion filter uses bilinear interpolation
len = max(1。;
sinphi = sin(phi);
% define mesh for the half matrix, eps takes care of the right size
% for 0 & 90 rotation
sx = fix(half*cosphi + linewdt*xsign - len*eps);
xsign = sign(cosphi);
if cosphi&= half)&(abs(dist2line)&(sum(h(;
[x y] = meshgrid([0,180)&#47:sx]:)) + eps*len*len).^2):sy]);
% define shortest distance from a pixel to the rotated line
dist2line = (y*cosphi-x*sinphi);
%distance to the line's end-point but within the line width
lastpix = find((rad &gt.^2);
% find points beyond the line&#39。;s end-point parallel to the line
x2lastpix = half - abs((x(lastpix) + dist2line(lastpix)*sinphi)&#47:xsign,
h = flipud(h).^2 + x2
dist2line(dist2line&
sy = fix(half*sinphi + linewdt - len*eps);% zero out anything beyond line width
% unfold half-matrix to the full size
h = rot90(dist2line:end]-1,2);
h(end+[1.&#47我想要自己重新编一个函数实现motion功能但是看不太懂他是什么意思;motion'=linewdt));cosphi);0) = 0,p2);
linewdt = 1
提问者采纳
h = h,为什么要设置为1,所以使用eps就是为了这点。
[x y] = meshgrid([0,但是为何乘以len还不得而知;=linewdt))。
%distance to the line'这里的输出角度全部都为0到180度:end]-1) = dist2line,如果还有看不懂的;找出距离原点超出half同时距离直线距离在linewdt宽度内的离散点坐标!所以可以通过矩阵元素进行坐标方面的运算;确定网格中x轴的生成方向
linewdt = 1.^2),[0。后面的判断机制就是看这个距离是否在linewdt之内.^2);2.
dist2line = linewdt + eps - abs(dist2line);mesh这条命令在这个应用里面起到了两层作用。
sy = fix(half*sinphi + linewdt - len*eps),自己举一个实例就能搞懂。
% define shortest distance from a pixel to the rotated line
dist2line = (y*cosphi-x*sinphi),所以我认为其影响只在某些特定的条件下产生,也就是说这个矩阵有合适的size,所以通过linewdt*xsign进行修正。
h(end+[1,判断其是否还能用作表示线段的点,
h = flipud(h).矩阵的元素是坐标;
dist2line(dist2line&输入的模糊核的长度必须大于1
half = (len-1)&#47,计算这些离散的点距离我们实际的这条线段的距离,补充一个完整的拥有len长度的线段;0。后面就是根据这些距离与linewdt的大小比较获取的,直观地认为在直线上的点最好,在内则可以将该点算作线段内部:sx]这位同学真有缘:end]-1,显然一行的情况更合乎逻辑。
rad = sqrt(x,end+[1。
% find points beyond the line&#39,如果你能找到能告诉我吗.^2 + x2% zero out anything beyond line width
% unfold half-matrix to the full size
h = rot90(dist2line,这种算法的原理我还找不到相关文献有一个理论解释; % Motion filter uses bilinear interpolation关键思想是双线性差分,这也是后面sy求解中的不使用ysign的缘由
cosphi = cos(phi),我们可以选取离直线近的点来充当直线成分,180)/motion&#39,即使乘以len也不存在较大的值;
end我只能按照代码进行解释;该句连同上句是计算lastpix中的点到half末端的距离;180*= half)&(abs(dist2line)&lt?
% define mesh与sx类似,通过矩阵变换最终的模糊核有3行而不是一行,主要用于区别超出线段长度的点;计算mesh区域中离散点到原点的距离;
if cosphi&0) = 0;s end-point parallel to the line
x2lastpix = half - abs((x(lastpix) + dist2line(lastpix)*sinphi)&#47:当sinphi=0时如果没有eps的存在。这些点留作进一步判断:)) + eps*len*len)?
len = max(1,则sy=1。这一点也是利用mesh出来的矩阵的坐标特性;% rotate half length around center求出模糊核一半的长度
phi = mod(p3,比这个数小的数就认为是0.产生一个能够容纳线段的矩阵;(sum(h(.
% for 0 & 90 rotation
sx = fix(half*cosphi + linewdt*xsign - len*eps), eps takes care of the right size其中eps用于保证mesh有正确的cosphi);% distance perpendicular to the line这条语句就使用了mesh产生的坐标性质。由于eps的实际值很小.^2 +设置的模糊核的宽度.&#47:sy]):xsign,p2),如果half*cosphi包含小数则会因为向零舍入造成矩阵的size不能包含全部的长度,如果没有直线上的点的话;后面这些就是将矩阵进行翻转等:1;
sinphi = sin(phi)?Eps是matlab中能计算的最小的数,2)?谢谢了;
dist2line(lastpix) = sqrt(dist2line(lastpix);s end-point but within the line width
lastpix = find((rad &
xsign = sign(cosphi);2;fix这个函数是将小数向0方向舍入,不在则将其置为0,我今天正打算研究这段代码是什么鸟意思。想知道具体回答qq上解答 case &#39
提问者评价
其他类似问题
为您推荐:
fspecial的相关知识
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 哪位大神有希崎杰西卡 的文章

 

随机推荐