Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview In this assignment, you will be implementing different image filters that modify the pixels of the image in some interesting ways. The filters you
Overview
In this assignment, you will be implementing different image filters that modify the pixels of the image in some interesting ways. The filters you will be implementing are the same ones used in image editing applications and apps like Instagram however you will implement basic ones While doing so you will learn how images are stored and manipulated in a computer and you will get much more comfortable working with nested loops.
Representing Images and Colors
As you learned in class, colors can be represented by three numbers describing the values of the red, green, and blue color components. These numbers are in the range In this assignment, we will use a Dimensional list whose elements are tuples to represent an image. We will also work with the CSEAImage library created by the course staff which makes it easy to create new images and to query its properties.
D Lists
One way to think of D lists is as a matrix. And just like with matrices, the first dimension represents the rows and the second dimension the columns. The CSEAImage library has functions defined to query for the image height and width. The height of an image corresponds to the number of rows and the width of the number of columns. Also, remember that the topmost row is at index and the bottommost row at index height Similarly, the leftmost column is at index and the rightmost column at index width
STEP A: Downloading Starter Code
To get started, first download the starter code here. Click on the dropdown at the top that says PA Starter Code and then download. This will download a zip file. Unzip it and you are good to go You will only modify the papy and patest.py files. Please do NOT modify the contents of the CSEAImage.py file.
Note: If you are not logged into Google, you will see a different interface. In this case, there will be a button on the topright corner reading Download All Click that button.
IMPORTANT: DO NOT change the original folder structure, that is DO NOT renamemove files around. All the files should be in the same folder with the given names.
You may add more images into the images folder for testing.
STEP B: Installing NumPy and pillow packages
In the CSEAImage Library provided in the starter code, you may see that we have imported packages called NumPy and PIL. In order for you to be able to utilize the given library, your system should have these packages installed. Otherwise, you will get a ModuleNotFoundError message.
Follow these instructions carefully to install NumPy and pillow packages.
To find the path where you need to install these packages run the below two commands the commands that follow on the IDLE Python shell and you can see that it prints the path where you need to install the packages In the example below the path is: C:UserswinnyAppDataLocalProgramsPythonPython
Commands:
import sys
printsysexecutable
Example:
Open Command Prompt on Windows or terminal on Mac and navigate to the path printed out in the IDLE shell using the cd command as shown below. Make sure that you do not navigate all the way to the last file, but only to the last directory. In the above example, we will navigate to the Python directory
Command:
cd
Example For Windows:
Example For MAC:
When you go into idle and type the sys command and printsysexecutable you may get something similar to below on MAC machines:
LibraryFrameworksPythonframeworkVersionsbinpython
Make sure that you do not navigate all the way to the last file, but only to the last directory, because python is a file, not a folder. So when you are running the cd command on the terminal of MAC machine, run it as:
cd LibraryFrameworksPythonframeworkVersionsbin
Note: If you see before you run a command, that means you navigated to the last file rather than bin, so make sure you navigate to the last directory, not file see above
After navigating to the correct Python path, run the below command on the command prompt in Windows or the terminal in Mac to ensure that you have pip installed.
Command For Windows:
python m ensurepip
Command For Mac:
pythonm ensurepip
Example:
Once pip is installed, you can install the numpy and pillow packages as follows using the pip command in the same path as shown below. The packages will now be downloaded to your local machine if it is not present
Command For Windows:
python m pip install numpy
python m pip install pillow
Command For Mac:
pythonm pip install numpy
pythonm pip install pillow
Example:
Note that if the package has been installed previously on your machine then it will say Requirement already satisfied otherwise it will say Downloading and once the download is complete you will be able to use these packages. You can disregard warning messages, if any.
STEP C: Unde
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