How to stack colour layers

조회 수: 4 (최근 30일)
Lucius
Lucius 2015년 5월 15일
댓글: Lucius 2015년 5월 20일
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
Lucius
Lucius 2015년 5월 15일
No, there are really 5 figures; the fifth being introduced with line 237. And instead of showing the top left image from the above figure in a perturbed way, I only get a figure with a white subplot(1,3,2) (line 238).
Image Analyst
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 5월 15일
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
Lucius
Lucius 2015년 5월 19일
one last one. In the end, I want to concatenate the corrected layers again to reveal the fully unperturbed galaxy again...to show that the correction process works. I applied the very same commands that you suggested above and the image formats seem to be ok. But the galaxy is only halfway corrected. The layers from line 307 shall be stacked. Line 318f shows the code. Btw, the same galaxy image as posted above.
Lucius
Lucius 2015년 5월 20일
I think we found the solution. The image we read in at the beginning already contains the diffraction and systematic effects of the Hubble telescope; we do not have the true planewave information from the imaged object, but only the CCD image itself (of course, as the planewave cannot be recorded withouth a recording device that introduces its own systematic effects). After propagating it trough our own aperture, we have additional diffraction patterns. We apply our disturbance to it and correct it back. This works perfectly. But it's strange that if introducing a star image, we do not get the overall star image WITH diffraction pattern. The stars are not where they are expected to be compared to the introduced image. But at least the correction algorithm works perfectly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by