Exercise

E2: Image Processing

Objective 1

Use morphological operations, thresholds, masks, and image arithmetic to isolate an object for a composite image.

  1. Apply a binary threshold to coins-bw.jpg, then use morphological operations to get a noise-free mask isolating the coins.

  2. Create a ROI to display only the coin at the upper left (just tweak the x and y ranges by hand).

  3. Load another image of your choosing to use as a background.

  4. Composite the single coin onto the background image.

objective 1 example

Objective 2

Change the image processing demo from class to control the amount of blur according to how much of a box area is covered by the threshold mask.

  1. Add code to the class demo to draw a box.

  2. Using a function like numpy.count_nonzero to count the number of mask pixels in the box.

  3. Blur the video frame according to the ratio of mask pixels.

objective 2 example

Submit

Follow the submission instructions on the course information page. Include your code and one screen capture from each objective. In your solution description, write about any problems you ran into, and the main resource(s) you used (blog posts, online tutorials, stackoverflow posts, papers, textbooks, etc.). These resources should be annotated with brief descriptions of what the resource is and how it helped you.

You can combine your code, screen captures, and description together in one Jupyter notebook and hand it in as a PDF.