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


Python Display.isNotDone方法代码示例

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


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

示例1: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main(cameraNumber, camWidth, camHeight, outputFile):

    BUFFER_NAME = 'cloud3.avi'
    vs = VideoStream(fps=24, filename=BUFFER_NAME, framefill=True)

    disp = Display((camWidth, camHeight))
    cam = Camera(cameraNumber, prop_set={"width": camWidth, "height": camHeight})

    # while the user does not press 'esc'
    start_time = time()
    count = 0
    while disp.isNotDone():
        # KISS: just get the image... don't get fancy
        img = cam.getImage()
        print type(img)

        skimage.io.push(img)

        #img.show()

        # write the frame to videostream
        vs.writeFrame(img)

        # show the image on the display
        img.save(disp)

        current_time = time()
        if current_time-start_time>=5:
            outputFile = "testing_chunk_%d.mp4" % (count)
            print "Saving %s" % (outputFile)
            saveFilmToDisk(BUFFER_NAME, outputFile)
            start_time = time()
            count += 1
开发者ID:knealon,项目名称:Siena_College_Kelly_Nealon,代码行数:35,代码来源:simple_save_to_file.py

示例2: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main():

    x = 0;
    cam  = Camera (prop_set={'width':640, 'height':480})
    disp = Display (resolution=(320,240))
    while disp.isNotDone():
        img = cam.getImage()
        img = img.scale(0.5)
        faces = img.findHaarFeatures("eye.xml")
        #print "not Detected"
        if faces:
            for face in faces:
                face.draw()
                print "eyes Detected"
               # x = 0
        else:
            
                 # x += 1

                 print "close eyes"
                  #print (x)    
                  #if x > 10:
                  #  print "HOY GISING"

                   # return main()
        img.save(disp)
开发者ID:jctraya,项目名称:sample,代码行数:28,代码来源:test.py

示例3: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main(cameraNumber, camWidth, camHeight, outputFile):
    BUFFER_NAME = 'buffer.avi'

    # create the video stream for saving the video file
    vs = VideoStream(fps=24, filename=BUFFER_NAME, framefill=True)
    
    # create a display with size (width, height)
    disp = Display((camWidth, camHeight))
    
    # Initialize Camera
    cam = Camera(cameraNumber, prop_set={"width": camWidth, "height": camHeight})
    
    # while the user does not press 'esc'
    while disp.isNotDone():
        # KISS: just get the image... don't get fancy
        img = cam.getImage()
        
        # write the frame to videostream
        vs.writeFrame(img)
        
        # show the image on the display
        img.save(disp)
    
    # Finished the acquisition of images now Transform into a film
    makefilmProcess = Process(self.saveFilmToDisk, args=(BUFFER_NAME, outputFile))
    makefilmProcess.start()


    def saveFilmToDisk(self, bufferName, outname):
        # construct the encoding arguments
        params = " -i {0} -c:v mpeg4 -b:v 700k -r 24 {1}".format(bufferName, outname)
        
        # run avconv to compress the video since ffmpeg is deprecated (going to be).
        call('avconv'+params, shell=True)
开发者ID:Paulo-Martins,项目名称:PIVC,代码行数:36,代码来源:Video.py

示例4: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main(cameraNumber, camWidth, camHeight, outputFile):
    BUFFER_NAME = 'motiontest.avi'

    # create the video stream for saving the video file
    #vs = VideoStream(fps=24, filename=fname, framefill=True)
    vs = VideoStream(fps=24, filename=BUFFER_NAME, framefill=True)

    # create a display with size (width, height)
    disp = Display((camWidth, camHeight))

    # Initialize Camera
    cam = Camera(cameraNumber, prop_set={"width": camWidth, "height": camHeight})

    # while the user does not press 'esc'
    while disp.isNotDone():
        # KISS: just get the image... don't get fancy
        img = cam.getImage()

        #img.show()

        # write the frame to videostream
        vs.writeFrame(img)

        # show the image on the display
        img.save(disp)

    # Finished the acquisition of images now Transform into a film
    #self.makefilmProcess = Process(target=self.saveFilmToDisk, args=(BUFFER_NAME, outputFile))
    #self.makefilmProcess.start()
    saveFilmToDisk(BUFFER_NAME, outputFile)
