Exemplo n.º 1
0
void calibrationB::transformDimension(float &width, float &height)
{
	//Transform width/height
    float halfX = width * 0.5f;
    float halfY = height * 0.5f;

	//Take all blobs as if they're from the center of calibrated region
	float centerX = ((maxBoxX - minBoxX)/2) + minBoxX;
	float centerY = ((maxBoxY - minBoxY)/2) + minBoxY;

	//Calculate x/y position of upperleft and lowerright x/y positions
    float ulX = centerX - halfX;
    float ulY = centerY - halfY;
    float lrX = centerX + halfX;
    float lrY = centerY + halfY;

	//Transform these x/y positions to screenspace
	cameraToScreenPosition(ulX, ulY);
	cameraToScreenPosition(lrX, lrY);

	printf("lrx: %f  lry: %f \n", lrX, lrY);
	//cameraToScreenSpace(ulX, ulY);
	//cameraToScreenSpace(lrX, lrY);

	//ofCircle(ulX * ofGetScreenWidth(), ulY * ofGetScreenHeight(), 30);
    //ofCircle(lrX * ofGetScreenWidth(), lrY * ofGetScreenHeight(), 30);

	//Calculate new height/width
	width = lrX - ulX;
	height = ulY - lrY;
}
//! Modification de la taille de la zone de calibration
void CalibrationUtils::transformDimension(float &width, float &height)
{
	//Transformation de la hauteur et de la largeur
    float halfX = width * 0.5f;
    float halfY = height * 0.5f;

	//Extraction des coordonnées du centre de la zone de calibration
	float centerX = ((maxBoxX - minBoxX)/2) + minBoxX;
	float centerY = ((maxBoxY - minBoxY)/2) + minBoxY;

	//Calcul de l'abscisse et de l'ordonnée des points en inférieur droit et supérieur gauche
    float ulX = centerX - halfX;
    float ulY = centerY - halfY;
    float lrX = centerX + halfX;
    float lrY = centerY + halfY;

	//Convertion des coordonnées théoriques en coordonnées réelles
	cameraToScreenPosition(ulX, ulY);
	cameraToScreenPosition(lrX, lrY);

	//Calcul de la nouvelle hauteur et largeur de la zone de calibration
	width = std::fabs(lrX - ulX);
	height = std::fabs(ulY - lrY);
}
Exemplo n.º 3
0
void CalibrationUtils::transformDimension(float &width, float &height)
{
	//Transform width/height
    float halfX = width * 0.5f;
    float halfY = height * 0.5f;

	//Take all blobs as if they're from the center of calibrated region
	float centerX = ((maxBoxX - minBoxX)/2) + minBoxX;
	float centerY = ((maxBoxY - minBoxY)/2) + minBoxY;

	//Calculate x/y position of upperleft and lowerright x/y positions
    float ulX = centerX - halfX;
    float ulY = centerY - halfY;
    float lrX = centerX + halfX;
    float lrY = centerY + halfY;

	//Transform these x/y positions to screenspace
	cameraToScreenPosition(ulX, ulY);
	cameraToScreenPosition(lrX, lrY);

	//Calculate new height/width
	width = std::fabs(lrX - ulX);
	height = std::fabs(ulY - lrY);
}