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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!