Method, device, storage medium and processor for detecting valve joint orientation

Through image processing technology, the valve joint orientation is quickly and accurately detected by image matching and brightness value analysis, solving the problems of cumbersome and inaccurate measurement in the prior art, and improving detection efficiency and accuracy.

CN115456992BActive Publication Date: 2025-06-06ZOOMLION HEAVY INDUSTRY SCIENCE AND TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211117774.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-14
Publication Date
2025-06-06
Estimated Expiration
2042-09-14

AI Technical Summary

Technical Problem

When detecting the orientation of the valve joint, the prior art has problems such as cumbersome, time-consuming and inaccurate measurement. In particular, professional measurement equipment requires manual participation, and deep learning methods require a large amount of data labeling, resulting in slow detection speed.

Method used

By matching the image to be detected of the valve joint with the template image, the center point is determined, and the image area is divided into multiple areas, the orientation of the valve joint is determined according to the brightness value of each area, and the orientation of the valve joint is quickly and accurately detected using image processing technology.

Benefits of technology

实现了快速、准确的阀门接头朝向检测,降低了人工成本和时间成本,提高了检测效率,减少了数据标注工作量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115456992B_ABST
    Figure CN115456992B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device, processor and storage medium for detecting the orientation of a valve joint. The method includes: determining an image to be detected of the valve joint; matching the image to be detected with a template image of the valve joint to determine the center point of the valve joint in the image to be detected; determining a circular area with the center point as the origin and a radius of a preset value as the image area to be detected in the image to be detected; setting dividing lines in a clockwise or counterclockwise direction in sequence according to preset interval angles to divide the image area to be detected into multiple image areas; for each image area, determining the brightness value of the image area according to the grayscale value of each pixel included in the image area; determining the image area with the largest brightness value as the target area; and determining the direction of the extension of the center point to the center line of the target area as the orientation of the valve joint. The above technical solution can greatly improve the detection efficiency, has high accuracy, and reduces labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of device detection, and in particular to a method, device, storage medium and processor for detecting the orientation of a valve joint. Background Art

[0002] When assembling the valve joint and the pipeline, it is necessary to check the direction of the valve joint. If the direction deviation of the valve joint is too large, it is easy to cause pipeline interference.

[0003] At present, the methods for detecting the orientation of valve joints include measurement by professional measuring equipment, visual measurement, and measurement based on deep learning methods. Among them, measurement by professional measuring equipment requires manual participation, which takes a lot of time, the measurement process is cumbersome, and too slow measurement can easily affect the overall assembly speed. Measurement by visual inspection cannot ensure the accuracy of the measurement. Measurement by deep learning requires a large amount of data to be labeled, which is a large workload and slow detection speed. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, device, storage medium and processor for detecting the orientation of a valve joint.

[0005] In order to achieve the above-mentioned object, the first aspect of the present application provides a method for detecting the orientation of a valve joint, comprising:

[0006] Determine the image of the valve joint to be inspected;

[0007] Matching the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected;

[0008] A circular area with a center point as the origin and a radius as a preset value is determined as the image area to be detected in the image to be detected;

[0009] Sequentially setting the segmentation lines in a clockwise or counterclockwise direction according to a preset interval angle to segment the image area to be detected into a plurality of image areas;

[0010] For each image region, determining a brightness value of the image region according to a grayscale value of each pixel included in the image region;

[0011] The image area with the largest brightness value is determined as the target area;

[0012] The direction from the center point to the center line of the target area is determined as the orientation of the valve joint.

[0013] In an embodiment of the present application, for each image area, determining the brightness value of the image area according to the grayscale value of each pixel included in the image area includes: for each image area, determining the sum of the grayscale values ​​of all the pixels included in the image area according to the grayscale value of each pixel included in the image area; determining the total number of pixels included in each image area; for each image area, determining the ratio of the sum of the grayscale values ​​corresponding to the image area to the sum of the number of pixels as the grayscale mean of the image area; and determining the brightness value of each image area according to the grayscale mean of each image area.

[0014] In an embodiment of the present application, determining the brightness value of each image area according to the grayscale mean of each image area includes: for any image area, determining the average of the grayscale means of multiple adjacent image areas of the image area and the grayscale mean of the image area as the brightness value of the image area.

[0015] In an embodiment of the present application, each image area refers to a closed area formed by the first dividing line and the second dividing line corresponding to each image area and the center point, and determining the image area with the largest brightness value as the target area includes: when there are multiple image areas with the largest brightness values, taking the image area with the largest brightness value as the image area to be selected; determining the angle value of each image area to be selected, the angle value refers to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line, and the starting dividing line refers to the dividing line located at a preset position; determining the target area from multiple image areas to be selected according to the angle value.

[0016] In an embodiment of the present application, determining a target area from a plurality of image areas to be selected according to an angle value includes: determining continuous and adjacent image areas to be selected as an area group, and determining the number of image areas to be selected contained in each area group; and determining the image area corresponding to the area group with the largest number as the target area.

