コード例 #1
0
def get_point_meters(req):
    response = CoordinatesResponse()

    coords, response.width, response.height = process_video_input(req)

    #set the output param to be the pixel coordiantes
    response.output = coords

    #define the width and height params
    response.width = convertToMeters(response.width)
    response.height = convertToMeters(response.height)

    #check the first pair
    if coords[0] == -1:
        #set second pair to -1, -1
        response.output = [-1, -1, response.output[2], response.output[3]]
    else:
        #convert the first pair to meters
        response.output = [
            convertToMeters(response.output[0]),
            convertToMeters(response.output[1]), response.output[2],
            response.output[3]
        ]

    #check the second pair
    if coords[2] == -1:
        #set second pair to -1, -1
        response.output = [response.output[0], response.output[1], -1, -1]
    else:
        #convert the second pair to meters
        response.output[2] = convertToMeters(coords[2])
        response.output[3] = convertToMeters(coords[3])

    return response
コード例 #2
0
def get_point_xy(req):
    response = CoordinatesResponse()
    response.output, response.width, response.height = process_video_input(req)
    return response