Shop OBEX P1 Docs P2 Docs Learn Events
CMUcam? — Parallax Forums

CMUcam?

HenrymouHenrymou Posts: 128
edited 2007-03-02 22:45 in BASIC Stamp
I am having trouble interfacing the CMUcam to my BS2, ok I don't know how to do it at all.
ANYONE know how i can find the distance of a black object, black-black, and "detect' it's presense?
PLEASE HELP!!!!!!!! freaked.gif

Comments

  • LarryLarry Posts: 212
    edited 2007-02-22 20:21
    Take a deep breath, Henry. You'll get help.

    Here's two things to get you started:

    1) you can't find the distance to an object with a CMUcam. It's NOT a distance sensor. Use another sensor, like a Shatp IR sensor or a PING)) sonar.
    The only exception is that you can judge the distance to some known objects by seing how many pixels of the object color are in te field of view.

    2) Black is just like any other color for the camera. look at example codes that either came with the camera, are on the Parallax website, or are posted for the many online projects you can google for. Then read the up on the TW and TC commands to see how they work.

    You'll be tracking black in no time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • HenrymouHenrymou Posts: 128
    edited 2007-02-25 07:05
    oh, ok, I have some ping ultrasound sensors in da garage, thanks birdman! idea.gif
  • quick questionquick question Posts: 50
    edited 2007-03-01 13:23
    You can use the cmucam as a distance sensor if you use a laser and are clever with some trig.

    search around here for laser and CMUCAM and you will bump into a link to a site that tells how.

    As far couling to the BS2 - I havn't done it yet.

    Let us know how.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-03-01 20:13
    Henry, if you look at the page which describes the CMUCam (http://www.cs.cmu.edu/~cmucam/home.html) it's statements of functionality are:


    At 17 frames per second, CMUcam can do the following:
    • track the position and size of a colorful or bright object
    • measure the RGB or YUV statistics of an image region
    • automatically acquire and track the first object it sees
    • physically track using a directly connected servo
    • dump a complete image over the serial port
    • dump a bitmap showing the shape of the tracked object

    The first line says it will track objects which are bright or colorful, black is neither bright nor colorful. Thier example object is typically a magenta ball, why a magenta ball? Because it's very colorful and not many objects are magenta, so the CMUCam can easily find it and keep track of it. Not only is black not colorful, but black objects are extremely common. As I look in my office, the black objects at BOE-BOT level are:
    • the floor moulding around the entire room
    • both of my chairs' bases
    • the trashcan
    • the baseboard of the·desk
    • the bookshelf·
    • my briefcase
    • and my shoes

    There is no way a CMUCam could track a black object unless you sterilize your environment (this means removing all black items from it's view except the object to be tracked).



    Please stop generating multiple threads in multiple forums on the same subject, this is called cross-posting and is against forum guidelines. The guidelines are here: http://forums.parallax.com/showthread.php?p=467912

    If you have any questions about the guidelines, we'll be happy to answer them for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 3/1/2007 11:10:59 PM GMT
  • HenrymouHenrymou Posts: 128
    edited 2007-03-02 05:03
    I don't want to track it though, i merely want to detect it. can't i detect the pressence of a non-black object with the camera?
    I just wan to get the CMUcam to see the object when it enters the full screen, how do i transfer that data to a BS2?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-03-02 05:34
    From the User Manual (http://www.cs.cmu.edu/~cmucam/Downloads/CMUcamManual.pdf):
    User Manual said...

    The CMUcam can be used to track or monitor color. The best performance can be achieved when there are highly contrasting and intense colors. For instance, it could easily track a red ball on a white background, but it would be hard to differentiate between different shades of brown in changing light. Tracking colorful objects can be used to localize landmarks, follow lines, or chase a moving beacon. Using color statistics, it is possible to monitor a scene, detect a specific color or do primitive motion detection. If the camera detects a drastic color change, then chances are something in the scene changed.
    So if you maintain a static scene, especially if you can set it to a neutral scene (everything is a solid color that isn't the same color as the object), you can use the color statistics to determine if the object is present in the scene.

    This isn't a begginer's task, it requires some mathmatics to accomplish it. I understand you are facing a deadline, can you precisely explain what it is you are trying to do at this competition and how far away it is?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 3/2/2007 5:46:52 AM GMT
  • HenrymouHenrymou Posts: 128
    edited 2007-03-02 06:55
    Yes, my idea is that if the object is in a certian feild of veiw, the CMUcam will realize that it is that far away from the object, label it's position, and move on. that is my idea, I merely want to know how to make the program for the BS2 to recognise it.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-02 07:39
    Henry,
    Do you understand how to get the CMUcam to do what you want? If not, are you asking one of us to figure that out for you? If you do know, could you write up a "pseudo-program", a description of specifically what you need to communicate to the CMUcam and what you would get back? We can certainly help you with the issue of getting the BS2 to talk to the CMUcam, but you're going to have to do most of the work yourself. Usually on these forums, people not only post their overall idea, but a description of what they've done so far, what works and what doesn't seem to work, and what seems to be going wrong.

    If you truely don't even know how to get the CMUcam and BS2 to talk to each other, you'd better read the CMUcam manual and the PBasic Manual's sections on the SERIN/SEROUT statements. If those don't make sense, then you're going to have to go back and work through some of the Stamps in Class tutorials to get the basic concepts involved.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-03-02 22:45
    Given your level of experience, I only see one way of doing what you want. You need to have a sterile and·uniformly lit environment, preferably white (this means anything the bot sees as the "background" must be white. Then you have your objects which are a known and uniform size and color. You would ask the CMUCam for image statistics looking for the amount of object color in the scene. When this passes a threshold, you have the CMUCam do a "first object" detection. From the result you get the size and centroid of the object, by comparing the size returned and the known size, you can mathmatically determine it's approximate distance away, and using the centroid position determine it's location.

    This is as far as I can help you on the theory of how to do it. If you don't understand what I have said, read the User manual carefully, and research the topic some. If you still don't understand, then this project should be reserved until you have a little more experience under your belt.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 3/2/2007 10:52:32 PM GMT
Sign In or Register to comment.