[0017] In an embodiment of the present application, determining the image area corresponding to the area group with the largest number as the target area includes: when there are multiple area groups with the largest number, determining the average angle value of the image area corresponding to each area group; and determining the image area corresponding to the area group with the largest average angle value among the area groups with the largest number as the target area.

[0018] In an embodiment of the present application, determining a target area from multiple candidate image areas according to the angle value includes: when any two of the multiple candidate image areas are not adjacent, determining the candidate image area with the largest angle value as the target area.

[0019] In an embodiment of the present application, the method also includes: determining the angle between the center line of the target area and the starting dividing line as the first deviation angle of the valve joint, the starting dividing line refers to the dividing line located at a preset position; obtaining the second deviation angle of the pipeline connected to the valve joint; when the angle difference between the first deviation angle and the second deviation angle is within a preset range, determining that the detection result of the valve joint orientation is qualified; when the angle difference between the first deviation angle and the second deviation angle exceeds the preset range, determining that the detection result of the valve joint orientation is unqualified.

[0020] In an embodiment of the present application, the preset interval angle is 1°.

[0021] A second aspect of the present application provides a device for detecting the orientation of a valve joint, comprising:

[0022] An image determination module, used for determining the image to be detected of the valve joint;

[0023] An image region determination module is used to match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected, and determine a circular region with the center point as the origin and a radius of a preset value as the image region to be detected in the image to be detected;

[0024] An image region segmentation module is used to sequentially set segmentation lines in a clockwise or counterclockwise direction according to preset interval angles to segment the image region to be detected into multiple image regions;

[0025] A target region determination module is used to determine the brightness value of each image region according to the gray value of each pixel point included in the image region, and determine the image region with the largest brightness value as the target region;

[0026] The orientation determination module is used to determine the direction in which the center point extends toward the center line of the target area as the orientation of the valve joint.

[0027] A third aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configure the processor to execute the above-mentioned method for detecting the orientation of a valve joint.

[0028] A fourth aspect of the present application provides a processor configured to execute the above-mentioned method for detecting the orientation of a valve joint.

[0029] The above technical solution can quickly detect the orientation of the valve joint by dividing the image area to be detected into multiple image areas and determining the brightness value of each image area, thereby determining the orientation of the valve joint by the brightness value, and greatly improving the detection efficiency of the valve joint orientation. Moreover, the detection accuracy is high, no data annotation is required, the workload of detection is reduced, and the labor cost and time cost are greatly reduced.

[0030] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0032] Figure 1 A schematic diagram of a flow chart of a method for detecting the orientation of a valve joint according to an embodiment of the present application is shown;

[0033] Figure 2 A schematic diagram of a flow chart of a method for detecting the orientation of a valve joint according to another embodiment of the present application is shown;

[0034] Figure 3 The structure block diagram of the device for detecting the orientation of the valve joint according to the embodiment of the present application is schematically shown;

[0035] Figure 4 The internal structure of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0037] Figure 1 The flowchart of the method for detecting the orientation of a valve joint according to an embodiment of the present application is schematically shown. Figure 1 As shown, in one embodiment of the present application, a method for detecting the orientation of a valve joint is provided, comprising the following steps:

[0038] Step 101, determining the image of the valve joint to be detected.

[0039] Step 102: Match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected.

[0040] Step 103 : determining a circular area with the center point as the origin and a radius as a preset value as the image area to be detected in the image to be detected.

[0041] Step 104 , dividing lines are sequentially set in a clockwise or counterclockwise direction according to preset interval angles to divide the image area to be detected into a plurality of image areas.

[0042] Step 105: for each image region, determine the brightness value of the image region according to the grayscale value of each pixel included in the image region.

[0043] Step 106: determine the image area with the maximum brightness value as the target area.

[0044] Step 107, determining the direction in which the center point extends toward the center line of the target area as the orientation of the valve joint.

[0045] Before detecting the orientation of the valve joint, an image acquisition device may be installed at a position relative to the valve joint. The image acquisition device may be a device with image acquisition function such as a camera, a video camera, a camera, a recorder, or an intelligent camera. After installing the image acquisition device, the processor may obtain the original image of the valve joint through the image acquisition device, and may perform grayscale processing and enhancement processing on the original image, thereby determining the image to be detected of the valve joint. The enhancement processing may be weighting the pixel values ​​of the original image after grayscale processing. For example, the pixel values ​​of the original image after grayscale processing may be multiplied by a coefficient α to enhance the original image after grayscale processing.

[0046] Since the position of the valve joint relative to the image acquisition device is not completely fixed, it is impossible to accurately determine the center point position of the valve joint in the image to be detected at this time. In order to ensure the accuracy of the subsequent valve joint orientation detection, when the image to be detected of the valve joint is obtained, the processor can further obtain a template image of the valve joint. Among them, the template image can refer to an image of the center position of the valve joint after cropping and grayscale processing. After obtaining the template image of the valve joint, the processor can match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected. Specifically, the processor can match the image to be detected with the template image according to the template matching algorithm, so as to determine the image area with the highest confidence on the image to be detected through the template image, and determine the center point of the image area as the center point of the valve joint.

