/** @brief Main SIFT routine
 *
 * takes as input 1) a list of keypoints coordinates and 2) an image. 
 *
 */
int main(int argc, char **argv)
{

    if (argc !=3){
        print_usage();
        return -1;
    }

    /** Load image */
    int w, h;
    float* x = read_image_to_gray(argv[2], &w, &h);

    /** Read keypoints locations from file */ 
    int n;
    struct sift_keypoint_std * k = sift_read_keyslocation_from_file(argv[1], &n);

    /** Compute the SIFT descriptors */
    sift_find_ori_and_fill_descriptors(x, w, h, k, n);

    /** Save into a file the keypoints with their orientations and their feature vectors */
    fprintf_keypoint_std(stdout, k, n); 
    sift_write_to_file("out.tt", k, n); // TEMP

    /* memory deallocation */
    xfree(x);
    xfree(k);
    return 0;
}
Ejemplo n.º 2
0
int main(void)
{
	// create input image
	int w = 512;
	int h = 512;
	float *x = (float*)malloc(w*h*sizeof(float));
	for (int i = 0; i < w*h; i++)
		x[i] = rand();

	// compute sift keypoints
	int n;
	struct sift_keypoint_std *k = sift_compute_points(x, w, h, &n);

	// write to standard output
	sift_write_to_file("/dev/stdout", k, n);

	// cleanup
	free(k);
	free(x);
	return 0;
}