6.S063 Engineering Interactive Technologies (fall 2017)

HW7: Setup OpenCV

Deadline: due Wednesday (October 4, 2017) at 1pm, upload here

Deliverables:
  • a screenshot of your OpenCV program and the resulting camera image, upload here
Questions?
  • post on piazza
  • go to a TA office hour for building/coding oriented questions (tbd)
  • go to an instructor office hour for logistical questions and grading (mondays, 4-5pm, 32-211)
  • do not send us emails


Task:
Install OpenCV. Then test run your camera:
  • create a new python file with the code below (e.g. test.py)
  • go to your console, call the python file (I had to use the python3 prompt to make it work, e.g. python3 test.py)
  • you should see your camera image displayed, if you have the wrong camera image, change the camera_port variable.
  • if you get errors, your openCV and python setup might not be linked correctly, consider talking to your TA

import cv2
camera_port = 0
camera = cv2.VideoCapture(camera_port)
ret, frame = camera.read()
cv2.imshow('window',frame)

You are done when you see this:


Installing on Windows:
Installing on Mac: