How can I convert my image to a red image
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
DGM
on 13 Dec 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!