コード例 #1
0
import numpy as np
import cv2
import PID
import server
import usb
import cubeFinder
import stereo


cameraR = usb.USBCamera(0)
cameraL = usb.USBCamera(1)

cubeR = cubeFinder.CubeFinder(cameraR)
cubeL = cubeFinder.CubeFinder(cameraL)

stereo = stereo.Stereo(cubeR, cubeL, 8)

while 1:

	stereo.track()
	print "r"+str(stereo.finders[0].angle)
	print "l"+str(stereo.finders[1].angle)
	print "d"+str(stereo.distanceToTarget)

	cv2.imshow("r", stereo.finders[0].frame)
	cv2.imshow("l", stereo.finders[1].frame)
	cv2.waitKey(1)

	#print stereo.distanceToTarget()

コード例 #2
0

def send(data):
    s.sendto(data, address)


def sendErrorValues(found, x, y, angle):
    status = 1 if found else 0
    data = '%3.1f %3.1f %3.1f %d \n' % (x, y, angle, status)
    print(data)
    send(data)


subprocess.check_call(
    ["uvcdynctrl", "-s", "White Balance Temperature, Auto", "0"])
subprocess.check_call(["uvcdynctrl", "-s", "Brightness", "30"])
subprocess.check_call(["uvcdynctrl", "-s", "Exposure, Auto", "1"])
subprocess.check_call(["uvcdynctrl", "-s", "Exposure (Absolute)", "5"])
camera = usb.USBCamera(1, 800, 448)

finder = targetFinder2019.targetFinder(camera)
#finder = HatchFinder2019.hatchFinder(camera)
while 1:
    start = datetime.now()
    result = finder.find()
    end = datetime.now()
    timeElapsed = end - start
    #print timeElapsed.total_seconds()
    #print result
    sendErrorValues(*result)
コード例 #3
0
ファイル: trackLED.py プロジェクト: Team1559/Vision2018
import numpy as np
import cv2
import PID
import server
import usb
import LEDFinder

#p = PID.PID(0.0033,0,0,0,0,500,-500)
#p.setPoint(0)

camera = usb.USBCamera(0)
#camera.setExposure(9)
led = LEDFinder.LEDFinder(camera)
led.setRed()
#led.setBlue()

#server.startServer()

while 1:

    led.find()
    led.calculateConfidence()

    cv2.imshow("frame", led.frame)
    cv2.waitKey(1)

    #print led.confidence

    #print led.err

    #if(led.err != -1000):