フィルターのクリア

what is repmat() doing in the following code?

3 ビュー (過去 30 日間)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 10 月 1 日
回答済み: Jan 2017 年 10 月 1 日
function handles = Open_Image(hObject, eventdata, handles, type, axesIm)
% if the file-name and path-name are not epty.
if not(isequal(handles.file, 0)) && not(isequal(handles.path,0))
% the current axes should be set to handles.axes
axes(handles.axes);
% Extract image and colormap from file path
[handles.img, handles.map] = imread([handles.path handles.file]);
% Viewing the image
[n,m,l] = size(handles.img);
% with bidimensional images, image does not work properly
if (l == 1)
image (repmat(uint8(handles.img),[1 1 3]));
else
image(handles.img);
end
axis equal; % sets the aspect ratio. (Show the image in its right ratio)
axis tight; % Sets the axis limits to the arrange of the data.
axis off; % Turn off all axis labeling
guidata(hObject, handles);
end

採用された回答

Jan
Jan 2017 年 10 月 1 日
repmat does exactly, what is explained in the documentation. See doc repmat:
The contents of the array handles.img is repeated 3 times along the 3rd dimension. This will create an RGB image in grey color from the matrix in handles.img.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by