Question: With Javascript 1. Write a function called imageMapXY with the following type: imageMapXY(img: Image, func: (img: Image, x: number, y: number) => Pixel): Image The

With Javascript With Javascript 1. Write a function called imageMapXY with the following type:

1. Write a function called imageMapXY with the following type: imageMapXY(img: Image, func: (img: Image, x: number, y: number) => Pixel): Image The result must be a new image with the same dimensions as img. The value of each pixel in the new image, should be the result of applying func to each pixel of img. Your function will have use either lib220.createImage or image.copy to create a new image, or make a copy of the original. Note that the fillcolor parameter for lib220.createImage needs to be a pixel value. The figure on the right shows an example output of using the imageMapXY function as follows: let url = 'https://people.cs.umass.edu/~joydeepb/robot.jpg'; let robot = lib220.load ImageFromURL(url); imageMapXY(robot, function(img, x, y) { const c = img.getPixel(x, y); return [C[0], 0, 0]; }).show(); 1. Write a function called imageMapXY with the following type: imageMapXY(img: Image, func: (img: Image, x: number, y: number) => Pixel): Image The result must be a new image with the same dimensions as img. The value of each pixel in the new image, should be the result of applying func to each pixel of img. Your function will have use either lib220.createImage or image.copy to create a new image, or make a copy of the original. Note that the fillcolor parameter for lib220.createImage needs to be a pixel value. The figure on the right shows an example output of using the imageMapXY function as follows: let url = 'https://people.cs.umass.edu/~joydeepb/robot.jpg'; let robot = lib220.load ImageFromURL(url); imageMapXY(robot, function(img, x, y) { const c = img.getPixel(x, y); return [C[0], 0, 0]; }).show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!