0% found this document useful (0 votes)
7 views2 pages

HPF Code

tfutdtd

Uploaded by

anony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

HPF Code

tfutdtd

Uploaded by

anony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

% Load the images

image1 = imread('500us000000001.bmp');
image2 = imread('500us000000002.bmp');
image3 = imread('500us000000003.bmp');
image4 = imread('500us000000004.bmp');
image5 = imread('500us000000005.bmp');
image6 = imread('500us000000006.bmp');
image7 = imread('500us000000007.bmp');
image8 = imread('500us000000008.bmp');
image9 = imread('500us000000009.bmp');
image10 = imread('500us000000010.bmp');
image11= imread('500us000000011.bmp');
image12 = imread('500us000000012.bmp');
image13 = imread('500us000000013.bmp');

% Convert the images to double precision


image1 = double(image1);
image2 = double(image2);
image3 = double(image3);
image4 = double(image4);
image5 = double(image5);
image6 = double(image6);
image7 = double(image7);
image8 = double(image8);
image9 = double(image9);
image10 = double(image10);
image11 = double(image11);
image12 = double(image12);
image13 = double(image13);

% Create the input image sequence


Raw_Image_Seq = cat(3, image1,
image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,ima
ge13);

% Set the filter parameters


fc = 0.1; % Cutoff frequency
N_filt = 4; % Filter order

% Apply the HPF pre-processing


Filt_Image_Seq = HPF_pre_processing(Raw_Image_Seq, fc, N_filt);

% Display the filtered images


figure;
subplot(2, 2, 1);
imshow(uint8(Raw_Image_Seq(:, :, 1)));
title('Original Image 1');

subplot(2, 2, 2);
imshow(uint8(Filt_Image_Seq(:, :, 1)));
title('Filtered Image 1');

subplot(2, 2, 3);
imshow(uint8(Raw_Image_Seq(:, :, 2)));
title('Original Image 2');

subplot(2, 2, 4);
imshow(uint8(Filt_Image_Seq(:, :, 2)));
title('Filtered Image 2');

% Function definition
function Filt_Image_Seq = HPF_pre_processing(Raw_Image_Seq, fc, N_filt)
[J, I, N] = size(Raw_Image_Seq);
Filt_Image_Seq = zeros(J, I, N);

[b, a] = butter(N_filt, fc, 'high');

for j = 1:J
for i = 1:I
Raw_time_history = squeeze(Raw_Image_Seq(j, i, :));
Raw_time_history = double(Raw_time_history);
Filt_time_history = filtfilt(b, a, Raw_time_history);
Filt_Image_Seq(j, i, :) = Filt_time_history;
end
end
end

You might also like