Dan252
05-02-2014, 04:37
Hey,
We are using RoboRealm for vision processing this year but we are having problems with the distance calculation.
This is the code we have as of now: (the output distances are way off)
def IsVertical(n):
return rr.GetArrayVariable("WIDTH")[n] < rr.GetArrayVariable("HEIGHT")[n]
width = 0
if IsVertical(i):
width = VtargetWidth_in
Hot[i] = False
else:
width = VtargetWidth_in
distance = width/(2*math.tan(cameraFieldOfView*(rr.GetArrayVariable ("WIDTH")[i]/rr.GetVariable("IMAGE_WIDTH"))*math.pi/360.0))
[written in python]
Another one tried (better results, but still atleast 3ft errors): [this is only for vertical targets]
if IsVertical(i):
d = VtargetRheight_in*imageHeight_px / (2*math.tan(cameraFieldOfView*math.pi/360.0)*rr.GetArrayVariable("HEIGHT")[i])
Any help would be welcome! :confused:
We are using RoboRealm for vision processing this year but we are having problems with the distance calculation.
This is the code we have as of now: (the output distances are way off)
def IsVertical(n):
return rr.GetArrayVariable("WIDTH")[n] < rr.GetArrayVariable("HEIGHT")[n]
width = 0
if IsVertical(i):
width = VtargetWidth_in
Hot[i] = False
else:
width = VtargetWidth_in
distance = width/(2*math.tan(cameraFieldOfView*(rr.GetArrayVariable ("WIDTH")[i]/rr.GetVariable("IMAGE_WIDTH"))*math.pi/360.0))
[written in python]
Another one tried (better results, but still atleast 3ft errors): [this is only for vertical targets]
if IsVertical(i):
d = VtargetRheight_in*imageHeight_px / (2*math.tan(cameraFieldOfView*math.pi/360.0)*rr.GetArrayVariable("HEIGHT")[i])
Any help would be welcome! :confused: