Exemplo n.º 1
0
def dirPicTest():

	clf = joblib.load('model/svm.pkl')
	print type(clf)
	print clf

	platePath = 'resource/general_test'
	for root, dirs, files in os.walk( platePath ):
		print len(files)	
		for file in files:
			path = os.path.join( root, file )
			print 'loading....',path
			imgPlate = cv2.imread(path,cv2.IMREAD_COLOR)
			PlateLocater.m_debug = False
			Result = PlateLocater.fuzzyLocate(imgPlate)

			for plate in Result:
				
				feature = PlateJudger.getHistogramFeatures(plate)
				res = clf.predict(feature)
				
				flag = (res==1)
				print flag[0]

				if flag[0]:
					cv2.imshow('test',plate)
					cv2.waitKey(0)
					cv2.destroyAllWindows()

				
				


	return None
Exemplo n.º 2
0
def CV_dirPicTest():
	model = CV_trainModel()

	platePath = 'resource/general_test'
	for root, dirs, files in os.walk( platePath ):
		print len(files)	
		for file in files:
			path = os.path.join( root, file )
			print 'loading....',path
			imgPlate = cv2.imread(path,cv2.IMREAD_COLOR)
			PlateLocater.m_debug = False
			Result = PlateLocater.fuzzyLocate(imgPlate)

			for plate in Result:
				
				feature = PlateJudger.getHistogramFeatures(plate)

				print feature.dtype

				feature = np.float32(feature)
				res = model.predict(feature)
				
				a = (res==1)
				print a[0]

				if a[0]:
					cv2.imshow('test',plate)
					cv2.waitKey(0)
					cv2.destroyAllWindows()
Exemplo n.º 3
0
def CV_PicTest():
	model = CV_trainModel()

	imgPlate = cv2.imread('plate_judge.jpg',cv2.IMREAD_COLOR)

	PlateLocater.m_debug = False
	Result = PlateLocater.fuzzyLocate(imgPlate)

	for plate in Result:
		cv2.imshow('test',plate)
		feature = PlateJudger.getHistogramFeatures(plate)
		feature = np.float32(feature)
		res = model.predict(feature)
		print res
		cv2.waitKey(0)
		cv2.destroyAllWindows()
Exemplo n.º 4
0
def loadNegativeTrainData(platePath):

	traindata = np.ones((1,172))
	label = np.array([0])
	isFirst = True

	for root, dirs, files in os.walk( platePath ):
		print len(files)	
		for file in files:

			path = os.path.join( root, file )
			print 'loading....',path
			imgPlate = cv2.imread(path,cv2.IMREAD_COLOR)
			feature = PlateJudger.getHistogramFeatures(imgPlate)

			if isFirst:
				traindata = feature
				isFirst = False
			else:
				traindata = np.vstack([traindata,feature])
				label = np.hstack([label,0])

	return traindata,label