Pipe diameter measurement method, device and system
Through the technology of binocular or monocular camera combined with depth cameras, the actual diameter of the circular tube is automatically calculated, which solves the problems of inaccurate manual measurement and low efficiency, and achieves efficient and accurate pipe diameter measurement.
Patent Information
- Application Number
- CN202411266847.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-10
AI Technical Summary
In the prior art, the measurement of circular pipe diameters depends on manual labor, and there are limitations on skill level and tool accuracy, resulting in inaccurate measurement results and low efficiency. Especially in large-scale production environments, it is prone to large errors, affecting production efficiency and product quality.
Using a binocular or monocular camera with a depth camera, by obtaining visible light images and depth images on the side of the circular tube, using edge detection and stereo vision algorithms to determine the side edge lines and center lines of the circular tube, and calculate the image tube in the image and automatically calculate the actual tube diameter based on the camera focal length and image data.
It realizes efficient and accurate measurement of the diameter of the circular tube, avoids the influence of human factors, greatly improves the measurement accuracy and efficiency, and reduces measurement errors.
Smart Images

Figure CN118794361B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of visual measurement technology, and in particular to a pipe diameter measurement method, device and system. Background Art
[0002] The diameter measurement of round tubes is a key task in industrial production and quality control, which is directly related to the dimensional accuracy and performance stability of round tube products.
[0003] At present, the diameter measurement of round tubes mostly relies on manual measurement. This measurement method is limited by the skill level of the operator, the limitations of visual perception and the accuracy of the measuring tools, and cannot guarantee the accuracy of the measurement results. In addition, in a large-scale production environment, manual measurement is not only inefficient, but also may cause large errors in the diameter measurement results due to human factors, thus affecting the overall production efficiency and product quality. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a pipe diameter measurement method, device and system to measure the pipe diameter efficiently and accurately. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a pipe diameter measurement method, the method comprising:
[0006] Obtain a visible light image of the side of the circular tube to be measured collected by a binocular camera, wherein the visible light image is a left-eye visible light image or a right-eye visible light image collected by the binocular camera, a backlight plate for fill light is provided in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate;
[0007] Performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result;
[0008] Determine the depth of each pixel in the visible light image according to the stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line;
[0009] Determine the center line of the circular tube to be measured based on the side edge line, and determine the depth of the center line based on the depth of the side edge line;
[0010] Determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured;
[0011] The actual diameter of the circular tube to be measured is determined according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the binocular camera.
[0012] Optionally, determining the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured includes:
[0013] Segmenting the circular tube to be measured along the center line in the visible light image;
[0014] For each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment;
[0015] Determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes:
[0016] For each segment, the actual diameter of the circular tube to be measured in the segment is determined according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0017] Optionally, determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes:
[0018] Calculating a target ratio between the depth of the center point on the center line and the target focal length;
[0019] The product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured.
[0020] Optionally, calculating a target ratio between the depth of the center point on the center line and the target focal length; and multiplying the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured comprises:
[0021] According to the following formula, the target ratio between the depth of the center point on the center line and the target focal length is calculated; the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured:
[0022] ;
[0023] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0024] Optionally, there are multiple binocular cameras, and obtaining a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured collected by the binocular cameras includes:
[0025] Respectively obtain a left-eye visible light image and a right-eye visible light image collected by multiple binocular cameras from the side of the circular tube to be measured, wherein the multiple binocular cameras are installed at the same height and have different collection angles;
[0026] Determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes:
[0027] For each binocular camera, the tube diameter corresponding to the binocular camera is determined according to a first focal length, a depth of a first center point, and a first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera;
[0028] The maximum value among the tube diameters corresponding to the binocular cameras is determined as the actual tube diameter of the circular tube to be measured.
[0029] Optionally, determining the depth of the center line based on the depth of the side edge line includes:
[0030] For each center point on the center line, an average value of the depths of the target edge points is determined as the depth of the center point, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
[0031] In a second aspect, an embodiment of the present application provides a pipe diameter measurement method, the method comprising:
[0032] Acquire a visible light image of the side of the circular tube to be measured acquired by a monocular camera, and acquire a depth image of the side of the circular tube to be measured acquired by a depth camera, wherein a backlight plate for fill light is provided in the optical axis direction of the monocular camera, the circular tube to be measured is located between the monocular camera and the backlight plate, and the depth camera and the monocular camera are used to acquire an image of the same area of the circular tube to be measured;
[0033] Performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result;
[0034] Determine the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image;
[0035] Determine the center line of the circular tube to be measured based on the side edge line, and determine the depth of the center line based on the depth of the side edge line;
[0036] Determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured;
[0037] The actual diameter of the circular tube to be measured is determined according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the monocular camera.
[0038] Optionally, determining the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured includes: segmenting the circular tube to be measured along the center line in the visible light image; for each segment, determining the minimum circumscribed rectangle of the segment, and determining the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line, and the image diameter includes: for each segment, determining the actual diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment, and the image diameter of the circular tube to be measured in the segment.
[0039] Optionally, determining the actual diameter of the circular tube to be measured based on the target focal length, the depth of the center point on the center line and the image diameter includes: calculating a target ratio between the depth of the center point on the center line and the target focal length; and determining the product of the target ratio and the image diameter as the actual diameter of the circular tube to be measured.
[0040] Optionally, calculating a target ratio between the depth of the center point on the center line and the target focal length; and multiplying the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured comprises:
[0041] According to the following formula, the target ratio between the depth of the center point on the center line and the target focal length is calculated; the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured:
[0042] ;
[0043] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0044] Optionally, there are multiple monocular cameras and multiple depth cameras, and obtaining the visible light image of the side of the circular tube to be measured acquired by the monocular camera, and obtaining the depth image of the side of the circular tube to be measured acquired by the depth camera, comprises: respectively acquiring the visible light image and the depth image acquired by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras comprises a monocular camera and a depth camera for acquiring images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the acquisition angles are different; determining the depth of the circular tube according to the target focal length, the depth of the center point on the center line and the image tube diameter Determining the actual diameter of the circular tube to be measured includes: for each monocular camera, determining the diameter corresponding to the monocular camera according to a first focal length, a depth of a first center point, and a first image diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image diameter is the image diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; and determining the maximum value of the diameters corresponding to the monocular cameras as the actual diameter of the circular tube to be measured.
[0045] Optionally, determining the depth of the center line based on the depth of the side edge line includes: for each center point on the center line, determining the depth of the center point as the average value of the depth of the target edge point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0046] In a third aspect, an embodiment of the present application provides a pipe diameter measuring device, the device comprising:
[0047] An image acquisition module, used for acquiring a visible light image of the side of the circular tube to be measured acquired by a binocular camera, wherein the visible light image is a left-eye visible light image or a right-eye visible light image acquired by the binocular camera, a backlight plate for fill light is provided in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate;
[0048] An edge line determination module, used to perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result;
[0049] an edge line depth determination module, configured to determine the depth of each pixel in the visible light image according to a stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line;
[0050] A centerline determination module, used to determine the centerline of the circular tube to be measured according to the side edge line, and determine the depth of the centerline based on the depth of the side edge line;
[0051] An image tube diameter determination module, used to determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured;
[0052] The actual diameter determination module is used to determine the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the binocular camera.
[0053] Optionally, the image tube diameter determination module includes: a segmentation unit, used to segment the circular tube to be measured along the center line in the visible light image; an image tube diameter determination unit, used to determine, for each segment, the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment; the actual tube diameter determination module is specifically used to determine, for each segment, the actual tube diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment, and the image tube diameter of the circular tube to be measured in the segment.
[0054] Optionally, the actual tube diameter determination module includes: a target ratio calculation unit, used to calculate the target ratio between the depth of the center point on the center line and the target focal length; an actual tube diameter determination unit, used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
[0055] Optionally, the actual tube diameter determination module is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured:
[0056] ;
[0057] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0058] Optionally, there are multiple binocular cameras, and the image acquisition module is specifically used to respectively acquire left-eye visible light images and right-eye visible light images collected by multiple binocular cameras from the side of the circular tube to be measured, wherein the multiple binocular cameras are installed at the same height and have different collection angles; the actual tube diameter determination module is specifically used to determine, for each binocular camera, the tube diameter corresponding to the binocular camera according to a first focal length, a depth of a first center point and a first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to each binocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0059] Optionally, the center line determination module is specifically used to determine, for each center point on the center line, an average value of the depths of the target edge points as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0060] In a fourth aspect, an embodiment of the present application provides a pipe diameter measuring device, the device comprising:
[0061] An image acquisition module, which acquires a visible light image of the side of the circular tube to be measured acquired by a monocular camera, and acquires a depth image of the side of the circular tube to be measured acquired by a depth camera, wherein a backlight plate for fill light is provided in the optical axis direction of the monocular camera, the circular tube to be measured is located between the monocular camera and the backlight plate, and the depth camera and the monocular camera are used to acquire an image of the same area of the circular tube to be measured;
[0062] An edge line determination module performs edge detection on the visible light image and determines the side edge line of the circular tube to be measured based on the edge detection result;
[0063] An edge line depth determination module, which determines the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image;
[0064] A centerline determination module, which determines the centerline of the circular tube to be measured according to the side edge line, and determines the depth of the centerline based on the depth of the side edge line;
[0065] An image tube diameter determination module, which determines the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured;
[0066] The actual diameter determination module determines the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the monocular camera.
[0067] Optionally, the image tube diameter determination module includes: a segmentation unit, used to segment the circular tube to be measured along the center line in the visible light image; an image tube diameter determination unit, used to determine, for each segment, the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment; the actual tube diameter determination module is specifically used to determine, for each segment, the actual tube diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment, and the image tube diameter of the circular tube to be measured in the segment.
[0068] Optionally, the actual tube diameter determination module includes: a target ratio calculation unit, used to calculate the target ratio between the depth of the center point on the center line and the target focal length; an actual tube diameter determination unit, used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
[0069] Optionally, the actual tube diameter determination module is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured:
[0070] ;
[0071] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0072] Optionally, there are multiple monocular cameras and multiple depth cameras, and the image acquisition module is specifically used to respectively acquire visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera and a depth camera for collecting images of the same area of the circular tube to be measured, and the multiple groups of cameras are installed at the same height and have different collection angles; the actual tube diameter determination module is specifically used to determine, for each monocular camera, the tube diameter corresponding to the monocular camera according to a first focal length, a depth of a first center point and a first image tube diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; the maximum value of the tube diameters corresponding to each monocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0073] Optionally, the center line determination module is specifically used to determine, for each center point on the center line, an average value of the depths of the target edge points as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0074] In a fifth aspect, an embodiment of the present application provides a pipe diameter measurement system, the system comprising a backlight plate, a fixing device, a binocular camera and an electronic device, the backlight plate and the fixing device are arranged in the optical axis direction of the binocular camera, and the fixing device is located between the binocular camera and the backlight plate;
[0075] The fixing device is used to fix the round tube to be measured;
[0076] The backlight panel is used to provide supplementary light to the round tube to be measured fixed on the fixing device;
[0077] The binocular camera is used to collect a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured, and send the left-eye visible light image and the right-eye visible light image to the electronic device;
[0078] The electronic device is used to obtain the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured sent by the binocular camera; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is the left-eye visible light image or the right-eye visible light image; determine the depth of each pixel in the visible light image according to the stereo vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the binocular camera.
[0079] Optionally, the electronic device is specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment based on the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0080] Optionally, the electronic device is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length; and multiply the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured.
[0081] Optionally, the electronic device is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured:
[0082] ;
[0083] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0084] Optionally, there are multiple binocular cameras, wherein the installation heights of the multiple binocular cameras are the same and the collection angles are different; the electronic device is specifically used to respectively obtain the left-eye visible light images and the right-eye visible light images collected from the side of the circular tube to be measured and sent by the multiple binocular cameras, and for each binocular camera, determine the tube diameter corresponding to the binocular camera according to a first focal length, a depth of a first center point and a first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to each binocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0085] Optionally, the electronic device is specifically used to determine, for each center point on the center line, an average value of the depth of the target edge point as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0086] In a sixth aspect, an embodiment of the present application provides a pipe diameter measurement system, the system comprising a backlight panel, a fixing device, a monocular camera, a depth camera and an electronic device, the backlight panel and the fixing device are arranged in the optical axis direction of the monocular camera, and the fixing device is located between the monocular camera and the backlight panel;
[0087] The fixing device is used to fix the round tube to be measured;
[0088] The backlight panel is used to provide supplementary light to the round tube to be measured fixed on the fixing device;
[0089] The monocular camera is used to collect a visible light image of the side surface of the circular tube to be measured and send the visible light image to the electronic device;
[0090] The depth camera is used to collect a depth image of the side of the circular tube to be measured and send the depth image to the electronic device, wherein the depth camera and the monocular camera are used to collect images of the same area of the circular tube to be measured;
[0091] The electronic device is used to obtain the visible light image sent by the monocular camera and the depth image sent by the depth camera; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result; determine the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the monocular camera.
[0092] Optionally, the electronic device is specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment based on the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0093] Optionally, the electronic device is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length; and multiply the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured.
[0094] Optionally, the electronic device is specifically used to calculate a target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured:
[0095] ;
[0096] in, Indicates the actual diameter of the circular tube to be measured, represents the depth of the center point on the center line, represents the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0097] Optionally, there are multiple monocular cameras and depth cameras; the electronic device is specifically used to respectively obtain visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera and a depth camera for collecting images of the same area of the circular tube to be measured, and the multiple groups of cameras are installed at the same height and have different collection angles; for each monocular camera, the tube diameter corresponding to the monocular camera is determined according to a first focal length, a depth of a first center point and a first image tube diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; the maximum value of the tube diameters corresponding to each monocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0098] Optionally, the electronic device is specifically used to determine, for each center point on the center line, an average value of the depth of the target edge point as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0099] Beneficial effects of the embodiments of the present application:
[0100] In the solution provided by the embodiment of the present application, the electronic device can obtain a left-eye visible light image and a right-eye visible light image of the side of the circular tube to be measured collected by a binocular camera, wherein a backlight plate for fill light is arranged in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate; edge detection is performed on the visible light image, and the side edge line of the circular tube to be measured is determined based on the edge detection result, wherein the visible light image is a left-eye visible light image or a right-eye visible light image; according to the stereo vision algorithm, the left-eye visible light image and the right-eye visible light image, the depth of each pixel point in the visible light image is determined, and the depth of the side edge line is determined based on each pixel point included in the side edge line; according to the side edge line, the center line of the circular tube to be measured is determined, and based on the depth of the side edge line, the depth of the center line is determined; according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured, the image tube diameter of the circular tube to be measured in the visible light image is determined; according to the target focal length, the depth of the center point on the center line and the image tube diameter, the actual tube diameter of the circular tube to be measured is determined, wherein the target focal length is the focal length of the binocular camera. Since the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, the actual diameter of the circular tube can be automatically calculated based on the correspondence between the focal length of the binocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to manual measurement.
[0101] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0103] Figure 1 A schematic diagram of a flow chart of a pipe diameter measurement method provided in an embodiment of the present application;
[0104] Figure 2 Based on Figure 1 A schematic diagram of a method for determining edge line depth in the illustrated embodiment;
[0105] Figure 3 Based on Figure 1 A schematic diagram of a flow chart of a method for determining an image tube diameter in the illustrated embodiment;
[0106] Figure 4 Based on Figure 3 A schematic diagram of a segmented approach to the illustrated embodiment;
[0107] Figure 5 Based on Figure 4 A schematic diagram of a segmented circumscribed rectangular frame of the illustrated embodiment;
[0108] Figure 6 Based on Figure 4 A schematic diagram of a pipe diameter marking method in the illustrated embodiment;
[0109] Figure 7 Based on Figure 1 A schematic flow chart of another method for determining the image tube diameter in the illustrated embodiment;
[0110] Figure 8 Based on Figure 1 A schematic diagram of a binocular camera arrangement of the illustrated embodiment;
[0111] Fig. 9 Based on Figure 1 A schematic diagram of a flow chart of a method for determining an actual pipe diameter in the illustrated embodiment;
[0112] Fig.10 A schematic flow chart of another pipe diameter measurement method provided in an embodiment of the present application;
[0113] Fig.11 Based on Fig.10 A schematic diagram of a flow chart of a method for determining an actual pipe diameter in the illustrated embodiment;
[0114] Fig.12 A schematic diagram of the structure of a pipe diameter measuring device provided in an embodiment of the present application;
[0115] Fig.13 A schematic diagram of the structure of another pipe diameter measuring device provided in an embodiment of the present application;
[0116] Fig.14 A schematic diagram of the structure of a pipe diameter measurement system provided in an embodiment of the present application;
[0117] Fig.15 A schematic diagram of the structure of another pipe diameter measurement system provided in an embodiment of the present application;
[0118] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0119] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0120] In order to measure the pipe diameter efficiently and accurately, the embodiments of the present application provide a pipe diameter measurement method, device, system, electronic device, computer readable storage medium and computer program product. First, a pipe diameter measurement method provided by the embodiments of the present application is introduced.
[0121] The pipe diameter measurement method provided in the embodiment of the present application can be applied to any electronic device that needs to perform pipe diameter measurement, for example, it can be a terminal device such as a computer, a mobile phone, or a server. No specific limitation is made here. For the sake of clear description, it is referred to as an electronic device below.
[0122] like Figure 1 As shown, a pipe diameter measurement method includes:
[0123] S101, obtaining a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured collected by a binocular camera.
[0124] A backlight plate for fill light is arranged in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate.
[0125] S102, performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result.
[0126] The visible light image is a left-eye visible light image or a right-eye visible light image.
[0127] S103, determining the depth of each pixel in the visible light image according to the stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and determining the depth of the side edge line based on each pixel included in the side edge line.
[0128] S104, determining the center line of the circular tube to be measured based on the side edge line, and determining the depth of the center line based on the depth of the side edge line.
[0129] S105, determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured.
[0130] S106, determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter.
[0131] Among them, the target focal length is the focal length of the binocular camera.
[0132] In the solution provided by the embodiment of the present application, the electronic device can obtain a left-eye visible light image and a right-eye visible light image of the side of the circular tube to be measured collected by a binocular camera, wherein a backlight plate for fill light is arranged in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate; edge detection is performed on the visible light image, and the side edge line of the circular tube to be measured is determined based on the edge detection result, wherein the visible light image is a left-eye visible light image or a right-eye visible light image; according to the stereo vision algorithm, the left-eye visible light image and the right-eye visible light image, the depth of each pixel point in the visible light image is determined, and the depth of the side edge line is determined based on each pixel point included in the side edge line; according to the side edge line, the center line of the circular tube to be measured is determined, and based on the depth of the side edge line, the depth of the center line is determined; according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured, the image tube diameter of the circular tube to be measured in the visible light image is determined; according to the target focal length, the depth of the center point on the center line and the image tube diameter, the actual tube diameter of the circular tube to be measured is determined, wherein the target focal length is the focal length of the binocular camera. Since the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, the actual diameter of the circular tube can be automatically calculated based on the correspondence between the focal length of the binocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to manual measurement.
[0133] For the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured, the electronic device can obtain them by, but not limited to, the following two implementations:
[0134] In the first embodiment, a preset position for fixing the round tube can be pre-set, and then the installation position of the binocular camera can be adjusted so that the image acquisition direction of the binocular camera is aligned with the preset position. Then, the focal length of the binocular camera can be adjusted so that the binocular camera can clearly image the preset position. After completing the above-mentioned adjustment of the installation position and focal length, the adjusted focal length of the binocular camera can be sent to the electronic device so that the electronic device can pre-record the focal length of the binocular camera.
[0135] When it is necessary to measure the diameter of the circular tube to be measured, the circular tube to be measured can be fixed at the above-mentioned preset position, and then the electronic device can send an image acquisition instruction to the binocular camera through the communication connection between it and the binocular camera, thereby controlling the binocular camera to acquire the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured, and return the image acquisition result to the electronic device. In this way, the electronic device can obtain the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured.
[0136] In the second embodiment, when it is necessary to measure the diameter of the circular tube to be measured, the user can manually input the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured into the electronic device, and input the focal length of the binocular camera that collects the left-eye visible light image and the right-eye visible light image. Thus, the electronic device can also obtain the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured.
[0137] Furthermore, when a binocular camera is arranged to collect a visible light image of the side of the circular tube to be detected, a backlight plate for fill light can be arranged in the optical axis direction of the binocular camera, and then the circular tube to be measured is fixed between the binocular camera and the backlight plate.
[0138] Compared with the use of laser dots, laser lines, speckles and other methods for fill-in lighting, on the one hand, when the circular tube to be measured is relatively small, the laser dots, laser lines, speckles and the like themselves have a certain size, and cannot cover enough points on the surface of the circular tube to be measured for fill-in lighting, while the backlight can achieve uniform fill-in lighting. On the other hand, when the surface of the circular tube to be measured is relatively smooth, mirror reflection is prone to occur when active fill-in lighting methods such as laser dots, laser lines, and speckles are used, resulting in a large difference in the brightness of the surface of the circular tube to be measured in the left and right eye images when the image of the circular tube to be measured is collected by the binocular camera, which easily causes the binocular matching algorithm to fail. When the backlight is used for fill-in lighting, the problem of mirror reflection will not occur.
[0139] After acquiring the left-eye visible light image and the right-eye visible light image, the electronic device can perform edge detection on any of the left-eye visible light image and the right-eye visible light image through traditional edge detection algorithms such as Canny, or through an edge detection algorithm based on deep learning, to obtain an edge detection result. Then, the electronic device can determine the side edge line of the circular tube to be measured based on the edge detection result.
[0140] After determining the side edge line of the circular tube to be measured in the visible light image, on the one hand, the electronic device can determine the depth of each pixel in the visible light image based on the stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and then determine the depth of the side edge line based on each pixel included in the side edge line and the determined depth of each pixel in the visible light image. On the other hand, the electronic device can also determine the line located between the two side edge lines by least squares fitting, curve interpolation, etc., and use it as the center line of the circular tube to be measured.
[0141] After determining the depths of the center line and the side edge line, the electronic device may determine the depth of the center line based on the depth of the side edge line. Specifically, the electronic device may determine the depth of the center line in the following manner:
[0142] For each center point on the center line, the electronic device can determine the normal of the center line at the center point, and then determine the two intersection points of the normal and the two side edge lines as the target edge points corresponding to the center point. Then the electronic device can determine the depths of the two target edge points based on the depths of the side edge lines, and determine the average of the depths of the two target edge points as the depth of the center point.
[0143] like Figure 2 As shown, the electronic device can determine the normal line 204 of the center line at the center point A for the center point A on the center line 203 of the circular tube to be measured, and then determine the intersection point B of the normal line 204 and the side edge line 201, and the intersection point C of the normal line 204 and the side edge line 202 as the target edge point corresponding to the center point A. Then the electronic device can determine the depth of the target edge point B according to the depth of the side edge line 201, and determine the depth of the target edge point C according to the depth of the side edge line 202. Then the electronic device can determine the average value of the depths of the target edge point B and the target edge point C as the depth of the center point A. That is, ,in, represents the depth of the center point A, Indicates the depth of the target edge point B, Indicates the depth of the target edge point C.
[0144] Of course, the electronic device may also determine the depth of the center line in other ways according to the depths of the two side edge lines, which is not specifically limited here. For example, when each depth in the depth map corresponds to a confidence level, the electronic device may also perform a weighted summation of the depths of the two side edge lines according to the confidence levels corresponding to the depths of the two side edge lines, thereby determining the depth of the center line.
[0145] The electronic device can also determine the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured, that is, determine the pixel size of the diameter of the circular tube to be measured in the visible light image. In this process, the electronic device can determine only one image diameter of the circular tube to be measured in the visible light image, or can determine multiple image diameters of the circular tube to be measured in the visible light image. For example, after the electronic device segments the circular tube to be measured, it can determine the width of the minimum circumscribed rectangle of any segment as the image diameter of the circular tube to be measured, or it can determine the width of the minimum circumscribed rectangle of each segment as the image diameter of the circular tube to be measured in the segment.
[0146] The following will use two scenarios as examples to introduce how an electronic device chooses whether to determine one image tube diameter or multiple image tube diameters.
[0147] In the first scenario, the user can send the type of circular tube to be measured to the electronic device, and then the electronic device can choose whether to determine one image tube diameter or multiple image tube diameters based on the type of circular tube to be measured and the correspondence between the preset type and the number of image tube diameters.
[0148] For example, when the type of the circular tube to be measured sent by the user to the electronic device is a standard circular tube with a consistent tube diameter, the electronic device can determine that only one image tube diameter of the circular tube to be measured in the visible light image needs to be determined based on the correspondence between the preset type and the number of image tube diameters; when the type of the circular tube to be measured sent by the user to the electronic device is a non-standard circular tube with inconsistent tube diameters, the electronic device can determine that multiple image tube diameters of the circular tube to be measured in the visible light image need to be determined based on the correspondence between the preset type and the number of image tube diameters.
[0149] In the second scenario, the user can choose whether to determine one image diameter or multiple image diameters according to actual needs, and then send a selection instruction to the electronic device, so that the electronic device determines whether to determine only one image diameter or multiple image diameters according to the selection instruction.
[0150] For example, when the user does not know the type of the circular tube to be measured, or wants to check the consistency of the diameter of a standard circular tube, a selection instruction for determining the diameters of multiple images can be sent to the electronic device, so that the electronic device can determine whether it is necessary to determine the diameters of multiple images of the circular tube to be measured in the visible light image.
[0151] The specific method of determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured will be described in detail in the subsequent embodiments and will not be elaborated here.
[0152] After obtaining the depth of the center line and the image diameter of the circular tube to be measured in the visible light image, the electronic device can further determine the center point corresponding to the obtained image diameter, and then the electronic device can determine the actual diameter of the circular tube to be measured based on the depth of the center point, the image diameter and the pre-recorded focal length of the binocular camera (i.e., the target focal length).
[0153] Among them, because the number of image tube diameters determined in the above steps is different, when the electronic device executes this step, it can be divided into two ways: determining multiple actual tube diameters of the tube to be measured and determining one actual tube diameter of the tube to be measured. Figure 3-Figure 6 and Figure 7 These two methods will be described in detail in the illustrated embodiment and will not be elaborated here.
[0154] In one embodiment, after obtaining the image diameter of the circular tube to be measured in the visible light image and the center point corresponding to the image diameter, the electronic device can first calculate the target ratio between the depth of the center point and the target focal length, and then multiply the target ratio by the image diameter of the circular tube to be measured in the visible light image to determine the actual diameter of the circular tube to be measured. That is, the electronic device can determine the actual diameter of the circular tube to be measured by the following formula.
[0155] ;
[0156] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter of the circular tube to be measured in the visible light image, The unit is pixel, represents the target focal length, The unit is pixel.
[0157] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the binocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to the manual measurement method.
[0158] The following will be combined Figure 3-Figure 6 and Figure 7 The specific implementation methods of determining multiple actual diameters of a circular tube to be measured and determining one actual diameter of a circular tube to be measured in the embodiments of the present application are respectively introduced.
[0159] For the implementation method of "determining multiple actual diameters of a circular tube to be measured":
[0160] When the electronic device determines the image diameter of the circular tube to be measured in the visible light image, it can use Figure 3 The method shown is used to determine Figure 3 As shown, the above step S105 may include:
[0161] S301, segmenting the circular tube to be measured along the center line in the visible light image.
[0162] like Figure 4 As shown, the electronic device can determine the center points of each segment used to segment the circular tube to be measured on the center line of the circular tube to be detected in the visible light image according to the preset distance, that is, Figure 4 Point A, point B, point C and point D in the figure. Then, the electronic device can determine the normal of the center line at the center of each segment for each segment center point, and then segment the circular tube to be measured according to the normal at the center of each segment to obtain segment 401, segment 402 and segment 403.
[0163] S302: for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment.
[0164] After the circular tube to be measured is segmented to obtain various segments, the electronic device can respectively determine the minimum circumscribed rectangle of each segment.
[0165] like Figure 5 As shown, the electronic device determines that the minimum bounding rectangle corresponding to segment 401 is 501 , that the minimum bounding rectangle corresponding to segment 402 is 502 , and that the minimum bounding rectangle corresponding to segment 403 is 503 .
[0166] After determining the minimum bounding rectangle of each segment, the electronic device can determine the width of the minimum bounding rectangle as the image diameter of the circular tube to be measured in the segment. Figure 5 The pixel size in the direction indicated by the arrow in the minimum circumscribed rectangle 501.
[0167] Electronic devices are passing Figure 3 After the image diameter of the circular tube to be measured in each segment is determined in the manner shown, the actual diameter of the circular tube to be measured in each segment can be determined according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment. Thus, the actual diameter of the circular tube to be measured in each segment is obtained, and the actual diameter of each segment of the circular tube to be measured is measured.
[0168] For the center point in the segment, in one embodiment, the center point in the segment can be the center point of the segment determined when the round tube to be measured is segmented. Figure 4 For the segment 401 shown, the center point in the segment may be point A. Figure 4 For the segment 402 shown, the center point in the segment may be point B. Figure 4 For the segment 403 shown, the center point in the segment may be point C.
[0169] In another embodiment, the center point in a segment may also be the midpoint of the center line of the portion included in the segment. Figure 4 For the segment 401 shown, the center point in the segment can be the midpoint of the center line of the portion included in the segment, that is, the center point on the center line that is at the same distance as point A and point B. Figure 4 For the segment 402 shown, the center point in the segment can be the midpoint of the center line of the portion included in the segment, that is, the center point on the center line that is at the same distance as point B and point C. Figure 4 For the segment 403 shown, the center point in the segment may be the midpoint of the center line of the portion included in the segment, that is, the center point on the center line that is at the same distance as point C and point D.
[0170] In yet another embodiment, the center point in a segment may also be any center point on the center line of the portion included in the segment.
[0171] In order to more intuitively display the diameter measurement result of the round tube to be measured, after obtaining the actual diameter of the round tube to be measured in each segment, the electronic device can display the actual diameter of each segment on the segmented result of the round tube to be measured. Figure 6 As shown, electronic devices can be Figure 4 In the segmented results shown, the actual tube diameter corresponding to each segment is displayed at the position of each segment, that is, from top to bottom, the actual tube diameters corresponding to each segment are 3.0289 mm, 3.0269 mm and 3.0354 mm respectively.
[0172] In the solution provided by the embodiment of the present application, the electronic device can segment the round tube to be measured and determine the actual diameter of each segment respectively. In this way, for non-standard round tubes, the diameter changes of the round tube at different positions can be accurately captured, which helps to fully understand the geometric characteristics of the round tube. For standard round tubes, it can detect whether the diameter of the round tube is consistent, thereby ensuring the quality of the round tube product.
[0173] For the implementation method of "determining an actual diameter of a circular tube to be measured":
[0174] When the electronic device determines the image diameter of the circular tube to be measured in the visible light image, it can use Figure 7 The method shown is used to determine Figure 7 As shown, the above step S105 may include:
[0175] S701, segmenting the circular tube to be measured along the center line in the visible light image.
[0176] The specific implementation of step S701 is the same as that of the above step S301, which will not be repeated here.
[0177] S702, determining the minimum circumscribed rectangle of the target segment, and determining the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment.
[0178] After the electronic device segments the circular tube to be measured, it can determine a target segment from each segment of the circular tube to be measured, and then determine the width of the minimum circumscribed rectangle of the target segment as the image diameter of the circular tube to be measured in the segment.
[0179] As for the method of determining the target segment, in one implementation, the electronic device can select any segment from the segments of the circular tube to be measured as the target segment.
[0180] In another embodiment, after the electronic device determines the various segments of the circular tube to be measured in the visible light image, it can select the segment located in the middle part of the image as the target segment. This is because compared with the edge part of the image, the middle part of the image is less affected by factors such as distortion, illumination, focus and background, so when determining the image diameter of the circular tube to be measured in the visible light image, it is more accurate to determine the image diameter of the circular tube to be measured in the middle part of the visible light image. Therefore, when determining the target segment, the electronic device can determine the segment including the intersection between the horizontal middle line and the center line of the visible light image as the target segment.
[0181] Electronic devices are passing Figure 7 After the image diameter of the circular tube to be measured in the visible light image is determined in the manner shown, the actual diameter of the circular tube to be measured can be determined according to the target focal length, the depth of the target center point and the determined image diameter of the circular tube to be measured in the visible light image.
[0182] In the solution provided by the embodiment of the present application, the electronic device can determine the image diameter of only one place of the circular tube to be measured, and then determine the actual diameter of the circular tube to be measured according to the depth of the center point of the place and the image diameter of the place. In this way, when the circular tube to be measured is a standard circular tube, the diameter of the circular tube to be measured can be quickly measured, which greatly improves the efficiency of the diameter measurement.
[0183] As an implementation of an embodiment of the present application, the number of binocular cameras used to obtain the left-eye visible light image and the right-eye visible light image of the side of the circular tube to be measured can be one or more. Accordingly, when the electronic device measures the tube diameter, it can measure the tube diameter based on the left-eye visible light image and the right-eye visible light image collected from one angle, or it can measure the tube diameter based on multiple left-eye visible light images and right-eye visible light images collected from different angles.
[0184] by Figure 8 For example, a binocular camera, such as binocular camera 802, can be arranged on the side of the circular tube 801 to be measured. At this time, when the electronic device measures the tube diameter, it can measure the tube diameter according to the left-eye visible light image and the right-eye visible light image collected by the binocular camera 802.
[0185] Of course, multiple binocular cameras, such as binocular camera 802, binocular camera 803 and binocular camera 804, can also be arranged on the side of the circular tube 801 to be measured. At this time, when the electronic device is measuring the tube diameter, it can measure the tube diameter based on the left-eye visible light image and the right-eye visible light image collected by the binocular camera 802, binocular camera 803 and binocular camera 804.
[0186] In one embodiment, for a circular tube with a standard circular cross-section, when the electronic device measures the tube diameter based on multiple left-eye visible light images and right-eye visible light images collected from different angles, the tube diameter measurement results can be determined separately based on the multiple left-eye visible light images and right-eye visible light images collected from different angles, and then the tube diameter measurement results corresponding to different angles are averaged to determine the final tube diameter measurement result, thereby reducing the error caused by a single measurement.
[0187] In another embodiment, for a circular tube with a non-standard circular cross-section, for example, a circular tube with an elliptical cross-section, when the electronic device measures the tube diameter based on multiple left-eye visible light images and right-eye visible light images collected from different angles, it can respectively determine the tube diameter measurement results based on the multiple left-eye visible light images and right-eye visible light images collected from different angles, and then determine the maximum value of the tube diameter measurement results as the final tube diameter measurement result, thereby determining the maximum tube diameter of the circular tube.
[0188] Here is an introduction to the specific way in which electronic equipment measures pipe diameter when there are multiple binocular cameras:
[0189] A plurality of binocular cameras may be arranged in advance at the same height of the side surface of the circular tube to be measured, and the plurality of binocular cameras may respectively collect the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured from different angles. In this way, when the electronic device obtains the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured, it may obtain the left-eye visible light image and the right-eye visible light image collected by the plurality of binocular cameras from the side surface of the circular tube to be measured.
[0190] For example, Figure 8 For example, binocular camera 802, binocular camera 803 and binocular camera 804 can respectively collect the left eye visible light image and the right eye visible light image of the side surface of the circular tube to be measured from 0°, 120° and 240°. When the electronic device obtains the left eye visible light image and the right eye visible light image of the side surface of the circular tube to be measured, the left eye visible light image and the right eye visible light image collected from 0°, 120° and 240° of the side surface of the circular tube to be measured can be obtained.
[0191] Accordingly, the electronic device can use the following method to determine the actual diameter of the round tube to be measured: Fig. 9 The method shown is used to determine Fig. 9 As shown, the above step S106 may include:
[0192] S901, for each binocular camera, determine a tube diameter corresponding to the binocular camera according to a first focal length, a depth of a first center point, and a first image tube diameter.
[0193] After obtaining the left-eye visible light image and the right-eye visible light image collected by each binocular camera, the electronic device can process the left-eye visible light image or the right-eye visible light image collected by each binocular camera one by one. Specifically:
[0194] After obtaining a visible light image (i.e., the first visible light image) collected by a binocular camera, the electronic device can perform the above steps S102-S105 based on the first visible light image to determine the depth of the center point on the center line of the circular tube to be measured in the first visible light image (i.e., the depth of the first center point), and determine the image tube diameter of the circular tube to be measured in the first visible light image (i.e., the first image tube diameter). Then, according to the focal length (i.e., the first focal length) of the binocular camera, the depth of the first center point, and the first image tube diameter, the tube diameter corresponding to the binocular camera is determined.
[0195] S902, determining the maximum value of the tube diameters corresponding to the binocular cameras as the actual tube diameter of the circular tube to be measured.
[0196] After obtaining the tube diameters corresponding to the binocular cameras, the electronic device can determine the maximum value of the tube diameters corresponding to the binocular cameras as the actual tube diameter of the circular tube to be measured, thereby determining the maximum tube diameter of the circular tube with a non-standard circular cross section.
[0197] In one embodiment, in order to make the actual diameter of the round tube to be measured closer to the actual maximum diameter of the round tube to be detected, a larger number of binocular cameras may be arranged on the side of the round tube to be measured. For example, 6 binocular cameras may be arranged on the side of the round tube to be measured at intervals of 60°.
[0198] In the solution provided by the embodiment of the present application, multiple binocular cameras can be arranged on the side of the circular tube to be measured, and the electronic device can measure the tube diameter according to the visible light images collected by different binocular cameras, and then determine the maximum tube diameter measurement result as the tube diameter of the circular tube to be measured. In this way, for a circular tube with a non-standard circular cross section, the electronic device can determine its maximum tube diameter.
[0199] Corresponding to the above-mentioned method for measuring pipe diameter based on the left-eye visible light image and the right-eye visible light image captured by the binocular camera, the embodiment of the present application also provides another method for measuring pipe diameter based on the visible light image captured by the monocular camera and the depth image captured by the depth camera. This method for measuring pipe diameter is introduced below.
[0200] like Fig.10 As shown, a pipe diameter measurement method includes:
[0201] S1001, obtaining a visible light image of the side surface of the circular tube to be measured captured by a monocular camera, and obtaining a depth image of the side surface of the circular tube to be measured captured by a depth camera.
[0202] When a monocular camera is arranged on the side of the circular tube to be measured to collect a visible light image of the side of the circular tube to be measured, a depth camera for collecting a depth image may be additionally arranged, and the depth camera and the monocular camera are set to collect images of the same area. In this way, in addition to obtaining the visible light image of the side of the circular tube to be measured collected by the monocular image, the electronic device can also obtain the depth image of the side of the circular tube to be measured collected by the depth camera.
[0203] In addition, when a monocular camera is arranged to collect a visible light image of the side of the circular tube to be detected, a backlight plate for fill light can also be provided in the optical axis direction of the monocular camera, and the circular tube to be measured is fixed between the monocular camera and the backlight plate.
[0204] S1002, performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result.
[0205] S1003 : Determine the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera, and the depth information in the depth image.
[0206] In addition to obtaining the visible light image captured by the monocular camera and the depth image captured by the depth camera, the electronic device can also obtain parameters of the monocular camera and the depth camera, where the parameters may include: intrinsic parameters and extrinsic parameters.
[0207] In order to determine the depth of the side edge line, the electronic device can first convert the depth image into a depth point cloud based on the internal parameters of the depth camera and the depth information of each pixel in the depth image. Then the electronic device can determine the posture relationship between the monocular camera and the depth camera based on the external parameters of the monocular camera and the external parameters of the depth camera, and thus convert the depth point cloud into a visible light point cloud based on the posture relationship. Furthermore, the electronic device can determine the image position of each point in the visible light point cloud in the visible light image based on the internal parameters of the monocular camera. Thus, the electronic device can obtain the image position of each pixel in the depth image mapped to the visible light image, that is, obtain the corresponding relationship between each pixel in the depth image and each pixel in the visible light image.
[0208] Then, for the side edge line in the visible light image, the electronic device can determine the depth of the side edge line based on the depth information of each pixel in the depth image and the correspondence between each pixel in the depth image and each pixel in the visible light image.
[0209] S1004, determining the center line of the circular tube to be measured based on the side edge line, and determining the depth of the center line based on the depth of the side edge line.
[0210] S1005 , determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured.
[0211] S1006, determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter.
[0212] The target focal length is the focal length of the monocular camera.
[0213] The specific implementation of the above steps S1002, S1004-S1006 is the same or similar to the specific implementation of the above steps S102, S104-S106. Figure 1-Figure 8 The illustrated embodiments will not be described in detail here.
[0214] In the scheme provided by the embodiment of the present application, the electronic device can obtain the image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the focal length of the monocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the correspondence between the actual diameter of the circular tube. No manual measurement is required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to the manual measurement method. And combined with the above-mentioned method for measuring the diameter of the left eye visible light image and the right eye visible light image collected by the binocular camera, when determining the depth of the side edge line, the electronic device can determine it according to the binocular image collected by the binocular camera, or according to the depth image corresponding to the visible light image, so that when implementing the diameter measurement method provided by the embodiment of the present application, it can be implemented by arranging a binocular camera, or by arranging a monocular camera and a depth camera, thereby improving the flexibility of the diameter measurement method.
[0215] As an implementation manner of an embodiment of the present application, the number of the above-mentioned monocular cameras and the above-mentioned depth cameras is multiple, and the multiple monocular cameras and the multiple depth cameras can be pre-combined to obtain multiple groups of cameras, wherein the installation heights of the multiple groups of cameras are the same and the acquisition angles are different, and each group of cameras includes a monocular camera and a depth camera for acquiring images of the same area of the circular tube to be measured.
[0216] In this case, the above step S1001 may include: respectively acquiring visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured.
[0217] Accordingly, the electronic device can use the following method to determine the actual diameter of the round tube to be measured: Fig.11 The method shown is used to determine Fig.11 As shown, the above step S1005 may include:
[0218] S1101, for each monocular camera, determining a tube diameter corresponding to the monocular camera according to a first focal length, a depth of a first center point, and a first image tube diameter.
[0219] Among them, the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image captured by the monocular camera.
[0220] After obtaining the visible light image and depth image collected by each camera group, the electronic device can process the visible light image and depth image collected by each camera group one by one. Specifically:
[0221] After obtaining the visible light image (i.e., the first visible light image) captured by the monocular camera in a group of cameras and the depth image (i.e., the first depth image) captured by the depth camera, the electronic device can perform the above steps S1002-S1005 based on the first visible light image to determine the depth of the center point on the center line of the circular tube to be measured in the first visible light image (i.e., the depth of the first center point), and determine the image tube diameter of the circular tube to be measured in the first visible light image (i.e., the first image tube diameter).
[0222] Then, the electronic device may determine the tube diameter corresponding to the monocular camera according to the focal length (ie, the first focal length) of the monocular camera in the group of cameras, the depth of the first center point, and the first image tube diameter.
[0223] S1102, determining the maximum value of the tube diameters corresponding to each monocular camera as the actual tube diameter of the circular tube to be measured.
[0224] After obtaining the tube diameters corresponding to the monocular cameras, the electronic device can determine the maximum value of the tube diameters corresponding to the monocular cameras as the actual tube diameter of the circular tube to be measured, thereby determining the maximum tube diameter of the circular tube with a non-standard circular cross section.
[0225] In one embodiment, in order to make the actual diameter of the round tube to be measured closer to the actual maximum diameter of the round tube to be detected, when arranging cameras on the side of the round tube to be measured, a larger number of groups of binocular cameras may be arranged. For example, 6 groups of cameras may be arranged on the side of the round tube to be measured at intervals of 60°.
[0226] In the solution provided by the embodiment of the present application, multiple groups of cameras can be arranged on the side of the circular tube to be measured, and the electronic device can measure the tube diameter according to the visible light images and depth images collected by different groups of cameras, and then determine the maximum tube diameter measurement result as the tube diameter of the circular tube to be measured. In this way, for a circular tube with a non-standard circular cross section, the electronic device can determine its maximum tube diameter.
[0227] As an implementation manner of an embodiment of the present application, the above-mentioned determining the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured may include: segmenting the circular tube to be measured along the center line in the visible light image; for each segment, determining the minimum circumscribed rectangle of the segment, and determining the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, including: for each segment, determining the actual diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0228] As an implementation method of an embodiment of the present application, the above-mentioned determination of the actual diameter of the circular tube to be measured based on the target focal length, the depth of the center point on the center line and the image diameter may include: calculating the target ratio between the depth of the center point on the center line and the target focal length; multiplying the target ratio by the image diameter to determine the actual diameter of the circular tube to be measured.
[0229] As an implementation of an embodiment of the present application, the above-mentioned calculation of the target ratio between the depth of the center point on the center line and the target focal length; multiplying the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured may include:
[0230] According to the following formula, calculate the target ratio between the depth of the center point on the center line and the target focal length; multiply the target ratio by the image tube diameter to determine the actual tube diameter of the circular tube to be measured:
[0231] ;
[0232] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter, The unit is pixel, represents the target focal length, The unit of is pixel;
[0233] As an implementation method of an embodiment of the present application, the above-mentioned determination of the depth of the center line based on the depth of the side edge line may include: for each center point on the center line, determining the average value of the depth of the target edge point as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0234] Corresponding to the above-mentioned method for measuring pipe diameter based on the left-eye visible light image and the right-eye visible light image collected by the binocular camera, an embodiment of the present application also provides a pipe diameter measuring device. The following is an introduction to a pipe diameter measuring device provided in an embodiment of the present application.
[0235] like Fig.12 As shown, a pipe diameter measuring device comprises:
[0236] The image acquisition module 1201 is used to acquire a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured collected by a binocular camera, wherein a backlight plate for fill light is provided in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate;
[0237] The edge line determination module 1202 is used to perform edge detection on the visible light image and determine the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is a left-eye visible light image or a right-eye visible light image;
[0238] The edge line depth determination module 1203 is used to determine the depth of each pixel in the visible light image according to the stereoscopic vision algorithm, the left eye visible light image and the right eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line;
[0239] The centerline determination module 1204 is used to determine the centerline of the circular tube to be measured according to the side edge line, and determine the depth of the centerline based on the depth of the side edge line;
[0240] The image tube diameter determination module 1205 is used to determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured;
[0241] The actual diameter determination module 1206 is used to determine the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the binocular camera.
[0242] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the binocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to the manual measurement method.
[0243] As an implementation of the embodiment of the present application, the image tube diameter determination module 1205 may include:
[0244] A segmentation unit, used for segmenting the circular tube to be measured along the center line in the visible light image;
[0245] An image tube diameter determination unit is used to determine the minimum circumscribed rectangle of each segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment;
[0246] The actual diameter determination module 1206 can be specifically used to determine the actual diameter of the circular tube to be measured in each segment according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0247] As an implementation of the embodiment of the present application, the actual pipe diameter determination module 1206 includes:
[0248] A target ratio calculation unit, used to calculate a target ratio between the depth of a center point on the center line and the target focal length;
[0249] The actual tube diameter determination unit is used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
[0250] As an implementation of an embodiment of the present application, the above-mentioned actual tube diameter determination module 1205 is specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured:
[0251] ;
[0252] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter, The unit is pixel, represents the target focal length, The unit of is pixel;
[0253] As an implementation of an embodiment of the present application, the number of the above-mentioned binocular cameras can be multiple, and the image acquisition module 1201 can be specifically used to respectively acquire the left-eye visible light image and the right-eye visible light image acquired by the multiple binocular cameras from the side of the circular tube to be measured, wherein the installation heights of the multiple binocular cameras are the same and the acquisition angles are different;
[0254] The above-mentioned actual tube diameter determination module 1206 can be specifically used to determine the tube diameter corresponding to each binocular camera according to the first focal length, the depth of the first center point and the first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to each binocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0255] As an implementation of an embodiment of the present application, the above-mentioned center line determination module 1204 can be specifically used to determine the average value of the depth of the target edge point as the depth of the center point for each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
[0256] Corresponding to the above-mentioned method for measuring pipe diameter based on the visible light image collected by the monocular camera and the depth image collected by the depth camera, an embodiment of the present application also provides a pipe diameter measuring device. The following is an introduction to a pipe diameter measuring device provided in an embodiment of the present application.
[0257] like Fig.13 , a pipe diameter measuring device, comprising:
[0258] The image acquisition module 1301 acquires a visible light image of the side of the circular tube to be measured acquired by a monocular camera, and acquires a depth image of the side of the circular tube to be measured acquired by a depth camera, wherein a backlight plate for fill light is provided in the optical axis direction of the monocular camera, the circular tube to be measured is located between the monocular camera and the backlight plate, and the depth camera and the monocular camera are used to acquire images of the same area of the circular tube to be measured;
[0259] The edge line determination module 1302 performs edge detection on the visible light image and determines the side edge line of the circular tube to be measured based on the edge detection result;
[0260] An edge line depth determination module 1303 determines the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image;
[0261] The centerline determination module 1304 determines the centerline of the circular tube to be measured according to the side edge line, and determines the depth of the centerline based on the depth of the side edge line;
[0262] The image tube diameter determination module 1305 determines the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured;
[0263] The actual diameter determination module 1306 determines the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the monocular camera.
[0264] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the monocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and also greatly improves the efficiency of the measurement compared to the manual measurement method.
[0265] As an implementation of an embodiment of the present application, the above-mentioned image tube diameter determination module 1305 may include: a segmentation unit, which is used to segment the circular tube to be measured along the center line in the visible light image; an image tube diameter determination unit, which is used to determine the minimum circumscribed rectangle of each segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment; an actual tube diameter determination module, which is specifically used to determine the actual tube diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image tube diameter of the circular tube to be measured in the segment for each segment.
[0266] As an implementation of an embodiment of the present application, the above-mentioned actual tube diameter determination module 1306 includes: a target ratio calculation unit, which is used to calculate the target ratio between the depth of the center point on the center line and the target focal length; an actual tube diameter determination unit, which is used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
[0267] As an implementation of an embodiment of the present application, the above-mentioned actual tube diameter determination module 1306 can be specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured:
[0268] ;
[0269] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0270] As an implementation mode of an embodiment of the present application, the number of the above-mentioned monocular camera and depth camera can be multiple, and the above-mentioned image acquisition module 1301 can be specifically used to respectively acquire visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera and a depth camera for collecting images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the collection angles are different; the actual tube diameter determination module is specifically used to determine the tube diameter corresponding to each monocular camera according to the first focal length, the depth of the first center point and the first image tube diameter for each monocular camera, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point of the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; the maximum value of the tube diameters corresponding to each monocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0271] As an implementation of an embodiment of the present application, the above-mentioned center line determination module 1304 can be specifically used to determine the average value of the depth of the target edge point as the depth of the center point for each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
[0272] Corresponding to the above-mentioned method for measuring pipe diameter based on the left-eye visible light image and the right-eye visible light image collected by the binocular camera, an embodiment of the present application also provides a pipe diameter measurement system. The following introduces a pipe diameter measurement system provided by an embodiment of the present application.
[0273] like Fig.14 As shown, a pipe diameter measurement system includes a backlight plate 1401, a fixing device 1402, a binocular camera 1403 and an electronic device 1404, the backlight plate 1401 and the fixing device 1402 are arranged in the optical axis direction of the binocular camera, and the fixing device 1402 is located between the binocular camera 1403 and the backlight plate 1401;
[0274] A fixing device 1402, used for fixing the round tube to be measured;
[0275] The backlight panel 1401 is used to provide supplementary light to the round tube to be measured fixed on the fixing device 1402;
[0276] The binocular camera 1403 is used to collect the visible light image of the side of the circular tube to be measured and send the visible light image to the electronic device 1404;
[0277] The electronic device 1404 is used to obtain the left-eye visible light image and the right-eye visible light image of the side of the circular tube to be measured sent by the binocular camera 1403; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is the left-eye visible light image or the right-eye visible light image; determine the depth of each pixel point in the visible light image according to the stereo vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel point included in the side edge line; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the binocular camera 1403.
[0278] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the binocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and greatly improves the efficiency of the measurement compared to the manual measurement method.
[0279] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1404 can be specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment based on the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0280] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1404 can be specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length; and the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured.
[0281] As an implementation of an embodiment of the present application, the electronic device 1404 can be specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured:
[0282] ;
[0283] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0284] As an implementation of an embodiment of the present application, the number of the above-mentioned binocular cameras 1403 can be multiple, wherein the installation heights of the multiple binocular cameras are the same and the acquisition angles are different;
[0285] The electronic device 1404 can be specifically used to respectively obtain the left-eye visible light images and the right-eye visible light images collected from the side of the circular tube to be measured and sent by multiple binocular cameras, and for each binocular camera, determine the tube diameter corresponding to the binocular camera according to the first focal length, the depth of the first center point and the first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to each binocular camera is determined as the actual tube diameter of the circular tube to be measured.
[0286] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1404 can be specifically used to determine the average value of the depth of the target edge point as the depth of the center point for each center point on the center line, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
[0287] Corresponding to the above-mentioned method for measuring pipe diameter based on the visible light image captured by the monocular camera and the depth image captured by the depth camera, an embodiment of the present application also provides a pipe diameter measurement system. The following introduces a pipe diameter measurement system provided by an embodiment of the present application.
[0288] like Fig.15 As shown, a pipe diameter measurement system includes a backlight plate 1501, a fixture 1502, a monocular camera 1503, a depth camera 1504 and an electronic device 1505, wherein the backlight plate 1501 and the fixture 1502 are arranged in the optical axis direction of the monocular camera 1503, and the fixture 1502 is located between the monocular camera 1503 and the backlight plate 1501;
[0289] A fixing device 1502, used for fixing the round tube to be measured;
[0290] The backlight panel 1501 is used to provide supplementary light to the round tube to be measured fixed on the fixing device 1502;
[0291] The monocular camera 1503 is used to collect the visible light image of the side surface of the circular tube to be measured and send the visible light image to the electronic device 1505;
[0292] The depth camera 1504 is used to collect the depth image of the side of the circular tube to be measured and send the depth image to the electronic device 1505, wherein the depth camera 1504 and the monocular camera 1503 are used to collect the image of the same area of the circular tube to be measured;
[0293] The electronic device 1505 is used to obtain the visible light image sent by the monocular camera 1503 and the depth image sent by the depth camera 1504; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result; determine the depth of the side edge line based on the parameters of the depth camera 1504, the parameters of the monocular camera 1503 and the depth information in the depth image; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the monocular camera 1503.
[0294] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the monocular camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and also greatly improves the efficiency of the measurement compared to the manual measurement method.
[0295] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1505 can be specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment based on the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
[0296] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1505 is specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length; and the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured.
[0297] As an implementation of an embodiment of the present application, the electronic device 1505 is specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length according to the following formula; and the product of the target ratio and the image tube diameter is determined as the actual tube diameter of the circular tube to be measured:
[0298] ;
[0299] in, Indicates the actual diameter of the round tube to be measured. Indicates the depth of the center point on the center line, Indicates the image tube diameter, The unit is pixel, represents the target focal length, The unit is pixel.
[0300] As an implementation of an embodiment of the present application, the number of the above-mentioned monocular camera 1503 and depth camera 1504 is multiple; the electronic device 1505 is specifically used to respectively obtain visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera 1503 and a depth camera 1504 for collecting images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the collection angles are different; for each monocular camera 1503, according to the first focal length, the depth of the first center point and the first image diameter, the diameter corresponding to the monocular camera 1503 is determined, wherein the first focal length is the focal length of the monocular camera 1503, the first center point is the center point on the center line determined according to the first visible light image, the first image diameter is the image diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera 1503; the maximum value of the diameters corresponding to each monocular camera 1503 is determined as the actual diameter of the circular tube to be measured.
[0301] As an implementation of an embodiment of the present application, the above-mentioned electronic device 1505 is specifically used to determine the average value of the depth of the target edge point as the depth of the center point for each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
[0302] The present application also provides an electronic device, such as Fig.16 As shown, including:
[0303] Memory 1601, used for storing computer programs;
[0304] The processor 1602 is used to implement the pipe diameter measurement method described in any of the above embodiments when executing the program stored in the memory 1601.
[0305] In the solution provided by the embodiment of the present application, the electronic device can obtain an image of the side of the circular tube, and then determine the image diameter and centerline depth of the circular tube from the image, and then automatically calculate the actual diameter of the circular tube according to the correspondence between the focal length of the camera, the depth of the center point on the centerline of the circular tube, the image diameter of the circular tube and the actual diameter of the circular tube. Manual measurement is not required, which avoids the influence of human factors on the accuracy of the measurement results, greatly improves the accuracy of the measurement, and also greatly improves the efficiency of the measurement compared to the manual measurement method.
[0306] In addition, the electronic device may further include a communication bus and / or a communication interface, and the processor 1602, the communication interface, and the memory 1601 communicate with each other via the communication bus.
[0307] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0308] The communication interface is used for communication between the above electronic device and other devices.
[0309] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0310] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0311] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the pipe diameter measurement method described in any of the above embodiments is implemented.
[0312] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the pipe diameter measurement method described in any of the above embodiments.
[0313] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0314] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0315] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, system, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0316] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for measuring pipe diameter, characterized in that: The method comprises: Obtaining a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured collected by a binocular camera, wherein a backlight plate for fill light is provided in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate; Performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is the left-eye visible light image or the right-eye visible light image; Determine the depth of each pixel in the visible light image according to the stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line; Determine the center line of the circular tube to be measured based on the side edge line, and determine the depth of the center line based on the depth of the side edge line; Determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured; Determine the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the binocular camera; Wherein, determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes: calculating a target ratio between the depth of the center point on the center line and the target focal length; and multiplying the target ratio by the image diameter to determine the actual diameter of the circular tube to be measured.
2. The method according to claim 1, characterized in that The step of determining the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured comprises: Segmenting the circular tube to be measured along the center line in the visible light image; For each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; Determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes: For each segment, the actual diameter of the circular tube to be measured in the segment is determined according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment.
3. The method according to any one of claims 1 to 2, characterized in that: The number of the binocular cameras is multiple, and the step of acquiring the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured collected by the binocular cameras includes: Respectively obtain a left-eye visible light image and a right-eye visible light image collected by multiple binocular cameras from the side of the circular tube to be measured, wherein the multiple binocular cameras are installed at the same height and have different collection angles; Determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes: For each binocular camera, the tube diameter corresponding to the binocular camera is determined according to a first focal length, a depth of a first center point, and a first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; The maximum value among the tube diameters corresponding to the binocular cameras is determined as the actual tube diameter of the circular tube to be measured.
4. The method according to any one of claims 1 to 2, characterized in that: The step of determining the depth of the center line based on the depth of the side edge line comprises: For each center point on the center line, an average value of the depths of the target edge points is determined as the depth of the center point, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
5. A method for measuring pipe diameter, characterized in that: The method comprises: Acquire a visible light image of the side of the circular tube to be measured acquired by a monocular camera, and acquire a depth image of the side of the circular tube to be measured acquired by a depth camera, wherein a backlight plate for fill light is provided in the optical axis direction of the monocular camera, the circular tube to be measured is located between the monocular camera and the backlight plate, and the depth camera and the monocular camera are used to acquire an image of the same area of the circular tube to be measured; Performing edge detection on the visible light image, and determining the side edge line of the circular tube to be measured based on the edge detection result; Determining the depth of the side edge line based on parameters of the depth camera, parameters of the monocular camera, and depth information in the depth image; Determine the center line of the circular tube to be measured based on the side edge line, and determine the depth of the center line based on the depth of the side edge line; Determining the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured; Determine the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter, wherein the target focal length is the focal length of the monocular camera; Wherein, determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image diameter includes: calculating a target ratio between the depth of the center point on the center line and the target focal length; and multiplying the target ratio by the image diameter to determine the actual diameter of the circular tube to be measured.
6. The method according to claim 5, characterized in that Determining the image diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured comprises: segmenting the circular tube to be measured along the center line in the visible light image; determining the minimum circumscribed rectangle of each segment, and determining the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; determining the actual diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line, and the image diameter comprises: determining the actual diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment, and the image diameter of the circular tube to be measured in the segment for each segment; or, There are multiple monocular cameras and multiple depth cameras, and obtaining the visible light image of the side of the circular tube to be measured acquired by the monocular camera and the depth image of the side of the circular tube to be measured acquired by the depth camera comprises: respectively acquiring the visible light image and the depth image acquired by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras comprises a monocular camera and a depth camera for acquiring images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the acquisition angles are different; determining the depth image of the circular tube according to the target focal length, the depth of the center point on the center line and the diameter of the image tube The actual diameter of the circular tube to be measured comprises: for each monocular camera, determining the diameter corresponding to the monocular camera according to a first focal length, a depth of a first center point and a first image diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image diameter is the image diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; determining the maximum value of the diameters corresponding to the monocular cameras as the actual diameter of the circular tube to be measured; or, Determining the depth of the center line based on the depth of the side edge line includes: for each center point on the center line, determining the average value of the depth of the target edge point as the depth of the center point, wherein the target edge point is the intersection of the normal of the center line at the center point and the side edge line.
7. A pipe diameter measuring device, characterized in that: The device comprises: An image acquisition module, used to acquire a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured collected by a binocular camera, wherein a backlight plate for fill light is provided in the optical axis direction of the binocular camera, and the circular tube to be measured is located between the binocular camera and the backlight plate; An edge line determination module, used to perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is the left-eye visible light image or the right-eye visible light image; an edge line depth determination module, configured to determine the depth of each pixel in the visible light image according to a stereoscopic vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line; A centerline determination module, used to determine the centerline of the circular tube to be measured according to the side edge line, and determine the depth of the centerline based on the depth of the side edge line; An image tube diameter determination module, used to determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured; An actual diameter determination module, used to determine the actual diameter of the circular tube to be measured according to a target focal length, a depth of a center point on the center line and the image diameter, wherein the target focal length is the focal length of the binocular camera; Among them, the actual tube diameter determination module includes: a target ratio calculation unit, which is used to calculate the target ratio between the depth of the center point on the center line and the target focal length; an actual tube diameter determination unit, which is used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
8. The device according to claim 7, characterized in that The image tube diameter determination module comprises: a segmentation unit, which is used to segment the circular tube to be measured along the center line in the visible light image; an image tube diameter determination unit, which is used to determine the minimum circumscribed rectangle of each segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment; the actual tube diameter determination module is specifically used to determine the actual tube diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image tube diameter of the circular tube to be measured in the segment for each segment; or, There are multiple binocular cameras, and the image acquisition module is specifically used to respectively acquire the left-eye visible light image and the right-eye visible light image collected by the multiple binocular cameras from the side of the circular tube to be measured, wherein the multiple binocular cameras are installed at the same height and have different collection angles; the actual tube diameter determination module is specifically used to determine the tube diameter corresponding to each binocular camera according to the first focal length, the depth of the first center point and the first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to each binocular camera is determined as the actual tube diameter of the circular tube to be measured; or, The center line determination module is specifically used to determine the average value of the depth of the target edge point as the depth of each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
9. A pipe diameter measuring device, characterized in that: The device comprises: An image acquisition module, which acquires a visible light image of the side of the circular tube to be measured acquired by a monocular camera, and acquires a depth image of the side of the circular tube to be measured acquired by a depth camera, wherein a backlight plate for fill light is provided in the optical axis direction of the monocular camera, the circular tube to be measured is located between the monocular camera and the backlight plate, and the depth camera and the monocular camera are used to acquire an image of the same area of the circular tube to be measured; An edge line determination module performs edge detection on the visible light image and determines the side edge line of the circular tube to be measured based on the edge detection result; An edge line depth determination module, which determines the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image; A centerline determination module, which determines the centerline of the circular tube to be measured according to the side edge line, and determines the depth of the centerline based on the depth of the side edge line; An image tube diameter determination module, which determines the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segments of the circular tube to be measured; An actual diameter determination module determines the actual diameter of the circular tube to be measured according to a target focal length, a depth of a center point on the center line, and the image diameter, wherein the target focal length is the focal length of the monocular camera; Among them, the actual tube diameter determination module includes: a target ratio calculation unit, which is used to calculate the target ratio between the depth of the center point on the center line and the target focal length; an actual tube diameter determination unit, which is used to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
10. The device according to claim 9, characterized in that The image tube diameter determination module comprises: a segmentation unit, which is used to segment the circular tube to be measured along the center line in the visible light image; an image tube diameter determination unit, which is used to determine the minimum circumscribed rectangle of each segment, and determine the width of the minimum circumscribed rectangle as the image tube diameter of the circular tube to be measured in the segment; the actual tube diameter determination module is specifically used to determine the actual tube diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image tube diameter of the circular tube to be measured in the segment for each segment; or, There are multiple monocular cameras and depth cameras, and the image acquisition module is specifically used to respectively acquire visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera and a depth camera for collecting images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the collection angles are different; the actual tube diameter determination module is specifically used to determine the tube diameter corresponding to each monocular camera according to a first focal length, a depth of a first center point and a first image tube diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; the maximum value of the tube diameters corresponding to each monocular camera is determined as the actual tube diameter of the circular tube to be measured; or, The center line determination module is specifically used to determine the average value of the depth of the target edge point as the depth of each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
11. A pipe diameter measurement system, characterized in that: The system comprises a backlight plate, a fixing device, a binocular camera and an electronic device, wherein the backlight plate and the fixing device are arranged in the optical axis direction of the binocular camera, and the fixing device is located between the binocular camera and the backlight plate; The fixing device is used to fix the round tube to be measured; The backlight panel is used to provide supplementary light to the round tube to be measured fixed on the fixing device; The binocular camera is used to collect a left-eye visible light image and a right-eye visible light image of the side surface of the circular tube to be measured, and send the left-eye visible light image and the right-eye visible light image to the electronic device; The electronic device is used to obtain the left-eye visible light image and the right-eye visible light image of the side surface of the circular tube to be measured sent by the binocular camera; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result, wherein the visible light image is the left-eye visible light image or the right-eye visible light image; determine the depth of each pixel in the visible light image according to the stereo vision algorithm, the left-eye visible light image and the right-eye visible light image, and determine the depth of the side edge line based on each pixel included in the side edge line; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the binocular camera; The electronic device is specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length; and to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
12. The system according to claim 11, characterized in that The electronic device is specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment; or, The number of the binocular cameras is multiple, wherein the multiple binocular cameras are installed at the same height and have different collection angles; the electronic device is specifically used to respectively obtain the left-eye visible light image and the right-eye visible light image collected from the side of the circular tube to be measured and sent by the multiple binocular cameras, and for each binocular camera, determine the tube diameter corresponding to the binocular camera according to the first focal length, the depth of the first center point and the first image tube diameter, wherein the first focal length is the focal length of the binocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image tube diameter is the image tube diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the binocular camera; the maximum value of the tube diameters corresponding to the respective binocular cameras is determined as the actual tube diameter of the circular tube to be measured; or, The electronic device is specifically used to determine the average value of the depth of the target edge point as the depth of each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
13. A pipe diameter measurement system, characterized in that: The system comprises a backlight plate, a fixing device, a monocular camera, a depth camera and an electronic device, wherein the backlight plate and the fixing device are arranged in the optical axis direction of the monocular camera, and the fixing device is located between the monocular camera and the backlight plate; The fixing device is used to fix the round tube to be measured; The backlight panel is used to provide supplementary light to the round tube to be measured fixed on the fixing device; The monocular camera is used to collect a visible light image of the side surface of the circular tube to be measured and send the visible light image to the electronic device; The depth camera is used to collect a depth image of the side of the circular tube to be measured and send the depth image to the electronic device, wherein the depth camera and the monocular camera are used to collect images of the same area of the circular tube to be measured; The electronic device is used to obtain the visible light image sent by the monocular camera and the depth image sent by the depth camera; perform edge detection on the visible light image, and determine the side edge line of the circular tube to be measured based on the edge detection result; determine the depth of the side edge line based on the parameters of the depth camera, the parameters of the monocular camera and the depth information in the depth image; determine the center line of the circular tube to be measured according to the side edge line, and determine the depth of the center line based on the depth of the side edge line; determine the image tube diameter of the circular tube to be measured in the visible light image according to the width of the minimum circumscribed rectangle of the segment of the circular tube to be measured; determine the actual tube diameter of the circular tube to be measured according to the target focal length, the depth of the center point on the center line and the image tube diameter, wherein the target focal length is the focal length of the monocular camera; The electronic device is specifically used to calculate the target ratio between the depth of the center point on the center line and the target focal length; and to determine the product of the target ratio and the image tube diameter as the actual tube diameter of the circular tube to be measured.
14. The system according to claim 13, characterized in that The electronic device is specifically used to segment the circular tube to be measured along the center line in the visible light image; for each segment, determine the minimum circumscribed rectangle of the segment, and determine the width of the minimum circumscribed rectangle as the image diameter of the circular tube to be measured in the segment; for each segment, determine the actual diameter of the circular tube to be measured in the segment according to the target focal length, the depth of the center point in the segment and the image diameter of the circular tube to be measured in the segment; or, The number of the monocular cameras and the depth cameras is multiple; the electronic device is specifically used to respectively obtain visible light images and depth images collected by multiple groups of cameras from the side of the circular tube to be measured, wherein each group of cameras includes a monocular camera and a depth camera for collecting images of the same area of the circular tube to be measured, and the installation heights of the multiple groups of cameras are the same and the collection angles are different; for each monocular camera, the diameter of the tube corresponding to the monocular camera is determined according to the first focal length, the depth of the first center point and the first image diameter, wherein the first focal length is the focal length of the monocular camera, the first center point is the center point on the center line determined according to the first visible light image, the first image diameter is the image diameter of the circular tube to be measured in the first visible light image, and the first visible light image is the visible light image collected by the monocular camera; the maximum value of the diameters corresponding to each monocular camera is determined as the actual diameter of the circular tube to be measured; or, The electronic device is specifically used to determine the average value of the depth of the target edge point as the depth of each center point on the center line, wherein the target edge point is the intersection of the normal line of the center line at the center point and the side edge line.
