Пример #1
0
def run_samples(n):
    net = net6_c.NetSix_C()
    path = '/media/1tb/Izzy/nets/net6_05-11-2016_12h09m12s.ckpt'
    sess = net.load(path)

    bc = BinaryCamera('./meta.txt')
    bc.open()
    for i in range(4):
        bc.read_frame()    


    num_samples = n
    samples = []
    images = []
    for i in range(num_samples):
        print i
        try:
            while True:
                frame = bc.read_frame()
                frame = inputdata.im2tensor(frame, channels=3)
                cv2.imshow('preview', frame)
                cv2.waitKey(30)            
        except:
            pass
        frame = bc.read_frame()
        frame = similarity.color(frame)
        images.append(frame)
        print "Saved sample"    
        np.save('samples_images.npy', images)
Пример #2
0
from pipeline.bincam import BinaryCamera
import cv2
import time
import numpy as np
from Net.tensor import inputdata
from edgeRICam import getTemplates, processFrame, findInitialMatch, traceObj, updateMatch

bc = BinaryCamera("./meta.txt")
bc.open()
frame = bc.read_frame()
#store processed templates; list of lists with various rotations of each template
filtTemplates = getTemplates()
sampleTemps = filtTemplates[0]
filtFrame = processFrame(frame)
pos, foundTemp = findInitialMatch(filtFrame, sampleTemps)
out = traceObj(frame, pos, foundTemp)
cv2.imshow("camera", out)
print("initial match found- press any key to begin")
cv2.waitKey(5000)
try:
	while True:
	    frame = bc.read_frame()
	    filtFrame = processFrame(frame)
        pos, foundTemp = updateMatch(pos, frame, sampleTemps)
        out = traceObj(frame, pos, foundTemp)
        cv2.imshow("camera",out)
        cv2.waitKey(250)
except KeyboardInterrupt:
    pass
Пример #3
0
from pipeline.bincam import BinaryCamera
import cv2
import numpy as np
from Net.tensor import inputdata, net4
bc = BinaryCamera('./meta.txt')
bc.open()
frame = bc.read_frame()
net_path = '/media/1tb/Izzy/nets/net4_02-17-2016_19h07m23s.ckpt'
#vc = cv2.VideoCapture(0)
#rval, frame = vc.read()

tf_net = net4.NetFour()
tf_net_path = net_path
sess = tf_net.load(var_path=tf_net_path)

while True:
    frame = bc.read_frame()

    img = cv2.resize(frame.copy(), (250, 250))
    img = np.reshape(img, (250, 250, 3))
    cv2.imwrite("test.jpg", img.copy())
    img_jpg = cv2.imread("test.jpg", 1)

    not_saved = tf_net.output(sess, img, channels=3)
    saved = tf_net.output(sess, img, channels=3)

    print "NOT SAVED ", not_saved
    print "SAVED ", saved