當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python SciPy misc.face用法及代碼示例

本文簡要介紹 python 語言中 scipy.misc.face 的用法。

用法:

scipy.misc.face(gray=False)#

獲取浣熊臉的 1024 x 768 彩色圖像。

raccoon-procyon-lotor.jpg 在http://www.public-domain-image.com

參數

gray 布爾型,可選

如果 True 返回 8 位 grey-scale 圖像,否則返回彩色圖像

返回

face ndarray

浣熊臉的圖像

例子

>>> import scipy.misc
>>> face = scipy.misc.face()
>>> face.shape
(768, 1024, 3)
>>> face.max()
255
>>> face.dtype
dtype('uint8')
>>> import matplotlib.pyplot as plt
>>> plt.gray()
>>> plt.imshow(face)
>>> plt.show()
scipy-misc-face-1.png

相關用法


注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.misc.face。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。