forked from auzanmuh/vehicle_detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_coordinate_init.py
executable file
·27 lines (21 loc) · 1.03 KB
/
_coordinate_init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import math
import math_operation as mo
class GetCoordinate:
def __init__(self, altitude, magnifier, theta):
self.width_frame = 1120 # pixel
self.height_frame = 630 # pixel
self.altitude = altitude
self.theta = theta
sensorHeight = 15.4
sensorWidth = 23.1
self.heightInFullFrame = (self.width_frame * 2.0) / 3
self.heightSurplus = (self.heightInFullFrame - self.height_frame) / 2
aspectRatioHeight = (sensorWidth / self.width_frame) * self.heightInFullFrame
self.focal = (((magnifier * 1) / aspectRatioHeight) * self.height_frame)
def getDistanceOB(self):
yCoordinate = (self.height_frame + self.heightSurplus) - self.height_frame
OB = mo.centeroidPinHoleMode(self.heightInFullFrame, self.focal, self.altitude, self.theta, yCoordinate)
return OB
def getCoordinate(self, distance):
yCoordinate = mo.getCoordinateFromDistance(self.height_frame, self.focal, self.altitude, self.theta, distance)
return yCoordinate