Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active December 19, 2017 00:25
Show Gist options
  • Save BlogBlocks/6b336a5d6b7aa58574e9de11e19b2428 to your computer and use it in GitHub Desktop.
Save BlogBlocks/6b336a5d6b7aa58574e9de11e19b2428 to your computer and use it in GitHub Desktop.
finding an image mean
"""
Get numpy mean of an image, np meanimage mean as a float image mean as a decimal
float is the mean displayed in a value between 0 and 1
"""
from skimage import io
import numpy as np
image = io.imread('http://i.stack.imgur.com/Y8UeF.jpg')
print(np.mean(image))
#You might want to convert all images to float to get a value betwenn 0 and 1:
from skimage import io, img_as_float
import numpy as np
image = io.imread('publish/20170819160925.jpg')
image = img_as_float(image)
print(np.mean(image))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment