資源簡介
使用MATLAB對圖像二值化處理,使用BayerM2矩陣和BayerM3矩陣對圖像進行處理對比。
代碼片段和文件信息
%???Transfer?an?image?to?black-white-dots?image?with?Bayer?matrix
clear;
clc;
m1?=?[[?0?2?];
??????[?3?1?]];
??
u1?=?ones(2?2);
m2?=?[[?4*m1???????4*m1+2*u1?];
??????[?4*m1+3*u1??4*m1+u1???]]
??
u2?=?ones(4?4);
m3?=?[[?4*m2???????4*m2+2*u2?];
??????[?4*m2+3*u2??4*m2+u2??]]
??
Image?=?imread(‘./data/img-1.png‘);
GrayImage?=?.2989*Image(::1)...
???????????+.5870*Image(::2)...
???????????+.1140*Image(::3);
%r?=?Image(::1);
%g?=?Image(::2);
%b?=?Image(::3);
[height?width]?=?size(GrayImage);
OuputM3?=?0;
for?i?=?1:height
????for?j?=?1:width
????????ImageColor?=?GrayImage(ij)?/?4;
????????BayerMatrix?=?m3(bitand(i7)?+?1?bitand(
- 上一篇:MATLAB中實現Gabor濾波器
- 下一篇:Matlab對于2XSK信號的產生處理
評論
共有 條評論