def recordOutput():
	output = "\nTOTAL FILTER TIME:\t "+str(time)+"\n\nAVERAGE TIME PER FRAME:\t "+str(time/numFrames)+"\n\nAVERAGE FRAMES PER SECOND:\t "+str(1 / (time / numFrames))+"\n\nTOTAL TIME INCLUDING CAPTURE:\t "+str(total)+"\n\nAVERAGE TIME PER FRAME INCLUDING CAPTURE:\t "+str(total/numFrames)+"\n\nAVERAGE FRAMES PER SECOND INCLUDING CAPTURE:\t "+str(1 / (total/numFrames))+"\n\nTOTAL KNOWN CAPTURE TIME:\t "+str(timeCapture)+"\n\nAVERAGE CAPTURE TIME PER FRAME:\t "+str(timeCapture / numFrames)+"\n\nAVERAGE CAPTURE FPS:\t "+str(1/ (timeCapture / numFrames))+"\n\nSTOPPED AT FRAME:\t "+str(numFrames)+" OUT OF: "+str(controlFrames)+"\n\n"
	print output
	if doOutput:
		try:
			fil = open(outputDir, "r")
			fil.close()
		except:
			fil = open(outputDir, "w")
			fil.close()
		f = open(outputDir, "a")
		f.write(output)
		f.write("================================================================")
		f.write("\n\n")
		f.write("================================================================")
		f.close()
	queue.close()
	queue.join_thread()
	p.join()
Exemple #2
0
def recordOutput():
    output = "\nTOTAL FILTER TIME:\t " + str(
        time) + "\n\nAVERAGE TIME PER FRAME:\t " + str(
            time / numFrames) + "\n\nAVERAGE FRAMES PER SECOND:\t " + str(
                1 / (time / numFrames)
            ) + "\n\nTOTAL TIME INCLUDING CAPTURE:\t " + str(
                total
            ) + "\n\nAVERAGE TIME PER FRAME INCLUDING CAPTURE:\t " + str(
                total / numFrames
            ) + "\n\nAVERAGE FRAMES PER SECOND INCLUDING CAPTURE:\t " + str(
                1 / (total / numFrames)
            ) + "\n\nTOTAL KNOWN CAPTURE TIME:\t " + str(
                timeCapture) + "\n\nAVERAGE CAPTURE TIME PER FRAME:\t " + str(
                    timeCapture /
                    numFrames) + "\n\nAVERAGE CAPTURE FPS:\t " + str(
                        1 / (timeCapture / numFrames)
                    ) + "\n\nSTOPPED AT FRAME:\t " + str(
                        numFrames) + " OUT OF: " + str(controlFrames) + "\n\n"
    print output
    if doOutput:
        try:
            fil = open(outputDir, "r")
            fil.close()
        except:
            fil = open(outputDir, "w")
            fil.close()
        f = open(outputDir, "a")
        f.write(output)
        f.write(
            "================================================================")
        f.write("\n\n")
        f.write(
            "================================================================")
        f.close()
    queue.close()
    queue.join_thread()
    p.join()
						output = filt.run(filt.image)

					capture.truncate(0)
					capture.seek(0)
					e2 = cv2.getTickCount()
					time += (e2 - e1) / cv2.getTickFrequency()
					numFrames += 1
					if controlFrames != 0 and numFrames >= controlFrames:
						break
			elif cType == 3:
				camera.capture_sequence(outputs(), 'jpeg', use_video_port=True)
		except KeyboardInterrupt:
			breaking = True
		tot2 = cv2.getTickCount()
		totalTime = (tot2-tot1) / cv2.getTickFrequency()
		# print "Test %i with settings %i: Captured %i frames at total fps of %.2f, with internal fps of %.2f. Saw a contour in %i frames." % (i, cType, numFrames, numFrames/totalTime, numFrames/time, goodFrames)
		out += "Test %i with settings %i:\tCaptured %i frames at total fps of %.2f, with internal fps of %.2f. Saw a contour in %i frames.\n" % (i, cType, numFrames, numFrames/totalTime, numFrames/time, filt.contourCount)
	if breaking:
		print "BREAKING OUT"
		break
