From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Processing - Rectangle recognition

Hi,

 

I am trying to find a way to recognize the rectangle (or square) pattern in my images, and I tried to do it using NI Vision Assistant. I find a function for shape recognition, but it does not see my rectangle which is quite big (enclosed picture ShapeDetection_Rectangles.png), and it does recognize elipses (enclosed picture ShapeDetection_Elipses.png), which are not even supposed to be there. Can someone help me to understand better the shape recognition function and propose maybe another way to find my squares?

 

Thank you very much for your help!

 

Best regards,

Jola

Download All
0 Kudos
Message 1 of 8
(3,778 Views)

Do you want find Match Pattern ?

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 8
(3,745 Views)

Hi, I am just looking for a way to find a square, so that my program will give information when the square is there on an image... The function which will be used is not important for me..Have you got any idea what could I do?

0 Kudos
Message 3 of 8
(3,722 Views)

Hi pers,

 

Before using the Shape Detection Setup function try using other functions to generate more contrast to the square. Have you tried extracting a color plane first (Color Plane Extraction Setup)?

 

Luis CT
0 Kudos
Message 4 of 8
(3,717 Views)

Hi pers,

It seems to me that your image is not preconditioned carefully which results in low-contrast between your object of interest and the background. Try preconditioning your image using tools such as Color Plane Extraction, Brightness, Filtering, Thresholding, Morphology etc. There are alot of preconditioning tools you can use which should be helpful to you but you should discover it yourself which ones are most suitable for your application.

However based from the image that youve provided, I suggest you might try this sequence Brightness -> Threshold -> Filter/Morphology -> Match Pattern/Geometeric Matching/Shape Detection. Of course its up to you to figure out the correct setting for each step.

0 Kudos
Message 5 of 8
(3,702 Views)

If you are not using it already, I highly recommend using the NI Vision Assistant to discover the right recipe of vision processing for your application.  It will also generate LabVIEW code.

 

http://www.ni.com/pdf/manuals/372228m.pdf

0 Kudos
Message 6 of 8
(3,683 Views)

Hi, thank you very much for the tips!

 

I used the Brightness, Threshold, Filter functions, in this order. You were right, the rectangle looks much better now, the edges are almost straight. The lines are very easy to be found by the function Shape Detection, but I still cannot find the Rectangle (see the enclosed pictures). The image before processing is enclosed as Erste Marken_5.png. The results of Shape Detection function is to be seen in the other two pictures.

Maybe there is something wrong with my settings in Curve Settings in Shape Detection function. I do not understand all options there (picture below.)

Settings.png

 

Thank you very much in advance for the next tips.

0 Kudos
Message 7 of 8
(3,670 Views)

HI Pers,

You can use Geometric Matching/Pattern Matching instead of Shape Detection.

0 Kudos
Message 8 of 8
(3,658 Views)