suyashkumar/seven-segment-ocr

Digit Not Recognized

jkenny23 opened this issue · 1 comments

I am having trouble getting any digits recognized even with the sample file you provided. It seems extremely sensitive to how you position the box around the digit. Is there a way to debug this further or better understand how the segments are being read?

FYI I made a few modifications to the file to work with the newest version of OpenCV (3.3.1):

22,24c22,24
-     fps = video.get(cv2.cv.CV_CAP_PROP_FPS) # Get FPS
-     frameInterval = int(round(fps * samplePeriod))
-     totalFrames = video.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT)
+     fps = video.get(cv2.CAP_PROP_FPS) # Get FPS
+     frameInterval = int(round(float(fps) * float(samplePeriod)))
+     totalFrames = video.get(cv2.CAP_PROP_FRAME_COUNT)
29c29
-         video.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, frameNumber*frameInterval) #Set frame to read next
+         video.set(cv2.CAP_PROP_POS_FRAMES, frameNumber*frameInterval) # Set frame to read next```

hi @jkenny23 feel free to submit a pull request with your changes! Also, the idea is for the bounding boxes to match the height and width of the digit as much as possible. This simple algorithm takes three line profiles (25% height, 75% height and 50% width) to determine the digit.

I'll be circling back to this project again in the coming months, so expect improvements and hopefully automatic detection of digits!