Compare commits

..

No commits in common. "master" and "feature" have entirely different histories.

4 changed files with 13 additions and 18 deletions

View File

@ -1,11 +1,3 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Region of Interest
%
% Author:LY Pechvattana, MINH Meng Hour
% Date: 19/02/2023
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I = imread('image1.png');
imshow(I)
im = drawrectangle()

View File

@ -1,11 +1,3 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Heart Rate Estimation
%
% Author:LY Pechvattana, MINH Meng Hour
% Date: 19/02/2023
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set variable
fps = 15;
windowDuration = 30;
@ -47,25 +39,36 @@ greenChannel_std = std(greenChannel);
%normalization
for i = 1:450
greenChannel_normal(i) = (greenChannel(i)-greenChannel_avg)/greenChannel_std;
greenChannel_normal(i) = (greenChannel(i)-greenChannel_avg);
end
%Fast Fourier transform (fft) of Green Channel
greenChannel_fft = fft(greenChannel_normal);
%power spectrum
%power spectrum P1
L = length(greenChannel_normal);
P2 = abs(greenChannel_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1)=2*P1(2:end-1);
f = 15*(0:(L/2))/L;
P1 = fftshift(P1);
plot(f,P1);
title("Power Spectrum")
xlabel("frequency (Hz)")
ylabel("Power Spectrum")
%peak - compute the freq vector
[m n]=size(P1);
x = 1:n;
y= 1:m;
[X Y]=meshgrid(x, y);
X = X - floor(n/2)-1;
Y = Y - floor(m/2)-1;
f = sqrt(X.^2 + Y.^2);
%peak - find the peak in range
indices = (f>=0.75)&(f<=4);
[peaks locations] = findpeaks(P1(indices), 'SortStr','descend');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 32 KiB