💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
用于在单个帧(段)上进行特征提取。这个过程涉及从特定的帧或片段中分析并提取特定的特征或属性。它可以应用于各种领域,如图像处理、视频分析或信号处理。通过从单个帧中提取特征,可以深入了解该特定时刻或片段的内容或特性。这有助于完成诸如对象识别、模式检测或分类等任务。提取的特征可以用于进一步处理或作为机器学习算法的输入以执行更复杂的任务。
📚2 运行结果
主函数部分代码:
clear, clc, close all
%% get a section of the sound file
[x, fs] = audioread('DR2_MJAR0_SI2247.wav'); % load an audio file
x = x(:, 1); % get the first channel
x = x/max(abs(x)); % normalize the signal
N = length(x); % signal length
t = (0:N-1)/fs; % time vector
%% signal framing
frlen = round(20e-3*fs); % frame length
hop = round(frlen/2); % hop size
[FRM, tfrm] = framing(x, frlen, hop, fs); % signal framing
%% determine the Short-time energy
STE = sum(FRM.^2);
%% determine the Short-time zero-crossing rate
STZCR = sum(abs(diff(FRM > 0)))/size(FRM, 1);
%% plot the results
% plot the signal waveform
figure(1)
subplot(3, 1, 1)
plot(t, x)
grid on
xlim([0 max(t)])
ylim([-1.1*max(abs(x)) 1.1*max(abs(x))])
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('Amplitude')
title('The signal in the time domain')
% plot the STE
subplot(3, 1, 2)
plot(tfrm, STE)
grid on
xlim([0 max(tfrm)])
ylim([0 1.1*max(STE)])
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('Energy')
title('Short-time Energy')
% plot the STZCR
subplot(3, 1, 3)
plot(tfrm, STZCR)
grid on
xlim([0 max(tfrm)])
ylim([0 1.1*max(STZCR)])
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('ZCR')
title('Short-time ZCR')
%% mark the signal
% Note: (i) the activity flag is rised when there is high energy frame
% in the signal stream; (ii) the consonant flag is rised when there are
% high ZCR activity and high energy in the signal stream.
AF = STE > 0.1*median(STE);
CF = AF & STZCR>2*median(STZCR);
subplot(3, 1, 1)
hold on
plot(tfrm, AF, 'r', 'LineWidth', 1.5)
plot(tfrm, CF, 'g', 'LineWidth', 1.5)
legend('signal', 'activity flag', 'consonant flag', ...
'Location', 'southeast')
🎉3 参考文献
文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。
[1]李艳,林晓明,赵宇明,等.基于改进mSDFT算法的谐波信号提取方法[J/OL].计量学报,2024,(10):1435-1443[2024-10-18].http://kns.cnki.net/kcms/detail/11.1864.TB.20241016.1019.016.html.
[2]曾海坤,朱瑞虎,王启明,等.基于形态学的极值提取在海工信号处理中的应用[J/OL].船舶工程,1-7[2024-10-18].http://kns.cnki.net/kcms/detail/31.1281.U.20241008.0918.002.html.