Geometric search tool parameter adaptive method and device, equipment and storage medium

By using the geometric search tool parameter adaptive method in machine vision tasks, users can automatically calculate the necessary tool parameters by labeling target lines, solving the problem of high settings complexity and reducing technical thresholds and training costs.

CN119228832APending Publication Date: 2024-12-31SHENZHEN SMARTMORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411353405.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In machine vision tasks, setting parameters of geometric search tools requires professional knowledge and long-term training, resulting in high technical thresholds and user training costs.

Method used

It provides a geometric search tool parameter adaptation method. By labeling target lines on the sample image, the target tool width, filter width, edge detection threshold, fit error threshold and number of tools are automatically calculated, reducing the complexity of parameter settings.

Benefits of technology

Without a deep understanding of the principles of the function and setting results of the parameters, users can quickly obtain appropriate tool parameters, significantly reducing technical thresholds and training costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119228832A_ABST
    Figure CN119228832A_ABST
Patent Text Reader

Abstract

The invention relates to a geometric lookup tool parameter adaptive method and device, equipment and a storage medium. The method comprises the steps of obtaining the number of tools required by a sample based on a target straight line set by a user on a sample image and an obtained width parameter combination, wherein the width parameter combination comprises a tool width and a filtering width; processing the sample image based on the number of tools required by the sample to obtain a nearest edge point, and obtaining a target tool proportion based on the number of tools required by the sample and the nearest edge point; calculating a sample maximum score based on the nearest edge point and the target tool proportion, and determining a target tool width and a target filtering width based on the sample maximum score; and calculating a target edge detection threshold, a target fitting error threshold and a target tool number based on the target straight line, the target tool width and the target filtering width. By adopting the method and the device, the technical threshold for setting the geometric search tool parameters and the user training cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, equipment and storage medium for geometric search tool parameter adaptation. Background Art

[0002] In traditional machine vision tasks, it is necessary to extract several edge points from an image through a geometric search tool, and then further obtain geometric shapes such as straight lines, circles, and ellipses based on the edge points, so as to accurately locate the target material corresponding to the above image; in order to facilitate the extraction of accurate edge points from the image through the geometric search tool, the tool parameters of the geometric search tool need to be carefully set.

[0003] Currently, when setting the tool parameters of the geometric search tool, the user needs to set the tool parameters of the geometric search tool according to the characteristics of the target edge in the image, where the tool parameters include tool width, tool length, filter width, edge detection threshold, edge polarity, edge selection strategy, number of tools, and fitting error threshold.

[0004] However, setting the above tool parameters requires users to have a deep understanding of the working principles and setting results of each parameter. Even professional engineers need to undergo a long period of training to master the idea of ​​setting tool parameters. It can be seen that the current technical threshold and user training cost for setting geometry search tool parameters are relatively high. Summary of the invention

[0005] Based on this, it is necessary to provide a method, device, computer equipment, computer readable storage medium and computer program product for geometric search tool parameter adaptation to address the above-mentioned technical problems, which can reduce the technical threshold and user training costs for setting geometric search tool parameters.

[0006] In a first aspect, the present application provides a method for geometric search tool parameter adaptation, comprising:

[0007] The number of tools required for the sample is obtained based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes the tool width and the filter width;

[0008] Processing the sample image based on the number of tools required for the sample to obtain a nearest edge point, and obtaining a target tool ratio based on the number of tools required for the sample and the nearest edge point;

[0009] Calculate the maximum score of the sample based on the ratio of the nearest edge point to the target tool, and determine the target tool width and the target filter width based on the maximum score of the sample;

[0010] A target edge detection threshold, a target fitting error threshold, and a target tool quantity are calculated based on the target straight line, the target tool width, and the target filter width.

[0011] In a second aspect, the present application provides a geometric search tool parameter adaptive device, comprising:

[0012] A quantity calculation module, used to obtain the number of tools required for the sample based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes the tool width and the filter width;

[0013] A ratio calculation module, used for processing the sample image based on the number of tools required for the sample to obtain the nearest edge point, and obtaining the target tool ratio based on the number of tools required for the sample and the nearest edge point;

[0014] A parameter determination module, used for calculating a maximum sample score based on the ratio of the nearest edge point to the target tool, and determining a target tool width and a target filter width based on the maximum sample score;

[0015] A parameter calculation module is used to calculate a target edge detection threshold, a target fitting error threshold and the number of target tools based on the target straight line, the target tool width and the target filter width.

[0016] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method when executing the computer program.

[0017] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.

[0018] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps in the above method.

