Thread: Camera Tracking
View Single Post
  #8   Spotlight this post!  
Unread 07-12-2011, 17:45
moopydoopy moopydoopy is offline
Registered User
no team
 
Join Date: Dec 2011
Location: USA
Posts: 2
moopydoopy is an unknown quantity at this point
Re: Camera Tracking

To get images from the camera, I would suggest writing your own code. In my experience the C++ WPILib functionality of getting images from the camera (the AxisCamera class, if I recall), was sketchy, slow, and didn't always work last time I tried to use it.

To get images yourself, you can do exactly what your browser (firefox, IE, chrome, etc) does and use HTTP Requests. The format is pretty simple and you can even use wireshark to see what firefox sends and just send that exact request if you like. All you need to do is make a new thread, open a TCP socket to the camera, and in a loop just send a packet containing your HTTP request, then read the response which will be an image from the camera.

You then feed the image into the NI Vision functions of your desire as Greg mentioned. NI Vision Assistant is an excellent tool for testing out some functions. You can even generate C code with it that you can use. The code is makes is inefficient and clunky (because it has to be for the modularity required in its case..) but you can rip out all the excess and see exactly what function calls it is doing.

This method allows you complete control over timing, memory, etc.