A visually assisted green and environmentally friendly lubricant quality detection method

By constructing multiple neighborhood scales and calculating local texture weights in lubricating oil detection, the detection error caused by light reflection of lubricating oil is solved and the accuracy of green lubricating oil quality detection is improved.

CN118096849BActive Publication Date: 2024-09-06KASONG SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410508954.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-26
Publication Date
2024-09-06
Estimated Expiration
2044-04-26

AI Technical Summary

Technical Problem

The light reflection of lubricating oil causes the local texture information of normal pixels and impurity pixels to be similar, which reduces the accuracy of green lubricating oil quality detection.

Method used

By setting multiple neighborhood scales, a neighborhood window is constructed for each pixel, local texture information is obtained, the local texture weight and credibility of each pixel are calculated, and the final texture information is obtained to judge lubricant quality.

Benefits of technology

The accuracy of the detection results is improved, impurity pixels are accurately identified, misidentifications are reduced, and the credibility of the detection is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118096849B
    Figure CN118096849B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and specifically to a visually assisted green environmentally friendly lubricant quality detection method, comprising: obtaining an image to be detected of the green environmentally friendly lubricant; setting multiple neighborhood scales, and obtaining the local texture information of each pixel point at each neighborhood scale and the possibility that each pixel point is an impurity according to the grayscale value of each pixel point in the image to be detected; obtaining the impurity pixel points in the image to be detected according to the local texture information of each pixel point at each neighborhood scale, the gradient value of each pixel point and the possibility that it is an impurity, and completing the quality detection result of the lubricant. The present invention obtains the final texture information of each pixel point through the local texture information of the pixel point at multiple neighborhood scales, so that the final texture information of each pixel point is closer to the actual situation, thereby making the obtained impurity pixel points more precise and making the detection result more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a visually assisted green and environmentally friendly lubricant quality detection method. Background Art

[0002] In today's industrial production process, manual inspection of products is time-consuming and laborious, and the inspection results are highly subjective and random. Visually assisted quality inspection of industrial products can greatly improve the efficiency and accuracy of quality inspection. Therefore, this method acquires product images and uses image processing algorithms to process and analyze the acquired product images to determine whether the product quality meets the requirements.

[0003] However, because the lubricant itself reflects light, some normal pixels have local texture information similar to that of impurity pixels. When the coding is used to detect the quality of green and environmentally friendly lubricants, some normal pixels may be identified as impurity pixels, which reduces the accuracy of the quality detection results of the green and environmentally friendly lubricants. Summary of the invention

[0004] The invention provides a visually assisted green and environmentally friendly lubricating oil quality detection method to solve the existing problems.

[0005] A visually assisted green and environmentally friendly lubricant quality detection method of the present invention adopts the following technical solution:

[0006] An embodiment of the present invention provides a visually assisted green and environmentally friendly lubricant quality detection method, the method comprising the following steps:

[0007] Setting multiple neighborhood scales, constructing a neighborhood window of each pixel point at each neighborhood scale in the image to be detected; obtaining local texture information of each pixel point at each neighborhood scale according to the gray value of each pixel point in the image to be detected;

[0008] Perform region growth on each pixel in the image to be detected to obtain the connected domain where each pixel is located;

[0009] According to the area of ​​the connected domain where each pixel is located and the gray value of each pixel in the connected domain, the possibility of each pixel in the image to be detected being impurity is obtained;

[0010] According to the local texture information of each pixel at each neighborhood scale, the gradient value of each pixel in the neighborhood window of each pixel at each neighborhood scale and the possibility of being impurities, the weight of the local texture information of each pixel at each neighborhood scale is obtained;

[0011] According to the local texture information of each pixel at each neighborhood scale, the credibility of the local texture information of each pixel at each neighborhood scale is obtained;

[0012] According to the weight and credibility of the local texture information of each pixel at each neighborhood scale, the final weight of the local texture information of each pixel at each neighborhood scale is obtained;

[0013] According to the local texture information of each pixel at all neighborhood scales and the final weight of the local texture information, the final texture information of each pixel is obtained;

[0014] According to the final texture information of each pixel in the image to be detected, the quality detection result of the lubricating oil is obtained.

[0015] Furthermore, the setting of multiple neighborhood scales to construct a neighborhood window for each pixel at each neighborhood scale in the image to be detected includes the following specific steps:

[0016] In the image to be detected, The pixel point is the center, and the construction size is The window is denoted as The neighborhood scale The neighborhood window of pixels; among them, , is the preset number of neighborhood scales.

[0017] Furthermore, the step of obtaining the local texture information of each pixel at each neighborhood scale according to the grayscale value of each pixel in the image to be detected includes the following specific steps:

[0018] According to The neighborhood scale Neighborhood window of pixels The gray value of the inner pixel is obtained The neighborhood scale The specific calculation formula corresponding to the quantized value of each pixel in the neighborhood window of pixels is:

