本文整理汇总了Python中SimpleCV.ImageClass.Image.rotate方法的典型用法代码示例。如果您正苦于以下问题:Python Image.rotate方法的具体用法?Python Image.rotate怎么用?Python Image.rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.ImageClass.Image
的用法示例。
在下文中一共展示了Image.rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rotate
# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import rotate [as 别名]
def rotate(self,angle):
"""
Rotate the blob given the angle in degrees most of the blob elements will
be rotated, not however this will "break" drawing back to the original image.
To draw the blob create a new layer and draw to that layer.
Parameters:
angle - Int or Float
"""
#FIXME: This function should return a blob
theta = 2*np.pi*(angle/360.0)
mode = ""
point =(self.x,self.y)
self.mImg = self.mImg.rotate(angle,mode,point)
#this is a bit of a hack, but it saves a lot of code
#I left masks as bitmaps grrrr
tempMask = Image(self.mMask)
self.mMask = tempMask.rotate(angle,mode,point).getBitmap()
tempMask = Image(self.mHullMask)
self.mHullMask = tempMask.rotate(angle,mode,point).getBitmap()
#self.mMask.rotate(theta,"",(self.x,self.y))
#self.mHullMask.rotate(theta,"",(self.x,self.y))
self.mContour = map(lambda x:
(x[0]*np.cos(theta)-x[1]*np.sin(theta),
x[0]*np.sin(theta)+x[1]*np.cos(theta)),
self.mContour)
self.mConvexHull = map(lambda x:
(x[0]*np.cos(theta)-x[1]*np.sin(theta),
x[0]*np.sin(theta)+x[1]*np.cos(theta)),
self.mConvexHull)
if( self.mHoleContour is not None):
for h in self.mHoleContour:
h = map(lambda x:
(x[0]*np.cos(theta)-x[1]*np.sin(theta),
x[0]*np.sin(theta)+x[1]*np.cos(theta)),
h)