image_path= ‘DoubleByte_ave.raw’ ;
image_width=1600;
image_height=1200;
fid=fopen(image_path,‘r’);
image = fread( fid, ‘uint8=>uint16’);
image_raw = image(1:2:end) + image(2:2:end)*256;
image = reshape(image_raw, image_width, image_height)’;
% image2 = uint8(image/4);
image_rgb = demosaic((image), ‘rggb’);
figure(4),imshow(uint8(image_rgb/4));
image_red = image_rgb(:,:,1);
image_green = image_rgb(:,:,2);
image_blue = image_rgb(:,:,3);
image_rgb2 = demosaic((image), ‘bggr’);
figure(5),imshow(uint8(image_rgb2/4));
image_rgb3 = demosaic((image), ‘grbg’);
figure(6),imshow(uint8(image_rgb3/4));
image,[3480000,1]
image_raw [1920000,1]
image [1200,1600]
/
clc;
clear;
image_path= ‘S5KJN1_Fullsize_64.raw’ ;
image_width=8160;
image_height=6144;
fid=fopen(image_path,‘r’);
image_raw = fread( fid, ‘uint8=>uint16’);
image_raw = image_raw(1:2:end) + image_raw(2:2:end)*256;
image_raw = reshape(image_raw, image_width, image_height)’;
filename = ‘Copy_of_S5KJN1_Fullsize_64.raw’;
f=fopen(filename,‘r’);
row = 6144;
col = 8160;
image=fread(f,[col,row],‘uint16’);
image=image’;
figure(1),imshow(uint8(image/4)), title(‘iamge’);
figure(2),imshow(uint8(image_raw/4)), title(‘iamge_raw’);
/
两种方法结果一样