示例#1
0
文件: MCC.cpp 项目: chendong/mpi-afis
float MCC::rho_tun(Cylinder const & t_a, Cylinder const & t_b, Cylinder const & k_a, Cylinder const & k_b)
{
	float d1, d2, d3;

	d1 = fabs(t_a.ds(k_a.getX(),k_a.getY()) - t_b.ds(k_b.getX(),k_b.getY()))/(t_a.ds(k_a.getX(),k_a.getY()) + t_b.ds(k_b.getX(),k_b.getY()));
	d2 = fabs(t_a.dFi(t_a.dFi(t_a.getrT(),k_a.getrT()),t_b.dFi(t_b.getrT(),k_b.getrT())));
	d3 = fabs(t_a.dFi(dR(t_a,k_a),dR(t_b,k_b)));

	return Cylinder::psi(d1,MUP1,TAUP1)*Cylinder::psi(d2,MUP2,TAUP2)*Cylinder::psi(d3,MUP3,TAUP3);
}
示例#2
0
float Cylinder::nhs(const Cylinder &c) const
{
	int hamming = 0;
	const float P = 30;

	if (abs(dFi(getrT(),c.getrT())) > 0.785398163397 || dss(c.getX(), c.getY()) > DELTAXY*DELTAXY)
		return 0;
	
	for(unsigned int i = 0; i < NUMCELLS; ++i)
		if (getB1(i) != c.getB1(i))
			hamming++;
		
	return pow(1.0-((float)hamming)/NUMCELLS, P);
}
示例#3
0
float Cylinder::similarity(const Cylinder & c) const
{
	unsigned int count = 0;
	float norma_b = 0, normb_a = 0, norm_diff = 0;
	float ca_b, cb_a;

	if (abs(dFi(getrT(),c.getrT())) > DELTAZETA)
		return 0;
	
	if (bit == false)
	{
		for (unsigned int i=0; i<NUMCELLS; i++)
		{
			ca_b = cmVector[i];
			cb_a = c.getCM(i);

			if (ca_b>=0 && cb_a>=0)
			{
				count++;

				norma_b += ca_b*ca_b;
				normb_a += cb_a*cb_a;
				norm_diff += ca_b*cb_a;
			}
		}

		//Check if two cylinders are matchable
		if(count >= MINCELLS)
		{
			norm_diff = sqrt(norma_b + normb_a - 2.0*norm_diff);
			return 1.0 - (norm_diff/(sqrt(norma_b)+sqrt(normb_a)));
		}
		else
			return 0;
	}
	else
	{
		int counta_b = 0, countb_a = 0, count_diff = 0;

		for (unsigned int i=0; i<cmBit1.size(); ++i)
			if (getB2(i) && c.getB2(i))
			{
				count++;
				
				if (getB1(i))
				{
					counta_b++;
					
					if(!c.getB1(i))
						count_diff++;
				}
				
				if (c.getB1(i))
				{
					countb_a++;
					
					if(!getB1(i))
						count_diff++;
				}
			}
		
		//Check if two cylinders are matchable
		if (count >= MINCELLS)
			return (1 - (sqrt(count_diff)/(sqrt(counta_b)+sqrt(countb_a))));
		else
			return 0;
	}
}