[0019] The above-mentioned geometric search tool parameter adaptive method, device, computer equipment, computer-readable storage medium and computer program product obtain the number of tools required for the sample based on the target straight line set by the user on the sample image and the obtained width parameter combination, and the width parameter combination includes tool width and filter width; based on the number of tools required for the sample, the sample image is processed to obtain the nearest edge point, and based on the number of tools required for the sample and the nearest edge point, the target tool ratio is obtained; based on the nearest edge point and the target tool ratio, the sample maximum score is calculated, and the target tool width and target filter width are determined based on the sample maximum score; based on the target straight line, the target tool width and the target filter width are determined. The target edge detection threshold, target fitting error threshold and target tool quantity are calculated based on the target tool width and the target filter width; through the above implementation, the user only needs to mark the target straight line on the sample image, and then the tool parameters of the set search tool including the target tool width, target filter width, target edge detection threshold, target fitting error threshold and target tool quantity can be adaptively calculated according to the target straight line marked by the user. Marking the target straight line on the sample image does not require the user to have a deep understanding of the working principles and setting results of each parameter, or to undergo a long period of training. This can reduce the technical threshold and user training cost of setting geometric search tool parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 An application environment diagram of a geometric search tool parameter adaptation method provided in an embodiment of the present application;

[0021] Figure 2 A schematic diagram of a flow chart of a parameter adaptation method of a geometric search tool provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of extracting edge points using a geometric search tool provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of a process of processing a sample image to generate a peak response point by a geometric search tool provided in an embodiment of the present application;

[0024] Figure 5 A structural block diagram of a parameter adaptive device for a geometric search tool provided in an embodiment of the present application;

[0025] Figure 6 An internal structure diagram of a computer device provided in an embodiment of the present application;

[0026] Figure 7 An internal structure diagram of another computer device provided in an embodiment of the present application;

[0027] Figure 8An internal structure diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0029] The geometric search tool parameter adaptive method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through a communication network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0030] like Figure 2 As shown, the embodiment of the present application provides a method for geometric search tool parameter adaptation, which is applied to Figure 1 The terminal 102 or the server 104 in the example is used for explanation. It is understandable that the computer device may include at least one of the terminal and the server. The method comprises the following steps:

[0031] S110. Obtaining the number of tools required for the sample based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes a tool width and a filter width.

[0032] The sample images are stored in a preset multi-sample database, which stores multiple sample images. For example, the sample images are as follows: Figure 3 The target straight line is a straight line set by the user on the sample image. For example, the target straight line is as follows: Figure 3 The green straight line in the figure; the geometric search tool in this embodiment is specifically a caliper tool (a straight line search tool). The caliper tool is used to extract edge points from an image in a machine vision task. In other embodiments, the geometric search tool may also be a circle search tool, an ellipse search tool, and a corner point search tool, etc., and the geometric search tool is not specifically limited.

[0033] In order to enable the geometric search tool to extract accurate edge points, it is necessary to set the tool parameters of the geometric search tool. In this embodiment, the tool parameters to be set include at least tool width, tool length, filter width, edge detection threshold, edge polarity, edge selection strategy, tool quantity and fitting error threshold; when extracting edge points from the same image, multiple geometric search tools need to work simultaneously, such as Figure 3 The multiple blue rectangles shown are the regions of interest (ROI) corresponding to each geometric search tool. Taking the first blue rectangle as an example, the length of the rectangle side where the yellow arrow is located is the tool width, the length of the rectangle side where the blue arrow is located is the tool length, and the yellow "×"-shaped point on the target straight line is an extracted edge point; in the process of extracting edge points, a smoothing filter is required, and the filter width is the filter kernel size of the smoothing filter; taking one of the geometric search tools as an example, the geometric search tool can extract multiple edge points, and the edge detection threshold is used to compare with the response amplitude of multiple edge points to obtain candidate edge points; taking one of the geometric search tools as an example, refer to Figure 3 , the direction of the blue arrow is the search direction of the geometric search tool, the edge polarity is used to characterize the brightness change of the image along the search direction, first from light to dark, and then from dark to light; the edge selection strategy is used to process multiple candidate edge points, so that the geometric search tool outputs one of the candidate edge points as the target edge point; the number of tools is used to characterize the number of geometric search tools; the fitting error threshold is used to determine whether the edge point initially extracted by the geometric search tool is an outlier.

[0034] It should be noted that among the above eight tool parameters, the tool length, edge polarity and edge selection strategy are relatively simple to set, especially the edge polarity and edge selection strategy have only a few options when setting. Therefore, in this embodiment, the tool length, edge polarity and edge selection strategy only require simple settings by the user, and the remaining five tool parameters, namely tool width, filter width, edge detection threshold, number of tools and fitting error threshold, need to be determined by the geometric search tool parameter adaptive method provided in this embodiment; in other embodiments, the tool length, edge polarity and edge selection strategy can also be determined by the corresponding parameter adaptive method, without specific limitation.

