Popular Posts

May 22, 2020

working with matplotlib -python


To install in your project:
-          Go to the file-> settings
-          Select your project -> project Interpreter
-          Click on the plus icon of left side window then type ‘matplotlab’ in the search box and click on install.


visit: https://matplotlib.org




import cv2
from matplotlib import pyplot as plt

img = cv2.imread(
'lena.jpg', -1)
cv2.imshow(
'image', img)
# opencv reads image in BGR format
# and matploatlib reads image in RBG format. So we need to
# convert image to get the same result
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
# hides axis from image
plt.xticks([]), plt.yticks([])
plt.show()

cv2.waitKey(
0)
cv2.destroyAllWindows()

No comments:

Post a Comment