How to read in several 16-bit images and store their filenames?

3 ビュー (過去 30 日間)
Happy PhD
Happy PhD 2022 年 5 月 12 日
回答済み: Happy PhD 2022 年 5 月 13 日
I have a set of images in a folder that is16-bit and I want to load them into matlab, maybe into an array, to do some calculations with them. The images should be mono (gray). Their filename have a number, for example "145p56". How do I read in their respective filenames associaited with the images.
Many thanks!

採用された回答

Happy PhD
Happy PhD 2022 年 5 月 13 日

その他の回答 (1 件)

Tala
Tala 2022 年 5 月 12 日
編集済み: Tala 2022 年 5 月 12 日
Depending on how your filenames, you can alter this code. The current code assumes your images are 145p56, 145p57, 145p58...
for i=56:n % number of your images
FileName=strcat('145p',num2str(i),'.png'); % or tif or any other format you have
I0=imread(FileName);
I1=% process your image here
imwrite(I1,['processed',int2str(i), '.png']);% or tif or any other format you want
end
  1 件のコメント
Happy PhD
Happy PhD 2022 年 5 月 13 日
編集済み: Happy PhD 2022 年 5 月 13 日
Thanks, but this requires the first numbers to start with "145p", which is not always given.

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by