[0019]

[0020] in, Indicates The neighborhood scale The pixel in the neighborhood window The quantized value of the pixel, Indicates The gray value of a pixel, Indicates The neighborhood scale The pixel in the neighborhood window The gray value of a pixel, is the preset first constant, is the absolute value function;

[0021] In clockwise direction from The quantized value of the first pixel in the upper left corner of the outermost layer is traversed layer by layer until all pixels except The quantized values ​​of all pixels except the pixel at the center are obtained. The neighborhood scale LBP coding within the neighborhood window of pixels;

[0022] The first The neighborhood scale The LBP code in the neighborhood window of pixels is converted into a decimal number and recorded as The neighborhood scale The local texture information of each pixel.

[0023] Furthermore, the possibility of each pixel in the image to be detected being impurity is obtained according to the area of ​​the connected domain where each pixel is located and the grayscale value of each pixel in the connected domain, including the specific formula as follows:

[0024]

[0025] in, Indicates The probability that a pixel is impurity, Indicates The area of ​​the connected domain where the pixel points are located, Indicates The grayscale mean of all pixels in the connected domain where the pixel is located, Indicates The pixel point is located in the connected domain The grayscale mean of a pixel and the rest of its 8 neighbors Indicates the image to be detected with The connected domain where the pixel point is located is adjacent to the The area of ​​the connected domain where the pixel points are located, is the image to be detected and The number of pixels adjacent to the connected domain where the pixel is located, Indicates The number of pixels in the connected domain where the pixel is located, is the absolute value function, Indicates The minimum area of ​​the connected domain of all pixels adjacent to the connected domain of the pixel point, is an exponential function with a natural constant as its base.

[0026] Further, the weight of the local texture information of each pixel at each neighborhood scale is obtained according to the local texture information of each pixel at each neighborhood scale, the gradient value of each pixel in the neighborhood window of each pixel at each neighborhood scale, and the possibility of being impurities, and the specific steps include the following:

[0027] According to The neighborhood scale The local texture information of the pixel is obtained by The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale Local texture information of each pixel;

[0028] The first The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale The local texture information of the pixel is recorded as The neighborhood scale The maximum local texture information of pixels;

[0029] The first The neighborhood scale The maximum local texture information of the pixel minus the The neighborhood scale The difference of the local texture information of pixels is recorded as The neighborhood scale The local texture information difference of each pixel;

[0030] According to multiple neighborhood scales The local texture information difference of pixels, The neighborhood scale The gradient value of each pixel in the neighborhood window of the pixel point and the possibility of being an impurity are obtained. The neighborhood scale The weight of the local texture information of each pixel.

[0031] Further, the first The local texture information difference of pixels, The neighborhood scale The gradient value of each pixel in the neighborhood window of the pixel point and the possibility of being an impurity are obtained. The neighborhood scale The weight of the local texture information of each pixel includes the following specific formula:

[0032]

[0033] in, Indicates The neighborhood scale The weight of the local texture information of each pixel, For the The neighborhood scale The local texture information difference of each pixel is For the The neighborhood scale The local texture information difference of each pixel is Indicates The neighborhood scale The number of pixels contained in the neighborhood window of pixels, Indicates The neighborhood scale The pixel in the neighborhood window The probability that a pixel is impurity, Indicates The neighborhood scale The pixel in the neighborhood window The gradient value of a pixel.

[0034] Furthermore, the step of obtaining the credibility of the local texture information of each pixel at each neighborhood scale according to the local texture information of each pixel at each neighborhood scale includes the following specific steps:

[0035] The first The neighborhood scale The pixel point at the center of each edge of the neighborhood window of pixels is recorded as the target point;

[0036] The first The neighborhood scale The pixel points that are not the target point in the neighborhood window of pixels are recorded as reference points;

[0037] The first The neighborhood scale The grayscale value of the pixel closest to each target point outside the neighborhood window of pixels is recorded as the updated grayscale value of each target point; the grayscale value of each reference point is recorded as the updated grayscale value of each reference point;

[0038] According to The neighborhood scale The method for obtaining the local texture information of pixels is to use The neighborhood scale The updated grayscale values ​​of all pixels in the neighborhood window of the pixel are obtained. The neighborhood scale Update local texture information of each pixel;

[0039] The first The neighborhood scale The local texture information of the pixel is The neighborhood scale The normalized value of the inverse proportion of the absolute value of the difference in the updated local texture information of the pixel is recorded as The neighborhood scale The credibility of the local texture information of each pixel.

[0040] Furthermore, the method of obtaining the final weight of the local texture information of each pixel at each neighborhood scale according to the weight and credibility of the local texture information of each pixel at each neighborhood scale includes the following specific steps:

[0041] The product of the credibility of the local texture information of each pixel at each neighborhood scale and the weight of the local texture information of each pixel at each neighborhood scale is recorded as the final weight of the local texture information of each pixel at each neighborhood scale.

