Extract data from an grayscale image
显示 更早的评论
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 个评论
Walter Roberson
2025-11-5
Two ways to read mraw are mentioned at https://www.mathworks.com/matlabcentral/answers/582314-phantom-cine-format-and-photron-mraw#answer_893440
solleti prabhakarchary
2025-11-5
Mathieu NOE
2025-11-5
hello @solleti prabhakarchary
can you share one frame (as mat file for example)
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)))
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Category Classification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
