Computer Vision I (CSCI 3240U)
Faculty of Science, Ontario Tech University
http://vclab.science.ontariotechu.ca
Check Canvas for Due Date
The goal of this lab is twofold: (1) set up the Python environment that you will use for every lab in this course, and (2) get comfortable reading, writing and displaying images and video with OpenCV.
Everything we do for the rest of the term sits on top of this. Take the time to get it working properly now.
Computer Vision: Algorithms and Applications (2nd ed.), Szeliski — Sec. 1.1, 2.1.
Introduction; geometric primitives and image formation.
Everything you need is beside this handout: the image test.jpg and the video traffic-short.mp4, a clip from a fixed traffic camera on an Ontario highway in winter. No download is required.
The following steps assume that you are using a Linux/OSX distribution.
To see if you have Python3 installed, use the following command:
$ python3 --versionIf Python3 is not found, you can install it as follows:
$ sudo apt-get update
$ sudo apt-get install python3Next you will need pip3 to install the packages needed for this course. You can see if pip3 is already installed by using the following command:
$ command -v pip3If pip3 is not installed, you can install it using the following command:
$ sudo apt-get install python3-pipIn any case, it is a good idea to upgrade pip3 to the latest version. This can be done using the following command:
$ python3 -m pip install --upgrade pipI strongly recommend that you install this course’s packages into a virtual environment rather than into your system Python. This keeps the course setup isolated from anything else you may be working on.
$ python3 -m venv cv-venv
$ source cv-venv/bin/activateYou will need to activate this environment (the source
line above) every time you start work on a lab.
Now install the packages needed for this course using the
requirements.txt file available here:
$ pip3 install -r requirements.txtIf all goes as planned, you should be able to open the following Jupyter Notebook: setup-workbook.ipynb.
Complete the tasks in the workbook setup-workbook.ipynb [html]. The workbook asks you to do the following.
test_gray.jpg.
Display the first frame of the video traffic-short.mp4.
Repeat the exercise above, this time using your webcam as the source.
If you do not have a webcam, say so in your notebook and skip this task. You will not lose marks for it.
Your notebook must contain the following.
setup-workbook.ipynb.test_gray.jpg written to disk.Via Canvas. Please submit a single executed Jupyter notebook — one that has been run top to bottom, so that every figure and number listed above is visible in the submitted file. Code that has not been executed cannot be marked.
(rows, cols); a lot of other software gives you
(width, height). Mixing these up is the single most common
source of bugs in this course.matplotlib, this is why.