Shop OBEX P1 Docs P2 Docs Learn Events
Simple B/W Image Capture and object counting — Parallax Forums

Simple B/W Image Capture and object counting

JBWolfJBWolf Posts: 405
edited 2012-01-17 01:17 in Propeller 1
Hello,
I have a project and could really use some help getting started.
Goal: count round black dots on white paper.

The white card paper is .5" x 1", the black dots are pretty large... about 3mm.
There are up to 4 rows of 4 dots, dot position is always specific, not random... just the amount of dots is random.
I need the most cost effective way to count these quickly, about two cards per second.
Feeding the cards is already taken care of, I just need a way to count the dots.

I have thought about using photo diodes with a small tube over where the dots are... but this seems a bit complex and really tight for space, not sure how much this would cost.
I found a thread started by PhPi about his PropCAM, but this is much more complex than I need.

I am hoping someone may have a solution already, or a simple & cheap method.
The idea floating around my head right now is to use a super cheap button camera to count them... but I have never interfaced a camera to the prop chip and not sure how to write software to recognize these dots. This may turn out to be much more expensive than photodiodes, not sure yet.
Looking for a place to start :)

All help is sincerely appreciated!
JB

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-16 15:27
    JB,

    Check out the machine vision section of my index. (See signature.)

    I've personally used Hanno's method (see Mecanum Wheeled Robot project in project index).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-16 18:58
    JB,

    Is your subject stationary or moving on a conveyor of some sort?

    -Phil
  • ercoerco Posts: 20,259
    edited 2012-01-16 19:13
    Heck, I'd pound it out with 16 close-proximity IR reflective sensors and a...

    (GASP!)

    Stamp--- 16 inputs, a match made in heaven!

    Buck sensors: $1.05 in 10+ qty https://www.solarbotics.com/products/qrd1114/

    Edit: Or feed the 16 inputs into a 16 to 4 line encoder, and feed those 4 outputs into your processor of choice.
  • JBWolfJBWolf Posts: 405
    edited 2012-01-16 22:04
    The objects will be stationary. basically a servo feeds a card in one at a time until it hits a lever switch.
    Once the switch has been activated, the servo starts to retract in prep for feeding the next card.
    The loaded card is now stationary and ready for imaging after a few ms delay to allow for settling.
    Atleast that is the initial idea...

    It would certainly be more efficient to fling them through... but I just figured that would be a bit too much visual processing to determine where one ends and the next starts. I cannot add or subtract any marks on the cards, but I suppose by making the background black and staggering the feed, it is certainly possible to do it this way!
    Never considered that.

    Erco:
    that is very neat, never seen them coupled together. But unless they can differentiate between multiple dots, it would mean I need one for every dot position. I dont know if I can fit 16 in a .5"x1" area. I was originally thinking about an array of small photo resistors with tubes over them pointing on the dot positions with about a 1mm gap, and illuminating the whole card with a single LED. I havent priced them out but I was expecting to find photo diodes on digikey for a few cents each.

    Either way, this is progress :)
  • ercoerco Posts: 20,259
    edited 2012-01-16 22:40
    Sounds like you need TINY sensors, so that reflective sensor I suggested is out. Another option is to read IR or visible light through the card with 16x3mm LEDs on one side and 16x3mm photransistors on the other side. The black spots will block more light than the blank paper will, and then your circuitry & comparators will tell black dot for not. Four 3mm LEDs in a tight row is right at a half inch, so there's no room for fabrication error... :)
  • JBWolfJBWolf Posts: 405
    edited 2012-01-16 22:47
    I should mention there is a possible mechanical option.
    The punch creates a heavy indentation into the card, it indents more than the width of the card itself.
    I considered a series of levers fine tuned to the height of the card, but I dismissed this idea after considering dust, debree and mechanical wear throwing off counts after a short time.
    Cards will be fed in stacks of 100, minimum 100 stacks or more a day. It will be used quite a bit and need to be reliable.
    Minor cleaning is expected at times, but daily is not an option.
    The cards themselves will be very clean, but the environment will vary.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-16 22:48
    JB,

    If you can synchronize multiple line-image captures with the servo feed, the TSL1401-DB could capture sequential slices of the dot pattern as the card is being fed, rather than waiting until it stops. This is the method used by Mike Davey to read characters from the tape in his Propeller-based Turing machine.

    -Phil
  • JBWolfJBWolf Posts: 405
    edited 2012-01-16 22:49
    Oh and we do have a CNC in the shop, so fabrication is not a problem as long as we can keep it generally simple... no curved tubes that cannot be reached by simple XYZ 3-axis CNC
  • JBWolfJBWolf Posts: 405
    edited 2012-01-16 22:51
    Thanks for the quick posts :)
    Thought I was the only one up at these hours hehe

    Sorry but a $50 camera is above our budget limits.
    We need to make over a dozen of these to make it a viable option

    Readin through the card via bright light isnt an option either, has to be a surface read.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-16 23:00
    erco wrote: »
    Sounds like you need TINY sensors

    These are nice and small. I used a couple to add encoders to my Roboni-I robot.
  • JBWolfJBWolf Posts: 405
    edited 2012-01-17 00:55
    hmm, maybe if the servo that feeds the card in, does it in specific increments... I could add a second servo or small stepper motor to move the sensor across one line at a time? so it feeds the card 1/4 in and the sensor moves across, then another 1/4 and across again and so on.
    This might also cost close to the same as just using 16 sensors though, alot more complex too.
    Was hoping to use a very cheap $10 camera to do this, that way no moving parts other than feeding.

    The budget is <$50 per unit.
    I have to find a way to do this under $50/ea... and the prop + basic components has already taken $10.
    So I'm left with $40 to use the prop chip for this project.
    Only other key factors are maintenance and expected lifetime.
    Must not require cleaning/maintenance any more than once every 100,000 cards in a clean environment, and must last 1-year minimum.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-17 01:06
    I'd think Phil's B&W NTSC capture should be able to capture enough detail to do this. With dots always in the same places, the software to process the image shouldn't be too hard.
  • shimniokshimniok Posts: 177
    edited 2012-01-17 01:17
    I've been playing around with a game boy camera and Propeller lately. If this is a one-off thing and your'e just interested in true black and white (not grayscale) this might be a viable option. Just use a comparator on the analog Vout from that camera. I can share my code that will drive the camera at 30+ FPS so all you'd need is to devote a cog to pulling in the data and doing blob detection (relatively easy to do even in limited cog ram). I've done this on an Arduino awhile back. EDIT: looks like you're doing a real product, so... nevermind :D
Sign In or Register to comment.