[0042] Furthermore, the method of obtaining the final texture information of each pixel point according to the local texture information of each pixel point at all neighborhood scales and the final weight of the local texture information includes the following specific steps:

[0043] Calculate the first The final weighted sum of the local texture information of pixels is The neighborhood scale The final weight of the local texture information of the pixel is the sum of the weights of the local texture information of the pixel at all neighborhood scales. The ratio of the final weighted sum of the local texture information of pixels is recorded as The neighborhood scale The weight of each pixel;

[0044] Calculate the first The product of the weight of the pixel and the local texture information is used to calculate the weight of all the neighboring scales. The normalized value of the sum of the product of the weight of the pixel and the local texture information is recorded as The final texture information of each pixel.

[0045] Furthermore, the method of obtaining the quality test result of the lubricating oil according to the final texture information of each pixel in the image to be tested includes the following specific steps:

[0046] The final texture information is greater than the preset texture information threshold The pixel points are recorded as impurity pixels;

[0047] The ratio of the number of impurity pixels in the image to be detected to the number of pixels in the image to be detected is recorded as the impurity degree;

[0048] If the impurity level is greater than or equal to the preset impurity level threshold , then the green and environmentally friendly lubricant has quality problems;

[0049] If the impurity level is less than the preset impurity level threshold , then there is no quality problem with the green and environmentally friendly lubricant.

[0050] The beneficial effects of the technical solution of the present invention are: when obtaining the possibility that each pixel point in the image to be detected is an impurity, the possibility that each pixel point in the image to be detected is an impurity is made more accurate based on the characteristics that the grayscale values ​​of each pixel point in the impurity area are relatively different and the impurity area may contain a connected domain of a smaller area; the weight of the local texture information of each pixel point at each neighborhood scale is obtained according to the local texture information of each pixel point at each neighborhood scale, the gradient value of each pixel point in the neighborhood window of the pixel point at each neighborhood scale, and the possibility of being an impurity, because when obtaining the weight of the local texture information of each pixel point at each neighborhood scale, the possibility that each pixel point in the neighborhood window of the pixel point is an impurity is taken into account, so that the weight of the local texture information of each pixel point at each neighborhood scale is more accurate. ; According to the local texture information of each pixel at each neighborhood scale, the credibility of the local texture information of each pixel at each neighborhood scale is obtained. When calculating the credibility, the grayscale values ​​of some pixels in the neighborhood window are adjusted to make the credibility more accurate; according to the weight and credibility of the local texture information of each pixel at each neighborhood scale, the final weight of the local texture information of each pixel at each neighborhood scale that is closer to reality is obtained; according to the local texture information of each pixel at all neighborhood scales and the final weight of the local texture information, the final texture information of each pixel is obtained. Because the final weight of the local texture information of each pixel at each neighborhood scale is closer to reality, the final texture information of each pixel is more accurate, thereby making the detection result more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 The present invention is a flowchart of the steps of a visually assisted green and environmentally friendly lubricant quality detection method. DETAILED DESCRIPTION

[0053] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a visually assisted green and environmentally friendly lubricant quality detection method proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0054] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0055] The specific scheme of a visually assisted green and environmentally friendly lubricant quality detection method provided by the present invention is described in detail below with reference to the accompanying drawings.

[0056] See also Figure 1 , which shows a flow chart of the steps of a visually assisted green environmentally friendly lubricant quality detection method provided by an embodiment of the present invention, the method comprising the following steps:

[0057] Step S001 obtains an image to be detected of green and environmentally friendly lubricating oil; sets multiple neighborhood scales to construct a neighborhood window of each pixel point at each neighborhood scale in the image to be detected; and obtains local texture information of each pixel point at each neighborhood scale according to the gray value of each pixel point in the image to be detected.

[0058] It should be noted that, since the purpose of this embodiment is to detect green and environmentally friendly lubricating oil, an image of the green and environmentally friendly lubricating oil to be detected is obtained.

[0059] Specifically, an industrial camera is used to photograph a green and environmentally friendly lubricant sample under normal lighting conditions to obtain an image of the green and environmentally friendly lubricant to be tested, and the image of the green and environmentally friendly lubricant to be tested is grayscaled to obtain an image to be tested.

[0060] It should be noted that, since the sizes of impurities in lubricating oil may be different, the areas of different impurities in the image to be detected may also be different. Therefore, when obtaining the local texture information of pixels based on a fixed neighborhood scale, it may not be possible to fully capture the local texture information of some impurity pixels. Therefore, by setting the local texture information of multiple neighborhood scale pixels at different neighborhood scales, and then assigning different weights to the local texture information of pixels at different neighborhood scales, the final texture information of the pixels is obtained.

