Reputation: 8310
I'm implementing the particle filter algorithm in order to track a moving object in a video sequence (each frame is a color image). This algorithm iterates over the frames of the video, and at each iteration, it compares the tracked object (ie the sub-image containing the tracked object in the previous frame) with N different portions of the current frame (that is, the sub-images that might contain the object).
The size of the tracked object may change over time, and the value assigned to N may be high (100, or a few hundred), then the issues to be addressed are the following.
I believe that the only way to meet the third constraint consists in choosing the maximum size of the subimages to compare: this means that any larger subimages must be resized. What do you think about that?
What method of comparison could I use?
Upvotes: 2
Views: 804
Reputation: 41
I guess you could try comparing images using the mean square error method, it's commonly used to estimate how similar two images are.
function [ mse ] = MSE( X, Y )
%MSE
[x,y] = size(X);
mse = 0;
for i=1:x
for j=1:y
mse = double(mse) + double(power((X(i,j)-Y(i,j)),2));
end
end
mse = mse / (x*y);
end
Upvotes: 4