Open YourDarwin opened 2 years ago
Dear YourDarwin,
I believe that this issue is due to your Matlab version, the new cwt (used in my code) has been introduced in MATLAB 2016b. Hereafter two solutions that should work:
% Compute scales
frqs = scal2frq(1:1000,'morl',1/fps);
k = 1;
for i=1:1000
if (frqs(i)>0.65 && frqs(i)<4)
sc(k) = i;
k = k+1;
end
end
sc = sc(1):0.2:sc(end);
% CWT
cw = cwt(signal, sc, 'morl');
% Compute scales
sc_min = -1;
sc_max = -1;
sc = 0.2:0.01:1000;
MorletFourierFactor = 4*pi/(6+sqrt(2+6^2));
freqs = 1./(sc.*MorletFourierFactor);
for i=1:length(freqs)
if (freqs(i)<0.6 && sc_max==-1)
sc_max = sc(i);
elseif (freqs(i)<4 && sc_min==-1)
sc_min = sc(i);
end
end
sc = [sc_min sc_max];
% CWT
cw = cwtft({signal,1/30}, 'scales',{scales(1) 0.01 ceil((scales(2)-scales(1))/0.01) 'lin'}, 'wavelet', 'morl');
Best regards, Frédéric
Hi again,I change my Matlab Version and it works for your example.But I want to use my own video to run ,I see there need to have a time txt file ,otherwise when I run my video on video model ,it will occur some errors.So I want to know what's meaning of the time txt file,or what can I do to make my own video run successfully in the program?Hope your response ,thank you very much.
This file is not mandatory. If it is not in the source folder, the program will construct it automatically (fixed fps, see lines 31 to 35). You can change the default value (30 fps) to the fps of your camera. Hereafter a modification of this part of the program to 60 fps:
% construct time variable if not already existing (30 fps by default)
else
listing = dir(file);
iPPG_time = 0:1/60:(length(listing)-2)/60 - 1/60;
end
Sincerely,
I know my video is already 30 fps, I run it by video model ,but there are some errors as the picture show
you should check the iPPG_time and iPPG_time30 variables, there may be some inconsistencies in these vectors.
I met the same problem as you. How did you solve it?
when i run it on MATLAB2016a ,it ocurred error in wt = cwt(iPPG_signal30, wavelet_type, 30, 'VoicesPerOctave', 32, 'FrequencyLimits', [0.667 4])(line 173).The error message is 'There can only be one character vector input and that input must be the wavelet name.'By the way,I use your example pictures to run,hope your response ,thank you!