[0061] Therefore, through Encoding, calculate the local texture information of the pixel at different neighborhood scales. Among them, LBP encoding is a well-known technology, and the specific method will not be repeated here. According to the possibility that each pixel in the neighborhood window of each pixel at each neighborhood scale is an impurity, the local texture information of the pixel at different neighborhood scales, and the credibility of the local texture information of the pixel at each neighborhood scale, the final weight of the local texture information of the pixel at each neighborhood scale to the final texture information is obtained, and the final texture information of each pixel is obtained. According to the final texture information of each pixel, the number of impurity pixels in the image to be detected is judged, that is, the degree of contamination of the green and environmentally friendly lubricant. Therefore, it is necessary to first determine the neighborhood scale of the pixel, and obtain the local texture information of each pixel at multiple neighborhood scales, that is, the local texture information of the pixel. The value is used to obtain the degree of lubricating oil contamination in the image to be detected.

[0062] Specifically, in this embodiment, the preset number of neighborhood scales is , can be set to other values ​​in other implementations, and this embodiment does not limit this. The neighborhood window size corresponding to the neighborhood scale is ,in .

[0063] First Take the pixel point as an example, and calculate the The neighborhood scale The local texture information of each pixel.

[0064] No. The neighborhood scale The method of obtaining the neighborhood window of pixels is as follows: The pixel point is the center of the construction. , and record this window as The neighborhood scale Neighborhood window of pixels When the pixel point is located close to the edge of the image and there are not enough pixels to construct the neighborhood window at some neighborhood scales, the grayscale value of the pixel points in the neighborhood window area at the neighborhood scale outside the image is set to the grayscale value of the central pixel point, that is, the pixel points outside the image within the neighborhood window at the neighborhood scale do not show texture features.

[0065] When obtaining the LBP code of each pixel at each neighborhood scale, when the grayscale value of the pixel in the neighborhood window of the pixel is similar to the grayscale value of the pixel at the center of the neighborhood window, the pixel is quantized to 0; when the grayscale value of the pixel in the neighborhood window is significantly different from the grayscale value of the pixel at the center of the neighborhood window, the pixel is quantized to 1.

[0066] For The neighborhood scale Each pixel in the neighborhood window of pixels is quantized, where the The neighborhood scale The pixel in the neighborhood window The quantization value of a pixel is , the calculation formula is as follows:

[0067]

[0068] in, Indicates The neighborhood scale The pixel in the neighborhood window The quantized value of the pixel, Indicates The gray value of a pixel, Indicates The neighborhood scale The pixel in the neighborhood window The gray value of a pixel, is a preset first constant. In this embodiment In other embodiments The value of can be set to other values, which are not limited in this embodiment. is the absolute value function.

[0069] According to the quantization method of pixels, we get The neighborhood scale The quantized value of each pixel in the neighborhood window of pixels is The neighborhood scale The quantization value of the first pixel in the upper left corner of the outermost layer in the neighborhood window of pixels is the highest bit of LBP coding. The quantized value of the right adjacent pixel of the first pixel in the upper left corner of the outermost layer is the second highest bit of the LBP code, and so on. The neighborhood scale The LBP coding in the neighborhood window of pixels, that is, in a clockwise direction from The quantized value of the first pixel in the upper left corner of the outermost layer is traversed layer by layer until all pixels except The quantized values ​​of all pixels except the pixel at the center are obtained. The neighborhood scale LBP coding within the neighborhood window of pixels.

[0070] Convert the obtained LBP code into a decimal number to get The neighborhood scale Local texture information of each pixel , and taking this as an example, we get The local texture information of pixels. The conversion of codes into decimal numbers is a well-known technique and will not be described in this embodiment.

[0071] So far, by setting multiple neighborhood scales and constructing the calculation method of pixel quantization value, the first The local texture information of each pixel.

[0072] Step S002 performs region growing on each pixel in the image to be detected to obtain a connected domain where each pixel is located; based on the area of ​​the connected domain where each pixel is located and the grayscale value of each pixel in the connected domain, the possibility that each pixel in the image to be detected is impurity is obtained.

[0073] Through the above steps, we can get the The local texture information of each pixel is obtained by calculating the probability that each pixel is an impurity at each neighborhood scale and the local texture information of the pixel at each neighborhood scale. The final weight of the local texture information of the pixel at different neighborhood scales is obtained by combining the credibility of the local texture information of the pixel at each neighborhood scale, and the final texture information of the pixel is obtained. Therefore, it is necessary to calculate the probability that each pixel in the image is an impurity and the credibility of the local texture information obtained at each neighborhood scale.

[0074] It should be noted that compared with the area of ​​impurities in the image to be detected, the reflection area caused by the lubricant itself is larger in the image and the grayscale values ​​of each pixel in the reflection area of ​​the lubricant itself are relatively close. The grayscale mean of the connected domain where the pixel points are located, The grayscale mean of each pixel in the connected domain where the pixel is located and the rest of the pixels in its 8 neighborhoods, and the area of ​​the connected domain where the pixel is located, are obtained. The probability that the pixel is an impurity. Since the impurity particles in the lubricating oil have different shapes and surface states, the image to be detected may contain adjacent small connected domains next to the impurity area. The minimum area of ​​the connected domain where the pixel is located and the connected domain where the adjacent pixel points are located is obtained. The probability that a pixel is impurity.

