Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed

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

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions