Example #1
0
    def __init__( self, **kwargs ) :
        
        for k in kwargs.keys():
            if k in ['method', 'gsize', 'gsig', 'window', 
                     'boundBoxRow', 'boundBoxCol',
                     'limRow', 'limCol',
                     'MAXONEFRAME', 'REFPING', 'MAXREF', 
                     'capRows','capCols', 'color']:
                self.__setattr__(k, kwargs[k])

        self.start = time.time()
        self.delay = 4
        self.breakT = 3
        self.breakStart = time.time()
        self.justMoved = False
        self.launch = 0
        self.launchMAX = 20

        self.setupCropping()
        self.setupFindingStructures()

        self.surf = None
        self.sift = None
        self.mser = None
        self.mserFD = None
        
        #self.Desc = None
        self.Desc = None

        logger.debug('Debug level: %s' % logger.getEffectiveLevel() )
        logger.debug('is Debug?: %s' % str(self.isDebug()))

        if not self.isDebug() and self.method != 'conf' :
            self.servos = easyEBB()#(self.capCols, self.capRows), (5,5), 5)
            time.sleep(2)
Example #2
0
    def __init__( self, **kwargs ) :
        
        for k in kwargs.keys():
            if k in ['method', 'gsize', 'gsig', 'window', 
                     'MAXONEFRAME', 'REFPING', 'MAXREF', 
                     'captureSize', 'cropRegion', 'decisionBoundary',
                     'color', 'motorsOn']:
                self.__setattr__(k, kwargs[k])

        self.trackerConnected = False

        ### Timing ###
        self.lastRefTime = time.time()        
        self.pauseFrame = 0 #cropping wise
        self.nPauseFrames = 20 #cropping wise
        
        self.breakDuration = 3 # motor wise
        self.breakStart = time.time()

        ### Worm Finding
        ## points
        self.wormLocation = utils.Point(-1 , -1 ) 
        self.wormLocationPrevious = utils.Point( -1, -1)
        self.frameCenter = utils.Point(self.captureSize.ncols / 2, self.captureSize.nrows / 2)

        ## images 
        self.refImg = None
        self.subImg = None
        self.croppedImg = None

        ### Cropping ###
        self.cmin = 0
        self.cmax = self.captureSize.ncols
        self.rmin = 0
        self.rmax = self.captureSize.nrows



        ### Logging ###
        logger.debug('Debug level: %s' % logger.getEffectiveLevel() )
        logger.debug('is Debug?: %s' % str(self.isDebug()))

        if self.initializeMotors: 
            self.servos = easyEBB()
Example #3
0
    def __init__(self, **kwargs):

        for k in kwargs.keys():
            if k in [
                    'method', 'gsize', 'gsig', 'window', 'MAXONEFRAME',
                    'REFPING', 'MAXREF', 'captureSize', 'cropRegion',
                    'decisionBoundary', 'color', 'motorsOn'
            ]:
                self.__setattr__(k, kwargs[k])

        self.trackerConnected = False

        ### Timing ###
        self.lastRefTime = time.time()
        self.pauseFrame = 0  #cropping wise
        self.nPauseFrames = 20  #cropping wise

        self.breakDuration = 3  # motor wise
        self.breakStart = time.time()

        ### Worm Finding
        ## points
        self.wormLocation = utils.Point(-1, -1)
        self.wormLocationPrevious = utils.Point(-1, -1)
        self.frameCenter = utils.Point(self.captureSize.ncols / 2,
                                       self.captureSize.nrows / 2)

        ## images
        self.refImg = None
        self.subImg = None
        self.croppedImg = None

        ### Cropping ###
        self.cmin = 0
        self.cmax = self.captureSize.ncols
        self.rmin = 0
        self.rmax = self.captureSize.nrows

        ### Logging ###
        logger.debug('Debug level: %s' % logger.getEffectiveLevel())
        logger.debug('is Debug?: %s' % str(self.isDebug()))

        if self.initializeMotors:
            self.servos = easyEBB()
Example #4
0
from skimage import io as skio
from skimage import color
import numpy as np
#import threading
from easyEBB import easyEBB

DURATION = 1000; #in ms
STEPX = 1/100 #pixels per step
STEPY = 1/100 #pixels per step
BOUNDX = 200; #pixels
BOUNDY = 200; #pixels
VIDLEN = 20; #in sec
PING = 0.5; #in sec
WINDOW = 10; #number of frames to average

ebb = easyEBB() 

#def get_frame(stream):
#    for frame in stream.frames:
#        if frame.header:
#            stream.seek(frame.position)
#        return (frame.frame_size, frame.position)

def write_video( stream, img ):
    print ('writing video')
    #stream2 = io.BytesIO()
    with stream.lock:
        #(ksize, kpos) = get_frame(stream)# Find keyframe
        for frame in stream.frames:
            if frame.header: #is keyframe
                stream.seek(frame.position)
Example #5
0
from easyEBB import easyEBB

e = easyEBB()
e.enableMotors()
e.centerWorm(100,200,300)
e.disableMotors()
e.closeSerial()
Example #6
0
from easyEBB import easyEBB

e = easyEBB()
e.enableMotors()
e.centerWorm(100, 200, 300)
e.disableMotors()
e.closeSerial()