Exemple #1
0
        cv2.waitKey(3000)
        cv2.destroyAllWindows()

    else:
        print(f"The current red detected objects are at : {red_coors}")
        cv2.namedWindow("red img", cv2.WINDOW_AUTOSIZE)
        # cv2.namedWindow("red mask", cv2.WINDOW_AUTOSIZE)
        # cv2.moveWindow("red mask", int(pic.shape[1]), 0)
        cv2.moveWindow("red img", 0, 0)
        # cv2.imshow("red mask", red_mask)
        cv2.imshow("red img", red_img)
        cv2.waitKey(2000)
        cv2.destroyAllWindows()
        number += 1  # to rename the next captured image
        modified_joints.move(
            get_angles(red_coors[0][0], red_coors[0][1], red_coors[0][2]))
        sleep(2)
        # joints.pump()       # turn on the pump
        modified_joints.red_drop_pos()
        sleep(2)
        # joints.pump()       # turn of the pump
        modified_joints.parking_pos()

while green_check:
    camera.start_preview()
    sleep(2)
    camera.capture(f'/home/pi/Desktop/images/img{number}.jpg')
    camera.stop_preview()
    pic = cv2.imread(f'/home/pi/Desktop/images/img{number}.jpg')
    green_coors, green_mask, green_img = green_color.color(pic)
    if len(green_coors) == 0:
def circle_drop_pos():
    pos = get_angles(10, 0, 5)
    move(pos)
def triangle_drop_pos():
    pos = get_angles(-6, 0, 5)
    move(pos)
def square_drop_pos():
    pos = get_angles(6, 0, 5)
    move(pos)
def red_drop_pos():
    pos = get_angles(-6, 0, 5)
    move(pos)
def green_drop_pos():
    pos = get_angles(10, 0, 5)
    move(pos)
def blue_drop_pos():
    pos = get_angles(6, 0, 5)
    move(pos)
def red_drop_pos():

    move(get_angles(-19, 0, 5))