MIT_MatlabToolbox/trunk/utils/VisionPrePostProcessor/image_module.c
/*
 * compute feature-to-landmark descriptor-distance
 */
compute feature-to-landmark descriptor-distance
compute feature - to - landmark descriptor - distance
float featuredist(float* descr_hsv, float* descr_rgb, float* descr_lndmark)
{
	double h_dist,h_dist_cnd,g_dist,b_dist;
	h_dist = pow((descr_hsv[0]-descr_lndmark[0]),2);
	h_dist_cnd = pow((descr_hsv[0]-descr_lndmark[0]-360),2);
	if (h_dist_cnd<h_dist) h_dist = h_dist_cnd;
	h_dist_cnd = pow((descr_hsv[0]-descr_lndmark[0]+360),2);
	if (h_dist_cnd<h_dist) h_dist = h_dist_cnd;
	return h_dist;
}
float featuredist ( float * descr_hsv , float * descr_rgb , float * descr_lndmark ) { double h_dist , h_dist_cnd , g_dist , b_dist ; h_dist = pow ( ( descr_hsv [ 0 ] - descr_lndmark [ 0 ] ) , 2 ) ; h_dist_cnd = pow ( ( descr_hsv [ 0 ] - descr_lndmark [ 0 ] - 360 ) , 2 ) ; if ( h_dist_cnd < h_dist ) h_dist = h_dist_cnd ; h_dist_cnd = pow ( ( descr_hsv [ 0 ] - descr_lndmark [ 0 ] + 360 ) , 2 ) ; if ( h_dist_cnd < h_dist ) h_dist = h_dist_cnd ; return h_dist ; }
compute feature-to-landmark descriptor-distance
compute feature - to - landmark descriptor - distance
//descr_landmark = [hue green blue]
 //h-distance is on 360group
 //color distance
 //g_dist = pow(descr_lndmark[1]-descr_rgb[1],2);
 //b_dist = pow(descr_lndmark[2]-descr_rgb[2],2);
 //printf("h: %f, landmark h: %f, dist: %f \n",descr_hsv[0],descr_lndmark[0],h_dist);
