% h01.m - modified from student's hw0.m Variable size of Image Displays
% 1. 512*512    2.8*2.8inches
close all; clc;
m=512; n=512;
subplot(3,2,1)
set(gca,'unit','inch','position',[0.5 4.5, 2.5 2.5]);
fin=fopen('mandrill.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('Mandrill (512\times512)')
% xlabel('512\times512 Mandrill')
% 2. 512*512   2.8*2.8 inches
m=512; n=512;
subplot(3,2,2)
set(gca,'unit','inch','position',[3.1 4.5, 2.5 2.5]);
fin=fopen('scene.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('Scene (512\times512)')
% xlabel('512\times512 Scene')
% 3. 512*512   2.8*2.8 inches
m=512; n=512;
subplot(3,2,3)
set(gca,'unit','inch','position',[0.5 1.6, 2.5 2.5]);
fin=fopen('D23.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('Pebbles (512\times512)')
% xlabel('512\times512 Pebbles')
% 4. 512*512   2.8*2.8 inches
m=512; n=512;
subplot(3,2,4)
set(gca,'unit','inch','position',[3.1 1.6, 2.5 2.5]);
fin=fopen('fingerprint.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('Fingerprint 512\times512)')
% xlabel('512\times512 Fingerprint')
% 5. 128*128    0.8*0.8 inches
m=128; n=128;
subplot(3,2,5)
set(gca,'unit','inch','position',[1.0, 0.3, 0.8, 0.8]);
fin=fopen('face.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('face (128\times128)')
% xlabel('128\times128 face')
% 6. 150*150     0.96*0.96  inches
m=150; n=150;
subplot(3,2,6)
set(gca,'unit','inch','position',[3.7, 0.14, 0.96, 0.96]);
fin=fopen('array150.raw','r');
X=fread(fin,m*n,'uint8=>uint8'); fclose(fin);
Y=reshape(X,m,n); Z=Y';
imshow(Z)
title('array150 (150\times150)')
%xlabel('150\times150 array150')