Answered step by step
Verified Expert Solution
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 CSEAImage import
from pa import
RGB codes for common colors. You can add on to this
if you want to experiment with different colors.
black
white
red
green
blue
yellow
magenta
gray
purple
def testcomplement:
# TEST CASE :
# Create a image of magenta color and visualize it
testimg createimg magenta
saveimgtestimg "magentatestimgjpg
# View the pixel values of the original image
imgstrtofiletestimg "magentatestimgtxt
# Call complement and visualize the resulting image
result complementtestimg;
saveimgresult "complementresultjpg
# View the pixel values of the filtered image
imgstrtofileresult "viewcomplementpixels.txt
# TEST CASE :
# Load the cat image given and call complement on it
cat loadimgimagescatjpg
img complementcat
saveimgimg "complementcat.jpg
# TEST CASE :
# TODO: Add test case for complement function using a self created image similar to Test Case
def testnegative:
# TEST CASE :
# Create a image of red color and visualize it
testimg createimg red
saveimgtestimg "redtestimgjpg
# View the pixel values of the original image
imgstrtofiletestimg "redtestimgtxt
# Call negative and visualize the resulting image
result negativetestimg;
saveimgresult "negativeresultjpg
# View the pixel values of the filtered image
imgstrtofileresult "viewnegativepixels.txt
# TEST CASE :
# TODO: Add test case that loads the cat image given and calls negative filter on it
# TEST CASE :
# TODO: Add test case for negative function using a self created image similar to Test Case
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.
#testcomplement
#testnegative
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started