opencv的像素值在[ 0,1 ] [ 0,1 ],show时变换为[ 0,255 ]
import cv 2img=cv2.im read (imgfile ) (cv2.imshow ) ) img_win_name ),img ) cv2.waitKey(0) #无限cv2.imwrey )
高宽通道高宽通道。
分离方法为: b,g,r=cv2.split(img )1)1 2. scikit-image包
scikit-image的像素值在[ 1,1 ] [ 1,1 ],show时转换为[ 0,255 ]
importskimage.ioasioimportmatplotlib.pyplotaspltimg=io.im read (a.jpg ) ) io.im show (img ) plt.show ) ) 123456
3. matplotlib包matplotlib的像素值在[-1,1 ]之间,保存时转换为[ 0,255 ] [ 0,255 ],显示时转换为[ 0,255 ]
importmatplotlib.pyplotaspltimg=PLT.im read (img _ name ) (PLT.imshow ) img ) 1234 matplotlib读取图像也是heightwidhtcchow
4. tifffile软件包导入tiff file as tiff #将图像的像素值设置为[ 0,1 ]之间的defscale_percentile(matrix ) : w,h, d=matrix.shapematriff d ).astype(NP.float64 ) get 2nd and 98 thpercentilemins=NP.percentile (matrix,1 ), axis=0) maxs=NP.percentile )、axis=0) maxs ) NP.percen axis=0(-mins matrix=(matrix-mins [ none,] ) h] 1) returnmatriximg=tiff.im read (file _ name ) ) tiff.imshow(scale_percentile ) img ) 123456789101111121314155