コード例 #1
0
ファイル: pictureTaker.py プロジェクト: tobybreckon/bee-wi
    # Stream the feed
    buggy.streamFeed()

    # Wait for feed to start...
    wait()

    # Loop
    try:

        if DISPLAY:
            cv2.namedWindow('normal',cv2.WINDOW_NORMAL)

        while IMAGES_TO_SAVE > 0:
            
            # Get current Image
            current_image = buggy.getCurrentImage()
            while current_image is None:
                current_image = buggy.getCurrentImage()

            # Save it
            u_string = str(time.clock()).replace(".","")
            cv2.imwrite(SAVE_LOCATION + u_string + '.png', current_image)
            IMAGES_TO_SAVE -= 1
            
            """ DISPLAYING IMAGE """
            if DISPLAY:

                cv2.imshow('normal',current_image)
                
                k = cv2.waitKey(33)
                if k==27:    # Esc key to stop
コード例 #2
0
    # Stream the feed
    buggy.streamFeed()

    # Wait for feed to start...
    wait()

    # Loop
    try:

        if DISPLAY:
            cv2.namedWindow('normal', cv2.WINDOW_NORMAL)

        while IMAGES_TO_SAVE > 0:

            # Get current Image
            current_image = buggy.getCurrentImage()
            while current_image is None:
                current_image = buggy.getCurrentImage()

            # Save it
            u_string = str(time.clock()).replace(".", "")
            cv2.imwrite(SAVE_LOCATION + u_string + '.png', current_image)
            IMAGES_TO_SAVE -= 1
            """ DISPLAYING IMAGE """
            if DISPLAY:

                cv2.imshow('normal', current_image)

                k = cv2.waitKey(33)
                if k == 27:  # Esc key to stop
                    cv2.destroyAllWindows()
コード例 #3
0
    # Wait for feed to start...
    wait()

    # Loop
    try:

        if DISPLAY:
            cv2.namedWindow('normal',cv2.WINDOW_NORMAL)
            cv2.namedWindow('goal',cv2.WINDOW_NORMAL)

        # Set found to false
        found_goal = False

        # Get the current Image for reference (don't save it)
        current_image = buggy.getCurrentImage(append=False)
        while current_image is None:
            current_image = buggy.getCurrentImage(append=False)

        # Set goal image
        goal_image = cv2.imread(PATH_GOAL_IMAGE)
        # Resize so smaller than video dimensions - keep halving till smaller
        while goal_image.shape[0] > current_image.shape[0] or goal_image.shape[1] > current_image.shape[1]:
            goal_image = cv2.resize(goal_image, (goal_image.shape[0]/2, goal_image.shape[1]/2))
        _, goal_w, goal_h = goal_image.shape[::-1]

        # Loop while still searching
        while not found_goal:
            
            # Get current Image
            current_image = buggy.getCurrentImage()