資源簡介
真彩色增強數字圖象處理Matlab實現(兩種方法),方法不錯,供大家參考!

代碼片段和文件信息
%直接對RGB進行變換
I=imread(‘原圖.jpg‘);
R=I(::1);
G=I(::2);
B=I(::3);
r=cat(3RG-GB-B);
g=cat(3R-RGB-B);
b=cat(3R-RG-GB);
figure(1)
subplot(331)
imshow(R);
title(‘紅色分量灰度圖‘);
subplot(332)
imshow(G);
title(‘綠色分量灰度圖‘);
subplot(333)
imshow(B);
title(‘藍色分量灰度圖‘);
subplot(334)
imshow(r);
title(‘紅色分量圖‘);
subplot(335)
imshow(g);
title(‘綠色分量圖‘);
subplot(336)
imshow(b);
title(‘藍色分量圖‘);
subplot(337)
imhist(R);
title(‘紅色分量直方圖‘);
subplot(338)
imhist(G);
title(‘綠色分量直方圖‘);
subplot(339)
imhist(B);
title(‘藍色分量直方圖‘);
k=histeq(R);
p=histeq(G);
g=histeq(B);
N=cat(3kpg);
figure(2)
subplot(121)
imshow(I);
title(‘原圖‘);
subplot(122)
imshow(N);
title(‘均衡化后圖片‘);
figure(3)
subplot(131)
imhist(k);
title(‘紅色分量均衡化直方圖‘);
subplot(132)
imhist(p);
title(‘綠色分量均衡化直方圖‘);
subplot(133)
imhist(g);
title(‘藍色分量均衡化直方圖‘);
%HSI變換后:
c=rgb2hsi(I);
h=c(::1);
s=c(::2);
i=c(::3);
figure(4)
subplot(121)
imhist(i);
title(‘I分量均衡化前‘);
k=histeq(i);
subplot(122)
imhist(k);
title(‘I分量均衡化后‘);
d=cat(3hsk);
e=hsi2rgb(d);
figure(5)
imshow(e);
title(‘HSI變換后‘);
%對比度拉伸
r=imadjust(R);
g=imadjust(G);
b=imadjust(B);
n=cat(3rgb);
i=imadjust(i);
f=cat(3hsi);
f=hsi2rgb(f);
figure(6)
subplot(131)
imshow(I);
title(‘原圖‘);
subplot(132)
imshow(n);
title(‘rgb拉伸‘);
subplot(133)
imshow(f);
title(‘i分量拉伸‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-04-26?20:44??程序1\
?????文件????????1527??2015-04-26?20:44??程序1\cszq.m
?????文件?????????873??2015-04-13?14:40??程序1\hsi2rgb.m
?????文件?????????395??2015-04-13?14:35??程序1\rgb2hsi.m
?????文件??????197233??2015-04-09?15:26??程序1\原圖.jpg
?????目錄???????????0??2015-05-09?14:42??程序2\
?????文件????????1488??2015-04-21?11:54??程序2\colorenhance.m
?????文件?????????873??2015-04-14?20:25??程序2\hsi2rgb.m
?????文件??????197233??2015-03-23?15:56??程序2\lena.jpg
?????文件?????????395??2015-04-14?20:25??程序2\rgb2hsi.m
?????目錄???????????0??2015-05-09?14:41??程序2\截圖\
?????文件??????138574??2015-04-19?21:32??程序2\截圖\1.png
?????文件??????236072??2015-04-15?16:26??程序2\截圖\10.png
?????文件??????301481??2015-04-15?21:12??程序2\截圖\11.png
?????文件??????281111??2015-04-15?21:18??程序2\截圖\12.png
?????文件??????334026??2015-04-15?21:21??程序2\截圖\13.png
?????文件??????209991??2015-04-15?21:30??程序2\截圖\14.png
?????文件??????150868??2015-04-19?21:10??程序2\截圖\15.png
?????文件??????181665??2015-04-19?21:04??程序2\截圖\2.png
?????文件??????143407??2015-04-19?21:09??程序2\截圖\3.png
?????文件??????150926??2015-04-19?21:08??程序2\截圖\4.png
?????文件??????137773??2015-04-20?14:08??程序2\截圖\5.png
?????文件??????257712??2015-04-15?21:32??程序2\截圖\6.png
?????文件??????245762??2015-04-15?21:31??程序2\截圖\7.png
?????文件??????138240??2015-04-19?21:32??程序2\截圖\8.png
?????文件??????373417??2015-04-15?16:22??程序2\截圖\9.png
?????文件??????202240??2015-04-26?23:01??程序2\截圖\Thumbs.db
- 上一篇:DOG高斯差分
- 下一篇:基于MATLAB和HMM的說話人識別系統
評論
共有 條評論