Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help. I am getting this error. Can you please send me the correct code? Thank you Ven Tools Education 12. Add Horl Terminal pictool.py

Please help. I am getting this error. Can you please send me the correct code? Thank you

image text in transcribed
Ven Tools Education 12. Add Horl Terminal pictool.py plugins py 138 if sepia= =True: Collapse ) 3. Add Image Flipping 139 for row in image: 140 for col in row: 141 col. green=int (0.6*col.green) 12. Add Horizontal Flipping 142 col.blue=int (0.4*col.blue) 143 return True Implement the function flip for the case vertical is False . You do not need to add an if- 144 145 statement yet. You can delay that until the next step. Read the specification for Flip for how to 146 def flip (image, vertical=False) : implement this function. 147 When you are done, you should try it out on the various test images. For example, the command 148 Returns True after reflecting the image horizontally or vertically. 149 158 All plug-in functions must return True or False. This function returns True 151 because it modifies the image. By default it reflects the image horizonally, python3 pictool.py flip Images/Walker.png Walker2-pog 152 or vertically if vertical is True. 153 154 Parameter image: The image buffer should perform the following conversion: 155 Precondition: image is a 2d table of RGB objects 156 157 Parameter vertical: Whether to reflect the image vertically 158 Precondition: vertical is a bool 159 168 # We recommend enforcing the precondition for vertical 161 # Change this to return True when the function is implemented 162 " if vertical = True: 163 image = image. transpose (method=Image. FLIP_TOP_BOTTOM) 164 image. save("vertical_transformation.png") 165 166 else: 167 image = image. transpose (method=Image . FLIP_LEFT_RIGHT) 168 image . save ("horizontal_transformation.png") 169 178 171 # open the image Important: It is very easy to get this function "off-by-one". That is why we recommend testing it on 172 ing = Image. open("1.png") 173 debug.py first. This image is small enough that you can follow any print statements that you add for 174 # Flip the original image vertically debugging 175 flip(ing, True) Check the Function 176 177 # Flip the original image horizontally You may run this test multiple times. Give this function several seconds to run. 178 flip(ing) 179 ing. close () Check It! 180 181 182 LAST RUN on 10121/2021, 1:24:23 504 183 def transpose (image) : X The module "plugins. py' crashed 184 Traceback (most recent call last) : 185 Returns True after transposing the image 186 NameError: name 'Image' is not defined 187 All plug-in functions must return True or False. This function returns True 188 because it modifies the image. It transposes the image, swaping colums and, favs 180 SAN (179:11) Python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions