Popular Posts

Jun 25, 2020

Histograms - Python(OpenCV)



import numpy as np
import cv2 as cv
from matplotlib import pyplot as pit


img = np.zeros((
200, 200), np.uint8)
cv.rectangle(img
, (0, 100), (200, 200), (255), -1)
cv.rectangle(img
, (0, 50), (100, 100), (127), -1)


cv.imshow(
"img", img)

pit.hist(img.ravel()
, 256, [0, 256])
pit.show()

cv.waitKey(
0)
cv.destroyAllWindows()

No comments:

Post a Comment