Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Sample Digits Not Working

What I did

  • Downloaded the opencv repo and setup the digit recognition sample (digits.py and digits_video.py)
  • Modify digits.py to modify line 44 (this prevents "ValueError: too many values to unpack" error)

contours, heirs = cv.findContours( bin.copy(), cv.RETR_CCOMP, cv.CHAIN_APPROX_SIMPLE)

with

_, contours, heirs = cv.findContours( bin.copy(), cv.RETR_CCOMP, cv.CHAIN_APPROX_SIMPLE)

  • Run digits.py and then run digits_video.py

Results

digits_video.py has no trouble isolating and deskewing the hand written digits but the prediction allows resolves to 0 (seen in blue above each green square). The only modification I've made to the code is the one line mentioned above in digits.py .

image description

System I'm testing this on OSX Sierra 10.12.6 with python3 and opencv 3.4.3

click to hide/show revision 2
None

updated 2018-11-07 02:53:55 -0500

berak gravatar image

OpenCV Sample Digits Not Working

What I did

  • Downloaded the opencv repo and setup the digit recognition sample (digits.py and digits_video.py)
  • Modify digits.py to modify line 44 (this prevents "ValueError: too many values to unpack" error)

contours, heirs = cv.findContours( bin.copy(), cv.RETR_CCOMP, cv.CHAIN_APPROX_SIMPLE)

with

_, contours, heirs = cv.findContours( bin.copy(), cv.RETR_CCOMP, cv.CHAIN_APPROX_SIMPLE)

  • Run digits.py and then run digits_video.py

Results

digits_video.py has no trouble isolating and deskewing the hand written digits but the prediction allows resolves to 0 (seen in blue above each green square). The only modification I've made to the code is the one line mentioned above in digits.py .

image description

System I'm testing this on OSX Sierra 10.12.6 with python3 and opencv 3.4.3