Shop OBEX P1 Docs P2 Docs Learn Events
Machine Vision 101 / Taos TSL1401 — Parallax Forums

Machine Vision 101 / Taos TSL1401

Brian_BBrian_B Posts: 842
edited 2010-03-02 16:33 in Accessories
Hi,
·I'm trying to learn how to use·the Taos line scan camera in a industrial setting. I've talked with Phil P and decided to make this a learning experience for everyone that would like to use the camera. I have built a small conveyor and mounted the Taos and a HED's encoder on it.
·
·The goal here is to sort washers by size; this version will just have a LED that will come on when the washer is at the location on the belt where it should be extracted. Future versions will have a means to remove the washer at its desired location.
·
·Jump in if you have any questions or comments.
·
Brian

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





"Imagination is more important than knowledge..." Albert Einstein

Comments

  • Brian_BBrian_B Posts: 842
    edited 2010-01-26 00:49
    Ok,
    Running conveyor as slow I can ,business card looks like it is 1/4" long. Also trying to figure out how to hook encoder up.

    Brian

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    "Imagination is more important than knowledge..." Albert Einstein
  • Brian_BBrian_B Posts: 842
    edited 2010-01-27 02:07
    Hooked encoder up to pin 3 on the mobo board, still seems to scan at the same speed(business card looks like it's 1/4" long). It quits scanning when conveyor is off ,so I know it is reading the encoder. Any suggestions ?

    Brian

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    "Imagination is more important than knowledge..." Albert Einstein
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-27 03:10
    What you're seeing in the scan window is fine. Consider that, if your field of view is 4" wide, your pixel pitch in that direction is 4/128 = 1/32". In the "encoder direction", it's eight times that big. But the monitor display shows them as square pixels. As a consequence, that window will show considerable distortion. But what matters in your app is the area, i.e. the sum of the measured widths over the length of each washer. And that measurement (for any objects, not just round ones) is invariant with orientation, regardless of the pixel aspect ratio.

    -Phil
  • Brian_BBrian_B Posts: 842
    edited 2010-01-30 21:03
    Thanks' Phil,
    I'm trying to figure out what point the the controller starts counting pixels , It's bound to pick up a few bright pixels here and there , how do you decide when the washer starts and when it ends ?

    Brian

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    "Imagination is more important than knowledge..." Albert Einstein
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-30 22:13
    Set a threshold, say ten or more bright adjacent pixels. Once it goes above that, start counting. When it goes below, stop. You'll also have to keep track of the number of lines you've read that satisfy this criterion. That will be your length, and it will figure into when you fire the ejector, since you want it to be in the middle of the washer, not at the end.

    Since the washers have holes in them, you will probably want to look for the leftmost and rightmost edges, rather than just counting pixels. This will give you the areal extent of the washer, including the hole.

    -Phil
  • Brian_BBrian_B Posts: 842
    edited 2010-03-01 03:32
    Ok,
    done with other project and want to get moving on this again.

    Phil,
    have you looked at the TSL1401 object in the object exchange? does it seem like a good starting point for this application?

    Brian

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    "Imagination is more important than knowledge..." Albert Einstein
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 03:40
    Brian,

    No, I regret to say I haven't looked at it as closely as I should. I've started on my own object for the '1401 and the Propeller Backpack, but it's just a start...

    -Phil
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 05:05
    Hi Brian,

    I've tried the object in the OBEX... it works fine.· The speed limit is in the adc... Here is a file that will get you up to around 2.5M Pixels/Sec... but not with the MCP3208.· It controls the first pass at the 1401 in PASM but does the actual data acquition in Spin.· Kind of a hibrid... or a not quite done object[noparse]:)[/noparse]·

    With the MCP3208 and this object you can still adjust the·exposure duration down to around the tsl1401's theoretical minimum... 10s of microseconds.·

    With two 1401's, which is supported by this object... you just wire them up on the Prop side to the same pins... only difference is the adc channel.... you should be able to get rid of your encoder.

    This is set up for video on pin 20.

    ISSUE for Phil... in order to make this work, I have to put a 100ohm resistor on the tsl1401 clock.· I'm using 3.3V everywhere and I have the jumpers in place... ?

    My Mac died[noparse]:([/noparse] and my pc has a virus)... I'm going to reboot before sending the object.

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 05:15
    OK... my PC seems to be working for the moment.

    I have a 10K pot hooked up to ch2 on the MCP... and two 1401's... on ch0 and 1.· This is configured to save data to another Prop... object not included here...

    The pins for the 1401 are set in the top level... but also in the PASM object... so you have to change both... not a preferred programming style![noparse]:)[/noparse]

    Rich
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 16:58
    rjo_ said...
    ISSUE for Phil... in order to make this work, I have to put a 100ohm resistor on the tsl1401 clock.
    Can you elaborate? I assume you mean the resistor is in series with the clock line. Why did you think it was necessary?

    -Phil
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 17:42
    Phil,

    Sorry, no the resistor ties the clocki pin to ground... What happened is that I was coding the assembly version... and nothing was working. The Obex version worked fine. so, I thought it was a timing problem... I put an LED on the the clock line and all of a sudden the thing sprang into life. Some LED's would work... others not. I put some different resistors in there an came up with 100 Ohms as the magic number. Try it... it makes no sense to me, except that there is something acting as a capacitor somewhere[noparse]:)[/noparse]

    I don't mind it, except that when I use the OBEX object... it doesn't work with the resistor in place... go figure[noparse]:)[/noparse]

    By the way... I think the tsl1401 should be sold as a kit... with the connectors as an option up to the builder. I couldn't get them off... so right now everything is jumper wired into place. That option could make it cheaper to produce... or you could make it more expensive and include the cables. I like door number 1.

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 17:48
    The other oddity, which I probably caused... but don't see how... is that I am not getting anything but dark noise from my first 10 pixels out of either tsl... could be an alignment problem with the lenses.

    You might want to leave the lenses off and just put the holder there and then offer an array of different lenses... I prefer no IR filter.

    rich

    Post Edited (rjo_) : 3/1/2010 5:54:12 PM GMT
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 18:07
    Having said all of that... I am pleased as punch to finally have the TSL!!! One of my hobbies is making stereo panoramas. Years ago, I created some software, based on a new algorithm for stereo matching... which allowed me to acquire a series of frames and then stitch them back together seamlessly. Doesn't sound like much now, but at the time it was a big deal. In the process, we threw away a lot of image data. The TSL is almost ideal, because it offers complete control of the acquisitions with very little data overflow between "frames." I do wish it had a narrower field of view... as narrow as possible.
    I'm currently redoing everything to demo this as is. I"m thinking that our gamers might eventually be able to create real 3D worlds to play in[noparse]:)[/noparse] If Andre isn't reading this thread... someone needs to let him know that I'm serious about this... and at the time of the first Mars mission... my stereo matching was better than Nasa's... no joke!

    thanks

    rich
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 18:33
    rjo_ said...
    Sorry, no the resistor ties the clocki pin to ground... What happened is that I was coding the assembly version... and nothing was working. The Obex version worked fine.
    Well, that should have told you something! smile.gif

    I took a glance at your code and noticed that you've set dira for the clock line to one in two separate cogs. This will surely lead to conflict and may account for the necessity of the 100 ohm resistor, as well as the low values you're getting for the first ten pixels.

    -Phil
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 19:46
    hmmmm ....
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-01 19:49
    Then... ITS a MIRACLE!!!!
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-02 04:18
    Brian,

    I'm not trying to hijack your thread. I think the problem
    breaks down to getting the image data as quickly as possible and processing the data as fast as you can. Your problem should be simple from an image processing standpoint... so, it is just a matter of process control with the TSL being at the center of the process.

    Phil,

    I was warming up my stepper motor... futzed with it all day... finally found a bad connection and some reversed lines[noparse]:)[/noparse]

    I took another look at the code. About the cog issue... it kind of has to be that way. If I don't explicitly declare dira :=1 on the clock line in the cog, the cog treats it as an input.


    Unless I have a huge misunderstaning... a cog's direction register gets or'd with all the others. So theoretically, there shouldn't be a problem.

    I am only making calls to the tsl clock in one place at one time... when the assembly routine is being called... the
    spin routine is waiting. On exit, both routines set the clock pin outa:=0.

    In the getImage method, I am using "cmd" as a shared variable, which the assembly routine waits to be non-zero, when the assembly routine sees "cmd" as non-zero, it does its work and then sets "cmd" to zero.... at which point the spin routine stops waiting and continues. the assembly routine then goes into a wait state. I believe that this logic is working... otherwise my spin routine would hang and I would never get data. I have tested this in both directions.

    I'm not entirely sure I understood what you were saying... if this is not it... please let me know.

    I am clocking the tsl pretty hard in the assembly routine... but I have tried putting a bunch of nops between clocks phases and slowed everything down to a snails pace and it doesn't seem to care... I am absolutely stumped.

    I am using the same line to clock both TSLs... but the Obex object doesn't seem to mind... so I don't see why it should make any difference if I am using PASM or Spin.

    Rich
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-02 06:47
    Rich,

    Could you start a new thread, please? I'll take a look at your issues there. Brian is working on a specific project that's unrelated to yours, which I've agreed weigh in on from time to time as needed. I'd like to keep this thread centerd on that project, if possible.

    Thanks,
    -Phil
  • rjo_rjo_ Posts: 1,825
    edited 2010-03-02 16:33
    Sorry
Sign In or Register to comment.