本文整理汇总了Python中SimpleCV.Image.rotate方法的典型用法代码示例。如果您正苦于以下问题:Python Image.rotate方法的具体用法?Python Image.rotate怎么用?Python Image.rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.rotate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: correct_alignment
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
def correct_alignment(si, image_path):
new_file_path = step_file_path(si, 'correct-alignment')
img = Image(image_path)
if (img.width > img.height):
img.rotate(-90, fixed=False).save(new_file_path)
else:
img.save(new_file_path)
si.step_outputs.append(new_file_path)
return new_file_path
示例2: correct_alignment
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
def correct_alignment(self, img_path):
new_file_path = self.nfn('correct-alignment')
img = Image(img_path)
if (img.width > img.height):
img.rotate(-90, fixed=False).save(new_file_path)
else:
img.save(new_file_path)
self.transformations.append(new_file_path)
return new_file_path
示例3: rotate
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
def rotate(self, img_path, shoe_measurements):
img = Image(img_path)
new_file_path = self.nfn('rotated')
img = img.rotate(shoe_measurements.toe_heel_angle(), point=shoe_measurements.cleat_length_intersection())
self.transformations.append(new_file_path)
img.save(new_file_path)
return new_file_path
示例4: rotate_and_resize
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
def rotate_and_resize(si, left_sm, right_sm):
new_file_path = step_file_path(si, 'rotate')
img = Image(si.step_outputs[-1:][0])
rot = right_sm.toe_heel_angle() + left_sm.toe_heel_angle()
img = img.rotate(rot, fixed=True)
si.step_outputs.append(new_file_path)
img.save(new_file_path)
scale = left_sm.shoe_length() / right_sm.shoe_length()
new_file_path = step_file_path(si, 'scale-length')
img = img.scale(scale)
si.step_outputs.append(new_file_path)
img.save(new_file_path)
# We also resize the original file
orig_img = Image(si.step_outputs[0])
orig_img = orig_img.rotate(rot, fixed=True)
orig_img = orig_img.scale(scale)
new_file_path = step_file_path(si, 'transformed-original')
si.step_outputs.append(new_file_path)
orig_img.save(new_file_path)
return new_file_path
示例5: getRotateBoxTest
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
def getRotateBoxTest(self):
if not self._rotBoxTest:
grayImg = self.image.toGray()
diff = grayImg - self._boxFilter(grayImg, 35)
result = [0]*18
if not self.ellipse.error and self.ellipse.a > 0 and self.ellipse.b > 0:
res = countInWindowEst(diff.threshold(6).getGrayNumpy(), 5)
res = self._getRotatedAndScaledGalImg(Image(res))
if res != None:
res = res.getGrayNumpy()
img = Image(res)
ellipse = self.ellipse
center = (img.width/2, img.height/2)
width = 10
diameter = int(max(ellipse.a, ellipse.b)*2)
mask = np.zeros_like(img.getGrayNumpy(), dtype=np.bool)
mask[center[0]-width/2:center[0]+width/2, center[1]-diameter/2:center[1]+diameter/2] = True
mask = Image(mask).threshold(0)
maxI = 0
maxThetaVal = 0
values = []
for i, theta in enumerate(xrange(-90, 90, 10)):
masked = (img & mask.rotate(theta, point=(img.width/2, img.height/2))).getGrayNumpy()
val = np.sum(masked)/float(img.width*img.height)
values.append(val)
if val > maxThetaVal:
maxThetaVal = val
maxI = i
result[0:len(values)-maxI] = values[maxI:]
result[len(values)-maxI:] = values[0:maxI]
self._rotBoxTest = result
return self._rotBoxTest
示例6: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
from SimpleCV import Image
import time
img = Image('ladies.jpg')
# Rotate the image counter-clockwise 45 degrees
# Rotate the image around the coordinates +(16, 16)+
# Rotate the image, and then resize it so the content isn't cropped
rot = img.rotate(45,point=(16, 16),fixed=False)
rot.show()
time.sleep(10)
示例7: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
kite_base = Image('http://www.winds-up.com/images/annonces/7915_1.jpg').resize(50, 50).invert()
disp = Display()
i_loop = 0
#pid = PID.PID(1, 1, 0.1)
offset = sp.pi/3*0
kite_model = kiteModel()
dX = 0*kite_model.X
while disp.isNotDone():
setpoint = sp.pi/1.7*sp.sin(2*sp.pi/7*time.time())+offset
i_loop = i_loop +1
order = 0+0*sp.randn(1)/5+2.0*disp.mouseX/background.width-1
#error = X[0] -setpoint
#order = sp.randn(1)/100 + pid.computeCorrection(error, dX[0]/dt-0)
#pid.incrementTime(error, dt)
dt = 0.1
kite_model.update(order, dt)
print kite_model.X
kite = kite_base.rotate(sp.rad2deg(kite_model.X[0]), fixed=False).invert()
#kite.save(disp)d
#background.blit(kite, (799,0)).save(disp)
toDisplay = background.blit(kite.invert(), (max(-kite.width +1, min(background.width-1, int(kite_model.X[1]+background.width/2-kite.width/2))), max(-kite.height+1, min(background.height-1, int(background.height-kite_model.X[2]-200)))), mask = kite.binarize())
toDisplay.drawText(str(i_loop*dt), 0, 0, color = Color.RED, fontsize=60)
toDisplay.save(disp)
time.sleep(dt)
示例8: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
from SimpleCV import Image
img = Image('ex17.png')
# Rotate the image counter-clockwise 45 degrees
rot = img.rotate(45)
rot.show()
示例9: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate [as 别名]
from SimpleCV import Image
import time
img = Image('ladies.jpg')
# Rotate the image 90 degrees and make it half the size
rot = img.rotate(90, scale=.5)
rot.show()
time.sleep(10)