How to convert image on a matrix

3 ビュー (過去 30 日間)
Claudia Santos
Claudia Santos 2016 年 1 月 19 日
コメント済み: Naufal Abdillah 2020 年 4 月 20 日
Hello! Im trying to convert an image in a matrix using matlab. however when i put the command: A = imread('image112.jpg'), the only answer I get is: «Error using imread (line 349) File "teddy.jpg" does not exist.»
What am I doing wrong? Ihe image is save on the destktop...
  2 件のコメント
Claudia Santos
Claudia Santos 2016 年 1 月 19 日
Not teddy sorry, but image112
Naufal Abdillah
Naufal Abdillah 2020 年 4 月 20 日
You need to add the image to your matlab path

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

採用された回答

Stephen23
Stephen23 2016 年 1 月 19 日
編集済み: Stephen23 2016 年 1 月 19 日
Like most programs MATLAB does not look everywhere on your computer for files, only in specific locations. This means that the command you are using
A = imread('image112.jpg'),
does not look for files on your desktop. It looks for files in the current directory, followed by all of the directories on the MATLAB search path. If the file is not in those locations, then MATLAB will not find it.
To resolve this you can either:
  • use an absolute or relative path, e.g. "C:\users\yourName\my folder\filename.jpg'. This can be any location, it does not have to be on your MATLAB path.
  • move the file to your current directory, or another directory on your MATLAB search path.
This is explained quite clearly in the documentation:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by