[0047] When the center point of the valve joint in the image to be detected is determined, the processor can determine a circular area with the center point as the origin and a radius of a preset value as the image area to be detected in the image to be detected. The preset value can be determined according to the maximum radius of the valve joint. For example, the preset value can be equal to the maximum radius of the valve joint, or can be greater than the maximum radius of the valve joint. When the image area to be detected in the image to be detected is determined, the processor can further set dividing lines in a clockwise or counterclockwise direction in sequence according to a preset interval angle to divide the image area to be detected into multiple image areas. The preset interval angle can be customized according to actual conditions. In one embodiment, the preset interval angle is 1°. If the preset interval angle is 1°, the image area to be detected can be divided into 360 image areas.

[0048] For each image area, the processor can determine the brightness value of the image area according to the grayscale value of each pixel included in the image area. After determining the brightness value for each image area, the processor can determine the image area with the largest brightness value as the target area. When the target area is determined, the processor can determine the direction in which the center point extends toward the center line of the target area as the direction of the valve joint.

[0049] The above technical solution can quickly detect the orientation of the valve joint by dividing the image area to be detected into multiple image areas and determining the brightness value of each image area, thereby determining the orientation of the valve joint by the brightness value, and greatly improving the detection efficiency of the valve joint orientation. Moreover, the detection accuracy is high, no data annotation is required, the workload of detection is reduced, and the labor cost and time cost are greatly reduced.

[0050] In one embodiment, for each image area, determining the brightness value of the image area based on the grayscale value of each pixel included in the image area includes: for each image area, determining the sum of the grayscale values ​​of all the pixels included in the image area based on the grayscale value of each pixel included in the image area; determining the total number of pixels included in each image area; for each image area, determining the ratio of the sum of the grayscale values ​​corresponding to the image area to the sum of the number of pixels as the grayscale mean of the image area; and determining the brightness value of each image area based on the grayscale mean of each image area.

[0051] For each image area, the processor may first determine the grayscale value of each pixel included in each image area, and may determine the sum of the grayscale values ​​of all the pixels included in the image area according to the grayscale value of each pixel included in each image area. The processor may determine the sum of the number of pixels of the pixels included in each image area. For each image area, when determining the sum of the grayscale values ​​and the sum of the number of pixels of the image area, the processor may determine the ratio of the sum of the grayscale values ​​corresponding to the image area to the sum of the number of pixels, and may use the ratio as the grayscale mean of the image area. Then, the processor may determine the brightness value of each image area according to the grayscale mean of each image area. Specifically, the processor may perform window smoothing on the grayscale mean of the image area to determine the brightness value of each image area.

[0052] In one embodiment, determining the brightness value of each image region according to the grayscale mean of each image region includes: for any image region, determining the average of the grayscale means of multiple adjacent image regions of the image region and the grayscale mean of the image region as the brightness value of the image region.

[0053] For any image area, when determining the grayscale mean of the image area, the processor can determine the average of the grayscale means of multiple adjacent image areas of the image area and the grayscale mean of the image area, and can determine the average as the brightness value of the image area. For example, for image area A3 among image areas A1, A2, A3, A4, A5, and A6, the four adjacent image areas of image area A3 are A1, A2, A4, and A5, and the processor can determine the average of the grayscale means of each image area in image areas A1, A2, A3, A4, and A5 as the brightness value of image area A3.

[0054] In one embodiment, each image area refers to a closed area formed by a first dividing line and a second dividing line corresponding to each image area and a center point, and determining the image area with the largest brightness value as the target area includes: when there are multiple image areas with the largest brightness values, taking the image area with the largest brightness value as the image area to be selected; determining the angle value of each image area to be selected, the angle value refers to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line, and the starting dividing line refers to the dividing line located at a preset position; and determining the target area from multiple image areas to be selected according to the angle value.

[0055] Each image region may refer to a closed region formed by the first dividing line and the second dividing line corresponding to each image region and the center point. The first dividing line may refer to the dividing line closest to the starting dividing line in each image region. The second dividing line may refer to the dividing line farthest from the starting dividing line in each image region. The starting dividing line may refer to a dividing line located at a preset position. For example, the starting dividing line may be a dividing line with a relative direction of three o'clock.

[0056] In the case where there are multiple image areas with the largest brightness value, the processor may use the image area with the largest brightness value as the image area to be selected. The number of image areas with the largest brightness value may include at least two. For example, if there are two image areas with the largest brightness value, the processor may use both of these image areas as the image areas to be selected. After determining the image areas to be selected, the processor may further determine the angle value of each image area to be selected. That is, each image area to be selected corresponds to an angle value. The angle value may refer to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line. After determining the angle value of each image area to be selected, the processor may determine the target area from multiple image areas to be selected according to the angle value.

[0057] In one embodiment, determining a target area from a plurality of image areas to be selected according to the angle value includes: determining continuous and adjacent image areas to be selected as area groups, and determining the number of image areas to be selected included in each area group; and determining the image area corresponding to the area group with the largest number as the target area.

