Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 1 : Update the data type of img to float 6 4 and call it Q 1 . Q 2 : Multiply each element
Q:Update the data type ofimgtofloatand call itQ
Q:Multiply each element in theQarray by and call this new arrayQ
Q:
Create a NumPy array calledarrof the following five values:
Use the NumPy's sum method to add all the values together and store as a variable calledtotal Do not hard code the answer by manually adding the numbers in your head. Use NumPy functions or you may be counted off during a review of the assignment.
Add this total to every element of theQarray and call this new arrayQ
Q:Add the Q array to itself example: array array and call it Q This will add the corresponding values in each cell to each other.
Q:Subtract from the first item in theQarray from the nd item, from the rd item...n from the nthitem and call the new arrayQ You shouldnotdo this using any type of loop as that wouldn't be efficient. Hint: Think about creating a second array that could be used in combination with the first array to complete the task.
Q:Copy theQarray and call the new arrayQthis step makes sure that we are working with a copy instead of a view of the previous array Update the th element in theQarray toCareful: Remember that Python is zero based index.
Q:Copy theQarray and call the new arrayQ Select the indices fromtoincluding the element in theindex and the indices fromtoincluding the element in theindex inQand addto only those values.
Hint:Remember that you can do this in two steps:
Step Update the first set of indices
Step Update the second set of indices.
Also remember that Python is zero based index.
As an example, if I wanted to addto the values in the indices fromtoincluding the element in theindex I could write my code as follows:
Q:Copy theQarray and call the new arrayQ Reshape theQarray to a twodimensional, twocolumn array.
Q:Copy theQarray and call the new arrayQ Swap the two columns from thisQarray In other words, the first column will now be the second and the second column will now be the first.
Q:Copy theQarray and call the new arrayQ Reverse the order of the rows of theQarray
Q:Copy theQarray and call itQ SetQs st row asCareful: Remember that Python is zero based index
Q:Copy theQarray and call itQ Set thefirst elementinQsst row to The second element in that row should remain unchanged.Careful: Remember that Python is zero based index
Q:Copy theQarray and call itQ Subtract from every element in thesecond columnforQ
Q:Copy theQarray and call itQ Take the square root of every element in thefirst columnofQ
Q:Copy theQarray and call itQ Change any value in theQarray that is currently and set it to
Q:
Copy theQarray and call itQ
Take the transpose of theQarray
Subtract from the first column of all rows.
Take the transpose of the array again this puts it back in its original state making sure that all the changes are saved asQ
Q:Copy theQarray and call itQ Reshape theQarray to Note: the values in each row are the RGB values for every pixel of the picture.
Q: Copy the Q array and call it Q Cast the entire Q array as an int
Q:Run the code below to plot your array below.
Q:Create a variable calledQthat is a string of the phrase in the picture include punctuation but not the name of the author You can of course hard code this string.
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