[0035] It should be noted that the present embodiment has a preset grid interval, and the grid interval stores multiple values ​​of the tool width and multiple values ​​of the filter width, that is, the grid interval stores multiple preset tool widths and filter widths; by traversing the grid interval, multiple groups of tool widths cw and filter widths b can be obtained, and the width parameter combination is one of the groups of tool widths cw and filter widths b; the present embodiment adopts the above-mentioned grid search process to obtain the tool width cw and filter width b, and in other embodiments, the heuristic search method can also be used to obtain the tool width cw and filter width b, which is not specifically limited; the number of tools required for the sample is also the number of tools that should be The optimal number of geometric search tools when the geometric search tools combined with the width parameter are applied to the current sample image; it should be noted that the number of tools required for the sample is related to the length of the target straight line. Generally, the longer the length of the target straight line, the larger the number of tools required for the sample. However, when the number of tools required for the sample is larger, the response time of the geometric search tool to extract edge points will also increase. Therefore, the number of tools required for the sample should not be too large. In this embodiment, the following calculation formula for the number of tools required for the sample is set based on historical experience to ensure that the optimal number of geometric search tools is obtained, wherein the calculation formula for the number of tools required for the sample is as follows:

[0036] M = L / cw;

[0037] Among them, M is the number of tools required for the sample, L is the target straight line length, and cw is the tool width in the width parameter combination.

[0038] Specifically, the length of the target straight line set by the user in the sample image is detected to obtain the target straight line length L; all width parameter combinations are traversed from the grid interval, and one set of width parameter combinations is taken as an example. The width parameter group includes the tool width cw and the filter width b, and the ratio of the target straight line length L to the tool width cw is calculated to obtain the number of tools required for the sample.

[0039] S120, processing the sample image based on the number of tools required for the sample to obtain a nearest edge point, and obtaining a target tool ratio based on the number of tools required for the sample and the nearest edge point.

[0040] Among them, according to the number of tools required for the sample, the number of geometric search tools required for the sample can be configured. Each geometric search tool can obtain a corresponding set of candidate edge points by processing the same sample image. Taking one set of candidate edge points as an example, the distance from each candidate edge point in the set of candidate edge points to the target straight line is calculated, and the candidate edge point corresponding to the smallest distance is also the nearest edge point; each geometric search tool has its corresponding nearest edge point; the target tool ratio R can be calculated through the number of tools required for the sample M and the nearest edge points corresponding to each geometric search tool M , target tool ratio R MThat is, the proportion of geometric search tools with better edge point extraction to all geometric search tools; wherein, the above-mentioned edge selection strategy is used to further determine whether the nearest edge point is preferentially selected as the target edge point. If so, the geometric search tool corresponding to the nearest edge point is also the geometric search tool with better edge point extraction.

[0041] Specifically, multiple geometric search tools corresponding in number to the number of geometric search tools are configured. Taking one of the geometric search tools as an example, multiple edge points obtained by processing a sample image with the geometric search tool are obtained, and the distance from each edge point to the target straight line on the sample image is calculated, and the edge point corresponding to the smallest distance is taken as the nearest edge point; further, the target tool ratio R is calculated by the number of tools required for the sample and the nearest edge point corresponding to each geometric search tool. M .

[0042] S130, calculating a maximum sample score based on the ratio of the nearest edge point to the target tool, and determining a target tool width and a target filter width based on the maximum sample score.

[0043] Among them, multiple width parameter combinations can be traversed through the grid interval. Taking one of the width parameter combinations as an example, the geometric search tool using the width parameter combination can process each sample image in the multi-sample database. The corresponding score can be calculated based on the situation of the geometric search tool processing each sample image in the multi-sample database. The score corresponds to the width parameter combination exemplified above, that is, each width parameter combination has its corresponding score, and the score with the largest value is also the maximum score of the sample; the target tool width and the target filter width are the tool width and filter width in the width parameter combination corresponding to the maximum score of the sample.

[0044] Specifically, taking a traversed width parameter combination as an example, the corresponding score when the geometric search tool using the width parameter combination is used to process each sample image in the multi-sample database is calculated, so as to obtain the score corresponding to each width parameter combination, and then the score with the largest value is used as the maximum score of the sample; further, the width parameter combination corresponding to the maximum score of the sample is determined, and the tool width and filter width in the width parameter combination are used as the target tool width and target filter width.

[0045] S140, calculating a target edge detection threshold, a target fitting error threshold, and the number of target tools based on the target straight line, the target tool width, and the target filter width.

[0046] Among them, the corresponding edge detection threshold and fitting error threshold can be calculated according to the target tool width and the target filter width, which are respectively recorded as the target edge detection threshold and the target fitting error threshold; the length of the target straight line set by the user in each sample image is the target straight line length L, and the corresponding number of tools can be calculated according to the target straight line length L and the target tool width, which is recorded as the target tool number.

