python可以定义函数吗_Python可以打印函数定义吗?

您可以在功能中使用__doc__,以hog()为例:你可以看到这样的hog()的用法:

from skimage.feature import hog

print hog.__doc__

输出将是:

Extract Histogram of Oriented Gradients (HOG) for a given image.

Compute a Histogram of Oriented Gradients (HOG) by

1. (optional) global image normalisation

2. computing the gradient image in x and y

3. computing gradient histograms

4. normalising across blocks

5. flattening into a feature vector

Parameters

----------

image : (M, N) ndarray

Input image (greyscale).

orientations : int

Number of orientation bins.

pixels_per_cell : 2 tuple (int, int)

Size (in pixels) of a cell.

cells_per_block : 2 tuple (int,int)

Number of cells in each block.

visualise : bool, optional

Also return an image of the HOG.

transform_sqrt : bool, optional

Apply power law compression to normalise the image before

processing. DO NOT use this if the image contains negative

values. Also see `notes` section below.

feature_vector : bool, optional

Return the data as a feature vector by calling .ravel() on the result

just before returning.

normalise : bool, deprecated

The parameter is deprecated. Use `transform_sqrt` for power law

compression. `normalise` has been deprecated.

Returns

-------

newarr : ndarray

HOG for the image as a 1D (flattened) array.

hog_image : ndarray (if visualise=True)

A visualisation of the HOG image.

References

----------

* http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients

* Dalal, N and Triggs, B, Histograms of Oriented Gradients for

Human Detection, IEEE Computer Society Conference on Computer

Vision and Pattern Recognition 2005 San Diego, CA, USA

Notes

-----

Power law compression, also known as Gamma correction, is used to reduce

the effects of shadowing and illumination variations. The compression makes

the dark regions lighter. When the kwarg `transform_sqrt` is set to

``True``, the function computes the square root of each color channel

and then applies the hog algorithm to the image.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值