Between coffee and 12 o'clock. [7 segments or what?]

First I have to appolologize, did not use raspberry as I have a whole table full of airplane electronics and raspi is in use as PIC programmer.

But gocr was useless on the 7 segment recognition, as I found out yesterday or was it the day before, time flies or flys? I dunno.

Anyways connected the Logitech E2500 webcam to the PC, grabbbed the Sony alarm clock, got some alu foil from a tin foil hat to screen the setup against the sun, and made a test movie like this:

# Logitech E2500 webcam in focus on /dev/video0 # pointed at Sony alarm clock # show camera properties: v4l2-ctl -d /dev/video0 -l # set auto gain of to prevent 7 segment muxing becoming viible in low light: v4l2-ctl -d /dev/video0 --set-ctrl=auto_gain=0 # check it it happened v4l2-ctl -d /dev/video0 -l brightness (int) : min=0 max=255 step=1 default=128 value=128 contrast (int) : min=0 max=255 step=1 default=128 value=128 gamma (int) : min=1 max=6 step=1 default=4 value=4 auto_gain (bool) : default=1 value=0

Reply to
Jan Panteltje
Loading thread data ...

On a sunny day (Fri, 15 Nov 2013 11:19:43 GMT) it happened Jan Panteltje wrote in :

selectable segment recogition working now...

An other hour, but did other things in the meantime, like food, more coffeee, make programming erros, needed to reboot for some other stuff.

Segment recognition seems very reliable on this test movie, and that in real time and real time is very fast, much faster than digits will normally change,

If you play the youtoobe movie with mplayer at 2 fps, you will see the digit segments sort of come on slowly and than say stable for some time (< second) interestning.

This is how I now set position of the detection windows:

formatting link

From: ./7s_parser -X 97 -x 137 -Y 127 -y 137 -c 32 -s < 7_segment_recognition_test_source.yuv

150 minutes
Reply to
Jan Panteltje

Jan,

I tossed a lot of URLs at you, so you might have overlooked this one:

Seven Segment Optical Character Recognition

formatting link

Or possibly integrating it with your video stream looked too messy.

Anyway, glad to hear you're making progress.

Frank

--
  My father ... drilled into me from an early age that if someone says 
  something is impossible, that just means it will take a bit longer 
  to achieve, and that the only failure in working with equipment is 
  if it fatally electrocutes you. 
                     -- Seth Horowitz / The Universal Sense
Reply to
Frnak McKenney

I tried gocr on your test image 'segment_detection.gif' and failed completely.

After a bit of research, I found hints that one might need to build an image database for 'gocr' to work from, so I went and took a look at ssocr (ssocr-2.14.1.tar.bz2). The only prereqs I needed were these:

libimlib2 libimlib2-dev

It compiled without any errors ('make' but not 'make install').

There are some subtleties one "learns on the fly" which I'll pass along:

1) You want to tell ssocr to crop your image to just the digits (plus some slop for possible camera or display movement). 2) ssocr is looking for _black_ digits (hence the 'invert'). 3) Use the '-o' option to see what ssocr is actually operating on. 4) '-v' is helpful.

Here's my final run (it's nearly supper time):

----- $ ./ssocr -v -d 5 -o temp.png crop 36 114 574 173 invert \ segment_detection.gif (

Reply to
Frnak McKenney

On a sunny day (Fri, 15 Nov 2013 16:41:06 -0600) it happened Frnak McKenney wrote in :

Yes, gocr the same, I converted to BW and inverse with 'mogrify' (part of imagemagic) Also tried smaller sizes. gocr works great on very small characters fro man xterm or rxvt for example. But it did not help.

Cool, yes I also download that link you gave in the other posting. Maybe later today I will do some more coding on 7s_parser (thing has a name now). It is able to do live video streams. I added a config file in /root/.7s_parser/segments.conf where you can specify fields for the segments, a -t command line option to put markers on the screen to see the area you specify. Of course that should be done with a mouse movement, but it is only a one time thing for each different display, so at this point I will not bother with the mouse thing, it is just a text config file.

Lots of structures.. digit has seven segments, each a xstart, xend, ystart, yend, slice-level, etc. All that coding is done, need to add some math to make 'slice-level' user friendly (not intergalactic numbers LOL). Will publish source of course. Writing it is much more fun (and as you may have noticed maybe even faster) than following somebody else's idea, I did that with many programs, making my own was easier than RTFM of others. :-)

Hey, and all that in only main(), with output in X too! You can use it as video player! Only libc, xlib... libmath. I can select preferred colors (for example for green digits) too. Code size lemme see now:

-rwxr-xr-x 1 root root 19972 Nov 15 21:10 7s_parser yes 20kB.,. will be a little more when finished.

Reply to
Jan Panteltje

PS

Program finished and working zero errors, even from lower resolution video made from original test recording:

formatting link

Hope you can see full screen, youtoob seems to have compressed the details out of it, its good here.

J Fields where is yours ;-)

