def test_getArcAngle(): xVals = helpers.getXVals(testCoords) yVals = helpers.getYVals(testCoords, 720) arc = helpers.getArc(xVals, yVals) assert helpers.getArcAngle(arc[2], arc[1], arc[0]) == 19.08
def test_getArcMax(): xVals = helpers.getXVals(testCoords) yVals = helpers.getYVals(testCoords, 720) arc = helpers.getArc(xVals, yVals) assert helpers.getArcMax(arc[2], arc[1], arc[0]) == 454.65
def test_getYVals(): assert helpers.getYVals(testCoords, 720) == [ 339, 370, 394, 430, 404, 413, 406, 402, 396, 402, 420, 435, 446, 470, 475, 487, 484, 469, 465, 468, 404, 359 ]
def test_getArc(): xVals = helpers.getXVals(testCoords) yVals = helpers.getYVals(testCoords, 720) assert helpers.getArc(xVals, yVals) == [ 330.2698234321775, 0.34583816370993475, -0.00024040241876043645 ]
thickness = int(np.sqrt(args["buffer"] / float(i + 1)) * 2.5) cv2.line(frame, pts[i - 1], pts[i], (0, 0, 255), thickness) # write video frame = imutils.resize(frame, width=int(vs.get(3))) writer.write(frame) # convert to list for seralization output = [] for pt in pts: output.append(pt) # get shot arc and shot angle: x_vals = helpers.getXVals(output) y_vals = helpers.getYVals(output, SCREEN_RES_Y) arc = helpers.getArc(x_vals, y_vals) # generate formatted coordinates output = helpers.formatCoordinates(arc, 10, 1100) if arc is not None: arcMax = helpers.getArcMax( arc[2], arc[1], arc[0] ) angle = helpers.getArcAngle( arc[2], arc[1], arc[0] ) # if helpers.checkSuccess(980, 1020, 280, 320, 720, arc): # success = True if helpers.checkSuccess(SUCCESS_X1, SUCCESS_X2, SUCCESS_Y1, SUCCESS_Y2, SCREEN_RES_Y, arc): success = True else: arcMax = None