How to stack colour layers
이전 댓글 표시
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
Star Strider
2015년 5월 15일
It might help to know what you’re doing in this loop:
for ii=1:3
...
end
Lucius
2015년 5월 15일
Stephen23
2015년 5월 15일
Instead of inserting the code as text (which is a difficult to read and hard to try out), please upload the file using the paperclip button. You will need to push both the Choose file and Attach file buttons.
Lucius
2015년 5월 15일
Walter Roberson
2015년 5월 15일
What is the original datatype of Img_x1 ? If it is double, with the values being between 0 and 1, then you need to multiply by 255 before you uint8
Img_R = uint8(255*abs(Img_x2(:,:,1)));
Image Analyst
2015년 5월 15일
There are only 4 figures, not 5. Figure 4 is below. Exactly what is all white?

Lucius
2015년 5월 15일
Image Analyst
2015년 5월 15일
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!