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