开发者ID:knealon,项目名称:Siena_College_Kelly_Nealon,代码行数:32,代码来源:FindAndRecord630.py

示例5: init

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
class GUIManager:

  def init(self):
    self.dis = Display(title='FRC Team 3341 Targeting')  # creates a window
    
  def setImage(self, image):
    self.img = image
    
  def setImageText(self, imageText):
    self.img.drawtext(imagetext, self.img.height/2, self.img.width/2)  
    # the height and width may need to be switched around
    # it could also be that the image is bigger than the display
    
  def setFeatures(self, blobs=None, ls=None):  #draws the features like blobs and Ls
    if self.blobs:
      for b in blobs:
        b.draw()

    if ls:
        for l in ls:
          l.draw()  # the L draw function draws the Ls upside down for some reason
    
  def show(self):  
    # I took out the isFile parameter because a video is not displayed differently than an image in simplecv
    # the thing where it waits for a key to be pressed was taken out too because it made the program crash
    self.img.save(self.dis)
    
  def disIsNotDone(self):
    # this is used to find if the window has been exited out of
    return self.dis.isNotDone()
开发者ID:nickwn,项目名称:simplecv-cv-2015,代码行数:32,代码来源:GUIManager.py

示例6: run

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
    def run(self):
        m = alsaaudio.Mixer()   # defined alsaaudio.Mixer to change volume
        scale = (300,250)    # increased from (200,150). works well
        d = Display(scale)
        cam = Camera()
        prev = cam.getImage().scale(scale[0],scale[1])
        sleep(0.5)
        buffer = 20
        count = 0
        prev_t = time()    # Note initial time
        while d.isNotDone():
            current = cam.getImage()
            current = current.scale(scale[0],scale[1])
            if( count < buffer ):
                count = count + 1
            else:
                fs = current.findMotion(prev, method="LK")   # find motion
                # Tried BM, and LK, LK is better. need to learn more about LK
                if fs:      # if featureset found
                    dx = 0
                    dy = 0
                    for f in fs:
                        dx = dx + f.dx      # add all the optical flow detected
                        dy = dy + f.dy
                
                    dx = (dx / len(fs))     # Taking average
                    dy = (dy / len(fs))

                    prev = current
                    sleep(0.01)
                    current.save(d)
                    
                    if dy > 2 or dy < -2:
                        vol = int(m.getvolume()[0]) # getting master volume
                        if dy < 0:
                            vol = vol + (-dy*3)
                        else:
                            vol = vol + (-dy*3)
                        if vol > 100:
                            vol = 100
                        elif vol < 0:
                            vol = 0
                        print vol
                        m.setvolume(int(vol))   # setting master volume
                        
                    if dx > 3:
                        cur_t = time()
                        if cur_t > 5 + prev_t:  # adding some time delay
                            self.play("next")   # changing next
                            prev_t = cur_t
                        
                    if dx < -3:
                        cur_t = time()
                        if cur_t > 5 + prev_t:
                            prev_t = cur_t
                        self.play("previous")   # changing previous
开发者ID:anantkamath,项目名称:SimpleCVexamples,代码行数:58,代码来源:banshee_control.py

示例7: show_img

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def show_img(img):
    display = Display()
    img.show()

    # Wait for user to close the window or break out of it.
    while display.isNotDone():
        try:
            pass
        except KeyboardInterrupt:
            display.done = True
        if display.mouseRight:
            display.done = True
    display.quit()
开发者ID:david-crespo,项目名称:py-super-hexagon,代码行数:15,代码来源:util.py

示例8: interactiveTranslation

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def interactiveTranslation():
	cam = Camera()
	disp = Display()
	current = " "
	while disp.isNotDone():
		image = cam.getImage()
		if disp.mouseLeft: break
		if disp.mouseRight:
			text = image.readText()
			text = cleanText(text)
			translated = trans.translate(text, langpair)
			if translated: current = translated
		image.drawText(current, 0, 0, color=Color.BLACK, fontsize=40)
		image.save(disp)
开发者ID:pianiel,项目名称:simplecv-demo,代码行数:16,代码来源:quotes.py

