A method, device and equipment for measuring the inner and outer diameters of a PPR pipe and a storage medium
By combining deep learning and traditional image processing algorithms, the inner and outer diameters of PPR pipes can be automatically measured, solving the problems of time-consuming, labor-intensive, and inaccurate measurement in existing technologies, and achieving efficient and accurate inner and outer diameter measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, measuring the inner and outer diameters of PPR pipes is time-consuming, labor-intensive, and inaccurate, especially under conditions of varying lighting and the presence of impurities.
Deep learning algorithms are used for coarse segmentation, combined with traditional image algorithms for fine segmentation. Distance algorithms are used to measure the inner and outer diameters of the PPR pipe. By acquiring images of the pipe end face, the Otsu algorithm is used to find the optimal threshold for binarization. The flood filling method is used to fill the holes, and opening operations are performed. Finally, the Canny algorithm is used to extract the inner and outer circular contours and calculate the inner and outer diameters.
It enables automatic measurement of the inner and outer diameters of PPR pipes, improving measurement speed and accuracy, saving manpower, increasing production line efficiency, and ensuring measurement accuracy and speed.
Smart Images

Figure CN116309376B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of deep learning, and in particular to a ppr pipeline inner and outer diameter measurement method, device, equipment and storage medium. BACKGROUND
[0002] Polypropylene random (PPR) pipe is commonly used in the construction industry, municipal engineering, water conservancy engineering, agriculture and industry, etc. It has the characteristics of moderate price, stable performance, heat resistance, corrosion resistance, etc. Compared with traditional cast iron pipes, it has the advantages of energy saving, environmental protection, light weight and high strength.
[0003] When a factory produces a PPR pipe, workers need to measure the inner and outer diameters of each PPR pipe produced. The entire measurement process is time-consuming and labor-intensive. The existing scheme uses a vernier caliper to measure the inner and outer diameters of the PPR pipe, which is time-consuming and labor-intensive. Alternatively, only based on traditional image processing algorithms, the pipe end face is processed to obtain the measurement value, but this method cannot cope with the measurement of the inner and outer diameters of the PPR pipe with light difference and impurities during collection, so it will affect the measurement accuracy. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a PPR pipe inner and outer diameter measurement method, device, equipment and storage medium, which solves the problem of inaccurate measurement accuracy in the prior art.
[0005] To solve the above technical problems, the present application provides a PPR pipe inner and outer diameter measurement method, comprising:
[0006] Obtain an end face image of a PPR pipe;
[0007] Coarsely segment the end face image using a deep learning algorithm to obtain an effective region image;
[0008] Fine segment the effective region image using a traditional image algorithm to obtain a segmented image;
[0009] Measure the segmented image using a distance algorithm to obtain the inner and outer diameter measurement value of the PPR pipe.
[0010] Optionally, the fine segmentation of the effective region image using the traditional image algorithm to obtain the segmented image comprises:
[0011] Finding the best threshold value of the effective region image using the Otsu algorithm;
[0012] Based on the best threshold value, the effective region image is binarized to obtain a binary image;
[0013] Fill holes of the binary image by using a flood fill method to obtain a filled image;
[0014] Perform an open operation on the filled image to obtain the segmentation image.
[0015] Optionally, the measuring the segmentation image by using a distance algorithm to obtain the inner and outer diameter measurement values of the PPR pipe comprises:
[0016] Using a Canny algorithm to find the inner and outer circular contours of the end face in the segmentation image, and calculating the inner and outer diameter measurement values based on the inner and outer circular contours.
[0017] Optionally, the calculating the inner and outer diameter measurement values based on the inner and outer circular contours comprises:
[0018] Calculating the maximum distance between each point on the inner circular contour and other remaining points on the inner circular contour as a first distance, and sorting the first distances of each point from large to small to obtain an inner diameter distance sequence;
[0019] Calculating the maximum distance between each point on the outer circular contour and other remaining points on the outer circular contour as a second distance, and sorting the second distances of each point from large to small to obtain an outer diameter distance sequence;
[0020] Obtaining the inner and outer diameter measurement values according to the inner and outer diameter distance sequences.
[0021] Optionally, the obtaining the inner and outer diameter measurement values according to the inner and outer diameter distance sequences comprises:
[0022] Reserving part of the values of the inner diameter distance sequence as an inner circular contour value group according to a first preset rule;
[0023] Reserving part of the values of the outer diameter distance sequence as an outer circular contour value group according to a second preset rule;
[0024] Taking an average of the inner circular contour value group to obtain a first average value, and multiplying the first average value by a scaling coefficient to obtain an inner diameter measurement value of the inner and outer diameter measurement values;
[0025] Taking an average of the outer circular contour value group to obtain a second average value, and multiplying the second average value by the scaling coefficient to obtain an outer diameter measurement value of the inner and outer diameter measurement values.
[0026] Optionally, the reserving part of the values of the inner diameter distance sequence as the inner circular contour value group according to the first preset rule, and reserving part of the values of the outer diameter distance sequence as the outer circular contour value group according to the second preset rule comprises:
[0027] The remaining values after removing the first N values and the last N values of the inner diameter distance sequence are taken as the inner circle profile value group.
[0028] The remaining values after removing the first N values and the last N values of the outer diameter distance sequence are taken as the outer circle profile value group.
[0029] Optionally, the end face image is coarsely segmented by using a deep learning algorithm to obtain an effective region image, and the method comprises the following steps:
[0030] The end face image is preprocessed by using an interpolation algorithm to obtain a scaled image.
[0031] The scaled image is coarsely segmented by using an Encoder-decode framework to obtain a first image.
[0032] The first image is enlarged to a size consistent with the end face image to serve as the effective region image.
[0033] The application further provides a ppr pipeline inner and outer diameter measuring device, comprising:
[0034] An acquisition module is configured to acquire an end face image of a ppr pipeline.
[0035] A coarse segmentation module is configured to coarsely segment the end face image by using a deep learning algorithm to obtain an effective region image.
[0036] A fine segmentation module is configured to finely segment the effective region image by using a traditional image algorithm to obtain a segmented image.
[0037] A measurement module is configured to measure the segmented image by using a distance algorithm to obtain inner and outer diameter measurement values of the ppr pipeline.
[0038] The application further provides a ppr pipeline inner and outer diameter measuring device, comprising:
[0039] A memory is configured to store a computer program.
[0040] A processor is configured to execute the computer program to implement the steps of the above-mentioned ppr pipeline inner and outer diameter measuring method.
[0041] The application further provides a storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the above-mentioned ppr pipeline inner and outer diameter measuring method.
[0042] It can be seen that the present application obtains the end surface image of the ppr pipeline; the end surface image is coarsely segmented by using a deep learning algorithm to obtain an effective region image; the effective region image is finely segmented by using a traditional image algorithm to obtain a segmented image; and the segmented image is measured by using a distance algorithm to obtain the inner and outer diameter measurement values of the ppr pipeline. The method uses artificial intelligence technology to automatically measure the inner and outer diameter sizes of the ppr pipeline, uses a deep learning method in combination with a traditional image processing mode, improves the speed and accuracy of measurement, and does not need human intervention from the beginning of ppr pipeline end surface image acquisition, and automatically outputs the inner and outer diameter measurement values of the ppr pipeline end surface, greatly improving the work efficiency of the production line and saving manpower.
[0043] In addition, the present application also provides a ppr pipeline inner and outer diameter measuring device, equipment and storage medium, which also have the above beneficial effects. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only a part of the embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of the provided drawings.
[0045] Figure 1 A flow chart of a ppr pipeline inner and outer diameter measuring method provided by the embodiment of the present application;
[0046] Figure 2 A structural schematic diagram of a ppr pipeline inner and outer diameter measuring device provided by the embodiment of the present application;
[0047] Figure 3 A structural schematic diagram of a ppr pipeline inner and outer diameter measuring device provided by the embodiment of the present application; DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0049] Please refer to Figure 1 , Figure 1 A flow chart of a ppr pipeline inner and outer diameter measuring method provided by the embodiment of the present application. The method can include:
[0050] S101: Obtain an end surface image of the ppr pipe.
[0051] The execution subject of the embodiment is a terminal. The embodiment is not limited to the type of the terminal as long as the terminal can complete the inner and outer diameter measurement of the ppr pipe. For example, the terminal can be a special-purpose terminal or a general-purpose terminal. The embodiment obtains the end surface image of the ppr pipe, and performs subsequent processing on the image to detect the inner and outer diameter measurement values.
[0052] S102: Coarsely segment the end surface image by using a deep learning algorithm to obtain an effective region image.
[0053] The embodiment coarsely segments the end surface image by using a deep learning algorithm to obtain an effective region image. The deep learning segmentation algorithm in the embodiment can be any algorithm that can segment an image.
[0054] Further, in order to improve the effectiveness of image segmentation, the step of coarsely segmenting the end surface image by using a deep learning algorithm to obtain an effective region image can include the following steps:
[0055] Preprocess the end surface image by using an interpolation algorithm to obtain a scaled image;
[0056] Coarsely segment the scaled image by using an Encoder-decode framework to obtain a first image;
[0057] Enlarge the first image to the size of the end surface image to obtain the effective region image.
[0058] In the embodiment, the end surface image is scaled by using an interpolation algorithm to scale a large-size image into a small-size image, the scaled image is coarsely segmented by using an Encoder-decode framework to obtain a first image, that is, the effective region is extracted, the first image is restored to the original size to obtain the effective region image. The embodiment is not limited to the interpolation algorithm. For example, the interpolation algorithm can be a bilinear interpolation algorithm or a nearest neighbor interpolation algorithm. The Encoder-decode framework is a pixel-wise classification task that can preserve the original size of the output result, for example, u-net (U-net is a CNN-based image segmentation network) is a common Encoder-decode. The training image in the embodiment is a labeled scaled image.
[0059] S103: Finely segment the effective region image by using a traditional image algorithm to obtain a segmented image.
[0060] The embodiment finely segments the effective region image by using a traditional image algorithm to obtain a segmented image. The traditional image segmentation algorithm in the embodiment can be any algorithm that can segment an image.
[0061] Further, in order to accurately segment, the above-mentioned using traditional image algorithm to effectively subdivide the region image, get the segmentation image, can include the following steps:
[0062] Using Otsu algorithm to find the best threshold of the effective region image;
[0063] Based on the best threshold, the effective region image is binarized to obtain a binary image;
[0064] Using the flood fill method to fill the holes of the binary image to obtain a filled image;
[0065] The filled image is operated to obtain a segmentation image.
[0066] In this embodiment, the Otsu algorithm is an algorithm for determining the threshold of image binarization segmentation, also known as the maximum inter-class variance method. After the threshold obtained by the Otsu algorithm is used for image binarization segmentation, the inter-class variance of the foreground and background image is maximum. The flood fill method is a method for filling connected regions with a specific color by setting the upper and lower limits of the connectable pixels and the connection method to achieve different filling effects. In this embodiment, the Otsu algorithm is used to find the best threshold of the image, and the effective region image is binarized. Then, the holes of the binary image are filled based on the flood fill method, and the image is operated multiple times to remove the burrs on the edge of the ppr pipe end face, so as to achieve the purpose of fine segmentation, thereby obtaining the segmentation image.
[0067] S104: Using distance algorithm to measure the segmentation image to obtain the inner and outer diameter measurement value of the ppr pipe.
[0068] In this embodiment, the distance algorithm is used to measure the segmentation image to obtain the inner and outer diameter measurement value of the ppr pipe. The distance algorithm in this embodiment can only measure the inner and outer diameter of the ppr pipe.
[0069] Further, in order to the accuracy of the inner and outer circular contour extraction, the above-mentioned using distance algorithm to measure the segmentation image, get the inner and outer diameter measurement value of the ppr pipe, can include the following steps:
[0070] Using canny algorithm to find the inner and outer circular contour of the end face in the segmentation image, and calculating the inner and outer diameter measurement value based on the inner and outer circular contour.
[0071] In this embodiment, the canny edge detection algorithm is used to extract the inner and outer circular contour of the end face in the segmentation image, and the inner diameter measurement value is calculated according to the inner circular contour, and the outer diameter measurement value is calculated according to the outer circular contour. In this embodiment, when the inner and outer circular contour is successfully extracted, the method for measuring the inner and outer diameter is not limited, as long as the inner and outer diameter measurement value can be calculated.
[0072] Further, in order to further improve the accuracy of the inner and outer diameter measurement value, the calculation of the inner and outer diameter measurement value based on the inner and outer circle profiles can include the following steps:
[0073] Calculate the maximum distance between each point on the inner circle profile and the other remaining points on the inner circle profile as the first distance, and sort the first distance of each point from large to small to obtain the inner diameter distance sequence;
[0074] Calculate the maximum distance between each point on the outer circle profile and the other remaining points on the outer circle profile as the second distance, and sort the second distance of each point from large to small to obtain the outer diameter distance sequence;
[0075] Obtain the inner and outer diameter measurement value according to the inner and outer diameter distance sequences.
[0076] The embodiment calculates the distance between each point on the inner / outer profile and the remaining points on the inner / outer profile, and takes the maximum value as a measurement value of the inner / outer diameter. Then, all the measurement values of the inner / outer diameter are sorted to obtain the inner / outer diameter distance sequence, and the inner and outer diameter measurement value is determined according to the measurement values.
[0077] Further, in order to avoid the interference of outlier edge profile points, the inner and outer diameter measurement value obtained according to the inner and outer diameter distance sequences can include the following steps:
[0078] According to the first preset rule, part of the values in the inner diameter distance sequence are reserved as the inner circle profile value group;
[0079] According to the second preset rule, part of the values in the outer diameter distance sequence are reserved as the outer circle profile value group;
[0080] The inner circle profile value group is averaged to obtain a first average value, and the first average value multiplied by a scaling factor obtains the inner diameter measurement value of the inner and outer diameter measurement value;
[0081] The outer circle profile value group is averaged to obtain a second average value, and the second average value multiplied by a scaling factor obtains the outer diameter measurement value of the inner and outer diameter measurement value.
[0082] After sorting all the measurement values of the inner / outer diameter, the embodiment removes part of the values according to the preset rule, and reserves the remaining values as the inner / outer circle profile value group. The remaining values are averaged and multiplied by a fixed scaling factor to obtain the inner / outer diameter measurement value. One pixel in the image corresponds to the size in the actual physical space, which is determined by the imaging system. The embodiment does not limit whether the first preset rule and the second preset rule are consistent. For example, the first preset rule and the second preset rule can be consistent, or the first preset rule and the second preset rule can be inconsistent.
[0083] Further, in order to improve the accuracy of the inner and outer diameter measurement values, the above-mentioned retaining part of the values of the inner diameter distance sequence as the inner circle contour value group according to the first preset rule and retaining part of the values of the outer diameter distance sequence as the outer circle contour value group according to the second preset rule can include the following steps:
[0084] After removing the first N values and the last N values of the inner diameter distance sequence, the remaining values are retained as the inner circle contour value group.
[0085] After removing the first N values and the last N values of the outer diameter distance sequence, the remaining values are retained as the outer circle contour value group.
[0086] In the embodiment, the first N values and the last N values of the inner / outer diameter distance sequence are removed, that is, the maximum value and the minimum value of N quantities are removed, and the remaining values are retained as the inner (outer) circle contour value group.
[0087] The ppr pipeline inner and outer diameter measurement method provided by the embodiment of the application is applied, the end surface image of the ppr pipeline is acquired, the deep learning algorithm is used for coarse segmentation of the end surface image to obtain an effective region image, the traditional image algorithm is used for fine segmentation of the effective region image to obtain a segmented image, and the distance algorithm is used for measuring the segmented image to obtain the inner and outer diameter measurement values of the ppr pipeline. The method uses artificial intelligence technology to automatically measure the inner and outer diameter sizes of the ppr pipeline, uses the deep learning method and the traditional image processing mode, improves the speed and accuracy of measurement, and completely does not need human intervention from the beginning of ppr pipeline end surface image acquisition. The inner and outer diameter measurement values of the ppr pipeline end surface are automatically output, the working efficiency of the production line is greatly improved, and manpower is saved. Moreover, the end surface is zoomed, the Encoder-decode framework is used for coarse segmentation, the image is enlarged again, the effectiveness of image segmentation is ensured, the Otsu algorithm is used for binaryzation processing, the hole filling method is used for hole filling, the opening operation is used to remove the burrs on the edge of the end surface, the accuracy is improved, the canny algorithm is used to extract the inner and outer circle contours of the end surface, the accuracy of edge detection is improved, the distance between each point on the contour and other points is calculated, the maximum value of the distance of each point is sorted to obtain a sequence, the accuracy of the inner and outer diameter measurement values is improved, and part of the values are removed according to the corresponding rules to avoid the interference of outlying edge contour points. The values after removing the N maximum values and the N minimum values in the corresponding value sequence are taken as the inner / outer circle contour value group, and the accuracy of the inner and outer diameter measurement values is improved.
[0088] The ppr pipeline inner and outer diameter measurement device provided by the embodiment of the application is described below, and the ppr pipeline inner and outer diameter measurement device described below can be correspondingly referred to the ppr pipeline inner and outer diameter measurement method described above.
[0089] Please refer to Figure 2 , Figure 2 A structure diagram of a ppr pipeline inner and outer diameter measuring device provided by the embodiment of the application can include:
[0090] The acquisition module 100 is configured to acquire an end face image of a ppr pipeline.
[0091] The coarse segmentation module 200 is configured to perform coarse segmentation on the end face image by using a deep learning algorithm to obtain an effective area image.
[0092] The fine segmentation module 300 is configured to perform fine segmentation on the effective area image by using a traditional image algorithm to obtain a segmentation image.
[0093] The measurement module 400 is configured to measure the segmentation image by using a distance algorithm to obtain an inner and outer diameter measurement value of the ppr pipeline.
[0094] Based on the above embodiment, the fine segmentation module 300 can include:
[0095] The optimal threshold acquisition unit is configured to find an optimal threshold of the effective area image by using the Otsu algorithm.
[0096] The binarization processing unit is configured to perform binarization processing on the effective area image based on the optimal threshold to obtain a binarization image.
[0097] The hole filling unit is configured to perform hole filling on the binarization image by using a flood fill method to obtain a filled image.
[0098] The open operation unit is configured to perform open operation on the filled image to obtain the segmentation image.
[0099] Based on the above embodiment, the measurement module 400 can include:
[0100] The calculation unit is configured to find an inner circle contour and an outer circle contour of an end face in the segmentation image by using a Canny algorithm, and calculate the inner and outer diameter measurement value based on the inner circle contour and the outer circle contour.
[0101] Based on the above embodiment, the calculation unit can include:
[0102] The first calculation subunit is configured to calculate a maximum distance between each point on the inner circle contour and other remaining points on the inner circle contour as a first distance, and sort the first distances of each point from large to small to obtain an inner diameter distance sequence.
[0103] a second calculating subunit configured to calculate a maximum distance between each point on the outer circle contour and other remaining points on the outer circle contour as a second distance, and sort the second distances of each point from large to small to obtain an outer diameter distance sequence;
[0104] a third calculating subunit configured to obtain the inner-outer diameter measurement value according to the inner diameter distance sequence and the outer diameter distance sequence.
[0105] Based on the above embodiments, the third calculating subunit can include:
[0106] an inner circle contour numerical group subunit configured to retain part of the numerical values in the inner diameter distance sequence as an inner circle contour numerical group according to a first preset rule;
[0107] an outer circle contour numerical group subunit configured to retain part of the numerical values in the outer diameter distance sequence as an outer circle contour numerical group according to a second preset rule;
[0108] a fourth calculating subunit configured to obtain a first average value by averaging the inner circle contour numerical group, and multiply the first average value by a scaling coefficient to obtain an inner diameter measurement value of the inner-outer diameter measurement value;
[0109] a fifth calculating subunit configured to obtain a second average value by averaging the outer circle contour numerical group, and multiply the second average value by the scaling coefficient to obtain an outer diameter measurement value of the inner-outer diameter measurement value.
[0110] Based on the above embodiments, the inner circle contour numerical group subunit and the outer circle contour numerical group subunit can include:
[0111] a first screening subunit configured to retain the numerical values after removing the first N numerical values and the last N numerical values in the inner diameter distance sequence as the inner circle contour numerical group;
[0112] a second screening subunit configured to retain the numerical values after removing the first N numerical values and the last N numerical values in the outer diameter distance sequence as the outer circle contour numerical group.
[0113] Based on any of the above embodiments, the coarse segmentation module 200 can include:
[0114] a preprocessing unit configured to pre-process the end face image by using an interpolation algorithm to obtain a scaled image;
[0115] a coarse segmentation unit configured to coarsely segment the scaled image by using an Encoder-decode framework to obtain a first image;
[0116] an amplification unit configured to amplify the first image to a size consistent with the end face image as the effective area image.
[0117] It should be noted that the modules and units in the ppr pipe inner and outer diameter measuring device described above can be changed in sequence without affecting the logic.
[0118] The ppr pipe inner and outer diameter measuring device provided by the embodiment of the application comprises: an acquisition module 100, configured to acquire an end face image of a ppr pipe; a coarse segmentation module 200, configured to perform coarse segmentation on the end face image by using a deep learning algorithm to obtain an effective region image; a fine segmentation module 300, configured to perform fine segmentation on the effective region image by using a traditional image algorithm to obtain a segmented image; and a measurement module 400, configured to measure the segmented image by using a distance algorithm to obtain an inner and outer diameter measurement value of the ppr pipe. The device uses artificial intelligence technology to automatically measure the inner and outer diameter of the ppr pipe, uses a deep learning method combined with traditional image processing, and improves the speed and accuracy of measurement. Moreover, starting from the acquisition of the end face image of the ppr pipe, no manual intervention is required, and the inner and outer diameter measurement value of the end face of the ppr pipe is automatically output, which greatly improves the work efficiency of the production line and saves manpower. Moreover, the end face is zoomed in, the coarse segmentation is performed by using an Encoder-decode framework, the image is zoomed in again, the effectiveness of image segmentation is ensured, the binarization processing is performed by using the Otsu algorithm, the hole filling is performed by using the flood fill method, the burrs on the edge of the end face are removed by using the open operation, the accuracy is improved, the inner and outer circular contour of the end face is extracted by using the canny algorithm, the accuracy of edge detection is improved, the distance between each point on the contour and other points is calculated, the maximum value of the distance of each point is sorted to obtain a sequence, the accuracy of the inner and outer diameter measurement value is improved, part of the values are removed according to the corresponding rules, the interference of outlying edge contour points is avoided, and the values after removing N maximum values and N minimum values in the corresponding value sequence are taken as an inner / outer circular contour value group, and the accuracy of the inner and outer diameter measurement value is improved.
[0119] The ppr pipe inner and outer diameter measuring device provided by the embodiment of the application will be described below. The ppr pipe inner and outer diameter measuring device described below can be correspondingly referred to the ppr pipe inner and outer diameter measuring method described above.
[0120] Please refer to Figure 3 , Figure 3 The structure diagram of the ppr pipe inner and outer diameter measuring device provided by the embodiment of the application can comprise:
[0121] The memory 10 is configured to store a computer program.
[0122] The processor 20 is configured to execute the computer program to implement the ppr pipe inner and outer diameter measuring method described above.
[0123] The memory 10, the processor 20, the communication interface 31 and the communication bus 32. The memory 10, the processor 20, the communication interface 31 all complete the communication between each other through the communication bus 32.
[0124] In the embodiment of the application, the memory 10 stores one or more programs, which can include program codes including computer operation instructions. In the embodiment of the application, the memory 10 can store programs for implementing the following functions:
[0125] Obtaining an end face image of the ppr pipeline;
[0126] Coarsely segmenting the end face image by using a deep learning algorithm to obtain an effective region image;
[0127] Finely segmenting the effective region image by using a traditional image algorithm to obtain a segmentation image;
[0128] Measuring the segmentation image by using a distance algorithm to obtain an inner and outer diameter measurement value of the ppr pipeline.
[0129] In a possible implementation manner, the memory 10 can include a program storage area and a data storage area. The program storage area can store an operating system and at least one application program required by a function and the like. The data storage area can store data created in a use process.
[0130] In addition, the memory 10 can include a read-only memory and a random access memory, and provide instructions and data for the processor. A part of the memory can also include an NVRAM. The memory stores an operating system and operation instructions, executable modules or data structures, or a subset of them, or an extended set of them, wherein the operation instructions can include various operation instructions for implementing various operations. The operating system can include various system programs for implementing various basic tasks and processing hardware-based tasks.
[0131] The processor 20 can be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device. The processor 20 can be a microprocessor or any conventional processor or the like. The processor 20 can call programs stored in the memory 10.
[0132] The communication interface 31 can be an interface of a communication module, used for connecting with other devices or systems.
[0133] Of course, it needs to be explained that, Figure 3 The structure shown does not constitute a limitation on the ppr pipeline inner and outer diameter measuring device in the embodiment of the application. In actual applications, the ppr pipeline inner and outer diameter measuring device can include more or fewer components than those shown in the figure.Figure 3 more or less components, or to combine certain components.
[0134] The storage medium provided by the embodiments of the present application is described below, and the storage medium described below can be referred to in combination with the ppr pipe inner and outer diameter measurement method described above.
[0135] The present application also provides a storage medium, and the storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the ppr pipe inner and outer diameter measurement method described above.
[0136] The storage medium can include a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0137] The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts of each embodiment can be referred to each other. For the device disclosed by the embodiments, since it corresponds to the method disclosed by the embodiments, the description is relatively simple, and the related parts can be referred to the method part.
[0138] The skilled person can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of both. In order to clearly show the interchangeability of hardware and software, the composition and steps of each example have been described in the above description. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0139] Finally, it should be noted that in this document, relationships such as first and second are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device.
[0140] The above describes in detail the ppr pipeline inner and outer diameter measuring method, device, equipment and storage medium provided by the present application, the principle and implementation mode of the present application are described by applying specific examples, and the above example description is only used to help understand the method of the present application and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as the limitation of the present application.
Claims
1. A method of measuring the internal and external diameters of a ppr pipe, characterized by, The method comprises the following steps: acquiring an end face image of a PPR pipe; coarsely segmenting the end face image by using a deep learning algorithm to obtain an effective area image; finely segmenting the effective area image by using a traditional image algorithm to obtain a segmented image; measuring the segmented image by using a distance algorithm to obtain an inner and outer diameter measurement value of the PPR pipe; wherein the measuring the segmented image by using the distance algorithm to obtain the inner and outer diameter measurement value of the PPR pipe comprises: finding an inner circle contour and an outer circle contour of the end face in the segmented image by using a Canny algorithm, and calculating the inner and outer diameter measurement value based on the inner circle contour and the outer circle contour; wherein the calculating the inner and outer diameter measurement value based on the inner circle contour and the outer circle contour comprises: calculating the maximum distance between each point on the inner circle contour and the remaining points on the inner circle contour as a first distance, and sorting the first distances of each point from large to small to obtain an inner diameter distance sequence; calculating the maximum distance between each point on the outer circle contour and the remaining points on the outer circle contour as a second distance, and sorting the second distances of each point from large to small to obtain an outer diameter distance sequence; obtaining the inner and outer diameter measurement value according to the inner diameter distance sequence and the outer diameter distance sequence; wherein the obtaining the inner and outer diameter measurement value according to the inner diameter distance sequence and the outer diameter distance sequence comprises: reserving part of the inner diameter distance sequence as an inner circle contour value group according to a first preset rule; reserving part of the outer diameter distance sequence as an outer circle contour value group according to a second preset rule; averaging the inner circle contour value group to obtain a first average value, and multiplying the first average value by a scaling factor to obtain an inner diameter measurement value of the inner and outer diameter measurement value; averaging the outer circle contour value group to obtain a second average value, and multiplying the second average value by the scaling factor to obtain an outer diameter measurement value of the inner and outer diameter measurement value.
2. The ppr pipe inside and outside diameter measuring method according to claim 1, characterized by, The finely segmenting the effective area image by using a traditional image algorithm to obtain a segmented image comprises: finding the best threshold value of the effective area image by using an Otsu algorithm; performing binaryzation processing on the effective area image based on the best threshold value to obtain a binaryzation image; performing hole filling on the binaryzation image by using a flood fill method to obtain a filled image; performing an opening operation on the filled image to obtain the segmented image.
3. The method of claim 1, wherein, The reserving part of the inner diameter distance sequence as an inner circle contour value group according to a first preset rule, and reserving part of the outer diameter distance sequence as an outer circle contour value group according to a second preset rule comprises: reserving the values after removing the first N values and the last N values of the inner diameter distance sequence as the inner circle contour value group; reserving the values after removing the first N values and the last N values of the outer diameter distance sequence as the outer circle contour value group.
4. The method of measuring the internal and external diameter of a ppr pipe according to any one of claims 1 to 3, characterized in that, The coarsely segmenting the end face image by using a deep learning algorithm to obtain an effective area image comprises: preprocessing the end face image by using an interpolation algorithm to obtain a scaled image; Coarse segmentation is performed on the scaled image by using an encoder-decoder framework to obtain a first image; The first image is enlarged to the size consistent with the end face image as the effective area image.
5. A ppr pipe inside and outside diameter measuring device characterized by, It comprises: An acquisition module is configured to acquire an end face image of a PPR pipe; A coarse segmentation module is configured to perform coarse segmentation on the end face image by using a deep learning algorithm to obtain an effective area image; A fine segmentation module is configured to perform fine segmentation on the effective area image by using a traditional image algorithm to obtain a segmented image; A measurement module is configured to measure the segmented image by using a distance algorithm to obtain an inner and outer diameter measurement value of the PPR pipe; The measurement module comprises: A calculation unit is configured to find an inner circle contour and an outer circle contour of the end face in the segmented image by using a Canny algorithm, and calculate the inner and outer diameter measurement value based on the inner circle contour and the outer circle contour; The calculation unit comprises: A first calculation subunit is configured to calculate a maximum distance between each point on the inner circle contour and other remaining points on the inner circle contour as a first distance, and sort the first distances of each point from large to small to obtain an inner diameter distance sequence; A second calculation subunit is configured to calculate a maximum distance between each point on the outer circle contour and other remaining points on the outer circle contour as a second distance, and sort the second distances of each point from large to small to obtain an outer diameter distance sequence; A third calculation subunit is configured to obtain the inner and outer diameter measurement value according to the inner diameter distance sequence and the outer diameter distance sequence; The third calculation subunit comprises: An inner circle contour numerical group subunit is configured to retain part of the values of the inner diameter distance sequence as an inner circle contour numerical group according to a first preset rule; An outer circle contour numerical group subunit is configured to retain part of the values of the outer diameter distance sequence as an outer circle contour numerical group according to a second preset rule; A fourth calculation subunit is configured to average the inner circle contour numerical group to obtain a first average value, and multiply the first average value by a scaling factor to obtain an inner diameter measurement value of the inner and outer diameter measurement value; A fifth calculation subunit is configured to average the outer circle contour numerical group to obtain a second average value, and multiply the second average value by the scaling factor to obtain an outer diameter measurement value of the inner and outer diameter measurement value.
6. A ppr pipe inside and outside diameter measuring apparatus characterized by, It comprises: A memory is configured to store a computer program; A processor is configured to execute the computer program to implement the steps of the PPR pipe inner and outer diameter measurement method according to any one of claims 1 to 4.
7. A storage medium, characterized by The storage medium has a computer program stored thereon, and the computer program is executed by the processor to implement the steps of the PPR pipe inner and outer diameter measurement method according to any one of claims 1 to 4.