[0058] The processor may determine continuous and adjacent image regions to be selected as region groups, and may determine the number of image regions to be selected contained in each region group. Then, the processor may determine the image region corresponding to the region group with the largest number as the target region. For example, if the image regions to be selected are A3, A4, A5, A6, A10, and A11, the processor may determine the image regions A3, A4, A5, and A6 to be selected as a region group M1, and may determine the image regions A10 and A11 as a region group N1. Among them, the region group M1 includes 4 continuous and adjacent image regions to be selected, and the region group N1 includes 2 continuous and adjacent image regions to be selected. Thus, the processor may determine the image region corresponding to the image regions A3, A4, A5, and A6 to be selected in the region group M1 as the target region.

[0059] In one embodiment, determining the image area corresponding to the area group with the largest number as the target area includes: when there are multiple area groups with the largest number, determining the average angle value of the image area corresponding to each area group; and determining the image area corresponding to the area group with the largest average angle value among the area groups with the largest number as the target area.

[0060] In the case where there are multiple area groups with the largest number, the processor can determine the average angle value of the image area corresponding to each area group. In the case of determining the average angle value, the processor can determine the image corresponding to the area group with the largest average angle value among the area groups with the largest number as the target area. For example, if the image areas to be selected are A3, A4, A10, and A11, the processor can use the image areas A3 and A4 to be selected as an area group M2, and can use the image areas A10 and A11 as an area group N2. Among them, the number of image areas to be selected included in the area groups M2 and N2 is 2. At this time, the processor can determine the average angle values ​​of the area groups M2 and N2 respectively. If the average angle value of the area group M2 is greater than the average angle value of N2, then the image area corresponding to the area group M2 can be determined as the target area.

[0061] In one embodiment, determining the target area from the multiple image areas to be selected according to the angle value includes: when any two of the multiple image areas to be selected are not adjacent, determining the image area to be selected with the largest angle value as the target area.

[0062] In the case where any two of the multiple image regions to be selected are not adjacent, the processor may determine the image region to be selected with the largest angle value as the target region. For example, for image regions A1, A3, A5, and A7 to be selected, any two of the image regions to be selected are not adjacent. In this case, if the angle value corresponding to image region A1 to be selected is the maximum value, the processor may determine image region A1 to be selected as the target region.

[0063] In one embodiment, the method also includes: determining the angle between the center line of the target area and the starting dividing line as the first deviation angle of the valve joint, the starting dividing line refers to the dividing line located at a preset position; obtaining the second deviation angle of the pipeline connected to the valve joint; when the angle difference between the first deviation angle and the second deviation angle is within a preset range, determining that the detection result of the valve joint orientation is qualified; when the angle difference between the first deviation angle and the second deviation angle exceeds the preset range, determining that the detection result of the valve joint orientation is unqualified.

[0064] The processor can determine the angle between the center line of the target area and the starting dividing line as the first deflection angle of the valve joint. The starting dividing line refers to a dividing line located at a preset position. For example, the starting dividing line can be a dividing line with a relative direction of three o'clock. The processor can obtain the second deflection angle of the pipeline connected to the valve joint. When the first deflection angle and the second deflection angle are determined, the processor can determine the angle difference between the first deflection angle and the second deflection angle, and can determine whether the angle difference is within a preset range, thereby determining the detection result of the valve joint. Further, when the angle difference between the first deflection angle and the second deflection angle is within a preset range, the processor can determine that the detection process of the valve joint orientation is qualified. That is, at this time, the assembly error between the valve joint and the pipeline is small. When the angle difference between the first deflection angle and the second deflection angle exceeds the preset range, the processor can determine that the detection result of the valve joint orientation is unqualified. That is, at this time, the assembly error between the valve joint and the pipeline is large, which is easy to cause pipeline interference, and the valve joint needs to be reassembled and tested. The preset error can be 5% to 10%.

[0065] In one embodiment, Figure 2 As shown, a flow chart of another method for detecting the orientation of a valve joint is provided.

[0066] The processor can obtain the joint image and can perform image enhancement on the joint image. Specifically, the processor can convert the joint image into a grayscale image and multiply the pixel value of the grayscale image by a coefficient α to obtain a first joint image. The processor can convert the joint image into a grayscale image and multiply the pixel value of the grayscale image by a coefficient β to obtain a second joint image. Then, the processor can match the first joint image with the template image according to the template matching algorithm to determine the center point of the valve joint in the first joint image. When the center point is determined, the processor can determine the image area to be detected in the second joint image. Wherein, the image area to be detected refers to a circular area with the center point as the origin and a radius of a preset value. After determining the image area to be detected, the processor can set the dividing lines in a clockwise or counterclockwise direction in sequence according to a preset interval angle of 1° to divide the image area to be detected into 360 image areas. The processor can count the 360-degree pixel mean, that is, the pixel mean of each image area in the 360 ​​image areas can be determined, and window smoothing can be performed to determine the brightness value of each image area. The processor can obtain the brightest angle, that is, the image area with the largest brightness value can be determined as the target area, and the angle between the center point of the target area and the starting dividing line can be determined as the deflection angle of the valve joint. The processor can also determine the direction from the center point to the center line of the target area as the orientation of the valve joint. Among them, the starting dividing line refers to the dividing line located at a preset position.

