Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVASCRIPT!!!! Write a function called blur that takes an image as an argument and returns a blurred copy of the argument image. To do

image text in transcribed

In JAVASCRIPT!!!!

Write a function called blur that takes an image as an argument and returns a blurred copy of the argument image. To do so, iterate over the (x, y)-coordinates and then independently consider the red, green, and blue components of each pixel's color. The red component of the pixel at (x, y) should be the mean of the red components of the five pixels to the left of (x, y), the five pixels to the right of (r, y), and the (x, y)pixel itself (i.e, the mean of 11 values). Update the blue and green components in the same manner. Note that to perform this operation correctly, you will need to make a copy of your image: writing to the input image directly while performing the blur operation will result in incorrect results (think about why, and write a unit test to check your code for this case!). You can use the copy0 function to make a copy of an input image as so: 4. let imageCopy inputImage.copy(); Note that you will have to deal with edge cases (literally!) in this assignment. Do something reasonable (not nothing!) to ensure that your code does not reference pixels outside the image, while producing reasonable values at the edges. Write a function called blur that takes an image as an argument and returns a blurred copy of the argument image. To do so, iterate over the (x, y)-coordinates and then independently consider the red, green, and blue components of each pixel's color. The red component of the pixel at (x, y) should be the mean of the red components of the five pixels to the left of (x, y), the five pixels to the right of (r, y), and the (x, y)pixel itself (i.e, the mean of 11 values). Update the blue and green components in the same manner. Note that to perform this operation correctly, you will need to make a copy of your image: writing to the input image directly while performing the blur operation will result in incorrect results (think about why, and write a unit test to check your code for this case!). You can use the copy0 function to make a copy of an input image as so: 4. let imageCopy inputImage.copy(); Note that you will have to deal with edge cases (literally!) in this assignment. Do something reasonable (not nothing!) to ensure that your code does not reference pixels outside the image, while producing reasonable values at the edges

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_2

Step: 3

blur-text-image_3

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

Entity Alignment Concepts Recent Advances And Novel Approaches

Authors: Xiang Zhao ,Weixin Zeng ,Jiuyang Tang

1st Edition

9819942527, 978-9819942527

More Books

Students also viewed these Databases questions