Flange identification method
By adjusting the light source and image processing technology, combined with HU moment matching and SIFT feature point matching, the problem of low flange identification efficiency and low accuracy is solved, and efficient and accurate flange identification is achieved.
Patent Information
- Application Number
- CN202410637001.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The identification efficiency and accuracy of flanges in the existing technology are low, and there is a lack of efficient and accurate identification and detection methods.
By collecting the flange image in real time, adjusting the light source intensity, using the Gamma transformation function for image enhancement, combined with hybrid filtering and noise reduction, matching the outer contour and holes of the flange, and using HU moment matching and SIFT feature point matching to eliminate mismatching points. Improve recognition accuracy.
The identification time is significantly reduced, the identification efficiency is improved, and more efficient and accurate flange identification is achieved.
Smart Images

Figure CN118628771A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a flange recognition method. Background Art
[0002] With the continuous improvement of industrial automation, more and more visual inspection tasks are replaced by machines. For example, in the industrial manufacturing process, flanges are often detected and identified through computer vision technology. Flanges are disc-shaped mechanical parts that are usually used in pipeline engineering to connect pipelines.
[0003] The detection and recognition of flanges are often performed through feature point matching. Feature point matching refers to finding the correspondence between the feature pixel points of the image of the flange to be detected and the sample image of a flange of a specific specification, thereby determining the similarity between the two images.
[0004] Feature point matching can be divided into four steps:
[0005] 1. Extract detectors: Find the most easily identifiable feature points in the two images and use the feature points as detectors;
[0006] 2. Extract descriptors: For detectors, use mathematical feature descriptions, such as gradient histograms and local random binary features, to form descriptors;
[0007] 3. Matching: The matching points in the two images are determined by individual descriptors. Common methods include BM and FLANN. Specifically, BM refers to the brute force matching algorithm, which is to arbitrarily select a feature descriptor of the flange (here refers to the feature point) and calculate its distance to all feature descriptors in the image (flange template). Then, the obtained distances are sorted. Finally, the feature with the shortest distance is selected as the matching point of the two images.
[0008] FLANN refers to nearest neighbor matching, that is, randomly selecting feature points of the flange, calculating the two feature points closest to the template image, finding the ratio of the two distances, and then selecting the best feature point by setting the comparison value.
[0009] 4. Eliminate incorrect matching points: Eliminate incorrect matching points and retain correct matching points.
[0010] In order to solve the stability problem of feature points, Wu Lijun et al. proposed a stability criterion based on the grayscale value difference entropy of the feature point neighborhood. However, there may be multiple points in the local neighborhood that meet the stability criterion and are retained, resulting in a dense distribution of feature points.
[0011] Xiang Chengyu et al. used the Harris corner detection operator to filter SIFT feature points to eliminate a large number of unstable pseudo feature points in the edge area of the image. Specifically, the Harris corner detection operator filters SIFT feature points by: extracting corner points with SIFT and then using the Harris corner detector to detect corner points again on this basis.
[0012] However, Harris corners are sensitive to artificially set thresholds.
[0013] In order to solve the problem of low detection efficiency and high missed detection rate caused by mutual occlusion of artifacts in unstructured environments and few features, Zhu Kai from Shanghai Normal University proposed artifact recognition based on neural networks. The algorithm improves accuracy by optimizing the loss function, increases the feature extraction scale, and uses the SPP module (spatial pyramid pooling module) to enhance the feature extraction ability of the original model. However, artifact recognition based on artificial neural networks is completed based on training a large amount of existing data, which is time-consuming and has high requirements for hardware.
[0014] In summary, the existing technology lacks efficient and accurate identification and detection methods for flanges. Summary of the invention
[0015] The purpose of the present invention is to provide a flange identification method, which effectively solves the problem of low efficiency and low accuracy in the prior art of flange identification.
[0016] To achieve the above object of the invention, an embodiment of the present invention provides a flange identification method, which is characterized by comprising the following steps:
[0017] Collect the image of the flange in real time and obtain the average gray value of the image;
[0018] Adjust the light source intensity according to the average gray value until the average gray value of the image collected in real time is within a predetermined threshold range;
[0019] An image of a flange sample of a specific specification under the aforementioned light source intensity is collected as an ideal image;
[0020] Gamma transformation function is used to perform Gamma enhancement on the real-time collected image to obtain an enhanced image;
[0021] De-noising the enhanced image by hybrid filtering and de-noising to obtain the target image;
[0022] Matching the outer contour and hole of the flange in the target image with the outer contour and hole of the flange in the ideal image;
[0023] If the matching is successful, feedback is given that the flange is identified.
[0024] As a further improvement of an embodiment of the present invention, before the step of “capturing the image of the flange in real time and obtaining the average gray value of the image”, the following steps are further included:
[0025] Set up a predefined environment;
[0026] Place the flange in the intended environment.
[0027] As a further improvement of an embodiment of the present invention, the “setting a predetermined environment” specifically includes:
[0028] Select the green surface light source;
[0029] Set the flange background color to black;
[0030] The flange is illuminated by diffuse reflection and backlighting.
[0031] As a further improvement of an embodiment of the present invention, the “denoising the real-time acquired image by hybrid filtering denoising” specifically includes:
[0032] The part within the edge line of the collected image is filtered out by median filtering;
[0033] The edge line is subjected to median filtering to filter out noise, and the edge pixel value is replaced by the mirror pixel value inside the edge line to simulate the expansion of the part within the edge line;
[0034] Gaussian filtering is used to filter out noise from the background outside the edge line.
[0035] As a further improvement of an embodiment of the present invention, the “filtering noise of the background outside the edge line by using Gaussian filtering” further includes:
[0036] A predetermined gray value threshold is selected for filtering to separate the flange and the background in the acquired image.
[0037] As a further improvement of an embodiment of the present invention, the “selecting a predetermined gray value threshold to perform filtering to separate the flange and the background in the acquired image” is specifically:
[0038] The parameters are obtained by segmenting the edge line using the OTSU threshold method;
[0039] The parameter is set to the predetermined gray value threshold.
[0040] As a further improvement of an embodiment of the present invention, the step of “matching the outer contour and holes of the flange in the target image with the outer contour and holes of the flange in the ideal image” specifically includes:
[0041] Perform HU moment matching on the outer contour of the flange in the target image and the outer contour of the flange in the ideal image;
[0042] If the matching is successful, the holes of the flange in the target image are matched with the holes of the flange in the ideal image using SI FT feature points and the false matching points are eliminated.
[0043] As a further improvement of an embodiment of the present invention, the step of “matching the outer contour of the flange in the target image with the outer contour of the flange in the ideal image by HU moment” further includes:
[0044] If the matching fails, feedback will be given on the recognition failure and the next flange will be selected;
[0045] The image of the flange is collected in real time and the average gray value of the image is obtained.
[0046] As a further improvement of an embodiment of the present invention, the “matching the outer contour and the hole of the flange in the target image with the outer contour and the hole of the flange in the ideal image” further includes:
[0047] If the matching fails, feedback will be given on the recognition failure and the next flange will be selected;
[0048] The image of the flange is collected in real time and the average gray value of the image is obtained.
[0049] Compared with the prior art, the present invention has the following beneficial effects:
[0050] By using the flange identification method of the present invention, the identification time can be reduced and the identification efficiency is relatively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 The overall flow chart of the flange identification method provided by the present invention;
[0052] Figure 2 A flowchart of the workflow before real-time acquisition of flange images in the flange recognition method provided by the present invention;
[0053] Figure 3 A workflow diagram for setting a predetermined environment in the flange identification method provided by the present invention;
[0054] Figure 4 A flowchart of the process of reducing noise of a real-time collected image by hybrid filtering and noise reduction in the flange recognition method provided by the present invention;
[0055] Figure 5 The enhanced image and its grayscale histogram obtained by performing Gamma enhancement on the image through the Gamma function in one embodiment of the present invention;
[0056] Figure 6 Schematic diagram of a median filtering process in one embodiment of the present invention;
[0057] Figure 7 FIG. 4 is a schematic diagram of a Gaussian filter processing process in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0059] It should be noted that, unless otherwise specified, all technical and scientific terms used in this application have the same meanings as commonly understood by ordinary technicians in the technical field to which this application belongs.
[0060] In the present invention, unless otherwise specified, the directional words used, such as "up, down, top, bottom", usually refer to the directions shown in the drawings, or to the components themselves in the vertical, perpendicular or gravity directions; similarly, for ease of understanding and description, "inside and outside" refer to the inside and outside relative to the outline of each component itself, but the above-mentioned directional words are not used to limit the present invention.
[0061] In order to solve the problem that there is a lack of efficient and accurate identification and detection methods in the prior art in the process of identifying flanges, an embodiment of the present invention provides a new flange identification method.
[0062] like Figure 1 As shown, the flange identification method includes the following steps:
[0063] S10: collecting the image of the flange in real time and obtaining the average gray value of the image;
[0064] S11: adjusting the light source intensity according to the average gray value until the average gray value of the image collected in real time is within a predetermined threshold range;
[0065] S12: collecting an image of a flange sample of a specific specification under the aforementioned light source intensity as an ideal image;
[0066] S13: using a Gamma transformation function to perform Gamma enhancement on the image collected in real time to obtain an enhanced image;
[0067] S14: reducing noise on the enhanced image by hybrid filtering and noise reduction to obtain a target image;
[0068] S15: matching the outer contour and the hole of the flange in the target image with the outer contour and the hole of the flange in the ideal image;
[0069] S16: If the matching is successful, feedback is given to identify the flange.
[0070] By using the above flange identification method, the identification time can be reduced and the identification efficiency is relatively improved.
[0071] It should be noted that in an embodiment of the present invention, the flange sample of specific specifications is usually a flange that meets the product technical specification parameters or meets the process quality requirements. An image of the flange sample of specific specifications under the intensity of the light source is collected as an ideal image. The ideal image can be used as a reference image, thereby providing a good reference standard.
[0072] In this embodiment, the problem caused by light is corrected by using the Gamma transformation function. Specifically, the Gamma function is a power function that amplifies image details in a nonlinear manner, thereby correcting the problem caused by light.
[0073] Images without gamma enhancement are usually relatively dark. Figure 5 As shown, in this embodiment, the Gamma transformation makes the image tend to become brighter as a whole, but while brightening the image, the Gamma transformation also retains the image details to the maximum extent. As shown in the histogram, the grayscale values of the pixels in the bright area of the image histogram after the Gamma transformation are concentrated at (25, 100), and the grayscale values of the pixels in the original area are concentrated at (50, 125), indicating that the bright area of the image becomes brighter, while the dark areas of the two are not much different, which increases the contrast between the background and the foreground. In addition, the pixel distribution of the original grayscale image is relatively flat, while the pixel distribution of the image after the Gamma transformation is steep, the edge is relatively sharp, and the edge can be more prominent. In contrast, it is observed that after histogram equalization, its pixel distribution is more uniform, and the overall image is obviously brighter, but because the histogram equalization is to uniformly add the grayscale value of the original image pixel to each pixel, it will make it impossible to better segment the target and the background, while the grayscale value distribution of the pixel of the histogram image of the local histogram equalization is very flat, and the target texture can be better observed, but it does not emphasize the edge, which conflicts with the purpose of emphasizing the edge.
[0074] In this embodiment, the image captured by the industrial camera is usually a color image, which contains three channels. Directly using the color image for calculation will increase the time cost. The grayscale image is one-dimensional, which can reduce the computational complexity. In the present invention, the collected flange image is grayed. Commonly used image graying algorithms mainly include component method, mean method, maximum method and weighted average method. Preferably, the weighted average method used in this embodiment grays the image.
[0075] In this embodiment, the average gray value of an image refers to the sum of the gray values of all pixels in the image divided by the total number of pixels. The gray value is a quantity used to represent the brightness of a pixel, and its range is usually 0 to 255, where 0 represents black (no light) and 255 represents white (full light). For a color image, it is usually necessary to convert it into a grayscale image before calculating the average gray value. This conversion can be completed by different algorithms, such as a simple averaging method (Gray = (Red + Green + Blue) / 3) or a more complex algorithm based on the visual characteristics of the human eye.
[0076] The average gray value can be used as an indicator of the overall brightness of an image and is often used in various scenarios of image processing, including image segmentation, image enhancement, image recognition, and as a basic statistic for image analysis. For example, in some automatic exposure algorithms, the camera may use the average gray value of the scene to adjust the appropriate exposure settings. In addition, it can also help analyze image content, such as evaluating image quality, performing image comparisons, or as a preprocessing step before further image processing.
[0077] In the embodiments of the present invention, further, reference is made to Figure 2 As shown, before the "real-time acquisition of the image of the flange and obtaining the average gray value of the image", it also includes:
[0078] S01: Setting the predetermined environment;
[0079] S02: Place the flange in a predetermined environment.
[0080] By placing the flange in a predetermined environment, the image of the flange can be captured in real time and the average grayscale value of the image can be obtained. The intensity of the light source can be adjusted according to the average grayscale value until the light source shines on the flange so that the average grayscale value of the flange is within a predetermined threshold range. In this embodiment, the threshold range is usually (70, 90) and the specific value is about 77.
[0081] It can be understood that the intensity of the light source at this time will meet the detection requirements in this embodiment. Under such a light source intensity, an image of a flange sample of a specific specification is collected as an ideal image, and the ideal image can be used as a reference image to provide a reference standard.
[0082] Further, refer to Figure 3 As shown, in the embodiment of the present invention, the “setting a predetermined environment” specifically includes:
[0083] S011: Select a green surface light source;
[0084] S012: Set the background color of the flange to black;
[0085] S013: Illuminate the flange by diffuse reflection and backlighting.
[0086] In this way, the light source, background color and lighting method in the predetermined environment are defined, so that the image of the flange can be better captured.
[0087] In the embodiments of the present invention, reference Figure 4 As shown, the “denoising the real-time collected image by hybrid filtering denoising” specifically includes:
[0088] S141: Filtering the noise of the part within the edge line of the collected image by using a median filter;
[0089] S142: filtering the noise of the edge line by using a median filter, and replacing the pixel value of the edge with the mirror pixel value inside the edge line to simulate the expansion of the part inside the edge line;
[0090] S143: Filter the noise of the background outside the edge line by using Gaussian filtering.
[0091] In the present invention, the histogram is similar to the probability density function of the image. Therefore, by comparing the histogram of the ideal image and the noise probability density distribution function, it can be seen that the histogram of the ideal image mainly contains normally distributed noise and impulse noise. For this reason, we analyze the requirements of the target image:
[0092] Specifically, in order to obtain a more accurate edge, high-frequency noise is filtered out on this basis. To this end, the present invention proposes a hybrid filtering method. The steps are:
[0093] a) In the flange part (that is, the part within the edge line), we use median filtering to filter noise.
[0094] Specifically, median filtering is a nonlinear filtering that sets the pixel value to the median of all points in its neighborhood. It processes the image in the form of a scanning window, sorts the numbers within the convolution kernel coverage range by pixel value, and then takes the median to replace the position of the convolution kernel center of the original image. Let f(x,y) be the original image, and the grayscale function of the filtered image be g(x,y), and the formula is as follows:
[0095] g(x,y)=Med{f(i,j)}.
[0096] The processing process is as follows Figure 6 As shown in the figure, the filter kernel size is 3, and the pixel values in the area are sorted as follows: [56, 66, 90, 91, 93, 94, 95, 97, 101], with a median value of 93, so the center pixel value 56 is replaced by 93. It is not difficult to find that the median filter greatly reduces the blurring of details and effectively protects the edge information of the target.
[0097] b) Based on the purpose of clear edges, the problem of boundary processing is considered. The pixels at the boundary are different from the pixels inside the image. The number of edge pixels is often too small, which causes the filtering result to appear discontinuous or unnatural at the boundary. Therefore, it is necessary to fill the edge. Considering the color characteristics of the area, the reflection filling method is selected. This method performs a mirror reflection on the image around the boundary, that is, when performing median filtering, the value of the boundary pixel will be replaced with its mirror pixel value inside the image to simulate the expansion of the image.
[0098] c) For the background desktop part (that is, the part outside the edge line), we use Gaussian filtering which is more consistent with the actual noise.
[0099] Specifically, Gaussian filtering also uses neighborhood averaging to process images. When averaging an image, different weights are assigned according to the pixel positions. It is usually used to eliminate Gaussian noise in an image. Its operation is to traverse the image with a template and replace the pixel at the center of the template with the weighted average of the pixels in the template neighborhood.
[0100] Assume that the grayscale function of the filtered image is g(x,y), and the formula is as follows:
[0101]
[0102] The processing process refers to Figure 7 As shown, the pixel values in the central area are:
[0103] (40*0.05+107*0.1+25*0.05)+(198*0.1+226*0.4+223*0.1)+(37*0.05+58*0.1+193*0.05)=164.
[0104] Generally speaking, Gaussian filtering has the best filtering effect on Gaussian noise that obeys a normal distribution, but has a poor effect on salt and pepper noise, and its efficiency is not high.
[0105] In the present invention, the “filtering noise of the background outside the edge line by Gaussian filtering” also includes:
[0106] A predetermined gray value threshold is selected for filtering to separate the flange and the background in the acquired image.
[0107] Furthermore, the “selecting a predetermined gray value threshold to perform filtering to separate the flange and the background in the acquired image” is specifically:
[0108] The parameters are obtained by segmenting the edge line using the OTSU threshold method;
[0109] The parameter is set to the predetermined gray value threshold.
[0110] In the present invention, OTSU can convert the grayscale image into a binary image, and its core is to find a threshold value to divide the image into two categories: foreground and background. Through the above steps, the enhanced image is denoised to obtain the target image.
[0111] It should be noted that, in the embodiment of the invention, the step of “matching the outer contour and the hole of the flange in the target image with the outer contour and the hole of the flange in the ideal image” specifically includes the following steps:
[0112] S151: Perform HU moment matching on the outer contour of the flange in the target image and the outer contour of the flange in the ideal image; generally speaking, Hu moment matching determines whether the match is successful based on the returned value, which is usually a preset value and is generally less than 1. When the returned value is less than 1, it is considered that the outer contour of the flange in the target image and the outer contour of the flange in the ideal image can be matched, and then the process goes to step S153; and when the returned value is greater than 1, it is considered that the outer contour of the flange in the target image and the outer contour of the flange in the ideal image fail to match. If the match fails, the system can feedback the recognition failure information and select the next flange, and then refer to Figure 1 Continue with the process in .
[0113] S152: If the match is successful, the hole of the flange in the target image is matched with the hole of the flange in the ideal image by SIFT feature points (holes in this embodiment) and the mismatched points are eliminated. SIFT feature point matching is to eliminate the mismatched points and then count the number of matching points and the number of matching pairs to make a ratio. By judging this ratio, it is determined whether the match is successful. If the match is successful, the flange (such as Figure 1 If the matching fails, the system can feedback the recognition failure information and select the next flange, and then refer to Figure 1 Continue with the process in .
[0114] During the flange recognition process, the recognition part of the flange is determined according to the characteristics of the flange. Since the outer contour and the hole position cannot uniquely determine the target flange, the two matching algorithms are combined. For this, there are contour-based matching, feature point-based matching, and shape-based matching. Considering the characteristics of real-time performance and accuracy, this embodiment performs ideal image matching based on contour features and SIFT feature points, and further improves the Hu moment features of the contour, and compares them with the SIFT matching algorithm and the Hu moment matching algorithm.
[0115] The flange image acquired in real time is processed to obtain the target image, and then the target image and the ideal image are matched based on the contour feature template.
[0116] In this embodiment, the interior of the target flange is composed of two identical ellipses and circles, and their positions, inner diameters, major and minor axes, etc. need to be identified. The procedure is complicated and takes much longer time than the outer contour. Therefore, the outer contour of the flange is roughly matched first to reduce the amount of calculation. According to the comparison of the above flange matching methods, the Hu moment feature based on the contour is selected for matching to adapt to objects with changing angles.
[0117] Hu moment is a method for describing image features. It has seven invariant moment features, which can be used to describe the invariant features of image shape and set features. Its characteristics are translation, rotation and scale invariance and not easily disturbed by light. For the above cases, Hu moment is almost equal. Its formula is: For M×N two-dimensional grayscale image g(x,y), its (p+q) moment can be expressed as:
[0118]
[0119] Where p and q are equal to 0, 1, 2, ..., the corresponding (p+q) order center distance is defined as
[0120]
[0121] Where p = 0, 1, 2, ..., q = 0, 1, 2, ... Among them:
[0122]
[0123] Normalize the (p+q)-order center distance:
[0124]
[0125]
[0126] Where, p+q=2, 3... A set of 7 two-dimensional invariants can be derived from the second-order and third-order normalized center distances.
[0127] Moment invariant formula:
[0128] φ1=η20+η02
[0129] φ2=(η20-η02)2+4η121
[0130] φ3=(η30-3η12)2+(3η21-η03)2
[0131] φ4=(η30+η12)2+(η21+η03)2
[0132] φ5=(eta30-3eta12)(eta30+eta12)(eta30+eta12)2 -3(eta21+eta03)2+(3eta21-eta03)(eta21+eta03)3(eta30+eta12)2-(eta21+eta03)2
[0133] φ6=(η20-η02)(η30+η12)2-(η21+η03)2+4η11(η30+η12)(η21+η03)
[0134] φ7=3(eta21-eta03)(eta30+eta12)(eta30+eta12)2 -3(eta21+eta03)2+(3eta21-eta03)(eta21+eta03)3(eta30+eta12)2-(eta21+eta03)2
[0135] By definition, the values of this set of moments are invariant to translation, scaling, mirroring (within the minus sign), and rotation. If physical meanings are attached to these low-order moment invariants, the physical meanings from the first invariant moment to the seventh invariant moment are:
[0136] Invariant Moment 1: describes the size of the image.
[0137] Invariant Moment 2: describes the shape of the image and is independent of the scale of the image.
[0138] Invariant Moment 3: describes the shape of the image and is independent of the scale of the image.
[0139] Invariant Moment 4: describes the shape and rotation of an image and is independent of the image's scale.
[0140] Invariant Moment 5: describes the shape and rotation of an image and is independent of the image's scale.
[0141] Invariant Moment 6: describes the shape of an image and is independent of the scaling and rotation of the image.
[0142] Invariant Moment 7: describes the shape of an image and is independent of the scaling and rotation of the image.
[0143] The steps of Hu matching are:
[0144] (1) Read the flange template image and a to-be-matched image, pre-process these images and perform threshold segmentation and contour extraction. The template image only takes the outer contour, while the to-be-matched image takes all contours.
[0145] (2) Then the template contour is calculated and its geometric moment (mpq), center distance (μpq) and normalized moment (ηpq) are output.
[0146] (3) Substitute these three values into the above formula to calculate the Hu moment of the two images.
[0147] (4) Compare the Hu moment of the template image with the Hu moment of each contour of the image to be matched through matchShape.
[0148] (5) Set a threshold and make a threshold judgment on the difference value. When two contours are similar, the difference between their Hu moments will be small. In order to reduce the dynamic range, the formula is used to simplify it. Scale each value.
[0149] In this embodiment, when executing steps S151 and / or S152, any step matching failure means that the matching fails when "matching the outer contour and hole of the flange in the target image with the outer contour and hole of the flange in the ideal image". When the matching fails, the system feeds back recognition failure information and selects the next flange; the image of the flange is collected in real time and the average gray value of the image is obtained, and then according to Figure 1 Continue with the process described in .
[0150] In summary, the embodiments of the present invention bring the following technical effects:
[0151] By using the above flange identification method, the identification time can be reduced and the identification efficiency is relatively improved.
[0152] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0153] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A flange identification method, characterized in that: The steps include: Collect the image of the flange in real time and obtain the average gray value of the image; Adjust the light source intensity according to the average gray value until the average gray value of the image collected in real time is within a predetermined threshold range; An image of a flange sample of a specific specification under the aforementioned light source intensity is collected as an ideal image; Gamma transformation function is used to perform Gamma enhancement on the real-time collected image to obtain an enhanced image; De-noising the enhanced image by hybrid filtering and de-noising to obtain the target image; Matching the outer contour and hole of the flange in the target image with the outer contour and hole of the flange in the ideal image; If the matching is successful, feedback is given that the flange is identified.
2. The flange identification method according to claim 1, characterized in that: Before the "real-time acquisition of the image of the flange and obtaining the average gray value of the image", the method further includes: Set up a predefined environment; Place the flange in the intended environment.
3. The flange identification method according to claim 2, characterized in that: The “setting a predetermined environment” specifically includes: Select the green surface light source; Set the flange background color to black; The flange is illuminated by diffuse reflection and backlighting.
4. The flange identification method according to claim 1, characterized in that: The “denoising the real-time acquired image by hybrid filtering denoising” specifically includes: The part within the edge line of the collected image is filtered out by median filtering; The edge line is subjected to median filtering to filter out noise, and the edge pixel value is replaced by the mirror pixel value inside the edge line to simulate the expansion of the part within the edge line; Gaussian filtering is used to filter out noise from the background outside the edge line.
5. The flange identification method according to claim 4, characterized in that: The "filtering noise by Gaussian filtering the background outside the edge line" also includes: A predetermined gray value threshold is selected for filtering to separate the flange and the background in the acquired image.
6. The flange identification method according to claim 5, characterized in that: The "selecting a predetermined gray value threshold to perform filtering to separate the flange and the background in the acquired image" is specifically: The parameters are obtained by segmenting the edge line using the OTSU threshold method; The parameter is set to the predetermined gray value threshold.
7. The flange identification method according to claim 1, characterized in that: The “matching the outer contour and holes of the flange in the target image with the outer contour and holes of the flange in the ideal image” specifically includes: Perform HU moment matching on the outer contour of the flange in the target image and the outer contour of the flange in the ideal image; If the match is successful, the holes of the flange in the target image are matched with the holes of the flange in the ideal image using SIFT feature points and the mismatched points are eliminated.
8. The flange identification method according to claim 7, characterized in that: The “matching the outer contour of the flange in the target image with the outer contour of the flange in the ideal image by HU moment” also includes: If the matching fails, feedback will be given on the recognition failure and the next flange will be selected; The image of the flange is collected in real time and the average gray value of the image is obtained.
9. The flange identification method according to claim 1, characterized in that: The “matching the outer contour and holes of the flange in the target image with the outer contour and holes of the flange in the ideal image” also includes: If the matching fails, feedback will be given on the recognition failure and the next flange will be selected; The image of the flange is collected in real time and the average gray value of the image is obtained.
