How can I convert my image to a red image

1 次查看(过去 30 天)
this is my code:
function redImage(app, event)
a=getappdata(0,'a');
red=a;
red(:,:,2:3)=0;
setappdata(0,'filename',red);
imshow(red,'Parent',app.UIAxes2);
end

采纳的回答

DGM
DGM 2022-12-13
That would work if you wanted a red image. It would even work if your input image were single-channel.
inpict = imread('cameraman.tif'); % MxNx1
inpict(:,:,2:3) = 0; % create red image by implicit expansion
imshow(inpict)
... but it wouldn't work if you wanted to do a green or blue image using the same method.
inpict(:,:,[1 3]) = 0; % create green image the same way?
imshow(inpict) % it's black because we just zeroed channel 1
See this thread:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by