在Matlab中找到两个拟合平面之间的角度

时间:2018-10-24 15:37:26

标签: matlab angle data-fitting plane

我想找到已经拟合到一组点(x,y,z)的两个平面之间的角度;此处,x和y是像素位置,z是位置(x,y)的强度值。我使用了 Matlab fit 函数,如下所示:

对于Image-1:

Image1 = double(imread('Image1.png'));
x = 1:size(Image1,1);
y = 1:size(Image1,2);
z= Image1;
[xo,yo,zo] = prepareSurfaceData(x,y,z);

对于Image-2:

Image2 = double(imread('Image2.png'));
x1 = 1:size(Image2,1);
y1 = 1:size(Image2,2);
z1= Image2;
[xg,yg,zg] = prepareSurfaceData(x1,y1,z1); 

现在,我平面拟合到这些图像点,如下所示:

% fitted plane for the first image
fc =fit([yo,xo],zo,'poly10','Normalize','on','Robust','Bisquare');
% fitted plane for the second image
fg = fit([yg,xg],zg,'poly10','Normalize','on','Robust','Bisquare');

我绘制这些拟合平面如下:

figure
h1=plot(fc);
set(h1(1),'Edgecolor','none')
set(h1(1),'FaceAlpha','0.99')
set(h1(1),'FaceColor','green')
hold on
h2=plot (fg);
set(h2(1),'Edgecolor','none')
set(h2(1),'FaceAlpha','0.99')
set(h2(1),'FaceColor',[0.5 0.5 0.5])
hold off 

我想测量拟合平面fc和fg之间的角度。您能建议我如何测量它们之间的角度吗?

0 个答案:

没有答案