[0047] Specifically, according to the target tool width and the target filter width, the edge detection threshold and the fitting error threshold corresponding to the target tool width and the target filter width are calculated to obtain the target edge detection threshold and the target fitting error threshold; the corresponding number of tools is also calculated through the target straight line length L and the target tool width to obtain the target number of tools.

[0048] It can be seen that in the embodiment of the present application, the number of tools required for the sample is obtained based on the target straight line set by the user on the sample image and the obtained width parameter combination, and the width parameter combination includes tool width and filter width; the sample image is processed based on the number of tools required for the sample to obtain the nearest edge point, and the target tool ratio is obtained based on the number of tools required for the sample and the nearest edge point; the sample maximum score is calculated based on the nearest edge point and the target tool ratio, and the target tool width and target filter width are determined based on the sample maximum score; the target edge detection threshold, target fitting error threshold and target tool number are calculated based on the target straight line, the target tool width and the target filter width; through the above implementation, the user only needs to mark the target straight line on the sample image, and then the tool parameters of the set search tool including the target tool width, target filter width, target edge detection threshold, target fitting error threshold and target tool number can be adaptively calculated according to the target straight line marked by the user. Marking the target straight line on the sample image does not require the user to have a deep understanding of the working principle and setting results of each parameter, or to undergo a long period of training, which can reduce the technical threshold and user training cost of setting geometric search tool parameters.

[0049] In some embodiments, the processing of the sample image based on the number of tools required for the sample to obtain the nearest edge point includes:

[0050] S121. Generate geometric search tools corresponding to the number of tools required for the sample, and process the sample image based on the geometric search tools to obtain candidate edge points.

[0051] Among them, the number of tools required for the sample is used to configure the corresponding number of geometric search tools. Taking one of the geometric search tools as an example, a certain number of edge points can be obtained by performing preliminary processing on a sample image through the geometric search tool, and further, a number of candidate edge points can be screened out from the edge points according to preset screening conditions.

[0052] Specifically, a number of geometric search tools corresponding to the number of tools required for the sample is configured, thereby obtaining multiple geometric search tools. Taking one of the geometric search tools as an example, a sample image is processed by the geometric search tool to obtain a certain number of edge points. Further, a number of candidate edge points are screened out from the certain number of edge points according to preset screening conditions.

[0053] S122: Calculate a first distance between the candidate edge point and the target straight line, and determine a nearest edge point from the candidate edge points based on the first distance.

[0054] The first distance is the distance between the candidate edge point and the target straight line, and the nearest edge point is the candidate edge point with the smallest corresponding first distance.

[0055] Specifically, the distance between each candidate edge point and the target straight line on the sample image is calculated to obtain a first distance corresponding to each candidate edge point. Further, the minimum first distance is determined, and the candidate edge point corresponding to the minimum first distance is also determined, and the candidate edge point is determined as the nearest edge point.

[0056] It can be seen that in this embodiment, by processing the same sample image through multiple geometric search tools, a group of candidate edge points corresponding to each geometric search tool can be calculated. Furthermore, the nearest edge point can be determined based on the distance between each candidate edge point and the target straight line; by generating the nearest edge point, it is convenient to subsequently calculate the target tool ratio and the maximum sample score.

[0057] In some embodiments, the step of processing the sample image based on the geometric search tool to obtain candidate edge points includes:

[0058] S121A. Based on the geometric search tool, reduce the dimension of the sample image to obtain a low-dimensional pixel sequence, and process the low-dimensional pixel sequence based on a smoothing filter kernel corresponding to the filter width to obtain a filtered pixel sequence.

[0059] Among them, dimension reduction, that is, the geometric search tool, reduces the corresponding area of ​​interest on the sample image from a two-dimensional image to Figure 4 The one-dimensional projection image shown in FIG. 1 is used to calculate the pixel value corresponding to each pixel point of the one-dimensional projection image. The low-dimensional pixel sequence is also the pixel value corresponding to each pixel point of the one-dimensional projection image. For example, the low-dimensional pixel sequence is as follows: Figure 4 As shown; the filter width in the width parameter combination is used to characterize the size of the one-dimensional Gaussian filter kernel. The corresponding smoothing filter kernel (i.e., the one-dimensional Gaussian filter kernel) can be determined by the filter width. The smoothing filter kernel is as follows Figure 4As shown, the smoothing filter kernel is used to smooth the low-dimensional pixel sequence. The filtered pixel sequence is also the low-dimensional pixel sequence that completes the smoothing filter. The filtered pixel sequence is as follows Figure 4 shown.

