Как сравнить 2 изображения, используя функции SIFT в OpenIMAJ?
Я прочитал учебник по OpenIMAJ и получил следующий код из этого учебника. Согласно коду, я получаю центр кластеров для изображения. Но с этого момента я не знаю, как использовать эти значения для сравнения двух изображений. Это код. Я добавил комментарии, как это было в документации, чтобы вы могли получить представление.
public static void main(String[] args) throws IOException
{
final String input_1Str ="/compareimage/clip6.jpg";
MBFImage input = ImageUtilities.readMBF(objectRecognition.class.getResourceAsStream(input_1Str));
input = ColourSpace.convert(input, ColourSpace.CIE_Lab); //apply a colour-space transform to the image
FloatKMeans cluster = FloatKMeans.createExact(2); //construct the K-Means algorithm. The parameter (2) is the number of clusters or classes we wish the algorithm to generate
FloatKMeans.createKDTreeEnsemble(2);
float[][] imageData = input.getPixelVectorNative(new float[input.getWidth() * input.getHeight()][3]); //The FloatKMeans algorithm takes its input as an array of floating point vectors (float[][]). We can flatten the pixels of an image into the required form using the getPixelVectorNative() method
FloatCentroidsResult result = cluster.cluster(imageData);
float[][] centroids = result.centroids; //The K-Means algorithm can then be run to group all the pixels into the requested number of classes
for (float[] fs : centroids) {
System.out.println(Arrays.toString(fs)); //Each class or cluster produced by the K-Means algorithm has an index, starting from 0. Each class is represented by its centroid. Running it prints the (L, a, b) coordinates of each of the classes
}
После запуска приведенного выше кода для изображения я получил следующий результат.
Image 1:
[95.99463, 3.6134863, 2.641686]
[32.080914, 14.114657, -48.14841]
После запуска приведенного выше кода на другом изображении дает мне следующее
Image 2:
[32.11119, 13.966739, -47.994236]
[95.64963, 3.9856236, 2.9136417]
Используя эти значения, как я могу сравнить 2 изображения. У меня нет никаких идей о том, как сравнивать изображения. Пожалуйста, помогите мне. Заранее спасибо.