Exemplo n.º 1
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[
Exemplo n.º 2
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(