Using "imread" to process multiple images

7 ビュー (過去 30 日間)
Dongsu Kim
Dongsu Kim 2022 年 3 月 31 日
コメント済み: Dongsu Kim 2022 年 4 月 5 日
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!

採用された回答

Geoff Hayes
Geoff Hayes 2022 年 4 月 4 日
@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 件のコメント
Dongsu Kim
Dongsu Kim 2022 年 4 月 5 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by