[0075] No. The specific method for obtaining the possibility that a pixel point is impurity is as follows:

[0076] No. The method of obtaining the connected domain where each pixel point is located is as follows:

[0077] Using the region growing algorithm, The pixel point is used as the starting point of regional growth, and the gray value difference between the starting point of regional growth and the point to be grown is less than the difference threshold. As a growth criterion, we get The connected domain where the pixel points are located. The region growing algorithm is a well-known technology and will not be described in detail in this embodiment. This embodiment uses the region growing algorithm and sets the gray value difference between the growth starting point and the generation growth point to be less than the difference threshold. As a growth criterion, we get The connected domain where the pixel points are located, in other implementations, other growth criteria can be set or other algorithms can be used to obtain the first The connected domain where the pixel points are located is not limited in this embodiment. The difference threshold preset in this embodiment , this is used as an example for description, and other values ​​may be set in other implementation modes, and this embodiment does not limit this.

[0078] Through the above connected domain acquisition method, the image to be detected and the first The connected domain where each pixel point is located is adjacent to the connected domain where the pixel points are located. The adjacent pixel points represent the pixel points outside the connected domain that are adjacent to the boundary of the connected domain.

[0079] No. The probability that a pixel is impurity is , the calculation formula is as follows:

[0080]

[0081] in, Indicates The probability that a pixel is impurity, Indicates The area of ​​the connected domain where the pixel point is located, that is, The number of pixels in the connected domain where the pixel is located. Indicates The grayscale mean of all pixels in the connected domain where the pixel is located, Indicates The pixel point is located in the connected domain The grayscale mean of a pixel and the rest of its 8 neighborhood pixels. Indicates the image to be detected with The connected domain where the pixel point is located is adjacent to the The area of ​​the connected domain where the pixel points are located, is the image to be detected and The number of pixels adjacent to the connected domain where the pixel is located, Indicates The number of pixels in the connected domain where the pixel is located, is the absolute value function, is the minimum function, It is an exponential function with a natural constant as the base. This embodiment adopts the exp(-y) model to present the inverse proportional relationship and normalization processing. y is the input of the model. The implementer can set the inverse proportional function and normalization function according to the actual situation.

[0082] It should be noted that Indicates The minimum area of ​​the connected domain of all pixels adjacent to the connected domain of the pixel point. The smaller the value, the greater the There is a small connected domain around the pixel, that is, The more likely the pixel is a magazine; Indicates The difference between the local grayscale mean and the overall grayscale mean in the connected domain where the pixel point is located, that is, The smaller the value, the smaller the unevenness of the grayscale value of the pixel in the connected domain where the pixel is located. The closer the gray values ​​of the pixels in the connected domain are, the The smaller the pixel, the less likely it is that it is a magazine.

[0083] The above operation is performed once for each pixel in the image to be detected to obtain the possibility that each pixel in the image to be detected is impurity.

[0084] Step S003 obtains the weight of the local texture information of each pixel at each neighborhood scale according to the local texture information of each pixel at each neighborhood scale, the gradient value of each pixel in the neighborhood window of each pixel at each neighborhood scale, and the possibility of being impurities.

[0085] It should be noted that if at a neighborhood scale The higher the mean value of the impurity probability of all pixels in the neighborhood window of pixels, the higher the probability of impurity. The weight of the local texture information of the pixel should be larger. The quantization values ​​of the remaining pixels in the neighborhood window of the pixel are calculated based on the The gray value of the pixel is The grayscale value of each pixel in the neighborhood window of the pixel is obtained. When the area of ​​the neighborhood window of pixels increases, The peripheral pixels of the neighborhood window of pixels and the The distance between pixels increases, so the The relationship between the pixel and the rest of the pixels in its neighborhood window will gradually weaken, that is, when the area of ​​the neighborhood window where the pixel is located is larger, the The texture information of the neighborhood window where the pixel point is located is consistent with the texture information of the The greater the difference between the actual texture information of the pixels, the greater the difference between the actual texture information of the pixels. The local texture information of the pixel represents the The local texture information of the pixel point at the neighborhood scale corresponding to the neighborhood window, that is, The degree of expression of local texture information of pixels. If the The smaller the difference between the expression degree of the texture information of each pixel and the maximum value of the expression degree of the texture information in the current neighborhood scale, the more texture information is captured in this neighborhood scale, and the corresponding weight increases.

[0086] Specifically, the gradient value of each pixel in the image to be detected is obtained by using the Sobel operator, wherein the Sobel operator is a well-known technology and the specific method is not introduced here.

[0087] According to The neighborhood scale The local texture information of the pixel is obtained by The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale Local texture information of each pixel;

[0088] The first The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale The local texture information of the pixel is recorded as The neighborhood scale The maximum local texture information of pixels;

[0089] The first The neighborhood scale The maximum local texture information of the pixel minus the The neighborhood scale The difference of the local texture information of pixels is recorded as The neighborhood scale The local texture information difference of each pixel.

[0090] According to multiple neighborhood scales The local texture information difference of pixels, The neighborhood scale The probability of each pixel in the neighborhood window of pixels being a magazine and the gradient of each pixel are obtained. The neighborhood scale The weight of the local texture information of a pixel point is calculated as follows:

[0091]

[0092] in, Indicates The neighborhood scale The weight of the local texture information of each pixel, For the The neighborhood scale The local texture information difference of each pixel is For the The neighborhood scale The local texture information difference of each pixel; Indicates The neighborhood scale The number of pixels contained in the neighborhood window of pixels, Indicates The neighborhood scale The pixel in the neighborhood window The probability that a pixel is impurity, Indicates The neighborhood scale The pixel in the neighborhood window The gradient value of a pixel.

[0093] Step S004 obtains the credibility of the local texture information of each pixel at each neighborhood scale according to the local texture information of each pixel at each neighborhood scale.

[0094] It should be noted that as the neighborhood scale of the pixel point expands, it will lose sensitivity to local details and textures, thereby reducing the credibility of the local texture information of the pixel point. Therefore, the credibility of the local texture information of the pixel point at each neighborhood scale is obtained by using the difference between the local texture information of the pixel point at each neighborhood scale and the updated local texture information obtained by adjusting the grayscale value of the pixel point in the neighborhood window of each pixel point at each neighborhood scale.

[0095] Specifically, this embodiment is based on The neighborhood scale Take the local texture information of a pixel as an example.

[0096] For The neighborhood scale The grayscale value of each pixel in the neighborhood window of pixels is adjusted as follows:

[0097] The first The neighborhood scale The pixel point at the center of each edge of the neighborhood window of pixels is recorded as the target point;

[0098] The first The neighborhood scale The pixel points that are not the target point in the neighborhood window of pixels are recorded as reference points;

[0099] The first The neighborhood scale The grayscale value of the pixel closest to each target point outside the neighborhood window of pixels is recorded as the updated grayscale value of each target point; the grayscale value of each reference point is recorded as the updated grayscale value of each reference point; and the first The neighborhood scale Update the gray value of each pixel in the neighborhood window of pixels.

[0100] According to The neighborhood scale The method for obtaining the local texture information of pixels is to use The neighborhood scale The updated grayscale values ​​of all pixels in the neighborhood window of the pixel are obtained. The neighborhood scale Update the local texture information of pixels and record it as .

[0101] The first The neighborhood scale The credibility of the local texture information of a pixel is , the calculation formula is as follows:

[0102]

[0103] Where: Indicates The neighborhood scale The credibility of the local texture information of each pixel, The neighborhood scale is Time The local texture information of each pixel, For the The neighborhood scale Update local texture information of pixels. is the absolute value function, It is an exponential function with a natural constant as the base. This embodiment adopts the exp(-y) model to present the inverse proportional relationship and normalization processing. y is the input of the model. The implementer can set the inverse proportional function and normalization function according to the actual situation.

[0104] The final weights of the local texture information of the pixels at multiple neighborhood scales are obtained by weighting the final texture information with respect to the local texture information of the pixels at multiple neighborhood scales and the credibility of the local texture information of the pixels at multiple neighborhood scales.

[0105] Step S005 obtains the final weight of the local texture information of each pixel at each neighborhood scale according to the weight and credibility of the local texture information of each pixel at each neighborhood scale.

[0106] No. The neighborhood scale The final weight of the local texture information of a pixel is , the calculation formula is as follows:

[0107]

[0108] in, Indicates The neighborhood scale The final weight of the local texture information of each pixel; Indicates The neighborhood scale The weight of the local texture information of each pixel; Indicates The neighborhood scale The credibility of the local texture information of each pixel.

[0109] According to the above method, we can get the The final weight of the local texture information of each pixel.

[0110] Step S006 obtains final texture information of each pixel according to the local texture information of each pixel at all neighborhood scales and the final weight of the local texture information.

[0111] No. The final texture information of pixels is , the calculation formula is as follows:

[0112]

[0113] in, Indicates The final texture information of each pixel, Indicates The neighborhood scale The final weight of the local texture information of each pixel, Indicates The neighborhood scale The local texture information of each pixel, is a normalized function, is the preset number of neighborhood scales.

[0114] The above operation is performed on all pixels in the image to be detected to obtain the final texture information of each pixel in the image to be detected.

[0115] Step S007 obtains the quality inspection result of the lubricating oil according to the final texture information of each pixel point in the image to be inspected.

[0116] Since impurity pixels in the image contain large texture information while non-impurity pixels do not, the pixels in the image to be tested are divided into impurity pixels and non-impurity pixels through threshold segmentation, and the impurity area and non-impurity area in the image to be tested are further obtained. According to the area ratio of the impurity area to the image to be tested, the quality of the green and environmentally friendly lubricant to be tested is qualified.

[0117] The specific process of dividing the pixels in the image to be detected into impurity pixels and non-impurity pixels by threshold segmentation is as follows:

[0118] Preset texture information threshold , when the final texture information of the pixel is greater than or equal to When the pixel contains more texture information, it means that the pixel is an impurity pixel; when the texture information of the pixel is less than When , it means that this pixel does not have much texture information, that is, this pixel is a non-impurity pixel; the above operation is performed on all pixels in the image to be detected, and the image to be detected is divided into impurity pixels and non-impurity pixels.

[0119] In this embodiment, the texture information threshold is preset , it can be set to other values ​​in other implementation modes and is not limited in this embodiment.

[0120] According to the number of impurity pixels in the image to be detected, the impurity degree is obtained , the calculation formula is as follows:

[0121]

[0122] Where: Indicates the degree of impurities, Indicates the number of impurity pixels, Indicates the number of pixels contained in the image to be detected.

[0123] Further preset impurity level thresholds In this embodiment, the impurity level threshold is preset , can be set to other values ​​in other embodiments, which are not limited in this embodiment. When , it means that the image to be tested contains more impurities, that is, the product has quality problems; when When , it means that there are not many impurities in the image to be tested, that is, the product has no quality problems. All green and environmentally friendly lubricant samples are traversed to screen out abnormal lubricants and mark them, completing the quality inspection of green and environmentally friendly lubricants.

[0124] So far, the present invention is completed.

[0125] To sum up, in the embodiments of the present invention, 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. A visually assisted green and environmentally friendly lubricant quality detection method, characterized in that: The method comprises the following steps: Obtain the image of green and environmentally friendly lubricant to be tested; Setting multiple neighborhood scales, constructing a neighborhood window of each pixel point at each neighborhood scale in the image to be detected; obtaining local texture information of each pixel point at each neighborhood scale according to the gray value of each pixel point in the image to be detected; Perform region growth on each pixel in the image to be detected to obtain the connected domain where each pixel is located; According to the area of ​​the connected domain where each pixel is located and the gray value of each pixel in the connected domain, the possibility of each pixel in the image to be detected being impurity is obtained; According to the local texture information of each pixel at each neighborhood scale, the gradient value of each pixel in the neighborhood window of each pixel at each neighborhood scale and the possibility of being impurities, the weight of the local texture information of each pixel at each neighborhood scale is obtained; According to the local texture information of each pixel at each neighborhood scale, the credibility of the local texture information of each pixel at each neighborhood scale is obtained; According to the weight and credibility of the local texture information of each pixel at each neighborhood scale, the final weight of the local texture information of each pixel at each neighborhood scale is obtained; According to the local texture information of each pixel at all neighborhood scales and the final weight of the local texture information, the final texture information of each pixel is obtained; According to the final texture information of each pixel in the image to be detected, the quality detection result of the lubricating oil is obtained; The possibility of each pixel in the image to be detected being impurity is obtained according to the area of ​​the connected domain where each pixel is located and the gray value of each pixel in the connected domain. The specific formula included is as follows: in, Indicates The probability that a pixel is impurity, Indicates The area of ​​the connected domain where the pixel points are located, Indicates The grayscale mean of all pixels in the connected domain where the pixel is located, Indicates The pixel point is located in the connected domain The grayscale mean of a pixel and the rest of its 8 neighbors Indicates the image to be detected with The connected domain where the pixel point is located is adjacent to the The area of ​​the connected domain where the pixel points are located, is the image to be detected and The number of pixels adjacent to the connected domain where the pixel is located, Indicates The number of pixels in the connected domain where the pixel is located, is the absolute value function, Indicates The minimum area of ​​the connected domain of all pixels adjacent to the connected domain of the pixel point, is an exponential function with a natural constant as base; The weight of the local texture information of each pixel at each neighborhood scale is obtained according to the local texture information of each pixel at each neighborhood scale, the gradient value of each pixel in the neighborhood window of each pixel at each neighborhood scale, and the possibility of being impurities, and the specific steps include the following: According to The neighborhood scale The local texture information of the pixel is obtained by The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale Local texture information of each pixel; The first The neighborhood scale The quantization value of all pixels in the neighborhood window of a pixel is 1. The neighborhood scale The local texture information of the pixel is recorded as The neighborhood scale The maximum local texture information of pixels; The first The neighborhood scale The maximum local texture information of the pixel minus the The neighborhood scale The difference of the local texture information of pixels is recorded as The neighborhood scale The local texture information difference of each pixel; According to multiple neighborhood scales The local texture information difference of the pixel points The neighborhood scale The gradient value of each pixel in the neighborhood window of the pixel point and the possibility of being an impurity are obtained. The neighborhood scale The weight of the local texture information of each pixel; The first The local texture information difference of the pixel points The neighborhood scale The gradient value of each pixel in the neighborhood window of the pixel point and the possibility of being an impurity are obtained. The neighborhood scale The weight of the local texture information of each pixel includes the following specific formula: in, Indicates The neighborhood scale The weight of the local texture information of each pixel, For the The neighborhood scale The local texture information difference of each pixel is For the The neighborhood scale The local texture information difference of each pixel is Indicates The neighborhood scale The number of pixels contained in the neighborhood window of pixels, Indicates The neighborhood scale The pixel in the neighborhood window The probability that a pixel is impurity, Indicates The neighborhood scale The pixel in the neighborhood window The gradient value of a pixel.

2. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The step of setting multiple neighborhood scales and constructing a neighborhood window for each pixel at each neighborhood scale in the image to be detected includes the following specific steps: In the image to be detected, The pixel point is the center, and the construction size is The window is denoted as The neighborhood scale The neighborhood window of pixels; among them, , is the preset number of neighborhood scales.

3. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The specific steps of obtaining the local texture information of each pixel at each neighborhood scale according to the gray value of each pixel in the image to be detected are as follows: According to The neighborhood scale Neighborhood window of pixels The gray value of the inner pixel is obtained The neighborhood scale The specific calculation formula corresponding to the quantized value of each pixel in the neighborhood window of pixels is: in, Indicates The neighborhood scale The pixel in the neighborhood window The quantized value of each pixel, Indicates The gray value of a pixel, Indicates The neighborhood scale The pixel in the neighborhood window The gray value of a pixel, is the preset first constant, is the absolute value function; In clockwise direction from The quantized value of the first pixel in the upper left corner of the outermost layer is traversed layer by layer until all pixels except The quantized values ​​of all pixels except the pixel at the center are obtained. The neighborhood scale LBP coding within the neighborhood window of pixels; The first The neighborhood scale The LBP code in the neighborhood window of pixels is converted into a decimal number and recorded as The neighborhood scale The local texture information of each pixel.

4. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The process of obtaining the credibility of the local texture information of each pixel at each neighborhood scale according to the local texture information of each pixel at each neighborhood scale includes the following specific steps: The first The neighborhood scale The pixel point at the center of each edge of the neighborhood window of pixels is recorded as the target point; The first The neighborhood scale The pixel points that are not the target point in the neighborhood window of pixels are recorded as reference points; The first The neighborhood scale The grayscale value of the pixel closest to each target point outside the neighborhood window of pixels is recorded as the updated grayscale value of each target point; the grayscale value of each reference point is recorded as the updated grayscale value of each reference point; According to The neighborhood scale The method for obtaining the local texture information of pixels is to use The neighborhood scale The updated grayscale values ​​of all pixels in the neighborhood window of the pixel are obtained. The neighborhood scale Update local texture information of each pixel; The first The neighborhood scale The local texture information of the pixel is The neighborhood scale The normalized value of the inverse proportion of the absolute value of the difference in the updated local texture information of the pixel is recorded as The neighborhood scale The credibility of the local texture information of each pixel.

5. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The method of obtaining the final weight of the local texture information of each pixel at each neighborhood scale according to the weight and credibility of the local texture information of each pixel at each neighborhood scale includes the following specific steps: The product of the credibility of the local texture information of each pixel at each neighborhood scale and the weight of the local texture information of each pixel at each neighborhood scale is recorded as the final weight of the local texture information of each pixel at each neighborhood scale.

6. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The method of obtaining the final texture information of each pixel point according to the local texture information of each pixel point at all neighborhood scales and the final weight of the local texture information includes the following specific steps: Calculate the first The final weighted sum of the local texture information of pixels is The neighborhood scale The final weight of the local texture information of the pixel is the sum of the weights of the local texture information of the pixel at all neighborhood scales. The ratio of the final weighted sum of the local texture information of pixels is recorded as The neighborhood scale The weight of each pixel; Calculate the first The product of the weight of the pixel and the local texture information is used to calculate the weight of all the neighboring scales. The normalized value of the sum of the product of the weight of the pixel and the local texture information is recorded as The final texture information of each pixel.

7. A visually assisted green and environmentally friendly lubricant quality detection method according to claim 1, characterized in that: The method of obtaining the quality test result of the lubricating oil according to the final texture information of each pixel in the image to be tested includes the following specific steps: The final texture information is greater than the preset texture information threshold The pixel points are recorded as impurity pixels; The ratio of the number of impurity pixels in the image to be detected to the number of pixels in the image to be detected is recorded as the impurity degree; If the impurity level is greater than or equal to the preset impurity level threshold , then the green and environmentally friendly lubricant has quality problems; If the impurity level is less than the preset impurity level threshold , then there is no quality problem with the green and environmentally friendly lubricant.