Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created May 11, 2021 12:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/ec3ce5d8cb10eee3bab0faf2b5251187 to your computer and use it in GitHub Desktop.
Save amankharwal/ec3ce5d8cb10eee3bab0faf2b5251187 to your computer and use it in GitHub Desktop.
import cv2
import numpy as np
import matplotlib.pyplot as plt
import cvlib as cv
from cvlib.object_detection import draw_bbox
from numpy.lib.polynomial import poly
image = cv2.imread("cars.jpeg")
box, label, count = cv.detect_common_objects(image)
output = draw_bbox(image, box, label, count)
plt.imshow(output)
plt.show()
print("Number of cars in this image are " +str(label.count('car')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment