Extract data from an grayscale image
47 views (last 30 days)
Show older comments
I need to extract data from a sequence of image frames (extracted from a high-speed schlieren video in .mraw format) to perform Dynamic Mode Decomposition (DMD) and Fast Fourier Transform (FFT) analysis. The goal is to analyze the unsteady shock structures on the object by selecting a Region of Interest (ROI) within the images. Please help me write a MATLAB script that processes these frames, performs DMD and FFT analysis, and extracts the corresponding frequency and amplitude data from the selected ROI.
5 Comments
Chuguang Pan
on 5 Nov 2025 at 13:21
Edited: Chuguang Pan
on 5 Nov 2025 at 13:27
The grayscale image sequency of high-speed video is a 3D tensor with dimention SST(S: space, T-time). The fft function can operate along different dimension.
imgSeqs = rand(64,64,50);
imgFreqs = fft(imgSeqs,[],3);
imagesc(imtile(abs(imgFreqs)))
William Rose
on 8 Nov 2025 at 4:24
If you have extracted the grayscale images from the video file, then you have an array BigX with dimensions N,M,L, where the image size is N-by-M and there are L frames.
Assuming the region of intrerest (ROI) is bounded by u1,v1 at the top left and u2,v2 at bottom right, where 0<u1<u2<=N and 0<v1<v2<=M, then
N=100; M=120; L=50; % raw video size
BigX=rand([N,M,L]);
u1=21; v1=11; u2=75; v2=70; % ROI corners
X=BigX(u1:u2,v1:v2,:); % extract ROI data
fprintf('Raw video: %d,%d,%d rows, columns, frames.\n',size(BigX))
fprintf('ROI video: %d,%d,%d rows, columns, frames.\n',size(X))
You will have to decide what algorithm to use for DMD. The Matlab File Exchange has a number of DMD submissions (here). Read the descriptions, and choose one package to download and investigate. Another DMD package for Matlab which I would consider, if I were doing this project, is here: https://github.com/MColbrook/DMD-Multiverse. The author, Matthew Colbrook, descirbes the package in detail in this article.
You also stated "I need to perform ... FFT analysis to extract frequency vs amplitude and findpeaks." Please be more specific about what Fourier analysis you wish to perform: full 3D, or 2D or 1D. If 2D or 1D, then along what dimensions? Explain what you want to do with findpeaks(). findpeaks() operates on vectors (1D data), not arrays. There is a user-submitted function peaks2() in the File Exchange that operates on 2D arrays. Perhaps it is useful to you.
Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!