Using "imread" to process multiple images

조회 수: 12 (최근 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));
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 CenterFile Exchange에서 Display and Exploration에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by