MATLAB: Read three different RGB band and Swap the Band

Image Processing Toolboxthank you

Thanks

Best Answer

Try this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now swap around in any way you want.
newRedChannel = greenChannel;
newGreenChannel = blueChannel;
newBlueChannel = redChannel;
% Recombine separate color channels into a single, true color RGB image.
NewRgbImage = cat(3, newRedChannel, newGreenChannel, newBlueChannel);