A hydraulic cylinder fault detection system based on machine vision
Through the oil cylinder fault detection system based on machine vision, using image cloning and feature extraction technology, combining color and gradient characteristics, the oil leakage area is accurately divided and the severity is judged, which solves the problem of low accuracy and inaccurate judgment of severity in the existing technology in complex environments, and achieves high-precision and stable fault detection.
Patent Information
- Application Number
- CN202411301723.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2044-09-18
AI Technical Summary
The existing oil leakage detection methods based on vision technology are difficult to maintain stable performance in complex industrial environments and are easily disturbed by environmental interference such as light changes and surface stains, resulting in the inability to accurately divide the oil leakage areas, resulting in false detection or missed detection, and the accurate judgment of the severity of oil leakage cannot be provided.
The oil cylinder fault detection system based on machine vision is adopted, and the oil leakage area is divided by obtaining standard fault images and RGB images of the hydraulic cylinder to be tested, and the image cloning and feature extraction is performed. The oil leakage area is divided according to the pixel area of the oil leakage area.
The precise division of oil leakage areas in complex industrial environments has been achieved, which significantly reduces the possibility of missed detection and missed detection, improves the accuracy and stability of fault detection, and helps operators quickly judge the urgency of the fault through a multi-stage oil leakage severity determination mechanism.
Smart Images

