Skip to content

Instantly share code, notes, and snippets.

@benkasminbullock
Created February 18, 2016 00:52
Show Gist options
  • Save benkasminbullock/42a6ac50470ed3bf2fe3 to your computer and use it in GitHub Desktop.
Save benkasminbullock/42a6ac50470ed3bf2fe3 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include "puzzle.h"
int main()
{
PuzzleContext context;
PuzzleCvec cvec;
PuzzleCvec cvec2;
double d;
int status;
puzzle_init_context(&context);
puzzle_init_cvec(&context, &cvec);
status = puzzle_fill_cvec_from_file(&context, &cvec, "lena.png");
if (status != 0) {
fprintf (stderr, "%s:%d: something wnet wrong.\n",
__FILE__, __LINE__);
exit (1);
}
status = puzzle_fill_cvec_from_file(&context, &cvec2, "lena-100.png");
if (status != 0) {
fprintf (stderr, "%s:%d: something wnet wrong.\n",
__FILE__, __LINE__);
exit (1);
}
d = puzzle_vector_normalized_distance(&context, &cvec, &cvec2, 1);
if (d < PUZZLE_CVEC_SIMILARITY_THRESHOLD) {
puts("Pictures are similar");
}
printf ("%g\n", d);
puzzle_free_cvec(&context, &cvec2);
puzzle_free_cvec(&context, &cvec);
puzzle_free_context(&context);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment