A method for oil seal quality detection based on image processing
By dividing the grayscale image of the oil seal into blocks, calculating the regional characteristics and approximate related sequences, obtaining dirt, and using image processing methods for threshold segmentation, the problem that traditional methods cannot accurately detect dirt in oil seals is solved, and the oil seal quality detection is achieved Accuracy and efficiency.
Patent Information
- Application Number
- CN202410837545.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The traditional single threshold segmentation method cannot accurately separate out the dirty or wear areas on the surface of the oil seal, resulting in the inability to effectively detect the quality of the oil seal, affecting the normal operation of mechanical components.
Using an image-based processing method, by dividing the oil-sealed grayscale image into blocks, obtaining the region feature value and approximate region correlation sequence of each block, calculate the gradient difference value and Euclidean distance of pixel points, and obtaining each pixel of each block. The dirtiness of the point is and threshold segmented by enhancing the image to accurately segment the dirty area.
Accurate detection of dirty areas on the surface of the oil seal is achieved, the contrast of images is enhanced, the impact of texture on detection is eliminated, and the problem of being unable to divide precise dirty areas directly using a single threshold segmentation.
Smart Images

Figure CN118396999B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and more specifically, to an oil seal quality detection method based on image processing. Background Art
[0002] An oil seal is a sealing device used in mechanical equipment, usually installed on a rotating shaft. Its main function is to prevent lubricating oil or grease from leaking from the moving parts of the mechanical equipment and to prevent external contaminants from entering the interior of the equipment. When dirt, wear and other defects appear on the oil seal, the aging of the oil seal will be accelerated, which may cause the oil seal to be loosely sealed when used. Therefore, low-quality oil seals may not be able to effectively prevent lubricating oil leakage, thereby affecting the normal operation of mechanical parts. Therefore, it is particularly important to detect the quality of oil seals. The oil seal quality detection method based on image processing can achieve fast and efficient oil seal quality detection, which is beneficial to improving the production efficiency and quality management level of oil seals and reducing the rate of unqualified products.
[0003] It is known that there is texture on the surface of the oil seal to increase friction. Therefore, due to the existence of the texture, the grayscale of the oil seal surface is not uniform. Therefore, using a traditional single threshold segmentation method, such as Otsu threshold segmentation, cannot accurately segment out the dirt or wear on the oil seal surface. Summary of the invention
[0004] In order to solve one or more of the above technical problems, the present invention proposes an oil seal quality detection method based on image processing, which comprises the following steps:
[0005] Collect grayscale images of oil seals;
[0006] The grayscale image of the oil seal is divided into blocks; the regional feature value of each block is obtained according to the grayscale value of the pixel in the block; the approximate area of each pixel in each block is obtained according to the neighborhood pixel of the pixel in the block; the approximate correlation value between the pixels is obtained according to the gradient difference and Euclidean distance between the pixels in each block, and the pixels in each block are arranged according to the approximate correlation value between the pixels to obtain the approximate correlation sequence of each block; the approximate correlation value between the pixels in the approximate area of each pixel in each block is obtained according to the gradient difference and Euclidean distance between the pixels in the approximate area of each pixel in each block, and the pixels in the approximate area of each pixel in each block are arranged according to the approximate correlation value between the pixels in the approximate area of each pixel in each block to obtain the approximate area correlation sequence of each pixel in each block;
[0007] According to the gradient value and the gradient angle of the pixel point and the approximate regional correlation sequence of each pixel point of each block, the relevant features of each pixel point in the approximate regional correlation sequence of each pixel point of each block are obtained; according to the relevant features of each pixel point in the approximate regional correlation sequence of each pixel point of each block, the approximate correlation sequence of each block and the regional feature value of each block, the difference degree of each pixel point of each block is obtained;
[0008] According to the difference of each pixel point of each block, the dirtiness of each pixel point of each block is obtained; according to the dirtiness of each pixel point of each block, an oil seal enhanced image is obtained, and the oil seal enhanced image is threshold segmented to obtain a dirty area.
[0009] Preferably, dividing the oil seal grayscale image into blocks includes:
[0010] The side length of the preset block is a, the center point of the oil seal grayscale image is obtained, a block is constructed with the center point as the central pixel point of a block, recorded as the central block, and the oil seal grayscale image is divided into blocks by spreading outward from the central block. When the pixel points at the edge of the oil seal grayscale image are not enough to constitute a When the block of a is reached, stop dividing the blocks and get several blocks.
[0011] Preferably, the regional characteristic value of each block is obtained according to the gray value of the pixel points in the block, and the calculation formula is:
[0012] ;
[0013] In the formula, Represents the gray value variance of all pixels in the i-th block; Represents the mean gray value of all pixels in the i-th block; Represents the regional feature value of the i-th block.
[0014] Preferably, the step of obtaining the approximate area of each pixel point in each block according to the neighboring pixel points of the pixel point in the block includes:
[0015] The area formed by the j-th pixel of the ith block and the eight neighboring pixels of the j-th pixel is recorded as the approximate area of the j-th pixel of the ith block, and the approximate area of each pixel of each block is obtained.
[0016] Preferably, the method of obtaining the approximate correlation value between the pixels according to the gradient difference and the Euclidean distance between the pixels in each block, arranging the pixels in each block according to the approximate correlation value between the pixels, and obtaining the approximate correlation sequence of each block includes:
[0017] Any pixel in the ith block is recorded as the first pixel and marked. The product of the absolute value of the gradient difference between the first pixel and each other unmarked pixel in the ith block and the Euclidean distance is obtained as the approximate correlation value between the first pixel and each other unmarked pixel in the ith block, and the unmarked pixel corresponding to the smallest approximate correlation value is taken as the second pixel and marked. The approximate correlation value of each other unmarked pixel in the i-th block is obtained, and the unmarked pixel corresponding to the smallest approximate correlation value is taken as the third pixel and marked; and so on, until all the pixels in the i-th block are marked, then stop and get the S-th pixel, where S represents the number of pixels in the i-th block; the pixels in the i-th block are arranged in the marking order to form the approximate correlation sequence of the i-th block;
[0018] Get the approximate correlation sequence for each block.
[0019] Preferably, the method of obtaining the approximate correlation value between the pixels in the approximate area of each pixel point of each block according to the gradient difference and the Euclidean distance between the pixels in the approximate area of each pixel point of each block, and arranging the pixels in the approximate area of each pixel point of each block according to the approximate correlation value between the pixels in the approximate area of each pixel point of each block to obtain the approximate area correlation sequence of each pixel point of each block includes:
[0020] The j-th pixel of the ith block is recorded as the first starting pixel and marked, and the approximate correlation value between the first starting pixel and each other unmarked pixel in the approximate area of the j-th pixel of the ith block is obtained, and the unmarked pixel in the approximate area of the j-th pixel of the ith block corresponding to the smallest approximate correlation value is taken as the second starting pixel and marked; the approximate correlation value between the second starting pixel and each other unmarked pixel in the approximate area of the j-th pixel of the ith block is obtained, and the unmarked pixel in the approximate area of the j-th pixel of the ith block corresponding to the smallest approximate correlation value is taken as the third starting pixel and marked; and so on, until all the pixels in the approximate area of the j-th pixel of the ith block are marked, and the M-th starting pixel is obtained, where M represents the number of pixels in the approximate area of the j-th pixel of the ith block; the pixels in the approximate area of the j-th pixel of the ith block are arranged in the marking order to form a correlation sequence of the approximate area of the j-th pixel of the ith block;
[0021] Get the approximate region correlation sequence of each pixel of each block.
[0022] Preferably, the calculation formula for obtaining the correlation features of each pixel in the approximate region correlation sequence of each pixel in each block is as follows:
[0023] ;
[0024] In the formula, Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the gradient value of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; Represents the gradient angle of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; norm() represents the linear normalization function.
[0025] Preferably, the difference of each pixel point in each block is obtained according to the correlation feature of each pixel point in the approximate regional correlation sequence of each pixel point in each block, the approximate correlation sequence of each block and the regional feature value of each block, and the calculation formula is:
[0026] ;
[0027] In the formula, Represents the difference of the jth pixel in the i-th block; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; represents the regional feature value of the block where the p-th pixel point in the approximate regional correlation sequence of the j-th pixel point of the i-th block is located; n represents the number of pixels in the approximate regional correlation sequence of the j-th pixel point of the i-th block; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel adjacent to the left of the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel on the left in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; Represents the absolute value symbol.
[0028] Preferably, obtaining the dirtiness of each pixel point in each block according to the difference of each pixel point in each block includes:
[0029] Obtain the central pixel point of the grayscale image of the oil seal, record the pixel points symmetrical to the central pixel point of each pixel point of each block as the central symmetrical pixel point of each pixel point of each block, and for each pixel point in the approximate area of the central symmetrical pixel point of each pixel point of each block, obtain each pixel point symmetrical to the central pixel point to obtain the central symmetrical pixel point of each pixel point in the related sequence of the approximate area of each pixel point of each block;
[0030] The pixel points in the approximate region correlation sequence of each pixel point of each block are numbered in sequence order to obtain the position sequence number of each pixel point in the approximate region correlation sequence of each pixel point of each block;
[0031] The calculation formula for obtaining the dirtiness of each pixel of each block is:
[0032] ;
[0033] In the formula, Represents the dirtiness of the jth pixel in the i-th block; Represents the difference between the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; Represents the position number of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the absolute value symbol; The difference between the central symmetric pixel of the p-th pixel in the approximate region correlation sequence representing the j-th pixel of the ith block; represents the position number of the central symmetric pixel of the pth pixel in the approximate region correlation sequence of the jth pixel of the ith block; n represents the number of pixels in the approximate region correlation sequence of the jth pixel of the ith block.
[0034] Preferably, the step of acquiring the oil seal enhanced image according to the dirtiness of each pixel point of each block, and performing threshold segmentation on the oil seal enhanced image to obtain the dirty area includes:
[0035] The product of the dirtiness and gray value of each pixel point in each block of the oil seal grayscale image is rounded up as the updated grayscale value of each pixel point to obtain the oil seal enhanced image. The oil seal enhanced image is segmented using the Otsu threshold method, and the pixels greater than the segmentation threshold are analyzed for connected domains. The connected areas obtained are recorded as dirty areas.
[0036] The present invention has the following beneficial effects: the present invention first divides the oil seal grayscale image into blocks; analyzes the characteristics of the normal area and the dirty area of the oil seal image to obtain the dirtiness of each pixel point of each block, the larger the dirtiness, the more likely the pixel point is a pixel point in the dirty area; then the grayscale value of each pixel point in the image is updated by the dirtiness of each pixel point of each block, so as to enhance the contrast between the dirty area and the textures of other areas, eliminate the influence of the texture on the dirt detection, enhance the dirt display effect of the image, and finally use the Otsu method threshold segmentation to obtain the accurate dirty area, thereby avoiding the problem that the accurate dirty area cannot be segmented by directly using a single threshold segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0038] Figure 1 is a flowchart of the steps of an oil seal quality detection method based on image processing according to an embodiment of the present invention;
[0039] Figure 2 Representative block diagram. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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.
[0041] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0042] See also Figure 1 , which shows a flowchart of a method for detecting oil seal quality based on image processing provided by an embodiment of the present invention, the method comprising the following steps:
[0043] S001. Collect grayscale image of oil seal.
[0044] In an embodiment of the present invention, an industrial camera is used to photograph the surface of the oil seal and is aimed directly above the surface of the oil seal to obtain an oil seal surface image. To facilitate subsequent processing, the oil seal surface image is grayed to obtain an oil seal grayscale image.
[0045] S002. Divide the oil seal grayscale image into several blocks, and obtain the regional feature value of each block.
[0046] It should be noted that, since the texture of the oil seal surface is centrosymmetric, in the embodiment of the present invention, the oil seal image may be divided into blocks according to the center point of the oil seal grayscale image.
[0047] In the embodiment of the present invention, the side length of the preset block is a, the center point of the oil seal grayscale image is obtained, a block is constructed with the center point as the central pixel point of a block, which is recorded as the central block, and the oil seal grayscale image is divided into blocks by spreading outward from the central block. When the pixel points at the edge of the oil seal grayscale image are not enough to constitute a When the block a is reached, the block division stops and several blocks are obtained. It should be noted that the schematic diagram of dividing the oil seal grayscale image into blocks by spreading outward from the central block is shown in FIG. Figure 2 In the embodiment of the present invention, the side length of the preset block is a=9. In other embodiments, the implementer can set the value of a according to the specific implementation situation.
[0048] It should be noted that the grayscale value of the block where the oil seal surface is dirty is relatively large, and the dirt is random, which makes the grayscale value of the pixel points in the block where the dirt is located relatively chaotic. Therefore, the present invention obtains the regional characteristic value of each block according to the grayscale mean and variance of the pixel points in each block, which is used to indicate the possibility of the existence of dirt influence in the block.
[0049] Get the regional feature values for each block:
[0050] ;
[0051] In the formula, Represents the gray value variance of all pixels in the i-th block; Represents the mean gray value of all pixels in the i-th block; Represents the regional characteristic value of the ith block; when the grayscale mean of all pixels in the ith block is larger and the grayscale value variance of all pixels in the ith block is larger, the regional characteristic value of the ith block is larger, and the possibility of dirty pixels in the ith block is greater.
[0052] S003. Obtain an approximate region of each pixel point of each block, arrange the pixels in each block according to the approximate correlation value between the pixels in each block, obtain an approximate correlation sequence of each block and an approximate region correlation sequence of each pixel point of each block, and obtain the difference of each pixel point of each block according to the approximate correlation sequence of each block, the region feature value of each block and the approximate region correlation sequence of each pixel point of each block.
[0053] It should be noted that it is known that when there is no dirt in the grayscale image of the oil seal, the grayscale values of each pixel are more similar, and the grayscale value of each pixel is most similar to that of its neighboring pixels. Therefore, when there is dirt, the dirt will destroy the grayscale approximation characteristics of the pixel and its neighboring pixels. Therefore, it is convenient for the subsequent analysis of the stolen pixels to first obtain the approximate area of each pixel of each block.
[0054] The area formed by the jth pixel of the ith block and the eight neighboring pixels of the jth pixel is recorded as the approximate area of the jth pixel of the ith block. Similarly, the approximate area of each pixel of each block is obtained.
[0055] It should be noted that it is known that when there is no dirt, the grayscale state of each pixel in the grayscale image of the oil seal is highly similar, among which the pixel and its neighboring pixel have the highest similarity. When there is dirt, the dirt will destroy the approximate characteristics of the pixel. Since there is a certain texture on the oil seal, when there is no dirt, the more similar the gradient value between the pixels and the closer the position between the pixels, the closer the pixels are. Therefore, according to the gradient value difference and the Euclidean distance between the pixels, the approximate correlation value between the pixels in each block is obtained, and the pixels in each block are sorted to form an approximate correlation sequence of each block; the approximate correlation value between the pixels in the approximate area of each pixel of each block is obtained, and the pixels in the approximate area of each pixel of each block are sorted to obtain the approximate correlation area sequence of each pixel of each block.
[0056] In an embodiment of the present invention, any pixel point in the ith block is recorded as the first pixel point and marked, the product of the absolute value of the gradient difference between the first pixel point and each other unmarked pixel point in the ith block and the Euclidean distance is obtained as the approximate correlation value between the first pixel point and each other unmarked pixel point in the ith block, and the unmarked pixel point corresponding to the minimum approximate correlation value is taken as the second pixel point and marked; the approximate correlation value between the second pixel point and each other unmarked pixel point in the ith block is obtained, and the unmarked pixel point corresponding to the minimum approximate correlation value is taken as the third pixel point and marked; and so on, until all the pixels in the ith block are marked, the Sth pixel point is obtained, and S represents the number of pixels in the ith block; the pixels in the ith block are arranged in the marking order to form an approximate correlation sequence of the ith block.
[0057] Similarly, the approximate correlation sequence of each block is obtained.
[0058] Obtain the approximate region correlation sequence of each pixel point of each block: record the jth pixel point of the ith block as the first starting pixel point and mark it, obtain the approximate correlation value between the first starting pixel point and each other unmarked pixel point in the approximate region of the jth pixel point of the ith block, and use the unmarked pixel point in the approximate region of the jth pixel point of the ith block corresponding to the smallest approximate correlation value as the second starting pixel point and mark it; obtain the approximate correlation value between the second starting pixel point and each other unmarked pixel point in the approximate region of the jth pixel point of the ith block, and use the unmarked pixel point in the approximate region of the jth pixel point of the ith block corresponding to the smallest approximate correlation value as the third starting pixel point and mark it; and so on, until all the pixels in the approximate region of the jth pixel point of the ith block are marked, then stop, and obtain the Mth starting pixel point, where M represents the number of pixels in the approximate region of the jth pixel point of the ith block; arrange the pixels in the approximate region of the jth pixel point of the ith block in the marking order to form the approximate region correlation sequence of the jth pixel point of the ith block.
[0059] It should be noted that the above steps obtain the approximate regional correlation sequence of each pixel point of each block. First, according to the gradient value and gradient angle of the pixel point, the relevant features of each pixel point in the approximate regional correlation sequence of each pixel point of each block are obtained. Since adjacent pixels in the approximate regional correlation sequence are relatively similar, the smaller the difference in the relevant features between adjacent pixels in the approximate regional correlation sequence of each pixel point of each block, the more likely the pixel point is to be a normal pixel point. The larger the difference in the relevant features between adjacent pixels in the approximate regional correlation sequence of each pixel point of each block, the more likely the pixel point is to be a dirty pixel point.
[0060] Get the correlation features of each pixel in the approximate region correlation sequence of each pixel of each block:
[0061] ;
[0062] In the formula, Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the gradient value of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; Represents the gradient angle of the p-th pixel in the approximate region correlation sequence of the j-th pixel in the ith block; norm() represents the linear normalization function, and the normalized object is the gradient angle of all pixels in the approximate region correlation sequence of the j-th pixel in the ith block.
[0063] Get the difference of each pixel in each block:
[0064] ;
[0065] In the formula, Represents the difference of the jth pixel in the i-th block; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; represents the regional feature value of the block where the p-th pixel point in the approximate regional correlation sequence of the j-th pixel point of the i-th block is located; n represents the number of pixels in the approximate regional correlation sequence of the j-th pixel point of the i-th block; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel adjacent to the left of the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel on the left in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; represents the absolute value symbol; when the number of pixels adjacent to the jth pixel in the approximate correlation sequence of the i-th block is 1, according to formula (2) The value of It reflects the deviation between the corresponding pixels with the same serial number in the approximate area correlation sequence of approximate pixels. The larger the value, the greater the possibility of contamination. The larger the value of , the more likely the j-th pixel in the ith block is to be a dirty pixel.
[0066] S004. According to the difference of each pixel point of each block, the dirtiness of each pixel point of each block is obtained to enhance the oil seal grayscale image to obtain an oil seal enhanced image, and the oil seal enhanced image is segmented by threshold value to obtain a dirty area.
[0067] It should be noted that, in step S003, the difference of each pixel point of each block is obtained through the approximate relationship of the pixels in the block. The larger the difference, the more likely the pixel point is to be a dirty pixel point. However, it is inaccurate to measure the influence of dirt on the pixel point only based on the difference. Therefore, the present invention takes into account that the oil seal grayscale image is symmetrical about the center. Therefore, when there is no dirty area in the oil seal grayscale image, the grayscale features of each pixel point in the oil seal grayscale image and the pixel point at the corresponding position of its center are unified. Because dirt is random, the features of the pixel points affected by dirt are random. In order to make the result more accurate, the dirtiness of each pixel point is further judged by the correlation between each pixel point in the oil seal grayscale image and the pixel point at the central symmetrical position.
[0068] In an embodiment of the present invention, the central pixel point of the oil seal grayscale image is obtained, and the pixel points symmetrical to the central pixel point of each pixel point of each block are recorded as the central symmetric pixel points of each pixel point of each block. For each pixel point in the approximate area of the central symmetric pixel point of each pixel point of each block, each pixel point symmetrical to the central pixel point is obtained to obtain the central symmetric pixel point of each pixel point in the approximate area related sequence of each pixel point of each block.
[0069] The pixel points in the approximate region correlation sequence of each pixel point of each block are numbered in sequence order to obtain the position serial number of each pixel point in the approximate region correlation sequence of each pixel point of each block.
[0070] Get the dirtiness of each pixel in each block:
[0071] ;
[0072] In the formula, Represents the dirtiness of the jth pixel in the i-th block; Represents the difference between the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; Represents the position number of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the absolute value symbol; The difference between the central symmetric pixel of the p-th pixel in the approximate region correlation sequence representing the j-th pixel of the ith block; represents the position number of the central symmetric pixel of the pth pixel in the approximate region correlation sequence of the jth pixel of the ith block; n represents the number of pixels in the approximate region correlation sequence of the jth pixel of the ith block; The larger the value of , the more likely it is that the pixel point has different characteristics from its central symmetric pixel point, which means that the j-th pixel point in the i-th block is more likely to be a dirty pixel point.
[0073] The product of the dirtiness and gray value of each pixel point in each block of the oil seal grayscale image is rounded up and used as the updated grayscale value of each pixel point to obtain the oil seal enhanced image. The oil seal enhanced image is segmented using the Otsu threshold method, and the pixels greater than the segmentation threshold are analyzed for connected domains. The connected areas obtained are recorded as dirty areas.
[0074] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An oil seal quality detection method based on image processing, characterized in that: include: Collect grayscale images of oil seals; Divide the oil seal grayscale image into blocks; According to the gray value of the pixel in the block, the regional feature value of each block is obtained, and the calculation formula is: ; In the formula, Represents the gray value variance of all pixels in the i-th block; Represents the mean gray value of all pixels in the i-th block; Representing the regional feature value of the i-th block; obtaining the approximate region of each pixel of each block according to the neighborhood pixel points of the pixel point in the block; obtaining the approximate correlation value between the pixels according to the gradient difference and Euclidean distance between the pixels in each block, arranging the pixels in each block according to the approximate correlation value between the pixels, and obtaining the approximate correlation sequence of each block; obtaining the approximate correlation value between the pixels in the approximate region of each pixel of each block according to the gradient difference and Euclidean distance between the pixels in the approximate region of each pixel of each block, and arranging the pixels in the approximate region of each pixel of each block according to the approximate correlation value between the pixels in the approximate region of each pixel of each block, and obtaining the approximate region correlation sequence of each pixel of each block; According to the gradient value and gradient angle of the pixel point and the approximate region correlation sequence of each pixel point of each block, the relevant features of each pixel point in the approximate region correlation sequence of each pixel point of each block are obtained. The calculation formula is: ; In the formula, Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the gradient value of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; represents the gradient angle of the pth pixel in the approximate regional correlation sequence of the jth pixel of the ith block; norm() represents the linear normalization function; according to the correlation features of each pixel in the approximate regional correlation sequence of each pixel of each block, the approximate correlation sequence of each block and the regional feature value of each block, the difference of each pixel of each block is obtained, and the calculation formula is: ; In the formula, Represents the difference of the jth pixel in the i-th block; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; represents the regional feature value of the block where the p-th pixel point in the approximate regional correlation sequence of the j-th pixel point of the i-th block is located; n represents the number of pixels in the approximate regional correlation sequence of the j-th pixel point of the i-th block; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel adjacent to the left of the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel on the left in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate regional correlation sequence of the pixel right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels right adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; Represents the correlation feature of the p-th pixel in the approximate region correlation sequence of pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block; Represents the regional feature value of the block where the p-th pixel in the approximate regional correlation sequence of the pixels adjacent to the j-th pixel in the approximate correlation sequence of the i-th block is located; represents the absolute value symbol; when the number of pixels adjacent to the jth pixel in the approximate correlation sequence of the i-th block is 1, according to formula (2) The value of According to the difference of each pixel point of each block, the dirtiness of each pixel point of each block is obtained, including: Obtain the central pixel point of the oil seal grayscale image, and record the pixel points symmetrical about the central pixel point of each pixel point of each block as the central symmetrical pixel points of each pixel point of each block; Obtain each pixel point in the approximate region correlation sequence of each pixel point of each block, each pixel point in the approximate region correlation sequence of each pixel point of each block being symmetrical about the central pixel point, and obtain the central symmetrical pixel point of each pixel point in the approximate region correlation sequence of each pixel point of each block; The pixel points in the approximate region correlation sequence of each pixel point of each block are numbered in sequence order to obtain the position sequence number of each pixel point in the approximate region correlation sequence of each pixel point of each block; The calculation formula for obtaining the dirtiness of each pixel of each block is: ; In the formula, Represents the dirtiness of the jth pixel in the i-th block; Represents the difference between the p-th pixel in the approximate region correlation sequence of the j-th pixel of the ith block; Represents the position number of the p-th pixel in the approximate region correlation sequence of the j-th pixel of the i-th block; Represents the absolute value symbol; The difference between the central symmetric pixel of the p-th pixel in the approximate region correlation sequence representing the j-th pixel of the ith block; represents the position number of the central symmetric pixel of the pth pixel in the approximate region correlation sequence of the jth pixel of the ith block; n represents the number of pixels in the approximate region correlation sequence of the jth pixel of the ith block; according to the dirtiness of each pixel of each block, the oil seal enhanced image is obtained, and the oil seal enhanced image is threshold segmented to obtain the dirty area, including: The product of the dirtiness and gray value of each pixel point in each block of the oil seal grayscale image is rounded up as the updated grayscale value of each pixel point to obtain the oil seal enhanced image. The oil seal enhanced image is segmented using the Otsu threshold method, and the pixels greater than the segmentation threshold are analyzed for connected domains. The connected areas obtained are recorded as dirty areas.
2. The oil seal quality detection method based on image processing according to claim 1 is characterized in that: The step of dividing the oil seal grayscale image into blocks includes: The side length of the preset block is a, the center point of the oil seal grayscale image is obtained, a block is constructed with the center point as the central pixel point of a block, recorded as the central block, and the oil seal grayscale image is divided into blocks by spreading outward from the central block. When the pixel points at the edge of the oil seal grayscale image are not enough to constitute a When the block of a is reached, stop dividing the blocks and get several blocks.
3. The oil seal quality detection method based on image processing according to claim 1 is characterized in that: The step of obtaining an approximate area of each pixel point of each block according to the neighboring pixel points of the pixel point in the block includes: The area formed by the j-th pixel of the ith block and the eight neighboring pixels of the j-th pixel is recorded as the approximate area of the j-th pixel of the ith block, and the approximate area of each pixel of each block is obtained.
4. The oil seal quality detection method based on image processing according to claim 1 is characterized in that: The method of obtaining an approximate correlation value between pixels according to the gradient difference and the Euclidean distance between the pixels in each block, arranging the pixels in each block according to the approximate correlation value between the pixels, and obtaining an approximate correlation sequence for each block includes: Any pixel in the ith block is recorded as the first pixel and marked. The product of the absolute value of the gradient difference between the first pixel and each other unmarked pixel in the ith block and the Euclidean distance is obtained as the approximate correlation value between the first pixel and each other unmarked pixel in the ith block, and the unmarked pixel corresponding to the smallest approximate correlation value is taken as the second pixel and marked. The approximate correlation value of each other unmarked pixel in the i-th block is obtained, and the unmarked pixel corresponding to the smallest approximate correlation value is taken as the third pixel and marked; and so on, until all the pixels in the i-th block are marked, then stop and get the S-th pixel, where S represents the number of pixels in the i-th block; the pixels in the i-th block are arranged in the marking order to form the approximate correlation sequence of the i-th block; Get the approximate correlation sequence for each block.
5. The oil seal quality detection method based on image processing according to claim 4 is characterized in that: The method of obtaining an approximate correlation value between pixels in the approximate area of each pixel point of each block according to the gradient difference and the Euclidean distance between pixels in the approximate area of each pixel point of each block, and arranging the pixels in the approximate area of each pixel point of each block according to the approximate correlation value between pixels in the approximate area of each pixel point of each block to obtain a correlation sequence of the approximate area of each pixel point of each block includes: The j-th pixel of the ith block is recorded as the first starting pixel and marked, and the approximate correlation value between the first starting pixel and each other unmarked pixel in the approximate area of the j-th pixel of the ith block is obtained, and the unmarked pixel in the approximate area of the j-th pixel of the ith block corresponding to the smallest approximate correlation value is taken as the second starting pixel and marked; the approximate correlation value between the second starting pixel and each other unmarked pixel in the approximate area of the j-th pixel of the ith block is obtained, and the unmarked pixel in the approximate area of the j-th pixel of the ith block corresponding to the smallest approximate correlation value is taken as the third starting pixel and marked; and so on, until all the pixels in the approximate area of the j-th pixel of the ith block are marked, and the M-th starting pixel is obtained, where M represents the number of pixels in the approximate area of the j-th pixel of the ith block; the pixels in the approximate area of the j-th pixel of the ith block are arranged in the marking order to form a correlation sequence of the approximate area of the j-th pixel of the ith block; Get the approximate region correlation sequence of each pixel of each block.
Citation Information
Patent Citations
Display image quality enhancement method
CN117274114A
Autoclaved concrete plate quality rapid detection method based on artificial intelligence
CN117934452A
Film bubble detection method and system based on machine vision
CN117952959A
Oil seal thermal stability detection method based on data processing
CN118090808A
Image processing method for direction dependent low pass filtering
US7016549B1
