1

Color Shifting - Right

Unsolved
Computer Vision

Difficulty: 6 | Problem written by mesakarghm
Problem reported in interviews at

Apple
Facebook
Google
Netflix

Color shifting is the process of shifting the values in the color channels of an image. A right color shift in an RGB image would work like: 

  1. Red -> Green
  2. Green -> Blue
  3. Blue -> Red

Because gray-toned values have RGB values that are identical (or nearly identical), color shifting doesn’t change the appearance of gray pixels. 

Implement a function color_shifting(image) which takes in an image as the argument (3D NumPy array) and returns the right color shifted output image (3D NumPy array).

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'>
[[[ 12. 33. 111.] [ 15. 16. 44.]] [[ 98. 19. 75.] [131. 112. 120.]] [[141. 15. 13.] [127. 183. 16.]]]

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.

Pariatur totam facere at porro maxime omnis obcaecati beatae consectetur dolorum alias, rem nam tempore dicta commodi nemo reprehenderit non quibusdam qui tenetur, amet suscipit illum, odio illum blanditiis natus alias voluptatibus quisquam impedit quos ducimus voluptate veniam, repellendus dolor laudantium deleniti ducimus impedit repellat quae quos error magni sit? Dignissimos distinctio saepe architecto maxime impedit tenetur, odio accusamus officiis illum nobis nemo nam unde, molestiae dolorem minus animi tempora molestias doloremque odit? Sint provident beatae tempora, earum eius id natus quo, impedit reprehenderit facere aliquam magnam alias vitae distinctio excepturi blanditiis temporibus dicta, iusto maxime officiis fuga repellendus veniam cupiditate quod libero?

Commodi exercitationem reiciendis numquam architecto tenetur quam dignissimos laborum quibusdam, labore consequuntur error vero? Rem aliquid amet corrupti, ratione debitis magni sunt ad cupiditate, voluptatem alias doloribus tempore, consequuntur nisi laborum dolor dicta rerum nam, animi ad velit nobis deleniti vero quisquam.

Totam quaerat veniam earum officia, necessitatibus ipsam tempora dicta vel delectus sunt aperiam et omnis qui, ab molestiae quia dolores quasi officia esse ullam nisi incidunt magni facilis.

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)