MATLAB: concatenition of 2 images in a frame: resulting images of 2 parts of code seem to be overwriting each other
Show older comments
%......section (e)
C1 = imread(InputImage);
NumberOfLevels = 2;
n = 32;
C1q1=uint8(rgb2ind(C1,n)*(NumberOfLevels-1));
imshow(C1q1,[]);
NumberOfLevels=4;
n = 32;
C1q2=uint8(rgb2ind(C1,n)*(NumberOfLevels-1));
imshow(C1q2,[]);
no8=figure;
C1img = [C1q1;C1q2];
image(C1img);
%........end of section (e)
%....section (f)
C1 = imread(InputImage);
C1 = double(C1);
NumberOfGrayLevels=32;
I= 0.299*C1(:,:,1)+0.587*C1(:,:,2)+0.114*C1(:,:,3);
C = 1;
I=(C*log(I+1))';
new=uint8(mat2gray(I)*(NumberOfGrayLevels-1));
[m,n]= size(new);
rgb = zeros(m,n,3);
rgb(:,:,1) = new;
rgb(:,:,2) = rgb(:,:,1);
rgb(:,:,3) = rgb(:,:,2);
new = rgb/256;
imshow(new,[]);
no9=figure;
image(new);
%...........end of section (f)
when i put a break command before %.....section(f) (i.e. when i execute only section (e)) then i can see concatenated image for C1q1 and C1q2 in a single frame as it should be. but when i remove the break command (i.e.) when i execute both section(e) and section (f) then i can see that result of section (f) is overwriting result in section (e). instead of seeing C1q1 and C1q2 in a frame, i see figure (new) in both frames. i cannot see C1q1 and C1q2 anymore. can you tell me why is this happening and how to overcome this?
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!