フィルターのクリア

Is it possible to apply a single function to all images of an imageset?

4 ビュー (過去 30 日間)
Pranaya Kansakar
Pranaya Kansakar 2020 年 5 月 2 日
コメント済み: Image Analyst 2020 年 5 月 2 日
Apologies if this is basic stuff - i'm new to matlab.
I have an imageset containing over 100 images, that are all time-dependent images of the same object - ie. the same object was filmed over a time period and i have split up the frames as individual images.
Would it be possible therefore to apply a function (say im2bw) to all of them?
I have a for loop:
z = imageset(uigetdir(*))
uC = *.Count
for i = 1:uC
pic = read(z,i);
bw = im2bw(pic);
end
My understanding is that that the algorithm itirates through the im2bw function for the duration of the length of the imageset. The code does work in that it converts images to bw; however, i am having problems recompiling the imageset at the end of the loop, and thus I get only one single image called bw, as opposed to the desired imageset.
Can you help?
Thanks!!!

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 2 日
Three code samples are shown in the FAQ: FAQ#How_can_I_process_a_sequence_of_files

その他の回答 (2 件)

KSSV
KSSV 2020 年 5 月 2 日
z = imageset(uigetdir(*))
uC = *.Count
bw = cell(Uc,1) ;
for i = 1:uC
pic = read(z,i);
bw{i} = im2bw(pic);
end
YOu can access bw by bw{1}, bw{2}, .....bw{n}.
If you know size in prior, you can save them into 3D matrix also.

Pranaya Kansakar
Pranaya Kansakar 2020 年 5 月 2 日
編集済み: Pranaya Kansakar 2020 年 5 月 2 日
Thanks for your replies!
It appears that i have created a "1280x1920 logical" at the end of the loop instead of a "1x1 imageSet".
It is my intention to get an imageset identical to the original imageset save the functions that i have carried out onto the new one - e.g. i want the new imageset to be a bw copy of the original imageset.
Is this the right approach to manipulate all images in a dataset by the same function?
  1 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 2 日
Use imwrite() to write out the new bw image to the folder where you want them to live.

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

Community Treasure Hunt

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

Start Hunting!

Translated by