[0067] In one embodiment, the processor may determine an array corresponding to a plurality of image regions. The array may refer to a set of parameters of each image region. The parameter may be one of the sum of grayscale values, the sum of the number of pixels, the grayscale mean, and the brightness value. Each image region refers to a closed area formed by the first and second dividing lines corresponding to each image region and the center point. Each image region corresponds to an angle value. The angle value refers to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line, and the starting dividing line refers to the dividing line located at a preset position.

[0068] For example, if the processor divides the image area to be detected into 360 image areas according to a preset interval angle, the processor can determine an array S1 corresponding to multiple image areas, wherein the array S1 can include the sum of the grayscale values ​​of each image area. For array S1, the array can be expressed as S1 = {A0, A1, A2, ... A359}. Among them, A0 refers to the sum of the grayscale values ​​of the image area corresponding to the angle value of 0, A1 refers to the sum of the grayscale values ​​of the image area corresponding to the angle value of 1, A2 refers to the sum of the grayscale values ​​of the image area corresponding to the angle value of 2, and A359 refers to the sum of the grayscale values ​​of the image area corresponding to the angle value of 359.

[0069] The processor may determine an array S2 corresponding to a plurality of image regions. For the array S2, the array may be expressed as S2 = {B0, B1, B2, ... B359}. Wherein, B0 refers to the sum of the number of pixels of the image region corresponding to an angle value of 0, B1 refers to the sum of the number of pixels of the image region corresponding to an angle value of 1, B2 refers to the sum of the number of pixels of the image region corresponding to an angle value of 2, and B359 refers to the sum of the number of pixels of the image region corresponding to an angle value of 359.

[0070] The processor can determine an array S3 corresponding to multiple image areas. For array S3, the array can be expressed as S3 = {C0, C1, C2, ... C359}. Among them, C0 refers to the grayscale mean of the image area corresponding to the angle value of 0, C1 refers to the grayscale mean of the image area corresponding to the angle value of 1, C2 refers to the grayscale mean of the image area corresponding to the angle value of 2, and C359 refers to the grayscale mean of the image area corresponding to the angle value of 359. Among them, the grayscale mean of each image area in array S3 is determined according to the sum of the grayscale values ​​of each image area in array S1 and the sum of the number of pixels of each image area in array S2. For example, C0 = A0 / B0.

[0071] The processor can determine an array S4 corresponding to multiple image areas. For array S4, the array can be expressed as S4 = {D0, D1, D2, ... D359}. Among them, D0 refers to the brightness value of the image area corresponding to the angle value of 0, D1 refers to the brightness value of the image area corresponding to the angle value of 1, D2 refers to the brightness value of the image area corresponding to the angle value of 2, and D359 refers to the brightness value of the image area corresponding to the angle value of 359. Among them, for any image area in array S4, the brightness value of the image area is the average of the grayscale mean values ​​of multiple adjacent image areas of the image area and the grayscale mean value of the image area. For example, for an image area corresponding to an angle value of 0, if it is necessary to obtain six adjacent image areas of the image area (an image area corresponding to an angle value of 357, an image area corresponding to an angle value of 358, an image area corresponding to an angle value of 359, an image area corresponding to an angle value of 1, an image area corresponding to an angle value of 2, and an image area corresponding to an angle value of 3), the processor can determine the average value of the grayscale mean values ​​(C357, C358, C359, C1, C2, C3) of the six adjacent image areas and the grayscale mean value (C0) of the image area corresponding to the angle value of 0 as the brightness value of the image area corresponding to the angle value of 0. That is, the brightness value D0 of the image area corresponding to the angle value of 0 = C357 + C358 + C359 + C0 + C1 + C2 + C3 / 7.

[0072] When determining an array S4 with multiple image regions, the processor can traverse the brightness value of each image region in the array S4, and can determine the image region with the largest brightness value as the target region. The processor can determine the direction of the center point extending toward the center line of the target region as the direction of the valve joint.

[0073] The above technical solution can quickly detect the orientation of the valve joint by dividing the image area to be detected into multiple image areas and determining the brightness value of each image area, thereby determining the orientation of the valve joint by the brightness value, and greatly improving the detection efficiency of the valve joint orientation. Moreover, the detection accuracy is high, no data annotation is required, the workload of detection is reduced, and the labor cost and time cost are greatly reduced.

[0074] Figure 1-2 FIG. 1 is a flow chart of a method for detecting the orientation of a valve joint in one embodiment. It should be understood that although Figure 1-2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-2At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0075] In one embodiment, Figure 3 As shown, a device 300 for detecting the orientation of a valve joint is provided, comprising an image determination module 301, an image region determination module 302, an image region segmentation module 303, a target region determination module 304 and an orientation determination module 305, wherein:

[0076] The image determination module 301 is used to determine the image to be detected of the valve joint.

[0077] The image area determination module 302 is used to match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected, and determine the circular area with the center point as the origin and the radius as the preset value as the image area to be detected in the image to be detected.

[0078] The image region segmentation module 303 is used to sequentially set segmentation lines in a clockwise or counterclockwise direction according to preset interval angles to segment the image region to be detected into multiple image regions.

[0079] The target region determination module 304 is used to determine the brightness value of each image region according to the gray value of each pixel point included in the image region, and determine the image region with the largest brightness value as the target region.

[0080] The direction determination module 305 is used to determine the direction in which the center point extends toward the center line of the target area as the direction of the valve joint.

[0081] The image to be detected may refer to an image after grayscale processing and enhancement processing of the original image of the valve joint. The original image of the valve joint may be obtained by an image acquisition device. The image acquisition device may be a device with image acquisition function such as a camera, a video camera, a camera, a recorder, an intelligent camera, etc. The image acquisition device may be installed at a position relative to the valve joint. The image determination module 301 may determine the image to be detected of the valve joint.

[0082] Since the position of the valve joint relative to the image acquisition device is not completely fixed, it is impossible to accurately determine the center point position of the valve joint in the image to be detected at this time. In order to ensure the accuracy of the subsequent valve joint orientation detection, when the image to be detected of the valve joint is obtained, the image area determination module 302 can further obtain a template image of the valve joint. Among them, the template image can refer to an image of the center position of the valve joint after cropping and grayscale processing. After obtaining the template image of the valve joint, the image area determination module 302 can match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected. Specifically, the image area determination module 302 can match the image to be detected with the template image according to the template matching algorithm to determine the image area with the highest confidence on the image to be detected through the template image, and determine the center point of the image area as the center point of the valve joint. When the center point of the valve joint in the image to be detected is determined, the image area determination module 302 determines the circular area with the center point as the origin and the radius as the preset value as the image area to be detected in the image to be detected. Among them, the preset value can be determined according to the maximum radius of the valve joint. For example, the preset value may be equal to the maximum radius of the valve joint, or may be greater than the maximum radius of the valve joint.

[0083] In the case of determining the image area to be detected in the image to be detected, the image area segmentation module 303 can set the segmentation lines in sequence in a clockwise or counterclockwise direction according to the preset interval angle to divide the image area to be detected into multiple image areas. Among them, the preset interval angle can be customized according to the actual situation. In one embodiment, the preset interval angle is 1°. If the preset interval angle is 1°, the image area to be detected can be divided into 360 image areas. In the case of dividing the image area to be detected into multiple image areas, for each image area, the target area determination module 304 can determine the brightness value of the image area according to the grayscale value of each pixel included in the image area, and can determine the image area with the largest brightness value as the target area. In the case of determining the target area, the orientation determination module 305 can determine the direction in which the center point extends toward the center line of the target area as the orientation of the valve joint.

[0084] The above technical solution can quickly detect the orientation of the valve joint by dividing the image area to be detected into multiple image areas and determining the brightness value of each image area, thereby determining the orientation of the valve joint by the brightness value, and greatly improving the detection efficiency of the valve joint orientation. Moreover, the detection accuracy is high, no data annotation is required, the workload of detection is reduced, and the labor cost and time cost are greatly reduced.

[0085] The device for detecting the orientation of a valve joint includes a processor and a memory. The above-mentioned image determination module, image area determination module, image area segmentation module, target area determination module and orientation determination module are all stored in the memory as program units, and the processor executes the above-mentioned program modules stored in the memory to implement corresponding functions.

[0086] The processor includes a kernel, and the kernel calls the corresponding program unit from the memory. One or more kernels can be set, and the method for detecting the direction of the valve joint is realized by adjusting the kernel parameters.

[0087] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0088] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned method for detecting the orientation of a valve joint is implemented.

[0089] An embodiment of the present application provides a processor, which is used to run a program, wherein the program executes the above-mentioned method for detecting the orientation of a valve joint when it is run.

[0090] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected via a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store data such as the brightness value of the image area. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a method for detecting the orientation of a valve joint is implemented.

[0091] Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0092] An embodiment of the present application provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: determining an image to be detected of a valve joint; matching the image to be detected with a template image of the valve joint to determine the center point of the valve joint in the image to be detected; determining a circular area with the center point as the origin and a radius of a preset value as the image area to be detected in the image to be detected; setting dividing lines in a clockwise or counterclockwise direction in sequence at preset interval angles to divide the image area to be detected into multiple image areas; for each image area, determining a brightness value of the image area according to the grayscale value of each pixel included in the image area; determining the image area with the largest brightness value as the target area; and determining the direction in which the center point extends toward the center line of the target area as the orientation of the valve joint.

[0093] In one embodiment, for each image area, determining the brightness value of the image area based on the grayscale value of each pixel included in the image area includes: for each image area, determining the sum of the grayscale values ​​of all the pixels included in the image area based on the grayscale value of each pixel included in the image area; determining the total number of pixels included in each image area; for each image area, determining the ratio of the sum of the grayscale values ​​corresponding to the image area to the sum of the number of pixels as the grayscale mean of the image area; and determining the brightness value of each image area based on the grayscale mean of each image area.

