View Full Version : Vision Processing on cRIO
Hello,
So I have a set of targets setup for vision processing for this season, and have a green led ring around the M1011 camera lens.
I am attempting to use the Vision Sample 2014 default code, however nothing happens.
What should I do from here?
Thanks,
DavisC
Alan Anderson
16-01-2014, 16:43
Do you see the targets glowing green on the image returned by the camera?
Joe Ross
16-01-2014, 16:46
It would be helpful to explain what changes you made to the code. By default, it does not read from the camera, but instead reads an image from the cRIO filesystem. http://wpilib.screenstepslive.com/s/3120/m/8731/l/91395-c-java-code
It would be helpful to explain what changes you made to the code. By default, it does not read from the camera, but instead reads an image from the cRIO filesystem. http://wpilib.screenstepslive.com/s/3120/m/8731/l/91395-c-java-code
Yes, sorry forgot about that.
I commented out and uncommented the lines referred to (here (http://wpilib.screenstepslive.com/s/3120/m/8731/l/91395-c-java-code/show_image?image_id=1772741)).
After doing that, it threw an error saying "camera" not declared. So after looking around I figured I declare the camera something like so:
class VisionSample2014 : public SimpleRobot...
AxisCamera& camera;
public:VisionSample2014(void):...
camera::GetInstance(CAMERA_IP)
I added CAMERA_IP as a new #define above
This all built and deployed without errors.
Do you see the targets glowing green on the image returned by the camera?
Yes, I also adjusted the brightness of the camera using the online interface to ~15 to make the green stand out more on the dark/black background
Greg McKaskle
17-01-2014, 08:26
After you've done those steps, you may want to compare the color of the retroreflective glow to the color threshold in the code. You want the glow value to be inside the min/max values. This will result in a binary image mask with on pixels that represent the glow and off pixels being something else. At that point, the rest should start working pretty well.
Greg McKaskle
I tested all of that today in the vision assistant and found the threshold values and plugged them into the code.
I decided to test something I know would work and added a line to run the motors after the line that checks to see if the "reports" is greater than 0. That Worked! (I was using static image for this point).
Not sure to what extent the vision tracking worked though.
I also added a line in the same place like so:
printf("Hello World!");
That did NOT work... So the printf statements are not showing up.
I have looked through some threads about the printf in netConsole but have had no success.
Success! Detected the horizontal target from my own testImage, Vertical one did not succeed but will have to test on Tuesday with a new image / live tracking.
For the printf problem (I attempted to print to driver station but that had annoyances), evidently I am blind when it comes to seeing the netConsole option on the Imaging tool (kept thinking Console out is what people meant :o ).
After selecting that, everything printed beautifully and I will perform more operations on the image over the coming week.
Thanks for your help!
DavisC
Must be that Friday success.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.