Visual quality inspection method, system and equipment suitable for gas hose
Through visual quality inspection methods and equipment, image processing technology is used to analyze the deformation area of the gas hose, which solves the problems of low efficiency and subjective results of existing quality inspection methods, and realizes the early detection of defects in the flexibility and pressure bearing capacity of the gas hose, which improves the accuracy and safety of quality inspection.
Patent Information
- Application Number
- CN202510322843.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-19
AI Technical Summary
The existing gas hose quality inspection methods are inefficient and the results are subjective. The defects of deteriorating flexibility and pressure bearing capacity cannot be detected in advance, resulting in reduced service life and safety hazards.
Visual quality inspection methods and equipment are used to clamp the gas hose and collect images during extrusion deformation through clamping and deformation, and use image processing technology to divide the deformation and non-deformed areas, determine the comprehensive abnormal areas, and judge the quality inspection results based on the average area of the connecting domain.
It realizes early detection of defects that are difficult to directly observe in gas hoses, improves quality inspection efficiency and accuracy, and reduces the safety risk of gas leakage.
Smart Images

Figure CN119845726A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a visual quality inspection method, system and equipment suitable for gas hoses. Background Art
[0002] Gas hoses will be corroded during long-term use, and their flexibility and pressure-bearing capacity will deteriorate. In addition, when there are deficiencies in the production process during the production of gas hoses, defects such as cracks will occur on their surfaces, which will greatly reduce the remaining service life of the gas hoses and even pose a risk of gas leakage. It is usually necessary to conduct regular quality inspections or factory quality inspections on gas hoses to ensure the safety of users' gas use.
[0003] Common quality inspection methods mainly include: relying on manual observation of the distribution of defects on its surface for quality inspection, and using combustible gas sensors for leak detection. The former has low quality inspection efficiency and subjective quality inspection results, while the latter can only determine that the gas hose is unqualified when it leaks. However, when there are some defects in the gas hose, these defects cannot be directly observed or will not cause leaks, but these defects may gradually become more serious as the gas hose continues to be used, resulting in worse flexibility and pressure bearing capacity, which in turn causes the remaining service life of the gas hose to continue to decrease, posing safety hazards, and even leaks before the next regular quality inspection. Summary of the invention
[0004] In order to solve the above problems, the present invention provides a visual quality inspection method, system and equipment suitable for gas hoses.
[0005] The visual quality inspection method, system and equipment for gas hoses of the present invention adopt the following technical solutions: An embodiment of the present invention provides a visual quality inspection device suitable for a gas hose, comprising: a handle, a wrench and a clamp installed on the handle, wherein the jaws open when the wrench is pressed, and the opened jaws clamp the gas hose in the middle of the clamp, and a plurality of columnar ball bearings are connected in a rolling manner inside the clamp, and when the clamp clamps the gas hose, the columnar ball bearings squeeze the outer wall of the gas hose, and a camera is installed on the visual quality inspection device; when the visual quality inspection device is working, the clamp clamps the gas hose and moves from top to bottom, and at the same time the camera faces the outer wall of the gas hose and collects multiple frames of images.
[0006] An embodiment of the present invention provides a visual quality inspection method applicable to a gas hose, using the above-mentioned visual quality inspection device applicable to a gas hose, the method comprising the following steps: Each frame of the acquired image is divided into a deformed area and a non-deformed area; any frame of the image is recorded as a target image, and the previous frame of the target image is recorded as a reference image; The deformed and non-deformed areas are used to obtain the comprehensive abnormal area, including: Obtain a sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image, and the position of the sub-region in the reference image is recorded as a displacement D; According to the texture difference between the pixel points in the deformed area in the target image and the reference area in the control image, the area in the target image where the defect occurs due to deformation is determined and recorded as the abnormal area of the target image; wherein the texture difference of the pixel points in the abnormal area is greater than a first preset threshold, and the reference area is the area corresponding to the deformed area of the control image after it is shifted down by D; Merging the abnormal regions of the target image and the control image into a comprehensive abnormal region; The deformed and non-deformed regions of the target image and the reference image are adjusted using the comprehensive abnormal region, so that the average area of the connected domain is the largest in the comprehensive abnormal region re-obtained using the adjusted deformed and non-deformed regions; In the recovered comprehensive abnormal area, when the average area of the connected domain is greater than a second preset threshold, the gas hose (5) fails the quality inspection.
[0007] Preferably, the step of dividing the deformed area and the non-deformed area in each frame of image comprises the following specific steps: The area with a height of H in the middle of each frame image is recorded as the deformation area, and the area above the deformation area in each frame image is recorded as the non-deformation area; H is a preset value, and the width of the deformation area and the non-deformation area is equal to the width of each frame image.
[0008] Preferably, the step of obtaining a sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image comprises the following specific steps: The non-deformed area of the target image is equally divided into a number of rectangular windows, and the grayscale values of all pixels in each rectangular window are used as a template. Based on the template, a template matching algorithm is used to perform template matching in the non-deformed area of the reference image to obtain a matching area of each rectangular window, wherein the matching area has a matching similarity with the template; The minimum bounding rectangle of all matching regions whose matching similarity is greater than a preset matching threshold is taken as the sub-region.
[0009] Preferably, the position of the sub-region in the reference image specifically refers to: the row number where the upper boundary of the sub-region is located in the reference image.
[0010] Preferably, the step of determining the region in the target image where defects are caused by deformation based on the texture difference between the pixels in the deformed region in the target image and the reference region in the control image is recorded as the abnormal region of the target image; wherein the texture difference of the pixels in the abnormal region is greater than a first preset threshold value, comprises the following specific steps: For pixel point a and pixel point b at the same position in the deformation area of the target image and the reference area of the comparison image respectively; for straight lines passing through pixel point a and pixel point b respectively and having the same inclination, the grayscale values of the pixel points on the straight lines constitute grayscale curves Sa and Sb; A curve segment most similar to Sb is obtained on Sa, and the curve difference between the curve segment and Sb is recorded as the texture difference of pixel a at each inclination angle; the average of the texture differences of all pixels in the deformed area in the target image at the same inclination angle is obtained, recorded as the average texture difference at each inclination angle, the inclination angle max with the largest average texture difference is obtained, and the texture difference of pixel a at the inclination angle max is recorded as the second texture difference of pixel a; when the second texture difference is greater than the first preset threshold th1, pixel a is recorded as an abnormal pixel, and all abnormal pixels in the deformed area in the target image constitute the abnormal area of the target image.
[0011] Preferably, the method of adjusting the deformed area and the non-deformed area of the target image and the reference image by using the comprehensive abnormal area so that the average area of the connected domain is the largest in the comprehensive abnormal area re-obtained by using the adjusted deformed area and the non-deformed area comprises the following specific steps: For the new deformed area and the non-deformed area obtained after sequentially changing the height H of the deformed area, the comprehensive abnormal area obtained by using the new deformed area and the non-deformed area is recorded as the comprehensive abnormal area obtained again after changing H; The value after the i+1th change of H is ,in , represents the value after the i-th change of H, represents the scaling factor when H is changed for the i+1th time, represents the scaling factor when H is changed for the i-th time; represents the Pearson correlation coefficient; After changing H several times in sequence, stop changing H, and for all the obtained comprehensive abnormal areas, obtain the average area of all connected domains in each comprehensive abnormal area, and the deformed area and non-deformed area obtained by H corresponding to the maximum average area are taken as the adjusted deformed area and non-deformed area; The Pearson correlation coefficient The method to obtain is: Obtain the texture adhesion trend in the integrated abnormal area when H changes twice adjacently; After the i-th change of H, the texture adhesion trends in all the integrated abnormal regions that are regained constitute the texture adhesion trend; after the i-th change of H, all values of H constitute the sequence LH, and the Pearson correlation coefficient between the sequence LH and the texture adhesion trend sequence is recorded as .
[0012] Preferably, the step of obtaining the texture adhesion trend in the abnormal area when H is changed twice adjacently includes the following specific steps: The comprehensive abnormal regions obtained when H is changed twice consecutively are recorded as K1 and K2, respectively, and K1 is obtained before K2; For any connected domain in K2, it is recorded as the target connected domain, and the connected domain with the largest intersection with the target connected domain is obtained on K1, which is recorded as the reference connected domain; in K2, the average of the distances between the target connected domain and the several connected domains closest to the target connected domain is recorded as the first distance; in K1, the average of the distances between the reference connected domain and the several connected domains closest to the reference connected domain is recorded as the second distance, and the difference between the second distance and the first distance is recorded as the texture adhesion trend.
[0013] Preferably, the step of obtaining a curve segment on Sa that is most similar to Sb, wherein the curve difference between the curve segment and Sb is recorded as the texture difference of the pixel point a at each inclination angle, comprises the following specific steps: Use multiple preset sliding windows to slide on Sa, and calculate the DTW distance between the grayscale value in the window and the grayscale value in Sb during each sliding process. During the sliding process when the DTW distance is the smallest, the curve segment corresponding to the grayscale value in the window is recorded as the most similar curve segment; the minimum DTW distance is recorded as the texture difference of pixel point a at each inclination angle.
[0014] Another embodiment of the present invention provides a visual quality inspection system for gas hoses, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned visual quality inspection method for gas hoses when executing the computer program.
[0015] The beneficial effects of the technical solution of the present invention are: The present invention provides a visual quality inspection device suitable for a gas hose, which can squeeze different positions of the gas hose and collect images of the squeeze deformation. These images may contain defects that are difficult to observe directly, but will cause the flexibility and pressure bearing capacity of the gas hose to deteriorate and the service life to be shortened. The device avoids problems such as low quality inspection efficiency and the risk of gas leakage caused by the quality inspection results being obtained only when there is a leak.
[0016] Furthermore, the visual quality inspection device of the present invention runs a visual quality inspection method suitable for gas hoses, which determines the displacement D corresponding to two adjacent frames of images through the initially divided non-deformed area, and obtains a comprehensive abnormal area based on the displacement D and the deformed area initially divided on the next frame of image and the texture difference between the reference area in the previous frame of image that belongs to the same position as the deformed area before deformation; this process can obtain the defective area of the gas hose caused by deformation before and after extrusion, ensuring that defects that are difficult to observe directly but will make the gas hose less flexible and pressure-bearing and shorten its service life can be detected. Compared with the conventional method that relies on manual observation and combustible gas sensor leakage detection, the present invention can detect possible safety hazards in advance, so that the quality inspection results can better maintain the gas safety of gas hose users.
[0017] Further, the method uses the comprehensive abnormal area to adjust the deformation area and non-deformation area of the target image and the control image, so that in the comprehensive abnormal area re-obtained by using the adjusted deformation area and non-deformation area, the average area of the connected domain is the largest; in the re-obtained comprehensive abnormal area, when the average area of the connected domain is greater than the second preset threshold, the gas hose quality inspection fails. This process takes into account that different gas hoses or different parts of the same gas hose may have different deformation characteristics, for example, different positions are subjected to different aging corrosion conditions, resulting in different flexibility and pressure bearing capacity at different positions, and thus resulting in different deformation conditions of the gas hose when squeezed. This embodiment re-adjusts and divides the deformation area and non-deformation area in the image by the defect distribution in the comprehensive abnormal area, avoiding the error in the displacement D when the deformation area and non-deformation area are not accurately divided, thereby avoiding the problem of inaccurate acquisition of defects in the comprehensive abnormal area (defective area caused by deformation). Further, the deformed area and non-deformation area adjusted by the present invention make the texture distribution in the comprehensive abnormal area as obvious as possible, further improve the reliability of the division of the deformed area and non-deformation area, so that when quality inspection is carried out based on whether the defect distribution in the comprehensive abnormal area is obvious or not, it can be prevented as much as possible. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] 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.
[0019] Figure 1 It is a schematic diagram of the first axial structure of the visual quality inspection equipment for gas hoses according to the present invention; Figure 2 The visual quality inspection device for gas hose of the present invention is Figure 1 The enlarged structural diagram at A in the middle; Figure 3 It is a schematic diagram of the second axial structure of the visual quality inspection device for gas hoses of the present invention; Figure 4 It is a front view structural schematic diagram of the visual quality inspection device for gas hoses according to the present invention; Figure 5 It is a schematic diagram of a top cross-sectional structure of a visual quality inspection device for a gas hose according to the present invention; Figure 6 It is a flowchart of the steps of the visual quality inspection method for gas hoses according to the present invention.
[0020] The following are the descriptions of the reference numerals: 1. Handle; 2. Wrench; 3. Clamp; 4. Jaw; 5. Gas hose; 6. Cylindrical ball; 7. Camera. DETAILED DESCRIPTION
[0021] 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 visual quality inspection method, system and equipment for gas hoses proposed according to the present invention, its specific implementation, structure, features and effects, 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.
[0022] 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.
[0023] The specific scheme of the visual quality inspection method, system and equipment applicable to the gas hose provided by the present invention is described in detail below with reference to the accompanying drawings.
[0024] Embodiment 1: See also Figure 1 , Figure 2 , Figure 3 , Figure 4 as well as Figure 5 , which shows the specific structure of a visual quality inspection device for a gas hose provided by an embodiment of the present invention. The visual quality inspection device includes: a handle 1, a wrench 2, a clamp 3, a cylindrical ball 6 and a camera 7.
[0025] The wrench 2 and the clamp 3 are installed on the handle 1. The clamp 3 has a jaw 4. When the wrench 2 is bounced (that is, not pressed), the jaw 4 is closed. When the wrench 2 is pressed, the jaw 4 opens. The opened jaw 4 clamps the gas hose 5 in the middle of the clamp 3.
[0026] The structure formed by the handle 1, the wrench 2, and the clamp 3 is a well-known technology. For example, a clamp ammeter has this structure, and it will not be described in detail in this embodiment.
[0027] A plurality of (for example, 4) columnar balls 6 are embedded in both sides of the inner wall of the clamp 3. For example, there are two columnar balls 6 on the left inner wall of the clamp 3 and two columnar balls 6 on the right inner wall. At the same time, each columnar ball 6 is rollingly connected to the clamp 3 (that is, the columnar ball 6 can roll along its own axis). When the clamp 3 clamps the gas hose 5, the columnar ball 6 squeezes the outer wall of the gas hose 5, causing local deformation of the gas hose 5.
[0028] like Figure 2 , Figure 4 As shown, the camera 7 is installed on the visual quality inspection device. In this embodiment, two cameras 7 are installed (on the upper and lower sides of the clamp 3 respectively), and in other embodiments, at least one camera 7 is installed. The camera 7 is facing the outer wall of the gas hose 5. The camera 7 is used to collect the image of the outer wall of the gas hose 5, and the image contains the deformation information of the outer wall of the gas hose 5 under the compression of the columnar ball 6. The image collected in this embodiment is a grayscale image. In other embodiments, if a color image is collected, it needs to be grayscaled into a grayscale image.
[0029] The working principle of this visual quality inspection equipment is: Hold the handle 1 and press the wrench 2 to open the jaws 4 on the clamp 3, insert the gas hose 5 into the jaws 4, then release the wrench 2 so that the clamp 3 clamps the outer wall of the gas hose 5; then hold the handle 1 and move the visual quality inspection device from top to bottom along the gas hose 5. When it moves to the lower end of the gas hose 5, remove the visual quality inspection device from the gas hose 5.
[0030] In the process of moving the visual quality inspection device from top to bottom, the camera 7 collects multiple frames of images in real time (for example, one frame of image is collected every 0.2). After the visual quality inspection device is removed from the gas hose 5, the visual quality inspection device uses the WIFI module (not marked in the figure) thereon to upload all the collected frame images to the server. A visual quality inspection system suitable for the gas hose is run in the server, and the visual quality inspection system is used to inspect the gas hose 5 according to all the frame images.
[0031] In other embodiments, the visual quality inspection system runs directly on the visual quality inspection device.
[0032] It should be noted that in order to ensure that the size or weight of the visual quality inspection equipment is not too large, the camera 7 adopts a small and light planar CCD array (or CCD sensor), and the resolution of the image collected is relatively low. In this embodiment, the width and height of the image are 64×256. At the same time, due to the low resolution of the image (that is, the image size is small), the WIFI module consumes less power and takes less time to transmit when transmitting the image to the server.
[0033] It should be further explained that before the visual quality inspection device clamps the gas hose 5 , the outer wall of the gas hose 5 needs to be wiped clean to prevent stains on the outer wall of the gas hose 5 from interfering with the quality inspection.
[0034] Embodiment 2: This embodiment provides a visual quality inspection system for a gas hose, the visual quality inspection system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a visual quality inspection method for a gas hose when executing the computer program. The visual quality inspection method further obtains a quality inspection result of the gas hose 5 based on all frame images.
[0035] Embodiment three: like Figure 6 As shown, this embodiment provides a visual quality inspection method applicable to a gas hose, the method comprising: Step S301: Divide each frame of image collected from top to bottom along the gas hose into a deformed area and a non-deformed area.
[0036] For each frame of image captured, the image is captured when the cylindrical ball 6 squeezes the outer wall of the gas hose 5. Therefore, the middle area of each frame of image contains image information when the gas hose 5 is squeezed and deformed, and the upper area of each frame of image contains image information when the gas hose 5 is not squeezed and deformed.
[0037] In this embodiment, a rectangular area with a height of H in the middle of each frame of image is recorded as a deformation area (that is, the horizontal center line of the deformation area coincides with the horizontal center line of the image), and a rectangular area above the deformation area in each frame of image is recorded as a non-deformation area; wherein H is a preset value, and the widths of the deformation area and the non-deformation area are equal to the width of each frame of image. In this embodiment, H is equal to one quarter of the image height (rounded up), and in other embodiments, H may also be set to other values, which are not specifically limited in this embodiment. For example, the value range of H is: greater than or equal to one tenth of the image height, and less than or equal to one quarter of the image height (if it is a decimal, it needs to be rounded up).
[0038] Step S302: any frame image is recorded as the target image, the previous frame image of the target image is recorded as the reference image, and the sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image is obtained, and the position of the sub-region in the reference image is recorded as the displacement D.
[0039] For two adjacent frames of target image and comparison image, both are collected at two adjacent positions on the gas hose 5. The displacement D is used to describe the displacement between two adjacent positions.
[0040] The sub-region describes the region in the target image and the reference image respectively, which contains the same local texture information on the outer wall of the gas hose 5. In other words, the partial texture in the non-deformed region in the target image and the texture in the sub-region in the reference image correspond to the same region on the outer wall of the gas hose 5.
[0041] As an optional example, obtaining a sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image includes the following methods: The non-deformed area of the target image is used as a template. Based on the template, a template matching algorithm is used to perform template matching in the non-deformed area of the reference image to obtain a matched area, which is recorded as the sub-area with the most similar texture.
[0042] It should be noted that, since the size of the non-deformed area in the target image and the non-deformed area in the reference image is the same, the non-deformed area in the target image needs to be proportionally reduced as a template (for example, the width and height are reduced by 4 times respectively).
[0043] In some other examples, a template matching algorithm may be used to perform template matching in the entire reference image to obtain a matched area, which is recorded as a sub-area with the most similar texture.
[0044] The advantages of this optional example are: on the one hand, the calculation speed is fast, and it is suitable for the following scenarios: the system in Example 2 runs on the device described in Example 1. On the other hand, the non-deformed area of the target image is taken as a whole, and the sub-area with the most similar overall texture can be obtained in the non-deformed area of the reference image. However, the disadvantage of this optional example is that when the non-deformed area of the target image in step S301 is not accurately divided, for example, when the non-deformed area of the target image actually contains the area where the gas hose 5 is deformed due to squeezing, and at the same time, since the resolution of the target image and the reference image is not high, both of them are easily interfered by noise, resulting in errors in the obtained sub-area (that is, the obtained sub-area may not be the same local area describing the gas hose 5 in the target image and the reference image).
[0045] As a preferred example, obtaining a sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image includes the following method: The non-deformed area of the target image is equally divided into a number of rectangular windows (e.g., 8), the grayscale values of all pixels in each rectangular window are used as a template, and a template matching algorithm is used based on the template to perform matching in the non-deformed area of the reference image to obtain a matching area of each rectangular window; wherein, according to the template matching algorithm, it can be known that there is a matching similarity between the matching area and the template, which is recorded as the texture similarity of each rectangular window and its matching area; All matching regions whose texture similarity is greater than a preset matching threshold are obtained, and the minimum bounding rectangles of these matching regions are used as the sub-regions. In this example, the preset matching threshold is 0.5, and other values may be set in other embodiments.
[0046] The amount of calculation in this preferred example is relatively large, and it is suitable for the following scenarios: the system in Example 2 runs on the server in Example 1. In addition, this preferred example divides the non-deformed area of the target image into several local areas (i.e., rectangular windows) to find the sub-areas. Although it is impossible to find the sub-area with the most similar texture from the overall texture distribution, it can avoid the interference of the image information that is deformed by compression and mixed locally in the non-deformed area to a certain extent (i.e., the interference caused by inaccurate division of the non-deformed area).
[0047] As an example, the position of the sub-region in the reference image is recorded as the displacement D, and the specific method includes: In the comparison image, the row number where the upper boundary of the sub-region (that is, the upper side of the rectangle corresponding to the sub-region) is located is taken as the displacement D.
[0048] As another example, the row number where the horizontal center line of the sub-region is located is taken as the displacement D.
[0049] The displacement D is used to describe the displacement between two adjacent positions, that is, the texture area of the gas hose 5 included in the target image is located at a distance D below the texture area of the gas hose 5 included in the reference image.
[0050] Step S303: According to the texture difference between the pixel points in the deformed area in the target image and the reference area in the control image, determine the area in the target image where defects occur due to deformation, and record it as the abnormal area of the target image. The reference area is the area corresponding to the deformed area of the control image after it is shifted down by D.
[0051] The reference area in the comparison image refers to the area corresponding to the deformation area of the comparison image after it moves down by D. The reference area and the deformation area in the target image refer to the areas describing the same local area of the gas hose 5 before and after being squeezed and deformed in the comparison image and the target image, respectively.
[0052] The abnormal area obtained based on the reference area and the deformed area in the target image represents the defect area in the target image that is generated (or becomes obvious) due to deformation.
[0053] As an example, the specific method of obtaining the reference area is: When the displacement D is obtained using the upper boundary of the sub-region described in step S302, the reference region refers to a rectangular region obtained by moving the deformed region of the reference image downward so that its upper boundary moves downward by D.
[0054] As another example, a specific method for obtaining the reference area is: When the displacement D is obtained using the horizontal center line of the sub-region described in step S302, the reference region refers to a rectangular region obtained by moving the deformed region of the reference image downward so that its horizontal center line moves downward by D.
[0055] As an optional example, according to the texture difference between the pixel points in the deformed area in the target image and the reference area in the comparison image, the area in the target image where the defect occurs due to the deformation is determined and recorded as the abnormal area of the target image, including the specific method of: For any pixel point a in the deformed area of the target image, and the pixel point b at the same position as the pixel point a in the reference area of the control image, the absolute value of the difference between the grayscale value of the pixel point a and the grayscale value of the pixel point b is obtained, which is recorded as the texture difference of the pixel point a in the deformed area of the target image. When the texture difference is greater than or equal to the first preset threshold th1, the pixel point a is recorded as an abnormal pixel point, and all abnormal pixels in the deformed area of the target image constitute the abnormal area of the target image.
[0056] This embodiment is described by taking th1=50 as an example. In other embodiments, th1 may be set to other values, which are not specifically limited in this embodiment.
[0057] In other embodiments, the Sobel operator may be used to obtain the gradients of pixel a and pixel b respectively (specifically, a vector consisting of the gradient amplitude and the gradient direction), and the Euclidean distance between the gradients of pixel a and pixel b is recorded as the texture difference of pixel a.
[0058] As another optional example, according to the texture difference between the pixel points in the deformed area in the target image and the reference area in the control image, the area in the target image where the defect occurs due to the deformation is determined and recorded as the abnormal area of the target image, including the specific method of: In the deformed area in the target image, the mean value Aa of the texture differences of all pixels in the neighborhood of pixel point a (for example, in the eight-neighborhood) is obtained, and in the reference area in the control image, the mean value B of the texture differences of all pixels in the neighborhood of pixel point b (for example, in the eight-neighborhood) is obtained, and the absolute value of the difference between Aa and B is recorded as the first texture difference of pixel point a. When the first texture difference is greater than or equal to the first preset threshold th1, pixel point a is recorded as an abnormal pixel, and all abnormal pixels in the deformed area in the target image constitute the abnormal area of the target image.
[0059] The calculation amount of the above optional example is relatively small, and it is applicable to the following scenario: the system in Example 2 is run on the device described in Example 1. At the same time, when there are no obvious patterns on the outer wall of the gas hose 5 or there is no large amount of stain interference on the outer wall of the gas hose 5, the acquisition result of the abnormal area is relatively accurate.
[0060] As a preferred example, according to the texture difference between the pixel points in the deformed area in the target image and the reference area in the comparison image, the area in the target image where the defect occurs due to deformation is determined and recorded as the abnormal area of the target image, including the specific method of: This preferred example takes into account that when there are obvious patterns or stains on the outer wall of the gas hose 5 (for example, the stains are not wiped off or are not wiped off cleanly), the deformed area in the target image is deformed due to extrusion, resulting in extrusion of the texture therein (or, for the texture in the deformed area in the target image, the texture in the reference area of the image is stretched and offset), which leads to inaccurate acquisition of the texture difference of pixel point a in the above optional example.
[0061] In this preferred example, a plurality of straight lines (for example, 10 straight lines) passing through pixel point a are obtained, the angle between two adjacent straight lines remains the same, and each straight line has an inclination angle; this embodiment does not limit the number of the plurality of straight lines of pixel point a.
[0062] For each straight line, in the deformation area of the target image, in the neighborhood of pixel point a (for example, in a 13×13 neighborhood centered on pixel point a), the grayscale values of the pixels through which the straight line passes are obtained. These grayscale values form a grayscale curve, with the horizontal axis being the position of the pixel on the straight line (with pixel point a as the origin), and the vertical axis being the grayscale value of the pixel.
[0063] So far, for each pixel point in the deformation area of the target image, each pixel point corresponds to several straight lines, and a grayscale curve is obtained on each straight line. Similarly, for each pixel point in the reference area of the comparison image, each pixel point also corresponds to several straight lines, and a grayscale curve is obtained on each straight line.
[0064] For a straight line at the same inclination angle, the grayscale curve corresponding to pixel a is recorded as Sa, and the grayscale curve corresponding to pixel b is recorded as Sb. A curve segment most similar to the grayscale curve Sb is obtained on the grayscale curve Sa, and the curve difference between the curve segment and the grayscale curve Sb is recorded as the texture difference of pixel a on each straight line (or recorded as the texture difference of pixel a at each inclination angle).
[0065] The mean value of the texture difference of all pixels in the deformed area of the target image at the same inclination angle is obtained, which is recorded as the average texture difference at each inclination angle. The inclination angle max at which the average texture difference is the largest is obtained. The inclination angle max represents the texture extrusion and offset direction of the gas hose 5 before and after being squeezed. The texture difference of the pixel point a at the inclination angle max is recorded as the second texture difference of the pixel point a.
[0066] When the second texture difference is greater than or equal to the first preset threshold th1, the pixel a is recorded as an abnormal pixel, and all abnormal pixels in the deformed area of the target image constitute the abnormal area of the target image.
[0067] In this preferred example, the abnormal area of the target image is further accurately divided when the texture is compressed (or squeezed) and offset. The computational complexity of this preferred example is relatively large, and it is applicable to the following scenarios: the system in the second embodiment runs on the server described in the first embodiment.
[0068] As an example, a curve segment most similar to the grayscale curve Sb is obtained on the grayscale curve Sa, and the curve difference between the curve segment and the grayscale curve Sb is recorded as the texture difference of the pixel point a on each straight line, including the following methods: (1) All grayscale values on the grayscale curves Sa and Sb constitute a grayscale value sequence La and Lb respectively. A sliding window is preset, and the window length of the sliding window is set to 5.
[0069] (2) The sliding window slides on La with a step size of 1. After each sliding, the DTW distance between the grayscale value in the sliding window and Lb is calculated. After the sliding window is completed, the sliding process with the smallest DTW distance and the DTW distance during that sliding are recorded.
[0070] (3) Then increase the window length of the sliding window by one and repeat the process in (2).
[0071] (4) Increase the window length of the sliding window by one again, and repeat the process in (2), and so on, until the window length of the sliding window is equal to the length of La, then stop increasing the window length and stop sliding.
[0072] (5) For the sliding process with the smallest DTW distance recorded in the above process, and the DTW distance during this sliding process, the curve segment corresponding to the grayscale value in the window on the grayscale curve Sa during this sliding process is taken as the curve segment obtained on the grayscale curve Sa and most similar to the grayscale curve Sb. The DTW distance during this sliding process is taken as the texture difference of the pixel point a on each straight line.
[0073] The DTW distance is obtained by a DTW algorithm, which is a well-known technique and will not be described in detail in this embodiment.
[0074] Step S304: merge the abnormal regions of the target image and the control image into a comprehensive abnormal region; and use the comprehensive abnormal region to adjust the deformed region and the non-deformed region of the target image and the control image, so that the average area of the connected domain is the largest in the comprehensive abnormal region re-obtained using the adjusted deformed region and the non-deformed region.
[0075] (1) The abnormal regions of the target image and the control image are merged into a comprehensive abnormal region.
[0076] The above steps S301 to S303 obtain the abnormal area of the target image. Similarly, for all the acquired frame images, the abnormal area of each frame image is obtained using the same method. In particular, since there is no previous frame image before the first frame image, the first frame image cannot be used as the target image to implement all embodiments of the present invention, and the abnormal area in the first frame image is no longer obtained.
[0077] The abnormal regions of two adjacent frames of images are merged (that is, the abnormal regions of the target image and the control image are merged), including the specific method of: First of all, it should be noted that no matter the target image or the control image, its abnormal area is within the deformation area of both.
[0078] As described in step S302 , the displacement D is used to describe the texture area of the gas hose 5 included in the target image, which is located at a distance D below the texture area of the gas hose 5 included in the reference image.
[0079] Therefore, the abnormal area in the reference image is moved up by a distance D, and then the abnormal area in the reference image that has been moved up and the abnormal area in the target image are simultaneously marked (or drawn) in the target image to obtain a merged comprehensive abnormal area.
[0080] The comprehensive abnormal area describes the defect areas (such as cracks, pit areas caused by corrosion or aging, etc.) that are generated or enlarged due to deformation before and after extrusion when the gas hose 5 is extruded at different positions. When there are obvious defect areas in the comprehensive abnormal area, it means that the remaining service life of the gas hose 5 is short. When there are no obvious defect areas in the comprehensive abnormal area, it means that the remaining service life of the gas hose 5 is long and it can be used without worry.
[0081] (2) The deformed area and the non-deformed area of the target image and the reference image are adjusted using the comprehensive abnormal area, so that the average area of the connected domain is maximized in the comprehensive abnormal area obtained using the adjusted deformed area and the non-deformed area.
[0082] First of all, it should be noted that this embodiment determines the displacement D corresponding to two adjacent frames of images through the initially divided non-deformed area (i.e., step S301), and obtains the comprehensive abnormal area based on the displacement D and the initially divided deformed area on the next frame of image and the texture difference between the reference area in the same position as the deformed area before deformation in the previous frame of image. However, this process may have the following problems: Taking into account that different gas hoses or different local areas of the same gas hose may have different flexibility and pressure bearing capacity, the deformation area and non-deformation area generated when squeezed and deformed are different; note that since there is a transition between the deformation area and the non-deformation area, the non-deformation area described in this embodiment refers to the relative deformation area.
[0083] When the deformation area and non-deformation area initially divided on each image in step S301 are inappropriate, for example, some areas that are obviously deformed due to extrusion are divided into non-deformation areas, step S302 still has a large error when obtaining the displacement D, especially when the system in Example 2 runs on the device described in Example 1.
[0084] Since the resolution of the acquired image is low, the texture information in the image is greatly interfered by noise, resulting in that even if the displacement D has a small error, the obtained comprehensive abnormal area will be inaccurate.
[0085] When the comprehensive abnormal area is inaccurate, even if there are obvious defects on the gas hose 5 due to extrusion deformation, the defective area in the comprehensive abnormal area may not be obvious (for example, there are many discrete and isolated connected domains distributed in the comprehensive abnormal area, and no obvious defective connected domain is formed). In this case, it is necessary to readjust or divide the deformed area and the non-deformed area in the target image and the reference image.
[0086] Since the target image and the reference image are images of adjacent frames, although there are differences in the extrusion deformation conditions at different positions on the gas hose 5, such differences in the images of adjacent frames are negligible (or the error compared to the displacement D is negligible). Therefore, the deformed area and the non-deformed area of the adjusted target image are the same as the deformed area and the non-deformed area of the adjusted reference image.
[0087] As an optional example, the deformed area and the non-deformed area of the target image and the reference image are adjusted using the comprehensive abnormal area so that the average area of the connected domain is the largest in the comprehensive abnormal area re-obtained using the adjusted deformed area and the non-deformed area, including the following methods: Set H in step S301 to different values in sequence, for example, set H to p times the image height in sequence, In other embodiments, p may be set to other values, which are not specifically limited in this embodiment.
[0088] Each value of H corresponds to a deformation area and a non-deformation area division result (see step S301 for details). Based on the deformation area and the non-deformation area corresponding to each H, the comprehensive abnormal area is obtained again according to the method included in steps S302 to S304, and the average value Y of the areas of all connected domains in the comprehensive abnormal area (that is, the average area of the connected domains in the comprehensive abnormal area) is obtained. Each value of H corresponds to a Y, and the value of H with the largest Y is obtained. The deformation area and the non-deformation area corresponding to the value of H are used as the deformation area and the non-deformation area after adjustment of the target image and the reference image.
[0089] The larger the above average value Y is, the more it indicates that there may be obvious texture areas in the comprehensive abnormal area (that is, defect areas that are generated or enlarged due to deformation before and after extrusion).
[0090] In this example, a huge amount of calculation is required to obtain the comprehensive abnormal area under multiple H values, and the calculation speed is slow.
[0091] It should be noted that, in order to avoid the problem that the above average value Y cannot reflect whether the texture in the comprehensive abnormal area is obvious when isolated small connected domains and large connected domains exist at the same time, other embodiments provide a method for calculating the average value Y, including: For each connected domain in the integrated abnormal area, the area size of all connected domains is clustered by K-Means to obtain two categories, and the average values of all areas in the two analogies are obtained, recorded as m1 and m2, where m1 is greater than or equal to m2. When the ratio of m2 to m1 is less than 0.25, it is determined that there are relatively more large connected domains in the integrated abnormal area, and the small connected domains are regarded as interference. At this time, the average value Y is m1; when the ratio of m2 to m1 is greater than or equal to 0.25, the average value Y is the average of m1 and m2.
[0092] In particular, if there are less than 2 connected domains in the comprehensive abnormal area, this method will no longer be used to calculate the average value Y.
[0093] In other embodiments, 0.25 may be replaced by other values, which are not specifically limited in this embodiment.
[0094] As a preferred example, the deformed area and the non-deformed area of the target image and the reference image are adjusted using the comprehensive abnormal area so that the average area of the connected domain is the largest in the comprehensive abnormal area re-obtained using the adjusted deformed area and the non-deformed area, including the following methods: Increase H by w times step by step, where the value of H after the i-1th increase by w times is recorded as , then the value of H after the i-th increase by w times is recorded as ,in represents the value of w when H is increased by w times for the i-th time (also known as the scaling factor). The value of H before H is gradually increased by w times for the first time is the value of H set in step S301. In this embodiment, the value of w when H is gradually increased by w times for the first time is In other embodiments, The value may be set to other values, which are not specifically limited in this embodiment.
[0095] Each time H is increased by w times (taking the i-th increase by w times as an example), the following processing is performed: (1) Obtain the comprehensive anomaly region obtained after the i-th increase in H. For this comprehensive anomaly region and all comprehensive anomaly regions obtained before the i-th increase in H, these comprehensive anomaly regions are arranged in the order of their acquisition time into a comprehensive anomaly region sequence (whose length is at least 2). For the two adjacent comprehensive anomaly regions K1 and K2 in the sequence (K1 is before K2).
[0096] (2) For any connected domain in K2, record it as the target connected domain, and obtain the connected domain with the largest intersection with the target connected domain on K1, record it as the reference connected domain. In particular, if there is no connected domain in K1 that intersects with the target connected domain, then the connected domain in K1 whose center point is closest to the center point of the target connected domain is recorded as the reference connected domain.
[0097] The reference connected domain and the target connected domain describe the areas that may belong to the same defect location before and after the value of H changes.
[0098] (3) In K2, the Nk connected domains closest to the target connected domain are obtained, and the average of the distances between the target connected domain and the Nk connected domains is recorded as the first distance; in K1, the Nk connected domains closest to the reference connected domain are obtained, and the average of the distances between the reference connected domain and these Nk connected domains is recorded as the second distance. The difference between the second distance and the first distance is recorded as the texture adhesion trend after increasing H for the i-th time.
[0099] This embodiment is described by taking Nk=3 as an example. Specifically, when there are less than Nk connected domains in K1 or K2, the value of Nk is equal to the total number of connected domains in K1 or K2. In other embodiments, Nk can be set to other values, which are not specifically limited in this embodiment.
[0100] The distance between connected domains refers to the distance between the center points of the connected domains.
[0101] In other embodiments, the distance between the target connected domain and the reference connected domain may be used as the texture adhesion trend. This method sacrifices the accuracy of the texture adhesion trend in exchange for a faster calculation speed.
[0102] The greater the texture adhesion trend is, the more it means that after increasing H for the ith time, the connected domains in the comprehensive abnormal region have a tendency to aggregate into a more obvious texture. On the contrary, it means that there is no tendency to aggregate into a more obvious texture.
[0103] (4) The texture adhesion trends corresponding to all adjacent comprehensive anomaly regions in the comprehensive anomaly region sequence constitute a texture adhesion trend sequence. The sequence of H values obtained after the i-th increase in H is recorded as LH. The Pearson correlation coefficient between the sequence LH and the texture adhesion trend sequence is recorded as ,in .
[0104] The larger it is, the more obvious the texture structure tends to be in the comprehensive anomaly area as the value of H changes. The smaller it is, it means that with the change of H, there tends to be no obvious texture structure in the comprehensive anomaly area.
[0105] Then the value after increasing H for the i+1th time is ,in .
[0106] Using the above methods (1) to (4), H is gradually increased by w times. The trend of w is updated each time it is increased, so that the value of H after increasing by w times can ensure as much as possible that the connected domains in the comprehensive abnormal area have a tendency to stick together as an obvious texture.
[0107] It should be noted that, in this embodiment, the value of w can be greater than or equal to 0 or less than 0; for example When it is greater than or equal to 0, it means that the value of H is increased for the i-th time. Times. When it is less than 0, it means that the value of H for the i-th time is reduced times.
[0108] Another example: when is greater than 0, and When it is also greater than 0, it means that as the value of H increases, there tends to be obvious texture structure in the comprehensive abnormal area. is greater than This means that the value of H increases with a greater growth trend for the i+1th time.
[0109] when is greater than 0, and When it is less than 0, it means that as the value of H increases, there is no obvious texture structure in the comprehensive abnormal area. is less than This means that the value of H will no longer increase with a greater growth trend for the i+1th time (or H will increase with a slower trend).
[0110] when is less than 0, and When it is greater than 0, it means that as the value of H decreases, there tends to be obvious texture structure in the comprehensive abnormal area. is less than This means that the value of H is reduced with a greater decreasing trend for the i+1th time.
[0111] when is less than 0, and When it is less than 0, it means that as the value of H decreases, there is no obvious texture structure in the comprehensive abnormal area. is greater than This means that the value of H will no longer decrease with a greater decreasing trend for the i+1th time (or H will decrease with a slower trend).
[0112] (5) In this preferred example, when H is gradually increased for 10 times, the increase of H is stopped. For all the obtained comprehensive abnormal areas, the average value Y (i.e., the average area) of all connected domains in each comprehensive abnormal area is obtained, and the H corresponding to the maximum average value Y is obtained. The deformation area and non-deformation area corresponding to the H are used as the adjusted deformation area and non-deformation area. In other embodiments, "gradually increasing 10 times" can also be replaced by other times, which is not specifically limited in this embodiment.
[0113] In particular, when H is increased twice in succession, the value of H is always greater than four-fifths of the image height, or always less than one-sixteenth of the image height, then the increase of H is also stopped.
[0114] In summary, compared with the optional example, this preferred example can calculate the next value of H according to the change of the adhesion trend of the connected domain in the abnormal area under different H values, thereby avoiding the inaccurate or unreasonable setting of the value of H in the optional example.
[0115] Step S305: In the re-obtained comprehensive abnormal area, when the average area of the connected domain is greater than the second preset threshold, the gas hose quality inspection fails.
[0116] For the deformed area and the non-deformed area of the adjusted target image obtained in step S304, the comprehensive abnormal area is re-obtained according to steps S302 to S304 based on the deformed area and the non-deformed area, and the average area of the connected domain of the comprehensive abnormal area is obtained and recorded as the detection result of the target image.
[0117] For all the collected images (excluding the first frame image, because the first frame image cannot be used as the target image to implement all the above steps of this embodiment), if the detection result of any image is greater than the second preset threshold th2, it means that the service life of the gas pipe is obviously low and the quality inspection fails. At this time, an early warning is issued and the user is notified to replace the gas hose 5 or shorten the quality inspection time interval of the user's gas hose 5.
[0118] When the detection results of all images are less than or equal to the second preset threshold th2, the detection is qualified.
[0119] This embodiment is described by taking th2=200 as an example. In other embodiments, th2 may be set to other values, which are not specifically limited in this embodiment.
[0120] This embodiment is now completed.
[0121] The present invention provides a visual quality inspection device suitable for a gas hose, which can squeeze different positions of the gas hose 5 and collect images of the squeeze deformation. These images may contain defects that are difficult to observe directly, but will cause the flexibility and pressure bearing capacity of the gas hose 5 to deteriorate and the service life to be shortened. The device avoids problems such as low quality inspection efficiency and the risk of gas leakage caused by the quality inspection results being obtained only when there is a leak.
[0122] Furthermore, the visual quality inspection device of the present invention runs a visual quality inspection method suitable for gas hoses, which determines the displacement D corresponding to two adjacent frames of images through the initially divided non-deformed area, and obtains a comprehensive abnormal area based on the displacement D and the deformed area initially divided on the next frame of image and the texture difference between the reference area in the previous frame of image that is at the same position as the deformed area before deformation; this process can obtain the defective area of the gas hose 5 caused by deformation before and after extrusion, ensuring that defects that are difficult to directly observe but will make the gas hose 5 less flexible and pressure-bearing and shorten its service life can be detected. Compared with the conventional method that relies on human observation and combustible gas sensor leakage detection, the present invention can detect possible safety hazards in advance, so that the quality inspection results can better maintain the gas safety of users of the gas hose 5.
[0123] Further, the method uses the comprehensive abnormal area to adjust the deformation area and non-deformation area of the target image and the control image, so that in the comprehensive abnormal area re-obtained by using the adjusted deformation area and non-deformation area, the average area of the connected domain is the largest; in the re-obtained comprehensive abnormal area, when the average area of the connected domain is greater than the second preset threshold, the gas hose 5 fails the quality inspection. This process takes into account that different gas hoses 5 or different parts of the same gas hose 5 may have different deformation characteristics, for example, different positions are subjected to different aging corrosion conditions, resulting in different flexibility and pressure bearing capacity at different positions, and thus resulting in different deformation conditions of the gas hose 5 when squeezed. This embodiment re-adjusts and divides the deformation area and non-deformation area in the image by the defect distribution in the comprehensive abnormal area, avoiding the error in the displacement D when the deformation area and non-deformation area are not accurately divided, thereby avoiding the problem of inaccurate acquisition of defects in the comprehensive abnormal area (defective area caused by deformation). Further, the deformed area and non-deformation area adjusted by the present invention make the texture distribution in the comprehensive abnormal area as obvious as possible, further improve the reliability of the division of the deformed area and non-deformation area, so that when quality inspection is carried out based on whether the defect distribution in the comprehensive abnormal area is obvious or not, it can be prevented as much as possible.
[0124] It should be noted that for the above embodiment, when the surface of the gas hose 5 has no texture in the non-deformed area of the target image (i.e., the grayscale is the same everywhere) before or after being squeezed, and there is no texture area in the non-deformed area of the control image, then the sub-area cannot be accurately obtained in step S302, which leads to an error in the result of obtaining the displacement amount D. At this time, no subsequent processing is performed on the target image, but the next frame image of the target image is directly used as a new target image, and processed according to the method of steps S302 to S305 of the above embodiment. This can not only reduce the problem of unreliable quality inspection results caused by the error in the result of obtaining the displacement amount D, but also greatly reduce the amount of calculation.
[0125] In some other embodiments, when the standard deviation of the grayscale value in the non-deformed area is less than 10, it is determined that there is no texture in the non-deformed area.
[0126] It should also be noted that the above-mentioned embodiment, when executing the visual quality inspection method described in Example 3, tends to obtain possible defective areas that may exist (or become obvious) due to extrusion deformation as much as possible (corresponding to the process of "making the average area of the connected domain the largest in the comprehensive abnormal area re-obtained using the adjusted deformed area and non-deformed area" described in step S304 in Example 3). The purpose is to warn of gas hoses 5 with unqualified quality or short remaining service life as early as possible, so as to ensure the safety of gas use as much as possible and achieve the effect of preventing problems before they occur. In order to avoid unreasonable quality inspection results of the gas hose 5, in other embodiments, when a warning is issued due to unqualified quality inspection, the quality inspector determines whether the quality inspection is qualified by manual judgment (it only needs to judge whether there are obvious defects in the image whose detection result is greater than the second preset threshold th2). In this way, efficient and accurate quality inspection can be achieved by combining visual quality inspection equipment with manual judgment methods.
[0127] 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. Visual quality inspection equipment for gas hoses, including: A handle (1), a wrench (2) mounted on the handle (1), and a clamp (3), wherein when the wrench (2) is pressed, the jaws (4) open, and the opened jaws (4) clamp a gas hose (5) in the middle of the clamp (3), and the clamp (3) is characterized in that a plurality of columnar balls (6) are connected in a rolling manner inside, and when the clamp (3) clamps the gas hose (5), the columnar balls (6) squeeze the outer wall of the gas hose (5), and a camera (7) is installed on the visual quality inspection device; when the visual quality inspection device is working, the clamp (3) clamps the gas hose (5) and moves from top to bottom, and at the same time, the camera (7) faces the outer wall of the gas hose (5) and collects multiple frames of images.
2. A visual quality inspection method for a gas hose, using the visual quality inspection device for a gas hose as claimed in claim 1, characterized in that: The method comprises the following steps: Each frame of the acquired image is divided into a deformed area and a non-deformed area; any frame of the image is recorded as a target image, and the previous frame of the target image is recorded as a reference image; The deformed and non-deformed areas are used to obtain the comprehensive abnormal area, including: Obtain a sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image, and the position of the sub-region in the reference image is recorded as a displacement D; According to the texture difference between the pixel points in the deformed area in the target image and the reference area in the control image, the area in the target image where the defect occurs due to deformation is determined and recorded as the abnormal area of the target image; wherein the texture difference of the pixel points in the abnormal area is greater than a first preset threshold, and the reference area is the area corresponding to the deformed area of the control image after it is shifted down by D; Merging the abnormal regions of the target image and the control image into a comprehensive abnormal region; The deformed and non-deformed regions of the target image and the reference image are adjusted using the comprehensive abnormal region, so that the average area of the connected domain is the largest in the comprehensive abnormal region re-obtained using the adjusted deformed and non-deformed regions; In the recovered comprehensive abnormal area, when the average area of the connected domain is greater than a second preset threshold, the gas hose (5) fails the quality inspection.
3. The visual quality inspection method for gas hose according to claim 2, characterized in that: The steps of dividing the deformed area and the non-deformed area in each frame of image are as follows: The area with a height of H in the middle of each frame image is recorded as the deformation area, and the area above the deformation area in each frame image is recorded as the non-deformation area; H is a preset value, and the width of the deformation area and the non-deformation area is equal to the width of each frame image.
4. The visual quality inspection method for gas hose according to claim 2, characterized in that: The specific steps of obtaining the sub-region in the reference image that is most similar to the texture in the non-deformed region in the target image include the following: The non-deformed area of the target image is equally divided into a number of rectangular windows, and the grayscale values of all pixels in each rectangular window are used as a template. Based on the template, a template matching algorithm is used to perform template matching in the non-deformed area of the reference image to obtain a matching area of each rectangular window, wherein the matching area has a matching similarity with the template; The minimum bounding rectangle of all matching regions whose matching similarity is greater than a preset matching threshold is taken as the sub-region.
5. The visual quality inspection method for gas hose according to claim 2, characterized in that: The position of the sub-region in the reference image specifically refers to: the row number where the upper boundary of the sub-region is located in the reference image.
6. The visual quality inspection method for gas hose according to claim 2, characterized in that: According to the texture difference between the pixel points in the deformed area in the target image and the reference area in the control image, the area in the target image where defects are generated due to deformation is determined and recorded as the abnormal area of the target image; wherein the texture difference of the pixel points in the abnormal area is greater than a first preset threshold, the specific steps include the following: For pixel point a and pixel point b at the same position in the deformation area of the target image and the reference area of the comparison image respectively; for straight lines passing through pixel point a and pixel point b respectively and having the same inclination, the grayscale values of the pixel points on the straight lines constitute grayscale curves Sa and Sb; A curve segment most similar to Sb is obtained on Sa, and the curve difference between the curve segment and Sb is recorded as the texture difference of pixel a at each inclination angle; the average of the texture differences of all pixels in the deformed area in the target image at the same inclination angle is obtained, recorded as the average texture difference at each inclination angle, the inclination angle max with the largest average texture difference is obtained, and the texture difference of pixel a at the inclination angle max is recorded as the second texture difference of pixel a; when the second texture difference is greater than the first preset threshold th1, pixel a is recorded as an abnormal pixel, and all abnormal pixels in the deformed area in the target image constitute the abnormal area of the target image.
7. The visual quality inspection method for gas hose according to claim 3, characterized in that: The method of adjusting the deformed area and the non-deformed area of the target image and the reference image by using the comprehensive abnormal area so that the average area of the connected domain is the largest in the comprehensive abnormal area re-obtained by using the adjusted deformed area and the non-deformed area includes the following specific steps: For the new deformed area and the non-deformed area obtained after sequentially changing the height H of the deformed area, the comprehensive abnormal area obtained by using the new deformed area and the non-deformed area is recorded as the comprehensive abnormal area obtained again after changing H; The value after the i+1th change of H is ,in , represents the value after the i-th change of H, represents the scaling factor when H is changed for the i+1th time, represents the scaling factor when H is changed for the i-th time; represents the Pearson correlation coefficient; After changing H several times in sequence, stop changing H, and for all the obtained comprehensive abnormal areas, obtain the average area of all connected domains in each comprehensive abnormal area, and the deformed area and non-deformed area obtained by H corresponding to the maximum average area are taken as the adjusted deformed area and non-deformed area; The Pearson correlation coefficient The method to obtain is: Obtain the texture adhesion trend in the integrated abnormal area when H changes twice adjacently; After changing H for the ith time, the texture adhesion trends in all the integrated abnormal regions that are retrieved constitute the texture adhesion trends; After changing H for the i-th time, all values of H form the sequence LH. The Pearson correlation coefficient between the sequence LH and the texture adhesion trend sequence is recorded as .
8. The visual quality inspection method for gas hoses according to claim 7, characterized in that: The specific steps of obtaining the texture adhesion trend in the abnormal area when two adjacent changes H are changed are as follows: The comprehensive abnormal regions obtained when H is changed twice consecutively are recorded as K1 and K2, respectively, and K1 is obtained before K2; For any connected domain in K2, record it as the target connected domain, obtain the connected domain with the largest intersection with the target connected domain on K1, record it as the reference connected domain; In K2, the average of the distances between the target connected domain and the several connected domains closest to the target connected domain is recorded as the first distance; in K1, the average of the distances between the reference connected domain and the several connected domains closest to the reference connected domain is recorded as the second distance, and the difference between the second distance and the first distance is recorded as the texture adhesion trend.
9. The visual quality inspection method for gas hoses according to claim 6, characterized in that: The step of obtaining a curve segment on Sa that is most similar to Sb, wherein the curve difference between the curve segment and Sb is recorded as the texture difference of the pixel point a at each inclination angle, includes the following specific steps: Use multiple preset sliding windows to slide on Sa, and calculate the DTW distance between the grayscale value in the window and the grayscale value in Sb during each sliding process. During the sliding process when the DTW distance is the smallest, the curve segment corresponding to the grayscale value in the window is recorded as the most similar curve segment; the minimum DTW distance is recorded as the texture difference of pixel point a at each inclination angle.
10. A visual quality inspection system for a gas hose, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of any one of the visual quality inspection methods applicable to a gas hose as described in claims 2-9 are implemented.
Citation Information
Patent Citations
Defect detecting method and device
CN107607397A
Structural part production management and control method and system based on image processing
CN113344924A
Defect detection method and device of rubber product, electronic equipment and storage medium
CN116823795A
Visual detection method for abnormal deformation of automobile part die-casting die
CN117764912A
Tumor medical image processing method and system of tumor ablation treatment system
CN119295493A