Seven Segment OCR - Anyone get it working in HA OS?

Seven Segement Display OCR seems like such a useful integration yet hardly anyone uses it 12 installs according to the stats). So this leads me to believe, is it just super hard to set up or is it unreliable? For me, I just cant get it to work even in a control form with a static image.

My setup:

image_processing:
  - platform: seven_segments
    x_position: 0
    y_position: 0
    height: 73
    width: 230
    threshold: 20
    digits: 6
    source:
     - entity_id: camera.s72

camera:
  - platform: local_file
    name: s72
    file_path: /config/www/images/s72.png

Now there are no issues in the log but the Image processing always shows as unknown for the image. As far as I know, HA OS should have everything built in, or am I missing something and some components need so be build into HA to make SSOCR work?

P.S. The image I am using is the stick imagine from the SSOCR website. Seven Segment Optical Character Recognition.

Is there supposed to be a camera: line in there?

Correct, I forgot to paste that in, but the local file is shown as a camera to Seven Segment image processing. I’ve edited the yaml to correct it. Thanks.

Just realised the file should probably be

camera:
  - platform: local_file
    name: s72
    file_path: /local/images/s72.png

/config/www in the filesystem maps to /local when seen by HA.

That breaks the local file to camera for me.
Did you have any luck getting SSOCR working?

Happy to pay someone 5 bucks if they can just check to see if seven segments OCR on a static image works on HA OS. I just need to know if the integration is broken or if there is a problem with the config.

I’ll try it tonight if I remember after work.

On the identical setup to yours mine gives a log error of

Logger: homeassistant.components.seven_segments.image_processing
Source: components/seven_segments/image_processing.py:135
Integration: seven_segments (documentation, issues)
First occurred: 10:34:44 AM (9 occurrences)
Last logged: 10:36:04 AM

Unable to detect value: unknown command "" found only 5 of 6 digits

What does your log say?

1 Like

So, I never actually went back to checking the logs after updating the image.
My logs match yours and by temporarily editing it to look for 5 digits, I get a match for the first 5. Thanks very much, at least now I know that it’s working so now it’s just case of fighting the config.

Actually I just got it to work with 6 digits.

image_processing:
  - platform: seven_segments
    x_position: 0
    y_position: 0
    height: 73
    width: 280
 #   threshold: 20
    digits: 6
    extra_arguments: -T
    source:
     - entity_id: camera.s72

The image is actually 280 wide

nick@media:~$ file six_digits.png
six_digits.png: PNG image data, 280 x 73, 8-bit/color RGB, non-interlaced

The web page for ssocr (pointed to by you) suggests using -T with this image, and changing to that works.

It is a pretty shitty image.

As for the $5, if you really feel the need to part with it, give it to a charity for people with mental health problems or drug/alcohol addictions. Drop in the bucket, but I see those problems every day in my work.

3 Likes

Hi, I’m trying out this OCR integration by using the same configuration. But I’m keep getting the following error message. It seems like the camera component can’t read the image. But when I tried to load the image in Lovelace with using the picture element card, it can actually see the image.

Logger: homeassistant.components.local_file.camera
Source: components/local_file/camera.py:82
Integration: local_file (documentation, issues)
First occurred: 10:46:05 (2 occurrences)
Last logged: 10:46:06

Could not read camera s72 image from file: /local/images/s72.png

This is my config,

image_processing:
  - platform: seven_segments
    x_position: 0
    y_position: 0
    height: 73
    width: 280
 #   threshold: 20
    digits: 6
    extra_arguments: -T
    source:
     - entity_id: camera.s72
camera:
  - platform: local_file
    name: s72
    file_path: /local/images/s72.png

Did you get this working? I am considering using this for my gas meter. Also, what camera did you use?

I think an esp32 cam would be fine and cheap.

1 Like

Do anyone have any Ideas what setting I can use on this picture? First 0 is ok to skip.

With this line I can get: 00247 but I need to have aleast 2 more numbers (15) to get any relevant use of the output. And I do understand that I can change the crop to see more of the window but then it dont give me a correct reading.

ssocr -D rotate 261.5 crop 271 199 147 51 -P -t 60 file.jpeg

file

There are numerous parameters to ssocr, see

https://www.unix-ag.uni-kl.de/~auerswal/ssocr/

I would try --number-digits, and given the amount of green, perhaps g_threshold

Tesseract is a c++ so you’d need an addon, but as they are based on docker, and I see docker configs for tesseract on the net, this may indeed be possible.

Hi everyone!
Can help me with seven_segments?
In configuguration,yaml:

image_processing:
  - platform: seven_segments
    x_position: 100
    y_position: 27
    height: 292
    width: 159
    threshold: 20
    digits: 3
    source:
      - entity_id: camera.esp32scam_esp32_cam

The image:
изображение
I found the pixels from paint:


But it cant see the numbers. I want add the degree also - how i can add The second number? Or can i add all the numbers at a time?
In logs: Unable to detect value: unknown command “” found only 1 of 4 digits

You have height and width confused.

image_processing:
  - platform: seven_segments
    x_position: 100
    y_position: 27
    height: 159
    width: 292
    threshold: 20
    digits: 3
    source:
      - entity_id: camera.esp32scam_esp32_cam

Unable to detect value: unknown command “” found only 1 of 3 digits

1 Like

I don’t seem to be able to get it to work. Anyone have any ideas what I might be doing wrong?

Config:

image_processing:
  - platform: seven_segments
    x_position: 159
    y_position: 73
    height: 61
    width: 179
    threshold: 10
    # digits: 3
    extra_arguments: "--charset=decimal"
    source:
      - entity_id: camera.cam4

Frame from the camera:
frame

Result…