Distance detection method and system for non-smooth edges

By identifying edge points, calculating distances and eliminating outliers, the problem of low efficiency and high computational cost in non-smooth edge distance detection is solved, and efficient and accurate distance detection is achieved.

CN113989489BActive Publication Date: 2024-09-24GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111234069.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2024-09-24
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

The existing technology has low efficiency and high computational cost in distance detection of non-smooth edges, and cannot operate efficiently, especially when dealing with distance detection of mutation positions.

Method used

By identifying the edge points of the area to be detected, calculating the distance between edge point pairs, eliminating outliers, determining the distance between edges based on the remaining distance, and using the mean square error to filter out mutation areas, it improves detection efficiency and accuracy.

Benefits of technology

It achieves the high efficiency of non-smooth edge distance detection, reduces the computing cost, eliminates the impact of mutation areas on distance detection, and makes the measurement results more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113989489B
    Figure CN113989489B
Patent Text Reader

Abstract

This invention discloses a method and system for distance detection of non-smooth edges, which solves the technical problems of low efficiency and high computational cost in existing distance detection schemes for non-smooth edges. The method includes: identifying the edges of the region to be detected according to a preset detection direction to obtain multiple edge points; marking every two edge points parallel to the preset detection direction as a pair of edge points; calculating the distance between the two edge points in each pair of edge points to obtain a set of edge point distances; removing the distances of outliers from the set of edge point distances; and determining the distance between the identified edges based on the remaining distances in the set of edge point distances.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for detecting distance of a non-smooth edge. Background Art

[0002] With the continuous development and innovation of artificial intelligence, the rational application of artificial intelligence technology has a great impact on the production capacity of industrial production lines. In particular, the image processing branch of artificial intelligence is relatively mature, and the production line tooling, industrial cameras and supporting software algorithms can effectively solve most inspection tasks.

[0003] However, during the research process, the inventors found that the existing technology is not ideal when performing distance detection on the non-smooth edges of a detection area in an image. It is necessary to use multiple detection lines to perform multiple calculations on the detection area to obtain the average distance, which results in a high calculation cost. In addition, the distance detection for non-smooth edges requires dealing with the distances of certain mutation positions, and recording and detecting the distances of these mutation positions, which makes it impossible to efficiently operate the scheme of using detection lines to perform distance detection on non-smooth edges.

[0004] The prior art distance detection scheme for non-smooth edges has the technical problems of low efficiency and high computational cost, and currently no effective solution has been provided. Summary of the invention

[0005] The object of the present invention is to provide a method and system for detecting the distance of a non-smooth edge, which can solve the technical problems in the prior art of detecting the distance of a non-smooth edge pair, that is, the method has low efficiency and high computational cost.

[0006] One aspect of the present invention provides a distance detection method for non-smooth edges, the method comprising: identifying the edge of an area to be detected according to a preset detection direction to obtain a plurality of edge points; marking each two edge points parallel to the preset detection direction as a group of edge point pairs; calculating the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; eliminating distances belonging to outliers from the edge point distance set; and determining the distances between the identified edges based on the remaining distances in the edge point distance set.

[0007] Optionally, eliminating distances belonging to outliers from the edge point distance set includes: calculating a first mean square error of all distances in the edge point distance set; selecting a distance from the edge point distance set as a target distance; calculating a second mean square error of other distances in the edge point distance set except the target distance; judging whether the target distance belongs to an outlier based on the first mean square error and the second mean square error; if the target distance belongs to an outlier, eliminating the target distance from the edge point distance set.

[0008] Optionally, after determining whether the target distance belongs to an outlier based on the first mean square error and the second mean square error, the method further includes: if the target distance does not belong to an outlier, selecting another distance from the edge point distance set as the target distance; and continuing to determine whether the target distance belongs to an outlier until all distances belonging to outliers are eliminated from the edge point distance set.

[0009] Optionally, selecting a distance from the edge point distance set as the target distance includes: sorting the distances in the edge point distance set in order of distance size to obtain a standard distance set, wherein the standard distance set includes a first threshold side and a second threshold side, and the first threshold side and the second threshold side are different distance threshold sides; selecting a corresponding distance threshold from the first threshold side of the standard distance set as the target distance; if the target distance belongs to an outlier, excluding the target distance from the edge point distance set includes: if the target distance belongs to an outlier, excluding the target distance from the standard distance set.

[0010] Optionally, if the target distance does not belong to an outlier, selecting another distance from the edge point distance set as the target distance includes: if the target distance does not belong to an outlier, selecting a corresponding distance threshold from the second threshold side of the standard distance set as the target distance.

[0011] Optionally, after the target distance is removed from the standard distance set if the target distance belongs to an outlier, the method further includes: continuing to select a distance threshold from the first threshold side of the current standard distance set as the target distance, and determining whether the target distance belongs to an outlier; if so, removing the target distance from the current standard distance set; if not, selecting a corresponding distance threshold from the second threshold side as the target distance, and continuing to determine whether the target distance belongs to an outlier, until all distances belonging to outliers are removed from the standard distance set.

[0012] Optionally, judging whether the target distance is an outlier according to the first mean square error and the second mean square error includes: when the first mean square error is greater than the second mean square error, and the second mean square error is greater than a preset mean square error threshold, determining that the target distance is an outlier.

[0013] Another aspect of the present invention provides a non-smooth edge distance detection system, the system comprising: an industrial computer, used to identify the edge of a to-be-detected area according to a preset detection direction to obtain a plurality of edge points; mark every two edge points parallel to the preset detection direction as a group of edge point pairs; calculate the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; eliminate the distances belonging to outliers from the edge point distance set; and determine the distances between the identified edges based on the remaining distances in the edge point distance set.

[0014] Optionally, the system also includes: a motion controller, used to control the production line conveyor belt to transmit the object to be detected with non-smooth edges; an industrial camera, used to capture the image of the object to be detected and transmit the image to the industrial computer; the industrial computer is also used to: identify the area to be detected in the image.

[0015] Optionally, the industrial computer is further used to: control the light source controller to adjust the light source when the industrial camera captures images.

[0016] Another aspect of the present invention provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the non-smooth edge distance detection method described in any of the above embodiments when executing the computer program.

[0017] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for detecting the distance of a non-smooth edge described in any one of the above embodiments is implemented.

[0018] The non-smooth edge distance detection method provided by the present invention can realize the non-smooth edge distance detection through a single calculation result of edge detection, thereby improving the detection efficiency and reducing the operating cost. Moreover, by filtering out the distances belonging to outliers, the influence of the mutation area in the non-smooth edge on the distance detection is eliminated, so that the measurement result is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0020] Figure 1 A flow chart of a non-smooth edge distance detection method provided in Embodiment 1 of the present invention is shown;

[0021] Figure 2A schematic diagram of a distance detection solution for non-smooth edges provided by Embodiment 1 of the present invention is shown;

[0022] Figure 3A A schematic diagram of an image including an area to be detected provided by the first embodiment of the present invention is shown;

[0023] Figure 3B A schematic diagram of a region to be detected provided by Embodiment 1 of the present invention is shown;

[0024] Figure 4A A schematic diagram showing edge points of an area to be detected that are identified according to the first embodiment of the present invention is shown;

[0025] Figure 4B A schematic diagram showing edge points after outliers are filtered out provided in the first embodiment of the present invention;

[0026] Figure 5 A block diagram of a non-smooth edge distance detection system provided by a second embodiment of the present invention is shown;

[0027] Figure 6 A block diagram of a computer device suitable for implementing a distance detection method for non-smooth edges provided in a third embodiment of the present invention is shown. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0029] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0030] Embodiment 1

[0031] Figure 1 FIG. 4 is a flow chart of a method for detecting the distance of a non-smooth edge provided by Embodiment 1 of the present invention. Figure 1 As shown, the non-smooth edge distance detection method includes steps S1 to S5, wherein:

[0032] Step S1, identifying the edge of the area to be detected according to a preset detection direction to obtain multiple edge points.

