How to stack colour layers
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an initial picture and make some calculations with the individual colour layers in a for-loop going through the 3 layers. In the end I want to stack them again to get the coloured version. Instead, I reveice nothing meaningful. What is wrong in the syntax?
for ii=1:3
...
end
Img_R = uint8(abs(Img_x2(:,:,1)));
Img_G = uint8(abs(Img_x2(:,:,2)));
Img_B = uint8(abs(Img_x2(:,:,3)));
pertImgRGB = cat(3,Img_R,Img_G,Img_B);
figure(5);
subplot(1,3,2);
imagesc(x, y, pertImgRGB);
axis square;
set(gca,'YDir','normal')
9 commentaires
Image Analyst
le 15 Mai 2015
Oh, you're right. For some weird reason figure 5 popped "up" exactly underneath figure #1 which totally hid/blocked figure #5. I'll look at it again.
Réponse acceptée
Image Analyst
le 15 Mai 2015
Before you go to uint8, the range of your data is:
minValue =
0.0169157443510078
maxValue =
145341.029916172
Replace your code with this:
% Display what the max and min are, just for fun.
minValue = min(abs(Img_x2(:)))
maxValue = max(abs(Img_x2(:)))
% Scale to 0-255
Img_x2 = 255 * mat2gray(abs(Img_x2));
Img_R = uint8((Img_x2(:,:,1)));
Img_G = uint8((Img_x2(:,:,2)));
Img_B = uint8((Img_x2(:,:,3)));
pertImgRGB = cat(3,Img_R,Img_G,Img_B);
5 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements 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!
