LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting Rectangles using NI-IMAQ

I am working on a project with omnidirectional robots.  We use different tops to determine between robots and to find the orientation.  A past group working on the project was able to use LabVIEW to detect and retreive information needed from a robot.  They used a circle as a marking to help determine the orientation.  I am attempting to get it to work now with a square instead of a circle.  I was hoping it would be as easy as replacing the detect circles with detect rectangles, but I am not having any luck with that.  I have attached pictures of the old and new robot and the LabVIEW code used to detect the circle or rectangle and calculate the orientation.  I am not sure if I need to adjust the match options and curve parameters to help detect a rectangle or not. 

 

The attached files contain VI and pictures of both the circle and rectangle recognition.  The only difference between the two is the DetectObj.vi.  The DetectObj.vi in the subVI folder is for the rectangle and oldCircleDetectObj.vi is for the circle detection.   If you have any other questions please let me know.  Thanks in advance for the help!!

 

Kevin

 

 

0 Kudos
Message 1 of 5
(4,944 Views)

Hey Kevin,

 

It appears that the rectangle is too small to be registering as a rectangle. You can actually find the rectangle with detect circles, showing that is actually pretty far from a rectangle when the algorithms are applied. 

 

However, I did come up with some problems when playing with your images. I used Vision Assistant to threshold, and manipulate your rectangle picture to the point where the only object on the entire image was the rectangle. However, it still could not find it. When I tried the same slogrithms with a rectangle that I created, it found it just find, but with your particular image, it could not. I don't know if your camera gives the image a header or something that interferes with our low-level code, but it wasn't working properly.

 

So, for orientation, I just used a line overlay where the start point was the middle of the white circle, and the end point was the rectangle's middle (the smaller "circle")

 

 

 

Chris Van Horn
Applications Engineer
Message 2 of 5
(4,919 Views)
The main reason I wanted to use detect rectangles is because we have two different robots and this is how we were going to attempt to distinguish between the two.  It sounds like detecting rectangles will not be an option at this size.  If this is correct then we will have to use multiple circles or another way to identify each robot.
0 Kudos
Message 3 of 5
(4,912 Views)

Ahh, well if you're wanting to use a rectangle merely for distinguishing the 2 different robots, there are plenty of ways to do that.

 

You could use different colored circles and use IMAQ Match Color Pattern.

You could do 2 circles on one of the robots.

You could do pattern matching instead of object detection.

You could use a bigger rectangle and place it a little further from the edge of the robot.

 

The problem was not in the size of the robot or picture, but the rectangle was so small that when it was being outlined for the algorithms, it was appearing more as an oval. A larger rectangle SHOULD remedy that. 

 

Hope this helps!

Chris Van Horn
Applications Engineer
Message 4 of 5
(4,909 Views)

Kevin - Is your Vi will find automatically find and extract (pick out ) the circular objects in a color image as well? Please confirm.

 

Regards,

Dinesh

0 Kudos
Message 5 of 5
(2,708 Views)