[0033] This embodiment can collect an image of the object to be detected, perform preprocessing operations such as grayscale, projection, filtering, etc. on the image to remove random noise and features irrelevant to the detection requirements in the image, and then identify the ROI (Region Of Interest) area, that is, the area to be detected, from the preprocessed image. For details, see Figure 2 , wherein the image to be detected is the image collected above, the parameter adjustment can be the range of the input area to be detected, the preset detection direction and the relevant parameters of the preprocessing operation, etc., the edge line detection algorithm is the recognition logic for executing step S1, the recognition logic can be implemented by the existing technology, and this embodiment will not be repeated, and the specific logic of edge point distance calculation and result output is further implemented through subsequent steps S2 to S5. Among them, when preprocessing the image, the following Gaussian function can be used to perform filtering operation on the image:

[0034]

[0035] σ is the standard deviation. The size of σ determines the width of the Gaussian function. The larger σ is, the more obvious the smoothing effect is. e is a constant, and x is the value of a pixel in the image.

[0036] The preset detection direction is a direction perpendicular to the edge of the area to be detected and the distance to be detected. When the edge of the area to be detected is identified according to the preset detection direction, the points constituting the edge, i.e., the edge points, are actually identified. In addition, in this embodiment, there is at least one non-smooth edge in the edge of the area to be detected and the distance to be detected. For example, Figure 3A is the image of the motor, Figure 3B is the detection area of ​​the motor. When the distance between the two longitudinal edges of the detection area needs to be known, the preset detection direction can be set to the horizontal direction, and Figure 3B It can be seen that the two longitudinal edges are both non-smooth edges with a concave portion.

[0037] Step S2: Mark every two edge points parallel to the preset detection direction as a group of edge point pairs.

[0038] Step S3, calculating the distance between two edge points in each group of edge point pairs to obtain an edge point distance set.

[0039] The number of distances in the edge point distance set is equal to the number of marked edge point pairs.

[0040] Assume that the preset detection direction is horizontal, such as Figure 4AAs shown, edge point a1 and edge point b1 are a set of edge point pairs, and distance d1 is the distance between edge point a1 and edge point b1; edge point a2 and edge point b2 are a set of edge point pairs, and distance d2 is the distance between edge point a2 and edge point b2.

[0041] It should be noted that in order to improve efficiency, a data structure stored continuously in memory space can be used to associate and store edge point pairs and distances, so as to maximize the efficiency of subsequent sorting and retrieval of distances in the edge point distance set.

[0042] Step S4: remove the distances belonging to outliers from the edge point distance set.

[0043] The so-called outliers refer to mutation points, such as Figure 4A As shown in the figure, if you want to know the distance of the non-concave edge, the distance d1 is an outlier relative to the distance d2; if you want to know the distance of the concave edge, the distance d2 is an outlier relative to the distance d1. Taking the example of knowing the distance of the non-concave edge, after removing the distances belonging to the outliers in the edge point distance set, the remaining distances in the edge point distance set are only the distances of the non-concave edge. For details, please refer to Figure 4B .

[0044] Optionally, step S4 includes steps S41 to S45, wherein:

[0045] Step S41, calculating the first mean square error of all distances in the edge point distance set;

[0046] Step S42, selecting a distance from the edge point distance set as a target distance;

[0047] Step S43, calculating the second mean square error of other distances in the edge point distance set except the target distance;

[0048] Step S44, judging whether the target distance is an outlier according to the first mean square error and the second mean square error;

[0049] Step S45: if the target distance belongs to an outlier, remove the target distance from the edge point distance set.

[0050] When step S4 does not include step S45, step S4 may further include steps S46 to S47, wherein:

[0051] Step S46, if the target distance does not belong to an outlier, select another distance from the edge point distance set as the target distance;

[0052] Step S47, continue to determine whether the target distance belongs to an outlier, until all distances belonging to outliers are removed from the edge point distance set.

[0053] Among them, step S42 may include two solutions:

[0054] Solution 1: Randomly select a distance from the edge point distance set as the target distance.