示例9: Run

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def Run(cmdPipe):
    steadyStateFPS = 10
    desiredBuffer = 60*60 #1 minute * 60 seconds
    numberOfFrames = steadyStateFPS*desiredBuffer;
    fmt = '%Y-%m-%d %H:%M:%S'

    disp = Display()

    filelist = []
    frameCounter = 101
    sleepTime = .1

    while disp.isNotDone():
        # check command
        if cmdPipe.poll():
            cmd = cmdPipe.recv()
            if cmd=='shutdown':
                print('player', 0, "Shutting down.")
                break

        if frameCounter > 100 or len(filelist) == 0:
            frameCounter = 0
            filelist = glob("images/*.jpg")
            if len(filelist)>numberOfFrames:
                sleepTime = 1.0/steadyStateFPS
                print("player", 0, "number of frames in buffer="+str(len(filelist))+" desired="+str(numberOfFrames)+" setting sleeptime to "+str(sleepTime))
            else:
                sleepTime = (1.0/steadyStateFPS)+.01
                print("player", 0, "number of frames in buffer="+str(len(filelist))+" desired="+str(numberOfFrames)+" setting sleeptime to "+str(sleepTime))


        filename = filelist.pop(0)
        img = Image(filename)
        matchObj = re.search(r'[0-9- :]+', filename)

        d1_ts = time.mktime(datetime.strptime(matchObj.group(), fmt).timetuple())
        d2_ts = time.mktime(datetime.utcnow().timetuple())
        offset = int(d1_ts-d2_ts)/60
        img.drawText(str(offset),  x=600, y=470)
        img.save(disp)
        os.remove(filename)
        frameCounter = frameCounter+1
        time.sleep(sleepTime)
开发者ID:dlgreenwald,项目名称:slowglass,代码行数:45,代码来源:player.py

示例10: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main():
    global ON_CIRCLE

    colour = Color.RED
    cam  = Camera()
    disp = Display()
    obj_x = 150
    obj_y = 75
    radius = 25
    normaldisplay = True
    while disp.isNotDone():
        if disp.mouseRight:
            normaldisplay = not(normaldisplay)
            print "Display Mode:", "Normal" if normaldisplay else "Segmented"

        img = cam.getImage()
        img = img.scale(0.5).flipHorizontal()
        dist = img.colorDistance(Color.BLACK).dilate(2)
        img.dl().circle((obj_x, obj_y), radius, colour, filled = True)
        segmented = dist.stretch(200,255)
        palm = img.findHaarFeatures('/home/malithsen/downloads/palm.xml')
        fist = img.findHaarFeatures('/home/malithsen/downloads/agest.xml')
        if palm:
            # palm = palm.sortArea()
            palm = palm[-1]
            colour = parm_on_obj(obj_x, obj_y, radius, palm)
            palm.draw()
        elif fist:
            # fist = fist.sortArea()
            fist = fist[-1]
            fist.draw()
            if ON_CIRCLE:
                colour = Color.GREEN
                obj_x, obj_y = fist.x, fist.y
        if normaldisplay:
            img.show()
        else:
            segmented.show()
开发者ID:malithsen,项目名称:cv-experiments,代码行数:40,代码来源:gesture.py

示例11: record

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def record(filename):
    from SimpleCV import Camera, Display
    import time
    neg_dir = "rawdata/%s" % filename
    if not os.path.exists(neg_dir):
        os.makedirs(neg_dir)
    cam = Camera()
    dis = Display()
    time.sleep(2)
    targetFps = 15.0
    fps = targetFps
    sleepTime = 1/targetFps
    start = time.time()
    prevTime = None
    count = 0
    try:
        print "Recording... [keyboard interrupt to quit]"
        while dis.isNotDone():
            img = cam.getImage()
            img = scaleDown(img)
            if fps > targetFps + .5:
                sleepTime += 0.005
            elif fps < targetFps:
                sleepTime = max(sleepTime - 0.005, 0.01)
            if prevTime is not None:
                fps = 1.0 / (time.time() - prevTime)
            prevTime = time.time()
            img.save("%s/%05d.jpg" % (neg_dir, count + 1600))
            count += 1
            img.dl().ezViewText("{0:.3f} fps".format(fps), (0, 0))
            img.save(dis)
            if dis.mouseRight:
                dis.quit()
            time.sleep(sleepTime)

    except KeyboardInterrupt:
        print "Done recording"
