Local Standardization

Computer Vision

Difficulty: 2 | Problem written by mesakarghm
Pixel Standardization is used to transform the distribution of pixel values to be a standard Gaussian with a mean of 0.0 and a standard deviation of 1.0.

In Local Standardization, the mean and standard deviation of the image are calculated per channel, and these values are used separately in each channel to standardize the pixel values. 

Write a function def local_standardization(image), which takes in an rgb image as input (3D numpy array) and performs local standardization on it. The shape of the output image should be exactly the 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'>
[[[ 0.7229127 -1.0737823 -0.6926652 ] [-0.49303246 -1.019337 -1.0011886 ]] [[ 0.06956904 0.48698306 -0.9467433 ] [ 0.88624865 1.0858815 0.74106115]] [[-1.0556339 1.2673658 -1.019337 ] [-1.0011886 1.0132877 2.0296001 ]]]

This is a premium problem, to view more details of this problem please sign up for MLPro Premium. MLPro premium offers access to actual machine learning and data science interview questions and coding challenges commonly asked at tech companies all over the world

MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.

Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro

Get access to Premium only exclusive educational content available to only Premium users.

Have an issue, the MLPro support team is available 24X7 to Premium users.

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

Log in to post a comment


Input Test Case

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