06-26-2013 09:32 AM
Attached are 3 files. The vi (simple.vi), the variable library and the project file. Hopefully it reassembles easily.
One issue I am having is that the image 'flickers', and it seems to be creating havoc with the vision tools. What is also strange is that every once and a while, it seems a 'raw' image (meaning color) slips in, which may actually be the flicker problem. I am using a USB camera to capture the video.
I thought of using a shift register, which helps a little, but the problem persists. I have a feeling it is something dumb I am missing.
Also, I am trying to figure out how to get the 'Imaq Simple Edge' to show up on the screen, like the 'Imaq Find Edge' does. I am assuming there is a Boolean somewhere I am missing. I would like to use this to see if the edges are where they are supposed to be, as well as if the lines are drawn in the right place. This is mainly for debugging purposes. What I have been using in the interim is the Vision Assistant to see if the calculated values line up with where they should be. It would be much nicer to have it in the VI.
In case you are curious, what I am trying to do is find 4 discs on any of 3 pins. The camera and target are not locked together, so I am using the top, bottom and left edges to locate the base, then calculate where the pins should be, then draw edge find lines to see if they are there. Ultimately the logic (not included yet) will allow me to determine which disc is where.
I tried pattern matching, but this setup is too 'random' for it in testing. The basic vision setup in this vi seems to work, and is similar to what I have used in industrial applications in the past.
Thanks for any help.
Rich
06-26-2013 04:42 PM
I didn't look at your code too closely, but have a few suggestions:
Provide a seperate dest image to IMAQ Cast. Without it your image is constantly being re-allocated between color and mono. It is pretty inefficient and is also likely causing the display irregularities you are seeing as described below.
-You image display is not set to "Snapshot" mode. This means the display is updated asynchronously. What you are probably seeing with the display is that the image is not yet updated on-screen but then gets acquired into on the next iteration of the loop. Thus you momentarilly see a color image. The non-snapshot mode works best when you only use it with images that are written to once per loop iteration. If it is being modified in more than one location then you'll see erratic results, depending on when the display is re-drawn.
Eric
06-26-2013 08:59 PM
Thank you for the feedback.
I tried the 'Snapshot' option, and the graphic overlays disappeared. Ultimately, this doesn't matter, but while I am still tinkering, it is useful to have it displayed.
What seems to have fixed it, is I removed the shift-register, and got rid of the Imaq Cast. Instead, I am using the 'IMAQ Create' to make the grayscale image. This has gotten rid of the twitch, as far as I can tell, allows the overlay, but the image displayed is color (not a big deal). Attached is the updated VI/
I still can't figure out how to get the overlay for the Edge Detector lines. Attached is a picture of what I would like to display with the edge finding lines (the little green squares).
I am assuming the Edge Detector is less processing intensive than the Find Straight Edge. This is the reason I am using Edge Detectors to find the discs. If this is incorrect, I can probably use the find Straight Edge to find the edge I am looking for.