开发者ID:DenerosArmy,项目名称:asterisk,代码行数:39,代码来源:asterisk.py

示例12: main

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
def main():
    # Get file name
    if len(sys.argv) < 2:
        print "<%s> usage : <%s> <directory name>" %(sys.argv[0], sys.argv[0])
        sys.exit()
    else:
        filename = sys.argv[1]

    config = ConfigParser.RawConfigParser()
    try:
        config.readfp(open("./experiments/" + filename + "/config.ini"))
    except IOError: 
        print "Error: can\'t find file or read data"
        sys.exit()

    # Display
    display = Display()

    # Set of slide images
    slideSet = ImageSet("./experiments/" + filename)

    lineList = config.items('sequence')
    length = len(lineList)
    sleepList = list()

    # Sleep times
    for line in lineList:
        sleepList.append(int(line[1])/1000)

    # Main loop    
    while display.isNotDone():
        for index, img in enumerate(slideSet):
            img.show()
            time.sleep(sleepList[index])

    sys.exit()
开发者ID:mfkaptan,项目名称:simplecv-slideshow,代码行数:38,代码来源:slideshow.py

示例13: Camera

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

# # Hello World

# In[ ]:

from SimpleCV import Camera,Color,Display,Image
camera = Camera()
disp = Display()
while disp.isNotDone():
    image = camera.getImage()
    image.save(disp)
print("Done")
exit()


# # Detect Yellow Object

# In[1]:

from SimpleCV import Camera,Color,Display,Image
camera = Camera()
disp = Display()
while disp.isNotDone():
    image = camera.getImage()
    yellow = image.colorDistance(Color.YELLOW).binarize(140).invert()
    onlyYellow = image-yellow
    onlyYellow.save(disp)
    
print("Done")
开发者ID:jwilligers,项目名称:ComputerVision,代码行数:32,代码来源:SimpleCV.py

示例14: Display

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
#!/usr/bin/env python

from SimpleCV import Color,Display,Image

display = Display() 

while(display.isNotDone()):
 
    img = Image('example.jpg')
    barcode = img.findBarcode() #finds barcode data from image

    if(barcode is not None): #if there is some data processed
        barcode = barcode[0] 
        result = str(barcode.data)
        print result #prints result of barcode in python shell
        barcode = [] #reset barcode data to empty set

    img.save(display) #shows the image on the screen
开发者ID:kellerkind,项目名称:cvjukebox,代码行数:20,代码来源:simplecv-test.py

示例15: VirtualCamera

# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import isNotDone [as 别名]
#
# Licensed under the MIT License,
# https://github.com/baptistelabat/robokite
# Authors: Baptiste LABAT


from SimpleCV import Camera, Image, VirtualCamera, Display, DrawingLayer, Color, JpegStreamCamera, JpegStreamer
import scipy as sp
import numpy as np

cam = VirtualCamera('../Recording/Videos/Kite with leds in night - YouTube [360p].mp4','video')
img = cam.getImage()
disp = Display((810,1080))
display = True
predictedTargetPosition = (img.size()[0]/2, img.size()[1]/2)
while (not(display) or disp.isNotDone()) and img.size()!= (0, 0) :
    img = cam.getImage()
    if img.size()!= (0, 0):
     if img:
      if display: 
	    # Create a new layer to host information retrieved from video
	      layer = DrawingLayer((img.width, img.height))
      maskred = img.colorDistance(color=(200,50,70)).invert().threshold(170)
      imgred = (img*(maskred/255)).dilate(3)
      targetred=imgred.findBlobs(maxsize=200)
      maskwhite = img.colorDistance(color=(200,200,200)).invert().threshold(230)
      imgwhite = (img*(maskwhite/255)).dilate(3)
      targetwhite=imgwhite.findBlobs(maxsize=200)
      
      
      if targetred:
开发者ID:traverseda,项目名称:robokite,代码行数:33,代码来源:nightTrack.py


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