Ejemplo n.º 1
0
static void	zoom(int keycode, t_env *env)
{
    if (keycode == KEYCODE_PLUS)
        apply_zoom(env, ZOOM_IN);
    else if (keycode == KEYCODE_MINUS)
        apply_zoom(env, ZOOM_OUT);
    if (keycode == KEYCODE_ARROW_UP)
        env->iter_max += 20;
    else if (keycode == KEYCODE_ARROW_DWN && env->iter_max > 20)
        env->iter_max -= 20;
}
Ejemplo n.º 2
0
void compute_sift_keypoints(float *input, keypointslist& keys, int width, int height, siftPar &par)
{

	flimage image;

	/// Make zoom of image if necessary
	float octSize = 1.0f;
	if (par.DoubleImSize){
		//printf("... compute_sift_keypoints :: applying zoom\n");
		image = alloc_image<float>(2*width, 2*height);
		apply_zoom(input,image.data,2.0,par.order,width,height);
		octSize *= 0.5f;
	} else
        image = alloc_image( make_image(input,width,height) );

    /// Apply initial smoothing to input image to raise its smoothing to par.InitSigma.  
    /// We assume image from camera has smoothing of sigma = 0.5, which becomes sigma = 1.0 if image has been doubled. 
    /// increase = sqrt(Init^2 - Current^2)
    float curSigma=0.5f;
    if (par.DoubleImSize) curSigma *= 2.0f;
    if (par.InitSigma > curSigma ) {
		if (DEBUG) printf("Convolving initial image to achieve std: %f \n", par.InitSigma);
		float sigma = (float)sqrt(par.InitSigma*par.InitSigma -
                                  curSigma*curSigma);
		gaussian_convolution(image.data, image.data, image.w, image.h, sigma);
	}

	/// Convolve by par.InitSigma at each step inside OctaveKeypoints by steps of 
	/// Subsample of factor 2 while reasonable image size 

	/// Keep reducing image by factors of 2 until one dimension is
	/// smaller than minimum size at which a feature could be detected.
	int 	minsize = 2 * par.BorderDist + 2;
	//printf("... compute_sift_keypoints :: maximum number of scales : %d\n", par.OctaveMax);

    for(int i=(par.DoubleImSize?-1:0);
        i<=par.OctaveMax && image.w>minsize && image.h>minsize;
        i++) {
		if(DEBUG) printf("Calling OctaveKeypoints \n");
		OctaveKeypoints(image, octSize, keys,par);

		// image is blurred inside OctaveKeypoints and therefore can be sampled
		flimage aux = alloc_image<float>(image.w/2, image.h/2);
		if(DEBUG) printf("Sampling initial image \n");
		sample(image.data, aux.data, 2.0f, image.w, image.h);
        free(image.data);
		image = aux;

		octSize *= 2.0f;
	}

    free(image.data);
/*	printf("sift::  %d keypoints\n", keys.size());
	printf("sift::  plus non correctly localized: %d \n", 	par.noncorrectlylocalized);*/

}