def drawDefects(image, defects, contour, contourProps):
    #try:
       
    center = (int(contourProps["Centroid"][0]), int(contourProps["Centroid"][1]))
    for defect in defects:
        start_i, end_i, far_i, distance = defect[0]
        distance = round(distance/256.0)
        start = tuple(contour[start_i][0])
        end = tuple(contour[end_i][0])
        far = tuple(contour[far_i][0])
        #convexhull
        cv2.line(image, start, end, [0,0,255], 1)
        #line from farthest point to convexhull
        cv2.line(image, far, end, [0,0,255], 1)
        #line from center of contour to convexhull point
        cv2.line(image, end, center, [255,0,255], 1)
        #points
        cv2.circle(image, end, 5, [0,0,255], -1)
        cv2.circle(image, far, 5, [0,0,255], -1)
        #write distance between hull and farthest point
        tools.setText(image, end, str(distance))
        distanceCenterHull = tools.getDistanceBetweenPoints(center, end)
        centerLine = tools.getMidPointInLine(center, end)
        tools.setText(image, centerLine, str(distanceCenterHull))
def processImage(image, gestures):
    sliderVals = getSliderVals()
    processed, newGestures = HGRecon.handRecognition(image, sliderVals, gestures)
    x,y = 10,20
    msg = "HMAX: " + str(sliderVals["Hmax"]) + " HMIN: " + str(sliderVals["Hmin"])
    tools.setText(processed, (x,y), msg)
    y = 40
    msg = "SMAX: " + str(sliderVals["Smax"]) + " SMIN: " + str(sliderVals["Smin"])
    tools.setText(processed, (x,y), msg)
    for gestName in newGestures.keys():
        y = y+20
        msg = gestName+": " + str(newGestures[gestName])
        tools.setText(processed, (x,y), msg)
    cv2.imshow("Result", processed)
    #cv2.imshow("Details", image)
    return newGestures