Vision processing problem (black, jittery images)

I have been working on an image processing system for recognizing 2012 basket balls. I have it working really well except for the very end, where it gives me a black image that switches between black and color really quickly for some reason. I compressed it and lowered the framerate to where my computer can handle it. the Vision tool says I can do it at around 25fps and i have it set to 15.

It seems to be the image processing itself that is creating the stuttering images. I have it working on a standard, default driverstation and even then it doesnt work with the processing. Without the processing, it is fine and clear as day. Can anyone help me?

Here is my code:

Here is what I see most of the time:

The Code (a little walk-through):

I start with the standard read image, and put it though some processing.
The math at the top right simply puts the circle detection data onto the output image. I want the image to display a color image with a green circle around the ball, and for the most part, it does. For some reason it is getting black frames in it.

Does it make any difference if you set your speed to something much lower than what speed you think you ought to be able to do?

This process, as coded, would normally show a black screen, with an overlay of a circle.
I would suggest that you define 3 IMAQ memory spaces outside the loop.

  1. The first one would hold the streaming images from the camera.
  2. the second should hold a fixed copy of one image.
  3. The third would be your working memory area. (similar to the random one you now show)
    4 . In the loop, copy the latest image from the camera to the fixed memory and also the working memory.
    5 After processing, put the overlay onto the fixed image.

By trying to store everything in one memory space, you are sometimes displaying streamed camera images and sometimes processing images.

Hope this helps.

Here are some suggestions based on my learning for how to do vision processing:

  1. Start with a static image. Take a photo of the balls or even create a JPG or GIF with several red, orange, green, and blue circles on it. See if the code will detect the orange circles from the static image. This will tell you if there is a flaw in your processing algorithm.
  2. Use a USB webcam attached to your development PC to track a mock-up of your targets, whether on paper or in miniature. The VIs for USB webcams are easy to download (and free). This will narrow down any IMAQ issues that you have.
  3. Use the whole shebang with the robot and such to try it for real. If there’s a problem at this stage, it probably has something to do with your communications link/bandwidth.

If you do each of these, you can narrow down which part of the system is giving you trouble.

I’ve attached a pic of my static image loading segment.



Thank you so much, it made it work! I didn’t realize that that’s what happens. It is my first time doing vision tracking and I wanted to make it really nice and fast. Thank you!