フィルターのクリア

Read All Images in Directory

7 ビュー (過去 30 日間)
Abed Nego Lubis
Abed Nego Lubis 2018 年 4 月 24 日
編集済み: Ameer Hamza 2018 年 4 月 24 日
Hello, i want to check noise level in image. The original code is only read 1 file and check the noise level of the image. Assume that i have more than one images and i want to execute all in one time. How to read all the image? I have tried this but it show the error below.
imagefiles = dir('Test\*.jpg');
nfiles = length(imagefiles); % Number of files found
for ii = 1 : nfiles
% diary('output2.txt');
% diary on;
currentfilename = imagefiles(ii).name;
currentimage = imread(currentfilename);
images{ii} = currentimage;
img = double(imread(currentfilename));
nlevel = NoiseLevel(img);
fprintf('noise level: %f \n\n', nlevel);
end
% diary off;
The error is shown like below :
Thank you...
  1 件のコメント
Matt Macaulay
Matt Macaulay 2018 年 4 月 24 日

The only thing that looks off is that a file named 'IMG_3700.JPG' is returned from a search from

   dir('Test\*.jpg').

'Test' is not in the filename of 'IMG_3700.JPG'. Clear the workspace?

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

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 24 日
編集済み: Ameer Hamza 2018 年 4 月 24 日
The mistakes lies in currentimage = imread(currentfilename);. Here currentfilename just contain file name IMG_3700.JPG, not the complete path Test\IMG_3700.JPG. You need to specify the complete path as
currentimage = imread(['Test\' currentfilename]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by