clear all;close all;clc;
fid = fopen('image.dat','r');
img = fread(fid,[512,512],'uint16');
im = mat2gray(img);
figure;
imshow(im);
odd = 1:2:1024;
even = 2:2:1024;
tim = zeros(512,1024);
tim(:,odd(:)) = img(:,:);
tim(:,even(:)) = img(:,:);
bim = zeros(1024,1024);
bim(odd(:),:) = tim(:,:);
bim(even(:),:) = tim(:,:);
figure;
imshow(mat2gray(bim));
fid = fopen('image2.dat','w');
fwrite(fid,bim,'uint16');
评论0