Should I add RS232 out? You can pipe the stdout to /dev/ttyUSB0 or /dev/ttyS0 or whatever, but then first set the format (baudrate etc). -rwxr-xr-x 1 root root 22214 Nov 16 17:27 7s_parser

Code size about 22 kB.

Will make a package later, README, INSTALL, license (GPL etc etc), Sunday? Want to see F1 racing now.

Reply to
Jan Panteltje

Source code and test file now can be downloaded:

formatting link

Please respect the GPL.

This is a quick hack, beware it is full of pointers! ;-)

Reply to
Jan Panteltje

Not been really following this thread, but... nice one!

--

John Devereux
Reply to
John Devereux

On a sunny day (Sat, 16 Nov 2013 19:53:56 GMT) it happened Jan Panteltje wrote in :

PS added serial output:

formatting link

Tested with null modem cable on the same PC with 2 USB to RS232 adaptors. Anybody even remember null modem cables?

Anyways, the OP probably does not run Linux and has no webcam... Else...

Still waiting for J. Fields hardware demo.

BTW I see no reason this would not run on Raspberry Pi, but have not tested it. Speed is not important, unless your digits flip several times per second, like in this test setup.

Reply to
Jan Panteltje

On a sunny day (Sat, 16 Nov 2013 20:44:31 +0000) it happened John Devereux wrote in :

Addd serial out, see other posting,

formatting link
codesize now

-rwxr-xr-x 1 root root 18368 Nov 16 22:07 7s_parser about 18kB

Reply to
Jan Panteltje

--
I already posted the LTspice file which shows the hardware works, 
and I'm still waiting for the OP to post whether/how the digits are 
muxed.
Reply to
John Fields

On a sunny day (Sat, 16 Nov 2013 18:20:15 -0600) it happened John Fields wrote in :

No way, your photocells need to be in place and real. Try it on the avi included in my program (displayed on a PC).

Already done the RS232, and I can have as many or as few digits as I want, download it and look at the code.

LT spice is nice to test small sub-cicuits, but does not do your mechanical setup or in any way validate that.

Come on ;-)

Reply to
Jan Panteltje

OK guys, project finished, website with latest version:

formatting link

Reply to
Jan Panteltje

--
There's no need to do that, since my logic has proven to be valid 
and, as you point out, why bother with someone else's RTFM? 

As for the sensors - be they photocells, phototransistors, whatever, 
- there's equally little point in building anything since optical 
coupling is a mature and well-understood technology. 

I understand that you had to write some code to prove your concept, 
and I had to generate a schematic and simulate the circuit in order 
to prove mine. 

Your way works, my way works, so why get into a pissing contest?
Reply to
John Fields

On a sunny day (Sun, 17 Nov 2013 09:00:07 -0600) it happened John Fields wrote in :

Does that go somewhere?

Reply to
Jan Panteltje

On Sun, 17 Nov 2013 15:05:33 GMT, Jan Panteltje Gave us:

Troll.

Reply to
DecadentLinuxUserNumeroUno

--
Anywhere I like, of course, but why are you trying to pick a fight?
Reply to
John Fields

On a sunny day (Sun, 17 Nov 2013 11:57:04 -0600) it happened John Fields wrote in :

Well if you want it that way: A system with photocells (whatever kind) would, for 4 digits, require 28 cells plus 28 lenses + mounting + positioning hardware. You could use one big lens, and put the photothings in the right spots I guess. Both from a price point of view, ease, time, a webcam is much easier as it already has the one lens and a zillion photocells + readout electronics, leaving only software, Not even mentioning you provide no hardware or whatever to 'fix' false changing digits, or to output RS232, or to only output on change.

It is very easy (and many here have done that) to cry: Oh yes it is simply this, without ever doing the real thing, and I am pretty sure never being able to do the real thing in a decent time frame, Sure it is a chat group, sure but align yourself with the global heating tribe, it never produces anything that anyone can use either.

The soft I just donated into the public domain will for thousands of years inspire and help people who want to solve this problem, without them having to buy anything but the cheapest webcam, as to find out about it they already must have a PC. That is one aspect of open source, and putting things _ programs_ into that universe, so to speak. Ideas are a cent a dozen, like inventions as perpetuum whatever....

So, fight? Fight WHAT? You have nothing. :-) And there are windmills Don Quixote, try them.

Reply to
Jan Panteltje

--
I merely asked a question, which isn't the same as issuing a 
challenge. 

You seem to be spoiling for a fight, though.
Reply to
John Fields

On a sunny day (Sun, 17 Nov 2013 19:32:15 -0600) it happened John Fields wrote in :

Ms Quixote, Is there any way you could do norml quoting of text so others can read it ?

ABORT,RETRY,IGNORE

A
Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.