示例#1
0
    # crop the image to remove the ui elements
    x, w, y, h = [200, 1130, 70, 750]
    keypoint_image = keypoint_image[y:y + h, x:x + w]

    kp1, kp2, matches, match_points = vision_limestone.match_keypoints(
        keypoint_image)
    match_image = cv.drawMatches(vision_limestone.needle_img, kp1,
                                 keypoint_image, kp2, matches, None)

    if match_points:
        # find the center point of all the matched features
        center_point = vision_limestone.centeroid(match_points)
        # account for the width of the needle image that appears on the left
        center_point[0] += vision_limestone.needle_w
        # drawn the found center point on the output image
        match_image = vision_limestone.draw_crosshairs(match_image,
                                                       [center_point])

    # display the processed image
    cv.imshow('Keypoint Search', match_image)
    cv.imshow('Processed', processed_image)
    cv.imshow('Edges', edges_image)
    #cv.imshow('Matches', output_image)

    # debug the loop rate
    print('FPS {}'.format(1 / (time() - loop_time)))
    loop_time = time()

    # press 'q' with the output window focused to exit.
    # waits 1 ms every loop to process key presses
    if cv.waitKey(1) == ord('q'):
        cv.destroyAllWindows()