Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read the function specifications completely before working on solution and please let me know how to attach image files. For the same question answered

Please read the function specifications completely before working on solution and please let me know how to attach image files.
For the same question answered before got the below errors:
Function 'flip' (no options) crashed on image 'blocks.png'.
Traceback (most recent call last):
TypeError: list indices must be integers or slices, not list
Function 'flip' (--vertical=True) crashed on image 'blocks.png'.
Traceback (most recent call last):
AttributeError: 'list' object has no attribute 'keys'
Same errors for rotate function too.
There are many post with incorrect answers for following 2functions:
please read parameter image as 2d dictionary/table of RGB objects and not image file and give the answers with code please:
RGB Object details:
This class represents a RGB (with optional alpha) color value. It is the core color value, and the one most supported by graphics packages. In particular, it has conversion methods for tkinter, kivy and PIL.
Constructor
class introcs.RGB(r, g, b, a=255)
An instance is a RGB color value.
All color value ranges are inclusive. So 255 is a valid red value, but 256 is not.
Parameters:
r (int 0..255) initial red value
g (int 0..255) initial green value
b (int 0..255) initial blue value
a (int 0..255) initial alpha value (default 255)
def flip(image,vertical=False):
"""
Returns True after reflecting the image horizontally or vertically.
All plug-in functions must return True or False. This function returns True
because it modifies the image. By default it reflects the image horizonally,
or vertically if vertical is True.
Parameter image: The image buffer
Precondition: image is a 2d table of RGB objects
Parameter vertical: Whether to reflect the image vertically
Precondition: vertical is a bool
"""
# We recommend enforcing the precondition for vertical
# Change this to return True when the function is implemented
def rotate(image,right=False):
"""
Returns True after rotating the image left of right by 90 degrees.
All plug-in functions must return True or False. This function returns True
because it modifies the image. By default it rotates the image left, or right
if parameter right is True.
To rotate left, transpose and then flip vertically. To rotate right, flip
vertically first and then transpose.
Parameter image: The image buffer
Precondition: image is a 2d table of RGB objects
Parameter right: Whether to rotate the image right
Precondition: right is a bool
"""
# We recommend enforcing the precondition for right
# Change this to return True when the function is implemented

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions