02-14-2012 05:20 PM
Hi , there is 3 days left till the official tournament of the FRC robotics competition and our new rookie team has been depressed because we can't figure out how to track a rectangle with the camera. There is a rectangle processing project in the labview example but I don't know how to use it or even to implement it.. Please , we desesperately need help.
Thank you very much!
02-14-2012 09:13 PM
The right example is the one in the FRC section of the examples. Have you tried running it? Note that you can run it either on the cRIO, or directly on your computer, depending on whether you run it from the cRIO target or the "My Computer" target in the project explorer. It's probably easiest to start by running it on your computer. If the camera is configured properly and you run the example you should see the camera image (you might need to enable the camera image). You'll need something that looks like the actual vision target in order to do something useful with the example. Try pointing the camera at the vision target and see if the code finds it properly.
There are a number of settings you can adjust. One is the color that the code uses to identify the border of the target; you can change this by clicking on the target. You can also change the mode; it can look either for a specific color, or it can run the camera in grayscale and look for particular shades of gray. I don't have the code in front of me, but if I remember correctly, you can adjust how close the color needs to be to considered a match. There are other properties you can adjust as well, such as the aspect ratio (ratio of width to height) of the rectangle. I assume these are preset to match the real target, but you can play with them.
The display on the left shows you the raw camera image. The display on the right shows you results of the processing (if you enable it). You'll get, I believe, a black and red image. The red is what is identified as the target and the black is everything else. The code identifies "particles" - regions of the image that match the vision pattern. Each one is assigned a score. The code displays information about these particles, as well as the calculated distance to them.
I hope that's enough to get you started.
02-15-2012 11:59 AM
I would just like to add that we could not track the rectangle until we put some led lights on the camera. The reflective tape will reflect back in the direction the light is coming from. When we tried ambiant light (i.e. just the standard room lights) we got nothing. It wasn't until we added lights that it worked. We also had best results with the "Intensity" tab in the example.
02-15-2012 07:20 PM
LockheedJoe would you care to pass me your project because I really have no idea where or what to do .We bought the light and we just need the files . This would be forever remebered if you could pass me or tell me the steps to what you did to obtain working project!
I tried merging rectangle processing vi with my main project and it failed...
Thank you very much!
02-16-2012 06:45 AM
I won't be near the code until later today. However, all we did was used the locate rectangle example (under find examples and vision) and got that working. If I remember right, we then moved the vision.vi (i think that was the name) to the robot porject we were using just using windows explorer. The next time we opened the project for the robot, the vision code was there.
So we really didn't modify anything, we just copied a vi.
02-16-2012 09:20 AM
Have you taken a look at the example for this? Are you having specific issues with the example? You should be able to just run the code out of the box to track the rectangle. The code will show you what its tracking right on the front panel. You can also change the tuning parameters on the fly which helps you adapt the code to your specific lighting conditions.
02-17-2012 08:14 PM
I managed to merge it with my main project but now, how do I make it detect the rectangle. On the processed image frame, there's too much red meaning it's detecting thr wrong stuff!
How can I fix it?