Esempio n. 1
0
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks
from ospery_diver.util import *

if __name__ == '__main__':

	cam = Camera(cv2)
	display = Display(cv2)
	executor = Executor(cv2, np)

	while( True ):

		frame = cam.getFrame()
		
		#point = executor.run(tasks.gateDetector, cam.getFrame())


		#if point is not None:

			#draw a cross hair
		#	cv2.circle(frame, (point.getX() ,point.getY()), 40, (0,0,255), 5)

		print frame
		rects = executor.run(tasks.findBoundingRectsByColor, cam.getFrame(), ORANGE)

		for rect in rects:
			display.drawContour(frame, rect, RED, 2)

		if (display.show(frame, "output")==-1):
			break
Esempio n. 2
0
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks, Communicator
from ospery_diver.util import *
import time

cam = Camera(cv2)
display = Display(cv2)
executor = Executor(cv2, np)
comm = Communicator('COM4', 9600)
# for video logging please donot erase!
# fps = 13
# size = cam.getFrameSize()
# fwdCamFileName = 'fwdCamera.avi'
# videoWriter = cam.getVideoSettings(fwdCamFileName,fps,size)
# numFramesRemaining = 10 * fps - 1
#colorCalibrate(all_colors())

task_name = ""


def runDisplay(frame, text):

    return display.show(frame, text)


def idlePhase():

    task_num = comm.standBy()  # Awaiting orders from the arduino.
    print task_num
    task = tasks.TASKS[
Esempio n. 3
0
# import function, variable, and classes from other modules  
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks
from ospery_diver.util import *


cam = Camera(cv2)              # Camera Object
display = Display(cv2)         # Object used to display results or camera frames
executor = Executor(cv2, np)   # The object that is responsible for executing different tasks (color detection, buoy detection, etc )

# Program we will be constantly looping 
# press CTRL-C to abort (end program) 
while( True ):

    frame = cam.getFrame()    # get a single frame or image from the camera and store it in a object

    # Try running the task with different colors
    # Comment the color = ORANGE and uncomment either color = BLUE or color GREEN 
    color = ORANGE
    #color = BLUE
    #color = GREEN


    buoyTask = executor.run(tasks.buoyDetector, frame, color)   # Execute the task. The executed task can be stored in variable     
	
    buoyResult = buoyTask.result()    # grab a result object from the task 
    buoyResult.drawOnFrame(frame)     # the result  of the task can draw on the frame 

    # comment the if block below and uncomment the other if block to see the thresholded frame
    if (display.show(frame, "output")==-1):
Esempio n. 4
0
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks, Communicator
from ospery_diver.util import *
import time

cam = Camera(cv2)
display = Display(cv2)
executor = Executor(cv2, np)
# for video logging please donot erase!
# fps = 13
# size = cam.getFrameSize()
# fwdCamFileName = 'fwdCamera.avi'
# videoWriter = cam.getVideoSettings(fwdCamFileName,fps,size)
# numFramesRemaining = 10 * fps - 1
colorCalibrate(all_colors())

while( True ):

	frame = cam.getFrame()

	buoyTask = executor.run(tasks.buoyDetector, frame, orange())
	
	buoyResult = buoyTask.result()
	buoyResult.drawOnFrame(frame)
	
	display.show(buoyTask.getThresholdFrame(), "buoy_threshold")
	
	#rectResult = executor.run(tasks.findBoundingRectsByColor, frame, orange())
	#rectResult.result().drawOnFrame(frame)
	
Esempio n. 5
0
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks, Communicator
from ospery_diver.util import *
import time

cam = Camera(cv2)
display = Display(cv2)
executor = Executor(cv2, np)
# for video logging please donot erase!
# fps = 13
# size = cam.getFrameSize()
# fwdCamFileName = 'fwdCamera.avi'
# videoWriter = cam.getVideoSettings(fwdCamFileName,fps,size)
# numFramesRemaining = 10 * fps - 1
colorCalibrate(all_colors())

while (True):

    frame = cam.getFrame()

    buoyTask = executor.run(tasks.buoyDetector, frame, orange())

    buoyResult = buoyTask.result()
    buoyResult.drawOnFrame(frame)

    display.show(buoyTask.getThresholdFrame(), "buoy_threshold")

    #rectResult = executor.run(tasks.findBoundingRectsByColor, frame, orange())
    #rectResult.result().drawOnFrame(frame)
Esempio n. 6
0
# import function, variable, and classes from other modules
import numpy as np
import cv2
from ospery_diver import Camera, Display, Executor, tasks
from ospery_diver.util import *

cam = Camera(cv2)  # Camera Object
display = Display(cv2)  # Object used to display results or camera frames
executor = Executor(
    cv2, np
)  # The object that is responsible for executing different tasks (color detection, buoy detection, etc )

# Program we will be constantly looping
# press CTRL-C to abort (end program)
while (True):

    frame = cam.getFrame(
    )  # get a single frame or image from the camera and store it in a object

    # Try running the task with different colors
    # Comment the color = ORANGE and uncomment either color = BLUE or color GREEN
    color = ORANGE
    #color = BLUE
    #color = GREEN

    buoyTask = executor.run(
        tasks.buoyDetector, frame,
        color)  # Execute the task. The executed task can be stored in variable

    buoyResult = buoyTask.result()  # grab a result object from the task
    buoyResult.drawOnFrame(