matlab中图像叠加 |
您所在的位置:网站首页 › 怎么叠加照片 › matlab中图像叠加 |
如果我们想在一幅图像上加上一个背景,那么我们可以将两幅做加法运算,在matlab中既可以使用imlincomb()函数,也可以使用imadd()函数。 close; clear all; clc; A1 = imread('rice.png'); A2 = imread('cameraman.tif'); K = imlincomb(0.5,A1,0.5,A2); subplot(1,3,1),subimage(A1); title('原始图像1'); subplot(1,3,2),subimage(A2); title('原始图像2'); subplot(1,3,3),subimage(K); title('0.5X图像1+0.5X图像2');
改变两幅图像所占的比例: 第一幅仅占10%,第二幅占90%。
可以明显看到,第二幅图像更加明显。 使用imadd()函数同样可以实现图像的加法运算; close; clear all; clc; A1 = imread('rice.png'); A2 = imread('cameraman.tif'); K = imadd(A1,A2,'uint16');%图像相加,防止像素值超出255,因此把结果存为16位 figure; subplot(1,3,1);imshow(A1);title('rice原始图像'); subplot(1,3,2);imshow(A2);title('cameraman原始图像'); subplot(1,3,3);imshow(K,[]);title('相加图像');%注意使用imshow函数时,要加上[],以使得像素值压缩至0—255
|
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |