Characterization of the Effects of Spatial Translations on JPEG-compressed Images
Keith Jacoby
% Keith Jacoby----Senior Research Project----4/10/1998
%
% Block DCT: This little beauty performs a block DCT on an 8-bit
% grayscale image, and outputs the DCT image as a TIFF. In addition,
% the blocks' DC coefficients are set to zero to make the DCT images
% easier to interpret. Finally, the DCT image is block-ensemble-
% averaged into 1 8x8 block that is an average of all the 8x8 DCT
% blocks in the entire DCT image. I LOVE MATLAB!!! :)
% It's really fun...
%
IMG1=imread('sft8radgrad.tiff','tiff');
figure(1)
imshow(IMG1,256)
IMG2=blkproc(IMG1,[8 8],'dct2(x)');
figure(2)
imshow(IMG2,256)
for i = 1:8:256,
for j = 1:8:256,
IMG2(i,j) = 0.0;
end
end
IMG2min=min(min(IMG2));
IMG2max=max(max(IMG2));
IMG3=mat2gray(IMG2,[IMG2min IMG2max]);
imwrite(IMG3,'sft8dct.tiff','tiff');
%
% Ensemble Averaging of 8x8 blocks
%
SUM8x8(8,8)=0;
for C = 1:8,
for R = 1:8,
for i = R:8:249,
for j = C:8:249,
SUM8x8(R,C)=SUM8x8(R,C)+IMG2(i,j);
end
end
end
end
SUM8x8AVE=SUM8x8/1024;
SUM8x8AVE
MatLab Correlation routine
% Keith Jacoby Senior Research 4/13/98
%
% This tiny routine performs a correlation on two images
% and returns a value R = correlation coefficient
%
IMG1=IMREAD('1-pix_shift_close40.tif','tiff');
figure(1)
imshow(IMG1,256)
IMG2=IMREAD('close40.tif','tiff');
figure(2)
imshow(IMG2,256)
R=CORR2(IMG1,IMG2)