[0094] In one embodiment, determining the brightness value of each image region according to the grayscale mean of each image region includes: for any image region, determining the average of the grayscale means of multiple adjacent image regions of the image region and the grayscale mean of the image region as the brightness value of the image region.

[0095] In one embodiment, each image area refers to a closed area formed by a first dividing line and a second dividing line corresponding to each image area and a center point, and determining the image area with the largest brightness value as the target area includes: when there are multiple image areas with the largest brightness values, taking the image area with the largest brightness value as the image area to be selected; determining the angle value of each image area to be selected, the angle value refers to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line, and the starting dividing line refers to the dividing line located at a preset position; and determining the target area from multiple image areas to be selected according to the angle value.

[0096] In one embodiment, determining a target area from a plurality of image areas to be selected according to the angle value includes: determining continuous and adjacent image areas to be selected as area groups, and determining the number of image areas to be selected included in each area group; and determining the image area corresponding to the area group with the largest number as the target area.

[0097] In one embodiment, determining the image area corresponding to the area group with the largest number as the target area includes: when there are multiple area groups with the largest number, determining the average angle value of the image area corresponding to each area group; and determining the image area corresponding to the area group with the largest average angle value among the area groups with the largest number as the target area.

[0098] In one embodiment, determining the target area from the multiple image areas to be selected according to the angle value includes: when any two of the multiple image areas to be selected are not adjacent, determining the image area to be selected with the largest angle value as the target area.

[0099] In one embodiment, the method also includes: determining the angle between the center line of the target area and the starting dividing line as the first deviation angle of the valve joint, the starting dividing line refers to the dividing line located at a preset position; obtaining the second deviation angle of the pipeline connected to the valve joint; when the angle difference between the first deviation angle and the second deviation angle is within a preset range, determining that the detection result of the valve joint orientation is qualified; when the angle difference between the first deviation angle and the second deviation angle exceeds the preset range, determining that the detection result of the valve joint orientation is unqualified.

[0100] In one embodiment, the preset interval angle is 1°.

[0101] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: determining an image to be detected of a valve joint; matching the image to be detected with a template image of the valve joint to determine the center point of the valve joint in the image to be detected; determining a circular area with the center point as the origin and a radius of a preset value as the image area to be detected in the image to be detected; setting dividing lines in sequence in a clockwise or counterclockwise direction at preset interval angles to divide the image area to be detected into multiple image areas; for each image area, determining the brightness value of the image area according to the grayscale value of each pixel included in the image area; determining the image area with the largest brightness value as the target area; and determining the direction in which the center point extends toward the center line of the target area as the orientation of the valve joint.

[0102] In one embodiment, for each image area, determining the brightness value of the image area based on the grayscale value of each pixel included in the image area includes: for each image area, determining the sum of the grayscale values ​​of all the pixels included in the image area based on the grayscale value of each pixel included in the image area; determining the total number of pixels included in each image area; for each image area, determining the ratio of the sum of the grayscale values ​​corresponding to the image area to the sum of the number of pixels as the grayscale mean of the image area; and determining the brightness value of each image area based on the grayscale mean of each image area.

[0103] In one embodiment, determining the brightness value of each image region according to the grayscale mean of each image region includes: for any image region, determining the average of the grayscale means of multiple adjacent image regions of the image region and the grayscale mean of the image region as the brightness value of the image region.

[0104] In one embodiment, each image area refers to a closed area formed by a first dividing line and a second dividing line corresponding to each image area and a center point, and determining the image area with the largest brightness value as the target area includes: when there are multiple image areas with the largest brightness values, taking the image area with the largest brightness value as the image area to be selected; determining the angle value of each image area to be selected, the angle value refers to the angle between the second dividing line farthest from the starting dividing line and the starting dividing line, and the starting dividing line refers to the dividing line located at a preset position; and determining the target area from multiple image areas to be selected according to the angle value.

[0105] In one embodiment, determining a target area from a plurality of image areas to be selected according to the angle value includes: determining continuous and adjacent image areas to be selected as area groups, and determining the number of image areas to be selected included in each area group; and determining the image area corresponding to the area group with the largest number as the target area.

[0106] In one embodiment, determining the image area corresponding to the area group with the largest number as the target area includes: when there are multiple area groups with the largest number, determining the average angle value of the image area corresponding to each area group; and determining the image area corresponding to the area group with the largest average angle value among the area groups with the largest number as the target area.

[0107] In one embodiment, determining the target area from the multiple image areas to be selected according to the angle value includes: when any two of the multiple image areas to be selected are not adjacent, determining the image area to be selected with the largest angle value as the target area.

[0108] In one embodiment, the method also includes: determining the angle between the center line of the target area and the starting dividing line as the first deviation angle of the valve joint, the starting dividing line refers to the dividing line located at a preset position; obtaining the second deviation angle of the pipeline connected to the valve joint; when the angle difference between the first deviation angle and the second deviation angle is within a preset range, determining that the detection result of the valve joint orientation is qualified; when the angle difference between the first deviation angle and the second deviation angle exceeds the preset range, determining that the detection result of the valve joint orientation is unqualified.

