Homework

Homework

# Many image manipulation operations (such as blurring, edge

Customer Question
detection etc) can be expressed...
Many image manipulation operations (such as blurring, edge detection etc) can be expressed universally as a convolution with a filter (different filters will represent different operations). The filter is a "table" of coefficients (we will represent it as a list of lists) which specifies how the nearby pixels need to be combined. We will assume for simplicity that width and height of our filters are always odd and that the center of the filter is placed on the "current pixel". The remaining elements of the table thus specify pixels relative to the current one. Here's the example:
blur = [ [ 0 , 1 , 0 ],
[ 1 , 1 , 1 ],
[ 0 , 1 , 0 ] ]
This filter is interpreted as follows: for each and every pixel at position x, y, we have to take that pixel's value (central cell of the filter), as well as values of the nearest pixels on the left , right, up, and down (i.e. (x-1,y), (x+1,y), (x,y-1), (x, y+1) ) and sum them all up with coefficients equal to 1. Of course we need to do this in each color channel. You can easily see that such operation, when applied to each an every pixel (x,y) in the image is almost precisely the blur operation discussed in your textbook and lecture slides, except that the previous blur function used the *average* (i.e. the sum of the pixels was divided by 5, the total number of pixels in each sum); we can (and should) do this when using the filter as well, so we could set non-zero elements to 0.2 instead of 1, or we can introduce an overall factor as described later.
Another filter might look as
motion_blur = [ [ 1, 0, 0, 0, 0 ],
[ 0, 1, 0, 0, 0 ],
[ 0, 0, 1, 0, 0 ],
[ 0, 0, 0, 1, 0 ],
[ 0, 0, 0, 0, 1 ] ]
Here the filter prescribes to sum each pixel at (x,y) with pixels at (x-1, y-1), (x-2, y-2), (x+1, y+1), and (x+2, y+2).
Your goal is to implement a function
filterImage(image, filter, factor, bias).
The defaults for factor and bias should be 1 and 0 respectively; the parameter image will take an object of class Image, and filter will be an arbitrary matrix (list of lists) similar to ones shown above.
The function will start by making a copy of the image. Then the copied image will be updated as follows (pseudocode):
for each x along the image width:
for each y along the image height:
assuming the filter is centered at pixel (x,y)
sum up the values of pixels from the original image as prescribed by the filter (using coefficients from the filter);
(you will need to loop over filter dimensions and extract those pixels!)
( you will need to do this in each color channel, either separately line by line or using fancier tricks as showcased in your textbook)
upon summation, multiply the result, in each channel, by the factor (so e.g. for the "blur" filter above, with all 1's, we could simply specify factor=1/5)
add bias to the result, also in each color channel
do not forget that color intensities must be integer
make sure the intensities are >= 0 and <= 255 (if not, trim back to the allowed range)
set the so obtained pixel value (three color intensities) as the value of the pixel (x,y) in the copied image
return the copied and modified image
You may want to start implementing the solution from the very inner (filter) loops. Assume that you are looking at pixel at x,y and that it's at the center of the filter. Write loops over filter width and height that would sum up all the neighboring pixels around the fixed pixel x, y, with the required coefficients. Now put this code inside the "main" outer loops that traverse the image itself (i.e. iterate over pixels x, y). In those loops, make sure you have correct ranges for x and y (you have to leave enough space on left/right/top/bottom to be always able to look at neighboring pixels as prescribed by a given filter: for instance if you traverse all the way from 0 to width, then you cannot look at pixels to the left when x = 0 and you cannot look at pixels to the right when x = width-1!)
Remember, this problem is very similar to the examples considered in class/textbook: you are still traversing the whole image; in the in-class examples, for each pixel (x,y) we "see" during the traversal we were manually pulling few nearby pixels, adding them up etc (and we had to have different functions when we wanted to combine different patterns of nearby pixels). Here, for each pixel (x,y) we just want to run additional traversal of the filter table itself that will automatically pull and combine whatever nearby pixels the filter prescribes.
Submitted: 1 year ago.Category: Homework
Show More
Show Less
Customer reply replied 1 year ago
The question is too long so I attached a text file instead. Thanks.
4/3/2016
Tutor: Mr. Gregory White, Professor replied 1 year ago
Category: Homework
Satisfied Customers: 5,240
Experience: M.A., M.S. Education / Educational Administration
Verified
Hello, my name is ***** ***** this might be time sensitive.Do you still need this answered?
Customer reply replied 1 year ago
yes I do.
Customer reply replied 1 year ago
Do you know approximately how long is this going to take? Thanks!
Tutor: Mr. Gregory White, Professor replied 1 year ago
After going through my resources, I do not have what is necessary to complete at this time.I am opting out and opening up to the other professionals and messaging a couple who might be able to help. Someone should be with you shortly.
Category: Homework
Satisfied Customers: 3,040
3,040 Satisfied Customers
Experience: MIT Graduate (Math, Programming, Science, and Music)

Scott is online now

A new question is answered every 9 seconds

• Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
• Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

## What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

## Meet the Experts:

LogicPro

Engineer

5,672 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Tutor

4,549 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

M.S.W. Social Work

2,635 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

Chartered Accountant

2,158 satisfied customers

Experience with chartered accountancy

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
I asked a question and will pay but the site asks me to
hi i asked a question and will pay but the site asks me to verify an ammount below 200 usd which i want to but it does not give me the option to do so, please help… read more
GLENN
Master of Mathematics
330 satisfied customers
Which if the following is not included unpaid-in capital?
which if the following is not included unpaid-in capital? common stock pain-in capital-donations stock dividend distributable appropriation per loan agreement … read more
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,158 satisfied customers
This question is just for Dr. Kakonge. This purpose is to
Hello. This question is just for Dr. Donna Kakonge.This purpose is to pay the payment to Dr. Donna Kakonge on 06/16/2017 again because of something wrong about payment on 06/16/2017.The question on 06… read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
On Excel contour map want to: 1) rotate series 180 degrees
On Excel contour map want to: 1) rotate series 180 degrees but not category 2) edit series name for all 3) edit legend 4) fill in colour boxes 5) change colour boxes to meet colorirmetric convention.… read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
A rifle with a longer barrel can fire bullets with a larger
A rifle with a longer barrel can fire bullets with a larger velocity than a rifle with a shorter barrel. A. Explain this using the impulse momentum theorem B. Explain this using the work energy theore… read more
GLENN
Master of Mathematics
330 satisfied customers
I need to get an answer of the case Conveyor Belt Project.
I need to get an answer of the case Conveyor Belt Project … read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
Where is the status bar? Im so sorry to be in a rush but if
where is the status bar? Im so sorry to be in a rush but if i fail my exam i have to redo my year … read more
The-PC-Guy
Bachelor\u0027s Degree
628 satisfied customers
A recent survey found that 73% of all adults over 50 wear
A recent survey found that 73% of all adults over 50 wear sunglasses for driving. In a random sample of 20 adults over 50, what is the mean and standard deviation of those that wear sunglasses?… read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
Is anyone familiar with Excel??? The link below will take
Is anyone familiar with Excel??? The link below will take you to my question. It is due 02/14/10 Sunday night , but the sooner the better. You will see "1: Five-Year Sales Projections" that is what I … read more
Stephen, MBA
Master's Degree
166 satisfied customers
160 Word min.: Consider the internal control process
160 Word min.: Consider the internal control process required by the Sarbanes-Oxley Act. Do you think the expenses of implementing better internal controls are offset by the benefits of having the con… read more
Jane T(LLC)
Master's Degree
18 satisfied customers
I would ask this in homework but I think this is out of
Hi,I would ask this in homework but I think this is out of their area of expertise. How much to answer these 40 electrician trade school questions from Penn foster. This is their NEC graded project wh… read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
I have questions on teh fundamental accounting principles
I have questions on teh fundamental accounting principles book nineteenth edition. chapter 11. if you do hit me up… read more
Brittany
Bachelor\u0027s Degree
102 satisfied customers
I see you have already done this project but i dont see the
hello i see you have already done this project but i dont see the essay part of it or the brainstorm page it needed done,i am in need of these asap,if you can contact me that would be great,thnx “Evil… read more
Bachelor\u0027s Degree
77 satisfied customers
I need help on how to figure out this problem, I am having
Hello, I need help on how to figure out this problem … read more
GLENN
Master of Mathematics
330 satisfied customers
How many words per minute does the average person think? How
Good afternoon, how many words per minute does the average person think? … read more
GLENN
Master of Mathematics
330 satisfied customers
Section 1 – Objectives: Provide a brief summary of the
Section 1 – Objectives: Provide a brief summary of the project. • Section 2 – Task 1: Basic Web Tracking Mechanism: Summarize your efforts to investigate web tracking, including the screenshots you to… read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
I need help implementing expectation maximization algorithm
I need help implementing expectation maximization algorithm in python … read more
Dr. Donna Kakonge
Doctor of Education
187 satisfied customers
I have 3 more if you want them, i have to pick a heroine,
i have 3 more if you want them, i have to pick a heroine, and do these assignments, let me know, and let me know what its worth, when this one is done, i will send you the other two, and pay seperatel… read more