Borrar filtros
Borrar filtros

How can I process the video and analyze it in the time and frequency domain?

2 visualizaciones (últimos 30 días)
I am studying an exercise using infrared video thermography. i need to know the temperature of the calcaneus tendon over the course of an exercise. I need the average temperature values frame by frame and I would also like to know the PSD in the frequency spectrum.

Respuestas (1)

Milan Bansal
Milan Bansal el 28 de Dic. de 2023
Hi Jose,
I understand that you want to know how to analyze infrared video thermography data of the calcaneus tendon to obtain temperature information over time and its power spectral density (PSD) in the frequency domain.
Please refer to the following steps to get the temperature information for each frame in the video.
  • Read the video file using "VideoReader function.
  • Initialize an array to store average temperature values for each frame.
  • Loop through each frame using "readFrame" function.
  • For each frame, convert the pixel values to temperature values using the calibration data.
  • Calculate the average temperature of the region of interest (ROI) which is the calcaneus tendon and store it in the array.
Please refer to the following steps to get the power spectral density (PSD).
  • Use the average temperature values array obtained and stored in the previous steps for each frame.
  • Compute the Fast Fourier Transform (FFT) using "fft"`function.
  • Calculate the frequency vector using the sampling rate (frame rate of the video).
  • Obtain the power spectral density (PSD) using the squared magnitude of the FFT result divided by size of array.
  • Plot and visualize the frequency spectrum and identify significant frequencies.
Please refer to the pseudo code below:
videoFile = 'videoPath.avi';
% VideoReader object
v = VideoReader(videoFile);
avgTemp = zeros(1, numFrames); % Array for average temperature values
% Loop over each frame
idx = 1;
while hasFrame(v)
frame = readFrame(v); % Read frame
tempData = convertToTemperature(frame); % Placeholder for conversion function
% Define the ROI for the calcaneus tendon and temp data
roi = tempData(roi_y:(roi_y+roi_height), roi_x:(roi_x+roi_width));
% Calculate the average temperature in the ROI
avgTemp(idx) = mean(roi);
idx = idx + 1;
end
Fs = FrameRate; % frame rate of the video
L = length(avgTemp); % Length of the signal
FFT = fft(avgTemp); % Compute the FFT
f = Fs*(0:L)/L;
% Calculate the PSD
PSD = (1/(Fs*L)) * abs(FFT(1:L)).^2;
% Plotting the Power Spectral Density (PSD)
plot(f, PSD);
Please refer to the documentation below to learn more about "VideoReader" function.
Please refer to the documentation below to learn more about "readFrame" function.
Please refer to the documentation below to learn more about ''fft" function.
Hope it helps!

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by