Requirements for OpenCV and Anaconda
— 32- or 64-bit computer.
— for Miniconda — 400 MB of disk space.
— For Anaconda — at least 3 GB of disk space for download and installation.
— Windows, MacOS or Linux.
— Python 2.7, 3.4, 3.5 or 3.6.
Anaconda — it is open source software containing jupiter, spies, etc., which are used for big data processing, data analysis, heavy scientific computing. Anaconda works in the R and Python programming languages. Spyder (Anaconda sub-application) is used for Python. OpenCV for Python will work in Skyder. Package versions are controlled by the conda package management system.
Installing Anaconda: Go to Continumum.io/downloads/ and install the latest version of Anaconda. Be sure to install "Python 3.6 Version" for the appropriate architecture. Install it with the default settings.p>
OpenCV (Open Source Computer Vision) — is a computer vision library that contains various functions for performing operations on images or videos. It was originally developed by Intel, but was later backed by Willow Garage and is now backed by Itseez. This library is cross-platform, meaning it is available in several programming languages such as Python, C ++, etc.
Steps to import OpenCV to Anaconda on Windows & # 39;
Step 2 : — Now you will see a menu with different options like Jupiter notepad, Spyder, etc. This is Anaconda Environment.
Step 3: — Select Spyder as it is an Anaconda IDE for Python and the OpenCV library will only run in it.
Step 2: — Enter this command, hit enter and let it download the entire package.
conda install -c menpo opencv
Step 3: — Now just import opencv into your python program, in which you want to use the image processing functions.
Examples: some basic functions of the opencv library (these functions are performed for the Windows version of Anaconda, but it also works for linux version)
img = cv2.imread (`LOCATION OF THE IMAGE`) pre >
The above imread function saves the image at a given location in the img variable.
img = cv2.imread (`watch .jpg`, cv2.IMREAD_GRAYSCALE)
The above function converts the image to grayscale and then stores it in the img variable.
cv2.imshow (`image`, img)
The above function shows the image stored in the img variable.li>
imwrite (filename, img)
The above function saves the image to file. The image is stored in a Mat variable in the form of a matrix.
cap = cv2.VideoCapture (0)
Stores live video from your webcam in a variable cap.
cap = cv2.VideoCapture (`LOCATION OF THE VIDEO`)
Saves the video at the given location to a variable.
cap — it is a variable that contains the video. The above function returns true if the video was opened successfully, otherwise it returns false.
The above function frees up the video stored in the header.