Esempio n. 1
0
        _, contours, _ = retvals
    else:
        contours, _ = retvals

    annotatedimage = image.copy()
    positions = []
    for contour in contours:
        center, _ = cv2.minEnclosingCircle(contour)
        intcenter = tuple(int(f) for f in center)
        count = mode_count[center[1]][center[0]]
        if count > (2 * circleArea / 3):
            cv2.circle(annotatedimage, intcenter, int((count / 2000) * imagefuncs.NOTE_SIZE / 2), (255,0,255))
            cv2.circle(annotatedimage, intcenter, imagefuncs.NOTE_SIZE / 2, (255,0,0))
            positions.append(intcenter)

    #imagefuncs.qimshow(annotatedimage)

    return positions

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)

    image = webcam.grab()

    with open('calibrationdata.json', 'rb') as f:
        calibrationdata = json.loads('\n'.join(f.readlines()))
    image, _ = imagefuncs.correct_perspective(imagefuncs.remove_color_cast(image, calibrationdata), calibrationdata, False)

    notes = findnotes(image)

Esempio n. 2
0
        direction = topindex - othertopindex

    if direction > 0:
        corners = (calibrationdata['corners'] * 2)[startingpointindex:startingpointindex + 4]
    else:
        corners = (calibrationdata['corners'] * 2)[startingpointindex + 1:startingpointindex + 4 + 1]
        corners.reverse()

    calibrationdata['corners'] = corners


    #
    # Ask the user for the aspect ratio of the scrum board (needed for perspective correction)
    #

    correctedimage = imagefuncs.correct_perspective(imagefuncs.remove_color_cast(image, calibrationdata), calibrationdata, True)

    downscaled_correctedimage, scalefactor = scale_to_fit_screen(correctedimage)


    #
    # Let the user drag the lines separating todo, busy, blocked, in review and done columns
    #

    nr_of_lines = 4

    linepositions = calibrationdata['linepositions']
    noteCorners = calibrationdata['notecorners']

    linepositions = scale_x_positions(linepositions, scalefactor)
    linepositions = clamp_x_positions_to_board(linepositions, downscaled_correctedimage)