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...
-
"Several of our divisions say they get tremendous help from their vendors when it comes to increasing the speed of our new product work. But, to tell you the truth, I think they're just lazy. They've...
-
Gainsborough Fashions Ltd operates a small chain of fashion shops. In recent months the business has been under pressure from its suppliers to reduce the average credit period taken from three months...
-
Suppose that you initially invested \($10,000\) in the Stivers mutual fund and \($5,000\) in the Trippi mutual fund. The value of each investment at the end of each subsequent year is provided in the...
-
Vargas Corporation is authorized to issue 20,000 shares of $50 par value, 10% preferred stock and 125,000 shares of $3 par value common stock . On January 1, 2010, the ledger contained the following...
-
(a) A wooden sphere with a diameter of d = 0.14 m (density? = 0.40 g/cm3) held under water by a string. What is the tension (in N) in the string? Note: Draw the free body diagram. (Assume the density...
-
Elwood is a pig farmer who is known to enjoy a drink or two. One day in July, after a weekend of particularly heavy drinking, he staggered into the office of Pork Bellies of America and offered to...
-
if policy tools like required reserves, discount rate, and open market operations are used to increase the feds interest rates by 25 basis points what does this mean for the policy instruments...
-
Group the data given in the table into the following groups: $351,000400,000; 401,000450,000; 451,000500,000; 501,000550,000; 551,000600,000; 601,000650,000; 651,000700,000; over 701,000. Use the...
-
Olena Mirrors records bad debt using the allowance, income statement method. They recorded $343,160 in accounts receivable for the year and $577,930 in credit sales. The uncollectible percentage is...
-
Under Subchapter K, the partnership files Form 1065 reporting its income to the IRS. Which statement is true? a. The partners pay income tax on the portion of that taxable income that is distributed...
-
What is the output of the following? A. 2 2 B. 2 3 C. 3 2 D. 3 3 E. The code does not compile. F. The code compiles but throws an exception at runtime. var listing = new String[] [] { { "Book",...
-
What is the result of compiling and executing the following application? A. 0 1 B. 1 1 C. 1 2 D. 2 2 E. The code does not compile. F. The code compiles but produces an exception at runtime. package...
-
What is Fault Tolerance. Explain classification of Component faults. Explain technique to handle Redundancy.
-
Could a set of three vectors in span all of? Explain. What about n vectors in when n is less than m? R4
-
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...
-
For the composite properties and environmental conditions described in Examples 3.6, 4.7, and 5.3, determine the hygrothermally degraded values of the longitudinal and transverse tensile strengths....
-
The filament-wound E-glass/epoxy pressure vessel described in Example 4.4 is to be used in a hot-wet environment with temperature \(T=100^{\circ} \mathrm{F}\) \(\left(38^{\circ} \mathrm{C} ight)\)...
-
A carbon/epoxy lamina is clamped between rigid plates in a mold (Figure 5.17), while curing at a temperature of \(125^{\circ} \mathrm{C}\). After curing, the lamina/mold assembly (still clamped...
Study smarter with the SolutionInn App