Write a function that is given the original image img and returns the integral image. With...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
python def integralimageimg h w imgshape integralimg imgcopy Calculate the cumulative sum along the ... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
In this assignment, you are writing a program that converts common texting abbreviations to English words to allow people like yours truly can understand. For the assignment, you are provided with a...
-
Consider the following characteristic function of a 1-flip-flop circuit with inputs X, Y. (20 points) Q(t) is the current value of the flip-flop output and Q = Q(t+1) is the next value of the...
-
In Chapter 12 (p. 432), we described a study reporting that college students who are on Facebook (or have it running in the background) while studying had lower grades than students who did not use...
-
In Prob. 3.21, determine the perpendicular distance from point C to portion AD of the line ABAD. Problem 3.21: A small boat hangs from two davits, one of which is shown in the figure. The tension in...
-
Surveys have been widely used by politicians around the world as a way of monitoring the opinions of the electorate. Six months ago, a survey was undertaken to determine the degree of support for a...
-
Xie Company identified the following activities, costs, and activity drivers for 2017. The company manufactures two types of go-karts: deluxe and basic. Required 1. Compute a single plantwide...
-
W. C. Sanders, owner of Fort Engines, a producer of heavy-duty snow blower engines, needs to develop an aggregate plan for the coming year. The company currently uses 20 individuals working 160...
-
Each of the following actions, except for one, is considered subversion. Which of these answers is not a form of subversion? Reproducing exam material without authorization. Bringing a calculator...
-
A car is moving with a velocity of 20 m/s when the brakes are applied and the wheels lock (stop spinning). The car then slides to a stop in 40 m. Find the coefficient of kinetic friction between the...
-
Suppose that there are only two goods produced in an economy: haircuts and banking services. Now suppose that banking services in year 2 are not the same as banking services in year 1. Year 2 banking...
-
Your company doesn't face any taxes and has $200 million in assets, currently financed entirely with equity. Equity is worth $25 per share, and book value of equity is equal to market value of...
-
What are the advantages of cultural diversity within an organization and how can it gain a competitive advantage from the cultural differences?
-
What type of shares have no fixed face value noted on the stock certificates?
-
What are the advantages and disadvantages of having staff diversity in a healthcare organization? How does an understanding of organizational behavior improve the effectiveness of a culturally...
-
Consider the following table for different assets for 1926 through 2017. Series Average return Standard Deviation Large-company stocks 12.1% 19.8% Small-company stocks 16.5 317 Long-term corporate...
-
page 14 Exp. 9: Acid Base Titration Questions (show your work for the math problems!) 1. Write a balanced equation as in footnote 2 for the neutralization of formic acid with sodium hydroxide. H COON...
-
For the following arrangements, discuss whether they are 'in substance' lease transactions, and thus fall under the ambit of IAS 17.
-
Suppose two people want to see if they could benefit from trading with one another in a 2-good world. A: In each of the following cases, determine whether trade might benefit the two individuals: (a)...
-
Mortgage Interest Deductibility, Land Values and the Equilibrium Rate of Return on Capital: In the text, we suggested that the property tax can be thought of in part as a tax on land and in part as a...
-
Suppose two players are asked to split $100 in a way that is agreeable to both. A: The structure for the game is as follows: Player 1moves firstand he is asked to simply state some number between...
-
Why may some people consider this to be incorrect? That is, why is the fact that the control account is kept in the General Ledger not enough to justify saying that the control account is part of the...
-
From the following figures, compile accounts receivable ledger and accounts payable ledger control accounts for the month, and ascertain what the net balances of the respective ledgers should be on...
-
The financial year of The Better Trading Company ended on 30 November 2014. You have been asked to prepare a Total Accounts Receivable Account and a Total Accounts Payable Account in order to produce...
Study smarter with the SolutionInn App