Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

from CSE 8 AImage import * from pa 5 import * RGB codes for common colors. You can add on to this

from CSE8AImage import *
from pa5 import *
"""
RGB codes for common colors. You can add on to this
if you want to experiment with different colors.
"""
black =(0,0,0)
white =(255,255,255)
red =(255,0,0)
green =(0,255,0)
blue =(0,0,255)
yellow =(255,255,0)
magenta =(255,0,255)
gray =(128,128,128)
purple =(128,0,128)
def test_complement():
# TEST CASE 1:
# Create a 100*100 image of magenta color and visualize it
test_img1= create_img(100,100, magenta)
save_img(test_img1, "magenta_test_img1.jpg")
# View the pixel values of the original image
img_str_to_file(test_img1, "magenta_test_img1.txt")
# Call complement and visualize the resulting image
result1= complement(test_img1);
save_img(result1, "complement_result1.jpg")
# View the pixel values of the filtered image
img_str_to_file(result1, "view_complement_pixels.txt")
# TEST CASE 2:
# Load the cat image given and call complement on it
cat = load_img("images/cat.jpg")
img = complement(cat)
save_img(img, "complement_cat.jpg")
# TEST CASE 3:
# TODO: Add test case for complement function using a self created image similar to Test Case 1
def test_negative():
# TEST CASE 1:
# Create a 100*100 image of red color and visualize it
test_img1= create_img(100,100, red)
save_img(test_img1, "red_test_img1.jpg")
# View the pixel values of the original image
img_str_to_file(test_img1, "red_test_img1.txt")
# Call negative and visualize the resulting image
result1= negative(test_img1);
save_img(result1, "negative_result1.jpg")
# View the pixel values of the filtered image
img_str_to_file(result1, "view_negative_pixels.txt")
# TEST CASE 2:
# TODO: Add test case that loads the cat image given and calls negative filter on it
# TEST CASE 3:
# TODO: Add test case for negative function using a self created image similar to Test Case 1
"""
Calling the Test functions one after the other.
You may want to uncomment one test at a time.
OPTIONAL: You can add tests for the custom filters you have
created as part of Star points.
"""
#test_complement()
#test_negative()

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

How do I feel just after I give in to my bad habit?

Answered: 1 week ago