Sie sind auf Seite 1von 2

//counting pixels angles and dimensions on normal surface

float dxPixelAngle, dyPixelAngle;


dxPixelAngle = 2 * cameraParam->xAngleOfView / (cameraParam->resolutionX
/ 4);
dyPixelAngle = 2 * cameraParam->yAngleOfView / (cameraParam->resolutionY
/ 4);
//counting pixel dimension on normal surface passing through object
float xNormObjectAngle, yNormObjectAngle;
float yNormSurface, xNormSurface;
float dxPixelDimension, dyPixelDimension;
yNormObjectAngle = dyPixelAngle*(fabs(cameraParam->resolutionY / 4 - yRo
i));
//angle between simple perpendicular to the surface of the earth and str
aight from camer to object
yNormSurface = cameraParam->altitiude / cos(yNormObjectAngle + cameraPar
am->mountAngle*PI / 180.0);
dyPixelDimension = yNormSurface*sin(yNormObjectAngle) / (fabs(cameraPara
m->resolutionY / 4 - yRoi));
xNormObjectAngle = dxPixelAngle*(fabs(cameraParam->resolutionX / 4 - xRo
i));
xNormSurface = cameraParam->altitiude / cos(xNormObjectAngle);
dxPixelDimension = xNormSurface*sin(xNormObjectAngle) / (fabs(cameraPara
m->resolutionX / 4 - xRoi));
//calculation of direct angle to the object from camera point of view
float a, b, c;
// descr
iption of triangle length
float directAngle;
//divide the plane into quarters
if ((xRoi - cameraParam->resolutionX / 4) > 0 && (yRoi -cameraParam->res
olutionY / 4 -static_cast<int>(cameraParam->altitiude*tan(cameraParam->mountAngl
e*PI/180)/dyPixelDimension)) < 0) {
//first quarter of coordinate system
a = fabs(tan(xNormObjectAngle)*cameraParam->altitiude);
b = fabs(tan(yNormObjectAngle + cameraParam->mountAngle*PI / 180
.0)*cameraParam->altitiude);
c = sqrt(a*a + b*b);
directAngle = atan2(c, cameraParam->altitiude);
rotationObjectAngle = atan2(a, b);
rotationObjectAngle = rotationObjectAngle + 0;
}
else if ((xRoi - cameraParam->resolutionX / 4) < 0 && (yRoi - cameraPara
m->resolutionY / 4 - static_cast<int>(cameraParam->altitiude*tan(cameraParam->mo
untAngle*PI / 180) / dyPixelDimension)) < 0) {
//second quarter of coordinate system
a = fabs(tan(xNormObjectAngle)*cameraParam->altitiude);
b = fabs(tan(yNormObjectAngle + cameraParam->mountAngle*PI / 180
.0)*cameraParam->altitiude);
c = sqrt(a*a + b*b);
directAngle = atan2(c, cameraParam->altitiude);
rotationObjectAngle = atan2(a, b);
rotationObjectAngle = -(rotationObjectAngle +0);
}
else if ((xRoi - cameraParam->resolutionX / 4) < 0 && (yRoi - cameraPara
m->resolutionY / 4 - static_cast<int>(cameraParam->altitiude*tan(cameraParam->mo

untAngle*PI / 180) / dyPixelDimension)) > 0) {


//third quarter of coordinate system
a = fabs(tan(xNormObjectAngle)*cameraParam->altitiude);
b = fabs(tan(yNormObjectAngle - cameraParam->mountAngle*PI / 180
.0)*cameraParam->altitiude);
c = sqrt(a*a + b*b);
directAngle = atan2(c, cameraParam->altitiude);
rotationObjectAngle = atan2(a, b);
rotationObjectAngle = -(PI-rotationObjectAngle);
}
else if ((xRoi - cameraParam->resolutionX / 4) > 0 && (yRoi - cameraPara
m->resolutionY / 4 - static_cast<int>(cameraParam->altitiude*tan(cameraParam->mo
untAngle*PI / 180) / dyPixelDimension)) > 0) {
//fourth quarter of coordinate system
a = fabs(tan(xNormObjectAngle)*cameraParam->altitiude);
b = fabs(tan(yNormObjectAngle - cameraParam->mountAngle*PI / 180
.0)*cameraParam->altitiude);
c = sqrt(a*a + b*b);
directAngle = atan2(c, cameraParam->altitiude);
rotationObjectAngle = atan2(a, b);
rotationObjectAngle = PI- rotationObjectAngle;
}

Das könnte Ihnen auch gefallen