Weird imshow image. same pixel value different color
Ältere Kommentare anzeigen
Hi,
I have some problem in displaying images with the following code. The output image should be image of Image A overlap image B. However the image become totally white after combine. When i use Imtool to check on the pixel value on A and C, i notice same pixel value shows different color.
Any1 knows what when wrong?
clc
% A = reshape(1:15,3,5)
% B = reshape(1:35,5,7)+12
A = imread('cameraman.tif');
B = imread('cameraman.tif');
% NA = 8; % The number to overlap in A.
% NB = 32; % The number to overlap in B.
[mA,nA] = size(A);
[mB,nB] = size(B);
% [IA,JA] = find(A==NA);
% [IB,JB] = find(B==NB);
IA=50;
JA=50;
IB=1;
JB=1;
mC = mA+mB+mod(mA+mB,2)+1;
nC = nA+nB+mod(nA+nB,2)+1;
C = zeros(mC,nC);
cC = round([mC/2,nC/2]);
C(cC(1)-IB+1:cC(1)-IB+mB,cC(2)-JB+1:cC(2)-JB+nB) = B;
C(cC(1)-IA+1:cC(1)-IA+mA,cC(2)-JA+1:cC(2)-JA+nA) = A;
C = C(:,any(logical(C)));
C = C(any(logical(C),2),:);
imshow(C)
1 Kommentar
Jan
am 26 Jun. 2011
The question is not clear to me. Why do you think that something went wrong?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Explore and Edit Images with Image Viewer App finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!