Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python图像处理库 #16

Open
jayboxyz opened this issue Nov 13, 2019 · 0 comments
Open

Python图像处理库 #16

jayboxyz opened this issue Nov 13, 2019 · 0 comments
Labels
Python&常用库 Python、Python常用库等

Comments

@jayboxyz
Copy link
Owner

jayboxyz commented Nov 13, 2019

基于python脚本语言开发的数字图片处理包,比如PIL,Pillow, opencv, scikit-image等。

  • PIL和Pillow只提供最基础的数字图像处理,功能有限;
  • opencv实际上是一个c++库,只是提供了python接口,更新速度非常慢。
  • scikit-image是基于scipy的一款图像处理包,它将图片作为numpy数组进行处理,正好与matlab一样,因此,我们最终选择scikit-image进行数字图像处理。

Image读出来的是PIL的类型,而skimage.io读出来的数据是numpy格式的

import Image as img
import os
from matplotlib import pyplot as plot
from skimage import io,transform
#Image和skimage读图片
img_file1 = img.open('./CXR_png/MCUCXR_0042_0.png')
img_file2 = io.imread('./CXR_png/MCUCXR_0042_0.png')

输出可以看出Img读图片的大小是图片的(width, height);而skimage的是(height,width, channel), [这也是为什么caffe在单独测试时要要在代码中设置:transformer.set_transpose('data',(2,0,1)),因为caffe可以处理的图片的数据格式是(channel,height,width),所以要转换数据]

作者:jiandanjinxin
链接:https://www.jianshu.com/p/f2e88197e81d
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

@jayboxyz jayboxyz added the Python&常用库 Python、Python常用库等 label Dec 30, 2019
@jayboxyz jayboxyz reopened this Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python&常用库 Python、Python常用库等
Projects
None yet
Development

No branches or pull requests

1 participant