Exemplo n.º 1
0
    def __init__(self, src):
        self.cap = video.create_capture(src, presets['book'])
        self.frame = None
        self.paused = False
        self.tracker = PlaneTracker()

        cv2.namedWindow('plane')
        self.rect_sel = common.RectSelector('plane', self.on_rect)
Exemplo n.º 2
0
    def __init__(self, src):
        self.cap = cv2.VideoCapture(src)
        self.frame = None
        self.paused = False
        self.tracker = PlaneTracker()

        cv2.namedWindow('plane')
        self.rect_sel = common.RectSelector('plane', self.on_rect)
Exemplo n.º 3
0
    def __init__(self, src):
        self.cap = video.create_capture(src)
        self.frame = None
        self.paused = False
        self.tracker = PlaneTracker()

        cv2.namedWindow('plane')
        cv2.createTrackbar('focal', 'plane', 25, 50, common.nothing)
        self.rect_sel = common.RectSelector('plane', self.on_rect)
    def __init__(self, src):
        image = cv.imread(src, 1)
        small = cv.resize(image, (0,0), fx=0.125, fy=0.125) # resizing the image, as high resolution image taken
        self.frame = small
        self.paused = False
        self.tracker = PlaneTracker()

        cv.namedWindow('Selected Region')
        # cv.setMouseCallback('Selected Region', self.draw_circle_corner)
        self.rect_sel = common.RectSelector('Selected Region', self.on_rect)
Exemplo n.º 5
0
    def __init__(self, src):
        self.cap = video.create_capture(src, presets['book'])
        self.frame = None
        self.paused = False
        self.tracker = PlaneTracker()

        cv.namedWindow('plane', cv.WINDOW_NORMAL)
        cv.createTrackbar('focal', 'plane', 25, 50, common.nothing)
        cv.resizeWindow('plane', 1920, 1080)
        self.rect_sel = common.RectSelector('plane', self.on_rect)
Exemplo n.º 6
0
 def __init__(self, src):
     cv.namedWindow(WIN_NAME)
     cv.moveWindow(WIN_NAME, 0, 0)
     self.cap = video.create_capture(src, presets['book'])
     self.frame = None
     self.auto_output_frame = None
     self.paused = False
     self.tracker = PlaneTracker()
     self.rect_sel = common.RectSelector('plane', self.on_rect)
     self.user_selected_rect = None
     self.focal_length = 0.0
     self.horizontal_angel = 0.0
     self.known_distance = 200
     self.KNOWN_WIDTH = 40
     self.KNOWN_HEIGHT = 40
     self.msg = None
     self.serial = 0
     self.auto_save = False
     self.auto_serial = 0
Exemplo n.º 7
0
    def __init__(self):
        self.template = None
        self.paused = False
        self.recognised = False
        self.tracker = PlaneTracker()
        self.character = ""

		#Add template images to tracker
        scarlet = cv2.imread(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'cluedo_images/scarlet.png')))
        mustard = cv2.imread(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'cluedo_images/mustard.png')))
        plum = cv2.imread(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'cluedo_images/plum.png')))
        peacock = cv2.imread(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'cluedo_images/peacock.png')))

        scarlet_rect = (0,0,scarlet.shape[1],scarlet.shape[0])
        mustard_rect = (0,0,mustard.shape[1],mustard.shape[0])
        plum_rect = (0,0,plum.shape[1],plum.shape[0])
        peacock_rect = (0,0,peacock.shape[1],peacock.shape[0])

        self.tracker.add_target(scarlet.copy(), scarlet_rect,'scarlet')
        self.tracker.add_target(mustard.copy(), mustard_rect,'mustard')
        self.tracker.add_target(plum.copy(), plum_rect,'plum')
        self.tracker.add_target(peacock.copy(), peacock_rect,'peacock')
Exemplo n.º 8
0
import numpy as np
import cv2
from common import getsize, draw_keypoints
from plane_tracker import PlaneTracker

face_cascade = cv2.CascadeClassifier(
    'haarcascades/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_eye.xml')

searchFor = cv2.imread('myPic.jpg', 0)  # Load Search Image
#searchForGray = cv2.cvtColor(searchFor, cv2.COLOR_BGR2GRAY) # Change to GRAY
searchHeight, searchWidth = searchFor.shape

tracker = PlaneTracker()
tracker.add_target(searchFor, (0, 0, searchWidth, searchHeight))

cap = cv2.VideoCapture(0)  # Init Camera

while (True):
    # Get Frame
    ret, img = cap.read()
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x, y, w, h) in faces:
        cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0),
                      2)  # Draw Faces On img

        # Crop Face
        cropped = img[y:y + h, x:x + w]
        #croppedGray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)
Exemplo n.º 9
0
 def __init__(self, features_detect=1500):
     self.tracker = PlaneTracker(0.025, 10, max_features_detect=1500)
     self.__templates = []  # Keep track of templates being tracked