Skip to content

Instantly share code, notes, and snippets.

@charlesreid1
Created November 9, 2017 21:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save charlesreid1/2087ab15d26a9eb07a13f896b2d7d626 to your computer and use it in GitHub Desktop.
Save charlesreid1/2087ab15d26a9eb07a13f896b2d7d626 to your computer and use it in GitHub Desktop.
Results from using different imread() functions
In [1]: from skimage.io import imread as skimage_imread
In [2]: from matplotlib.pyplot import imread as plt_imread
In [3]: from scipy.ndimage import imread as scipy_imread
In [4]: skimage_imread('bulk_water_000.png')
Out[4]:
array([[[146, 125, 54, 255],
[146, 125, 54, 255],
[146, 125, 56, 255],
...,
[140, 120, 55, 255],
[141, 120, 59, 255],
[142, 121, 60, 255]],
[[146, 125, 54, 255],
[146, 125, 54, 255],
[146, 125, 56, 255],
...,
[140, 120, 55, 255],
[142, 121, 60, 255],
[142, 121, 60, 255]],
[[146, 125, 56, 255],
[146, 125, 56, 255],
[146, 124, 58, 255],
...,
[141, 121, 56, 255],
[143, 123, 59, 255],
[144, 124, 60, 255]],
...,
[[146, 125, 66, 255],
[147, 126, 67, 255],
[146, 125, 64, 255],
...,
[129, 108, 37, 255],
[120, 98, 32, 255],
[119, 97, 31, 255]],
[[146, 125, 64, 255],
[146, 125, 64, 255],
[145, 125, 61, 255],
...,
[137, 116, 47, 255],
[129, 109, 44, 255],
[126, 106, 41, 255]],
[[146, 125, 64, 255],
[146, 125, 64, 255],
[145, 125, 61, 255],
...,
[145, 124, 55, 255],
[139, 119, 54, 255],
[137, 117, 52, 255]]], dtype=uint8)
In [5]: plt_imread('bulk_water_000.png')
Out[5]:
array([[[ 0.57254905, 0.49019608, 0.21176471, 1. ],
[ 0.57254905, 0.49019608, 0.21176471, 1. ],
[ 0.57254905, 0.49019608, 0.21960784, 1. ],
...,
[ 0.54901963, 0.47058824, 0.21568628, 1. ],
[ 0.5529412 , 0.47058824, 0.23137255, 1. ],
[ 0.55686277, 0.47450981, 0.23529412, 1. ]],
[[ 0.57254905, 0.49019608, 0.21176471, 1. ],
[ 0.57254905, 0.49019608, 0.21176471, 1. ],
[ 0.57254905, 0.49019608, 0.21960784, 1. ],
...,
[ 0.54901963, 0.47058824, 0.21568628, 1. ],
[ 0.55686277, 0.47450981, 0.23529412, 1. ],
[ 0.55686277, 0.47450981, 0.23529412, 1. ]],
[[ 0.57254905, 0.49019608, 0.21960784, 1. ],
[ 0.57254905, 0.49019608, 0.21960784, 1. ],
[ 0.57254905, 0.48627451, 0.22745098, 1. ],
...,
[ 0.5529412 , 0.47450981, 0.21960784, 1. ],
[ 0.56078434, 0.48235294, 0.23137255, 1. ],
[ 0.56470591, 0.48627451, 0.23529412, 1. ]],
...,
[[ 0.57254905, 0.49019608, 0.25882354, 1. ],
[ 0.57647061, 0.49411765, 0.26274511, 1. ],
[ 0.57254905, 0.49019608, 0.25098041, 1. ],
...,
[ 0.50588238, 0.42352942, 0.14509805, 1. ],
[ 0.47058824, 0.38431373, 0.1254902 , 1. ],
[ 0.46666667, 0.38039216, 0.12156863, 1. ]],
[[ 0.57254905, 0.49019608, 0.25098041, 1. ],
[ 0.57254905, 0.49019608, 0.25098041, 1. ],
[ 0.56862748, 0.49019608, 0.23921569, 1. ],
...,
[ 0.53725493, 0.45490196, 0.18431373, 1. ],
[ 0.50588238, 0.42745098, 0.17254902, 1. ],
[ 0.49411765, 0.41568628, 0.16078432, 1. ]],
[[ 0.57254905, 0.49019608, 0.25098041, 1. ],
[ 0.57254905, 0.49019608, 0.25098041, 1. ],
[ 0.56862748, 0.49019608, 0.23921569, 1. ],
...,
[ 0.56862748, 0.48627451, 0.21568628, 1. ],
[ 0.54509807, 0.46666667, 0.21176471, 1. ],
[ 0.53725493, 0.45882353, 0.20392157, 1. ]]], dtype=float32)
In [6]: scipy_imread('bulk_water_000.png')
/usr/local/bin/ipython:1: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0.
Use ``matplotlib.pyplot.imread`` instead.
#!/usr/local/opt/python3/bin/python3.6
Out[6]:
array([[[146, 125, 54, 255],
[146, 125, 54, 255],
[146, 125, 56, 255],
...,
[140, 120, 55, 255],
[141, 120, 59, 255],
[142, 121, 60, 255]],
[[146, 125, 54, 255],
[146, 125, 54, 255],
[146, 125, 56, 255],
...,
[140, 120, 55, 255],
[142, 121, 60, 255],
[142, 121, 60, 255]],
[[146, 125, 56, 255],
[146, 125, 56, 255],
[146, 124, 58, 255],
...,
[141, 121, 56, 255],
[143, 123, 59, 255],
[144, 124, 60, 255]],
...,
[[146, 125, 66, 255],
[147, 126, 67, 255],
[146, 125, 64, 255],
...,
[129, 108, 37, 255],
[120, 98, 32, 255],
[119, 97, 31, 255]],
[[146, 125, 64, 255],
[146, 125, 64, 255],
[145, 125, 61, 255],
...,
[137, 116, 47, 255],
[129, 109, 44, 255],
[126, 106, 41, 255]],
[[146, 125, 64, 255],
[146, 125, 64, 255],
[145, 125, 61, 255],
...,
[145, 124, 55, 255],
[139, 119, 54, 255],
[137, 117, 52, 255]]], dtype=uint8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment