Iklan1

Saturday, July 27, 2019

TIPS : Install opencv-python

Assalamualaykum,
Berikut command install opencv library untuk python dengan PIP

C:\Windows\system32>pip install opencv-contrib-python
Collecting opencv-contrib-python
  Downloading https://files.pythonhosted.org/packages/aa/4c/a3125e25da4b121b4077
c575eee8a691ffabb5d97afc5ae832fd5a7015e3/opencv_contrib_python-4.1.0.25-cp37-cp3
7m-win32.whl (30.9MB)
     |████████████████████████████████| 30.9MB 26kB/s
Requirement already satisfied: numpy>=1.14.5 in c:\users\alooo\appdata\local\pro
grams\python\python37-32\lib\site-packages (from opencv-contrib-python) (1.16.4)

Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.1.0.25

C:\Windows\system32>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> ^Z

Coba tes dengan script ini :

import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('opencv-tes.jpg',0)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
(2)
import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('opencv-tes.jpg',0)
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
plt.show()

Semoga bermanfaat
Wassalamualaykum

No comments:

Post a Comment