-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0. Intsllation guide
53 lines (38 loc) · 1.79 KB
/
0. Intsllation guide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Intsllation guide:
1. Download Anaconda 3.7 version (if you are comfortable with 2.7 go for it, beginners start with 3.7) at https://www.anaconda.com/distribution/
2. Installing Anaconda:
For Windows:
install the .exe file which was downloaded
For Linux:
in terminal, go to the directory in which the .sh file was downloaded, and type the following:
bash ./<Downloaded filename>
For macOS:
install the .pkg file which was downloaded
-You should now be able to find 'anaconda navigator' somewhere in your machine.
-Open anaconda navigator and install spyder/jupyter notebook (if already not installed). Once installed, codes in python can be written in these interfaces.
To open these interfaces, open terminal/anaconda prompt and type:
spyder / jupyter notebook
3. Libraries:
In general the way to install libraries in python is by opening terminal/anaconda prompt and type:
conda install <library name>
OR
pip install <library name>
For example, to install the library matplotlib:
conda install matplotlib
OR
pip install matplotlib
Recommended: numpy, opencv-python, scipy, matplotlib
If your OS is not supporting the new versions of above libraries, you can install old versions like : pip install opencv-python==4.0.0.21
3. Importing libraries
Even though while installing opencv we used the name opencv-python, while importing we use cv2
import cv2 # The OpenCV library for opening and saving images
import numpy as np # Array manipulations and other math stuff
from matplotlib import pyplot as plt # plotting graphs
4. Using Libraries
# import the necessary libraries
from matplotlib import pyplot as plt # plotting graphs
import matplotlib.image as mpimg
# reading the image in grayscale format
img = mpimg.imread('cameraman.tif')
imgplot = plt.imshow(img, cmap='gray', vmin=0, vmax=255)
plt.show()