[0055] Correspondingly, step S46 may also be to randomly select another distance from the edge point distance set as the target distance. However, if the first solution is used to remove outliers, the judgment logic needs to be executed once for each distance in the edge point distance set, which is too complicated and clumsy.

[0056] Solution 2: sort the edge point distance set in order of distance size, and start judging whether there is an outlier from any distance threshold side. If there is, continue judging whether there is still an outlier on that side until there is no outlier on that side, and then judge whether there is an outlier from another distance threshold side until there is no outlier on that side, and then stop judging. Using solution 2 can reduce the number of judgments and improve judgment speed and flexibility. Specifically: step S42 includes steps S421 to S422, where:

[0057] Step S421, sorting the distances in the edge point distance set in order of distance size to obtain a standard distance set, wherein the standard distance set includes a first threshold side and a second threshold side, and the first threshold side and the second threshold side are different distance threshold sides;

[0058] Step S422: Select a corresponding distance threshold from the first threshold side of the standard distance set as the target distance.

[0059] Correspondingly, step S45 specifically includes: if the target distance is an outlier, removing the target distance from the standard distance set.

[0060] Correspondingly, step S46 specifically includes: if the target distance does not belong to an outlier, selecting a corresponding distance threshold from the second threshold side of the standard distance set as the target distance.

[0061] The distance threshold may be the maximum distance or the minimum distance. If the first threshold side is the maximum distance side, the second threshold side is the minimum distance side, and the distance threshold corresponding to the first threshold side is the maximum distance, and the distance threshold corresponding to the second threshold side is the minimum distance; if the first threshold side is the minimum distance side, the second threshold side is the maximum distance side, and the distance threshold corresponding to the first threshold side is the minimum distance, and the distance threshold corresponding to the second threshold side is the maximum distance.

[0062] Accordingly, after removing the target distance from the standard distance set if the target distance belongs to an outlier, the method further includes:

[0063] Continue to select a distance threshold from the first threshold side of the current standard distance set as the target distance, and determine whether the target distance belongs to an outlier;

[0064] If so, remove the target distance from the current standard distance set;

[0065] If not, a corresponding distance threshold is selected from the second threshold side as the target distance, and the determination of whether the target distance belongs to an outlier is continued until all distances belonging to outliers are eliminated from the standard distance set.

[0066] For example, the standard distance set includes distance d1, distance d2, ..., distance dn, where distance d1 is the minimum distance, distance dn is the maximum distance, the first threshold side is the distance d1 side, and the second threshold side is the distance dn side; if the outlier is judged from the first threshold side, first judge whether distance d1 is an outlier, if so, remove distance d1, at this time distance d2 is the current minimum distance, continue to judge whether distance d2 is an outlier, until it is judged that distance di is not an outlier, then start to judge the outlier from the second threshold side, first judge whether distance dn is an outlier, if so, remove distance dn, at this time distance dn-1 is the current maximum distance, continue to judge whether distance dn-1 is an outlier, until it is judged that distance dn-j is not an outlier on the second threshold side, stop judging, at this time the remaining distances in the standard distance set and the edge point distance set are: distance di, distance di+1, ... distance dn-j. n is the total number of distances, 1 <i<j<n。

[0067] Optionally, step S44 includes: when the first mean square error is greater than the second mean square error, and the second mean square error is greater than a preset mean square error threshold, determining that the target distance is an outlier.

[0068] The preset mean square error threshold is used to remove edge point pairs and distances in the mutation area. For example, the edge of the identified area to be detected is Figure 4A , since the sudden change area, i.e. the sunken area, cannot be eliminated during recognition, but the user only needs to know the edge distance of the non-sunk area, the sunken area can be eliminated by setting a preset mean square error threshold, i.e., eliminating outliers, thereby achieving Figure 4B effect and improve detection accuracy.

[0069] Step S5: determining the distances between the identified edges according to the remaining distances in the edge point distance set.

[0070] The largest distance and / or the smallest distance may be selected from the remaining distances in the edge point distance set as the distance between the identified edges, or the average value of the remaining distances in the edge point distance set may be calculated as the distance between the identified edges.