[0109] In one embodiment, the preset interval angle is 1°.

[0110] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0111] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0114] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0115] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0116] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0117] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0118] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for detecting the orientation of a valve joint, It is characterized in that The method comprises: Determining the image to be detected of the valve joint; Matching the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected; Determine a circular area with the center point as the origin and a radius as a preset value as the image area to be detected in the image to be detected; Sequentially setting dividing lines in a clockwise or counterclockwise direction according to preset interval angles to divide the image area to be detected into a plurality of image areas; For each image area, determining a brightness value of the image area according to a grayscale value of each pixel included in the image area; Determine the image area with the largest brightness value as the target area; The direction in which the center point extends toward the center line of the target area is determined as the orientation of the valve joint.

2. The method for detecting the orientation of a valve joint according to claim 1, It is characterized in that The step of determining the brightness value of each image region according to the grayscale value of each pixel point included in the image region comprises: For each image area, determining the sum of the grayscale values ​​of all the pixels included in the image area according to the grayscale value of each pixel included in the image area; Determine the total number of pixels included in each image region; For each image region, a ratio of the total grayscale value corresponding to the image region to the total number of pixels is determined as the grayscale mean value of the image region; The brightness value of each image region is determined according to the grayscale mean of each image region.

3. The method for detecting the orientation of a valve joint according to claim 2, It is characterized in that Determining the brightness value of each image area according to the grayscale mean value of each image area comprises: For any image region, an average value of grayscale means of a plurality of adjacent image regions of the image region and the grayscale mean of the image region is determined as the brightness value of the image region.

4. The method for detecting the orientation of a valve joint according to claim 1, It is characterized in that Each image region refers to a closed area formed by the first segmentation line and the second segmentation line corresponding to each image region and the central point, and determining the image region with the maximum brightness value as the target region includes: When there are multiple image regions with the largest brightness values, the image region with the largest brightness values ​​is used as the image region to be selected; Determine an angle value of each image region to be selected, where the angle value refers to the angle between a second segmentation line that is farthest from a starting segmentation line and the starting segmentation line, where the starting segmentation line refers to a segmentation line located at a preset position; A target area is determined from a plurality of image areas to be selected according to the angle value.

5. The method for detecting the orientation of a valve joint according to claim 4, It is characterized in that Determining the target area from a plurality of image areas to be selected according to the angle value includes: Determine continuous and adjacent image regions to be selected as region groups, and determine the number of image regions to be selected included in each region group; The image region corresponding to the region group with the largest number is determined as the target region.

6. The method for detecting the orientation of a valve joint according to claim 5, It is characterized in that The step of determining the image area corresponding to the area group with the largest number as the target area comprises: In the case where there are multiple area groups with the largest number, determining a mean angle value of the image area corresponding to each area group; The image area corresponding to the area group with the largest average angle value among the area groups with the largest number is determined as the target area.

7. The method for detecting the orientation of a valve joint according to claim 4, It is characterized in that Determining the target area from a plurality of image areas to be selected according to the angle value includes: In the case that any two of the multiple image regions to be selected are not adjacent, the image region to be selected with the largest angle value is determined as the target region.

8. The method for detecting the orientation of a valve joint according to claim 1, It is characterized in that The method further comprises: Determine the angle between the center line of the target area and the starting dividing line as the first deflection angle of the valve joint, wherein the starting dividing line refers to a dividing line located at a preset position; Acquire a second deflection angle of the pipeline connected to the valve joint; When the angle difference between the first deflection angle and the second deflection angle is within a preset range, determining that the detection result of the valve joint orientation is qualified; When the angle difference between the first deflection angle and the second deflection angle exceeds the preset range, it is determined that the detection result of the valve joint orientation is unqualified.

9. A method for detecting the orientation of a valve joint according to any one of claims 1 to 8, It is characterized in that The preset interval angle is 1°.

10. A device for detecting the orientation of a valve joint, It is characterized in that The device comprises: An image determination module, used to determine the image to be detected of the valve joint; An image region determination module is used to match the image to be detected with the template image of the valve joint to determine the center point of the valve joint in the image to be detected, and determine a circular region with the center point as the origin and a radius of a preset value as the image region to be detected in the image to be detected; An image region segmentation module, used to sequentially set segmentation lines in a clockwise or counterclockwise direction according to preset interval angles, so as to segment the image region to be detected into a plurality of image regions; A target region determination module is used to determine the brightness value of each image region according to the gray value of each pixel point included in the image region, and determine the image region with the largest brightness value as the target region; The direction determination module is used to determine the direction in which the center point extends toward the center line of the target area as the direction of the valve joint.

11. A machine-readable storage medium having instructions stored thereon, It is characterized in that When the instructions are executed by a processor, the processor is configured to perform the method for detecting the orientation of a valve joint according to any one of claims 1 to 9.

12. A processor, It is characterized in that The device is configured to perform the method for detecting the orientation of a valve joint according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Fire point detection method and device, electronic equipment and storage medium

    CN114758290A

  • Method and device for identifying wrist, method for identifying gesture, electronic equipment and computer-readable storage medium

    US20190332858A1