[0060] Specifically, taking a geometric search tool as an example, the geometric search tool reduces the dimension of the area of ​​interest corresponding to the sample image from a two-dimensional image to a one-dimensional projection image, and then calculates the pixel value of each pixel point of the one-dimensional projection image to obtain a low-dimensional pixel sequence; further, a smoothing filter kernel corresponding to the filter width in the width parameter combination is obtained, and the low-dimensional pixel sequence is smoothed and filtered by the smoothing filter kernel to obtain a filtered pixel sequence.

[0061] S121B: Generate a filtered curve based on the filtered pixel sequence, and obtain the candidate edge point based on the filtered curve.

[0062] Among them, the filtered pixel sequence includes the filtered pixel values ​​corresponding to each pixel point in the one-dimensional projection image. The corresponding function curve can be generated by the filtered pixel values ​​corresponding to each pixel point. The function curve is also the filtered curve. The positive and negative peaks of the filtered curve are peak response points. The pixel points corresponding to the peak response points in the sample image are also the edge points extracted by the geometric search tool, which are recorded as primary edge points. It should be noted that the edge detection threshold tool parameter of the geometric search tool is used to screen out candidate edge points from primary edge points. If the response amplitude of the primary edge point is greater than the edge detection threshold, the primary edge point is screened as a candidate edge point.

[0063] Specifically, a corresponding filtered curve is generated according to each filtered pixel value in the filtered pixel sequence, and then the positive and negative peaks of the filtered curve are determined to obtain the peak response points, and the pixel points corresponding to each peak response point in the sample image are determined, thereby obtaining the primary edge points; further, it is determined whether the primary edge points are greater than the edge detection threshold of the geometric search tool, and the primary edge points greater than the edge detection threshold are used as candidate edge points.

[0064] It can be seen that in this embodiment, the geometric search tool can accurately determine candidate sample points from the sample image by performing dimensionality reduction, smoothing filtering, and curve generation on the sample image in sequence, and the candidate sample points are used to facilitate subsequent calculation of accurate nearest edge points.

[0065] In some embodiments, obtaining a target tool ratio based on the number of tools required for the sample and the nearest edge point includes:

[0066] S123. Determine whether the nearest edge point is a target edge point based on a preset edge selection strategy to obtain a determination result, and determine the number of target tools based on the determination result.

[0067] Among them, the edge selection strategy is an initialized tool parameter of the geometric search tool. The edge selection strategy is used to determine whether the nearest edge point corresponding to each geometric search tool is a priority selected edge point. If so, the nearest edge point is used as the target edge point; each geometric search tool has a corresponding nearest edge point, and each geometric search tool has a corresponding judgment result. The judgment result includes two situations: first, the nearest edge point corresponding to the geometric search tool is the priority selected edge point, and second, the nearest edge point corresponding to the geometric search tool is not the priority selected edge point; the number of target tools M r That is, the number of judgment results belonging to the first case mentioned above.

[0068] Specifically, according to the preset edge selection strategy, it is determined whether the nearest edge point corresponding to each geometric search tool is the edge point that is selected first, so as to obtain a judgment result corresponding to each geometric search tool one by one, and then the judgment result is the number of the nearest edge points corresponding to the geometric search tool that are the edge points that are selected first, so as to obtain the number of target tools.

[0069] S124. Calculate a target tool ratio based on the number of tools required for the sample and the number of target tools.

[0070] Among them, the target tool ratio R M is the target tool quantity M r The ratio of the number of tools M required for the sample, that is, R M =M r / M.

[0071] Specifically, calculate the number of target tools M r The ratio of the number of tools required for the sample M is the target tool ratio R M .

[0072] It can be seen that in this embodiment, by calculating the target tool ratio R M The proportion of geometric search tools that can output target edge points among all geometric search tools can be clearly determined; the target tool proportion R M It is also convenient for further calculation of the maximum sample score.

[0073] In some embodiments, the calculating the maximum score of the sample based on the ratio of the nearest edge point to the target tool includes:

[0074] S131. Calculate a second distance between the nearest edge point and the target straight line, and calculate an average distance based on the second distance.

[0075] Each geometric search tool has its corresponding nearest edge point, and the second distance D mThat is, the distance from the nearest edge point on the sample image to the target line. The corresponding second distance can be calculated through each nearest edge point. The average distance D avg That is, the mean of the second distances corresponding to the nearest edge points, the average distance D avg The calculation formula is as follows:

[0076]

[0077] Specifically, the distance from the nearest edge point corresponding to each geometric search tool on the template image to the corresponding target straight line on the sample image is calculated, thereby obtaining a second distance corresponding to each nearest edge point; further, the mean of the second distances corresponding to each nearest edge point is calculated to obtain an average distance.

