当前位置: 首页>>代码示例>>Python>>正文


Python Display.isDone方法代码示例

本文整理汇总了Python中SimpleCV.Display.isDone方法的典型用法代码示例。如果您正苦于以下问题:Python Display.isDone方法的具体用法?Python Display.isDone怎么用?Python Display.isDone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleCV.Display的用法示例。


在下文中一共展示了Display.isDone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: simpleDiff

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def simpleDiff():
    cam = Camera()
    img = cam.getImage().scale(.20)
    disp = Display(img.size())
    img.save(disp)
    X = range(100)
    Y = [0 for i in range(100)]
    count = 0
    imgA = cam.getImage().scale(0.20).grayscale()
    while not disp.isDone():
        ax.clear()
        count += 1
        time.sleep(0.1)
        imgB = cam.getImage().scale(0.20).grayscale()
        #imgB.save(disp)
        motion = (imgB - imgA).binarize().invert().erode(1).dilate(1)
        motion.save(disp)
        s = diff(motion)
        imgA = imgB
        if count < 100:
            Y[count] = s
        else:
            Y.append(s)
            Y = Y[1:]
            X.append(count)
            X = X[1:]
        ax.bar(X, Y)
        plt.xlim(X[0], X[-1])
        plt.draw()
        imgA = imgB
开发者ID:vijaym123,项目名称:Boredom-Detection-In-Class,代码行数:32,代码来源:live.py

示例2: ThreadingObject

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
class ThreadingObject(object):
    """ Threading object class

    The run() method will be started and it will run in the background
    until the application exits.
    """
 
    def __init__(self, interval=1, video=False):
        """ Constructor

        :type interval: int
        :param interval: Check interval, in seconds
        """
        self.interval = interval
        self.url = "http://192.168.10.222:1201/videostream.cgi?user=admin&pwd="
        self.ipCam = JpegStreamCamera(self.url)
        self.display = Display()

        thread = threading.Thread(target=self.run, args=(video,))
        thread.daemon = True                            # Daemonize thread
        thread.start()                                  # Start the execution
 
    def run(self, video):
        """ Method that runs forever """
        while not self.display.isDone():
            if video:
                imagen = self.ipCam.live()
            else:
                imagen = self.ipCam.getImage().show()
            time.sleep(self.interval)
        imagen.quit()
开发者ID:Robots-de-Rescate,项目名称:Kauil_ROS,代码行数:33,代码来源:Threads.py

示例3: opticalFlow

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def opticalFlow():
    cam = Camera()
    img = cam.getImage().scale(.20)
    disp = Display(img.size())
    img.save(disp)
    X = range(100)
    Y = [0 for i in range(100)]
    flag = 0
    count = 0
    while not disp.isDone():
        ax.clear()
        count += 1
        if flag == 0:
            imgA = cam.getImage().scale(0.20)
            flag += 1
        else:
            imgB = cam.getImage().scale(0.20)
            imgB.save(disp)
            motion = imgB.findMotion(imgA)
            s = sum([i.magnitude() for i in motion])
            imgA = imgB
            if count < 100:
                Y[count] = s
            else:
                Y.append(s)
                Y = Y[1:]
                X.append(count)
                X = X[1:]
            ax.bar(X, Y)
            plt.xlim(X[0], X[-1])
            plt.draw()
开发者ID:vijaym123,项目名称:Boredom-Detection-In-Class,代码行数:33,代码来源:live.py

示例4: show_video

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def show_video():
    dis = Display()
    try:
        while not dis.isDone():
            capture_image().save(dis)
            sleep(1 / 25.0)
    except pygame.error:
        return
开发者ID:AlexeiBuzuma,项目名称:IPD,代码行数:10,代码来源:cameralib.py

示例5: calibrate

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def calibrate():
    winsize = (640, 480)
    display = Display(winsize)
    bg_img = get_image()
    bg_img.save(display)
    while not display.isDone():
        img = get_image()
        img.save(display)
        if display.mouseLeft:
            return img.getPixel(display.mouseX, display.mouseY), bg_img, img
开发者ID:DataSounds,项目名称:OceanSound,代码行数:12,代码来源:capture.py

示例6: getImage

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def getImage(video):
    url = "http://192.168.10.222:1201/videostream.cgi?user=admin&pwd="
    ipCam = JpegStreamCamera(url)
    display = Display()
    if video==False:
        imagen = ipCam.getImage().show()
        while not display.isDone():
            pass

    else:
        while not display.isDone():

            imagen = ipCam.getImage()
            #faces = imagen.findHaarFeatures('face')
            #if faces is not None:
            #    faces = faces.sortArea()
            #    bigFace = faces[-1]
                # Draw a green box around the face
            #    bigFace.draw()
            #imagen = ipCam.live()
            imagen.save(display)

    imagen.quit()
开发者ID:Robots-de-Rescate,项目名称:Kauil_ROS,代码行数:25,代码来源:talkerSCV.py

示例7: ajusteFoto

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
def ajusteFoto(filename,brillo=50,resolucion=(1024,768),modoExposicion='auto'):
	""" Va tomando fotos en un proceso de ensayo y error supervisado por el 
	usuario , hasta que se toma la adecuada y el metodo 
	devuelve el objeto imagen """
	
	disp = Display(resolucion)
	
	try:
		while not disp.isDone():
			
				img = tomaFoto(filename,brillo,resolucion,modoExposicion,altaVelocidad=False)
				img.save(disp)
	except:
		pass
		
	return img
开发者ID:chuison,项目名称:Alarma-Visual-Avanzada,代码行数:18,代码来源:utilidades.py

示例8: Camera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
from SimpleCV import Camera, Display
from time import sleep

myCamera = Camera(prop_set={'wdith': 320, 'height': 240})

myDisplay = Display(resolution=(320, 240))

while not myDisplay.isDone():
   myCamera.getImage().save(myDisplay)
   sleep(.1)
开发者ID:Insight-book,项目名称:Getting-Started-With-Raspberry-Pi,代码行数:12,代码来源:basic-camera.py

示例9: depuracion

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
				p = self.articulaciones.pop()
				img.dl().line(puntoInicial, p, Color.BLUE, width=5)
				img.dl().circle(p, 10, Color.BLUE, width=5)
				img.applyLayers()
				self.angulosHuesos.append(aux.anguloLineaEntreDosPuntos(p, puntoInicial))
				puntoInicial = p	
		
	def depuracion(self):
		self.enDepuracion = True
		print " ---------------------"
		print "Areas: "
		print self.AreaBlobs  
		print "Numero de blobs candidatos por area: "
		print self.numBlobsCandidatosPorArea
		print "Tiempo de tratamiento de imagen: "
 		print self.tiempoTratamiento 
 		print "Numero Articulaciones detectadas: "
 		print len(self.articulaciones) 
		print " ---------------------"
		time.sleep(1)
		
if __name__ == '__main__':
	
	display = Display() 
	imgT = ImagenTratada()
	
	while not display.isDone():
		img = imgT.capturaYTrataLaImagen(150)
		img.save(display)

开发者ID:vencejo,项目名称:GUI-para-el-tratamiento-de-imagenes,代码行数:31,代码来源:tratamientoImagen.py

示例10: Camera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
from SimpleCV import Camera, Color, Display, Image

cam = Camera()
original_background = Image('weather.png')

disp = Display()

while not disp.isDone():
    img = cam.getImage()
    img = img.flipHorizontal()
    
    bgcolor = img.getPixel(10, 10)
    dist = img.colorDistance(bgcolor)
    mask = dist.binarize(50)
    
    foreground = img - mask

    background = original_background - mask.invert()

    combined = background + foreground

    combined.save(disp)
开发者ID:vizcacha,项目名称:practicalcv,代码行数:24,代码来源:green_screen.py

示例11: Camera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
cam = Camera()
# Initialize the display
display = Display()
# Take an initial picture
img = cam.getImage() 
# Write a message on the image
img.drawText("Left click to save a photo.", 
 50, 50, color=Color().getRandom()) 
# Show the image on the display
img.save(display)

time.sleep(3)

counter = 0

while not display.isDone(): # for window handling
	
## Pseudo live view
   img = cam.getImage() # get image
   # Update the display with the latest image
   img.save(display)
   # Since it's in while, It'll keep on rolling
   # and displaying making it appear
   # as live view. 
####################

   if display.mouseLeft:
      # Save image to the current directory
      img.save("photobooth" + str(counter) + ".jpg") 
      img.drawText("Photo saved.", 50, 50, color=Color().getRandom()) 
      img.save(display)
开发者ID:dattasaurabh82,项目名称:SimpleCV-Studies,代码行数:33,代码来源:ex7PhotoBooth.py

