Gauge Parameters and Tools#
Gauge Parameters#
-
struct AnnularSection#
The annular section region for annular calipers arrangement.
Public Members
-
visionflow::geometry::Point2f center = {150, 150}#
The center point of the annular section.
-
double start_radius = {50}#
Start radius of the annular section.
-
double end_radius = {80}#
End radius of the annular section.
-
visionflow::geometry::Radian start_radian = {0}#
Start angle (Radian) of the annular section, note that the range of Radian is [-𝝅, 𝝅].
-
visionflow::geometry::Point2f center = {150, 150}#
-
struct OneSideScoreFunc#
This class provides some common implementation for all one-sided scoring functions. A one-sided scoring function is a monotonic, piecewise-linear mapping from an input feature (shown on the x-axis) to an output score (gauged on the y-axis).The parameters x0, x1, xc, y0, and y1 determine breakpoints in the mapping function. The parameters are paired to define points: (x0,y0), (x1,y1), (xc,y1).
y0 |________ | \ | \ y1 | \________ | | ____|___________________|______ x0 x1 xc
The values of y0 and y1 range from 0.0 to 1.0. The range of the x values depends upon the feature being scored. For example, when scoring edge pairs, x values are often gauged as a multiple of the nominal model width.
Note that y0 is required to be the larger of the two output scores. You may create a reverse map by setting xc < x1 < x0 as follows:
y0 | ________ | / | / y1 | _____/ | | ____|___|_____________________ xc x1 x0
x values can be negative as well.
__________ y0 |/ | /| _____/ | y1 | | _______|_______|______________ xc x1 0 x0
Note that the parameters are not checked at construction time. The scoring functions check for the right order of x values at run time, i.e., it checks if x0 <= x1 <= xc or if xc <= x1 <= x0. Any other order is unacceptable and flagged as an error.
Public Members
-
bool enable = {false}#
Whether to enable OneSideScoreFunc.
-
double x0 = {200.0}#
Values between x0 and x1 are mapped to a score that is between y0 and y1, while contrast values on the other side of x0 are mapped to a score of y0.
-
double x1 = {50.0}#
Value of x1 must fall between the values of xc and x0. Contrast values between x0 and x1 are mapped to a score that is between y0 and y1, while contrast values between xc and x1 are mapped to a score of y1.
-
double xc = {10.0}#
Values between xc and x1 are mapped to a score of y1, while contrast values on the other side of xc are mapped to a score of zero.
-
double y0 = {1.0}#
The maximum score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be greater than the y1 value.
-
double y1 = {0.1}#
The minimum non-zero score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be less than the y0 value.
-
bool enable = {false}#
-
struct TwoSideScoreFunc#
This class provides some common implementation for all two-sided scoring functions. Like the one-sided case, a two-sided scoring function maps an input feature value, x, to an output score, y. The two-sided map is still piecewise-linear. It allows negative x values. A two-sided function is, in fact, broken up into 2 one-sided functions for simplicity and then the mapping function of the appropriate one-sided scoring function is called to evaluate the score.
The two-sided mapping uses the following parameters:
y0 ________|________ y0h / | : / | :\ y1 _____/ | : \__________ y1h | | : | ________|________________|________:____________|______ xc x1 x0 0 x0h x1h xch
The above fig shows a simple hump-shaped two-sided scoring function where y0 = y0h and y1 = y1h. This two-sided function is now split into 2 one-sided functions. Lets call them ‘High’ and ‘Low’ for simplicity. The High scoring function starts at the point marked by x0h and the Low scoring function is everything to the left of High. In other words, the Low scoring function ends at the point which corresponds to the lowest x value of High.
Let us consider a more complex scoring function.
| y0h ___________ | / | / y0 | _________/ y1h |/ : | : _________/| y1 : __|__________|_____:___________________ xc x1 0 x0 xch x1h x0h
Here the portion to the left of xch forms the Low scoring function since xch is the lowest x value of High and the portion to the right forms the High scoring function.
Note that the parameters are not checked at construction time. The scoring functions check for the right order of x values at run time, i.e., it checks if x0 <= x1 <= xc or if xc <= x1 <= x0, and checks if x0h <= x1h <= xch or if xch <= x1h <= x0h, then checks if y1 <= y0h <= 1 and y1h>=0. Any other order is unacceptable and flagged as an error.
Public Members
-
bool enable = {false}#
Whether to enable TwoSideScoreFunc.
-
double x0 = {200.0}#
Values between x0 and x1 are mapped to a score that is between y0 and y1, while contrast values on the other side of x0 are mapped to a score of y0.
-
double x1 = {50.0}#
Value of x1 must fall between the values of xc and x0. Contrast values between x0 and x1 are mapped to a score that is between y0 and y1, while contrast values between xc and x1 are mapped to a score of y1.
-
double xc = {10.0}#
Values between xc and x1 are mapped to a score of y1, while contrast values on the other side of xc are mapped to a score of zero.
-
double y0 = {1.0}#
The maximum score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be greater than the y1 value.
-
double y1 = {0.1}#
The minimum non-zero score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be less than the y0 value.
-
double x0h = {200.0}#
Values between x0h and x1h are mapped to a score that is between y0h and y1h, while contrast values on the other side of x0h are mapped to a score of y0h.
-
double x1h = {50.0}#
Value of x1h must fall between the values of xch and x0h. Contrast values between x0h and x1h are mapped to a score that is between y0h and y1h, while contrast values between xch and x1h are mapped to a score of y1h.
-
double xch = {10.0}#
Values between xch and x1h are mapped to a score of y1h, while contrast values on the other side of xch are mapped to a score of zero.
-
double y0h = {1.0}#
The maximum score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be greater than the y1h value.
-
double y1h = {0.1}#
The minimum non-zero score that will be produced by this scoring function. This unitless value is in the range of 0.0 through 1.0, and must be less than the y0h value.
-
bool enable = {false}#
-
struct CaliperSingleEdgeScoreFunc#
A set of scoring functions. A overall score (i.e., the score attribute in the CaliperedSingleEdgePoint object) is generated based on each score (computed by the OneSideScoreFunc function, such as contrast, center_distance, etc.). If the number of scoring functions is N, the overall score is the Nth root of the product of N scores.
Public Members
-
OneSideScoreFunc contrast = {true, 255.0, 0.0, 0.0, 1.0, 0.0}#
A function for scoring based on contrast.
-
OneSideScoreFunc center_distance#
A function for scoring based on distance to the center.
-
OneSideScoreFunc center_offset#
A function for scoring based on the offset relative to the center.
-
OneSideScoreFunc polarity#
A function for scoring based on polarity.
-
OneSideScoreFunc light_polarity#
A function for rating based on lightness polarity.
-
OneSideScoreFunc dark_polarity#
A function for rating based on darkness polarity.
-
OneSideScoreFunc contrast = {true, 255.0, 0.0, 0.0, 1.0, 0.0}#
-
struct CaliperEdgePairScoreFunc#
A set of scoring functions. A overall score (i.e., the score attribute in the CaliperedEdgePairPoint object) is generated based on each score (computed by the OneSideScoreFunc function and TwoSideScoreFunc function, such as contrast, center_distance, etc.). If the number of scoring functions is N, the overall score is the Nth root of the product of N scores.
Public Members
-
OneSideScoreFunc contrast = {true, 255.0, 0.0, 0.0, 1.0, 0.0}#
A function for scoring based on contrast.
-
OneSideScoreFunc center_distance#
A function for scoring based on distance to the center.
-
OneSideScoreFunc center_offset#
A function for scoring based on the offset relative to the center.
-
OneSideScoreFunc center_distance_norm#
A function for scoring based on the normalized center distance.The normalized center distance represents the absolute value of the distance between the detected edge position and the center position of the caliper, as well as the width of the edge.
-
OneSideScoreFunc center_offset_norm#
A function for scoring based on the normalized center offset.The normalized center offset represents the sum of the distance between the detected edge position and the center position of the caliper and the edge width.
-
OneSideScoreFunc width_norm#
A function for scoring based on the normalized width.The normalized width represents the ratio of the detected edge width to the user set width.
-
TwoSideScoreFunc width_diff_norm#
A function for scoring based on the normalized width difference.The normalized width difference represents the sum of the difference between the detected edge width and the user set width, and the user set width.
-
OneSideScoreFunc width_diff_norm_abs#
A function for scoring based on the absolute normalized width difference.The absolute normalized width difference represents the absolute value of the difference between the detected edge width and the user set width, and the absolute value of the user set width.
-
bool enable_straddle = {}#
Enable the function for scoring based on whether it straddles centers. If the product of the center deviation of two detection edges is greater than or equal to 0, the score is set to 0. If it is greater than or equal to 0, the score is set to 1.
-
OneSideScoreFunc average_gray#
A function for scoring based on average gray.The higher the average grayscale of the edges, the higher the edge score.
-
OneSideScoreFunc contrast = {true, 255.0, 0.0, 0.0, 1.0, 0.0}#
-
enum visionflow::gauge::ExecuteStatus#
The execute status of gauge tool, indicating whether it’s successful and the reasons for failure.
Values:
-
enumerator kSuccess#
The tool successfully found the result.
-
enumerator kNotFound#
The tool is not find target.
-
enumerator kEmptyCaliperROIs#
he ROI calculated based on the view and caliper parameters is empty.
-
enumerator kFitFailed#
Failed to fit shape.
-
enumerator kClipFailed#
Failed to clip shape.
-
enumerator kSuccess#
-
enum visionflow::gauge::AnnularDirectionMode#
The direction mode of search annular edges.
Values:
-
enumerator kInnerToOuter#
Search for edges from inner to outer.
-
enumerator kOuterToInner#
Search for edges from outer to inner.
-
enumerator kInnerToOuter#
-
enum visionflow::gauge::FitType#
The type of fit shape.
Values:
-
enumerator kLeastSquare#
Simle least square, no weight.
-
enumerator kHuber#
Huber weight.
-
enumerator kTukey#
Tukey weight.
-
enumerator kRanSac#
Ransac.
-
enumerator kLeastSquare#
-
enum visionflow::gauge::EdgePolarityMode#
It specifies how the gray value of pixels around the edge you want to find changes along the search direction.
Values:
-
enumerator kDarkToLight#
Search the edge from dark to light.
-
enumerator kLightToDark#
Search the edge from light to dark.
-
enumerator kBoth#
Search the edge from dark to light and from light to dark.
-
enumerator kDarkToLight#
-
enum visionflow::gauge::EdgeOrderMode#
The way to sorted search results.
Values:
-
enumerator kBestScore#
Search results are sorted in descending order of scores.
-
enumerator kFirstEdge#
Search results are sorted along the detection direction.
-
enumerator kLastEdge#
Search results are sorted in the opposite direction of the detection direction.
-
enumerator kBestScore#
Gauge Tools#
-
struct CaliperedSingleEdgePoint#
An edge point searched by single edge caliper, note that the point position is based on the view coordinate system.
Public Members
-
double score = {}#
Score of the single edge caliper point in the range 0.0-1.0.
-
visionflow::geometry::Point2f edge_point#
The (x,y) position of the single edge caliper point in the view coordinate system.
-
double offset = {}#
The offset along the x axis relative to the center of the input region.
-
double contrast = {}#
Contrast of the edge in the range -255-255, negative contrasts represent light to dark.
-
double sensitivity = {}#
The ratio of the current edge contrast to the maximum contrast in the range 0.0-1.0.
-
EdgePolarityMode polarity = {kBoth}#
Polarity of the edge.
-
double score = {}#
-
struct CaliperedSingleEdgePointSet#
All edge points found by the single edge caliper in the input geometry::RotateRect2f roi region and the execute status, the details please see ExecuteStatus.
Public Members
-
std::vector<CaliperedSingleEdgePoint> target#
The search results of the tool.
-
ExecuteStatus status = {kSuccess}#
The status of single edge caliper tool execution.
-
std::vector<CaliperedSingleEdgePoint> target#
-
CaliperedSingleEdgePointSet visionflow::gauge::caliper_single_edge(const visionflow::img::Image &image, const visionflow::View &view, const visionflow::geometry::RotateRect2f &roi = visionflow::geometry::RotateRect2f({50, 50}, {100, 50}, 0), gauge::EdgePolarityMode edge_polarity_mode = gauge::kBoth, gauge::EdgeOrderMode edge_order_mode = gauge::kBestScore, size_t filter_half_size = 1, double contrast_threshold = 25.0, double sensitive_threshold = 0, size_t max_result_num = 1, const gauge::CaliperSingleEdgeScoreFunc &score_func = gauge::CaliperSingleEdgeScoreFunc())#
The single edge caliper used to search for single edge points.
- Parameters:
image – Source image.
view – Possible region for single edge caliper arrangement.
roi – The ROI of arrange single edge caliper, note that the position coordinates are based on the view coordinate system.
edge_polarity_mode – Edge polarity mode, the type is EdgePolarityMode
edge_order_mode – Edge order mode. the type is EdgeOrderMode.
filter_half_size – Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
sensitive_threshold – Sensitive Threshold of edge, it’s a real number between [0, 1].
max_result_num – Maximum number of results, it’s an integer number >= 1.
score_func – Function used to score results, the details please see CaliperSingleEdgeScoreFunc
- Returns:
-
struct CaliperedEdgePairPoint#
An edge point pair searched by edge pair caliper, note that the point position is based on the view coordinate system.
Public Members
-
double score = {}#
Score of the edge pair caliper points in the range 0.0-1.0.
-
visionflow::geometry::Point2f edge1_point#
The (x,y) position of the first edge point in the view coordinate system.
-
double edge1_point_offset = {}#
The offset of the first edge along the x axis relative to the center of the input region.
-
double edge1_point_contrast = {}#
Contrast of the first edge in the range -255-255, negative contrasts represent light to dark.
-
visionflow::geometry::Point2f edge2_point#
The (x,y) position of the second edge point in the view coordinate system.
-
double edge2_point_offset = {}#
The offset of the second edge along the x axis relative to the center of the input region.
-
double edge2_point_contrast = {}#
Contrast of the second edge in the range -255-255, negative contrasts represent light to dark.
-
double score = {}#
-
struct CaliperedEdgePairPointSet#
All edge points found by the edge pair caliper in the input geometry::RotateRect2f roi region and the execute status, the details please see ExecuteStatus.
Public Members
-
std::vector<CaliperedEdgePairPoint> target#
The search results of the tool.
-
ExecuteStatus status = {kSuccess}#
The status of edge pair caliper tool execution.
-
std::vector<CaliperedEdgePairPoint> target#
-
CaliperedEdgePairPointSet visionflow::gauge::caliper_edge_pair(const visionflow::img::Image &image, const visionflow::View &view, const visionflow::geometry::RotateRect2f &roi = visionflow::geometry::RotateRect2f({50, 50}, {100, 50}, 0), gauge::EdgePolarityMode edge_polarity_mode1 = gauge::kBoth, gauge::EdgePolarityMode edge_polarity_mode2 = gauge::kBoth, size_t filter_half_size = 1, double contrast_threshold = 25.0, double sensitive_threshold = 0, size_t max_result_num = 1, double edge_pair_width = 100.0, const gauge::CaliperEdgePairScoreFunc &score_func = gauge::CaliperEdgePairScoreFunc())#
Edge pair caliper, which is used to search for edge point pair.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi – The ROI of arrange caliper, note that the position coordinates are based on the view coordinate system.
edge_polarity_mode1 – Edge polarity mode1, the type is EdgePolarityMode
edge_polarity_mode2 – Edge polarity mode1, the type is EdgePolarityMode
filter_half_size – Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
sensitive_threshold – Sensitive Threshold of edge, it’s a real number between [0, 1].
max_result_num – Maximum number of results, it’s an integer number >= 1.
edge_pair_width – Expected width of edge pairs, it’s a real number greater than 0.
score_func – Function used to score results, the details please see CaliperEdgePairScoreFunc
- Returns:
-
struct CaliperedAnnularPoint#
An annular edge point searched by annular caliper, note that the point position is based on the view coordinate system.
Public Members
-
double score = {}#
Score of the annular caliper point in the range 0.0-1.0.
-
visionflow::geometry::Point2f edge_point#
The (x,y) position of the annular edge point in the view coordinate system.
-
visionflow::geometry::Radian angle#
The vector direction angle formed by the annular section center point and the searched edge point in the view coordinate system.
-
double contrast = {}#
Contrast of the edge in the range -255-255, negative contrasts represent light to dark.
-
double sensitivity = {}#
The ratio of the current edge contrast to the maximum contrast in the range 0.0-1.0.
-
EdgePolarityMode polarity = {kBoth}#
Polarity of the edge.
-
double score = {}#
-
struct CaliperedAnnularPointSet#
All edge points found by the annular caliper in the input AnnularSection roi region and the execute status, the details please see ExecuteStatus.
Public Members
-
std::vector<CaliperedAnnularPoint> target#
The search results of the tool.
-
ExecuteStatus status = {kSuccess}#
The status of caliper tool execution.
-
std::vector<CaliperedAnnularPoint> target#
-
CaliperedAnnularPointSet visionflow::gauge::caliper_annular(const visionflow::img::Image &image, const visionflow::View &view, const visionflow::gauge::AnnularSection &roi = visionflow::gauge::AnnularSection(), gauge::EdgePolarityMode edge_polarity_mode = gauge::kBoth, gauge::EdgeOrderMode edge_order_mode = gauge::kBestScore, size_t filter_half_size = 1, double contrast_threshold = 25, double sensitive_threshold = 0, size_t max_result_num = 1, bool enable_angle_normalization = true)#
Annular caliper, which is used to search for annular edge point.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi – The ROI of arrange caliper, note that the position coordinates are based on the view coordinate system. radian.
edge_polarity_mode – Edge polarity mode1, the type is EdgePolarityMode
edge_order_mode – Edge order mode. the type is EdgeOrderMode.
filter_half_size – Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
sensitive_threshold – Sensitive Threshold of edge, it’s a real number between [0, 1].
max_result_num – Maximum number of results, it’s an integer number >= 1.
enable_angle_normalization – Whether to enable normalize the result radian.
- Returns:
-
struct EdgePointWithStatus#
The edge point found by gauge tool and whether it’s’ used to fit the shape.
Public Members
-
visionflow::geometry::Point2f point#
The edge point found by gauge tool.
-
bool fitted = true#
Whether the edge point is used for shape fitting.
-
visionflow::geometry::Point2f point#
-
struct FoundLine#
The return result of the find_line function includes the found line(The type is geometry::Segment2f, which is the intersection of the found original line and the input parameter roi of the find_line function.), the set of edge points found by the calipers and whether it’s used for line fitting, the roi set of the caliper array and the execution status of find_line function, note that the position of found line, edge points and caliper array roi set ard based on the view coordinate system.
Public Members
-
double rms = {}#
The root mean square of the vertical distance from the edge points for line fitting.
-
visionflow::geometry::Segment2f target#
The line that was found.
-
std::vector<EdgePointWithStatus> edge_points_and_status#
The edge point of the caliper and the status, the type is EdgePointWithStatus.
-
std::vector<visionflow::geometry::RotateRect2f> caliper_rois#
All calipers’ sampling roi rectangles.
-
ExecuteStatus status = ExecuteStatus::kSuccess#
The status of find line tool execution.
-
double rms = {}#
-
visionflow::gauge::FoundLine visionflow::gauge::find_line(const Image &image, const View &view, const geometry::Segment2f &roi_center_line = geometry::Segment2f({0, 0}, {100, 100}), bool enable_caliper_auto = true, size_t caliper_width = 5, size_t caliper_height = 15, int caliper_space = 1, gauge::EdgePolarityMode edge_polarity_mode = gauge::kBoth, gauge::EdgeOrderMode edge_order_mode = gauge::kBestScore, size_t filter_half_size = 1, double contrast_threshold = 25, double outliers_ratio = 0.3)#
Find line tool, which is used to search line segment.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi_center_line – The caliper array are arranged with this as the center line in the height direction, note that the position coordinates are based on the view coordinate system.
enable_caliper_auto – Whether to turn on automatic caliper arrangement.
caliper_width – The width of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
caliper_height – The height of the caliper, note that the minimum value is 3.
caliper_space – The space of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
edge_polarity_mode – Edge polarity mode, the type is EdgePolarityMode
edge_order_mode – Edge order mode. the type is EdgeOrderMode.
filter_half_size – filter_half_size Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
outliers_ratio – The ratio of outliers when fitting line.
- Returns:
-
struct FoundCircle#
The return result of the find_circle function includes the found circle(The type is geometry::Arc2f, which is the intersection of the found original circle and the input parameter roi of the find_circle function.), the set of edge points found by the calipers and whether it’s used for circle fitting, the roi set of the caliper array and the execution status of find_circle function, note that the position of found circle, edge points and caliper array roi set ard based on the view coordinate system.
Public Members
-
double rms = {}#
The root mean square of the vertical distance from the edge points for circle fitting.
-
visionflow::geometry::Arc2f target#
The arc that was found.
-
std::vector<EdgePointWithStatus> edge_points_and_status#
The edge point of the caliper and the status, the type is EdgePointWithStatus.
-
std::vector<visionflow::geometry::RotateRect2f> caliper_rois#
All calipers’ sampling roi rectangles.
-
ExecuteStatus status = ExecuteStatus::kSuccess#
FindCircle tool execution status.
-
double rms = {}#
-
visionflow::gauge::FoundCircle visionflow::gauge::find_circle(const Image &image, const View &view, const geometry::Arc2f &roi = geometry::Arc2f({150, 100}, 50, 0, geometry::Radian::FromDegree(180)), bool enable_caliper_auto = true, size_t caliper_width = 5, size_t caliper_height = 15, int caliper_space = 1, gauge::AnnularDirectionMode direction_mode = gauge::kInnerToOuter, gauge::EdgePolarityMode edge_polarity_mode = gauge::kBoth, gauge::EdgeOrderMode edge_order_mode = gauge::kBestScore, size_t filter_half_size = 1, double contrast_threshold = 25, double outliers_ratio = 0.3)#
Find circle tool, which is used to search circle.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi – Arc of caliper array, note that the minimum radius greater than 0, and the position coordinates are based on the view coordinate system.
enable_caliper_auto – Whether to turn on automatic caliper arrangement.
caliper_width – The width of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
caliper_height – The height of the caliper, note that the minimum value is 3.
caliper_space – The space of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
direction_mode – The direction mode of find circle.
edge_polarity_mode – Edge polarity mode, the type is EdgePolarityMode
edge_order_mode – Edge order mode. the type is EdgeOrderMode.
filter_half_size – filter_half_size Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
outliers_ratio – The ratio of outliers when fitting line.
- Returns:
FindCircleResult.
-
struct FoundTipPointPostion#
The result of find tip point position tool, including edge points found by this tool, the corresponding offset in the ROI angle direction, the index of the maximum offset and the minimum offset, the caliper ROI set and its index set, and execute status of this tool, note that the position of found edge points and caliper array roi set ard based on the view coordinate system.
Public Members
-
visionflow::geometry::MultiPoint2f target#
edge points.
-
std::vector<double> offsets#
offset of each point in the direction of ROI
-
std::vector<int> caliper_indexs#
caliper index for every edge_pts and offsets
-
size_t max_offset_idx#
maximum offset point index.
-
size_t min_offset_idx#
minimum offset point index.
-
std::vector<visionflow::geometry::RotateRect2f> caliper_rois#
All calipers’ sampling roi rectangles.
-
ExecuteStatus status = ExecuteStatus::kSuccess#
The status of find tip position tool execution.
-
visionflow::geometry::MultiPoint2f target#
-
visionflow::gauge::FoundTipPointPostion visionflow::gauge::find_tip_point_position(const Image &image, const View &view, const geometry::RotateRect2f &roi = geometry::RotateRect2f({150, 150}, {200, 100}, 0), bool enable_caliper_auto = true, size_t caliper_width = 5, int caliper_space = 1, gauge::EdgePolarityMode edge_polarity_mode = gauge::kBoth, gauge::EdgeOrderMode edge_order_mode = gauge::kBestScore, size_t filter_half_size = 1, double contrast_threshold = 25)#
Find tip point position tool, which is used to search the nearest and farthest points in the image ROI region from the edge in the opposite direction of the ROI angle.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi – The ROI of arrange caliper, note that the position coordinates are based on the view coordinate system.
enable_caliper_auto – Whether to turn on automatic caliper arrangement.
caliper_width – The width of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
caliper_space – The space of the caliper (only effective when enable_caliper_auto is false), note that the minimum value is 1.
edge_polarity_mode – Edge polarity mode, the type is EdgePolarityMode
edge_order_mode – Edge order mode. the type is EdgeOrderMode.
filter_half_size – filter_half_size Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
- Returns:
-
struct FittedLine#
The return result type of the fit_line function, including the fitted segment and function execution status.
Public Members
-
visionflow::geometry::Segment2f target#
Fitted segment.
-
ExecuteStatus status = {kSuccess}#
FitLine tool execution status.
-
visionflow::geometry::Segment2f target#
-
FittedLine visionflow::gauge::fit_line(const geometry::MultiPoint2f &multi_pt, gauge::FitType fit_type = gauge::FitType::kLeastSquare, double clipping_factor = 1)#
Fit Line function, which is used to fit segment from multiple points.
- Parameters:
multi_pt – input points.
fit_type – fit algorithm, kHuber and kTukey are robust fit algorithms that iteratively fits the segment to reduce the impact of outliers,but less efficiency.
clipping_factor – Clipping factor for the elimination of outliers (typical: 1.0 for kHuber and 2.0 for kTukey), only no effective when fit_type is RanSac.
- Returns:
-
struct FittedCircle#
The return result type of the fit_circle function, including the fitted circle and function execution status.
Public Members
-
visionflow::geometry::Circle2f target#
Fitted circle result.
-
ExecuteStatus status = {kSuccess}#
FitCircle tool execution status.
-
visionflow::geometry::Circle2f target#
-
FittedCircle visionflow::gauge::fit_circle(const geometry::MultiPoint2f &multi_pt, gauge::FitType fit_type = gauge::FitType::kLeastSquare, double clipping_factor = 1, bool constraint_radius = false, double radius = 0)#
Fit circle function, used to fit circle from multiple points.
- Parameters:
multi_pt – input points.
fit_type – fit algorithm, kHuber and kTukey are robust fit algorithms that iteratively fits the circle to reduce the impact of outliers,but less efficiency.
clipping_factor – Clipping factor for the elimination of outliers (typical: 1.0 for kHuber and 2.0 for kTukey), only no effective when fit_type is RanSac.
constraint_radius – whether fit circle with constraint radius. When the input discrete points are mainly concentrated in a small arc region, it is recommended to turn on the radius constraint.
radius – the constraint radius.
- Returns:
-
struct FittedEllipse#
The return result type of the fit_ellipse function, including the fitted ellipse and function execution status.
Public Members
-
visionflow::geometry::Ellipse2f target#
Fitted ellipse result.
-
ExecuteStatus status = {kSuccess}#
FitEllipse tool execution status.
-
visionflow::geometry::Ellipse2f target#
-
FittedEllipse visionflow::gauge::fit_ellipse(const geometry::MultiPoint2f &multi_pt, gauge::FitType fit_type = gauge::FitType::kLeastSquare, double clipping_factor = 1, bool constraint_angle = false, const geometry::Radian &angle = geometry::Radian(0))#
Fit ellipse function, used to fit ellipse from multiple points.
- Parameters:
multi_pt – input points.
fit_type – fit algorithm, kHuber and kTukey are robust fit algorithms that iteratively fits the ellipse to reduce the impact of outliers,but less efficiency.
clipping_factor – Clipping factor for the elimination of outliers (typical: 1.0 for kHuber and 2.0 for kTukey), only no effective when fit_type is RanSac.
constraint_angle – whether the x axis of the ellipse will be constrained. When the input discrete points are mainly concentrated in a small arc region, it is recommended to turn on the angle constraint.
angle – the radian of constraint angle.
- Returns:
-
struct Pitch#
The found pitch by gauge pitch tool, includes the coordinates, contrast, polarity and width of an edge point pair, note that the edge point pair is based on the view coordinate system.
Public Members
-
double edge1_contrast = {}#
contrast of first edge.
-
EdgePolarityMode edge1_polarity = {EdgePolarityMode::kBoth}#
polarity of first edge.
-
double edge2_contrast = {}#
contrast of second edge.
-
EdgePolarityMode edge2_polarity = {EdgePolarityMode::kBoth}#
polarity of second edge.
-
double intra_distance = {}#
width of edge pair: | <-pair1-> | | <-pair2-> |
-
double edge1_contrast = {}#
-
struct PitchSet#
The find result of the gauge pitch tool, includes pitch set, an edge distance set and a center point distance set of two adjacent pitches.
Public Members
-
std::vector<double> inter_distances#
distance of neighbor pairs:| pair1| <-inter-> | pair2 |
-
std::vector<double> center_distances#
distance of neighbor center
-
ExecuteStatus status = ExecuteStatus::kSuccess#
gauge pitch tool execution status.
-
std::vector<double> inter_distances#
-
visionflow::gauge::PitchSet visionflow::gauge::gauge_pitch(const Image &image, const View &view, const geometry::RotateRect2f &roi = geometry::RotateRect2f({50, 50}, {100, 50}, 0), gauge::EdgePolarityMode edge_polarity_mode1 = gauge::kBoth, gauge::EdgePolarityMode edge_polarity_mode2 = gauge::kBoth, size_t filter_half_size = 1, double contrast_threshold = 25)#
Gauge pitch tool, which is used to gauge each pitch width, neighbor pitch edge distance and neighbor pitch center distance.
- Parameters:
image – Source image.
view – Possible region for caliper arrangement.
roi – The ROI of arrange caliper, note that the position coordinates are based on the view coordinate system.
edge_polarity_mode1 – Edge polarity mode1, the type is EdgePolarityMode
edge_polarity_mode2 – Edge polarity mode1, the type is EdgePolarityMode
filter_half_size – Filter radius, which is a integer number >=1, used for denoising.
contrast_threshold – Contrast Threshold of edge, it’s a real number in (0, 255].
- Returns: