Python machine vision

Reading time ~1 minute

Python machine vision LCD OCR WTF

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

thresh = cv2.adaptiveThreshold(blur,255,1,1,11,2)

to this

thresh = cv2.adaptiveThreshold(blur,255,0,1,25,-2)

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.

TensorFlow functions with Keras

Using TensorFlow function in combination with Keras models Continue reading

Sentiment analysis

Published on February 06, 2019

Cannabis recommender and science

Published on November 20, 2016