|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Camera Programming
So after three years, our team has finally decided to use a camera on the robot.
Since I was in the team three years ago, i dont have a single idea how to program the camera. So I would like to ask the greater programmers at CD, to help me. What do I need to program a robot to track the 4 squares (used in rebound rumble), and then move the robot so it aligns straight towards the target. Like what electrical components do i need and how do I program a camera thanks for the help |
|
#2
|
||||
|
||||
|
Re: Camera Programming
Electrically, all you need is the camera (axis cam), an Ethernet cord to plug into your bridge, and the power cable wired to 5v on the Power Distribution Board.
For setting up and configuring the camera, refer to this document (search camera) http://www.usfirst.org/sites/default...20System_2.pdf There is a great write up on the vision targets here: http://firstforge.wpi.edu/sf/docman/...ib/docman.root With Java code examples and an explanation of the theory! (Read all the documentation and you will learn alot, if you have specific questions, ask them here and the community will help!) Last edited by McGurky : 11-14-2012 at 09:53 AM. |
|
#3
|
||||
|
||||
|
Okay thanks,
So I do have one question: So here I have a snippet of the sample code given for Java programming: Code:
//ColorImage image = camera.getImage(); // comment if using stored images
ColorImage image; // next 2 lines read image from flash on cRIO
image = new RGBImage("/10ft2.jpg");
BinaryImage thresholdImage = image.thresholdRGB(255, 255, 0, 0, 0, 0); // keep only red objects
BinaryImage bigObjectsImage = thresholdImage.removeSmallObjects(false, 2); // remove small artifacts
BinaryImage convexHullImage = bigObjectsImage.convexHull(false); // fill in occluded rectangles
BinaryImage filteredImage = convexHullImage.particleFilter(cc); // find filled in rectangles
Code:
unreported exception AxisCameraException; must be caught or declared to be thrown Also, I was just wondering. If I do happen to use the sample image, how do I get it on the cRIO. I know in the documentations it says, ftp to the root directory. But what does that actually mean, like how do i ftp to the cRIO, which software do I use and etc. Thanks in advance |
|
#4
|
||||
|
||||
|
Re: Camera Programming
camera.getImage() can cause errors (think about if you tried to fetch an image that didn't exist) so you need to surround it with a
try{ //getImage } catch (Exception e){ //insert code to log error here, if wanted //handle the error by notifying the user to fix what ever is throwing the //error. } |
|
#5
|
||||
|
||||
|
Re: Camera Programming
Okay thanks
But how do i download the sample images to the crio via ftp Could u like tell me how to do it |
|
#6
|
||||
|
||||
|
Re: Camera Programming
|
|
#7
|
||||
|
||||
|
Re: Camera Programming
Use the address that cgmv123 posted (if you are using the default ip set up).
You can use FileZilla which has a graphic user interface or the default ftp using a CLI FTP Change to the current directory to the one with the image files run ftp type "open 10.28.15.2" and press enter leave username and password blank type "bin" use the "cd" command to move to the directory that you want the files in the use the "put" command to upload files. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|