2021-10-22 MATLAB水平拼接两幅图

涡旋光的螺旋相位图## 标题MATLAB中实现两幅图的水平拼接

  • List item
    写这个博客目的很简单,网上搜代码,比如我今天就想实现两幅图的简单拼接,奈何网上搜出来的都不对劲(或许是我检索能力太差了)没搜到之后,其实我自己想了一下拼接的原理,就是把两个矩阵放在一起,图片嘛就是矩阵。然后随便编了两行一试,居然成功了。。。,哎,我这种不爱动脑子的人,就喜欢现成的,现成代码如下:
    clear all;
    cm = 0.01;
    um = 1e-6;
    nm = 1e-9;
    mm = 1e-3;

lambda = 638.8*nm;

Pitch = 20*um;
M_a = 1200;
N_a = 950;
xa =[-N_a/2:N_a/2-1]*Pitch;
ya = [-M_a/2:M_a/2-1]’*Pitch;

[theta,rou]=cart2pol(xa,ya);
l1=3 ;
l=1
theta_offset = pi;
vox1 = exp(l1j(theta+theta_offset));
vox1 = (vox1);
vox2 = exp(lj(theta+theta_offset));
vox2 = (vox2);
Image_1=mat2gray(angle(vox1));
Image_2=mat2gray(angle(vox2));
figure()
imshow(Image_1);
imshow(Image_2);
imwrite(Image_1,‘fig_1.jpg’);
imwrite(Image_1,‘fig_2.jpg’);
%水平拼接两幅图

C=[Image_1,Image_2]
[M_a,N_a]=size©

figure()
imshow©

上一篇:week4


下一篇:机器学习一