a) Write a program to change picture colors according to the following criteria: Your program L9Q1initials.py...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a) Write a program to change picture colors according to the following criteria: Your program "L9Q1initials.py" must start with a commented ID Box AND include a comment that indicates the purpose of the program. EACH function in your program must state its purpose in comments. Ensure you group your code into logical blocks and use comments to explain each block. Coding style is important! ● ● The main function in your program should be named: repair_picture () When >>> repair_picture() is called from the command line, the program should: (a) open up the picture 'bird_broken.png' (provided in Blackboard), (b) call the helper functions: repair_bottom (picture) repair_left (picture) (explained next), (c) show only the final picture to verify the changes. The helper function repair_bottom (picture) will: Adjust each color component on the bottom half of the image so it becomes: (255 - current color component) The helper function repair_left (picture) will: Swap the green and red components on the left half of the image if the blue component is greater than 100. Otherwise, do not modify them. The pictures below demonstrate how 'bird_broken.png' is transformed. Viewing the result after each successive transformation can help you verify whether the transformation was done correctly. However, when your program is submitted for marking it should only show the final picture (which includes both transformations). Original version of 'bird_broken.png' After performing repair_bottom Final: After both repair_bottom and repair_left VEYS DANE 2 92 a) Write a program to change picture colors according to the following criteria: Your program "L9Q1initials.py" must start with a commented ID Box AND include a comment that indicates the purpose of the program. EACH function in your program must state its purpose in comments. Ensure you group your code into logical blocks and use comments to explain each block. Coding style is important! ● ● The main function in your program should be named: repair_picture () When >>> repair_picture() is called from the command line, the program should: (a) open up the picture 'bird_broken.png' (provided in Blackboard), (b) call the helper functions: repair_bottom (picture) repair_left (picture) (explained next), (c) show only the final picture to verify the changes. The helper function repair_bottom (picture) will: Adjust each color component on the bottom half of the image so it becomes: (255 - current color component) The helper function repair_left (picture) will: Swap the green and red components on the left half of the image if the blue component is greater than 100. Otherwise, do not modify them. The pictures below demonstrate how 'bird_broken.png' is transformed. Viewing the result after each successive transformation can help you verify whether the transformation was done correctly. However, when your program is submitted for marking it should only show the final picture (which includes both transformations). Original version of 'bird_broken.png' After performing repair_bottom Final: After both repair_bottom and repair_left VEYS DANE 2 92
Expert Answer:
Answer rating: 100% (QA)
import numpy as np import matplotlibpyplot as plt def repairbottompicture heightwidthpictureshape n... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
For what values of t is each function in Problem 9 continuous? a. b. (|| ]Denotes the greatest integer function.) c. r(1) = [12] i- V20-1 j + 3k
-
For what values of t is each function in Problem 10 continuous? a. r(t) = ln(t - 1)i + 20 - t j b. r(t) = ln(t-1)i + tan-1 tj + t k c. r(t
-
Blocks A and B each have a mass of 0.4 kg and block C has a mass of 1.2 kg. The coefficient of friction between the blocks and the plane is k = 0.30. Initially block A is moving at a speed v0 = 3 m/s...
-
- A large, open bucket of water sits on a table. The height of the water level in the bucket is 4 m above the surface of the table. A small hole is made in the bucket at a distance of 10 cm above the...
-
Consider the following time series. a. Construct a time series plot. What type of pattern exists in the data? b. Using Minitab or Excel, develop the quadratic trend equation for the time series. c....
-
W8 video Lecture 3 "contracts: Capacity, Consent, and Legality" W8 Discussion "Review and Reflection" Review and Reflection Review and reflect on that you learned in the past 8 weeks. What is the...
-
Define the following: a. Asset b. Liability c. Net asset
-
(One Temporary Difference, Tracked 3 Years, Change in Rates, Income Statement Presentation) Crosley Corp. sold an investment on an installment basis. The total gain of $60,000 was reported for...
-
ESG CSR Study caseSunset Manufacturing Inc. manufactures Umbrellas in the Western Canadian market, and is comparing the budget for the current year with the actual results. The market has been good...
-
It is January 2 and Twin Pines Farm is putting together its annual net worth statement Following are a nurmher of pieces of information they have collected. Help them fit it all together using the...
-
What are the three types of organizations that help local governments achieve their sustainability goals?
-
In what circumstances does a partner recognize gain on receipt of a proportionate distribution from a partnership?
-
Are taxpayers allowed to claim the additional old-age or blindness standard deduction for dependents?
-
What exemption amounts are allowed to an estate, simple trust, and complex trust?
-
What are the two delinquency penalties?
-
Define the term "vesting" and identify the two vesting methods that are available to employer-sponsored qualified plans.
-
(b) A small mass m and a heavy mass M are connected to the ends of an inextensible string. The string is threaded through a glass tube as shown in Fig. 5.1. The tube is then held by a student and is...
-
Feller Company purchased a site for a limestone quarry for $100,000 on January 2, 2019. It estimate that the quarry will yield 400,000 tons of limestone. It estimates that its retirement obligation...
-
For each of the following six program fragments: a. Give an analysis of the running time (Big-Oh will do). b. Implement the code in Java, and give the running time for several values of N. c. Compare...
-
Consider the following algorithm for sorting six numbers: Sort the first three numbers using Algorithm A. Sort the second three numbers using Algorithm B. Merge the two sorted groups using...
-
Can leftist heaps efficiently support decreaseKey?
-
Fill in the blanks to make the following statements correct. a. Economists have designed____________ to better explain and predict the behaviour we observe in the world around us. b. A variable, such...
-
The following supply and demand schedules describe a hypothetical Canadian market for potash. a. What is the equilibrium price of potash? b. How much potash would actually be purchased if the price...
-
According to Statistics Canada, Canada's exports and imports of energy (combined totals of fossil fuels, hydro, and nuclear, all measured in petajoules) over a five-year period were as follows: a....
Study smarter with the SolutionInn App