euclidean algorithm for image comparison

i am going to develop an application for image comparison on java. For this i have choosen euclidean algorithm. This application involves with 2 images. 1. Actual image 2. Part of the actual image.

Algorithm should compare the part of the image with actual image. If the part is existed in actual image, it should return one value as matching success.

Can anyone give me the algorithmic steps? code on java will be appreciated..!

Answers


Here is a relatively simple idea, with some parts left out intentionally, since the question smells like homework.

public static boolean contains(Image large, Image small) {
  final int largeWidth = large.getWidth(), largeHeight = large.getHeight();
  final int smallWidth = small.getWidth(), smallHeight = small.getHeight();

  if (smallWidth > largeWidth || smallHeight > largeHeight) {
    return false;
  }

  for (int x = 0; x < largeWidth - smallWidth; x++) {
    for (int y = 0; y < largeHeight - smallHeight; y++) {
      if (subImageEquals(large, x, y, small)) {
        return true;
      }
    }
  }
  return false;
}

private static boolean subImageEquals(Image large, int x, int y, Image small) {
  // TODO: checks whether all pixels starting at (x, y) match
  // those of the small image.
}

Need Your Help

UIImageView Memory Problem

iphone objective-c memory uiimageview

I have a UIImageView property in my view controller set to "assign". Every time I hit a button, I set the image in the view to something new. Due to the way I am using another component, I have to

shooting intervals in cocos2d without CACurrentMediaTime()

cocos2d-iphone

I have a ship and I want to make it to shoot every 1 sec. So here's what I did,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.