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
-
On September 1, Year 3, Geco Co. sold $40,000 of goods and accepted a one-year, 12% note. b. If no reversing entries were made after December 31, Year 3, and adjusting entries were made on December...
-
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...
-
Calculate the force of gravity a newborn baby (mass 3.0 kg) and the planet Mars (mass 6.4 10 23 kg) exert on each other when Mars is at its closest to Earth (distance 5.6 10 10 m).
-
Refer to the situation described in BE 8-6. SAM uses a perpetual inventory system. Calculate ending inventory and cost of goods sold for January using (1) FIFO, and (2) average cost. In BE 8-6...
-
One interesting property of digital assets is that they can be reproduced and dis tributed via the Internet at very little cost. What are some of the implications of having a product with a marginal...
-
Exacto Company reported the following net income and dividends for the years indicated: True Corporation acquired 75 percent of Exacto's common stock on January 1, 20X5. On that date, the fair value...
-
You are required to conduct an analysis of specific financial data of Bob Smith, Inc. Bob is an existing bank customer. When the loan to Bob was originally made in 2 0 1 6 , the bank required Bob to...
-
Jaguar Plastics Company has been operating for three years. At December 31 of last year, the accounting records reflected the following: Cash Investments (short- term) Accounts receivable Inventory...
-
Explain what the text of this carton means to you. WHEN I WENT TO SCHOOL ( THE MEN WHO OPENED THE WEST WERE GIANTS- I LEARNED GEORGE WASHINGTON NEVER TOLD A LIE AND WE WON EVERY WAR BECAUSE GOD WAS...
-
17 1 point Compute dy for y = (2x+5) 11. Show all work and your final answer using the html equation editor. BIUA A 12pt Paragraph GJ
-
ABC in Casales of 487,600 total equity of 367,700 a profit margin of 5.1% in a debt equity ratio of .34. What is the return on assets
-
Valenzuela, Incorporated, has a cash cycle of 44 days, an operating cycle of 64 days, and an Inventory period of 27.5 days. The company reported cost of goods sold in the amount of $343,000, and...
-
William wishes to save enough money to purchase a retirement lake cabin. He is willing to spend $200,000 for the cabin and he can save $20,000 per year and invest the money into an account earning...
-
20 1 point Suppose that f(5) = ' (5) = g(5) = g'(5) = 3. Is this enough information to compute h' (5) where h(x) = f(g(x))? Why or why not? Previous BIUA A E 12pt Paragraph B fx Submit
-
Langford Co. issued 14-year bonds a year ago at a coupon rate of 8.8%. The bonds make semiannual payments. If the YTM on these bonds is 7.1%, what is the current bond price? (Do not round...
-
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...
-
The following information is taken from the annual report of the Couche Corporation. Calculate the ratio of the allowance for uncollectible accounts divided by gross accounts receivable. Did this...
-
Charles Smith, Inc., is a manufacturer of small office equipment. Smith transacts most of its business on credit and offers its customers credit terms of 2/10, n/30. On July 1, Smith shipped an order...
-
M. Beall Inc. uses the aging method to estimate the companys bad debt expense. Mike Beall, the president of the company, collected information about the companys outstanding accounts receivable and...
Study smarter with the SolutionInn App