本文整理匯總了Python中ImageFilter.FIND_EDGES屬性的典型用法代碼示例。如果您正苦於以下問題:Python ImageFilter.FIND_EDGES屬性的具體用法?Python ImageFilter.FIND_EDGES怎麽用?Python ImageFilter.FIND_EDGES使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類ImageFilter
的用法示例。
在下文中一共展示了ImageFilter.FIND_EDGES屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: imfilter
# 需要導入模塊: import ImageFilter [as 別名]
# 或者: from ImageFilter import FIND_EDGES [as 別名]
def imfilter(arr,ftype):
"""
Simple filtering of an image.
Parameters
----------
arr : ndarray
The array of Image in which the filter is to be applied.
ftype : str
The filter that has to be applied. Legal values are:
'blur', 'contour', 'detail', 'edge_enhance', 'edge_enhance_more',
'emboss', 'find_edges', 'smooth', 'smooth_more', 'sharpen'.
Returns
-------
imfilter : ndarray
The array with filter applied.
Raises
------
ValueError
*Unknown filter type.* If the filter you are trying
to apply is unsupported.
"""
_tdict = {'blur':ImageFilter.BLUR,
'contour':ImageFilter.CONTOUR,
'detail':ImageFilter.DETAIL,
'edge_enhance':ImageFilter.EDGE_ENHANCE,
'edge_enhance_more':ImageFilter.EDGE_ENHANCE_MORE,
'emboss':ImageFilter.EMBOSS,
'find_edges':ImageFilter.FIND_EDGES,
'smooth':ImageFilter.SMOOTH,
'smooth_more':ImageFilter.SMOOTH_MORE,
'sharpen':ImageFilter.SHARPEN
}
im = toimage(arr)
if ftype not in _tdict:
raise ValueError("Unknown filter type.")
return fromimage(im.filter(_tdict[ftype]))
示例2: imfilter
# 需要導入模塊: import ImageFilter [as 別名]
# 或者: from ImageFilter import FIND_EDGES [as 別名]
def imfilter(arr, ftype):
"""
Simple filtering of an image.
Parameters
----------
arr : ndarray
The array of Image in which the filter is to be applied.
ftype : str
The filter that has to be applied. Legal values are:
'blur', 'contour', 'detail', 'edge_enhance', 'edge_enhance_more',
'emboss', 'find_edges', 'smooth', 'smooth_more', 'sharpen'.
Returns
-------
imfilter : ndarray
The array with filter applied.
Raises
------
ValueError
*Unknown filter type.* If the filter you are trying
to apply is unsupported.
"""
_tdict = {'blur': ImageFilter.BLUR,
'contour': ImageFilter.CONTOUR,
'detail': ImageFilter.DETAIL,
'edge_enhance': ImageFilter.EDGE_ENHANCE,
'edge_enhance_more': ImageFilter.EDGE_ENHANCE_MORE,
'emboss': ImageFilter.EMBOSS,
'find_edges': ImageFilter.FIND_EDGES,
'smooth': ImageFilter.SMOOTH,
'smooth_more': ImageFilter.SMOOTH_MORE,
'sharpen': ImageFilter.SHARPEN
}
im = toimage(arr)
if ftype not in _tdict:
raise ValueError("Unknown filter type.")
return fromimage(im.filter(_tdict[ftype]))
示例3: imfilter
# 需要導入模塊: import ImageFilter [as 別名]
# 或者: from ImageFilter import FIND_EDGES [as 別名]
def imfilter(arr, ftype):
"""
Simple filtering of an image.
This function is only available if Python Imaging Library (PIL) is installed.
.. warning::
This function uses `bytescale` under the hood to rescale images to use
the full (0, 255) range if ``mode`` is one of ``None, 'L', 'P', 'l'``.
It will also cast data for 2-D images to ``uint32`` for ``mode=None``
(which is the default).
Parameters
----------
arr : ndarray
The array of Image in which the filter is to be applied.
ftype : str
The filter that has to be applied. Legal values are:
'blur', 'contour', 'detail', 'edge_enhance', 'edge_enhance_more',
'emboss', 'find_edges', 'smooth', 'smooth_more', 'sharpen'.
Returns
-------
imfilter : ndarray
The array with filter applied.
Raises
------
ValueError
*Unknown filter type.* If the filter you are trying
to apply is unsupported.
"""
_tdict = {'blur': ImageFilter.BLUR,
'contour': ImageFilter.CONTOUR,
'detail': ImageFilter.DETAIL,
'edge_enhance': ImageFilter.EDGE_ENHANCE,
'edge_enhance_more': ImageFilter.EDGE_ENHANCE_MORE,
'emboss': ImageFilter.EMBOSS,
'find_edges': ImageFilter.FIND_EDGES,
'smooth': ImageFilter.SMOOTH,
'smooth_more': ImageFilter.SMOOTH_MORE,
'sharpen': ImageFilter.SHARPEN
}
im = toimage(arr)
if ftype not in _tdict:
raise ValueError("Unknown filter type.")
return fromimage(im.filter(_tdict[ftype]))