Question: Write a function that is given the original image img and returns the integral image. With the focus on speed, this function should run


Write a function that is given the original image img and returns the integral image. With the focus on speed, this function should run in O(hw) time, where h is height and w is width of the original image. b. Deliverable: sum_rectangle function (10 pts). Write a function that calculates the sum of all values within a rectangle of an image, given the integral image ii and a rectangle defined by x, y, width, and height. This should run in O(1) time, i.e., independent of the size of the integral image. a. Deliverable: unnormalized_score function (10 pts). Write a function that accepts an integral image and a HaarFeature object and returns the unnormalized score of that feature upon that integral image. This is slightly different from the unnormalized_score function in the Haar Features worksheet. Note that instead of a list of rectangles, you are given a HaarFeature object, which has one property, rectangles, containing a list of rectangles. Use the earlier function sum_rectangle as a subroutine. As a reminder, the score HFS of a Haar feature F consisting of multiple rectangles r with properties Tx Ty, Twidth, Theight, and Tweight upon an image window W is: HFS(W, F) = weight TEF Twidth-1 Theight-1 i=0 W[ra+j,ry + i] j=0 Activate Windows Go to Settings to activat b. Deliverable: normalized score function (15 pts). Write a function that calculates the normalized score, using the unnormalized_score function you wrote in 2a. Instead of normalizing first and computing the Haar feature on the normalized values, it is possible to calculate the unnormalized values and divide by the standard deviation and size afterwards. Recall the normalized expression NHFS(W, F) of a window W and Haar feature Fis NHFS(W, F) 1 HFS(W, F) W (x,y W[x, y]) - m 3 Cascading Classifiers Deliverable: cascading_classifier function (20 pts). Given a Cascade object, which represents several stages (each stage consisting of several stumps), an integral image, and the integral of the square image, apply the cascade to the image to determine whether the integral image represents a face or not. Use your function. normalized_score as a subroutine. 4 End-to-end performance Deliverable: end_to_end_classification function (30 pts). This function calls all your other functions to make sure they work together and classify faces from non-faces. Make sure all the other parts work first, because this last question depends on all of the previous three section.
Step by Step Solution
3.32 Rating (140 Votes )
There are 3 Steps involved in it
python def integralimageimg h w imgshape integralimg imgcopy Calculate the cumulative sum along the ... View full answer
Get step-by-step solutions from verified subject matter experts
