MATLAB: How to make red-free light image

image processingImage Processing Toolboxred-free

hello, can you help make this image red-free light. thx
% Read in original RGB image.
rgbImage = imread('test.png');
% Extract color channels.
redChannel = rgbImage(:,:,1); % Red channel
greenChannel = rgbImage(:,:,2); % Green channel
blueChannel = rgbImage(:,:,3); % Blue channel
% Create an all black channel.
allBlack = zeros(size(rgbImage, 1), size(rgbImage, 2), 'uint8');
% Create color versions of the individual color channels.
just_red = cat(3, greenChannel, allBlack, allBlack);
just_green = cat(3, allBlack, greenChannel, allBlack);
just_blue = cat(3, allBlack, allBlack, blueChannel);
% Recombine the individual color channels to create the original RGB image again.
recombinedRGBImage = cat(3, allBlack, greenChannel, blueChannel);
%Extract red-free Green Channel
redFree= recombinedRGBImage(:,:,2);

Best Answer

Your recombinedRGBImage variable appears to be the result you are looking for.