[0071] The method provided in this embodiment has the following effects: 1. The distance of the corresponding edge point pairs is determined by the multiple edge points detected by edge detection, and the area with large mutation is filtered out by the mean square error, so that the maximum distance, the minimum distance and the average distance of the non-smooth edge can be output more accurately; 2. The distance measurement result of the non-smooth edge is more objective, and the final distance is output in combination with multiple conditions. Various edge point pairs that meet the distance requirements in the area to be detected can be calibrated, and different detection requirements can be met by adjusting the preset mean square error threshold. For example, by adjusting the preset mean square error threshold, only the distance of the non-concave area or only the distance of the concave area can be detected; 3. When determining the distance of the non-smooth edge by the mean square error filtering method, there is no need to perform multiple measurements for the edge case with large mutation, and the distance measurement result can be obtained by one algorithm operation, which can greatly reduce the calculation complexity and calculation time; 4. When applied to production lines with distance measurement requirements, the overall running efficiency of the software can be improved, thereby improving production efficiency.

[0072] Embodiment 2

[0073] Embodiment 2 of the present invention further provides a non-smooth edge distance detection system, which corresponds to part of the content of the above embodiment 1, and the corresponding technical features and technical effects are not described in detail in this embodiment, and the relevant parts can refer to the above embodiment 1. Specifically, Figure 5 FIG. 2 shows a block diagram of a non-smooth edge distance detection system provided by Embodiment 2 of the present invention. Figure 5 As shown, the non-smooth edge distance detection system may include:

[0074] The industrial computer 501 is used to identify the edge of the area to be detected according to a preset detection direction to obtain multiple edge points; mark every two edge points parallel to the preset detection direction as a group of edge point pairs; calculate the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; eliminate the distance belonging to the outlier from the edge point distance set; and determine the distance between the identified edges according to the remaining distances in the edge point distance set.

[0075] The minimum required hardware functions of the industrial computer 501 meet the software operation requirements, and the rest can be flexibly adjusted. Optionally, the system also includes: a motion controller 502, used to control the production line conveyor belt 503 to transmit the object to be detected 504 with non-smooth edges; an industrial camera 505, used to collect the image of the object to be detected 504, and transmit the image to the industrial computer 501; the industrial computer 501 is also used to: identify the area to be detected in the image.

[0076] Optionally, the industrial computer 501 is further used to: when the industrial camera 505 captures images, control the light source controller 506 to adjust the light source 507 to improve the image capture effect of the industrial camera 505 .

[0077] After the detection standard of the object to be detected is established through the above algorithm steps, the image transmitted by the industrial camera can be detected. In this embodiment, the purpose of overall control can be achieved through the industrial computer sending and receiving signals.

[0078] Optionally, when the industrial computer 501 executes the elimination of distances belonging to outliers from the edge point distance set, it is specifically used to: calculate a first mean square error of all distances in the edge point distance set; select a distance from the edge point distance set as a target distance; calculate a second mean square error of other distances in the edge point distance set except the target distance; determine whether the target distance belongs to an outlier based on the first mean square error and the second mean square error; if the target distance belongs to an outlier, eliminate the target distance from the edge point distance set.

[0079] Optionally, the industrial computer 501 is also used for: after executing the determination of whether the target distance belongs to an outlier based on the first mean square error and the second mean square error, if the target distance does not belong to an outlier, selecting another distance from the edge point distance set as the target distance; and continuing to determine whether the target distance belongs to an outlier until all distances belonging to outliers are eliminated from the edge point distance set.

[0080] Optionally, when the industrial computer 501 selects a distance from the edge point distance set as the target distance, it is specifically used to: sort the distances in the edge point distance set in order of distance size to obtain a standard distance set, wherein the standard distance set includes a first threshold side and a second threshold side, and the first threshold side and the second threshold side are different distance threshold sides; select a corresponding distance threshold from the first threshold side of the standard distance set as the target distance; when the industrial computer 501 executes if the target distance belongs to an outlier, remove the target distance from the edge point distance set, it is specifically used to: if the target distance belongs to an outlier, remove the target distance from the standard distance set.

