Weird imshow image. same pixel value different color
이전 댓글 표시
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
Jan
2011년 6월 26일
The question is not clear to me. Why do you think that something went wrong?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!