Exemplo n.º 1
0

    def reset(event):
        plt.close()

    button.on_clicked(reset)

    ###########################

    lower.on_changed(update)
    upper.on_changed(update)

    plt.show()

    edges = cv2.blur(edges,(3,3))
    contours = find_contours(edges, 0.5)
    contours.sort(key=lambda x: -len(x))
    final = []

    for cont in contours[:ncont]:
        final.append(cont[::5]) #take every n-th point in contour

    contours = final[:]

    ##################################################################
    # Coordinate conversion, angle calculation and output to .CSV
    ##################################################################

    wp = box[2]-box[0]		# width of image (px)
    hp = box[3]-box[1]		# height of image (px)
    ratio = float(hp)/float(wp)	# ratio of image
Exemplo n.º 2
0
    okax = plt.axes([0.8, 0.025, 0.1, 0.04])
    button = Button(okax, 'OK', color=axcolor, hovercolor='0.975')

    def reset(event):
        plt.close()

    button.on_clicked(reset)

    ###########################

    lower.on_changed(update)
    upper.on_changed(update)

    plt.show()

    contours = find_contours(edges,5)
    contours.sort(key=lambda x: -len(x))

    i=0
    while len(contours[i])>1:
        i+=1
    final = contours[:i]

    def r(x1,y1,x2,y2):
        return ((x1-x2)**2+(y1-y2)**2)**0.5

    dist = 10
    num = 0
    while num<len(final):
        j = num+1
        while j<len(final):
Exemplo n.º 3
0
    okax = plt.axes([0.8, 0.025, 0.1, 0.04])
    button = Button(okax, 'OK', color=axcolor, hovercolor='0.975')

    def reset(event):
        plt.close()

    button.on_clicked(reset)

    ###########################

    lower.on_changed(update)
    upper.on_changed(update)

    plt.show()

    contours = find_contours(edges, 5)
    contours.sort(key=lambda x: -len(x))

    i = 0
    while len(contours[i]) > 1:
        i += 1
    final = contours[:i]

    def r(x1, y1, x2, y2):
        return ((x1 - x2)**2 + (y1 - y2)**2)**0.5

    dist = 10
    num = 0
    while num < len(final):
        j = num + 1
        while j < len(final):