Method, system, device and medium for qualified detection of clamps based on machine vision
Through a machine vision-based method, template matching and classification and grabbing technology are used to solve the problem of inaccurate identification caused by stacking clamps on each other, and the accuracy and efficiency of clamp qualification detection are improved.
Patent Information
- Application Number
- CN202111219583.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-10-20
AI Technical Summary
In complex industrial scenarios, stacking of clamps on each other causes inaccurate identification of clamps that are blocked, resulting in low detection accuracy, time-consuming and low efficiency.
Using a machine vision-based method, by obtaining the color image information of the clamp to be detected, using pre-created template images for template matching, determining the position and size information of the clamp, and classifying and capturing and detecting based on this information.
It improves the accuracy and efficiency of clamp qualification detection, and can detect whether all clamps are qualified and classified in order in order according to the stacking order, avoiding the inaccurate identification caused by clamp occlusion.
Smart Images

Figure CN114049509B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method, system, device and medium for detecting qualified clamps based on machine vision. Background Art
[0002] Clamp qualification detection is a basic functional requirement of industrial assembly lines, and its purpose is to detect the qualified rate of clamps. At present, in some complex industrial scenarios, clamps will be stacked on each other, resulting in inaccurate identification of obscured clamps, resulting in low detection accuracy, long time consumption, low efficiency and other problems. Summary of the invention
[0003] The purpose of the present invention is to solve one of the technical problems existing in the prior art to at least a certain extent.
[0004] To this end, an object of an embodiment of the present invention is to provide an efficient and accurate method for detecting qualified clamps based on machine vision.
[0005] Another object of an embodiment of the present invention is to provide a clamp qualification detection system based on machine vision.
[0006] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present invention include:
[0007] In a first aspect, an embodiment of the present invention provides a method for detecting qualified clamps based on machine vision, comprising the following steps:
[0008] Acquire first image information of a plurality of clamps to be inspected, wherein the plurality of clamps to be inspected are stacked on top of each other;
[0009] Performing template matching on the first image information according to a pre-created template image to determine a first matching area, and determining position information of the first clamp according to the first matching area;
[0010] extracting a first edge pair of the first clamp according to the first matching area, and determining size information of the first clamp according to the first edge pair;
[0011] Determine whether the first clamp is qualified according to the size information, and classify and grab the first clamp according to the detection result and the position information, and then obtain the second image information after classification and grabbing, and continue to detect according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed;
[0012] Wherein, the template image includes a front template image and a back template image.
[0013] Furthermore, in one embodiment of the present invention, the clamp qualification rate detection method further includes the step of creating a template image, which specifically includes:
[0014] Obtaining front image information and back image information of the standard clamp;
[0015] Expanding the width and height of the front image information and the back image information to obtain an expanded front image and an expanded back image;
[0016] Down-sampling the extended front image and the extended back image to generate a front image pyramid and a back image pyramid;
[0017] A front template image is determined according to the front image pyramid, and a back template image is determined according to the back image pyramid.
[0018] Furthermore, in one embodiment of the present invention, the step of obtaining first image information of a plurality of clamps to be inspected is specifically as follows:
[0019] A plurality of color images of the clamps to be inspected are acquired as first image information through an industrial camera.
[0020] Further, in one embodiment of the present invention, the step of performing template matching on the first image information according to the pre-created template image to determine the first matching area specifically includes:
[0021] Constructing a target image pyramid according to the first image information;
[0022] Performing quadtree segmentation on the template image to obtain a first grid, and performing quadtree segmentation on the target image pyramid to obtain a second grid;
[0023] Determine a first gradient magnitude and a first gradient directional entropy value for all pixels in the first grid, and determine a second gradient magnitude and a second gradient directional entropy value for all pixels in the second grid;
[0024] Determine a first LBP histogram feature vector according to the first gradient amplitude and the first gradient directional entropy value, and determine a second LBP histogram feature vector according to the second gradient amplitude and the second gradient directional entropy value;
[0025] A first matching area is determined according to the similarity between the first LBP histogram feature vector and the second LBP histogram feature vector.
[0026] Further, in one embodiment of the present invention, the step of extracting the first edge pair of the first clamp according to the first matching area and determining the size information of the first clamp according to the first edge pair specifically includes:
[0027] Performing angle correction on the first matching area through affine transformation to obtain a second matching area;
[0028] Creating a rectangular measurement template, and extracting a first edge pair perpendicular to the rectangular measurement template in the second matching area by using an edge extraction operator;
[0029] The coordinate values of the pixels on the first edge are determined, and the size information of the first clamp is determined according to the coordinate values.
[0030] Further, in one embodiment of the present invention, the step of determining whether the first clamp is qualified according to the size information, and classifying and grasping the first clamp according to the detection result and the position information specifically includes:
[0031] Determining whether the first clamp is qualified according to the size information and a preset size threshold range;
[0032] The robot arm is controlled to grasp the first clamp according to the position information, and the first clamp is placed in a qualified area or a failed area according to the detection result.
[0033] In a second aspect, an embodiment of the present invention provides a clamp qualification detection system based on machine vision, comprising:
[0034] A first image information acquisition module, used to acquire first image information of a plurality of clamps to be detected, wherein the plurality of clamps to be detected are stacked on each other;
[0035] a position information determination module, configured to perform template matching on the first image information according to a pre-created template image, determine a first matching area, and determine position information of the first clamp according to the first matching area;
[0036] a size information determination module, configured to extract a first edge pair of the first clamp according to the first matching area, and determine size information of the first clamp according to the first edge pair;
[0037] A classification and grabbing module, used to determine whether the first clamp is qualified according to the size information, and to classify and grab the first clamp according to the detection result and the position information, and then obtain the second image information after classification and grabbing, and continue to detect according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed;
[0038] Wherein, the template image includes a front template image and a back template image.
[0039] Furthermore, in one embodiment of the present invention, the size information determination module includes:
[0040] an affine transformation unit, configured to perform angle correction on the first matching area through affine transformation to obtain a second matching area;
[0041] an edge pair extraction unit, configured to create a rectangular measurement template, and extract a first edge pair perpendicular to the rectangular measurement template in the second matching area by using an edge extraction operator;
[0042] The size information determining unit is used to determine the coordinate value of the pixel point on the first edge pair, and determine the size information of the first clamp according to the coordinate value.
[0043] In a third aspect, an embodiment of the present invention provides a clamp qualification detection device based on machine vision, comprising:
[0044] at least one processor;
[0045] at least one memory for storing at least one program;
[0046] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned method for detecting qualified clamps based on machine vision.
[0047] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned method for detecting qualified clamps based on machine vision.
[0048] The advantages and beneficial effects of the present invention will be partly given in the following description, partly become apparent from the following description, or be understood through the practice of the present invention:
[0049] The embodiment of the present invention obtains the first image information of the clamps to be inspected that are stacked on each other, performs template matching on the first image information according to a pre-created template image, determines a first matching area and determines the position information of the first clamp located at the top of the clamps to be inspected, then extracts the first edge pair of the first clamp according to the first matching area, determines the size information of the first clamp according to the first edge pair, then determines whether the first clamp is qualified according to the size information, and classifies and captures the first clamp according to the qualified detection result and the position information, and then obtains the second image information after classification and capture, and continues to detect until the classification and capture of all the clamps to be inspected are completed. The embodiment of the present invention determines the position information and size information of the first clamp at the top of the clamps to be inspected through template matching, and can classify and capture the first clamp to avoid occlusion of other clamps, so that all clamps can be detected and classified in sequence according to the stacking order, overcoming the problem of inaccurate recognition caused by clamp occlusion in the prior art, and improving the accuracy and efficiency of qualified clamp detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solution in the embodiments of the present invention, the following introduction is made to the drawings required for use in the embodiments of the present invention. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solution of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 A flowchart of the steps of a clamp qualification detection method based on machine vision provided by an embodiment of the present invention;
[0052] Figure 2 A structural block diagram of a clamp qualification detection system based on machine vision provided by an embodiment of the present invention;
[0053] Figure 3 A structural block diagram of a clamp qualification detection device based on machine vision provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0055] In the description of the present invention, the meaning of "a plurality" is two or more than two. If there is a description of "a first" or "a second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features. In addition, unless otherwise defined, all technical and scientific terms used in this document have the same meaning as those commonly understood by those skilled in the art.
[0056] Reference Figure 1 The embodiment of the present invention provides a clamp qualification detection method based on machine vision, which specifically includes the following steps:
[0057] S101, obtaining first image information of a plurality of clamps to be inspected, where the plurality of clamps to be inspected are stacked on top of each other;
[0058] As an optional implementation, the step of obtaining first image information of a plurality of clamps to be inspected is specifically as follows:
[0059] A plurality of color images of the clamps to be inspected are acquired as first image information through an industrial camera.
[0060] Specifically, since the clamps to be inspected are stacked on each other, the effect of shape-based template matching using grayscale images is very unsatisfactory. However, the embodiment of the present invention uses color images for shape-based template matching, which can quickly obtain the best matching area and greatly enhance the robustness of template matching.
[0061] S102, performing template matching on the first image information according to a pre-created template image, determining a first matching area, and determining position information of the first clamp according to the first matching area;
[0062] The template image includes a front template image and a back template image.
[0063] Specifically, since the clamps to be inspected are stacked on top of each other, both the front and back sides of the clamps may face upward. In order to perform accurate template matching in subsequent steps, the embodiment of the present invention creates two templates for the front and back sides of a single clamp respectively.
[0064] As an optional implementation, the clamp qualification rate detection method further includes the step of creating a template image, which specifically includes:
[0065] A1. Obtaining front image information and back image information of the standard clamp;
[0066] A2. Expanding the width and height of the front image information and the back image information to obtain an expanded front image and an expanded back image;
[0067] A3, down-sampling the extended front image and the extended back image to generate a front image pyramid and a back image pyramid;
[0068] A4. Determine the front template image according to the front image pyramid, and determine the back template image according to the back image pyramid.
[0069] Specifically, the front image information and the back image information of the standard clamp are obtained, and the width and height are expanded respectively to the nearest power of 2. The expanded image is downsampled by Gaussian smoothing with a scale factor of 2 to generate an image pyramid.
[0070] Due to the irregular placement and stacking of the clamps, the orientation of the clamps on the horizontal plane is arbitrary. Therefore, when creating the template, the factor that the template needs to be rotated should also be taken into account. Therefore, an image pyramid is generated by downsampling, and each layer of the image pyramid is rotated to include all rotation situations of the clamps.
[0071] For each layer of the image in the image pyramid, the Angle j Angle to rotate, Angle j The angle is calculated by:
[0072]
[0073] Among them, Angle s is the starting angle of rotation, Angle E is the end angle of the rotation, and the rotation angle base step length μ A It is limited by the number of layers of the template pyramid and the range of rotation angles. Therefore, when the range of rotation angles is small, μ A The value of should also be reduced, and when the total number of pyramid layers is small, μ A The value of should be increased. From the top of the pyramid to each layer, the rotation angle step d Ai Reduce accordingly, accurate angle and reduce calculation time, usually μ A Set to 1.
[0074] The smaller the size of the top image of the template image pyramid, the shorter the calculation time for matching with the target image, but the accuracy of the matching result is also reduced. When the matching score of the result of the previous layer of the pyramid is not higher than the threshold in the next layer, it means that the downsampling matching of the result is terminated.
[0075] As an optional implementation, the step of performing template matching on the first image information according to the pre-created template image to determine the first matching area specifically includes:
[0076] B1. constructing a target image pyramid according to the first image information;
[0077] B2, performing quadtree segmentation on the template image to obtain a first grid, and performing quadtree segmentation on the target image pyramid to obtain a second grid;
[0078] B3, determining the first gradient amplitude and the first gradient direction entropy value of all pixel points in the first grid, and determining the second gradient amplitude and the second gradient direction entropy value of all pixel points in the second grid;
[0079] B4, determining a first LBP histogram feature vector according to the first gradient amplitude and the first gradient direction entropy value, and determining a second LBP histogram feature vector according to the second gradient amplitude and the second gradient direction entropy value;
[0080] B5. Determine a first matching area according to the similarity between the first LBP histogram feature vector and the second LBP histogram feature vector.
[0081] Specifically, for the first grid and the second grid, the local feature points belonging to the edge and texture in the image are determined by the gradient amplitude and the gradient direction entropy value. The larger the gradient amplitude of a pixel point, the richer the gradient information contained in the pixel point; the larger the gradient direction entropy value of a certain area of the image, the greater the gradient direction change of the pixel points in the area, and the greater the possibility that the image corner points exist in the area, and the corner points usually mean that the target contour changes, which can provide more feature information for template matching.
[0082] In the embodiment of the present invention, the gradient amplitude and gradient directional entropy values of the pixel points in the first grid and the second grid are calculated, and the pixel points whose gradient amplitude and gradient directional entropy are respectively greater than the corresponding thresholds are selected as local feature points.
[0083] Local feature points are detected for all images in the template image pyramid, and the first LBP histogram feature vector is extracted with each local feature point as the region center; local feature points are detected for all images in the target image pyramid, and the second LBP histogram feature vector is extracted with each local feature point as the region center.
[0084] Starting from the top layer of the target image pyramid and the template image pyramid, a candidate window is slid on the target image. The relative position information of all local feature points in the template image is recorded in the candidate window. The feature vectors of the local feature points of the candidate window are continuously matched with the feature vectors on the corresponding target image. The similarity is calculated by the histogram feature vectors of all local feature points of the template image (i.e., the first LBP histogram feature vector) and the histogram feature vectors of the feature points at the corresponding position of the target image (i.e., the second LBP histogram feature vector). Each layer may have multiple results. The results with similarity lower than the set threshold are discarded. Finally, after the similarity matching of the bottom layer of the pyramid is completed, several local feature points with high and stable similarity are detected, so as to determine the first matching area according to the local feature points, that is, the area where the first clamp at the top of the clamp to be detected is located. Since the clamps to be detected are stacked on each other, theoretically the clamp at the top is the most completely exposed clamp, that is, it will not be blocked by other clamps, and its matching degree is also the highest.
[0085] After the first matching area is determined, the center coordinates of the first matching area may be used as position information of the first clamp.
[0086] S103, extracting a first edge pair of the first clamp according to the first matching area, and determining size information of the first clamp according to the first edge pair;
[0087] Specifically, the first matching area may be subjected to morphological processing to extract edge pairs of the first clamp, so that the size information of the first clamp may be calculated. Step S103 specifically includes the following steps:
[0088] S1031, performing angle correction on the first matching area through affine transformation to obtain a second matching area;
[0089] S1032, creating a rectangular measurement template, and extracting a first edge pair perpendicular to the rectangular measurement template in the second matching area by using an edge extraction operator;
[0090] S1033: Determine the coordinate value of the pixel point on the first edge, and determine the size information of the first clamp according to the coordinate value.
[0091] Specifically, the embodiment of the present invention uses affine transformation technology to correct the first matching area so that its rotation angle is 0 degrees, that is, the image is in a horizontal position as a whole; then a rectangular measurement template is created in the clamp key size area, and the edge extraction operator is used to extract all straight edges perpendicular to the rectangular measurement template. The edge extraction operator needs to set the edge strength parameter: edge strength (Threshold), that is, the degree to which the edge is distinguished from the surrounding pixels. The lower the edge strength value is set, the greater the tolerance when extracting the edge. For example, when the edge strength is set to 5, the edge extraction effect is best for color images; when the edge strength is set to 30, the edges of clamps of certain colors (such as blue) will not be recognized and extracted. The embodiment of the present invention sets the edge strength to 5, and the tolerance for extracting the edges of clamps of multiple colors will be greater, and the edges can be extracted more easily and quickly.
[0092] After the first edge pair is extracted, the size information of the first clamp can be determined by calculating according to the coordinate values of each pixel point on the first edge pair.
[0093] S104, determining whether the first clamp is qualified according to the size information, and classifying and grabbing the first clamp according to the detection result and the position information, and then obtaining the second image information after classification and grabbing, and continuing the detection according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed.
[0094] Specifically, whether the clamps are qualified is detected based on the extracted size information, and the robot arm performs classified grasping without putting them back. After grasping, the above-mentioned detection steps are executed in a loop until all the clamps in the image are detected and grasped.
[0095] As an optional implementation, determining whether the first clamp is qualified according to the size information and classifying and grasping the first clamp according to the detection result and the position information specifically includes:
[0096] C1. Determine whether the first clamp is qualified according to the size information and a preset size threshold range;
[0097] C2. Control the robot arm to grab the first clamp according to the position information, and place the first clamp in a qualified area or a failed area according to the detection result.
[0098] The above is a description of the method steps of the embodiment of the present invention. It can be understood that the embodiment of the present invention determines the position information and size information of the first clamp at the top of the clamp to be detected through template matching, and can classify and capture the first clamp to avoid blocking other clamps, so that all clamps can be tested and classified in sequence according to the stacking order to see if they are qualified, which overcomes the problem of inaccurate recognition caused by clamp blocking in the prior art and improves the accuracy and efficiency of qualified clamp detection.
[0099] Reference Figure 2 The embodiment of the present invention provides a clamp qualification detection system based on machine vision, comprising:
[0100] A first image information acquisition module is used to acquire first image information of a plurality of clamps to be inspected, where the plurality of clamps to be inspected are stacked on top of each other;
[0101] A position information determination module, used to perform template matching on the first image information according to a pre-created template image, determine a first matching area, and determine the position information of the first clamp according to the first matching area;
[0102] A size information determination module, configured to extract a first edge pair of the first clamp according to the first matching area, and determine size information of the first clamp according to the first edge pair;
[0103] A classification and grabbing module is used to determine whether the first clamp is qualified according to the size information, and to classify and grab the first clamp according to the detection result and the position information, and then obtain the second image information after classification and grabbing, and continue to detect according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed;
[0104] The template image includes a front template image and a back template image.
[0105] As an optional implementation, the size information determination module includes:
[0106] An affine transformation unit, used for performing angle correction on the first matching area through affine transformation to obtain a second matching area;
[0107] An edge pair extraction unit, used for creating a rectangular measurement template and extracting a first edge pair perpendicular to the rectangular measurement template in the second matching area through an edge extraction operator;
[0108] The size information determining unit is used to determine the coordinate value of the pixel point on the first edge, and determine the size information of the first clamp according to the coordinate value.
[0109] The contents of the above method embodiments are all applicable to the present system embodiments. The functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0110] Reference Figure 3 The embodiment of the present invention provides a clamp qualification detection device based on machine vision, comprising:
[0111] at least one processor;
[0112] at least one memory for storing at least one program;
[0113] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned method for detecting qualified clamps based on machine vision.
[0114] The contents of the above method embodiments are all applicable to the present device embodiments. The functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0115] An embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned clamp qualification detection method based on machine vision.
[0116] A computer-readable storage medium according to an embodiment of the present invention can execute a clamp qualification detection method based on machine vision provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0117] The embodiment of the present invention also discloses a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 1 The method shown.
[0118] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the above-mentioned boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0119] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified to the contrary, one or more of the above-mentioned functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0120] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the above methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0121] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0122] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the above-mentioned program is printed, since the above-mentioned program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in other suitable ways as necessary, and then stored in a computer memory.
[0123] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0124] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0125] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0126] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A clamp qualification detection method based on machine vision, characterized in that: The following steps are involved: Acquire first image information of a plurality of clamps to be inspected, wherein the plurality of clamps to be inspected are stacked on top of each other; Performing template matching on the first image information according to a pre-created template image to determine a first matching area, and determining position information of the first clamp according to the first matching area; extracting a first edge pair of the first clamp according to the first matching area, and determining size information of the first clamp according to the first edge pair; Determine whether the first clamp is qualified according to the size information, and classify and grab the first clamp according to the detection result and the position information, and then obtain the second image information after classification and grabbing, and continue to detect according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed; Wherein, the template image includes a front template image and a back template image; The step of extracting the first edge pair of the first clamp according to the first matching area, and determining the size information of the first clamp according to the first edge pair specifically includes: Performing angle correction on the first matching area through affine transformation to obtain a second matching area; Creating a rectangular measurement template, and extracting a first edge pair perpendicular to the rectangular measurement template in the second matching area by using an edge extraction operator; The coordinate values of the pixels on the first edge are determined, and the size information of the first clamp is determined according to the coordinate values.
2. A method for detecting qualified clamps based on machine vision according to claim 1, characterized in that: The clamp qualification detection method also includes the step of creating a template image, which specifically includes: Obtaining front image information and back image information of the standard clamp; Expanding the width and height of the front image information and the back image information to obtain an expanded front image and an expanded back image; Down-sampling the extended front image and the extended back image to generate a front image pyramid and a back image pyramid; A front template image is determined according to the front image pyramid, and a back template image is determined according to the back image pyramid.
3. The method for detecting qualified clamps based on machine vision according to claim 1, characterized in that: The step of obtaining the first image information of the plurality of clamps to be inspected is specifically as follows: A plurality of color images of the clamps to be inspected are acquired as first image information through an industrial camera.
4. The method for detecting qualified clamps based on machine vision according to claim 1, characterized in that: The step of performing template matching on the first image information according to the pre-created template image to determine the first matching area specifically includes: Constructing a target image pyramid according to the first image information; Performing quadtree segmentation on the template image to obtain a first grid, and performing quadtree segmentation on the target image pyramid to obtain a second grid; Determine a first gradient magnitude and a first gradient directional entropy value for all pixels in the first grid, and determine a second gradient magnitude and a second gradient directional entropy value for all pixels in the second grid; Determine a first LBP histogram feature vector according to the first gradient amplitude and the first gradient directional entropy value, and determine a second LBP histogram feature vector according to the second gradient amplitude and the second gradient directional entropy value; A first matching area is determined according to the similarity between the first LBP histogram feature vector and the second LBP histogram feature vector.
5. The method for detecting qualified clamps based on machine vision according to claim 1, characterized in that: The step of determining whether the first clamp is qualified according to the size information, and classifying and grasping the first clamp according to the detection result and the position information specifically includes: Determining whether the first clamp is qualified according to the size information and a preset size threshold range; The robot arm is controlled to grasp the first clamp according to the position information, and the first clamp is placed in a qualified area or a failed area according to the detection result.
6. A clamp qualification detection system based on machine vision, characterized in that: include: A first image information acquisition module, used to acquire first image information of a plurality of clamps to be detected, wherein the plurality of clamps to be detected are stacked on each other; a position information determination module, configured to perform template matching on the first image information according to a pre-created template image, determine a first matching area, and determine position information of the first clamp according to the first matching area; a size information determination module, configured to extract a first edge pair of the first clamp according to the first matching area, and determine size information of the first clamp according to the first edge pair; A classification and grabbing module, used to determine whether the first clamp is qualified according to the size information, and to classify and grab the first clamp according to the detection result and the position information, and then obtain the second image information after classification and grabbing, and continue to detect according to the second image information and the template image until the classification and grabbing of all the clamps to be detected are completed; Wherein, the template image includes a front template image and a back template image; The size information determination module includes: an affine transformation unit, configured to perform angle correction on the first matching area through affine transformation to obtain a second matching area; an edge pair extraction unit, configured to create a rectangular measurement template, and extract a first edge pair perpendicular to the rectangular measurement template in the second matching area by using an edge extraction operator; The size information determining unit is used to determine the coordinate value of the pixel point on the first edge pair, and determine the size information of the first clamp according to the coordinate value.
7. A clamp qualification detection device based on machine vision, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements a clamp qualification detection method based on machine vision as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to execute a clamp qualification detection method based on machine vision as described in any one of claims 1 to 5 when executed by the processor.
Citation Information
Patent Citations
Subway clamp appearance abnormity detection method
CN112465784A
Target positioning method, system and device based on template matching and medium
CN113128554A