[0078] S132: Calculate a single sample score corresponding to each of the sample images based on the average distance and the target tool ratio.

[0079] Taking a width parameter combination as an example, the single sample score is the score of a sample image processed by the geometric search tool using the width parameter combination. The single sample score S k According to the average distance D avg Ratio to target tool R M The calculation shows that the single sample score S k The calculation formula is as follows:

[0080]

[0081] Among them, 30 is the preset experience value.

[0082] Specifically, the average distance D avg Ratio to target tool M Substitute into the preset single sample score S k The calculation formula is used to calculate the single sample score S k .

[0083] S133: Determine the maximum sample score based on the single sample score.

[0084] Among them, through the single sample score S k The score of all sample images in the multi-sample database processed by the geometric search tool can be further calculated, that is, the overall sample score S ij , the overall sample score S ij The calculation formula is as follows:

[0085]

[0086] Among them, the tool width in the i-th width combination is the i-th tool width traversed from the grid space, and the filter width in the j-th width combination is the j-th filter traversed from the grid space; K is the total number of sample images in the multi-sample database; the maximum sample score S max Score S for each overall sample ij The overall sample score S with the largest value ij . Sample maximum score S max The corresponding tool width and filter width are also the target tool width and target filter width.

[0087] Specifically, the single sample score S k Substitute into the overall sample score S ij The calculation formula is used to calculate the overall sample score S ij .

[0088] It can be seen that in this embodiment, the overall sample score S corresponding to each width parameter combination can be calculated through the above steps. ij Since multiple width parameter combinations can be obtained by traversing the grid space, the overall sample score S corresponding to each width parameter combination can be calculated through the above steps. ij ; By obtaining the overall sample score S corresponding to each width parameter combination ij This facilitates the subsequent determination of the five tool parameters ultimately required for the geometry search tool, namely: tool width, filter width, edge detection threshold, number of tools, and fitting error threshold.

[0089] In some embodiments, the calculating of the target edge detection threshold, the target fitting error threshold and the number of target tools based on the target straight line, the target tool width and the target filter width includes:

[0090] S141, determining the nearest edge point group obtained by processing each sample image with a geometric search tool having the target tool width and the target filter width.

[0091] Among them, the geometric search tool using the target tool width and the target filter width can obtain the nearest edge point corresponding to each sample image by processing each sample image in the multi-sample database; the nearest edge point group is the nearest edge point corresponding to all sample images in the multi-sample database.

[0092] Specifically, taking a width parameter combination as an example, the width parameter combination includes the i-th tool width and the j-th filter width traversed from the grid space; all sample images in a multi-sample database are processed by using a geometric search tool of the target tool width and the target filter width in the width parameter combination to obtain the nearest edge points corresponding to all sample images, and the nearest edge points corresponding to all the obtained sample images are recorded as a nearest edge point group.

[0093] S142: Calculate a target edge detection threshold and a target fitting error threshold based on the nearest edge point group.

[0094] Among them, through further calculation of the nearest edge point group, the target edge detection threshold and target fitting error threshold of the geometric search tool can be obtained. The target edge detection threshold is the edge detection threshold among the five tool parameters that the geometric search tool must ultimately determine, and the target fitting error threshold is the fitting error threshold among the five tool parameters that the geometric search tool must ultimately determine.

[0095] Specifically, further calculation is performed on the nearest edge point group to obtain a target edge detection threshold and a target fitting error threshold.

[0096] S143. Calculate the number of target tools based on the target straight line and the target tool width.

[0097] The length of the target straight line is also the target straight line length L, and the target tool width is recorded as cw a , the target tool quantity is recorded as M a , and the number of target tools is the target straight line length L and the target tool width cw a The ratio of M a =L / cw a .

[0098] Specifically, calculate the target straight line length L and the target tool width cw a The ratio of , thus obtaining the target tool quantity M a .

[0099] It can be seen that in this embodiment, the nearest edge point group can not only calculate the target edge detection threshold and the target fitting error threshold, but also calculate the number of target tools M a Thus, by combining the target tool width and the target filter width that have been determined above, the five tool parameters that the geometric search tool will ultimately determine can be determined.

[0100] In some embodiments, the calculating the target edge detection threshold and the target fitting error threshold based on the nearest edge point group includes:

[0101] S142A, calculating the gradient response amplitude corresponding to each nearest edge point in the nearest edge point group to obtain an amplitude group, and calculating the target edge detection threshold based on the amplitude group;

[0102] Among them, the gradient response amplitude is the gradient response amplitude of the corresponding nearest edge point, which can be calculated by the corresponding gradient response amplitude calculation formula and the nearest edge point. The amplitude group is the set of gradient response amplitudes corresponding to each nearest edge point in the nearest edge point group; the target edge detection threshold Td * The calculation formula is as follows:

