Description
Setup
Note that we will be using a new conda environment for this project!
-
Install Miniconda. It doesn’t matter whether you use Python 2 or 3 because we will create our own environment that uses 3 anyways.
-
Open the terminal
-
-
On Windows: open the installed Conda prompt to run the command.
-
Basic Numpy [20 points (5 each)]
Write a few lines of code to do each of the following. Copy and paste your code into the report.
1.1 Use numpy.random.rand to return the roll of a six-sided die over N trials.
1.2 Let y be the vector: y = np.array([11, 22, 33, 44, 55, 66]). Use the reshape command to
form a new matrix z that looks like this: [[11,22],[33,44],[55,66]]
1.3 Use the numpy.max and numpy.where functions to set x to the maximum value that occurs in z (above), and set r to the row number (0-indexed) it occurs in and c to the column number (0-indexed) it occurs in.
1.4 Let v be the vector: v = np.array([1, 4, 7, 1, 2, 6, 8, 1, 9]). Set a new variable x to be the number of 1’s in the vector v.
C = V − m
and the Saturation will be the ratio between the difference and how large the max is:
S=C/V
Except if R, G, and B are all 0. Because then V would be 0 and we don’t want to divide by that, so just set the saturation 0 if that’s the case.
Finally, to calculate Hue we want to calculate how far around the color hexagon our target color is.
-
Submit the code as zip on Gradescope at PS1 – Code
-
Submit the report as PDF on Gradescope at PS1 – Report
There is no submission to be done on Canvas.
This assignment is adapted from the following 3 sources:
PS0 assignment of Kristen Grauman’s CS 376: Computer Vision at UT Austin
HW1 assignment of David Fouhey’s EECS 442: Computer Vision at University of Michigan.
HW0 assignment of Joseph Redmon’s CSE 455: Computer Vision at University of Washington.
6