MATLAB CODE to take 2 jpgs and determine the scale invariant (SURF algorithm used) absolute difference (like xor )
tic;
[FileName_f, PathName_f] = uigetfile('*.jpg','Select the fixed image');
fixed = imread([PathName_f, FileName_f]);
[FileName_m, PathName_m] = uigetfile('*.jpg', 'Select the moving image');
moving = imread([PathName_m, FileName_m]);
out_path = uigetdir;
convert jpg to gray scale
fixed_g = rgb2gray(fixed);
moving_g = rgb2gray(moving);
movingAdjusted=imadjust(moving_g);
fixedAdjusted=imadjust(fixed_g);
perform scale invariant feature transform via faster SURF vs. older SIFT
ptsFixed=detectSURFFeatures(fixedAdjusted);
ptsMoving=detectSURFFeatures(movingAdjusted);
[featuresFixed,validPtsFixed]=extractFeatures(fixedAdjusted,ptsFixed);
[featuresMoving,validPtsMoving]=extractFeatures
indexPairs = matchFeatures(featuresFixed,featuresMoving);
matchedFixed=validPtsFixed(indexPairs(:,1));
matchedMoving=validPtsMoving(indexPairs(:,2));
Get estimates geometric transform
[tform,inlierMoving,inlierFixed]=estimateGeometricTransform(...
matchedMoving,matchedFixed,'affine');
Tinv=tform.invert.T;
ss=Tinv(2,1);
sc=Tinv(1,1);
recover scale and rotation angle
scaleRecovered=sqrt(ss*ss + sc*sc);
thetaRecovered=atan2(ss,sc)*180/pi;
movingRegistered=imwarp(moving,tform,'OutputView',imref2d(size(fixed)));
perform absolute difference matrix calculation - NoN GPU version
diff = imabsdiff(fixed, movingRegistered);
imshow(diff)
cd(out_path);
output file = difference.jpg
imwrite(diff, 'difference.jpg', 'jpg');
timeSpent=toc;
clc;
Speeded up robust features - Wikipedia, the free encyclopedia
https://en.wikipedia.org/wiki/Speeded_up_robust_features
Wikipedia
In computer vision, Speeded Up Robust Features (SURF) is a local feature detector and descriptor that can be used for tasks such as object recognition or registration or classification or 3D reconstruction. It is partly inspired by the scale-invariant feature transform (SIFT) descriptor.
Example – WebCamera –possible applications: Motion detection, Earthquake monitoring (or Camera vibration) Intruder detection, alarm function Steganography*, finding hidden messages in original source vs. modified version)
-MATLAB change detection, using general or WebCamera pictures - here is Scale Invariant difference of two similar pictures
File : difference.m (for MatLab) is complex code and Sqrt, Arctangent in SURF algorithms to do jpg to rgb absolute differences – this would not be fast on GR-PEACH. SURF is used as its 3-5x faster than SIFT.