[0103] Td * =A avg -3*A std ;

[0104] Among them, A avg is the mean value of each gradient response amplitude in the amplitude group, A std is the variance of the amplitude of each gradient response in the amplitude group.

[0105] Specifically, the gradient response amplitude corresponding to each nearest edge point in the nearest edge point group is calculated, and the gradient response amplitudes are combined to obtain an amplitude group. Further, the mean value A of the gradient response amplitudes in the amplitude group is calculated. avg , and the variance A of each gradient response amplitude std ; Then, A avg With A std Substitute into the target edge detection threshold Td * The target edge detection threshold Td is obtained by calculating the calculation formula * .

[0106] S142B, calculating the third distance from each nearest edge point in the nearest edge point group to the target straight line to obtain a distance group, and calculating a target fitting error threshold based on the distance group.

[0107] Among them, the third distance is the distance from each nearest edge point in the nearest edge point group to the target straight line, and the distance group is a collection of the third distances; the target fitting error threshold Tf * The calculation formula is as follows:

[0108] Tf * =D avg +3*D std ;

[0109] Among them, D avg is the mean of the third distances in the distance group, D std is the variance of each third distance in the distance group.

[0110] Specifically, the third distance from each nearest edge point in the nearest edge point group to the target line is calculated, and each third distance is collected to obtain a distance group; further, the mean value D of each third distance in the distance group is calculated. avg , and the variance D of each third distance in the distance group std ; Then, D avg With D std Substitute into the target fitting error threshold Tf * The calculation formula is used to calculate the target fitting error threshold Tf * .

[0111] It can be seen that in this embodiment, the target edge detection threshold Td can be calculated based on the nearest edge point group. * The error threshold Tf with the target fitting * , so that the target edge detection threshold Td * The error threshold Tf with the target fitting * Combine the target tool width, target filter width and target tool number M a Get the five tool parameters that the geometry search tool will ultimately determine.

[0112] It should be understood that, although the steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0113] In one embodiment,

[0114] Based on the same inventive concept, the embodiment of the present application also provides a geometric search tool parameter self-adaptation device. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more geometric search tool parameter self-adaptation device embodiments provided below can refer to the limitations of the geometric search tool parameter self-adaptation method above, and will not be repeated here.

[0115] like Figure 5 As shown, the embodiment of the present application provides a geometric search tool parameter adaptive device 200, including:

[0116] A quantity calculation module 210 is used to obtain the number of tools required for the sample based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes the tool width and the filter width;

[0117] A ratio calculation module 220, configured to process the sample image based on the number of tools required for the sample to obtain a nearest edge point, and obtain a target tool ratio based on the number of tools required for the sample and the nearest edge point;

[0118] A parameter determination module 230, configured to calculate a maximum sample score based on the ratio of the nearest edge point to the target tool, and determine a target tool width and a target filter width based on the maximum sample score;

[0119] The parameter calculation module 240 is used to calculate a target edge detection threshold, a target fitting error threshold and a target tool quantity based on the target straight line, the target tool width and the target filter width.

[0120] In some embodiments, the proportion calculation module 220 is specifically used to: generate a geometric search tool corresponding to the number of tools required for the sample, and process the sample image based on the geometric search tool to obtain candidate edge points; calculate a first distance between the candidate edge point and the target straight line, and determine the nearest edge point from the candidate edge points based on the first distance.

[0121] In some embodiments, processing the sample image based on the geometric search tool to obtain candidate edge points includes: reducing the dimension of the sample image based on the geometric search tool to obtain a low-dimensional pixel sequence, processing the low-dimensional pixel sequence based on a smoothing filter kernel corresponding to the filter width to obtain a filtered pixel sequence; generating a filtered curve based on the filtered pixel sequence, and obtaining the candidate edge points based on the filtered curve.

[0122] In some embodiments, the ratio calculation module 220 is also specifically used to: determine whether the nearest edge point is the target edge point based on a preset edge selection strategy to obtain a judgment result, and determine the number of target tools based on the judgment result; calculate the target tool ratio based on the number of tools required for the sample and the number of target tools.

[0123] In some embodiments, the parameter determination module 230 is specifically used to: calculate the second distance between the nearest edge point and the target straight line, and calculate the average distance based on the second distance; calculate the single sample score corresponding to each of the sample images based on the average distance and the target tool ratio; and determine the sample maximum score based on the single sample score.

[0124] In some embodiments, the parameter calculation module 240 is specifically used to: determine the nearest edge point group obtained by processing each sample image with a geometric search tool using the target tool width and the target filter width; calculate the target edge detection threshold and the target fitting error threshold based on the nearest edge point group; calculate the number of target tools based on the target straight line and the target tool width.