try:
	f = open(outputDir, "r")
except:
	f = open(outputDir, "w")
	f.write(str(outputDir)+": A place to store data from various Baseline tests.")
f.close()
print out
f = open(outputDir, "a")
f.write(out)
f.close()
            ) + "\n\nTOTAL TIME INCLUDING CAPTURE:\t " + str(
                total
            ) + "\n\nAVERAGE TIME PER FRAME INCLUDING CAPTURE:\t " + str(
                total / numFrames
            ) + "\n\nAVERAGE FRAMES PER SECOND INCLUDING CAPTURE:\t " + str(
                1 / (total / numFrames)) + "\n\nSTOPPED AT FRAME:\t " + str(
                    numFrames) + "\n\nWAITED FOR:\t " + str(
                        waits * (time / numFrames)) + " SECONDS!\n\n"
    print output
    if doOutput:
        try:
            fil = open(outputDir, "r")
            fil.close()
        except:
            fil = open(outputDir, "w")
            fil.close()
        f = open(outputDir, "a")
        f.write(output)
        f.write(
            "================================================================")
        f.write("\n\n")
        f.write(
            "================================================================")
        f.close()

# Shut down the processors in an orderly fashion
while pool:
    with lock:
        processor = pool.pop()
    processor.terminated = True
    processor.join()
                    e2 = cv2.getTickCount()
                    time += (e2 - e1) / cv2.getTickFrequency()
                    numFrames += 1
                    if controlFrames != 0 and numFrames >= controlFrames:
                        break
            elif cType == 3:
                camera.capture_sequence(outputs(), 'jpeg', use_video_port=True)
        except KeyboardInterrupt:
            breaking = True
        tot2 = cv2.getTickCount()
        totalTime = (tot2 - tot1) / cv2.getTickFrequency()
        # print "Test %i with settings %i: Captured %i frames at total fps of %.2f, with internal fps of %.2f. Saw a contour in %i frames." % (i, cType, numFrames, numFrames/totalTime, numFrames/time, goodFrames)
        out += "Test %i with settings %i:\tCaptured %i frames at total fps of %.2f, with internal fps of %.2f. Saw a contour in %i frames.\n" % (
            i, cType, numFrames, numFrames / totalTime, numFrames / time,
            filt.contourCount)
    if breaking:
        print "BREAKING OUT"
        break
try:
    f = open(outputDir, "r")
except:
    f = open(outputDir, "w")
    f.write(
        str(outputDir) +
        ": A place to store data from various Baseline tests.")
f.close()
print out
f = open(outputDir, "a")
f.write(out)
f.close()
Exemple #6
0
			if controlFrames != 0 and numFrames >= controlFrames:
				break
	elif capType == 2:
		camera.capture_sequence(outputs(), 'jpeg', use_video_port=True)
	else:
		raise TypeError("Incorrect capType! capType can only be between 1 and 2. capType=%i" % (capType))
except KeyboardInterrupt:
	pass


tot2 = cv2.getTickCount()
total = (tot2 - tot1) / cv2.getTickFrequency()
cv2.destroyAllWindows()
camera.close()

output = "\nTOTAL FILTER TIME:\t "+str(time)+"\n\nAVERAGE TIME PER FRAME:\t "+str(time/numFrames)+"\n\nAVERAGE FRAMES PER SECOND:\t "+str(1 / (time / numFrames))+"\n\nTOTAL TIME INCLUDING CAPTURE:\t "+str(total)+"\n\nAVERAGE TIME PER FRAME INCLUDING CAPTURE:\t "+str(total/numFrames)+"\n\nAVERAGE FRAMES PER SECOND INCLUDING CAPTURE:\t "+str(1 / (total/numFrames))+"\n\nSTOPPED AT FRAME:\t "+str(numFrames)+" OUT OF: "+str(controlFrames)+"\n\n"
print output
if doOutput:
	try:
		fil = open(outputDir, "r")
		fil.close()
	except:
		fil = open(outputDir, "w")
		fil.close()
	f = open(outputDir, "a")
	f.write(output)
	f.write("================================================================")
	f.write("\n\n")
	f.write("================================================================")
	f.close()