suyashkumar / seven-segment-ocr

Digitizes numbers from videos & images of seven segment displays
73 stars 19 forks source link

Digit Not Recognized #2

Open jkenny23 opened 6 years ago

jkenny23 commented 6 years ago

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```
suyashkumar commented 6 years ago

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!