Effacer les filtres
Effacer les filtres

Stitching three channels of an image

1 vue (au cours des 30 derniers jours)
Sneha
Sneha le 12 Déc 2017
Réponse apportée : Rik le 12 Déc 2017
i need to stitch the three components red blue and green of an rgb image P to form a gray image PS. At first i separate the three channels as Rp, Gp, and Bp using the code " Rp = image(:,:,1);". Now how can i stitch those three?

Réponse acceptée

Rik
Rik le 12 Déc 2017
In Matlab (and some other languages) this is referred to as concatenation, for which you can use the function cat.
Rp=image(:,:,1);
Gp=image(:,:,2);
Bp=image(:,:,3);
%code that changes Rp, Gp and Bp
%
image2=cat(3,Rp,Gp,Bp);
alternatively:
Rp=image(:,:,1);
Gp=image(:,:,2);
Bp=image(:,:,3);
%code that changes Rp, Gp and Bp
%
image2=image;%create a copy
image2(:,:,1)=Rp;
image2(:,:,2)=Gp;
image2(:,:,3)=Bp;

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by