Effacer les filtres
Effacer les filtres

Color Imaging - RGB Channels

9 vues (au cours des 30 derniers jours)
Rahul Mishra
Rahul Mishra le 5 Juin 2020
Commenté : DGM le 1 Jan 2024
Divide the given image in 3 parts(RGB) and stack them together to get a color image
please help me what to edit in code...
%Read the image
img = imread('image.jpg');
%Get the size (rows and columns) of the image
[r,c] = size(img);
rr=r/3;
%Wrire code to split the image into three equal parts and store them in B, G, R channels
B=imcrop(img,[1,1,c,rr]);
G=imcrop(img,[1,1*rr,c,rr]);
R=imcrop(img,[1,2*rr,c,rr]);
%concatenate R,G,B channels and assign the RGB image to ColorImg variable
ColorImg(:,:,1) = R;
ColorImg(:,:,2) = G;
ColorImg(:,:,3) = B;
imshow(ColorImg)
  3 commentaires
Image Analyst
Image Analyst le 9 Août 2020
Modifié(e) : Image Analyst le 1 Avr 2021
DGM
DGM le 1 Jan 2024

Connectez-vous pour commenter.

Réponses (2)

shyam chauhan
shyam chauhan le 18 Juil 2020
This code is absolutely fine for the task already, if you have the "image processing toolbox" installed in your account. Imcrop is the advanced feature that of matlab that needs to be bought to use it.
If you have not installed that toolbox, change your program to split the image into three equal parts replacing the command for B, G, R.

Chit La Pyae Myo Hein
Chit La Pyae Myo Hein le 23 Sep 2020
Modifié(e) : DGM le 12 Nov 2022

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by