Binary Image Subtraction
5 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 9 Feb 2012
The most obvious possibility would seem to be that you are not subtracting in the order that you think you are.
Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!