enzom83
enzom83

Reputation: 8310

What could be a good comparison method to compare images in a fast and reliable way?

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.

  1. Find a fast method to compare two portions of the image, since it will be performed N times for each iteration.
  2. The comparison method should be also reliable (that is, among the N possible subimages, it should choose the one that most resembles the sub-image containing the tracked object in the previous frame).
  3. Finally, the comparison operation must respect a real time constraint: the time required to perform the comparison must be constant, or it must have a known upper bound.

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

Answers (1)

Vladimir Parka
Vladimir Parka

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

Related Questions