matlab中18张彩色图片自适应融合算法代码
时间: 2023-08-26 22:14:56 浏览: 154
这里是一个基于matlab的18张彩色图片自适应融合算法的代码示例:
```matlab
% 读取18张彩色图片
img1 = imread('img1.png');
img2 = imread('img2.png');
img3 = imread('img3.png');
img4 = imread('img4.png');
img5 = imread('img5.png');
img6 = imread('img6.png');
img7 = imread('img7.png');
img8 = imread('img8.png');
img9 = imread('img9.png');
img10 = imread('img10.png');
img11 = imread('img11.png');
img12 = imread('img12.png');
img13 = imread('img13.png');
img14 = imread('img14.png');
img15 = imread('img15.png');
img16 = imread('img16.png');
img17 = imread('img17.png');
img18 = imread('img18.png');
% 将图片转换为灰度图像
img1_gray = rgb2gray(img1);
img2_gray = rgb2gray(img2);
img3_gray = rgb2gray(img3);
img4_gray = rgb2gray(img4);
img5_gray = rgb2gray(img5);
img6_gray = rgb2gray(img6);
img7_gray = rgb2gray(img7);
img8_gray = rgb2gray(img8);
img9_gray = rgb2gray(img9);
img10_gray = rgb2gray(img10);
img11_gray = rgb2gray(img11);
img12_gray = rgb2gray(img12);
img13_gray = rgb2gray(img13);
img14_gray = rgb2gray(img14);
img15_gray = rgb2gray(img15);
img16_gray = rgb2gray(img16);
img17_gray = rgb2gray(img17);
img18_gray = rgb2gray(img18);
% 对灰度图像进行自适应融合
fused_gray = adapthisteq(cat(3, img1_gray, img2_gray, img3_gray, img4_gray, img5_gray, img6_gray, img7_gray, img8_gray, img9_gray, img10_gray, img11_gray, img12_gray, img13_gray, img14_gray, img15_gray, img16_gray, img17_gray, img18_gray));
% 将融合后的灰度图像转换为彩色图像
fused = cat(3, fused_gray, fused_gray, fused_gray);
% 显示融合后的彩色图像
imshow(fused);
```
这个代码示例中,我们首先读取了18张彩色图片,然后将它们转换为灰度图像。接着,我们调用了`adapthisteq`函数对这些灰度图像进行自适应融合。最后,我们将融合后的灰度图像转换为彩色图像,并将其显示出来。
阅读全文