how does NXTCam work with NXC?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
brothman01
Posts: 20
Joined: 16 Feb 2012, 22:59

how does NXTCam work with NXC?

Post by brothman01 »

I was about to order the NXTCam-v4, and I figured rather than risking the possibility of wasting $150, I'll just ask.

Does NXC have full compatibility with the NXTCam, and if so, how does the language work with the camera while on the brick? I know thats kind of a vague question, so what I'll clarify with a lot of little subquestions. I'm asking if the data is:
a) a series of still-images (sorta like frames but spaced out by more time or the same amount of time)
b) a video processed in real-time (as it is recorded)
c) a video processed after the fact (like a video file that gets processed a few seconds later?
d) Is there sound? if there is, how is that processed?

This may seem like a lot, but the questions have short answers.. relatively short. ;)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: how does NXTCam work with NXC?

Post by mightor »

I don't have the V4, but I have the V3 and I've tinkered with its firmware so I think I can answer your questions:
a) a series of still-images (sorta like frames but spaced out by more time or the same amount of time)
No, the data returned with the standard firmware is a collection of coordinates of up to 8 tracked objects and their matched colour range. So for example, if you have light red to dark red (in RGB values) set as colour range 1, it will do pixel based matching on those colours and if they match, it will try to find the smallest enclosing square that matches those pixels. It can track up to 8 objects at any time and up to 8 colour ranges
b) a video processed in real-time (as it is recorded)
It is live, at about 30fps.
c) a video processed after the fact (like a video file that gets processed a few seconds later?
No, it doesn't store anything, the data is pulled from the camera chip and pulled into the ATMega for processing, it does process the info line by line.
d) Is there sound? if there is, how is that processed?
No sound.

There is a way to make the camera return actual pixel data but that's a slow process because you are limited by how quickly the data can be pulled by the NXT over the I2C connection.
So the main question is, what do you intend to do with it?

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
brothman01
Posts: 20
Joined: 16 Feb 2012, 22:59

Re: how does NXTCam work with NXC?

Post by brothman01 »

I know this sounds like a lazy use for it, but I live in a dorm, so at first, I am going to try to have the NXT do the relatively simple but annoying task of changing the garbage when I tell it to. I don't need the NXT to recognize when the garbage needs to be changed, (I'll do that by activating him) but there are a few objects I need him to be able to recognize...
there is:
1. the garbage can
2. the old garbage bag
3. the actual garbage (not the individual pieces, just the level at which the garbage reaches in the garbage can, so that the NXT can try to prevent some from falling out)
4. the old garbage bag
5. the new garbage bag

the biggest difficulty I can foresee is recognizing the garbage... Since there can be anywhere from 0 to like ∞ pieces of garbage, I feel like that may be more than 8 ;)
There is a way to make the camera return actual pixel data but that's a slow process because you are limited by how quickly the data can be pulled by the NXT over the I2C connection.
First off, how can the program make the camera return the actual pixel data? And secondly,when you say that making the camera return pixel data is a 'slow process', how slow do you mean... for instance would it take minutes, seconds or miliseconds or some smaller denomination of time to get every pixel on the screen?
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: how does NXTCam work with NXC?

Post by mightor »

I don't think the NXTCam is suitable for what you intend to try and do with it. Unless you know what colour range your garbage is going to be, you won't be able to distinguish it from the rest of the data.

The process takes quite a number of seconds. Here's a demo Andy made a while back with the V3: http://www.youtube.com/watch?v=9ppNCzDb7lU

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
brothman01
Posts: 20
Joined: 16 Feb 2012, 22:59

Re: how does NXTCam work with NXC?

Post by brothman01 »

I don't think the NXTCam is suitable for what you intend to try and do with it.
is there some other NXT accessory that can do better what I intend to try and do with the cam?

hmm, I see what you mean, that IS a slow process... I can't predict the color range of the garbage, but I can say != the bag or the can or the wall behind it... but as for the problem of the slowness, is there a way I can add more 12C connections to the cam, so the data can be retrieved from all of them?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests