Remove outliers from N dimensional data
Try to make the input and output types the same

In your example, remove_outliers() takes a NumPy array as input, but returns a regular Python list. It would be nicer to have the function return a NumPy array in this case.

The axis parameter only works when using the median

Make sure that when you specify axes, that the resulting behaviour of the function is what you would expect. If, for some reason, the axis parameter could not work with means, then you should throw an error if the caller explicitly specified which axes to work on.

Don't calculate values you are not going to use

You calculate both the median and the mean, but only use one of them. This is inefficient, just write the code as:

if use_median:
    measure = np.median(data, axis)
else:
    mean, std_dev = cv2.meanStdDev(data)
    measure = mean


I know you always need the standard deviation, but see the next comment.

Avoid using CV2 for something as simple as calculating mean and standard deviation

NumPy has functions for calculating those things as well. By avoiding importing cv2, you reduce the amount of dependencies users would have to install. As a bonus, the NumPy functions for mean and standard deviation also take an axis parameter. So consider writing:

std_dev = np.std(data, axis)

if use_median:
    measure = np.median(data, axis)
else:
    measure = np.mean(data, axis)


Don't special-case 3-dimensional data

Why are you reshaping the input array only if len(data.shape) == 3? Your should aim to make your code work generically with arrays of any number of dimensions.