如何將圖像存儲到使用uigetfile()
命令檢索的變量(如I
)? 例如, 我通過使用uigetfile的輸出讀取圖像
[FileName PathName] = uigetfile('E:\*.jpg','Select an image');
現在我想選擇的圖像存儲在變量I
如何將圖像存儲到使用uigetfile()
命令檢索的變量(如I
)? 例如, 我通過使用uigetfile的輸出讀取圖像
[FileName PathName] = uigetfile('E:\*.jpg','Select an image');
現在我想選擇的圖像存儲在變量I
下面的代碼會爲你工作: -
[FileName,PathName] = uigetfile('*.jpg','Select an image');
image=imread(strcat(PathName,FileName));
使用命令imread
if ~isequal(FileName,0)
I = imread(fullfile(PathName,FileName));
end
的isequal
是測試選擇的圖像爲用戶取消點擊。
我有以下錯誤 ???對於 類型爲「char」的輸入參數,未定義的函數或方法「等於」。 – meena 2012-02-03 08:05:07
@meena - 修正了 – 2012-02-03 09:07:35
THANKS DAVID ... IT WORKED .. :) – meena 2012-02-03 19:52:59