Shop OBEX P1 Docs P2 Docs Learn Events
VIDEO image - Analogic to digital conversion — Parallax Forums

VIDEO image - Analogic to digital conversion

LUCALUCA Posts: 7
edited 2005-10-26 23:03 in General Discussion
Hi to everybody,·· smilewinkgrin.gif
·
I am a new Italian consumer of this forum.·
·
I work in the pharmaceutical sector and I would like to know if it is possible with SX28 to convert a signal coming from a B/W camera in a digital system.·
·
I would like to be able to analyze an image taken back with the camera and to compare it with a standard.·
·
Thanks to everybody·
·
LUCA

Comments

  • BeanBean Posts: 8,129
    edited 2005-10-24 15:12
    You would need a flash ADC and external RAM, but it could be done depending on what type of comparison you need.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    Life is NOT a box of chocolates.
    Life is a trip, and 99% of the time you get where your headed.

    ·
  • LUCALUCA Posts: 7
    edited 2005-10-24 17:08
    Thanks for the answer Bean,·
    ·
    my necessity is to verify if a pharmaceutical capsule is present or no inside a transparent blister.·
    ·
    Currently I have realized the system with a ray IR that (if there is the capsule) is interrupted.·
    ·
    I thought to a television camera B/W to recognize the presence or less of the capsule (dark stain on white background) therefore I thought about something of enough simple to directly realize with SX28·

    I would have need of a system that recognizes a dark stain in a certain position

    ·
    Thanks·
    LUCA·
    ·
  • BeanBean Posts: 8,129
    edited 2005-10-24 17:22
    Is the "dark stain" the capsule ? Or is that what it sees if a capsule is missing ?
    Will the camera be focused on a single position or are your trying to "see" multiple positions at one time ?
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    Life is NOT a box of chocolates.
    Life is a trip, and 99% of the time you get where your headed.

    ·
  • LUCALUCA Posts: 7
    edited 2005-10-25 08:57
    The black stain is the capsule and the camera is fixed in the same position.·
    The camera·focused on a single position must·see multiple positions at one time.

    I will try to explain me better :·
    ·
    The blister of the capsules is transparent and white fund, the capsules have some lodgings where they must be positionated therefore if the capsule is present the camera· sees the dark stain, if the capsule is absent the camera sees the white fund in that position.



    LUCA
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-25 12:49
    Yes it should be relatively easy to do, and you shouldn't need external memory. This is because you are only concerned with a binary value for each capsule, is it there or not.

    Your SX would sync to the camera's output, then sample an 8x8 pixel swatch at each capsule's location. Then use a classifier function on the swatch, there are many different functions that can classify the swatch: majority rule, average, bayesian etc. Then once you determine whether the capsule is there you set or clear a bit in a variable.

    The SX28 has 128 bytes of variable space (plus a few more global variables). You wont be able to implement a true Bayesian classifier (requires full sample set, of which two swatches would completely fill the SX's memory). But you could easily implement the others, average is self explanitory, majority rule would go like this: sample video stream at capsule location eight times each time threshold the value (so you get a value of 0 or 255), find whether that row has majority dark or light pixels and store a 0 or 255 for that row, if it's a tie, store 128 for the row. You do this for each row (8 in total) after all 8 are done this way, do a majority rule for all of the rows, and set the value for the capsule position to true or false (values of 0 and 255 are totaled, values of 128 are ignored). If they are equally numbered (4 white, 4 black) then its a tie and the classifier failed. If you are clever with your variable use (and reuse variables when possible) you should be able to implement majority rule and average classifiers simultaneuosly, where when there is a tie by majority rule, the average classifier breaks the tie.

    BTW if you don't implement the average classifier (only majority rule), you can do this with the SX's built in comparator, no ADC required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 10/25/2005 12:53:38 PM GMT
  • LUCALUCA Posts: 7
    edited 2005-10-26 10:17
    Thanks to all for the help,·
    ·
    my true problem is to turn the video signal into a digital signal.·
    ·
    How do I do to convert the signal to make to know to my SX that in that position there is a black or white pixel ?·
    ·
    Do you have a code from which I can start ?·
    ·
    Which is the protocol to convers with the camera ?·
    ·
    LUCA
  • BeanBean Posts: 8,129
    edited 2005-10-26 13:02
    I would use an LM1881 sync seperator IC to get the timing of each scanline.
    Then you are going to need a fast comparitor or a flash A/D (4 bit would probably work) to test whether the pixel is dark or light.
    The comparitor could be a bit touchy. And I don't think the built-in comparitor is fast enough.

    Basically,
    Wait for vertical sync. Count lines until you get to the scanline your interest in. Wait till the pixel (horizontal) is being sent and capture the value of the flash A/D. Then compare the value to see how dark/light it is.

    It's not going to be easy, but it is do-able.

    P.S. Just had a thought, if the background is dark enough you may be able to get away with just a peak detector circuit. That would tell you how bright the brightest area is.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    Life is NOT a box of chocolates.
    Life is a trip, and 99% of the time you get where your headed.



    Post Edited (Bean (Hitt Consulting)) : 10/26/2005 1:09:43 PM GMT
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2005-10-26 23:03
    I came across an article on Atmel's website, and it might be of interest to this thread. The author interfaces a Gameboy camera to a robot. The cool thing about it is apparently the Gameboy camera has built-in edge detection and extraction which can be controlled via the mcu. Here is the link:

    www.atmel.com/journal/documents/issue4/pg39_43_Robotics.pdf

    This was done with an Atmel mcu, but should give some ideas for those interested.
Sign In or Register to comment.