Write a function called scale whose input is a matrix representingan image and t
ID: 3610782 • Letter: W
Question
Write a function called scale whose input is a matrix representingan image and the factor by which toscale the image’s brightness. This function returns anothermatrix representing an image. Use scalar
multiplication on all of the elements in the color image to scalethem all by the same factor. Call the
function scale for execution and choose a factor that would dim theimage by half i.e. Make all elements
in the matrix half of their original value. The function definitionis
function scaled_image = scale(input, factor)
The body of this function should only contain one line. DO NOT USEA FOR LOOP.
Explanation / Answer
function scale_image =scale(input, factor) scale_image = factor.*input;