Exemplo n.º 1
0
	def run_test(image, cascade):
		block_size = (64, 64)

		print 'XXX histogram equalisation is not implemented yet, use violajones impl'
		print '    before executing simulator'
		image = reference.equalizeHist(image)

		args = {'haar_classifier':cascade}
		# now execute the codegen
		code = Code()
		code.set_generator(gen_code.gen_detect_faces_opt, block_size, args)
		#print '# instructions: %i'%(code.instr_size())

		sim = Interpreter(code, image, block_size, 4)
		sim.run()

		detections_pixmap = sim.gen_output_image(1) # result is saved in first buffer

		# convert the number of rejections in the stages to detections
		detections = gen_code.convert_pixelmap_to_detections(detections_pixmap, cascade.size)
		return detections
Exemplo n.º 2
0
	def run_test(codegen_function, image, cascade, block_size):
		print 'running %s'%codegen_function.__name__
		print 'XXX histogram equalisation is not implemented yet, use violajones impl'
		print '    before executing simulator'
		image = reference.equalizeHist(image)

		width, height = block_size
		pe_dim = (len(image[0])//width, len(image)//height)

		args = {'haar_classifier': cascade, 'pe_dim':pe_dim}
		# now execute the codegen
		code = Code()
		code.set_generator(optimiser_wrapper(codegen_function), block_size, args)

		sim = Interpreter(code, image, block_size, 4)
		sim.run()

		detections_pixmap = sim.gen_output_image(1) # result is saved in first buffer

		# convert the number of rejections in the stages to detections
		detections = gen_code.convert_pixelmap_to_detections(detections_pixmap, cascade.size)
		return detections