AxisCamera Question

I have a very basic question about how AxisCamera works. If GetImage() is not being called, or not being called very often, do images being read from the camera accumulate in the cRIO memory? Or does each new image overwrite the previous one? If they accumulate the cRIO would eventually run out of memory whereas if they overwrite that would not be a problem. I was trying to explain this to a student and was not exactly sure how it worked.

From my experience in using this, each time you call GetImage() it overwrites the previous image stored in memory. The previous image will not be overwritten until GetImage() is called again.

This way you can perform multiple analysis/transforms on the image even if the image isn’t “fresh”.

Are you saying that an image is retrieved from the camera with each call to GetImage? I thought that images were constantly being received from the camera, stored in cRIO memory and that GetImage only picked up the latest one.

Correct, the cRIO will only store an image from the camera when the GetImage function is called.

Be careful how often you call the GetImage function, this can lead to clogging up your cRIO.

The driver station works differently, it constantly receives a feed from the camera.

Okay, so if for any reason we want to stop image processing, we can stop calling GetImage. Thanks for your help.

The descriptions here are pretty accurate, but it changed this year. To go into a bit more detail, in vision processing, there is an icon to the left that retrieves the mjpg stream as the images come in and posts them to anyone that has the same notifier. The big loop will call Get Image and process the latest – notifiers don’t queue. If you set the vision enable global to false, not only will you not call get image, but the refcount system in the Get MJPG will also stop retrieving images. After about fifteen second seconds, the camera will stop sending them entirely.

At that point, simply enabling will result in an error 66 inside the mjpg code. If you intend to enable and disable the camera during the match, you may need a version that handles that error.

Greg Mckaskle

Greg, I’m not sure if I completely follow you. In the C++ world, the above would only happen if you were to run the deconstructor ~AxisCamera, correct?

If you do not run GetImage() for 15 seconds, you can run it again and still get a new image; at least that’s what I’ve seen from experience.

In C++ and Java, images are constantly acquired by a background task and written into a buffer. Calls to GetImage() read from that buffer into an IMAQ image (this includes decoding the JPEG).

Not calling GetImage() when you are not doing anything with the output will reduce your processing burden by eliminating the JPEG decoding step.

RufflesRidge that goes back to my original question. When GetImage is not being called, are those images that are constantly being acquired filling up memory or does each new one overwrite the previous one?

They overwrite the previous ones. You can verify this by constructing an AxisCamera object by calling GetInstance(), but then never calling GetImage(). If the images were filling up, you would see the memory indicator on the DS Charts tab rapidly dwindle to 0 before your code crashed.

I was referring to the LV GetImage implementation. If no clients are enabled, it stops reading. I’m not that familiar with the Java and C++ implementation.

Greg Mckaskle