A machine vision detection method and system based on image processing
By establishing a knowledge base of three-dimensional objects based on image processing methods and using selection algorithms and fuzzy classification algorithms, the problem of machine vision systems being difficult to identify three-dimensional structures in complex scenes is solved, and fast and accurate three-dimensional object recognition is achieved.
Patent Information
- Application Number
- CN202410924557.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Existing machine vision systems mainly rely on 2D image analysis, which makes it difficult to accurately understand and analyze the three-dimensional structure of objects, especially in complex scenes.
An image processing-based method is used to build a knowledge base by scanning three-dimensional objects, extract key features and integrate data, and use selection algorithms and fuzzy classification algorithms to quickly identify three-dimensional objects, combined with tree structure storage and fuzzy detection algorithms.
It improves the accuracy and speed of three-dimensional object recognition, is suitable for strict detection scenarios such as assembly line detection, and achieves rapid recognition in complex scenes.
Smart Images

Figure CN118470705B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine vision detection, and in particular to a machine vision detection method and system based on image processing. Background Art
[0002] As an important branch of artificial intelligence, machine vision has made remarkable progress. Machine vision mainly relies on optical devices and non-contact sensors to automatically receive and process images of real objects. At present, machine vision systems mainly rely on 2D image analysis. If 3D vision technology can be integrated, machines will be able to understand and analyze the three-dimensional structure of objects more accurately, thus playing a role in more complex scenes. Image processing technology is the core of machine vision. The key to innovating machine vision systems lies in how to enable machines to successfully understand and analyze the three-dimensional structure of objects based on image processing technology. Summary of the invention
[0003] The present invention provides a machine vision detection method based on image processing, comprising:
[0004] Step 1: Scan 3D objects and build a knowledge base according to the machine's task requirements;
[0005] Step 2: Establish a machine vision detection model based on the knowledge base;
[0006] Step 3: Scan and identify three-dimensional objects in the task scene based on the machine vision detection model;
[0007] Step 4. Regularly maintain the data in the knowledge base through the knowledge base extension interface.
[0008] As described above, a machine vision detection method based on image processing, in which a three-dimensional object is scanned and a knowledge base is established according to the task requirements of the machine, specifically includes the following sub-steps:
[0009] Collect scans of 3D objects that the machine needs to recognize in the task scenario and store them in the knowledge base;
[0010] Extract key features from 3D object scans based on image processing technology;
[0011] The data in the knowledge base is further integrated based on the extracted key features.
[0012] A machine vision inspection method based on image processing as described above, wherein key features are extracted from a scanned three-dimensional object based on image processing technology, specifically comprising the following sub-steps:
[0013] Perform image enhancement on scans of three-dimensional objects and extract general features of the scans;
[0014] From the extracted general features, features whose confidence in object recognition is higher than a threshold are selected as key features.
[0015] The above-mentioned machine vision detection method based on image processing, wherein the data in the knowledge base is further integrated according to the extracted key features, specifically includes the following sub-steps:
[0016] Label each key feature value with the scan number;
[0017] Sort the key feature values in positive order using the first key feature as the sorting field;
[0018] The sorted key feature values are organized into a tree storage structure.
[0019] As described above, a machine vision detection method based on image processing, wherein the working process of the machine vision detection model includes the following sub-steps:
[0020] Find the tree to be retrieved based on the value of the first key feature in the input set;
[0021] Select layer by layer in the search tree according to the key features in the input set until the leaf node corresponding to the last key feature value of the input set is found;
[0022] The scan number marked on the leaf node is output as the number of the recognized three-dimensional object.
[0023] A machine vision detection method based on image processing as described above, wherein a machine vision detection model is used to identify a three-dimensional object scanned by a machine in a task scene, specifically comprising the following sub-steps:
[0024] Extracting various key feature values of the object scanned by the machine and storing them as a key feature set;
[0025] Serialize the extracted key features according to the order of key features in the knowledge base;
[0026] Input the serialized key feature set into the machine vision detection model;
[0027] If the machine vision detection model inputs the scan number, the details of the object are queried from the knowledge base according to the scan number as the echo data;
[0028] If the machine vision detection model does not output the scan number, fuzzy detection is performed on the object to be identified.
[0029] A machine vision detection method based on image processing as described above, wherein the data in the knowledge base is regularly maintained using a knowledge base extension interface, specifically comprising the following sub-steps:
[0030] Define the extended interface specification to ensure the consistency of imported data and knowledge base data;
[0031] Extract and integrate features of imported data in the test environment;
[0032] Verify the applicability of imported data to the machine vision inspection model in a test environment;
[0033] After verification, the knowledge base will be synchronized to the production environment.
[0034] The present invention also provides a machine vision inspection system based on image processing, comprising: a knowledge base module, a vision inspection module, and an expansion module;
[0035] The knowledge base module is used to maintain the three-dimensional objects that the machine needs to recognize in the task scenario;
[0036] The visual inspection module is used to detect the three-dimensional objects scanned by the machine in the task scene based on the data in the knowledge base, identify the type of the three-dimensional object and display it;
[0037] The extension module is used to regularly maintain the data in the knowledge base using the knowledge base extension interface.
[0038] A machine vision inspection system based on image processing as described above, wherein the knowledge base module includes a feature extraction submodule, a knowledge integration submodule, and a knowledge storage submodule;
[0039] A feature extraction submodule is used to extract key features of a 3D object scan using image processing technology;
[0040] The knowledge integration submodule is used to further integrate the data in the knowledge base according to the extracted key features;
[0041] The knowledge storage submodule is used to store the scanned three-dimensional objects and related knowledge that the machine needs to recognize and process in the task scenario.
[0042] A machine vision inspection system based on image processing as described above, wherein the vision inspection module includes a machine input set processing submodule, a vision inspection model submodule, and an output set processing submodule;
[0043] An input set processing submodule, used to process the object data scanned by the machine into an input set of the machine vision detection model;
[0044] A machine vision detection model submodule is used to create a machine vision detection model using data in the knowledge base;
[0045] The output set processing submodule is used to form echo data according to the output of the machine vision detection model.
[0046] The beneficial effects achieved by the present invention are as follows: using image processing technology to make feature extraction more accurate, converting knowledge base data into an ordered tree structure, using a selection algorithm instead of a traditional traversal algorithm, and combining a fuzzy classification algorithm to achieve rapid recognition of three-dimensional objects. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0048] Figure 1 is a flow chart of a machine vision detection method based on image processing provided by Embodiment 1 of the present invention;
[0049] Figure 2 It is a schematic diagram of the key characteristic values after sorting provided by the present invention;
[0050] Figure 3 It is a schematic diagram of the tree structure provided by the present invention. DETAILED DESCRIPTION
[0051] The machine vision inspection method provided by the present invention is applicable to strict inspection scenarios, such as inspecting whether the produced products are qualified, and the inspection speed is very fast, and is applicable to task scenarios with high real-time requirements such as assembly lines.
[0052] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0053] Embodiment 1
[0054] like Figure 1 As shown, the first embodiment of the present invention provides a machine vision detection method based on image processing, including:
[0055] Step S10: Scanning the three-dimensional object and establishing a knowledge base according to the task requirements of the machine;
[0056] First, we need to clarify the task requirements of the machine, understand the types, characteristics, and application scenarios of the three-dimensional objects that need to be identified and processed, and integrate these three-dimensional objects into a knowledge base to provide data support for machine vision inspection. Specifically:
[0057] Step S11: collecting scans of three-dimensional objects that the machine needs to recognize in the task scenario, and storing the scan numbers in the knowledge base;
[0058] In order to ensure that the machine can identify three-dimensional objects in the task scene based on the scanned parts, multi-angle and high-resolution scanning is required when scanning and warehousing. After the scan is completed, its name, category, part, connection relationship and other attributes are labeled and stored in the knowledge base.
[0059] Step S12: extracting key features from the scanned three-dimensional object based on image processing technology;
[0060] Key features are the basis for machine vision inspection. Each set of extracted features must uniquely point to a 3D object. The specific extraction steps include:
[0061] Step S121: performing image enhancement on the scanned copy of the three-dimensional object to extract general features of the scanned copy;
[0062] Image enhancement is to highlight the edges and details of 3D object scans to make feature extraction more accurate. General features include: normal vector, surface curvature, texture, color, shape, depth and other attributes that describe the surface characteristics of an object.
[0063] Step S122: Selecting features whose confidence level for object recognition is higher than a threshold from the extracted general features as key features;
[0064] The key feature selection function is expressed as:
[0065] .
[0066] in is the input feature set, For the input set The first feature Observations, For the input set The mean of all observed values of the feature, Value , For the The number of observed values of the feature, Calculate the The confidence of the feature in object recognition, is the threshold value set, is the first Item features, when Time Output and execute To update the index value , and then continue to judge, if , the output is empty , that is, no output is performed, but the execution is still performed To update the index value , and continue to judge, repeating until Exit the function, is the total number of input features, The initial value of is 1.
[0067] Threshold It is used to control the number of key features. Too many key features will increase unnecessary calculation, while too few key features cannot guarantee uniqueness and directionality. Therefore, it is necessary to adjust the threshold when extracting key features. To control the number of key features.
[0068] Step S13: further integrating the data in the knowledge base according to the extracted key features, specifically including the following sub-steps:
[0069] Step S131: label each key feature value with the scan number;
[0070] The feature value corresponding to each key feature is queried from the general features of each scan, and each key feature value queried is marked with the scan number.
[0071] Step S132: sorting the values of the key features in positive order using the first key feature as the sorting field;
[0072] Step S133: Arrange the sorted key feature values into a tree storage structure, which specifically includes the following sub-steps:
[0073] Step S1331: Create a tree with the first key feature value as the root node;
[0074] First, count the different values of the first key feature and use each value as the root of a tree, such as Figure 2 As shown in the schematic diagram of the key feature values after sorting, the first feature has three values of "1, 2, and 3", so three trees are established, and "1, 2, and 3" are the root nodes of the trees respectively;
[0075] Step S1332: adding other key feature values as tree nodes layer by layer;
[0076] Then the number of nodes in the second layer is determined by the number of the second key eigenvalues, such as Figure 2 When the root node is 1, the second key feature has two values, "2, 4", so the number of nodes in the second layer is two, and the node values are 2 and 4 respectively; then according to the third and fourth key features, the number of nodes in the third and fourth layers and the value of each node are determined until the last key feature;
[0077] Step S1333: taking the node of the last key feature as a leaf node, and marking the leaf node with a scan number;
[0078] The node of the last key feature is called a leaf node, and the corresponding scan code is marked on the leaf node, such as Figure 2 As shown in the diagram, there are four key features in total. The fourth key feature "5, 4, 1" is the leaf node of the tree with the root node 1. Figure 2 The tree structure converted into data is as follows Figure 3 The tree structure diagram is shown in the figure.
[0079] Step S20: Building a machine vision detection model based on the knowledge base and applying the model to the task scenario;
[0080] The knowledge base has maintained the three-dimensional objects that the machine needs to recognize in the task scenario. Next, we need to build a machine vision detection model based on the knowledge in the knowledge base, which can be expressed as: , is the input set, is the model output, TreSel() represents the machine vision detection model, and its working process is:
[0081] Step S21: Find the tree to be retrieved according to the value of the first key feature in the input set;
[0082] Query the knowledge base for the root node value that is the same as the first key feature value of the input set. The tree where this root node is located is the tree to be retrieved next. If no root node is found, it means that there is no knowledge of the object to be identified in the knowledge base, and the model directly returns "NULL" without executing the following steps.
[0083] Step S22: selecting layer by layer in the search tree according to the key features in the input set until a leaf node corresponding to the last key feature value of the input set is found;
[0084] This step uses a selection algorithm: the retrieval tree is taken out of the knowledge base and placed in a HashMap. Because the node value is not unique in the entire tree but is unique in each layer, the number of layers plus the node value is directly used as the key value of each data item in the HashMap, and the scan number marked on the node is used as the value of each data item. Because the order of the key features in the input set is consistent with the order of the key features used when creating the retrieval tree, the corresponding node in the retrieval tree can be selected by directly using the ordinal number of the key features in the input set plus the value of the key feature as the key. Starting from the second key feature of the input set, select layer by layer from top to bottom in the retrieval tree (the number of selected layers is consistent with the ordinal number of the key features in the input set). If the selection is successful, continue to go down. If the selection fails, it means that the three-dimensional object is not maintained in the knowledge base, and the model directly returns NULL, and the following steps are not executed; repeat the judgment during the selection process until the last key feature selects the leaf node. At this time, the key value of the leaf node corresponding to the last key feature value of the input set should be MA, where M is the total number of key features and A is the value of the last key feature. The value of the leaf node can be directly selected from the HashMap according to the key value.
[0085] Step S23: Output the scan number marked on the leaf node as the number of the identified three-dimensional object.
[0086] Step S30: using the machine vision detection model to identify the three-dimensional object scanned by the machine in the task scene, specifically including the following sub-steps:
[0087] Step S31: extracting various key feature values of the object scanned by the machine and storing them as a key feature set;
[0088] First, the general features of the object scanned by the machine are extracted. The method of extracting general features is consistent with the method of extracting general features of the scanned object when the knowledge base is created; then, the values of the key feature items used when the knowledge base establishes the retrieval tree are filtered out from the general features.
[0089] Step S32: Serializing the extracted key features according to the order of key features in the knowledge base;
[0090] Because the tree structure created in the knowledge base is ordered, during retrieval, it is necessary to require that the key features in the input set be in the same order as the key features when the tree structure was created.
[0091] Step S33: inputting the serialized key feature set into the machine vision detection model;
[0092] Step S34: if the machine vision detection model inputs the scan number, the details of the object are queried from the knowledge base according to the scan number as echo data;
[0093] Step S35: If the machine vision detection model does not output the scan number, fuzzy detection is performed on the object to be identified;
[0094] Fuzzy detection matches the general features of the object to be identified with the scanned parts in the knowledge base, which is implemented based on the fuzzy detection algorithm. If you remember:
[0095] ,
[0096] ,
[0097] but
[0098] ,
[0099]
[0100] .
[0101] The core formula of the fuzzy detection algorithm is expressed as:
[0102] ,
[0103] Each parameter in the fuzzy detection algorithm needs to be normalized before calculation to obtain the corresponding dimensionless value, and then the formula is calculated. represents the general feature vector of the i-th scan in the knowledge base, represents the general feature vector of the object to be identified, , They are , The model, Represents the knowledge base Scan of appearance feature values, Value , is the number of scans in the knowledge base, Indicates The weight of the influence of each appearance feature on the overall appearance, Value , is the number of appearance features of the scanned part, represents the matching weight of the object appearance, Represents the knowledge base The normal vector of each scan, Represents the matching weight of the object normal, The knowledge base Scan of The value of the general characteristic of the item, Value , is the number of general features other than appearance features and normal vectors, is the matching weight for other general features, Indicates the first appearance feature values, represents the normal vector of the object to be identified, is the first The value of a general characteristic. If ,in If is the threshold, execute , that is, return the index of the object scan that has the largest cosine, or the smallest angle, with the object to be identified. If it does not meet , indicating that the object to be identified is too different from the scanned copies in all knowledge bases, and the output result is nothing, that is, there is no relevant knowledge base code. At this time, the 3D scan data of the object to be identified is stored in the data set to be updated for association when the knowledge base is updated uniformly.
[0104] Calculation results It is the corresponding scan index return value obtained by fuzzy detection matching in the knowledge base of the object to be identified, that is, The calculated subscript i is calculated according to the result Find the scan code, and then query the details of the scan according to the scan code as the echo data.
[0105] Step S40: using the knowledge base extension interface to regularly maintain the data in the knowledge base;
[0106] The knowledge base is the data basis for visual inspection. To ensure that the data in the knowledge base is complete and accurate, it is necessary to maintain the knowledge base regularly. Specifically:
[0107] Step S41: define the extended interface specification to ensure the unity of the imported data and the knowledge base data;
[0108] The interface specification includes requirements for the data format, data structure, data type, etc. of the imported data, as well as verification rules for external data sources.
[0109] Step S42: extracting and integrating features of the imported data in the test environment;
[0110] According to the key features in the original knowledge base, the corresponding feature values are extracted from the imported data, and then each set of extracted key feature values is checked to see whether it uniquely points to a scan number. If so, data integration is performed. Otherwise, the number of key features needs to be expanded to ensure the unique directionality of the key features. The data integration step is detailed in step S13.
[0111] Step S43: verifying the applicability of the imported data on the machine vision detection model in a test environment;
[0112] Several three-dimensional objects are randomly selected from the imported data for the machine to identify. The recognition success rate must reach 100% to pass the verification. For the three-dimensional objects that fail the verification, it is necessary to check layer by layer whether the data in the corresponding retrieval tree is correct, and modify the incorrect data.
[0113] Step S44: After verification, the knowledge base is synchronized to the production environment.
[0114] Embodiment 2
[0115] Embodiment 2 of the present invention provides a machine vision inspection system based on image processing, including: a knowledge base module, a visual inspection module, and an expansion module;
[0116] (1) Knowledge base module, which is used to maintain the three-dimensional objects that the machine needs to recognize in the task scenario; it includes feature extraction submodule, knowledge integration submodule, and knowledge storage submodule;
[0117] 1. Feature extraction submodule, used to extract key features of 3D object scans using image processing technology;
[0118] Key features are the basis for machine vision inspection. Each set of features extracted must uniquely point to a 3D object, including:
[0119] I. Perform image enhancement on scanned copies of three-dimensional objects and extract general features of the scanned copies;
[0120] Image enhancement is to highlight the edges and details of 3D object scans to make feature extraction more accurate. General features include: normal vector, surface curvature, texture, color, shape, depth and other attributes that describe the surface characteristics of an object.
[0121] II. Select features whose confidence in object recognition is higher than a threshold from the extracted general features as key features.
[0122] The key feature selection function is expressed as:
[0123] .
[0124] in is the input feature set, For the input set The first feature Observations, For the input set The mean of all observed values of the feature, Value , For the The number of observed values of the feature, Calculate the The confidence of the feature in object recognition, is the threshold value set, is the first Item features, when Time Output and execute To update the index value , and then continue to judge, if , the output is empty , that is, no output is performed, but the execution is still performed To update the index value , and continue to judge, repeating until Exit the function, is the total number of input features, The initial value of is 1.
[0125] Threshold It is used to control the number of key features. Too many key features will increase unnecessary calculation, while too few key features cannot guarantee uniqueness and directionality. Therefore, it is necessary to adjust the threshold when extracting key features. To control the number of key features.
[0126] 2. The knowledge integration submodule is used to further integrate the data in the knowledge base according to the extracted key features, including:
[0127] I. Label each key feature value with the scan number;
[0128] The feature value corresponding to each key feature is queried from the general features of each scan, and each key feature value queried is marked with the scan number.
[0129] II. Sort the key feature values in positive order using the first key feature as the sorting field;
[0130] III. Arrange the sorted key eigenvalues into a tree storage structure;
[0131] First, count the different values of the first key feature and use each value as the root of a tree, such as Figure 2 As shown in the schematic diagram of the key eigenvalues after sorting, the first feature has three values of "1, 2, and 3", so three trees are established, and "1, 2, and 3" are the root nodes of the trees respectively; then the number of the second-level nodes is determined by the number of the second key eigenvalues, such as Figure 2When the root node is 1, the second key feature has two values, "2, 4", so the number of nodes in the second layer is two, and the node values are 2 and 4 respectively; then according to the third and fourth key features, the number of nodes in the third and fourth layers and the value of each node are determined until the last key feature. The node of the last key feature is called a leaf node, and the corresponding scan code is marked on the leaf node, such as Figure 2 As shown in the diagram, there are four key features in total. The fourth key feature "5, 4, 1" is the leaf node of the tree with the root node 1. Figure 2 The tree structure converted into data is as follows Figure 3 shown.
[0132] 3. Knowledge storage submodule, used to store the scanned 3D objects and related knowledge that the machine needs to recognize and process in the task scenario;
[0133] Collect scans of three-dimensional objects that need to be identified during machine task execution, and store the scan numbers in the knowledge base. In addition, general features, key features, integrated tree structure data and other related knowledge extracted from the three-dimensional object scans are also stored in the knowledge base. The data in the knowledge base provides data support and detection basis for machine vision inspection.
[0134] (2) A visual inspection module, which is used to detect the three-dimensional objects scanned by the machine in the task scene based on the data in the knowledge base, identify the type of the three-dimensional object and display it; it includes a machine vision inspection model submodule, an input set processing submodule, and an output set processing submodule;
[0135] 1. Machine vision detection model submodule, used to create a machine vision detection model using data in the knowledge base;
[0136] The machine vision detection model is expressed as: , is the input set, is the model output, TreSel() represents the machine vision detection model, and its working process is:
[0137] I. Find the tree to be retrieved based on the value of the first key feature in the input set;
[0138] Query the knowledge base for the root node value that is the same as the first key feature value of the input set. The tree where this root node is located is the tree to be retrieved next. If no root node is found, it means that there is no knowledge of the object to be identified in the knowledge base, and the model directly returns "NULL" without executing the following steps.
[0139] II. Select layer by layer in the search tree according to the key features in the input set until the leaf node corresponding to the last key feature value of the input set is found;
[0140] This step uses a selection algorithm: the retrieval tree is taken out of the knowledge base and placed in a HashMap. Because the node value is not unique in the entire tree but is unique in each layer, the number of layers plus the node value is directly used as the key value of each data item in the HashMap, and the scan number marked on the node is used as the value of each data item. Because the order of the key features in the input set is consistent with the order of the key features used when creating the retrieval tree, the corresponding node in the retrieval tree can be selected by directly using the ordinal number of the key features in the input set plus the value of the key feature as the key. Starting from the second key feature of the input set, select layer by layer from top to bottom in the retrieval tree (the number of selected layers is consistent with the ordinal number of the key features in the input set). If the selection is successful, continue to go down. If the selection fails, it means that the three-dimensional object is not maintained in the knowledge base, and the model directly returns NULL, and the following steps are not executed; repeat the judgment during the selection process until the last key feature selects the leaf node. At this time, the key value of the leaf node corresponding to the last key feature value of the input set should be MA, where M is the total number of key features and A is the value of the last key feature. The value of the leaf node can be directly selected from the HashMap according to the key value.
[0141] III. Output the scan number marked on the leaf node as the number of the identified three-dimensional object.
[0142] 2. Input set processing submodule, used to process the object data scanned by the machine into the input set of the machine vision detection model;
[0143] First, the key feature values of the object scanned by the machine are extracted and stored as a key feature set;
[0144] The method of extracting general features is consistent with the method of extracting general features of scanned documents when creating the knowledge base; then the values of various key feature items used in establishing the retrieval tree of the knowledge base are screened from the general features;
[0145] Then the extracted key features are serialized according to the order of key features in the knowledge base;
[0146] Because the tree structure created in the knowledge base is ordered, during retrieval, it is necessary to require that the key features in the input set be in the same order as the key features when the tree structure was created.
[0147] The serialized key feature set is input into the machine vision detection model as an input set.
[0148] 3. Output set processing submodule, used to form echo data according to the output of the machine vision detection model;
[0149] If the output is a specific scan number, the details of the object are queried from the knowledge base according to the scan number as the echo data.
[0150] If the machine vision detection model does not output the scan number, the object to be identified is subjected to fuzzy detection;
[0151] Fuzzy detection matches the general features of the object to be identified with the scanned parts in the knowledge base, which is implemented based on the fuzzy detection algorithm. If you remember:
[0152] ,
[0153] ,
[0154] but
[0155] ,
[0156] ,
[0157] .
[0158] The core formula of the fuzzy detection algorithm is expressed as:
[0159] ,
[0160] Each parameter in the fuzzy detection algorithm needs to be normalized before calculation to obtain the corresponding dimensionless value, and then the formula is calculated. represents the general feature vector of the i-th scan in the knowledge base, represents the general feature vector of the object to be identified, , They are , The model, Represents the knowledge base Scan of appearance feature values, Value , is the number of scans in the knowledge base, Indicates The weight of the influence of each appearance feature on the overall appearance, Value , is the number of appearance features of the scanned part, represents the matching weight of the object appearance, Represents the knowledge base The normal vector of each scan, Represents the matching weight of the object normal, The knowledge base Scan of The value of the general characteristic of the item, Value , is the number of general features other than appearance features and normal vectors, is the matching weight for other general features, Indicates the first appearance feature values, represents the normal vector of the object to be identified, is the first The value of a general characteristic. If ,in If is the threshold, execute , that is, return the index of the object scan that has the largest cosine, or the smallest angle, with the object to be identified. If it does not meet , indicating that the object to be identified is too different from the scanned copies in all knowledge bases, and the output result is nothing, that is, there is no relevant knowledge base code. At this time, the 3D scan data of the object to be identified is stored in the data set to be updated for association when the knowledge base is updated uniformly.
[0161] Calculation results It is the corresponding scan index return value obtained by fuzzy detection matching in the knowledge base of the object to be identified, that is, The calculated subscript i is calculated according to the result Find the scan code, and then query the details of the scan according to the scan code as the echo data.
[0162] (3) Extension module, used to regularly maintain the data in the knowledge base using the knowledge base extension interface;
[0163] The knowledge base is the data basis for visual inspection. To ensure that the data in the knowledge base is complete and accurate, it is necessary to maintain the knowledge base regularly. Specifically:
[0164] I. Define the extended interface specification to ensure the consistency of imported data and knowledge base data;
[0165] The interface specification includes requirements for the data format, data structure, data type, etc. of the imported data, as well as verification rules for external data sources.
[0166] II. Extract and integrate features of the imported data in the test environment;
[0167] According to the key features in the original knowledge base, the corresponding feature values are extracted from the imported data, and then it is verified whether each set of extracted key feature values uniquely points to a scan number. If so, data integration is performed, otherwise the number of key features needs to be expanded to ensure the unique directionality of the key features.
[0168] III. Verify the applicability of the imported data to the machine vision inspection model in a test environment;
[0169] Several three-dimensional objects are randomly selected from the imported data for the machine to identify. The recognition success rate must reach 100% to pass the verification. For the three-dimensional objects that fail the verification, it is necessary to check layer by layer whether the data in the corresponding retrieval tree is correct, and modify the incorrect data.
[0170] IV. After verification, synchronize the knowledge base to the production environment.
[0171] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A machine vision detection method based on image processing, characterized in that: The method comprises: Step 1: Scan 3D objects and build a knowledge base according to the machine's task requirements; Step 2: Establish a machine vision detection model based on the knowledge base; Step 3: Scan and identify three-dimensional objects in the task scene based on the machine vision detection model; Step 4: Regularly maintain the data in the knowledge base through the knowledge base extension interface; Scanning 3D objects and building a knowledge base based on the machine's task requirements includes the following sub-steps: Step S11: collecting scans of three-dimensional objects that the machine needs to recognize in the task scenario, and storing the scan numbers in the knowledge base; Step S12: extracting key features from the scanned three-dimensional object based on image processing technology; Step S13: further integrating the data in the knowledge base according to the extracted key features; The specific steps for extracting key features include: Step S121: performing image enhancement on the scanned copy of the three-dimensional object and extracting general features of the scanned copy; the general features include: normal vector, surface curvature, texture, color, shape, and depth; Step S122: Selecting features whose confidence level for object recognition is higher than a threshold from the extracted general features as key features; The data in the knowledge base is further integrated based on the extracted key features, including: Step S131: label each key feature value with the scan number; Step S132: sorting the values of the key features in positive order using the first key feature as the sorting field; Step S133: Arrange the sorted key feature values into a tree storage structure, which specifically includes the following sub-steps: Step S1331: Create a tree with the first key feature value as the root node; Step S1332: adding other key feature values as tree nodes layer by layer; Step S1333: taking the node of the last key feature as a leaf node, and marking the leaf node with a scan number; A machine vision detection model is established based on the knowledge in the knowledge base, which is expressed as: , is the input set, is the model output, TreSel() represents the machine vision detection model, and its working process is: Step S21: Find the tree to be retrieved according to the value of the first key feature in the input set; Step S22: selecting layer by layer in the search tree according to the key features in the input set until a leaf node corresponding to the last key feature value of the input set is found; Step S23: outputting the scan number marked on the leaf node as the number of the identified three-dimensional object; Scanning and identifying three-dimensional objects in the task scene based on the machine vision detection model specifically includes the following sub-steps: Step S31: extracting various key feature values of the object scanned by the machine and storing them as a key feature set; Step S32: Serializing the extracted key features according to the order of key features in the knowledge base; Step S33: inputting the serialized key feature set into the machine vision detection model; Step S34: if the machine vision detection model inputs the scan number, the details of the object are queried from the knowledge base according to the scan number as echo data; Step S35: If the machine vision detection model does not output the scan number, fuzzy detection is performed on the object to be identified. The fuzzy detection matches the general features of the object to be identified and the scans in the knowledge base.
2. The machine vision detection method based on image processing according to claim 1, characterized in that: Use the knowledge base extension interface to regularly maintain the data in the knowledge base, which includes the following sub-steps: Define the extended interface specification to ensure the consistency of imported data and knowledge base data; Extract and integrate features of imported data in the test environment; Verify the applicability of imported data to the machine vision inspection model in a test environment; After verification, the knowledge base will be synchronized to the production environment.
3. A machine vision inspection system based on image processing, characterized in that: The system comprises: a knowledge base module, a visual detection module, and an expansion module; The knowledge base module is used to maintain the three-dimensional objects that the machine needs to recognize in the task scenario; The visual inspection module is used to detect the three-dimensional objects scanned by the machine in the task scene based on the data in the knowledge base, identify the type of the three-dimensional object and display it; Extension module, used to regularly maintain the data in the knowledge base using the knowledge base extension interface; The knowledge base module includes a feature extraction submodule, a knowledge integration submodule, and a knowledge storage submodule; The feature extraction submodule is used to extract key features of the scanned three-dimensional object using image processing technology; the specific extraction of key features includes: performing image enhancement on the scanned three-dimensional object and extracting general features of the scanned object; general features include: normal vector, surface curvature, texture, color, shape, depth; selecting features with a confidence level for object recognition higher than a threshold from the extracted general features as key features; The knowledge integration submodule is used to further integrate the data in the knowledge base according to the extracted key features; specifically includes: marking each key feature value with the scan number; sorting the key feature values in positive order with the first key feature as the sorting field; arranging the sorted key feature values into a tree storage structure; wherein, arranging the sorted key feature values into a tree storage structure specifically includes: creating a tree with the first key feature value as the root node; adding other key feature values as tree nodes layer by layer; taking the node of the last key feature as a leaf node, and marking the leaf node with the scan number; The knowledge storage submodule is used to store the scanned 3D objects and related knowledge that the machine needs to recognize and process in the task scenario; The visual inspection module includes an input set processing submodule, a machine vision inspection model submodule, and an output set processing submodule; An input set processing submodule, used to process the object data scanned by the machine into an input set of the machine vision detection model; The machine vision detection model submodule is used to create a machine vision detection model using the data in the knowledge base; the machine vision detection model is established based on the knowledge in the knowledge base, which is expressed as: , is the input set, is the model output. TreSel() represents the machine vision detection model. Its working process is as follows: find the tree to be searched according to the value of the first key feature in the input set; select layer by layer in the search tree according to the key features in the input set until the leaf node corresponding to the last key feature value of the input set is found; output the scan number marked on the leaf node as the number of the identified 3D object; The output set processing submodule is used to form echo data according to the output of the machine vision detection model; based on the machine vision detection model, the three-dimensional objects in the task scene are scanned and identified, specifically including: extracting the key feature values of the objects scanned by the machine and storing them as a key feature set; serializing the extracted key features according to the order of the key features in the knowledge base; inputting the serialized key feature set into the machine vision detection model; if the machine vision detection model inputs the scan number, the details of the object are queried from the knowledge base according to the scan number as the echo data; if the machine vision detection model does not output the scan number, fuzzy detection is performed on the object to be identified, and the fuzzy detection matches the general features of the object to be identified and the scan in the knowledge base.
