Installation

For Windows or Mac, the easiest way to install probably through Anaconda.

  • Download and install Anaconda

  • Open an “Anaconda prompt” (open terminal directly for Mac case) and type

    • pip install opencv-python

    • pip install opencv-contrib-python

  • Ignore this if the above works perfectly already. If you prefer, you may install OpenCV through conda instead. Open an “Anaconda prompt” and type

    • conda install -c conda-forge opencv

For Linux, you may install opencv to your OS Python by simply type

  • sudo pip install opencv-python

  • sudo pip install opencv-contrib-python

But I strongly recommend you create an virtualenv as well

  • virtualenv -p python3 ~/myenv

  • source ~/myenv/bin/activate # activate environment

  • pip install opencv-python

  • pip install opencv-contrib-python

Test

  • Type python to start python (from an Anaconda prompt if you installed Anaconda)

    • Type “import cv2” and press enter. If there is no error, your installation is successful

Jupyter notebook

Jupyter notebook is a simple code developing environment suitable for fast prototyping and testing. In Anconda prompt, type

  • jupyter notebook

Inside jupyter notebook, you can select each block to be a code block, a markdown block, and some other types. But mostly we just need the first two types. Make sure that a block is selected as a code block, then type “1+1” and press shift-enter. Hopefully you will get 2.

Python is not a difficult language but if you absolutely zero programming background, you could have a hard time for this course. If you have some background on other languages (such as C/C, Java/Javascript, Matlab, Lua, Go, Perl), you should not have too much trouble getting used to Python. You may take a look of this super short tutorial by Justin Johnson. And you don't need to worry too much about the “numpy” part at the moment, you probably don't need too much of the numpy features in this lass. For a “book” form reference, you can check out this. But you don't need to go through the entire book. The first 3 chapters should be more than sufficient. If you come across any question, please do not hesitate to share it in piazza.