0

Negative Transformation

Unsolved
Computer Vision

Difficulty: 3 | Problem written by mesakarghm
The Negative Transformation is an image inverting transformation where the output pixel can be calculated as: 

\(s = L-1-r\)

where s is the output pixel, L is the largest value in the color space, and r is the input pixel. 

For an RGB image (represented by a 3D NumPy array), perform aa negative transformation on the image and return the resultant image.  Make sure that the shape of the output image is same as that of the input image.

Sample Input:
<class 'numpy.ndarray'>
image: [[[111 12 33] [ 44 15 16]] [[ 75 98 19] [120 131 112]] [[ 13 141 15] [ 16 127 183]]]

Expected Output:
<class 'numpy.ndarray'>
[[[144 243 222] [211 240 239]] [[180 157 236] [135 124 143]] [[242 114 240] [239 128 72]]]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Fuga magni aliquid ad at, sit maxime mollitia odio? Assumenda possimus facere, nam a voluptate ea id dolorem voluptatum voluptatibus rem aperiam recusandae, ipsum officia voluptatem optio veritatis quam dicta beatae temporibus expedita, in eius cum quod fugit at alias? Fugiat sed veritatis fuga aut ad perspiciatis aliquid non, fugiat reiciendis delectus ipsum natus sit eveniet aliquid, dolor sunt fugiat adipisci distinctio, tempore beatae velit eligendi quis assumenda cumque quaerat delectus?

Nulla laboriosam voluptas impedit sapiente fugit deserunt officia eum nihil, numquam explicabo culpa, nesciunt ut eum quis minus, quod quae deleniti quaerat incidunt facilis soluta delectus laudantium assumenda voluptatum perferendis, quae rerum error necessitatibus tenetur ut accusamus porro.

Consequatur dignissimos quos asperiores? Saepe veniam earum dolorem sed delectus vitae porro nihil hic repudiandae aut, veniam odit mollitia iure tempore nihil aliquid non numquam deserunt sit?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)