필터 지우기
필터 지우기

Binary Image Subtraction

조회 수: 3 (최근 30일)
Colm
Colm 2012년 2월 9일
I am subtracting one binary image away from another image. But the results seem to be the inverted answer. Bascially in hex 17D8 - 0A5A = D7E but the answer Matlab writes out is FFFFFFFFFFFFF282
This is the same decimal answer except it is negative instead of positive, so: 3454 = D7E & -3454 = FFFFFFFFFFFFF282
Is there some sort of overload? and how do I overcome this problem? As it affects any other image processing I need to preform.
[FileName, PathName] = uigetfile({'*.jpg;*.tif;*.png;*.gif;*.bin','All Image Files';...
'*.*','All Files' },'mytitle');
Full = fullfile(PathName, FileName)
fid = fopen(Full);
samevals = fread(fid, [2048, 2048], 'uint16');
fclose(fid);%load binary
X = samevals;
[FileName2, PathName2] = uigetfile({'*.jpg;*.tif;*.png;*.gif;*.bin','All Image Files';...
'*.*','All Files' },'mytitle');
Full = fullfile(PathName2, FileName2)
fid2 = fopen(Full);
new = fread(fid2, [2048, 2048], 'uint16');
fclose(fid2);%load binary
frametempt=double(X) - double(new);
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 2월 9일
The most obvious possibility would seem to be that you are not subtracting in the order that you think you are.
Colm
Colm 2012년 2월 10일
I am subtracting in the right order, because I have tried it in the other (wrong) order. At the minute I am getting the right numbers but matlab seems to be putting a negative sign in hex in front of some values.
I'm taking an offset from an image with offset and signal so I should just have signal left, that's how I know what order to subtract in. Thanks though.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by