bmp 双线性插值_基于双线性插值法raw2rgb

clc;

clear;

close all;

[filename,pathname]=uigetfile({'*.*','All Files (*.*)'},'Pick a file');

file = strcat(pathname,filename);

% raw图的尺寸

row = 1280;

col = 960;

% 读图 所读raw图为8位

fid=fopen(file, 'r');

Bayer=fread(fid,[row,col],'uint8');

fclose(fid);

imR=Bayer(1:2:row,1:2:col);

imG(1:2:row,:)=Bayer(1:2:row,2:2:col);

imG(2:2:row,:)=Bayer(2:2:row,1:2:col);

imB=Bayer(2:2:row,2:2:col);

%imR=imresize(imR,[1280,960],'bicubic');%双线性

imG=imresize(imG,[640,480],'bicubic');%双线性

%imB=imresize(imB,[1280,960],'bicubic');%双线性

rgb(:,:,1)= uint8(imR');

rgb(:,:,2)= uint8(imG');

rgb(:,:,3)= uint8(imB');

figure;imshow(rgb);

imwrite(rgb,'rgb.bmp');

你可能感兴趣的:(bmp,双线性插值)