本文章通过对数实现对图像的增强
clc;
close all;
clear all;
I =imread('D:/matlab_project/city_afternoon.png');%读取图像原图
Img =rgb2gray(I);%rgb2gray函数的作用就是将彩色图像转换为灰度图像
Img =im2double(Img);%将图像数据转换为double型
[M,N]=size(Img);%获取图像的分辨率
title('直方图统计结果');%给直方图添加标题f
for i=1:M
for j=1:N
imgs(i,j)=1.5*log(1+Img(i,j));
end
end
figure(1);
subplot(1,2,1);
imshow(Img);title('原图');
figure(1);
subplot(1,2,2);
imshow(imgs);title('对数log增强');
figure(2);
subplot(1,2,1);
imhist(Img); title('原图直方图'); %调用imhist函数对图像进行直方图统计
figure(2);
subplot(1,2,2);
imhist(imgs); title('对数log增强直方图');