Binary Image Subtraction

5 ビュー (過去 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 Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by