clc;
clear all;
close all;
img=imread('1.jpg');
img=rgb2gray(img);
subplot(1,2,1);
imshow(img,[]);title('Original Picture');
[M,N]=size(img);
%Histogram Caculation
img=double(img);
h=zeros(256,1);
for i=1:M,
for j=1:N,
f=img(i,j);
h(f+1)=h(f+1)+1;
end
end
subplot(1,2,2);
bar(h);grid;title('Original Histogram');
%Histogram Equalizing
hh=h/(M*N);
for k=1:256
c(k)=uint8(sum(hh(1:k))*255);
end
for i=1:M
for j=1:N
f=img(i,j)+1;
histeqimg(i,j)=c(f);
end
end
figure;
subplot(1,2,1);
imshow(histeqimg,[]);title('Picture after Histogram Equalizing');
%Histogram Caculation of Equalized Picture
histeqimg=double(histeqimg);
h=zeros(256,1);
for i=1:M,
for j=1:N,
f=histeqimg(i,j);
h(f+1)=h(f+1)+1;
end
end
subplot(1,2,2);
bar(h);grid;title('Histogram of Equalized Picture');
%Histogram Equalizing by Function Histeq
img=imread('1.jpg');
img=rgb2gray(img);
img=histeq(img);
figure;
subplot(1,2,1);
imshow(img,[]);title('Comparison:Picture by function histeq');
img=double(img);
h=zeros(256,1);
for i=1:M,
for j=1:N,
f=img(i,j);
h(f+1)=h(f+1)+1;
end
end
subplot(1,2,2);
bar(h);grid;title('Comparison:Histogram by function histeq');
zhifangtujunhenghua.zip_图像拉伸_非线性拉伸
版权申诉
87 浏览量
2022-09-14
20:23:06
上传
评论
收藏 589B ZIP 举报
weixin_42653672
- 粉丝: 93
- 资源: 1万+
最新资源
- 基于Python的高德地图+58租房(源码+使用文档)
- C语言文件读写代码.docx
- python的概要介绍与分析
- module-0982.SyncTensorsGraph.9515.sm-8.0-gpu-after-optimizations
- ChromeSetup20220804.exe
- 讲解记录 基于Java的小区物业管理系统
- module-0004.SyncTensorsGraph.7578.sm-8.0-gpu-after-optimizations
- python39.dll
- 【Matlab 六自由度机器人】Fixed Angles(固定角度) 和 Euler Angles(欧拉角) 之间的区别
- STLINK下载器调试过程中常见问题排查
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0