本文整理汇总了Python中SimpleCV.Image.rotate90方法的典型用法代码示例。如果您正苦于以下问题:Python Image.rotate90方法的具体用法?Python Image.rotate90怎么用?Python Image.rotate90使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.rotate90方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fneighbourdhood_area
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def fneighbourdhood_area(x):
global na, thres, windowTitle, tipo
if x % 2 ==0:
na = x+1
else:
na = x
if na == 0 or na == 1:
na = 3
if tipo == 0:
thres = img
elif tipo == 1:
thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
elif tipo == 2:
thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
blobImg = Image(thres)
invImg = blobImg.invert()
blobImg = blobImg.rotate90()
invImg = blobImg.invert()
blobs = invImg.findBlobs()
for blob in blobs:
#print blob.coordinates()
invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
blobImg.addDrawingLayer(invImg.dl())
blobs.show(color=Color.GREEN,width=1)
cv2.imshow(windowTitle, thres)
示例2: thresholding
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def thresholding(x):
global thres, value, maxValue, img, tipo
imgO = img
if (x == 0):
thres = None
filtro = img
value = 0
maxValue = 255
cv2.createTrackbar('Value', windowTitle, value, maxValue, fValue)
cv2.createTrackbar('MaxValue', windowTitle, maxValue, maxValue, fMaxValue)
elif (x == 1):
thres = cv2.THRESH_BINARY+cv2.THRESH_OTSU
elif (x==2):
thres = cv2.THRESH_BINARY+cv2.THRESH_OTSU
img = cv2.GaussianBlur(img,(5,5),0)
if (x != 0):
ret, filtro = cv2.threshold(img,value, maxValue, thres)
tipo = x
img = imgO
blobImg = Image(filtro)
invImg = blobImg.invert()
blobImg = blobImg.rotate90()
invImg = blobImg.invert()
blobs = invImg.findBlobs()
for blob in blobs:
#print blob.coordinates()
invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
blobImg.addDrawingLayer(invImg.dl())
blobs.show(color=Color.GREEN,width=1)
cv2.imshow(windowTitle, filtro)
示例3: adaptative_thresholding
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def adaptative_thresholding(x):
global thres, na, cons, maxValue, tipo, img, windoTitle
if x == 0:
thres = img
maxValue = 255
na = 11
cons = 2;
cv2.createTrackbar('Neighbourhood area (odds)', windowTitle, na, maxValue, fneighbourdhood_area)
cv2.createTrackbar('Constant', windowTitle, -maxValue, maxValue, fConstant)
cv2.createTrackbar('MaxValue', windowTitle, maxValue, maxValue, fMaxValue)
elif x == 1:
thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
elif x == 2:
thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
tipo = x
blobImg = Image(thres)
invImg = blobImg.invert()
blobImg = blobImg.rotate90()
invImg = blobImg.invert()
blobs = invImg.findBlobs()
for blob in blobs:
#print blob.coordinates()
invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
blobImg.addDrawingLayer(invImg.dl())
blobs.show(color=Color.GREEN,width=1)
cv2.imshow(windowTitle, thres)
示例4: get_puzzle_from_image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def get_puzzle_from_image(raw_image):
# Returns None if no puzzle found
# Returns puzzle, x offset, y offset
# if puzzle found. Offsets are top
# left corner of puzzle
# Remove color
gray_image = raw_image.grayscale()
# Smooth to remove speckle
smooth_image = gray_image.gaussianBlur((5,5),0)
# Convert to Numpy Array For OpenCV use
cv_image = smooth_image.getGrayNumpyCv2()
# Adaptive threshold does much better than linear
raw_thresh_image = cv2.adaptiveThreshold(cv_image,255,1,1,11,2)
# Convert back to a SimpleCV image
thresh_image = Image(raw_thresh_image)
# For some reason it gets rotated and flipped, reverse
thresh_image = thresh_image.rotate90().flipVertical()
# Find "blobs" which are interesting items in the image
blobs = thresh_image.findBlobs()
# Assume the largest rectangular blob is our puzzle
puzzle_blob = None
puzzle_area = 0
for blob in blobs:
if blob.isRectangle() and blob.area() > puzzle_area:
puzzle_blob = blob
puzzle_area = blob.area()
# Only continue if there is a puzzle
if puzzle_blob is None: return None, 0, 0
# Crop image to just the puzzle
puzzle_image = puzzle_blob.crop()
offset_x, offset_y = puzzle_blob.topLeftCorner()
return puzzle_image, offset_x, offset_y
示例5: fMaxValue
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def fMaxValue(x):
global maxValue, value, thres, img, filtro
maxValue = x
if (thres is None):
filtro = img
else:
ret, filtro = cv2.threshold(img,value, maxValue, thres)
blobImg = Image(filtro)
invImg = blobImg.invert()
blobImg = blobImg.rotate90()
invImg = blobImg.invert()
blobs = invImg.findBlobs()
for blob in blobs:
#print blob.coordinates()
invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
blobImg.addDrawingLayer(invImg.dl())
blobs.show(color=Color.GREEN,width=1)
cv2.imshow(windowTitle, filtro)
示例6: fConstant
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
def fConstant(x):
global cons, thres, windowTitle, tipo, maxValue, na, img
# const positive to white, otherwise, to black
cons = x
if tipo == 0:
thres = img
elif tipo == 1:
thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
elif tipo == 2:
thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
blobImg = Image(thres)
invImg = blobImg.invert()
blobImg = blobImg.rotate90()
invImg = blobImg.invert()
blobs = invImg.findBlobs()
for blob in blobs:
#print blob.coordinates()
invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
blobImg.addDrawingLayer(invImg.dl())
blobs.show(color=Color.GREEN,width=1)
cv2.imshow(windowTitle, thres)
示例7: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
gray_image = raw_image.grayscale()
# Smooth to remove speckle
smooth_image = gray_image.gaussianBlur((5,5),0)
# Convert to Numpy Array For OpenCV use
cv_image = smooth_image.getGrayNumpyCv2()
# Adaptive threshold does much better than linear
raw_thresh_image = cv2.adaptiveThreshold(cv_image,255,1,1,11,2)
# Convert back to a SimpleCV image
thresh_image = Image(raw_thresh_image)
# For some reason it gets rotated and flipped, reverse
thresh_image = thresh_image.rotate90().flipVertical()
# Find "blobs" which are interesting items in the image
blobs = thresh_image.findBlobs()
# Assume the largest rectangular blob is our puzzle
puzzle_blob = None
puzzle_area = 0
for blob in blobs:
if blob.isRectangle() and blob.area() > puzzle_area:
puzzle_blob = blob
puzzle_area = blob.area()
# Only continue if there is a puzzle
#if puzzle_blob is None: return
示例8: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import rotate90 [as 别名]
from SimpleCV import Image
import cv2
__author = "mimadrid"
#img = Image('edi uveitis previa 11.png')
windowTitle = "canny detector"
cv2_img = cv2.imread('edi uveitis final6.png')
scv_img = Image(cv2_img, cv2image=True)
scv_img = scv_img.rotate90()
def threshold(value):
global scv_img
# The t1 parameter is roughly the "strength" of the edge required, and the
# value between t1 and t2 is used for edge linking.
output = scv_img.edges(t1=value)
#output.show()
cv2.imshow(windowTitle, output.getNumpyCv2())
if __name__ == "__main__":
cv2.namedWindow(windowTitle, cv2.WINDOW_NORMAL)
cv2.createTrackbar('Threshold', windowTitle, 0, 1000, threshold)
#output.show()
#imgs.addDrawingLayer(output.dl())
#cv2_image = scv_img.getNumpyCv2()
#ocv_gray = cv2.cvtColor(ocv_image, cv2.cv.CV_BGR2GRAY)
cv2.imshow(windowTitle, scv_img.getNumpyCv2())
while True:
# key = cv2.waitKey(0)