本文整理汇总了Python中SimpleCV.ImageClass.Image.size方法的典型用法代码示例。如果您正苦于以下问题:Python Image.size方法的具体用法?Python Image.size怎么用?Python Image.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.ImageClass.Image
的用法示例。
在下文中一共展示了Image.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __add__
# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import size [as 别名]
def __add__(self, flt):
if not isinstance(flt, type(self)):
warnings.warn("Provide SimpleCV.DFT object")
return None
if self.size() != flt.size():
warnings.warn("Both SimpleCV.DFT object must have the same size")
return None
flt_numpy = self._numpy + flt._numpy
flt_image = Image(flt_numpy)
retVal = DFT(numpyarray=flt_numpy, image=flt_image, size=flt_image.size())
return retVal
示例2: applyFilter
# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import size [as 别名]
def applyFilter(self, image, grayscale=False):
"""
**SUMMARY**
Apply the DFT filter to given image.
**PARAMETERS**
* *image* - SimpleCV.Image image
* *grayscale* - if this value is True we perfrom the operation on the
DFT of the gray version of the image and the result is
gray image. If grayscale is true we perform the
operation on each channel and the recombine them to
create the result.
**RETURNS**
Filtered Image.
**EXAMPLE**
>>> notch = DFT.createNotchFilter(dia1=200, cen=(200, 200),
size=(512, 512), type="highpass")
>>> img = Image('lenna')
>>> notch.applyFilter(img).show()
"""
if self.width == 0 or self.height == 0:
warnings.warn("Empty Filter. Returning the image.")
return image
w, h = image.size()
if grayscale:
image = image.toGray()
print self._numpy.dtype, "gray"
fltImg = Image(self._numpy)
if fltImg.size() != image.size():
fltImg = fltImg.resize(w, h)
filteredImage = image.applyDFTFilter(fltImg, grayscale)
return filteredImage