Article image
Pablo Abreu
Pablo Abreu20/10/2022 11:09
Compartilhe

Como contar o numero de objetos de uma imagem?

  • #Python
#REV1
#pip install cvlib
#pip install --upgrade cvlib


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("car.jpg")
box, label, count = cv.detect_common_objects(image)
output = draw_bbox(image, box, label, count)
plt.imshow(output)
plt.show()
print("Numero de carros nessa imagem " + str(label.count('car')))
Compartilhe
Comentários (3)
Pablo Abreu
Pablo Abreu - 20/10/2022 14:12

@luiz silva vc tem que instalar a biblioteca matplot


pip install matplotlib

import matplotlib.pyplot as plt

LS

Luiz Silva - 20/10/2022 13:32
import matplot.pyplot as plt

to com erro para importar esse modulo

LS

Luiz Santos - 20/10/2022 12:50

Show