version 1.2
This commit is contained in:
parent
7cc36a8154
commit
fcb5fe7803
|
|
@ -1,3 +1,11 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Region of Interest
|
||||
%
|
||||
% Author:LY Pechvattana, MINH Meng Hour
|
||||
% Date: 19/02/2023
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
I = imread('image1.png');
|
||||
imshow(I)
|
||||
im = drawrectangle()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Heart Rate Estimation
|
||||
%
|
||||
% Author:LY Pechvattana, MINH Meng Hour
|
||||
% Date: 19/02/2023
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%set variable
|
||||
fps = 15;
|
||||
windowDuration = 30;
|
||||
|
|
@ -39,36 +47,25 @@ greenChannel_std = std(greenChannel);
|
|||
|
||||
%normalization
|
||||
for i = 1:450
|
||||
greenChannel_normal(i) = (greenChannel(i)-greenChannel_avg);
|
||||
greenChannel_normal(i) = (greenChannel(i)-greenChannel_avg)/greenChannel_std;
|
||||
end
|
||||
|
||||
%Fast Fourier transform (fft) of Green Channel
|
||||
greenChannel_fft = fft(greenChannel_normal);
|
||||
|
||||
|
||||
%power spectrum P1
|
||||
%power spectrum
|
||||
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: 32 KiB After Width: | Height: | Size: 34 KiB |
Loading…
Reference in New Issue