Figure CN119273635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and more specifically, to a machine vision-based oil cylinder fault detection system. Background Art
[0002] The hydraulic cylinder is one of the core components in the hydraulic transmission system. Its function is to convert hydraulic energy into mechanical energy to drive various mechanical equipment to work. The normal operation of the hydraulic cylinder directly affects the working efficiency and stability of the equipment. However, during the long-term use of the cylinder, due to the wear of the seals, mechanical stress and environmental factors, oil leakage often occurs; oil leakage in the cylinder will cause the system pressure to drop, the performance of the equipment to decrease, and even cause equipment damage and environmental pollution in severe cases; therefore, timely detection and treatment of oil cylinder leakage is of great significance to ensure the reliability of the equipment.
[0003] At present, oil leakage detection methods based on visual technology have been applied, but most of these technologies rely on simple image processing methods such as grayscale and edge detection. It is difficult to maintain stable performance in complex industrial environments and is easily affected by environmental interference such as light changes and surface stains, resulting in the inability to accurately segment the oil leakage area, which is prone to false detection or missed detection. In addition, the severity of the oil leakage often determines the urgency of the fault handling. Minor oil leakage may not affect the operation of the equipment for the time being, while serious oil leakage requires immediate measures. However, the existing detection system cannot provide accurate classification judgments, resulting in a lack of basis for operators to judge the urgency of the oil cylinder leakage fault, resulting in delayed handling and affecting the normal operation of the equipment. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a cylinder fault detection system based on machine vision.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A machine vision-based oil cylinder fault detection system, the system comprising:
[0007] A data acquisition module is used to acquire a standard fault image and an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image;
[0008] A feature extraction module is used to obtain image features of the hydraulic cylinder to be tested when it is leaking oil from a standard fault image; the image features include color features and gradient features;
[0009] A first segmentation module, used for dividing the first copy image into a mask area and a non-mask area according to color features, and marking the first copy image including the mask area as a first target image;
[0010] A second segmentation module is used to divide the foreground area and the background area from the second copy image according to the gradient feature, and mark the second copy image including the foreground area as a second target image;
[0011] The fault identification module is used to overlap the first target image and the second target image, mark the overlapping area formed by the mask area and the foreground area after overlapping as the oil leakage area, and determine the oil leakage severity of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area.
[0012] Further, the obtaining of the adjusted RGB image of the hydraulic cylinder to be tested includes:
[0013] Extract the RGB image of the hydraulic cylinder to be tested before adjustment, and calculate the quality coefficient of the RGB image;
[0014] The step of calculating the quality coefficient of the RGB image includes:
[0015] Get the brightness value of each channel of the RGB image;
[0016] Substitute the brightness value of each channel into the pre-built quality coefficient calculation model to obtain the quality coefficient of the RGB image;
[0017] The expression of the quality coefficient calculation model is as follows:
[0018]
[0019] Where: QC is the quality coefficient, R i is the brightness value of the i-th pixel in the red channel, G i is the brightness value of the i-th pixel in the green channel, B i is the brightness value of the i-th pixel in the blue channel, is the average brightness of the red channel, G is the average brightness of the green channel, is the average brightness of the blue channel, and N is the total number of pixels;
[0020] comparing the quality factor with a preset quality factor threshold;
[0021] If the quality coefficient is greater than or equal to the quality coefficient threshold, the RGB image is judged to meet the established quality standard;
[0022] If the quality coefficient is less than the quality coefficient threshold, the RGB image is determined to not meet the established quality standard and the RGB image is marked as a low-quality image;
[0023] After converting the low-quality image into a low-quality image in grayscale form, the grayscale values of each grayscale level in the low-quality image in grayscale form are obtained, and the grayscale value of each grayscale level in the low-quality image in grayscale form is redistributed using Gamma transformation to obtain an adjusted RGB image of the hydraulic cylinder to be tested.
[0024] Furthermore, the logic for obtaining the color features in the standard fault image is as follows:
[0025] Converting a standard fault image from an RGB color space to an HSV color space; the standard fault image includes a pre-divided oil leakage area and a non-oil leakage area;
[0026] Calculate the average hue and saturation of the oil leakage area in the standard fault image, and use the calculated average hue and saturation as the color feature of the standard fault image;
[0027] The calculation formula of the average hue is as follows:
[0028]
[0029] Where: is the average hue of the oil spill area, N leak is the total number of pixels in the oil leak area, H(x,y) is the hue value of the pixel at the coordinate (x,y) of the image;
[0030] The calculation formula of the average saturation is as follows:
[0031]
[0032] Where: is the average saturation of the oil leak area, and S(x,y) is the saturation value of the pixel in the image at coordinate (x,y).
[0033] Further, the standard fault image is grayed to obtain a gray fault image;
[0034] The Sobel operator or Prewitt operator is used to calculate the gradient intensity of each pixel in the grayscale fault image;
[0035] According to the gradient strength of each pixel, the number of pixels at each gradient strength level in the grayscale fault image is counted;
[0036] A gradient intensity histogram is constructed according to the number of pixels at each gradient intensity level, and the gradient intensity histogram is used as the gradient feature of the standard fault image.
[0037] Furthermore, dividing the mask area and the non-mask area from the first copy image includes:
[0038] Retrieving the color features of the standard fault image and obtaining the color features in the first copy image;
[0039] The color features of the standard fault image are compared with the color features in the first copy image to divide the mask area K and the non-mask area from the first copy image:
[0040]
[0041] Where: I ij is the color feature of the pixel at position (i, j) in the first copy image, 1 represents the mask area, and 0 represents the non-mask area; a represents the average hue of the standard fault image, and b represents the average saturation of the standard fault image.
[0042] Furthermore, dividing the foreground area and the background area from the second copy image includes:
[0043] Using a K-means clustering algorithm to distinguish pixels of the second copy image, clustering pixels in the second copy image to form regions as candidate regions, and obtaining multiple candidate regions;
[0044] Obtaining a gradient intensity histogram of each candidate region, and calculating similarity between the gradient intensity histogram of each candidate region and the gradient feature of the standard fault image to obtain multiple similarities;
[0045] Each similarity is compared with a preset similarity threshold. If the similarity is greater than or equal to the similarity threshold, the corresponding candidate area is marked as a foreground area; if the similarity is less than the similarity threshold, the corresponding candidate area is marked as a background area.
[0046] Furthermore, before superimposing the first target image and the second target image, the method includes:
[0047] Get the set transparency range;
[0048] Adjusting the transparency of the first target image and the second target image according to the transparency range;
[0049] Wherein, the transparency range is 30% to 70%.
[0050] Further, determining the severity of the oil leakage of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area includes:
[0051] Acquire the pixel area of the oil leak area and the pixel area of the first target image or the second target image;
[0052] Calculating the ratio of the pixel area between the oil leakage area and the first target image or the second target image to obtain the area ratio of the oil leakage area;
[0053] The oil leakage area ratio is compared with a preset oil leakage area ratio threshold, and the oil leakage area ratio is compared with the oil leakage area ratio threshold; the oil leakage area ratio threshold includes a first and a second oil leakage area ratio threshold, wherein the first oil leakage area ratio threshold is greater than the oil leakage area ratio threshold;
[0054] If the oil leakage area ratio threshold is greater than or equal to the first oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the first oil leakage level;
[0055] If the oil leakage area ratio threshold is less than the first oil leakage area ratio threshold, and if the oil leakage area ratio threshold is greater than the second oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the second oil leakage level;
[0056] If the oil leakage area ratio threshold is less than or equal to the second oil leakage area ratio threshold, the oil leakage severity of the hydraulic cylinder to be tested is determined to be the third oil leakage level.
[0057] A method for detecting a cylinder fault based on machine vision is implemented based on the above-mentioned cylinder fault detection system based on machine vision, and the method comprises:
[0058] Acquire a standard fault image, and acquire an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image;
[0059] Acquire image features when the hydraulic cylinder to be tested is leaking oil from the standard fault image; the image features include color features and gradient features;
[0060] Dividing the first copy image into a mask area and a non-mask area according to the color feature, and marking the first copy image including the mask area as a first target image;
[0061] dividing a foreground area and a background area from the second copy image according to the gradient feature, and marking the second copy image including the foreground area as a second target image;
[0062] The first target image and the second target image are superimposed, and the overlapping area formed by the mask area and the foreground area after superposition is marked as the oil leakage area, and the oil leakage severity of the hydraulic cylinder to be tested is determined according to the pixel area of the oil leakage area.
[0063] Compared with the prior art, the present invention has the following beneficial effects:
[0064] The present application discloses a machine vision-based oil cylinder fault detection system, comprising: obtaining a standard fault image and an RGB image of a hydraulic oil cylinder to be tested, cloning the RGB image to obtain a set of copy images; obtaining image features from the standard fault image; dividing a mask area from a first copy image according to color features, marking the first copy image containing the mask area as a first target image; dividing a foreground area from a second copy image according to gradient features, marking the second copy image containing the foreground area as a second target image; marking the overlapped area formed by the mask area and the foreground area after superposition as an oil leakage area, The severity of the oil leakage of the hydraulic cylinder to be tested is determined according to the pixel area of the oil leakage area; based on the above technical features, the present invention can accurately divide the oil leakage area, and even in complex industrial environments, such as lighting changes, surface pollution and other conditions, the system can still maintain high accuracy, significantly reducing the possibility of missed detection and false detection, and improving the accuracy and stability of fault detection; in addition, by introducing a multi-level oil leakage severity determination mechanism, the system can accurately distinguish different oil leakage levels, thereby helping operators to quickly determine the urgency of the fault, optimize equipment maintenance plans, and avoid equipment damage or shutdown due to untimely treatment of oil leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of the module structure of a cylinder fault detection system based on machine vision provided by the present invention;
[0066] Figure 2 The present invention provides a flow chart of a method for detecting oil cylinder faults based on machine vision. DETAILED DESCRIPTION
[0067] 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 only 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0068] Example 1
[0069] See also Figure 1 As shown, this embodiment discloses a cylinder fault detection system based on machine vision, and the system includes:
[0070] The data acquisition module 101 is used to acquire a standard fault image and an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image;
[0071] It should be noted that: the standard fault image is obtained by technicians after pre-collection and pre-processing, and is pre-stored in the system database. The standard fault image is the state performance of the hydraulic cylinder when oil leakage occurs; wherein, the RGB image of the hydraulic cylinder to be tested before adjustment is directly collected by an industrial camera deployed on the hydraulic system;
[0072] Specifically, the step of obtaining the adjusted RGB image of the hydraulic cylinder to be tested includes:
[0073] Extract the RGB image of the hydraulic cylinder to be tested before adjustment, and calculate the quality coefficient of the RGB image;
[0074] The step of calculating the quality coefficient of the RGB image includes:
[0075] Get the brightness value of each channel of the RGB image;
[0076] Substitute the brightness value of each channel into the pre-built quality coefficient calculation model to obtain the quality coefficient of the RGB image;
[0077] The expression of the quality coefficient calculation model is as follows:
[0078]
[0079] Where: QC is the quality coefficient, R i is the brightness value of the i-th pixel in the red channel, G i is the brightness value of the i-th pixel in the green channel, B i is the brightness value of the i-th pixel in the blue channel, is the average brightness of the red channel, G is the average brightness of the green channel, is the average brightness of the blue channel, and N is the total number of pixels;
[0080] comparing the quality factor with a preset quality factor threshold;
[0081] If the quality coefficient is greater than or equal to the quality coefficient threshold, the RGB image is judged to meet the established quality standard;
[0082] If the quality coefficient is less than the quality coefficient threshold, the RGB image is determined to not meet the established quality standard and the RGB image is marked as a low-quality image;
[0083] After converting the low-quality image into a low-quality image in grayscale form, the grayscale value of each grayscale level in the low-quality image in grayscale form is obtained, and the grayscale value of each grayscale level in the low-quality image in grayscale form is redistributed by using Gamma transformation to obtain an adjusted RGB image of the hydraulic cylinder to be tested;
[0084] The transformation formula of the Gamma transformation is as follows:
[0085] I output =c×(I input ) γ ;
[0086] Where: I output is the gray value after redistribution, γ is the Gamma value, c is a constant, I input is the gray value before redistribution;
[0087] It should also be noted that: when the RGB image of the hydraulic cylinder to be tested is not adjusted, it means that the RGB image of the hydraulic cylinder to be tested before the adjustment meets the set quality standard; but no matter whether the RGB image of the hydraulic cylinder to be tested before or after the adjustment is obtained, it will be cloned and copied afterwards to obtain the first copy image and the second copy image of the RGB image before or after the adjustment, and the first copy image and the second copy image are completely consistent in all aspects.
[0088] The feature extraction module 102 is used to obtain the image features of the hydraulic cylinder to be tested when it is leaking oil from the standard fault image; the image features include color features and gradient features;
[0089] In implementation, the logic for obtaining the color features in the standard fault image is as follows:
[0090] Converting a standard fault image from an RGB color space to an HSV color space; the standard fault image includes a pre-divided oil leakage area and a non-oil leakage area;
[0091] It should be noted that: the standard fault image is divided into oil leakage area and non-oil leakage area in advance, and the oil leakage area and non-oil leakage area in the standard fault image are obtained by manual division in advance by technicians;
[0092] Among them, the formula for converting from RGB color space to HSV color space is as follows:
[0093]
[0094] V = max(R, G, B);
[0095] Where: Δ is the color difference, Δ = max(R, G, B) - min(R, G, B), max(R, G, B) is the maximum value of the color channel, min(R, G, B) is the minimum value of the color channel, H is the hue, S is the saturation, V is the brightness, R is the color value of the red channel, G is the color value of the green channel, and B is the color value of the blue channel;
[0096] Calculate the average hue and saturation of the oil leakage area in the standard fault image, and use the calculated average hue and saturation as the color feature of the standard fault image;
[0097] The calculation formula of the average hue is as follows:
[0098]
[0099] Where: is the average hue of the oil spill area, N leak is the total number of pixels in the oil leak area, H(x,y) is the hue value of the pixel at the coordinate (x,y) of the image;
[0100] The calculation formula of the average saturation is as follows:
[0101]
[0102] Where: is the average saturation of the oil spill area, S(x,y) is the saturation value of the pixel at the coordinate (x,y) of the image;
[0103] In implementation, the logic for obtaining the gradient features in the standard fault image is as follows:
[0104] Grayscale the standard fault image to obtain a grayscale fault image;
[0105] The Sobel operator or Prewitt operator is used to calculate the gradient intensity of each pixel in the grayscale fault image;
[0106] The calculation formula of the gradient strength of each pixel is as follows:
[0107]
[0108] Where: T is the gradient strength, T x is the horizontal gradient, T y is the vertical gradient, and are the brightness change rates of the image in the horizontal and vertical directions respectively;
[0109] According to the gradient strength of each pixel, the number of pixels at each gradient strength level in the grayscale fault image is counted;
[0110] A gradient intensity histogram is constructed according to the number of pixels at each gradient intensity level, and the gradient intensity histogram is used as the gradient feature of the standard fault image;
[0111] The horizontal axis of the gradient intensity histogram is the gradient intensity value, and the vertical axis is the number of pixels for each gradient intensity value.
[0112] A first segmentation module 103 is used to divide the first copy image into a mask area and a non-mask area according to color features, and mark the first copy image including the mask area as a first target image;
[0113] In implementation, dividing the mask area and the non-mask area from the first copy image includes:
[0114] Retrieving the color features of the standard fault image and obtaining the color features in the first copy image;
[0115] It should be noted that the principle of obtaining the color features in the first copy image is the same as the color features of the above-mentioned standard fault image. For details, please refer to the relevant description above, and will not be repeated here.
[0116] The color features of the standard fault image are compared with the color features in the first copy image to divide the mask area K and the non-mask area from the first copy image:
[0117]
[0118] Where: I ij is the color feature (i.e., average hue and saturation) of the pixel at position (i, j) in the first copy image, 1 represents the masked area, and 0 represents the non-masked area; a represents the average hue of the standard fault image, and b represents the average saturation of the standard fault image;
[0119] It can be understood that by acquiring the color features in the first copy image and distinguishing the pixels in the first copy image based on the color features of the standard fault image, the mask area and the non-mask area can be quickly segmented from the first copy image, wherein the mask area represents the oil leakage area in the first copy image, and conversely, the non-mask area represents the non-oil leakage area in the first copy image.
[0120] A second segmentation module 104 is used to divide the second copy image into a foreground area and a background area according to the gradient feature, and mark the second copy image including the foreground area as a second target image;
[0121] In implementation, dividing the foreground area and the background area from the second copy image includes:
[0122] Using a K-means clustering algorithm to distinguish pixels of the second copy image, clustering pixels in the second copy image to form regions as candidate regions, and obtaining multiple candidate regions;
[0123] Obtaining a gradient intensity histogram of each candidate region, and calculating similarity between the gradient intensity histogram of each candidate region and the gradient feature of the standard fault image to obtain multiple similarities;
[0124] It should be noted that the logic for obtaining the gradient intensity histogram of each candidate region is the same as the logic for obtaining the gradient features of the above-mentioned standard fault image. For details, please refer to the above-mentioned relevant parts and will not be repeated here.
[0125] It should also be noted that: the similarity calculation is implemented by using cosine similarity or Euclidean distance algorithm;
[0126] Compare each similarity with a preset similarity threshold, if the similarity is greater than or equal to the similarity threshold, mark the corresponding candidate area as a foreground area; if the similarity is less than the similarity threshold, mark the corresponding candidate area as a background area;
[0127] It can be understood that: by taking the gradient features of the standard fault image as a reference standard, the present invention can quickly divide the foreground area and the background area from the second copy image, wherein the foreground area represents the oil leakage area in the second copy image, and conversely, the background area represents the non-oil leakage area in the second copy image.
[0128] The fault identification module 105 is used to superimpose the first target image and the second target image, mark the overlapping area formed by the mask area and the foreground area after superposition as the oil leakage area, and determine the oil leakage severity of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area;
[0129] Before superimposing the first target image and the second target image, the method includes:
[0130] Get the set transparency range;
[0131] Adjusting the transparency of the first target image and the second target image according to the transparency range;
[0132] Wherein, the transparency range is 30% to 70%;
[0133] It should be noted that: since the parameters such as the size of the first target image and the second target image are completely consistent, the first target image and the second target image are completely overlapped in the same direction; when the first target image and the second target image are completely overlapped, the intersection area formed by the mask area and the foreground area is taken as the oil leakage area;
[0134] In implementation, determining the severity of oil leakage of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area includes:
[0135] Acquire the pixel area of the oil leak area and the pixel area of the first target image or the second target image;
[0136] Calculating the ratio of the pixel area between the oil leakage area and the first target image or the second target image to obtain the area ratio of the oil leakage area;
[0137] The oil leakage area ratio is compared with a preset oil leakage area ratio threshold, and the oil leakage area ratio is compared with the oil leakage area ratio threshold; the oil leakage area ratio threshold includes a first and a second oil leakage area ratio threshold, wherein the first oil leakage area ratio threshold is greater than the oil leakage area ratio threshold;
[0138] If the oil leakage area ratio threshold is greater than or equal to the first oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the first oil leakage level;
[0139] If the oil leakage area ratio threshold is less than the first oil leakage area ratio threshold, and if the oil leakage area ratio threshold is greater than the second oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the second oil leakage level;
[0140] If the oil leakage area ratio threshold is less than or equal to the second oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the third oil leakage level;
[0141] It should be noted that: the first oil leakage level is higher than the second oil leakage level, which is higher than the third oil leakage level. When the oil leakage severity of the hydraulic cylinder to be tested is the first oil leakage level, it means that the oil leakage of the hydraulic cylinder to be tested is very serious and the equipment should be shut down for maintenance immediately; when the oil leakage severity of the hydraulic cylinder to be tested is the second oil leakage level, it means that the oil leakage of the hydraulic cylinder to be tested is moderate and maintenance needs to be carried out in time; when the oil leakage severity of the hydraulic cylinder to be tested is the third oil leakage level, it means that the oil leakage of the hydraulic cylinder to be tested is minor and maintenance can be carried out after the equipment is completed.
[0142] By combining color features and gradient features, the oil leakage area can be accurately divided. Even in complex industrial environments, such as lighting changes, surface pollution, etc., the system can still maintain high accuracy, significantly reducing the possibility of missed detection and false detection, and improving the accuracy and stability of fault detection. In addition, by introducing a multi-level oil leakage severity determination mechanism, the system can accurately distinguish different oil leakage levels, thereby helping operators to quickly determine the urgency of the fault, optimize equipment maintenance plans, and avoid equipment damage or downtime due to untimely treatment of oil leaks.
[0143] Example 2
[0144] See also Figure 2As shown, based on the same inventive concept, this embodiment discloses a method for detecting a cylinder fault based on machine vision. For details not provided in this embodiment, please refer to the description of the relevant parts in Embodiment 1. The method includes:
[0145] S201: Acquire a standard fault image, and acquire an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image;
[0146] S202: Acquire image features of the hydraulic cylinder to be tested when it is leaking oil from the standard fault image; the image features include color features and gradient features;
[0147] S203: dividing the first copy image into a mask area and a non-mask area according to the color feature, and marking the first copy image including the mask area as a first target image;
[0148] S204: dividing the foreground area and the background area from the second copy image according to the gradient feature, and marking the second copy image including the foreground area as a second target image;
[0149] S205: Overlap the first target image and the second target image, mark the overlapping area formed by the mask area and the foreground area after the overlap as an oil leakage area, and determine the severity of the oil leakage of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area.
[0150] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters, weights and thresholds in the formula are set by technicians in this field according to actual conditions.
[0151] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through a wired network or a wireless network. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD) or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0152] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0153] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0154] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0155] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0156] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0157] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0158] Finally: 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 spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A cylinder fault detection system based on machine vision, characterized in that: The system comprises: A data acquisition module is used to acquire a standard fault image and an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image; A feature extraction module is used to obtain image features of the hydraulic cylinder to be tested when it is leaking oil from a standard fault image; the image features include color features and gradient features; A first segmentation module, used for dividing the first copy image into a mask area and a non-mask area according to color features, and marking the first copy image including the mask area as a first target image; A second segmentation module is used to divide the foreground area and the background area from the second copy image according to the gradient feature, and mark the second copy image including the foreground area as a second target image; The fault identification module is used to overlap the first target image and the second target image, mark the overlapping area formed by the mask area and the foreground area after overlapping as the oil leakage area, and determine the oil leakage severity of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area.
2. The oil cylinder fault detection system based on machine vision according to claim 1 is characterized in that: The step of obtaining the adjusted RGB image of the hydraulic cylinder to be tested comprises: Extract the RGB image of the hydraulic cylinder to be tested before adjustment, and calculate the quality coefficient of the RGB image; The step of calculating the quality coefficient of the RGB image includes: Get the brightness value of each channel of the RGB image; Substitute the brightness value of each channel into the pre-built quality coefficient calculation model to obtain the quality coefficient of the RGB image; The expression of the quality coefficient calculation model is as follows: Where: QC is the quality coefficient, R i is the brightness value of the i-th pixel in the red channel, G i is the brightness value of the i-th pixel in the green channel, B i is the brightness value of the i-th pixel in the blue channel, is the average brightness of the red channel, is the average brightness of the green channel, is the average brightness of the blue channel, and N is the total number of pixels; comparing the quality factor with a preset quality factor threshold; If the quality coefficient is greater than or equal to the quality coefficient threshold, the RGB image is judged to meet the established quality standard; If the quality coefficient is less than the quality coefficient threshold, the RGB image is determined to not meet the established quality standard and the RGB image is marked as a low-quality image; After converting the low-quality image into a low-quality image in grayscale form, the grayscale values of each grayscale level in the low-quality image in grayscale form are obtained, and the grayscale value of each grayscale level in the low-quality image in grayscale form is redistributed using Gamma transformation to obtain an adjusted RGB image of the hydraulic cylinder to be tested.
3. The oil cylinder fault detection system based on machine vision according to claim 2 is characterized in that: The logic for obtaining the color features in the standard fault image is as follows: Converting a standard fault image from an RGB color space to an HSV color space; the standard fault image includes a pre-divided oil leakage area and a non-oil leakage area; Calculate the average hue and average saturation of the oil leakage area in the standard fault image, and use the calculated average hue and average saturation as the color features of the standard fault image; The calculation formula of the average hue is as follows: Where: is the average hue of the oil spill area, N leak is the total number of pixels in the oil leak area, H(x,y) is the hue value of the pixel at the coordinate (x,y) of the image; The calculation formula of the average saturation is as follows: Where: is the average saturation of the oil leak area, and S(x,y) is the saturation value of the pixel in the image at coordinate (x,y).
4. The oil cylinder fault detection system based on machine vision according to claim 3 is characterized in that: Grayscale the standard fault image to obtain a grayscale fault image; The Sobel operator or the Prewitt operator is used to calculate the gradient intensity of each pixel in the grayscale fault image; According to the gradient strength of each pixel, the number of pixels at each gradient strength level in the grayscale fault image is counted; A gradient intensity histogram is constructed according to the number of pixels at each gradient intensity level, and the gradient intensity histogram is used as the gradient feature of the standard fault image.
5. The oil cylinder fault detection system based on machine vision according to claim 4 is characterized in that: The step of dividing the mask area and the non-mask area from the first copy image includes: Retrieving the color features of the standard fault image and obtaining the color features in the first copy image; The color features of the standard fault image are compared with the color features in the first copy image to divide the mask area K and the non-mask area from the first copy image: Where: I ij is the color feature of the pixel at position (i, j) in the first copy image, 1 represents the mask area, and 0 represents the non-mask area; a represents the average hue of the standard fault image, and b represents the average saturation of the standard fault image.
6. The oil cylinder fault detection system based on machine vision according to claim 5 is characterized in that: The step of dividing the foreground area and the background area from the second copy image comprises: Using a K-means clustering algorithm to distinguish pixels of the second copy image, clustering pixels in the second copy image to form regions as candidate regions, and obtaining multiple candidate regions; Obtaining a gradient intensity histogram of each candidate region, and calculating similarity between the gradient intensity histogram of each candidate region and the gradient feature of the standard fault image to obtain multiple similarities; Each similarity is compared with a preset similarity threshold. If the similarity is greater than or equal to the similarity threshold, the corresponding candidate area is marked as a foreground area; if the similarity is less than the similarity threshold, the corresponding candidate area is marked as a background area.
7. The machine vision-based oil cylinder fault detection system according to claim 6, characterized in that: Before superimposing the first target image and the second target image, the method includes: Get the set transparency range; Adjusting the transparency of the first target image and the second target image according to the transparency range; Wherein, the transparency range is 30% to 70%.
8. The machine vision-based oil cylinder fault detection system according to claim 7, characterized in that: Determining the severity of the oil leakage of the hydraulic cylinder to be tested according to the pixel area of the oil leakage area includes: Acquire the pixel area of the oil leak area and the pixel area of the first target image or the second target image; Calculating the ratio of the pixel area between the oil leakage area and the first target image or the second target image to obtain the area ratio of the oil leakage area; The oil leakage area ratio is compared with a preset oil leakage area ratio threshold, and the oil leakage area ratio is compared with the oil leakage area ratio threshold; the oil leakage area ratio threshold includes a first and a second oil leakage area ratio threshold, wherein the first oil leakage area ratio threshold is greater than the oil leakage area ratio threshold; If the oil leakage area ratio threshold is greater than or equal to the first oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the first oil leakage level; If the oil leakage area ratio threshold is less than the first oil leakage area ratio threshold, and if the oil leakage area ratio threshold is greater than the second oil leakage area ratio threshold, the oil leakage severity of the tested hydraulic cylinder is determined to be the second oil leakage level; If the oil leakage area ratio threshold is less than or equal to the second oil leakage area ratio threshold, the oil leakage severity of the hydraulic cylinder to be tested is determined to be the third oil leakage level.
9. A method for detecting a cylinder fault based on machine vision, which is implemented based on the cylinder fault detection system based on machine vision according to any one of claims 1 to 8, characterized in that: The method comprises: Acquire a standard fault image, and acquire an RGB image of the hydraulic cylinder to be tested before or after adjustment, and clone the RGB image to obtain a copy image set; the copy image set includes a first copy image and a second copy image; Acquire image features when the hydraulic cylinder to be tested is leaking oil from the standard fault image; the image features include color features and gradient features; Dividing the first copy image into a mask area and a non-mask area according to the color feature, and marking the first copy image including the mask area as a first target image; dividing a foreground area and a background area from the second copy image according to the gradient feature, and marking the second copy image including the foreground area as a second target image; The first target image and the second target image are superimposed, and the overlapping area formed by the mask area and the foreground area after superposition is marked as the oil leakage area, and the oil leakage severity of the hydraulic cylinder to be tested is determined according to the pixel area of the oil leakage area.
Citation Information
Patent Citations
Image processing device and method
US20150310302A1
Image fusion method and apparatus, device and storage medium
WO2023155324A1