Visual Quality Inspection Method, System and Equipment Applicable to Gas Hoses
Through visual quality inspection equipment and methods, image processing technology is used to identify potential defects of gas hoses, solving the problems of low efficiency and safety hazards of existing quality inspection methods, and achieving early detection of flexibility and pressure bearing capacity to ensure the safety of gas hoses.
Patent Information
- Application Number
- CN202510322843.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-03-19
AI Technical Summary
The existing gas hose quality inspection methods are inefficient and lack the ability to detect potential defects. They cannot detect the problem of deterioration in flexibility and pressure bearing capacity in advance, which poses safety risks.
Visual quality inspection equipment and methods are used to squeeze the gas hose through columnar balls and collect images, and image processing technology is used to divide the deformation and non-deformed areas. Combined with template matching and texture difference analysis, comprehensive abnormal areas are identified, and deformation and non-deformed areas are adjusted to maximize the area of the connecting domain to achieve detection of potential defects.
It improves the efficiency and accuracy of gas hose quality inspection, can detect defects that are difficult to directly observe in advance, reduces the risk of gas leakage, and ensures gas safety.
Smart Images

Figure CN119845726B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to a visual quality inspection method, system and device applicable to gas hoses. Background Art
[0002] During the long-term use of gas hoses, when there are aging corrosion, poor flexibility and pressure-bearing capacity, and in addition, when there are deficiencies in the production process of gas hoses, cracks and other defects will occur on their surfaces, greatly reducing the remaining service life of the gas hoses and even posing a risk of gas leakage. Usually, regular quality inspection or factory quality inspection of gas hoses is required to ensure the gas use safety of users.
[0003] Common quality inspection methods mainly include: relying on manual observation of the defect distribution on its surface for quality inspection, and using a combustible gas sensor for leakage detection. The former has low quality inspection efficiency and subjective quality inspection results, and the latter can only determine that it is unqualified when the gas hose leaks. However, when there are some defects in the gas hose, these defects cannot be directly observed or do not cause leakage, but these defects may gradually become serious as the gas hose continues to be used, resulting in worse flexibility and pressure-bearing capacity, and further reducing the remaining service life of the gas hose, posing a safety hazard, and even a leakage accident may occur before the next regular quality inspection. Summary of the Invention
[0004] To solve the above problems, the present invention provides a visual quality inspection method, system and device applicable to gas hoses.
[0005] The visual quality inspection method, system and device applicable to gas hoses of the present invention adopt the following technical solutions:
[0006] An embodiment of the present invention provides a visual quality inspection device applicable to gas hoses, including: a handle, a wrench and a clamp installed on the handle. When the wrench is pressed, the jaws open, and the opened jaws clamp the gas hose in the middle of the clamp. A number of columnar balls are rotatably connected inside the clamp. When the clamp clamps the gas hose, the columnar balls squeeze the outer wall of the gas hose. A camera is installed on the visual quality inspection device. When the visual quality inspection device works, 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 acquires multiple frames of images.
[0007] An embodiment of the present invention provides a visual quality inspection method applicable to gas hoses, which utilizes the above-mentioned visual quality inspection device applicable to gas hoses. The method includes the following steps:
[0008] Divide the deformed area and the non-deformed area in each frame of the acquired image; any frame of the image is recorded as the target image, and the previous frame of the target image is recorded as the reference image;
[0009] Obtaining a comprehensive abnormal area by using a deformed area and a non-deformed area, including:
[0010] Obtaining a sub-region in the reference image that is most similar to the texture in the non-deformed area of the target image, and the position of the sub-region in the reference image is denoted as the displacement D;
[0011] Determining the area in the target image that is defective due to deformation according to the texture difference between the deformed area in the target image and the pixel points in the reference area in the reference image, which is denoted 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 in the reference image after being shifted down by D;
[0012] Combining the abnormal areas of the target image and the reference image into a comprehensive abnormal area;
[0013] 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 components in the comprehensive abnormal area re-obtained by using the adjusted deformed area and non-deformed area is the largest;
[0014] In the re-obtained comprehensive abnormal area, when the average area of the connected components is greater than a second preset threshold, the quality inspection of the gas hose (5) is unqualified.
[0015] Preferably, dividing the deformed area and the non-deformed area in each frame of image includes the following specific steps:
[0016] Denoting the area in the middle of each frame of image with a height of H as the deformed area, and the area above the deformed area in each frame of image as the non-deformed area; wherein H is a preset value, and the widths of the deformed area and the non-deformed area are equal to the width of each frame of image.
[0017] Preferably, obtaining the sub-region in the reference image that is most similar to the texture in the non-deformed area of the target image includes the following specific steps:
[0018] Dividing the non-deformed area of the target image into a plurality of rectangular windows equally, taking the gray values of all pixel points in each rectangular window as a template respectively, and performing template matching in the non-deformed area of the reference image based on the template by using the template matching algorithm to obtain the matching area of each rectangular window, wherein the matching area has a matching similarity with the template;
[0019] The minimum circumscribed rectangle of all matching areas with a matching similarity greater than a preset matching threshold is used as the sub-region.
[0020] 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.
[0021] Preferably, determining the area with defects caused by deformation in the target image according to the texture difference between the deformed area in the target image and the reference area in the control image, and denoting it 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 specific steps are as follows:
[0022] For pixel point a and pixel point b at the same position in the deformed area of the target image and the reference area of the control image respectively; for straight lines passing through pixel point a and pixel point b with the same inclination angle, the gray values of the pixel points on the straight lines form gray curves Sa and Sb;
[0023] Obtain a curve segment on Sa that is most similar to Sb, and denote the curve difference between this curve segment and Sb as the texture difference of pixel point a at each inclination angle; obtain the mean value of the texture differences of all pixel points in the deformed area of the target image at the same inclination angle, and denote it as the average texture difference at each inclination angle. Obtain the inclination angle max with the largest average texture difference, and denote the texture difference of pixel point a at inclination angle max as the second texture difference of pixel point a. When the second texture difference is greater than the first preset threshold th1, denote pixel point a as an abnormal pixel point, and all abnormal pixel points in the deformed area of the target image form the abnormal area of the target image.
[0024] Preferably, adjusting the deformed area and the non-deformed area of the target image and the control image by using the comprehensive abnormal area, so that the average area of the connected components in the comprehensive abnormal area re-obtained by using the adjusted deformed area and non-deformed area is the largest, and the specific steps are as follows:
[0025] For the new deformed area and 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 non-deformed area is denoted as the comprehensive abnormal area re-obtained after changing H;
[0026] The value after the (i + 1)-th change of H is , where , represents the value after the i-th change of H, represents the scaling factor when changing H for the (i + 1)-th time, represents the scaling factor when changing H for the i-th time; represents the Pearson correlation coefficient;
[0027] After changing H several times in sequence and then stopping changing H, for all the obtained comprehensive anomaly regions, obtain the average area of all the connected components within each comprehensive anomaly region. The deformed region and the non-deformed region corresponding to the H when the average area is the largest are used as the adjusted deformed region and non-deformed region.
[0028] The Pearson correlation coefficient is obtained by the following method:
[0029] Obtain the texture adhesion trend within the comprehensive anomaly region when changing H twice in succession.
[0030] After the i-th change of H, the texture adhesion trends within all the re-obtained comprehensive anomaly regions form the texture adhesion trend. After the i-th change of H, all the values of H form a sequence LH, and the Pearson correlation coefficient between the sequence LH and the texture adhesion trend sequence is denoted as .
[0031] Preferably, the steps for obtaining the texture adhesion trend within the comprehensive anomaly region when changing H twice in succession are as follows:
[0032] The comprehensive anomaly regions obtained when changing H twice in succession are respectively denoted as K1 and K2, and K1 is obtained before K2.
[0033] For any connected component in K2, denoted as the target connected component, obtain the connected component with the largest intersection with the target connected component on K1, denoted as the reference connected component. In K2, the average value of the distances between the target connected component and several connected components closest to it is denoted as the first distance. In K1, the average value of the distances between the reference connected component and several connected components closest to it is denoted as the second distance, and the difference between the second distance and the first distance is denoted as the texture adhesion trend.
[0034] Preferably, the steps for obtaining a curve segment on Sa that is most similar to Sb, and the curve difference between this curve segment and Sb is denoted as the texture difference of pixel point a at each inclination angle, are as follows:
[0035] Use multiple preset sliding windows to slide on Sa, calculate the DTW distance between the gray values within the window during each sliding process and the gray values in Sb. During the sliding process when the DTW distance is the smallest, the curve segment corresponding to the gray values within the window is denoted as the most similar curve segment; the minimum value of the DTW distance is denoted as the texture difference of pixel point a at each inclination angle.
[0036] Another embodiment of the present invention provides a visual quality inspection system applicable to gas hoses. The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned visual quality inspection method applicable to gas hoses are implemented.
[0037] The beneficial effects of the technical solution of the present invention are as follows:
[0038] The visual quality inspection device applicable to gas hoses provided by the present invention can extrude different positions of the gas hose and collect images during the extrusion deformation. These images will contain defects that are difficult to directly observe but will deteriorate the flexibility and pressure-bearing capacity of the gas hose and shorten its service life. This device avoids problems such as low quality inspection efficiency and the risk of gas leakage caused by obtaining quality inspection results only when there is air leakage.
[0039] Furthermore, a visual quality inspection method applicable to gas hoses runs in the visual quality inspection device of the present invention. This method determines the displacement D corresponding to two adjacent frames of images through the initially divided non-deformed regions, and obtains a comprehensive abnormal region based on the displacement D and the texture difference between the initially divided deformed region on the latter frame of image and the reference region at the same position before deformation in the former frame of image. This process can obtain the defect regions generated by the deformation of the gas hose before and after extrusion, ensuring that defects that are difficult to directly observe but will deteriorate the flexibility and pressure-bearing capacity of the gas hose and shorten its service life can be detected. Compared with the conventional methods that rely on manual observation and leakage detection by combustible gas sensors, the present invention can detect potential safety hazards in advance, making the quality inspection results better protect the gas use safety of gas hose users.
[0040] Still further, this method uses the comprehensive abnormal region to adjust the deformed regions and non-deformed regions of the target image and the reference image, so that the average area of the connected regions is the largest within the comprehensive abnormal region re-obtained by using the adjusted deformed regions and non-deformed regions. When the average area of the connected regions is greater than the second preset threshold within the re-obtained comprehensive abnormal region, the gas hose fails the quality inspection. This process takes into account that different gas hoses or different parts of the same gas hose may have different deformation characteristics. For example, the aging and corrosion conditions of different positions are different, resulting in different flexibility and pressure-bearing capacities of different positions, and thus different deformation situations when the gas hose is extruded. In this embodiment, the deformed regions and non-deformed regions in the image are re-adjusted and divided according to the defect distribution in the comprehensive abnormal region, avoiding the error of the displacement D when the deformed regions and non-deformed regions are inaccurately divided, and further avoiding the problem of inaccurate acquisition of the defects (defect regions generated by deformation) in the comprehensive abnormal region. Furthermore, the adjusted deformed regions and non-deformed regions of the present invention make the texture distribution in the comprehensive abnormal region as obvious as possible, further improving the reliability of the division of the deformed regions and non-deformed regions, so that when conducting quality inspection based on the obviousness of the defect distribution in the comprehensive abnormal region, potential problems can be prevented as much as possible. Description of the Drawings
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0042] Figure 1 is the first axonometric structural schematic diagram of the visual quality inspection device applicable to gas hoses according to the present invention;
[0043] Figure 2 is the Figure 1 enlarged structural schematic diagram at position A in the visual quality inspection device for gas hoses according to the present invention;
[0044] Figure 3 is the second axonometric structural schematic diagram of the visual quality inspection device for gas hoses according to the present invention;
[0045] Figure 4 is the front view structural schematic diagram of the visual quality inspection device for gas hoses according to the present invention;
[0046] Figure 5 is the top view sectional structural schematic diagram of the visual quality inspection device for gas hoses according to the present invention;
[0047] Figure 6 is the step flow chart of the visual quality inspection method for gas hoses according to the present invention.
[0048] The description of the reference numerals is as follows:
[0049] 1. Handle; 2. Wrench; 3. Clamp; 4. Jaw; 5. Gas hose; 6. Columnar ball; 7. Camera. Detailed Embodiments
[0050] To further elaborate on the technical means and effects adopted by the present invention to achieve the intended invention purpose, the following, in combination with the drawings and preferred embodiments, details the specific embodiments, structures, features, and effects of the visual quality inspection method, system, and device applicable to gas hoses according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0052] The following specifically describes the specific solutions of the visual quality inspection method, system, and equipment for gas hoses provided by the present invention in conjunction with the accompanying drawings.
[0053] Embodiment 1:
[0054] Please refer to Figure 1 , Figure 2 , Figure 3 , Figure 4 and Figure 5 , which shows the specific structure of the visual quality inspection equipment for gas hoses provided by an embodiment of the present invention. The visual quality inspection equipment includes: a handle 1, a wrench 2, a clamp 3, columnar balls 6, and a camera 7.
[0055] The wrench 2 and the clamp 3 are installed on the handle 1. The clamp 3 has a jaw 4. When the wrench 2 bounces up (i.e., when not pressed), the jaw 4 closes. When the wrench 2 is pressed, the jaw 4 opens, and the opened jaw 4 clamps the gas hose 5 in the middle of the clamp 3.
[0056] 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 this embodiment will not be specifically described.
[0057] Several (e.g., 4) columnar balls 6 are embedded on 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 in rolling connection with the clamp 3 (i.e., the columnar ball 6 can roll along its own axis). When the clamp 3 clamps the gas hose 5, the columnar balls 6 squeeze the outer wall of the gas hose 5, causing local deformation of the gas hose 5.
[0058] As Figure 2 , Figure 4 shown, the camera 7 is installed on the visual quality inspection equipment. In this embodiment, two cameras 7 are installed (on the upper and lower sides of the clamp 3 respectively), and at least one camera 7 is installed in other embodiments. The camera 7 faces the outer wall of the gas hose 5. The camera 7 is used to collect images of the outer wall of the gas hose 5, and the images contain deformation information of the outer wall of the gas hose 5 under the extrusion of the columnar balls 6. The images collected in this embodiment are grayscale images. In other embodiments, if the collected images are color images, they need to be grayscale-converted into grayscale images.
[0059] The working principle of this visual quality inspection equipment is as follows:
[0060] Hold the handle 1 and press the wrench 2 to open the jaw 4 on the clamp 3, so that the gas hose 5 is sleeved into the jaw 4, and then release the wrench 2 to make the clamp 3 clamp the outer wall of the gas hose 5. Then hold the handle 1 and move this visual quality inspection equipment up and down along the gas hose 5. When moving to the lower end of the gas hose 5, remove this visual quality inspection equipment from the gas hose 5.
[0061] During the process of moving the visual inspection device from top to bottom, the camera 7 continuously captures multiple frames of images in real-time (for example, one frame of image is captured every 0.2 seconds). After removing the visual inspection device from the gas hose 5, the visual inspection device uploads all the captured frames of images to the server using the WIFI module (not marked in the attached drawings) thereon. A visual inspection system suitable for the gas hose runs in the server, and this visual inspection system is used to inspect the gas hose 5 based on all the frames of images.
[0062] In some other embodiments, the visual inspection system runs directly on the visual inspection device.
[0063] It should be noted that in order to ensure that the volume or weight of the visual inspection device is not too large, the camera 7 uses a small and light planar CCD array (or CCD sensor), and the resolution of the images it captures is relatively low. In this embodiment, the width and height of the images are 64×256. At the same time, due to the relatively low resolution of the images (that is, the relatively small size of the images), when the WIFI module transmits the images to the server, the power consumption is small and the transmission time is short.
[0064] Furthermore, it should be noted that before the visual inspection device clamps the gas hose 5, the outer wall of the gas hose 5 needs to be wiped clean to avoid the stains on the outer wall of the gas hose 5 interfering with the inspection.
[0065] Embodiment 2:
[0066] This embodiment provides a visual inspection system suitable for a gas hose. The visual inspection system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a visual inspection method suitable for a gas hose. This visual inspection method further obtains the inspection result of the gas hose 5 based on all the frames of images.
[0067] Embodiment 3:
[0068] As Figure 6 shown, this embodiment provides a visual inspection method suitable for a gas hose. The method includes:
[0069] Step S301: Divide the deformed area and the non-deformed area in each frame of image collected from top to bottom along the gas hose.
[0070] For each frame of image collected, this image is collected under the condition that the columnar ball 6 presses the outer wall of the gas hose 5. Therefore, the middle area of each frame of image contains the image information when the gas hose 5 is deformed under extrusion, and the upper area of each frame of image contains the image information when the gas hose 5 is not deformed under extrusion.
[0071] In this embodiment, a rectangular area in the middle of each frame of image with a height of H is denoted as the deformation area (i.e., the horizontal center line of the deformation area coincides with the horizontal center line of the image), and the rectangular area above the deformation area in each frame of image is used as the non-deformation area; where H is a preset value, 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-fourth of the image height (rounded up). In other embodiments, H can also be set to other values, which is 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-fourth of the image height (if it is a decimal, it needs to be rounded up).
[0072] Step S302: Denote any frame of image as the target image, and denote the previous frame of the target image as the reference image. Obtain the sub-region in the reference image that is most similar to the texture in the non-deformation area of the target image, and denote the position of the sub-region in the reference image as the displacement amount D.
[0073] For two adjacent frames of target image and reference image, they are respectively collected at two adjacent positions on the gas hose 5. The displacement amount D is used to describe the displacement amount between two adjacent positions.
[0074] The sub-region describes the regions in the target image and the reference image respectively that contain the same local texture information on the outer wall of the gas hose 5. Or rather, part of the texture in the non-deformation area of the target image and the texture in the sub-region of the reference image correspond to the same area on the outer wall of the gas hose 5.
[0075] As an optional example, the method for obtaining the sub-region in the reference image that is most similar to the texture in the non-deformation area of the target image includes:
[0076] Take the non-deformation area of the target image as a template. Based on this template, use the template matching algorithm to perform template matching in the non-deformation area of the reference image to obtain the matched area, and denote this area as the sub-region with the most similar texture.
[0077] It should be noted that since the sizes of the non-deformation areas of the target image and the reference image are the same, it is necessary to reduce the non-deformation area of the target image proportionally (for example, reduce the width and height by 4 times) as a template.
[0078] In other examples, the template matching algorithm can also be used to perform template matching in the entire reference image to obtain the matched area, and denote this area as the sub-region with the most similar texture.
[0079] The advantages of this optional example are as follows: on the one hand, the calculation speed is fast and it is applicable to the following scenario: the system in the second embodiment runs on the device in the first embodiment. On the other hand, taking the non-deformed area of the target image as a whole, it is possible to obtain the sub-area with the most similar overall texture within the non-deformed area of the reference image. However, the disadvantages of this optional example are as follows: when the non-deformed area of the target image in step S301 is inaccurately divided, for example, when the non-deformed area of the target image actually contains the area where the gas hose 5 is deformed by extrusion, and at the same time, due to the low resolution of the target image and the reference image, both are prone to noise interference, resulting in errors in the obtained sub-areas (that is, the obtained sub-areas may not be the same local area describing the gas hose 5 in the target image and the reference image).
[0080] As a preferred example, the method for obtaining the sub-area in the reference image that is most similar to the texture within the non-deformed area of the target image includes:
[0081] Divide the non-deformed area of the target image into several rectangular windows (for example, 8), and take the gray values of all pixel points within each rectangular window as a template. Based on this template, use the template matching algorithm to perform matching within the non-deformed area of the reference image to obtain the matching area of each rectangular window; among them, it can be known from the template matching algorithm that there is a matching similarity between the matching area and the template, which is recorded as the texture similarity between each rectangular window and its matching area;
[0082] Obtain all the matching areas whose texture similarity is greater than the preset matching threshold, and use the minimum circumscribed rectangle of these matching areas as the sub-area. In this example, it is described with the preset matching threshold equal to 0.5 as an example, and in other embodiments, it can be set to other values.
[0083] The calculation amount in this preferred example is relatively large and it is applicable to the following scenario: the system in the second embodiment runs on the server in the first embodiment. In addition, this preferred example divides the non-deformed area of the target image into several local areas (that is, rectangular windows) to find the sub-area. Although it is impossible to find the sub-area with the most similar texture from the overall texture distribution, it can, to a certain extent, avoid the interference of the image information of the deformed area due to extrusion mixed in locally within the non-deformed area (that is, the interference caused by inaccurate division of the non-deformed area).
[0084] As an example, the position of the sub-area in the reference image is denoted as the displacement D, and the specific method includes:
[0085] In the reference image, take the row number where the upper boundary of the sub-area (that is, the upper side of the rectangle corresponding to the sub-area) is located as the displacement D.
[0086] As another example, the line number where the horizontal center line of the sub-region is located is used as the displacement D.
[0087] The displacement D is used to describe the displacement between two adjacent positions, that is, the texture region of the gas hose 5 included in the target image is at a distance D below the texture region of the gas hose 5 included in the reference image.
[0088] Step S303: Determine the region in the target image where defects are generated due to deformation based on the texture difference between the deformed region in the target image and the pixel points in the reference region in the reference image, and record it as the abnormal region of the target image. The reference region is the region corresponding to the deformed region in the reference image after being shifted down by D.
[0089] The reference region in the reference image refers to the region corresponding to the deformed region in the reference image after being shifted down by D. The deformed regions in the reference region and the target image refer to the same local region of the gas hose 5 described in the reference image and the target image before and during extrusion deformation, respectively.
[0090] The abnormal region obtained based on the deformed regions in the reference region and the target image represents the region where defects are generated (or become obvious) due to deformation in the target image.
[0091] As an example, the specific method for obtaining the reference region is:
[0092] When the displacement D is obtained using the upper boundary of the sub-region described in step S302, then the reference region refers to the rectangular region obtained by shifting down the deformed region of the reference image so that its upper boundary is shifted down by D.
[0093] As another example, the specific method for obtaining the reference region is:
[0094] When the displacement D is obtained using the horizontal center line of the sub-region described in step S302, then the reference region refers to the rectangular region obtained by shifting down the deformed region of the reference image so that its horizontal center line is shifted down by D.
[0095] As an optional example, the specific method for determining the region in the target image where defects are generated due to deformation based on the texture difference between the deformed region in the target image and the pixel points in the reference region in the reference image, and recording it as the abnormal region of the target image, includes:
[0096] For any pixel point a within the deformed area in the target image and the pixel point b at the same position as pixel point a within the reference area in the reference image, obtain the absolute value of the difference between the gray value of pixel point a and the gray value of pixel point b, which is denoted as the texture difference of pixel point a within the deformed area in the target image. When this texture difference is greater than or equal to the first preset threshold th1, pixel point a is denoted as an abnormal pixel point, and all the abnormal pixel points within the deformed area in the target image constitute the abnormal area of the target image.
[0097] In this embodiment, th1 = 50 is taken as an example for description. In other embodiments, th1 can be set to other values, and this embodiment does not make specific limitations.
[0098] In other embodiments, the sobel operator can also be used to obtain the gradients of pixel point a and pixel point b respectively (specifically, the vector composed of the gradient amplitude and the gradient direction), and the Euclidean distance between the gradients of pixel point a and pixel point b is denoted as the texture difference of pixel point a.
[0099] As another alternative example, according to the texture differences of the pixel points within the deformed area in the target image and the reference area in the reference image, determine the area with defects caused by deformation in the target image, which is denoted as the abnormal area of the target image. The specific method included is:
[0100] Within the deformed area in the target image, obtain the mean value Aa of the texture differences of all pixel points within the neighborhood of pixel point a (for example, within the eight-neighborhood). Within the reference area in the reference image, obtain the mean value B of the texture differences of all pixel points within the neighborhood of pixel point b (for example, within the eight-neighborhood). Denote the absolute value of the difference between Aa and B as the first texture difference of pixel point a. When this first texture difference is greater than or equal to the first preset threshold th1, pixel point a is denoted as an abnormal pixel point, and all the abnormal pixel points within the deformed area in the target image constitute the abnormal area of the target image.
[0101] The computational amount of the above alternative example is relatively small and is applicable to the following scenario: The system in Embodiment 2 runs on the device in Embodiment 1. At the same time, when there are no a large number of obvious patterns on the outer wall of the gas hose 5 or there is no large amount of stains interfering on the outer wall of the gas hose 5, the obtained result of the abnormal area is relatively accurate.
[0102] As a preferred example, according to the texture differences of the pixel points within the deformed area in the target image and the reference area in the reference image, determine the area with defects caused by deformation in the target image, which is denoted as the abnormal area of the target image. The specific method included is:
[0103] This preferred example takes into account that when there are obvious patterns or stain interference on the outer wall of the gas hose 5 (for example, when the stain is not wiped off or not wiped off completely), due to the extrusion deformation in the deformed area of the target image, the texture therein is squeezed (or rather, for the texture in the deformed area of the target image, the texture in the image reference area is stretched and offset), which in turn leads to inaccurate acquisition of the texture difference of pixel point a in the above optional example.
[0104] In this preferred example, a number of straight lines passing through pixel point a (for example, 10 straight lines) are obtained, and the angle between adjacent two straight lines remains the same, and each straight line has an inclination angle; the number of the number of straight lines of pixel point a is not limited in this embodiment.
[0105] For each straight line, in the deformed area of the target image, within the neighborhood of pixel point a (for example, within a 13×13 neighborhood centered on pixel point a), the gray values of the pixel points passed by the straight line are obtained, and these gray values form a gray curve, the abscissa is the position of the pixel point on the straight line (with pixel point a as the origin), and the ordinate is the gray value of the pixel point.
[0106] So far, for each pixel point in the deformed area of the target image, each pixel point corresponds to a number of straight lines, and a gray curve is obtained corresponding to each straight line. Similarly, for each pixel point in the reference area of the control image, each pixel point also corresponds to a number of straight lines, and a gray curve is obtained corresponding to each straight line.
[0107] For the straight lines under the same inclination angle, the gray curve obtained corresponding to pixel point a is denoted as Sa, and the gray curve obtained corresponding to pixel point b is denoted as Sb. A curve segment most similar to the gray curve Sb is obtained on the gray curve Sa, and the curve difference between this curve segment and the gray curve Sb is denoted as the texture difference of pixel point a on each straight line (or denoted as the texture difference of pixel point a at each inclination angle).
[0108] The mean value of the texture differences of all pixel points in the deformed area of the target image under the same inclination angle is obtained, denoted as the average texture difference at each inclination angle. The inclination angle max with the largest average texture difference 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 pixel point a at the inclination angle max is denoted as the second texture difference of pixel point a.
[0109] When the second texture difference is greater than or equal to the first preset threshold th1, pixel point a is denoted as an abnormal pixel point, and all abnormal pixel points in the deformed area of the target image form the abnormal area of the target image.
[0110] In this preferred example, in the case where there is compression (or extrusion) and offset of the texture, the abnormal region of the target image is further accurately divided. The computational complexity of this preferred example is relatively large and is applicable to the following scenario: the system in Embodiment 2 runs on the server described in Embodiment 1.
[0111] As an example, a curve segment most similar to the gray curve Sb is obtained on the gray curve Sa, and the curve difference between this curve segment and the gray curve Sb is recorded as the texture difference of the pixel point a on each straight line. The method includes:
[0112] (1) All the gray values on the gray curves Sa and Sb respectively form a gray value sequence La and Lb. A sliding window is preset, and the window length of this sliding window is set to 5.
[0113] (2) The sliding window slides on La with a step size of 1. After each slide, the DTW distance between the gray values within the sliding window and Lb is calculated. After the sliding window finishes sliding, record the sliding process with the smallest DTW distance and the DTW distance at this time of sliding.
[0114] (3) Then increase the window length of the sliding window by one and repeat the process in (2).
[0115] (4) Increase the window length of the sliding window by one again and repeat the process in (2) again, 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.
[0116] (5) For the sliding process with the smallest DTW distance recorded in the above process and the DTW distance at this time of sliding, the gray values within the window during this sliding process on the curve segment corresponding to the gray curve Sa are used as the curve segment obtained on the gray curve Sa and most similar to the gray curve Sb. The DTW distance at this time of sliding is used as the texture difference of the pixel point a on each straight line.
[0117] The DTW distance is obtained by the DTW algorithm, which is a well-known technology and will not be specifically described in this embodiment.
[0118] Step S304: Merge the abnormal regions of the target image and the reference image into a comprehensive abnormal region; use the comprehensive abnormal region to adjust the deformed regions and non-deformed regions of the target image and the reference image so that the average area of the connected regions within the comprehensive abnormal region re-obtained using the adjusted deformed regions and non-deformed regions is the largest.
[0119] (1) Merge the abnormal regions of the target image and the reference image into a comprehensive abnormal region.
[0120] The abnormal regions of the target image are obtained in the above steps S301 to S303. Similarly, for all the captured frame images, the abnormal regions of each frame image are obtained using the same method. Specifically, since there is no previous 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 region in the first frame image is no longer obtained.
[0121] Merge the abnormal regions of two adjacent frame images (that is, merge the abnormal regions of the target image and the reference image), and the specific method included is:
[0122] First, it should be noted that whether it is the target image or the reference image, their abnormal regions are both within the deformation regions of the two.
[0123] As described in step S302, the displacement D is used to describe the distance D at which the texture region of the gas hose 5 included in the target image is below the texture region of the gas hose 5 included in the reference image.
[0124] Therefore, move the abnormal region in the reference image upward by a distance D, and then simultaneously mark (or draw) the abnormal region in the reference image after upward movement and the abnormal region in the target image in the target image to obtain the combined comprehensive abnormal region.
[0125] The comprehensive abnormal region describes the defective regions (such as cracks, pit regions 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 defective regions in the comprehensive abnormal region, it indicates that the current remaining service life of the gas hose 5 is relatively short. When there are no obvious defective regions in the comprehensive abnormal region, it indicates that the current remaining service life of the gas hose 5 is relatively long and it can be used with confidence.
[0126] (2) Adjust the deformation regions and non - deformation regions of the target image and the reference image using the comprehensive abnormal region, so that the average area of the connected regions in the comprehensive abnormal region re - obtained using the adjusted deformation regions and non - deformation regions is the largest.
[0127] First, it should be noted that in this embodiment, the displacement D corresponding to two adjacent frame images is determined through the initially divided non - deformation region (that is, step S301). Based on the displacement D and the texture difference between the initially divided deformation region in the latter frame image and the reference region in the same position as the deformation region before deformation in the previous frame image, the comprehensive abnormal region is obtained. However, the following problems may exist in this process:
[0128] Considering that different gas hoses or different local areas of the same gas hose may have different flexibility and pressure-bearing capacities, resulting in different deformation areas and non-deformation areas when being squeezed and deformed; 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 area relative to the deformation area.
[0129] When the initially divided deformation areas and non-deformation areas on each image in step S301 are inappropriate, for example, when some areas that are significantly deformed due to extrusion are divided into non-deformation areas, it will lead to a large error in obtaining the displacement D in step S302, especially when the system in the second embodiment runs on the device described in the first embodiment.
[0130] Due to the low resolution of the collected images and the large interference of noise on the texture information in the images, even if the displacement D has a small error, the obtained comprehensive abnormal area will be inaccurate.
[0131] When the comprehensive abnormal area is inaccurate, even if there are obvious defects on the gas hose 5 due to extrusion deformation, the defective areas 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). At this time, it is necessary to readjust or divide the deformation areas and non-deformation areas in the target image and the reference image.
[0132] Since the target image and the reference image are adjacent-frame images, although there are differences in the extrusion deformation conditions at different positions on the gas hose 5, these differences in adjacent-frame images can be ignored (or in other words, compared with the error existing in the displacement D, they can be ignored). Therefore, the deformation areas and non-deformation areas of the adjusted target image are the same as those of the adjusted reference image.
[0133] As an optional example, using the comprehensive abnormal area to adjust the deformation areas and non-deformation areas of the target image and the reference image, so that the average area of the connected domains in the comprehensive abnormal area newly obtained by using the adjusted deformation areas and non-deformation areas is the largest, the method includes:
[0134] Successively set H in step S301 to different values, for example, successively set H to p times the height of the image, In other embodiments, p can be set to other values, and this embodiment does not make specific limitations.
[0135] Each value of H corresponds to a result of dividing the deformed area and the non-deformed area (see step S301 for details). Based on the deformed area and the non-deformed area corresponding to each H, the comprehensive abnormal area is re-obtained according to the methods included in steps S302 to S304, and the average value Y of the areas of all connected domains within the comprehensive abnormal area (that is, the average area of the connected domains within the comprehensive abnormal area) is obtained. Each value of H corresponds to a Y. The value of H with the largest Y is obtained, and the deformed area and the non-deformed area corresponding to this value of H are used as the deformed area and the non-deformed area after adjusting the target image and the reference image.
[0136] The larger the above average value Y, the more likely it is that there is an obvious texture area in the comprehensive abnormal area (that is, the defective area generated or enlarged due to deformation before and after extrusion).
[0137] In this example, a huge amount of computation is required to obtain the comprehensive abnormal areas under multiple values of H, and the calculation speed is slow.
[0138] 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 there are both isolated small connected domains and large connected domains at the same time, in some other embodiments, a calculation method for the average value Y is re-given, including:
[0139] For each connected domain within the comprehensive abnormal area, the areas of all connected domains are subjected to K-Means clustering to obtain 2 categories, and the average values of all areas in the two categories are obtained respectively, denoted 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 within the comprehensive 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.
[0140] Specifically, if the number of connected domains within the comprehensive abnormal area is less than 2, this method is no longer used to calculate the average value Y.
[0141] In other embodiments, 0.25 can be replaced with other values, and no specific limitation is made in this embodiment.
[0142] As a preferred example, using the comprehensive abnormal area to adjust the deformed area and the non-deformed area of the target image and the reference image, so that within the comprehensive abnormal area re-obtained by using the adjusted deformed area and non-deformed area, the average area of the connected domains is the largest, and the method includes:
[0143] H is gradually increased by w times. Among them, the value of H after the (i - 1)-th increase by w times is denoted as Then the value of H after the i-th increase by w times is denoted as where Denotes the value of w when increasing w by a factor of i (which is also the scaling factor). The value of H before the first step of gradually increasing H by a factor of w is the value of H set in step S301. In this embodiment, when increasing H by a factor of w for the first time, the value of w , in other embodiments, can be set to other values, which are not specifically limited in this embodiment.
[0144] After each time of increasing H by a factor of w (taking the case after the i-th time of increasing H by a factor of w as an example for description), the following processing is performed:
[0145] (1) Obtain the comprehensive abnormal area obtained after the i-th increase of H. For this comprehensive abnormal area and all the comprehensive abnormal areas obtained before the i-th increase of H, these comprehensive abnormal areas are arranged in a sequence of comprehensive abnormal areas in the order of acquisition time (the length of which is at least 2). For two adjacent comprehensive abnormal areas K1 and K2 (K1 is before K2) in this sequence.
[0146] (2) For any connected domain in K2, denoted as the target connected domain, obtain the connected domain with the largest intersection with the target connected domain on K1, denoted as the reference connected domain. Specifically, if there is no connected domain in K1 that intersects with the target connected domain, then denote the connected domain with the closest center point to the center point of the target connected domain in K1 as the reference connected domain.
[0147] The reference connected domain and the target connected domain describe the areas that may belong to the same defect part before and after the change of the value of H.
[0148] (3) Obtain the Nk connected domains closest to the target connected domain in K2. The average value of the distances between the target connected domain and the Nk connected domains is denoted as the first distance; obtain the Nk connected domains closest to the reference connected domain in K1. The average value of the distances between the reference connected domain and these Nk connected domains is denoted as the second distance. The difference between the second distance and the first distance is denoted as the texture adhesion trend after the i-th increase of H.
[0149] This embodiment describes the case with Nk = 3 as an example. Specifically, when there are less than Nk connected domains in K1 or K2, then 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.
[0150] The distance between connected domains refers to the distance between the center points of the connected domains.
[0151] In other embodiments, the distance between the target connected domain and the reference connected domain can be used as the texture adhesion trend. This method sacrifices the accuracy of the texture adhesion trend in exchange for a faster calculation speed.
[0152] The greater the texture adhesion tendency, it indicates that after increasing H for the i-th time, the connected components in the comprehensive abnormal region tend to aggregate into a more obvious texture. On the contrary, it indicates that there is no tendency to aggregate into a more obvious texture.
[0153] (4) The texture adhesion tendencies obtained corresponding to all adjacent comprehensive abnormal regions in the comprehensive abnormal region sequence form a texture adhesion tendency sequence. The sequence of the values of H obtained after increasing H for the i-th time is denoted as LH, and the Pearson correlation coefficient between this sequence LH and the texture adhesion tendency sequence is denoted as , where .
[0154] The larger it is, it indicates that with the change of the value of H, there is a tendency to have an obvious texture structure in the comprehensive abnormal region. The smaller it is, it indicates that with the change of H, there is no tendency to have an obvious texture structure in the comprehensive abnormal region.
[0155] Then the value after increasing H for the (i + 1)-th time is , where .
[0156] Use the methods (1) to (4) above to gradually increase H by w times. The trend of w will be 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 components in the comprehensive abnormal region tend to adhere to an obvious texture.
[0157] 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 indicates that the value of H is increased by times for the i-th time. When is less than 0, it indicates that the value of H is reduced by times for the i-th time.
[0158] Another example:
[0159] When is greater than 0, and is also greater than 0, it indicates that with the increase of the value of H, there is a tendency to have an obvious texture structure in the comprehensive abnormal region. At this time is greater than , indicating that the value of H is increased with a greater growth trend for the (i + 1)-th time.
[0160] When is greater than 0, and is less than 0, it indicates that with the increase of the value of H, there is no longer a tendency to have an obvious texture structure in the comprehensive abnormal region. At this time is less than That is to say, in the (i + 1)-th time, the value of H will no longer increase with a greater growth trend (or increase with a relatively slow trend).
[0161] When is less than 0, and is greater than 0, it indicates that with the decrease of the value of H, there tends to be an obvious texture structure in the comprehensive abnormal area. At this time is less than which means that in the (i + 1)-th time, the value of H decreases with a greater decreasing trend.
[0162] When is less than 0, and is less than 0, it indicates that with the decrease of the value of H, there is no longer a tendency to have an obvious texture structure in the comprehensive abnormal area. At this time is greater than which means that in the (i + 1)-th time, the value of H will no longer decrease with a greater decreasing trend (or decrease with a relatively slow trend).
[0163] (5) In this preferred example, when H stops increasing after increasing step by step for 10 times, for all the obtained comprehensive abnormal areas, the average value Y (i.e., the average area) of the areas of all connected components within each comprehensive abnormal area is obtained. The H corresponding to the maximum average value Y is obtained, and the deformation area and non-deformation area corresponding to this H are used as the adjusted deformation area and non-deformation area. In other embodiments, "increasing step by step for 10 times" can also be replaced by other numbers, and this example does not make specific limitations.
[0164] Specifically, when H is continuously increased twice and then 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 H also stops increasing.
[0165] Generally speaking, compared with the optional example, this preferred example can calculate the value of H for the next time according to the change of the adhesion trend of the connected components in the comprehensive abnormal area under different values of H, avoiding the inaccurate or unreasonable setting of the value of H in the optional example.
[0166] Step S305: In the re-obtained comprehensive abnormal area, when the average area of the connected components is greater than the second preset threshold, the gas hose quality inspection is unqualified.
[0167] For the adjusted deformation area and non-deformation area of the target image obtained in step S304, according to this deformation area and non-deformation area, the comprehensive abnormal area is re-obtained in accordance with steps S302 to S304. And the average area of the connected components of this comprehensive abnormal area is obtained, which is recorded as the detection result of the target image.
[0168] For all the collected images (excluding the first frame image because the above-mentioned all steps of this embodiment cannot be implemented using the first frame image as the target image), if the detection result of any one image is greater than the second preset threshold th2, it indicates that the service life of the gas pipe is significantly low and the quality inspection is unqualified. At this time, a warning is given, and the user is notified to replace the gas hose 5 or shorten the quality inspection time interval of the gas hose 5 of this user.
[0169] When the detection results of all images are less than or equal to the second preset threshold th2, the inspection is qualified.
[0170] In this embodiment, th2 = 200 is taken as an example for description. In other embodiments, th2 can be set to other values, which is not specifically limited in this embodiment.
[0171] So far, this embodiment is completed.
[0172] The visual quality inspection device provided by the present invention is applicable to gas hoses. This device can squeeze different positions of the gas hose 5 and collect images during the extrusion deformation. These images will contain defects that are difficult to directly observe but will make the flexibility and pressure-bearing capacity of the gas hose 5 deteriorate and the service life shorten. This device avoids problems such as low quality inspection efficiency and the risk of gas leakage caused by obtaining the quality inspection result only when there is air leakage.
[0173] Furthermore, the visual quality inspection method applicable to gas hoses runs in the visual quality inspection device of the present invention. This method determines the displacement amount D corresponding to two adjacent frames of images through the preliminarily divided non-deformed region, and obtains the comprehensive abnormal region based on the displacement amount D and the texture difference between the preliminarily divided deformed region on the latter frame of image and the reference region at the same position before deformation in the previous frame of image. This process can obtain the defect region generated by the deformation of the gas hose 5 before and after extrusion, ensuring that defects that are difficult to directly observe but will make the flexibility and pressure-bearing capacity of the gas hose 5 deteriorate and the service life shorten can be detected. Compared with the conventional method that relies on manual observation and leakage detection by a combustible gas sensor, the present invention can detect potential safety hazards in advance, making the quality inspection result better protect the gas use safety of users of the gas hose 5.
[0174] Furthermore, the method adjusts the deformed area and the non-deformed area of the target image and the reference image with the comprehensive abnormal area, so that the average area of the connected components is the largest within the comprehensive abnormal area re-obtained by using the adjusted deformed area and non-deformed area; within the re-obtained comprehensive abnormal area, when the average area of the connected components is greater than the second preset threshold, the quality inspection of the gas hose 5 is unqualified. 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, the aging and corrosion conditions at different positions are different, resulting in different flexibility and pressure-bearing capacities at different positions, and further resulting in different deformation conditions of the gas hose 5 when it is squeezed. In this embodiment, the deformed area and the non-deformed area in the image are readjusted and divided according to the defect distribution in the comprehensive abnormal area, so as to avoid the error of the displacement D when the deformed area and the non-deformed area are inaccurately divided, and further avoid the problem of inaccurate acquisition of the defects (defect areas caused by deformation) in the comprehensive abnormal area. Further, the adjusted deformed area and non-deformed area of the present invention make the texture distribution in the comprehensive abnormal area as obvious as possible, further improving the reliability of the division of the deformed area and the non-deformed area, so that when quality inspection is carried out based on whether the defect distribution in the comprehensive abnormal area is obvious or not, potential problems can be prevented as much as possible.
[0175] Regarding the above embodiments, it should be noted that when there is no texture (i.e., the gray value is the same everywhere) in the non-deformed area of the target image whether before or after the gas hose 5 is squeezed, and there is also no textured area in the non-deformed area of the reference image, then the sub-region cannot be accurately obtained in step S302, and as a result, the obtained displacement D is incorrect. At this time, the subsequent processing is no longer performed on this target image, but the next frame image of this target image is directly used as the new target image, and the processing is carried out according to the methods of steps S302 to S305 of the above embodiments. This can not only reduce the problem of unreliable quality inspection results caused by incorrect acquisition of the displacement D, but also greatly reduce the calculation amount.
[0176] In some other embodiments, it can also be determined that there is no texture in the non-deformed area when the standard deviation of the gray value in the non-deformed area is less than 10.
[0177] In addition, it should be noted that when the above-mentioned embodiments execute the visual quality inspection method described in Embodiment 3, they tend to obtain as much as possible the defective areas that may exist and are caused (or become obvious) due to extrusion deformation (corresponding to the process of "making the average area of the connected components the largest in the comprehensive abnormal area re-obtained by using the adjusted deformed area and non-deformed area" described in step S304 of Embodiment 3). The purpose is to give an early warning as much as possible about the gas hose 5 with unqualified quality or a short remaining service life, 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 giving an early warning due to unqualified quality inspection, the quality inspection personnel determine whether the quality inspection is qualified through a manual judgment method (only need to judge whether there are obvious defects in the images with the detection result greater than the second preset threshold th2). In this way, the combination of the visual quality inspection device and the manual judgment method can perform quality inspection efficiently and accurately.
[0178] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A visual quality inspection method applicable to gas hoses, which uses a visual quality inspection device applicable to gas hoses to collect multiple frames of images towards the outer wall of the gas hose; the visual quality inspection device includes: A handle, a wrench and a clamp mounted on the handle. When the wrench is pressed, the jaws open, and the opened jaws clamp a gas hose in the middle of the clamp. It is characterized in that a number of columnar balls are connected in a rolling manner inside the clamp. When the clamp clamps the gas hose, the columnar balls press against the outer wall of the gas hose. A camera is installed on the visual inspection device. When the visual inspection device works, 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 acquires multiple frames of images. The method includes the following steps: In each frame of the acquired images, a deformed area and a non-deformed area are divided, including: the area in the middle of each frame of image with a height of H is recorded as the deformed area, and the area above the deformed area in each frame of image is used as the non-deformed area; where H is a preset value, and the widths of the deformed area and the non-deformed area are equal to the width of each frame of image. Any frame of image is recorded as the target image, and the previous frame of the target image is recorded as the reference image. Obtain a comprehensive abnormal area by using the deformed area and the non-deformed area, including: Obtain the sub-region in the reference image that is most similar to the texture in the non-deformed area of the target image, and the position of the sub-region in the reference image is recorded as the displacement amount D. According to the texture difference of the pixel points in the deformed area of the target image and the reference area in the reference image, determine the area in the target image where defects are generated due to deformation, which is recorded as the abnormal area of the target image; where the texture difference of the pixel points in the abnormal area is greater than the first preset threshold, and the reference area is the area corresponding to the deformed area of the reference image after being shifted down by D. Merge the abnormal areas of the target image and the reference image into a comprehensive abnormal area. Adjust the deformed area and non-deformed area of the target image and the reference image using the comprehensive abnormal area, so that the average area of the connected components in the comprehensive abnormal area re-obtained using the adjusted deformed area and non-deformed area is the largest, including: for the new deformed area and non-deformed area obtained after sequentially changing the height H of the deformed area, the comprehensive abnormal area obtained using the new deformed area and non-deformed area is denoted as the comprehensive abnormal area re-obtained after changing H; the value after the (i + 1)-th change of H is , where , represents the value after the i-th change of H, represents the scaling factor when the (i + 1)-th change of H occurs, represents the scaling factor when the i-th change of H occurs; represents the Pearson correlation coefficient; when changing H several times in sequence and then stopping changing H, for all the obtained comprehensive abnormal areas, obtain the average area of all the connected components in each comprehensive abnormal area, and use the deformed area and non-deformed area corresponding to the H with the largest average area as the adjusted deformed area and non-deformed area; the method for obtaining the Pearson correlation coefficient is: obtain the texture adhesion trend in the comprehensive abnormal area when changing H twice in succession; when after the i-th change of H, the texture adhesion trends in all the re-obtained comprehensive abnormal areas form a texture adhesion trend sequence; when after the i-th change of H, all the values of H form a sequence LH, and the Pearson correlation coefficient between the sequence LH and the texture adhesion trend sequence is denoted as ; In the newly obtained comprehensive abnormal area, when the average area of the connected components is greater than the second preset threshold, the quality inspection of the gas hose is unqualified.
2. The visual quality inspection method applicable to gas hoses according to claim 1, characterized in that, Obtain the sub-region in the reference image that is most similar to the texture in the non-deformed area of the target image, including the following specific steps: Divide the non-deformed area of the target image into several equal rectangular windows. Respectively take the gray values of all pixel points in each rectangular window as a template, and use the template matching algorithm to perform template matching in the non-deformed area of the reference image based on this template to obtain the matching area of each rectangular window. Among them, there is a matching similarity between the matching area and the template. The minimum bounding rectangle of all matching areas with a matching similarity greater than the preset matching threshold is used as the sub-region.
3. The visual quality inspection method applicable to gas hoses according to claim 1, 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.
4. The visual quality inspection method applicable to gas hoses according to claim 1, wherein According to the texture difference of the pixel points in the deformed area of the target image and the reference area in the reference image, determine the area in the target image where defects are generated due to deformation, which is recorded as the abnormal area of the target image; where the texture difference of the pixel points in the abnormal area is greater than the first preset threshold, including the following specific steps: For pixel point a and pixel point b at the same position in the deformed area of the target image and the reference area in the reference image respectively; for straight lines passing through pixel point a and pixel point b with the same inclination angle, the gray values of the pixel points on the straight lines form gray curves Sa and Sb. Obtain a curve segment on Sa that is most similar to Sb, and record the difference between this curve segment and the curve of Sb as the texture difference of pixel point a at each inclination angle; obtain the mean value of the texture differences of all pixel points within the deformed area in the target image at the same inclination angle, and record it as the average texture difference at each inclination angle. Obtain the inclination angle max with the largest average texture difference, and record the texture difference of pixel point a at the inclination angle max as the second texture difference of pixel point a; when this second texture difference is greater than the first preset threshold th1, mark pixel point a as an abnormal pixel point, and all abnormal pixel points within the deformed area in the target image constitute the abnormal area of the target image.
5. The visual quality inspection method applicable to gas hoses according to claim 1, characterized in that, When obtaining the texture adhesion trend within the comprehensive abnormal area during two adjacent changes in H, the specific steps are as follows: The comprehensive abnormal areas obtained during two adjacent changes in H are respectively denoted as K1 and K2, where K1 is obtained before K2; For any connected domain in K2, denoted as the target connected domain, obtain the connected domain on K1 with the largest intersection with the target connected domain, denoted as the reference connected domain; In K2, the mean value of the distances between the target connected domain and several connected domains closest to it is denoted as the first distance; in K1, the mean value of the distances between the reference connected domain and several connected domains closest to it is denoted as the second distance, and the difference between the second distance and the first distance is denoted as the texture adhesion trend.
6. The visual quality inspection method applicable to gas hoses according to claim 4, characterized in that Obtain a curve segment on Sa that is most similar to Sb, and record the difference between this curve segment and the curve of Sb as the texture difference of pixel point a at each inclination angle. The specific steps are as follows: Use multiple preset sliding windows to slide on Sa, calculate the DTW distance between the gray values within the window and the gray values in Sb during each sliding process. During the sliding process when the DTW distance is the smallest, the curve segment corresponding to the gray values within the window is denoted as the most similar curve segment; the minimum value of the DTW distance is denoted as the texture difference of pixel point a at each inclination angle.
7. A visual quality inspection system applicable to gas hoses, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of any one of the visual quality inspection methods applicable to gas hoses as claimed in claims 2 - 6.
Citation Information
Patent Citations
Defect detecting method and device
CN107607397A
Defect detection method and device of rubber product, electronic equipment and storage medium
CN116823795A
Pipeline detection device
CN211652595U