Using "imread" to process multiple images

7 views (last 30 days)
Hi guys,
I plan to develop a code to process a series of combustion images from a GDI engine captured by a high speed camera.
I have written a code to process multiple images but it seems that the matlab only presents the last data of "for" loop even though the code succesfully loaded all the images in an array form.
Each cycle consists of 400 frames and there are 10 cycles to be analysed. However, I always omit the first frame as the image is blurred. Therefore, I tried to process the following frames for each cycel: 2~400, 402~800, 802~1200 etc. until 3602~4000. Nevertheless, I found out that the array size increases as I increased the number of 'n' for the "for" loop e.g. If I do for n=402:800, the arry size becomes 800 and it shows 401 blank cells within the array.
Is there any clever way to process the data? I would like to plot a 2d-line (continuous) curve for each data set (399 frames per cycle).
Your help is greatly appreciated.
Many Thanks!

Accepted Answer

Geoff Hayes
Geoff Hayes on 4 Apr 2022
@Dongsu Kim - from your code
for n=2:400 %Load image file
images{n} = imread(sprintf('C1S0076%08d.tif',n));
end
Im1 = mat2gray(images{n}, [0 255]); %Convert matrix to grayscale image
% etec.
Note how the loop reads in each image, but the first line outside of the loop only considers the last image. You would need to include that line (and all that which follows) within the loop so that the code gets processed for each image (though you may not want to create a figure for each image...).
  1 Comment
Dongsu Kim
Dongsu Kim on 5 Apr 2022
Hi Geoff Hayes,
Many thanks for the comments.
Indeed, as you pointed out, I reliased the issue after posting the question (same goes for the figure problem).
I have modified the code and it pretty much works now as I want it to be.
Anyway, thank you very much for your advice.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!