示例12: FingerTrackerPeaks

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
class FingerTrackerPeaks(FingerTracker):
    """Finger tracking using peak-findings
    """

    def __init__(self, camera=None):
        """Initialize the finger tracker

        :param TrackerIn ti: Tracker input
        :param camera: Camera index, filename, or None
        """
        FingerTracker.__init__(self, camera)
        self.display = None

    def crop_img(self, img):
        return img.crop(50, 150, img.width - 100, img.height - 150)
        return img.crop(490, 95, img.width - 1000, img.height - 290).rotate(90, fixed=False)

    def find_fingers3(self, img, prev_img):
        if img is None or prev_img is None:
            return []

        crop_spec = [0, 0, img.width, img.height]
        scale_factor = 2
        r1 = img.grayscale().crop(*crop_spec)
        r2 = prev_img.grayscale().crop(*crop_spec)

        # modified
        diff = (r2 - r1).binarize(40)
        edge_mask = diff.erode(5).dilate(5) - diff.erode(5)
        edge_mask = edge_mask.dilate(5)
        scaled = (diff.edges() & edge_mask).resize(r1.width / scale_factor)

        points = []
        for x in range(scaled.width):
            points.append(scaled.edgeIntersections((x, 0), (x, scaled.height))[0])
        points = [xy for xy in points if xy is not None]
        if not points:
            return []

        xs = range(scaled.width)
        ys = scipy.interp(range(scaled.width), [a[0] for a in points], [a[1] for a in points])
        peaks = scipy.signal.find_peaks_cwt(-ys, np.arange(7, 11))
        if len(peaks) == 0:
            return []

        positions = np.array(zip(peaks, np.array(ys)[peaks])) * scale_factor + np.array(crop_spec[:2])

        return positions

    def run_frame(self, ti, img):
        """Run the algorithm for one frame

        :param TrackerIn ti: TrackerIn object to send events to
        :return: True if I should be called with the next frame
        """
        img = self.crop_img(img)

        if self.display is None:
            # Consume one frame for the initialization
            self.display = Display(img.size())
            self.prev_img = img
            self.bg_img = None
            self.count = 20
            self.last_time = time.time()
            return True
        elif self.display.isDone():
            return False

        if self.bg_img is None and img:
            self.bg_img = img

        positions = self.find_fingers3(img, self.bg_img)
        if self.count > 0:
            self.bg_img = img
            self.count -= 1
            print "SETTING BG IMAGE"

        di = img  # (bg_img.grayscale() - img.grayscale()).binarize(40)
        for x, y in positions:
            di.dl().circle((int(x), int(y)), 15, color=Color.RED, width=3)
        self.add_positions(ti, positions)

        fps = 1.0 / (time.time() - self.last_time)
        di.dl().ezViewText("{0:.3f} fps".format(fps), (0, 0))
        di.save(self.display)

        self.last_time = time.time()
        self.last_img = True

        if self.display.mouseLeft or self.display.mouseRight:
            self.display.done = True
            return False
        else:
            return True

    def finish(self):
        if self.display is not None:
            self.display.done = True
            self.display.quit()
开发者ID:DenerosArmy,项目名称:asterisk,代码行数:101,代码来源:fingertracker_peaks.py

示例13: Camera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
# -*- coding: utf-8 -*-

from SimpleCV import Display, Image, Camera

cam = Camera()
display = Display()
while display.isDone() == False:
    img = cam.getImage()

    img.show()
    
exit()
开发者ID:italofernandes84,项目名称:Python-SimpleCV_Course_Examples,代码行数:14,代码来源:ex6.py

示例14: JpegStreamCamera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
    squareConrnerY = centerPointY - boxHeight / 2
    pic.drawRectangle(squareConrnerX, squareConrnerY, boxWidth, boxHeight)
    return



windowSize = (640,480)
# Initialize the webcam by providing URL to the camera
cam = JpegStreamCamera("http://192.168.2.103:8080/video?submenu=mjpg")
face = 0
display = Display(windowSize)
img = cam.getImage()
img.save(display)
done = False
while not done:
    if not display.isDone():
        img = cam.getImage()
        test = {}            # Dictionary containing difference images of a particular sticker and standard colors 
        pixValues = []        # List containing the pixel values from (20,50) to (20,80) of each image present in test
        averagesDict = {}    # Dictionary containing the average of pixValues corresponding to each color
        averagesList = []    # List containing all the average of pixValues corresponding to each color
        stickerColors = [[],[],[]] # Contains first letter of color of all the stickers in a picture
        DrawSquare(img, (320,240), 300)
        # Coordinates corresponding to the 'origin' of the cube
        squareCornerX = 170    
        squareCornerY = 90
        for i in range(0,3):
            for j in range(0,3):
                croppedImg = img.crop(squareCornerX + j*100, squareCornerY + i*100, 100, 100) #to obtain just the sticker
                for color in rubikColor:
                    test[color] = croppedImg.colorDistance(rubikColor[color])
开发者ID:bhar92,项目名称:Rubik-Robot,代码行数:33,代码来源:snap_analyze_algo.py

示例15: Camera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isDone [as 别名]
from SimpleCV import Camera, Display, VideoStream, VirtualCamera, Color
from time import sleep
import numpy

cam = Camera(prop_set={'width':320, 'height':240})
dis = Display(resolution=(320,240))
lastCoordinates = (0,0)
vidStream = VideoStream("test.mov", 25, True)

while not dis.isDone():
    frame = cam.getImage()
    faces = frame.findHaarFeatures('face')
    if faces:
        for face in faces:
            # Checks to see if the (x,y) is greater than or less than the last (x,y). Then we have motion.
            if face.coordinates()[0] > lastCoordinates[0]+3 or face.coordinates()[1] > lastCoordinates[1]+3 or face.coordinates()[0] < lastCoordinates[0]-3 or face.coordinates()[1] < lastCoordinates[1]-3:
                lastCoordinates = face.coordinates()
                face.draw()
                frame.save(vidStream)
    # Show the image
    frame.show()
    # My attempt to get around 30 frames per second.. though I haven't checked this.
    sleep(1./30.)

if dis.IsDone():
    cam.close()
    dis.close()
开发者ID:wiremanb,项目名称:SimpleCV,代码行数:29,代码来源:getFace.py


注:本文中的SimpleCV.Display.isDone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。