Skip to content

Instantly share code, notes, and snippets.

@zoecarver
Created November 27, 2018 03:35
Show Gist options
  • Save zoecarver/c6e704344c37b29020abb915d109ab07 to your computer and use it in GitHub Desktop.
Save zoecarver/c6e704344c37b29020abb915d109ab07 to your computer and use it in GitHub Desktop.
test_image = cv2.imread('test.jpg', COLOR_RGB2GRAY) # load test image
test_image = cv2.resize(test_image, (200, 400)) # resize
# get all sliding windows we want
search_windows = \
sliding_window(test_image, y_stop=200, window=(64, 64), overlap=(.7, .7)) + \
sliding_window(test_image, y_stop=250, window=(80, 80), overlap=(.6, .6)) + \
sliding_window(test_image, y_stop=300, window=(96, 96), overlap=(.5, .5)) + \
sliding_window(test_image, y_stop=350, window=(128, 128), overlap=(.4, .4))
# play with values for sliding window
positive_windows = predict_windows(test_image, windows=search_windows, classifier=classifier)
annotated_image = draw_boxes(test_image, positive_windows) # positive boxes
boxed_image = draw_boxes(test_image, search_windows) # to visualize the search window coverage of our image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment