Python machine vision LCD OCR
I just finished getting a camera through a usb adapter visible in python, and now I’m getting the machine vision set up. I found someone who already did all the hard stuff. I used this LCD numbers image since it had the same font as the display on the Dylos air quality monitor. I had to adjust the perspective to make it flat for the machine vision training though, so I used gimp to do that. Then I realized there was a 0 with a line under it, so I replaced that with another 0 from lines below. After that, I started training the program, but it was seeing 4s and 1s. I had to change the threshhold for detection from
to this
The docs describe this function a bit, although I can’t get the cv2.CV_ADAPTIVE_THRESH_MEAN_C to print, so I’m not entirely sure which adaptive_method I’m using (I think I changed it from gaussian, 1, to linear, 0). I empirically found the higher block size and lower constant seem to work best for this image. After that, it works well.