[0125] In some embodiments, the calculation of the target edge detection threshold and the target fitting error threshold based on the nearest edge point group includes: calculating the gradient response amplitude corresponding to each nearest edge point in the nearest edge point group to obtain an amplitude group, and calculating the target edge detection threshold based on the amplitude group; calculating the third distance from each nearest edge point in the nearest edge point group to the target straight line to obtain a distance group, and calculating the target fitting error threshold based on the distance group.

[0126] Each module in the above-mentioned geometry search tool parameter adaptive device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0127] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the above-mentioned geometric search tool parameter adaptation method are implemented.

[0128] In some embodiments, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, the steps in the above-mentioned geometric search tool parameter adaptation method are implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen; the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0129] Those skilled in the art will understand that Figure 6 or Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] In some embodiments, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps in the above method embodiments are implemented.

[0131] In some embodiments, Figure 8 The figure shows an internal structure diagram of a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0132] In some embodiments, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0134] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0135] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0136] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for geometric search tool parameter adaptation, characterized in that: include: The number of tools required for the sample is obtained based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes the tool width and the filter width; Processing the sample image based on the number of tools required for the sample to obtain a nearest edge point, and obtaining a target tool ratio based on the number of tools required for the sample and the nearest edge point; Calculate the maximum score of the sample based on the ratio of the nearest edge point to the target tool, and determine the target tool width and the target filter width based on the maximum score of the sample; A target edge detection threshold, a target fitting error threshold, and a target tool quantity are calculated based on the target straight line, the target tool width, and the target filter width.

2. The method according to claim 1, characterized in that: include: The step of processing the sample image based on the number of tools required for the sample to obtain the nearest edge point includes: Generate geometric search tools corresponding to the number of tools required for the sample, and process the sample image based on the geometric search tools to obtain candidate edge points; A first distance between the candidate edge point and the target straight line is calculated, and a nearest edge point is determined from the candidate edge points based on the first distance.

3. The method according to claim 2, characterized in that The step of processing the sample image based on the geometric search tool to obtain candidate edge points includes: Based on the geometric search tool, the sample image is reduced in dimension to obtain a low-dimensional pixel sequence, and based on the smoothing filter kernel corresponding to the filter width, the low-dimensional pixel sequence is processed to obtain a filtered pixel sequence; A filtered curve is generated based on the filtered pixel sequence, and the candidate edge point is obtained based on the filtered curve.

4. The method according to claim 1, characterized in that: include: The method of obtaining a target tool ratio based on the number of tools required for the sample and the nearest edge point includes: Determine whether the nearest edge point is a target edge point based on a preset edge selection strategy to obtain a determination result, and determine the number of target tools based on the determination result; A target tool ratio is calculated based on the sample required tool quantity and the target tool quantity.

5. The method according to claim 1, characterized in that The calculating the maximum score of the sample based on the ratio of the nearest edge point to the target tool comprises: Calculating a second distance between the nearest edge point and the target straight line, and calculating an average distance based on the second distance; Calculate a single sample score corresponding to each of the sample images based on the average distance and the target tool ratio; The sample maximum score is determined based on the single sample score.

6. The method according to claim 1, characterized in that The calculating of the target edge detection threshold, the target fitting error threshold and the number of target tools based on the target straight line, the target tool width and the target filter width includes: Determine the nearest edge point group obtained by processing each sample image with a geometric search tool using the target tool width and the target filter width; Calculate a target edge detection threshold and a target fitting error threshold based on the nearest edge point group; The target tool quantity is calculated based on the target straight line and the target tool width.

7. The method according to claim 6, characterized in that The calculating the target edge detection threshold and the target fitting error threshold based on the nearest edge point group includes: Calculating the gradient response amplitude corresponding to each nearest edge point in the nearest edge point group to obtain an amplitude group, and calculating the target edge detection threshold based on the amplitude group; A third distance from each nearest edge point in the nearest edge point group to the target straight line is calculated to obtain a distance group, and a target fitting error threshold is calculated based on the distance group.

8. A geometric search tool parameter adaptive device, characterized in that: include: A quantity calculation module, used to obtain the number of tools required for the sample based on the target straight line set by the user on the sample image and the acquired width parameter combination, wherein the width parameter combination includes the tool width and the filter width; A ratio calculation module, used for processing the sample image based on the number of tools required for the sample to obtain the nearest edge point, and obtaining the target tool ratio based on the number of tools required for the sample and the nearest edge point; A parameter determination module, configured to calculate a maximum sample score based on the ratio of the nearest edge point to the target tool, and determine a target tool width and a target filter width based on the maximum sample score; A parameter calculation module is used to calculate a target edge detection threshold, a target fitting error threshold and the number of target tools based on the target straight line, the target tool width and the target filter width.

9. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.