how to solve imread() issues?

11 ビュー (過去 30 日間)
benjamin123
benjamin123 2017 年 9 月 24 日
コメント済み: Walter Roberson 2017 年 9 月 24 日

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 9 月 24 日
That is not an imread() issue. That is imshow() telling you that somehow you have deleted the figure you were attempting to display into.
If your code has any "close all" calls in it, then remove those calls.
  2 件のコメント
Image Analyst
Image Analyst 2017 年 9 月 24 日
imshow() does not require any figure or axes to be existing in advance. It will create them if there are none:
close all force; % Close down all existing figures.
image2 = imread('moon.tif');
% imshow will automatically create a figure,
% with an axes on it, and display image2 in the axes.
imshow(image2, []);
Walter Roberson
Walter Roberson 2017 年 9 月 24 日
However if the user closes the figure between the time it is created and the time everything is set up properly then you could get this message.

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


Image Analyst
Image Analyst 2017 年 9 月 24 日
You may have overwritten imshow() with your own version, though it's doubtful.
imshow() will create a figure and axes if it needs to.
Even if you had deleted image2, you would have gotten a different error:
delete image2;
imshow(image2, []);
Warning: File 'image2' not found.
> In test (line 2)
or
clear('image2');
imshow(image2, []);
Undefined function or variable 'image2'.
Error in test (line 2)
imshow(image2, []);
Please attach Q1.m, or at least the first 29 lines of it, so we can see what's wrong.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by