how to remove this error please some one help me

Error using imread (line 349)
File "face_original" does not exist.
Error in face_detection (line 9)
face_original = imread('face_original');
This is the code:
face_original = imread('face_original');
size_img = size(face_original);
r = 1; g = 2; b = 3;
y = 1; u = 2; v = 3;

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 15 日

0 投票

Are you certain that the file name is not face_original.jpg ?

1 件のコメント

Image Analyst
Image Analyst 2015 年 8 月 15 日
I hope not. I hope it would be face_original.png. Using lossy compressed images is not good for image analysis, though I realize people do it all the time. Regardless, adding the extension and using exist() before calling imread() makes for more robust code.
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end

この質問は閉じられています。

タグ

タグが未入力です。

質問済み:

2015 年 8 月 15 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by