| HALCON Reference Manual / Regions / Features | Operators |
circularity — Shape factor for the circularity (similarity to a circle) of a region.
circularity(Regions : : : Circularity)
The operator circularity calculates the similarity of the input region with a circle.
Calculation: If F is the area of the region and max is the maximum distance
from the center to all contour pixels, the shape factor C
is defined as:
C = F / (max^2 * pi)
The shape factor C of a circle is 1. If the region is long or has holes C is smaller than 1. The operator circularity especially responds to large bulges, holes and unconnected regions.
In case of an empty region the operator circularity returns the value 0 (if no other behavior was set (see set_system)). If more than one region is passed the numerical values of the shape factor are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple.
| Regions (input_object) | region(-array) → object |
| Region(s) to be examined. | |
| Circularity (output_control) | real(-array) → (real) |
| Roundness of the input region(s). | |
| Assertion: (0 <= Circularity) && (Circularity <= 1.0) | |
* Comparison between shape factors of rectangle, circle and ellipse: gen_rectangle1(R1,10,10,20,20) gen_rectangle2(R2,100,100,0.0,100,20) gen_ellipse(E100,100,0.0,100,20) gen_circle(C,100,100,20) circularity([R1,R2,E,C],M) fwrite_string(FileId,['quadrate: ',M[1]]) fnew_line(FileId) fwrite_string(FileId,['rectangle: ',M[2]]) fnew_line(FileId) fwrite_string(FileId,['ellipse: ',M[3]]) fnew_line(FileId) fwrite_string(FileId,['circle: ',M[4]]) fnew_line(FileId)
The operator circularity returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>). The behavior in case of empty region (the region is the empty set) is set via set_system('empty_region_result',<Result>). If necessary an exception is raised.
circularity is reentrant and automatically parallelized (on tuple level).
threshold, regiongrowing, connection
roundness, compactness, convexity, eccentricity
Foundation
| HALCON Reference Manual / Regions / Features | Operators |
| Version 9.0.2 | Copyright © 1996-2010 MVTec Software GmbH |