[0081] Optionally, when the industrial computer 501 executes the step of selecting another distance from the edge point distance set as the target distance if the target distance does not belong to an outlier, it is specifically used to: if the target distance does not belong to an outlier, select a corresponding distance threshold from the second threshold side of the standard distance set as the target distance.

[0082] Optionally, the industrial computer 501 is also used for: after executing if the target distance belongs to an outlier, excluding the target distance from the standard distance set, continuing to select a distance threshold from the first threshold side of the current standard distance set as the target distance, and judging whether the target distance belongs to an outlier; if so, excluding the target distance from the current standard distance set; if not, selecting a corresponding distance threshold from the second threshold side as the target distance, and continuing to judge whether the target distance belongs to an outlier, until all distances belonging to outliers are eliminated from the standard distance set.

[0083] Optionally, when the industrial computer 501 determines whether the target distance is an outlier based on the first mean square error and the second mean square error, it is specifically used to: when the first mean square error is greater than the second mean square error, and the second mean square error is greater than a preset mean square error threshold, determine that the target distance is an outlier.

[0084] Embodiment 3

[0085] Figure 6 A block diagram of a computer device suitable for implementing a distance detection method for non-smooth edges provided in the third embodiment of the present invention is shown. In this embodiment, the computer device 600 may be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. Figure 6 As shown, the computer device 600 of this embodiment includes at least but is not limited to: a memory 601, a processor 602, and a network interface 603 that can be interconnected through a system bus. It should be noted that Figure 6 Only computer device 600 is shown with components 601 - 603 , but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0086] In this embodiment, the memory 603 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 601 can be an internal storage unit of the computer device 600, such as a hard disk or memory of the computer device 600. In other embodiments, the memory 601 can also be an external storage device of the computer device 600, such as a plug-in hard disk equipped on the computer device 600, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 601 can also include both the internal storage unit of the computer device 600 and its external storage device. In this embodiment, the memory 601 is generally used to store an operating system and various application software installed on the computer device 600, such as program codes of a non-smooth edge distance detection method, etc. The non-smooth edge distance detection method includes: identifying the edge of the area to be detected according to a preset detection direction to obtain multiple edge points; marking every two edge points parallel to the preset detection direction as a group of edge point pairs; calculating the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; eliminating distances belonging to outliers from the edge point distance set; and determining the distances between the identified edges based on the remaining distances in the edge point distance set.

[0087] In some embodiments, the processor 602 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 602 is generally used to control the overall operation of the computer device 600. For example, the processor 602 performs control and processing related to data interaction or communication with the computer device 600. In this embodiment, the processor 602 is used to run the program code of the distance detection method of the non-smooth edge stored in the memory 601.

[0088] In this embodiment, the non-smooth edge distance detection method stored in the memory 601 may also be divided into one or more program modules and executed by one or more processors (processor 602 in this embodiment) to complete the present invention.

[0089] The network interface 603 may include a wireless network interface or a wired network interface, and the network interface 603 is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer device 600 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0090] Embodiment 4

[0091] The present embodiment also provides a computer-readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored. When the computer program is executed by a processor, the steps of a non-smooth edge distance detection method are implemented. The non-smooth edge distance detection method includes: identifying an edge of a to-be-detected area according to a preset detection direction to obtain a plurality of edge points; marking each two edge points parallel to the preset detection direction as a group of edge point pairs; calculating the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; eliminating distances belonging to outliers from the edge point distance set; and determining the distances between the identified edges according to the remaining distances in the edge point distance set.

[0092] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.

