digits_video.py prints warning if trained classifier (should be created by digits.py) not found
This commit is contained in:
parent
3804ca3e20
commit
b987154ebc
@ -1,11 +1,19 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import cv2
|
import cv2
|
||||||
#import video
|
|
||||||
import digits
|
import digits
|
||||||
|
import os
|
||||||
|
import video
|
||||||
from common import mosaic
|
from common import mosaic
|
||||||
|
|
||||||
#cap = video.create_capture()
|
|
||||||
cap = cv2.VideoCapture(0)
|
|
||||||
|
def main():
|
||||||
|
cap = video.create_capture()
|
||||||
|
|
||||||
|
classifier_fn = 'digits_svm.dat'
|
||||||
|
if not os.path.exists(classifier_fn):
|
||||||
|
print '"%s" not found, run digits.py first' % classifier_fn
|
||||||
|
return
|
||||||
|
|
||||||
model = digits.SVM()
|
model = digits.SVM()
|
||||||
model.load('digits_svm.dat')
|
model.load('digits_svm.dat')
|
||||||
@ -61,3 +69,6 @@ while True:
|
|||||||
cv2.imshow('bin', bin)
|
cv2.imshow('bin', bin)
|
||||||
if cv2.waitKey(1) == 27:
|
if cv2.waitKey(1) == 27:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user