本文整理汇总了Python中SimpleCV.Image.dl方法的典型用法代码示例。如果您正苦于以下问题:Python Image.dl方法的具体用法?Python Image.dl怎么用?Python Image.dl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.dl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visualize_consumer
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
def visualize_consumer(to):
"""A consumer that visualizes the data on an image
:param TrackerOut to: A TrackerOut objects that receives data
"""
img = Image((600, 600))
while True:
to.flush()
img.clearLayers()
for pos, timestamp in to:
for finger in pos:
if finger is not None:
img.dl().rectangle2pts((finger[0]-4, finger[1]-4),
(finger[0]+4, finger[1]+4),
color=Color.RED,
filled=True)
print "{}: {}".format(int(timestamp), pos)
img.show()
to.clear()
del img
示例2: __init__
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
class Window:
world_size = 100
img_size = (world_size, world_size)
generation = 0
def __init__(self):
self.display = Display(self.img_size)
self.img = Image(self.img_size)
self.img.save(self.display)
def dot(self, x, y, size=0, color=Color.WHITE):
x = int(round(x))
y = int(round(y))
#print "Drawing robot particle at {}, {}".format(x, y)
self.img.dl().circle((x, y), size, color, filled=True)
def dot_red(self, x, y):
self.dot(x, y, 2, Color.RED)
def dots(self, coords, size=0, color=Color.WHITE):
for (x, y) in coords:
self.dot(x, y, size, color)
def clear(self):
self.img = Image(self.img_size)
#self.display.clear()
self.img.save(self.display)
def show(self):
self.img.save(self.display)
self.generation += 1
print "Generation = {}".format(self.generation)
self.wait_for_mouse()
def wait_for_mouse(self):
while True:
for event in pg.event.get():
if event.type == pg.MOUSEBUTTONDOWN:
print event
self.clear()
return
示例3: Display
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
from SimpleCV import Display, Image, Color
winsize = (640, 480)
display = Display(winsize)
img = Image(winsize)
img.save(display)
while not display.isDone():
if display.mouseLeft:
img.dl().circle((display.mouseX, display.mouseY), 5,
Color.RED, filled=True)
img.save(display)
img.save("art.png")
示例4: Display
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
# -*- coding: utf-8 -*-
from SimpleCV import Display, Image, Color
winsize = (640,480)
display = Display(winsize)
img = Image(winsize)
img.save(display)
while not display.isDone():
if display.mouseLeft:
img.dl().circle((display.mouseX, display.mouseY), 4,
Color.WHITE, filled=True)
img.save(display)
img.save("ex7.png")
示例5: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
__author__ = "becks"
import time
from SimpleCV import Camera, Image, Color, Display
img = Image((300, 300))
img.dl().circle((150, 75), 50, Color.RED, filled=True)
img.dl().line((150, 125), (150, 275), Color.WHITE, width=5)
img.show()
time.sleep(5)
cam = Camera()
size = cam.getImage().size()
disp = Display(size)
center = (size[0] / 2, size[1] / 2)
while disp.isNotDone():
img = cam.getImage()
img.dl().circle(center, 50, Color.BLACK, width=3)
img.dl().circle(center, 200, Color.BLACK, width=6)
img.dl().line((center[0], center[1] - 50), (center[0], 0), Color.BLACK, width=2)
示例6: __call__
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
def __call__(self, image):
params = util.utf8convert(self.inspection.parameters)
retVal = []
mask = Image((image.width,image.height))
if( params.has_key('w') and params.has_key('h') and params.has_key('x') and params.has_key('y') ): #rectangle
if( params['x'] + params['w'] < image.width and
params['y'] + params['h'] < image.height and
params['y'] >= 0 and
params['x'] >= 0 ):
mask.drawRectangle(params['x'],params['y'],params['w'],params['h'],width=-1,color=Color.WHITE)
mask = mask.applyLayers()
fs = image.findBlobsFromMask(mask)
ff = M.FrameFeature()
if( fs is not None and len(fs) > 0 ):
#fs[-1].draw()
b = fs[-1]
b.__class__ = BlobRegion
c = b.meanColor()
b.mColor = (int(c[0]),int(c[1]),int(c[2]))
ff.setFeature(b) # a little hacky but I am sure that it works
retVal = [ff]
elif( params.has_key('x') and params.has_key('y') and params.has_key('r') ): # circle
if( params['x'] + params['r'] < image.width and
params['y'] + params['r'] < image.height and
params['x'] - params['r'] >= 0 and
params['y'] - params['r'] >= 0 ):
r = params['r']
x = params['x']
y = params['y']
mask.drawCircle((x,y),r,thickness=-1,color=Color.WHITE)
mask = mask.applyLayers()
fs = image.findBlobsFromMask(mask)
ff = M.FrameFeature()
if( fs is not None and len(fs) > 0 ):
#fs[-1].draw()
b = fs[-1]
b.__class__ = BlobRegion
c = b.meanColor()
b.mColor = (int(c[0]),int(c[1]),int(c[2]))
ff.setFeature(b)
retVal = [ff]
elif( params.has_key('contour') ):
contour = params['contour'] # this may bail out
if( len(contour) >= 3 ):
mask.dl().polygon(contour,filled=True,color=Color.WHITE)
mask = mask.applyLayers()
fs = image.findBlobsFromMask(mask)
ff = M.FrameFeature()
if( fs is not None and len(fs) > 0 ):
#fs[-1].draw()
b = fs[-1]
b.__class__ = BlobRegion
c = b.meanColor()
b.mColor = (int(c[0]),int(c[1]),int(c[2]))
ff.setFeature(b)
retVal = [ff]
if( params.has_key("saveFile") ):
image.save(params["saveFile"])
return retVal
示例7: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
__author__ = 'becks'
import time
from SimpleCV import Image
head = Image('head.png')
amgothic = Image('amgothic.png')
scream = Image('scream.png')
amgothic.dl().blit(head,(175, 110))
amgothic.show()
time.sleep(2)
layer = amgothic.getDrawingLayer()
scream.addDrawingLayer(layer)
scream.show()
time.sleep(2)
print amgothic._mLayers
print scream._mLayers
layer.blit(head,(75,220))
amgothic.show()
time.sleep(2)
scream.show()
示例8: Display
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import dl [as 别名]
from SimpleCV import Display, Image, Color
winsize = (640,480)
display = Display(winsize)
img = Image(winsize)
img.save(display)
while not display.isDone():
if display.mouseLeft:
img.dl().circle((display.mouseX, display.mouseY), 4, Color.YELLOW, filled=True)
img.save(display)
img.save("painting.png")
exit()