[0093] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0095] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for detecting distance of a non-smooth edge, characterized in that: The method comprises: Collecting images of the object to be detected and preprocessing the images, and identifying the area to be detected from the preprocessed images; Identify the edge of the area to be detected according to the preset detection direction to obtain multiple edge points; Marking every two edge points parallel to the preset detection direction as a group of edge point pairs; Calculate the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; Selecting a distance from the edge point distance set as a target distance and determining whether the target distance belongs to an outlier; If the target distance belongs to an outlier, remove the distance belonging to the outlier from the edge point distance set; Determining the distances between the identified edges according to the remaining distances in the edge point distance set; The method further comprises: If the target distance does not belong to an outlier, sort the distances in the edge point distance set in order of distance size to obtain a standard distance set, wherein the standard distance set includes a first threshold side and a second threshold side, and the first threshold side and the second threshold side are different distance threshold sides; Selecting a corresponding distance threshold from the first threshold side of the standard distance set as the target distance; If the target distance is an outlier, remove the target distance from the standard distance set; If the target distance does not belong to an outlier, a corresponding distance threshold is selected from the second threshold side of the standard distance set as the target distance, and the determination of whether the target distance belongs to an outlier is continued until all distances belonging to outliers are eliminated from the standard distance set.

2. The method according to claim 1, characterized in that The selecting a distance from the edge point distance set as the target distance and judging whether the target distance belongs to an outlier point comprises: Selecting a distance from the edge point distance set as a target distance; Calculating a first mean square error of all distances in the edge point distance set and calculating a second mean square error of other distances in the edge point distance set except the target distance; Whether the target distance belongs to an outlier is determined according to the first mean square error and the second mean square error.

3. The method according to claim 2, characterized in that The determining whether the target distance belongs to an outlier according to the first mean square error and the second mean square error includes: When the first mean square error is greater than the second mean square error, and the second mean square error is greater than a preset mean square error threshold, it is determined that the target distance is an outlier.

4. The method according to any one of claims 1 to 3, characterized in that: After the target distance is removed from the standard distance set if the target distance is an outlier, the method further includes: Continue to select a distance threshold from the first threshold side of the current standard distance set as the target distance, and determine whether the target distance belongs to an outlier; If so, remove the target distance from the current standard distance set; If not, a corresponding distance threshold is selected from the second threshold side as the target distance, and the determination of whether the target distance belongs to an outlier is continued until all distances belonging to outliers are eliminated from the standard distance set.

5. A non-smooth edge distance detection system, characterized in that: The system comprises: Motion controller, used to control the production line conveyor belt to transport the objects to be detected with non-smooth edges; An industrial camera, used to collect images of the object to be detected and transmit the images to an industrial computer; An industrial computer, the industrial computer is used to execute a program having the following steps: Identifying an area to be detected in the image; Identify the edge of the area to be detected according to the preset detection direction to obtain multiple edge points; Marking every two edge points parallel to the preset detection direction as a group of edge point pairs; Calculate the distance between two edge points in each group of edge point pairs to obtain an edge point distance set; Selecting a distance from the edge point distance set as a target distance and determining whether the target distance belongs to an outlier; If the target distance belongs to an outlier, remove the distance belonging to the outlier from the edge point distance set; Determining the distances between the identified edges according to the remaining distances in the edge point distance set; If the target distance does not belong to an outlier, sort the distances in the edge point distance set in order of distance size to obtain a standard distance set, wherein the standard distance set includes a first threshold side and a second threshold side, and the first threshold side and the second threshold side are different distance threshold sides; Selecting a corresponding distance threshold from the first threshold side of the standard distance set as the target distance; If the target distance is an outlier, remove the target distance from the standard distance set; If the target distance does not belong to an outlier, a corresponding distance threshold is selected from the second threshold side of the standard distance set as the target distance, and the determination of whether the target distance belongs to an outlier is continued until all distances belonging to outliers are eliminated from the standard distance set.

6. The system according to claim 5, characterized in that The industrial computer is also used for: When the industrial camera collects images, the light source controller is controlled to adjust the light source.

Citation Information

Patent Citations

  • Edge width defect detection method and edge width defect detection device

    CN106339710A

  • Intelligent target detection and size measurement method based on human eye vision model

    CN107392929A

  • Non-contact small gap width measuring method based on image processing

    CN108088381A

  • Rapid detection and length accurate measurement method for product burrs

    CN109115800A

  • Method, apparatus and device for detecting abnormal data, and machine-readable medium

    US20190087738A1