A laser rangefinder polygon area measurement method, device and storage medium
By using a monocular camera and a laser ranging module in a laser rangefinder, image profile detection and pixel area calculation are solved, and the area measurement of polygons and irregular patterns is achieved.
Patent Information
- Application Number
- CN202410669311.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-05-28
AI Technical Summary
Existing laser rangefinders cannot measure the area of the surface with irregular patterns.
By introducing a monocular camera and a laser ranging module into the laser rangefinder, the image of the object to be measured is acquired and the profile detection is performed, and the product value of the number of pixels and the area of a single pixel is calculated to obtain the area of the surface to be measured.
The area measurement of any polygon or irregular figure is realized, and no auxiliary tools are required, making it more convenient to use.
Smart Images

Figure CN118424162B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of measuring equipment, and in particular to a method, a device and a storage medium for measuring polygonal area using a laser rangefinder. Background Art
[0002] At present, the laser rangefinders on the market can only calculate the surface area of the object by measuring the length, width or height of the object separately first, and then using the area formula. Moreover, they can only measure the area of regular shapes such as standard rectangles, squares, triangles, trapezoids, etc., but cannot measure the area of irregular shapes. Summary of the invention
[0003] 1. Technical issues to be resolved
[0004] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a method, device and storage medium for measuring polygonal area of a laser rangefinder, which solves the technical problem in the prior art that the area of an irregular surface cannot be measured.
[0005] (II) Technical solution
[0006] In order to achieve the above object, the main technical solutions adopted by the present invention include:
[0007] In a first aspect, an embodiment of the present invention provides a method for measuring polygonal area of a laser rangefinder, which is applied to a laser rangefinder module in the laser rangefinder, wherein the laser rangefinder includes a monocular camera and a laser rangefinder module; the method for measuring polygonal area of the laser rangefinder includes: obtaining a current effective distance to a measured object and a first image of a surface to be measured of the measured object including a laser point and the surface to be measured of the measured object irradiated by the laser point; wherein the first image is obtained by photographing the monocular camera, and the graphic of the surface to be measured of the measured object is a polygon; contour detection is performed on the first image based on the laser point, an overall edge contour of the surface to be measured is obtained, and the number of pixels inside the overall edge contour is determined; the current effective distance is substituted into a linear proportional relationship between the area of a single pixel and the measured distance, and the area of a single pixel corresponding to the current effective distance is obtained; the product value of the number of pixels and the area of a single pixel corresponding to the current effective distance is calculated, and the product value is used as the area of the surface to be measured.
[0008] In some possible embodiments, the laser rangefinder includes a tilt angle measuring device for collecting the tilt angle of the laser rangefinder in real time;
[0009] Among them, obtaining the current effective distance between the object to be measured includes: determining whether the tilt angle is equal to zero; if the tilt angle is not equal to zero, taking the product value of the cosine value of the tilt angle and the current measurement distance measured by the laser rangefinder as the current effective distance; if the tilt angle is equal to zero, taking the current measurement distance as the current effective distance.
[0010] In some possible embodiments, the laser rangefinder includes a display screen;
[0011] Among them, based on the laser point, contour detection is performed on the first image to obtain the overall edge contour of the surface to be measured, including: determining the position of the laser point in the first image; binarizing the first image to obtain a binary image; based on the position of the laser point in the first image, contour detection is performed on the area where the laser point is located in the binary image to obtain a candidate overall edge contour of the surface to be measured; the candidate overall edge contour is output through a display screen for user reference to determine whether it is the contour of the surface to be measured; and based on the user's confirmation operation on the candidate overall edge contour, the candidate overall edge contour is used as the overall edge contour of the surface to be measured.
[0012] In some possible embodiments, contour detection is performed on the area where the laser point is located in the binary image based on the position of the laser point in the first image to obtain a candidate overall edge contour of the surface to be measured, including: determining the candidate overall edge contour of the surface to be measured based on the change in grayscale values around the laser point based on the position of the laser point in the first image.
[0013] In some possible embodiments, the area measurement mode of the area of the surface to be measured includes a first measurement mode and a second measurement mode, and the measurement accuracy of the second measurement mode is better than the measurement accuracy of the first measurement mode;
[0014] Determining the number of pixels inside the overall edge contour includes: when the area measurement mode is the first measurement mode, determining the total number of incomplete pixels and complete pixels inside the overall edge contour, and using the total number as the number of pixels inside the overall edge contour.
[0015] In some possible embodiments, determining the number of pixels inside the overall edge contour further includes: when the area measurement mode is the second measurement mode, determining the total number of complete pixels inside the overall edge contour, determining the pixel ratio value of each incomplete pixel inside the overall edge contour, and calculating the sum of all pixel ratio values, and determining the total number of complete pixels corresponding to all incomplete pixels based on the sum, and taking the sum of the total number of complete pixels and the total number of complete pixels corresponding to all incomplete pixels as the number of pixels inside the overall edge contour; wherein the pixel ratio value is used to represent the ratio of the pixel area of the incomplete pixel to the pixel area of the complete pixel.
[0016] In some possible embodiments, the process of obtaining the linear proportional relationship includes: when the measured distance is the first standard measurement distance, obtaining a second image including the laser point and the designated square in the camera vision calibration plate illuminated by the laser point, and processing the second image to determine the first image area corresponding to the designated square, and determining the number of pixel rows and the number of pixels in each row corresponding to the first image area, and determining the area of a single pixel corresponding to the first standard measurement distance based on the number of pixel rows and the number of pixels in each row corresponding to the first image area; when the measured distance is the second standard measurement distance, obtaining a third image including the laser point and the designated square in the camera vision calibration plate illuminated by the laser point, and processing the third image to determine the second image area corresponding to the designated square, and determining the number of pixel rows and the number of pixels in each row corresponding to the second image area, and determining the area of a single pixel corresponding to the second standard measurement distance based on the number of pixel rows and the number of pixels in each row corresponding to the second image area; constructing a linear proportional relationship based on the area of the single pixel corresponding to the first standard measurement distance and the area of the single pixel corresponding to the second standard measurement distance.
[0017] In a second aspect, an embodiment of the present invention provides a laser rangefinder, comprising: a monocular camera; a laser ranging module, the laser ranging module and the monocular camera are communicatively connected, and the laser ranging module is used to execute the laser rangefinder polygon area measurement method described in any one of the first embodiments.
[0018] In a third aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and the computer program is executed by a processor to execute the method described in the first aspect or any optional implementation of the first aspect.
[0019] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the method described in the first aspect or any optional implementation method of the first aspect is performed.
[0020] In a fifth aspect, the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0021] (III) Beneficial effects
[0022] The beneficial effects of the present invention are:
[0023] The embodiment of the present application provides a method, device and storage medium for measuring polygonal area of a laser rangefinder, which obtains the current effective distance between the object to be measured and a first image of the surface to be measured including a laser point and the object to be measured irradiated by the laser point, and performs contour detection on the first image based on the laser point to obtain the overall edge contour of the surface to be measured, and determine the number of pixels inside the overall edge contour, and substitute the current effective distance into the linear proportional relationship between the area of a single pixel and the measured distance to obtain the area of a single pixel corresponding to the current effective distance, and calculate the product value of the number of pixels and the area of a single pixel corresponding to the current effective distance, and use the product value as the area of the surface to be measured. Therefore, through the method of the present application, it is only necessary to align the laser rangefinder with the object to be measured, without the need for additional auxiliary tools, to directly measure the area of the shape to be measured, and it can measure the area of any polygon or irregular figure, which is more convenient to use.
[0024] In order to make the above-mentioned objectives, features and advantages to be achieved by the embodiments of the present application more obvious and understandable, the following specifically cites preferred embodiments and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 A flow chart of a method for measuring polygonal area using a laser rangefinder provided in an embodiment of the present application is shown;
[0027] Figure 2 A schematic diagram of a camera vision calibration plate provided in an embodiment of the present application is shown;
[0028] Figure 3 A structural block diagram of a laser rangefinder provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0029] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0030] For existing laser rangefinders, when measuring the length, width, and height of an object, a boundary or end point is required as a reference for the laser signal reflection. Therefore, existing laser rangefinders cannot directly measure the area of a graphic with an open boundary. For example, a laser rangefinder cannot measure the area of a small graphic on a plane alone.
[0031] Therefore, in addition to the problem that the existing laser rangefinder cannot measure the area of irregular patterns on the surface, it also has the problem of being unable to meet the demand for measuring the area of small patterns.
[0032] Based on this, the embodiments of the present application provide a method, device and storage medium for measuring polygonal area of a laser rangefinder, by setting a monocular camera on the laser rangefinder, and obtaining an image of the object to be measured through the monocular camera, and then obtaining the distance between the current laser rangefinder and the object to be measured through the laser ranging module, and obtaining the number of pixels in the area of the object to be measured after processing the obtained image, and then calculating the distance value of a single pixel on the X-axis and the Y-axis according to the distance information, and thereby calculating the area of a single pixel, and then multiplying the number of pixels in the area of the object to be measured by the area of a single pixel, so as to obtain the area of the object to be measured, so that through the method of the present application, it is only necessary to aim the laser rangefinder at the object to be measured, without the need for additional auxiliary tools, and it can measure the area of any polygon or irregular figure, which is more convenient to use.
[0033] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0034] First embodiment
[0035] See also Figure 1 , Figure 1 A flow chart of a laser rangefinder polygon area measurement method provided in an embodiment of the present application is shown. Specifically, the laser rangefinder polygon area measurement method is applied to a laser ranging module in a laser rangefinder, and the laser rangefinder includes a monocular camera and a laser ranging module; the laser rangefinder polygon area measurement method includes:
[0036] Step S110, obtaining the current effective distance to the measured object and a first image including the laser point and the measured surface of the measured object illuminated by the laser point. The first image is obtained by taking a monocular camera. The current effective distance can also be called the current depth of field distance.
[0037] It should be understood that the specific object of the object to be measured and the specific surface of the object to be measured can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0038] For example, the side surface of the object to be measured may be a flat surface of a regular shape, or a flat surface of an irregular shape, etc.; for another example, the shape or outline of the side surface of the object to be measured may be a polygon.
[0039] It should also be understood that the specific process of obtaining the current effective distance to the object to be measured and the first image including the laser point and the surface to be measured of the object to be measured illuminated by the laser point can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0040] Specifically, the laser rangefinder can be aimed at the side of the object to be measured, and the laser can be projected into the area of the side of the object to be measured, and the first image of the surface to be measured of the object to be measured including the laser point and the surface illuminated by the laser point can be obtained by the monocular camera. When obtaining the first image, it is necessary to stand at a test distance that enables the monocular camera to obtain the overall outline of the first image.
[0041] And, for the laser distance measuring module, the laser distance measuring module can measure the current measured distance between it and the measured object. And, in actual depth of field measurement, the laser distance meter is not necessarily a vertical incident target, so when the laser distance meter includes an inclination angle measuring device for real-time acquisition of the inclination angle of the laser distance meter, it can be determined whether the inclination angle is equal to zero; if the inclination angle is not equal to zero, the product value of the cosine value of the inclination angle and the current measured distance measured by the laser distance meter (i.e., D*cos(α), D represents the current measured distance measured by the laser distance meter; α represents the inclination angle) is used as the current effective distance; if the inclination angle is equal to zero, the current measured distance is used as the current effective distance.
[0042] It should be understood that the specific device of the tilt angle measuring device can be set according to actual needs, and the embodiments of the present application are not limited thereto.
[0043] For example, the tilt angle measuring device may be a three-axis accelerometer or the like.
[0044] Step S120 , performing contour detection on the first image based on the laser points, obtaining the overall edge contour of the surface to be measured, and determining the number of pixels inside the overall edge contour.
[0045] It should be understood that the specific process of performing contour detection on the first image based on the laser points to obtain the overall edge contour of the surface to be measured can be set according to actual needs, and the embodiments of the present application are not limited thereto.
[0046] Specifically, in the case where the laser rangefinder includes a display screen, the laser point can be found from the first image, and the laser point can be marked in the first image, and the position of the laser point in the first image can be determined. Subsequently, the first image can also be binarized to obtain a binarized image, and the binarized image only contains black and white colors. Subsequently, based on the position of the laser point in the first image, the image edge algorithm can be used to perform contour detection on the area where the laser point is located in the binarized image to obtain a candidate overall edge contour of the surface to be measured, and the candidate overall edge contour can be output through the display screen for the user to refer to whether it is the contour of the surface to be measured. If the laser rangefinder detects the user's click confirmation operation, the candidate overall edge contour can be used as the overall edge contour of the surface to be measured according to the user's confirmation operation on the candidate overall edge contour; if the laser rangefinder detects the user's click cancellation operation, it can return to the step of performing contour detection on the area where the laser point is located in the binarized image through the image edge algorithm. In addition to the above-mentioned click confirmation operation and click cancellation operation, the laser detector can also detect the user's stop operation, and can directly stop the area measurement this time.
[0047] It should be noted that since the object to be detected may be placed on other objects, and since the first image may contain the contours of other objects in addition to the contour of the object to be detected, contour detection errors may occur, and thus the user needs to confirm when performing contour detection. In addition, different edge detection algorithms may be used each time contour detection is performed.
[0048] For example, when multiple edge detection algorithms are stored, when performing the first contour detection, one edge detection algorithm can be randomly selected from the multiple edge detection algorithms as the first edge detection algorithm. When performing the second contour detection, one edge detection algorithm can be randomly selected from the multiple edge detection algorithms other than the first edge detection algorithm as the second edge detection algorithm, and so on.
[0049] It should also be understood that the specific algorithm of the edge detection algorithm can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0050] For example, the plurality of edge detection algorithms may include Laplace algorithm, differentiation method and differential edge detection algorithm, etc.
[0051] It should also be understood that the specific process of performing contour detection on the area where the laser point is located in the binary image based on the position of the laser point in the first image and obtaining the candidate overall edge contour of the surface to be measured can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0052] Optionally, the candidate overall edge profile of the surface to be measured is determined based on the change in the grayscale value around the laser point due to the position of the laser point in the first image.
[0053] For example, the image processing module in the laser rangefinder can identify the location of the laser point and obtain the edge of the image according to the change in the grayscale value around the laser point, thereby reducing the measurement error and the acquisition error of the measured image.
[0054] It should also be understood that the specific process of determining the number of pixels inside the overall edge contour can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0055] Specifically, the area measurement mode of the area of the surface to be measured may include a first measurement mode and a second measurement mode, and the measurement accuracy of the second measurement mode is better than the measurement accuracy of the first measurement mode. The first measurement mode may be called a fast measurement mode, and the second measurement mode may also be called a precise measurement mode;
[0056] Determining the number of pixels inside the overall edge contour includes: when the area measurement mode is the first measurement mode, determining the total number of incomplete pixels and complete pixels inside the overall edge contour, and using the total number as the number of pixels inside the overall edge contour.
[0057] For example, the identified image can be differentiated, and the image can be divided into multiple rows in units of pixels, and the number of pixels in each row can be calculated to obtain the number of pixels P in each row. Xn and the number of pixel rows Pyn, and based on the number of pixels in each row P Xn and the number of pixel rows Pyn, calculate the number of pixels Pn contained in the graphic of the surface to be tested.
[0058] When the surface of the side is a regular square, rectangle or other regular shape, the number of pixels in each row P can be Xn and the number of pixel rows Pyn for corresponding calculations; when the surface of the side is an irregular shape, the number of pixels in each row P Xn Add.
[0059] And, determining the number of pixels inside the overall edge contour further includes: when the area measurement mode is the second measurement mode, determining the total number of complete pixels inside the overall edge contour, and determining the pixel ratio value of each incomplete pixel inside the overall edge contour, and calculating the sum of all pixel ratio values, and determining the total number of complete pixels corresponding to all incomplete pixels based on the sum, and taking the sum of the total number of complete pixels and the total number of complete pixels corresponding to all incomplete pixels as the number of pixels inside the overall edge contour; wherein the pixel ratio value is used to represent the ratio of the pixel area of the incomplete pixel to the pixel area of the complete pixel.
[0060] For example, when the area measurement mode is the second measurement mode, the total number of complete pixels inside the overall edge contour is determined to be 1000, and the pixel ratio value of each incomplete pixel inside the overall edge contour is determined (for example, the pixel ratio value of the first incomplete pixel at the edge is 10%, the pixel ratio value of the second incomplete pixel at the edge is 60, etc.), and the total value of all pixel ratio values is calculated to be 850%, and based on the total value, the total number of complete pixels corresponding to all incomplete pixels is determined to be 8.5, so that the number of pixels inside the overall edge contour is finally determined to be 1008.5,
[0061] Step S130 , substituting the current effective distance into the linear proportional relationship between the area of a single pixel and the measured distance, to obtain the area of a single pixel corresponding to the current effective distance.
[0062] It should be understood that the process of obtaining the linear proportional relationship can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0063] Optionally, when the measuring distance is the first standard measuring distance, a second image including the laser point and the designated square in the camera vision calibration plate illuminated by the laser point is obtained, and the second image is processed to determine the first image area corresponding to the designated square, and the number of pixel rows and the number of pixels in each row corresponding to the first image area are determined, and based on the number of pixel rows and the number of pixels in each row corresponding to the first image area, the area of a single pixel corresponding to the first standard measuring distance is determined; when the measuring distance is the second standard measuring distance, a third image including the laser point and the designated square in the camera vision calibration plate illuminated by the laser point is obtained, and the third image is processed to determine the second image area corresponding to the designated square, and the number of pixel rows and the number of pixels in each row corresponding to the second image area are determined, and based on the number of pixel rows and the number of pixels in each row corresponding to the second image area, the area of a single pixel corresponding to the second standard measuring distance is determined; a linear proportional relationship is constructed based on the area of the single pixel corresponding to the first standard measuring distance and the area of the single pixel corresponding to the second standard measuring distance.
[0064] In order to facilitate understanding of the process of obtaining the linear proportional relationship, a specific embodiment is used for description below.
[0065] Specifically, a standard measured surface can be optionally set, and a camera vision calibration plate is set on the standard measured surface. The calibration plate is composed of square grids of at least two colors of the same size and with distinct light and dark contrasts that are arranged at intervals from each other. For details, see Figure 2 Also, the measuring tool can be used to measure the side length of a single square grid to obtain the side length a of a single square grid, and the area S of a single square grid can be calculated according to the square area formula. a And, a laser rangefinder equipped with a monocular camera is prepared, and a first standard measurement distance d can be preset, and the laser rangefinder is placed at the first standard measurement distance. Among them, the side length a can be 100 mm, etc.
[0066] Then, the image processing step is as follows: the laser rangefinder can be turned on, the laser is aimed at one of the dark square grids, the image of the laser irradiation point is obtained through the monocular camera, and the obtained image is processed to obtain the number of pixel rows and the number of pixels in each row in the dark square grid.
[0067] The image processing method specifically includes the following steps: binarizing the image captured by the monocular camera so that the image contains only black and white colors; identifying the edge information of the dark square grid in the area where the laser point is located, and obtaining the overall outline of the dark square grid through the image edge algorithm; differentiating the identified image into pixels for calculation, dividing the image to be tested into multiple rows, and calculating the number of pixels in each row to obtain the number of pixels P in each row. X , and the number of pixel rows P y .
[0068] Then, the step of calculating the area of a single pixel is as follows: According to the side length a of the square, the distance of a single pixel on the X axis of the first standard measurement distance d is calculated as L x =a / P x (mm), the distance on the Y axis is L x =a / P y (mm), then calculate the area S of a single pixel according to the area formula 单 =L x *L x .
[0069] And, the second standard measurement distance d', and d' is greater than d, the laser rangefinder is placed at the second standard measurement distance. Then repeat the above image processing steps and the calculation steps of the area of a single pixel, and obtain the distance of a single pixel on the X axis of the second standard measurement distance as Lx’ =a / P x’ (mm), the distance on the Y axis is L y’ =a / P y’ (mm), then calculate the area S of a single pixel according to the area formula 单’ =L x’ *L y’ .
[0070] Then, the linear proportional relationship between the single pixel size and the measured distance represented by the first standard measured distance and the second standard measured distance can be used to obtain any measured distance d n The size L represented by the pixel xn (mm) and L yn (mm), and then any measurement distance d can be obtained n The area of a single pixel is L xn *L yn .
[0071] Among them, L xn and L yn The expression is as follows:
[0072]
[0073]
[0074] For example, when the first standard measurement distance is 5 meters and the second standard measurement distance is 10 meters, n The pixel side length at distance is:
[0075]
[0076]
[0077] Therefore, the above current effective distance can be used as d n Substitute into L xn *L yn In the calculation formula, the area of a single pixel corresponding to the current effective distance can be obtained.
[0078] Step S140, calculating the product of the number of pixels and the area of a single pixel corresponding to the current effective distance, and using the product as the area of the surface to be measured.
[0079] Furthermore, the process of measuring the area of an object with a concave-convex surface is described below.
[0080] Because the application environment and purpose of the laser rangefinder of this application mainly measure the area of an object, rather than the surface area of the object, this application only considers the area of the figure surrounded by its edge for objects with concave and convex surfaces. And considering that the concave and convex surface of the object will affect the accuracy of the laser rangefinder module in obtaining the depth of field distance, it is necessary to add the following two corresponding depth of field distance acquisition methods, specifically:
[0081] The first method is to build an angle measurement module into the laser rangefinder, and obtain the depth of field distance through the laser rangefinder's laser rangefinder. Specifically:
[0082] An angle measurement module such as an electronic gyroscope is provided in the laser rangefinder for measuring the tilt angle of the laser rangefinder;
[0083] And, during actual measurement, the calibrated laser rangefinder is horizontally (angle is 0) aimed at the surface of the object to be measured, and the laser is vertically irradiated into the area of the object to be measured, and the actual image surrounded by the laser point and the edge of the object to be measured is obtained by the monocular camera;
[0084] and, finding the laser point and marking the position of the laser point in the image;
[0085] And, binarization is performed on the actual image so that the image contains only black and white colors;
[0086] And, identifying the edge information of the area where the laser point is located, obtaining the overall outline of the graphic of the surface to be measured through the image edge algorithm, and outputting the graphic outline through the display screen of the rangefinder for the user to refer to whether it is the graphic outline of the surface to be measured;
[0087] And, the identified image is differentiated, and the image is divided into multiple rows in units of pixels, and the number of pixels in each row is calculated to obtain the number of pixels in each row P Xn , and the number of pixel rows P yn , and based on the number of pixels in each row P Xn and the number of pixel rows P yn , calculate the number of pixels P contained in the graphic outline of the surface to be measured n ;
[0088] Also, the current angle position of the laser rangefinder is used as the origin or calibration position, and the laser rangefinder randomly selects at least two edge points of the object to be measured (when selecting edge measurement points, they can be selected according to the positions that the user believes can improve the accuracy during use) as distance measurement points without changing the current position and height, and the rangefinder is tilted at a certain angle until the laser is projected onto the first distance measurement point on the edge of the object to be measured, and the current distance D is obtained. n1, and record the current inclination angle α1 relative to the calibration position, so as to form a spatial right triangle between the laser rangefinder, the first distance measurement point and the laser origin. According to the cosine theorem, the vertical distance d1=D between the laser rangefinder and the object to be measured is calculated. n1 *cosα1, then project the laser to the second distance measurement point to obtain the current distance D n2 , and record the current inclination angle α2 relative to the calibration position. Similarly, according to the cosine theorem, the vertical distance d2=D between the laser rangefinder and the object to be measured is calculated. n2 *cosα2, ..., then take the average of multiple results to get the depth of field distance d between the laser rangefinder and the object to be measured n ;
[0089] And, according to the linear proportional relationship between the single pixel area and the measurement distance calculated above, the area S of a single pixel at the current measurement distance is calculated. 单n ;
[0090] The area of a single pixel S 单n Multiply by the total number of pixels P contained in the graph to be tested n , that is, the area S of the image to be tested is obtained n =S 单n *P n .
[0091] Another method is to obtain the depth of field distance by combining image processing and laser ranging without a built-in angle measurement module. Specifically:
[0092] Aim the rangefinder at the surface to be measured and project the laser into the area of the surface to be measured;
[0093] And, obtaining an actual image including the laser point and the position of the measured surface illuminated by the laser point through a monocular camera;
[0094] and, searching for a laser point in the image, marking the position of the laser point in the image, and defining the laser point as a first laser point;
[0095] And, binarization is performed on the actual image so that the image contains only black and white colors;
[0096] And, edge contour processing step: identify the edge information of the area where the laser point is located, obtain the edge contour of the measured surface through the image edge algorithm, and output the graphic contour through the display screen of the rangefinder for the user to refer to whether it is the contour of the measured surface. The image with edge recognition is defined as a standard image and stored;
[0097] And, the identified image is differentiated, and the image is divided into multiple rows in units of pixels, and the number of pixels in each row is calculated to obtain the number of pixels in each row P Xn , and the number of pixel rows P yn , and based on the number of pixels in each row P Xn and the number of pixel rows P yn , calculate the number of pixels P contained in the graphic outline of the surface to be measured n ;
[0098] And, obtain the current measured distance d through the laser ranging module n , due to the existence of concave and convex surface distance d n There is a large error, so the d n As data for obtaining the offset angle of the laser rangefinder;
[0099] Also, the current angle position of the laser rangefinder is used as the origin or calibration position, and the laser rangefinder randomly selects at least two edge points of the object to be measured (when selecting edge measurement points, the positions that the user believes can improve the accuracy during use) as distance measurement points without changing the current position and height, and projects the laser on the point to obtain the distance c from the laser rangefinder to the point. The monocular camera simultaneously obtains the image information at the point. After the aforementioned image processing, an edge image of the point where the second laser is located is obtained, and the edge image is compared and identified with the standard image in the edge contour processing step, and the position of the second laser point is marked in the standard image. In the standard image, the first laser point is connected with the second laser point. Since the obtained image is a plane image, the first laser point and the second laser point are in the same plane in the annotated image. According to the current distance d n The corresponding image information can be calculated using image algorithms at a distance d n The distance a between the first laser point and the second laser point is thus determined by the tangent theorem, so that the offset angle of the laser rangefinder is tanα=a / d n , and then find the offset angle α. According to the linear relationship of the right triangle, when the laser rangefinder offset angle remains unchanged, if one side increases or decreases, the other sides will also increase or decrease, and the angles remain unchanged. Therefore, according to the cosine theorem, the actual distance d between the laser rangefinder and the object being measured when the laser rangefinder is projected at the second laser point is calculated. n实 =c*cosα, similarly, calculate the depth of field distance at other edge points, and then take the average of multiple results to get the depth of field distance d between the laser rangefinder and the object to be measured n’ ;
[0100] And, according to the linear proportional relationship between the single pixel area and the measurement distance calculated above, the area S of a single pixel at the current measurement distance is calculated. 单n ;
[0101] And, the area S of a single pixel 单n Multiply by the total number of pixels P contained in the graph to be tested n , that is, the area S of the image to be tested is obtained n =S 单n *P n .
[0102] In summary, through the method of the present application, it is only necessary to aim the laser rangefinder at the object to be measured, without any other auxiliary tools, to directly measure the area of the shape to be measured, and it can measure the area of any polygon or irregular figure, which is more convenient to use.
[0103] It should be understood that the above-mentioned laser rangefinder polygon area measurement method is only exemplary, and those skilled in the art can make various modifications based on the above-mentioned method, and the modified or deformed content is also within the protection scope of this application.
[0104] Second embodiment
[0105] See also Figure 3 , Figure 3 The structure block diagram of a laser rangefinder 300 provided in an embodiment of the present application is shown. Specifically, the laser rangefinder 300 includes:
[0106] Monocular camera 310;
[0107] The laser ranging module 320 is communicatively connected with the monocular camera 310. The laser ranging module 320 is used to execute the laser rangefinder polygon area measurement method described in the first embodiment. For details, please refer to the relevant description of the first embodiment and will not be repeated here.
[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0109] The present application also provides a storage medium, on which a computer program is stored. When a processor runs the computer program, the method described in the method embodiment is executed.
[0110] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the method embodiment.
[0111] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.
[0113] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.
[0114] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0115] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0116] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.
Claims
1. A method for measuring polygonal area using a laser rangefinder, characterized in that: The laser rangefinder polygon area measurement method is applied to a laser rangefinder module in the laser rangefinder, wherein the laser rangefinder comprises a monocular camera and the laser rangefinder module; The laser rangefinder polygon area measurement method comprises: Acquire the current effective distance to the measured object and a first image including a laser point and a surface to be measured of the measured object illuminated by the laser point; wherein the first image is obtained by photographing the monocular camera, and the surface to be measured of the measured object is a polygon; Performing contour detection on the first image based on the laser points to obtain the overall edge contour of the surface to be measured, and determining the number of pixels inside the overall edge contour; Substituting the current effective distance into a linear proportional relationship between the area of a single pixel and the measured distance, to obtain the area of a single pixel corresponding to the current effective distance; Calculate the product value of the number of pixels and the area of a single pixel corresponding to the current effective distance, and use the product value as the area of the surface to be measured; The obtaining of the current effective distance to the measured object comprises: When the laser rangefinder is aimed at the measured surface and the laser is projected into the measured surface area, an actual image including the laser point and the position of the measured surface illuminated by the laser point is obtained through the monocular camera; Searching for the laser point in the actual image, marking the position of the laser point in the actual image, and defining the laser point as a first laser point; Binarization is performed on the actual image so that the image contains only black and white colors; Edge contour processing step: identifying edge information of the area where the laser point is located, obtaining the edge contour of the measured surface through an image edge algorithm, and outputting the edge contour through the display screen of the laser rangefinder for the user to refer to whether it is the contour of the measured surface, and defining the image for edge recognition as a standard image and storing it; The standard image is differentiated, and the standard image is divided into multiple rows in units of pixels, and the number of pixels in each row of the multiple rows is calculated to obtain the number of pixels in each row. P Xn , and the number of pixel rows P yn , and based on the number of pixels in each row P Xn And the number of pixel rows P yn , calculate the number of pixels contained in the graphic outline of the surface to be measured P n ; The current measured distance is obtained by the laser rangefinder d n , and the d n As data for obtaining the offset angle of the laser rangefinder; The current angle position of the laser rangefinder is used as the origin or calibration position. Without changing the current position and height of the laser rangefinder, the laser rangefinder randomly selects at least two edge points of the measured object as distance measurement points, and the point where the laser is projected on the distance measurement point is used as the second laser point to obtain the distance from the laser rangefinder to the distance measurement point. c , the image information at the distance measurement point is simultaneously acquired by the monocular camera, and after image processing, an edge image of the second laser point is obtained, and the edge image is compared and identified with the standard image in the edge contour processing step, and the position of the second laser point is marked in the standard image, and in the standard image, the first laser point is connected with the second laser point, and in the standard image, the first laser point and the second laser point are in the same plane, according to the current measurement distance d n The corresponding image information is used to calculate the current measurement distance using the image algorithm. d n The distance between the first laser point and the second laser point a , and according to the tangent theorem, the offset angle of the laser rangefinder , find the offset angle , and calculating the actual distance between the laser rangefinder and the measured object when the laser of the laser rangefinder is projected at the second laser point according to the law of cosines Similarly, calculate the depth of field distance at other edge points, and then take the average of multiple results to get the depth of field distance between the laser rangefinder and the object to be measured. d n’ , and the depth of field distance d n’ as the current effective distance.
2. The method for measuring polygonal area using a laser rangefinder according to claim 1, characterized in that: The laser rangefinder comprises an inclination angle measuring device for collecting the inclination angle of the laser rangefinder in real time; Wherein, obtaining the current effective distance to the measured object includes: Determining whether the tilt angle is equal to zero; If the tilt angle is not equal to zero, the product value of the cosine value of the tilt angle and the current measured distance measured by the laser rangefinder is used as the current effective distance; If the tilt angle is equal to zero, the current measured distance is used as the current effective distance.
3. The method for measuring polygonal area using a laser rangefinder according to claim 1, characterized in that: The laser rangefinder comprises a display screen; The step of performing contour detection on the first image based on the laser point to obtain the overall edge contour of the surface to be measured includes: determining a position of the laser point in the first image; Performing binarization processing on the first image to obtain a binarized image; Based on the position of the laser point in the first image, contour detection is performed on the area where the laser point in the binary image is located to obtain a candidate overall edge contour of the surface to be measured; Outputting the candidate overall edge contour through the display screen for the user to refer to whether it is the contour of the surface to be measured; According to a user's confirmation operation on the candidate overall edge contour, the candidate overall edge contour is used as the overall edge contour of the surface to be measured.
4. The method for measuring polygonal area using a laser rangefinder according to claim 3, characterized in that: Performing contour detection on the area where the laser point is located in the binary image based on the position of the laser point in the first image to obtain a candidate overall edge contour of the surface to be measured includes: Based on the change of the position of the laser point in the first image to the grayscale value around the laser point, a candidate overall edge contour of the surface to be measured is determined.
5. The method for measuring polygonal area using a laser rangefinder according to claim 1, characterized in that: The area measurement mode of the area of the surface to be measured includes a first measurement mode and a second measurement mode, and the measurement accuracy of the second measurement mode is better than the measurement accuracy of the first measurement mode; Wherein, determining the number of pixels inside the overall edge contour includes: When the area measurement mode is the first measurement mode, the total number of incomplete pixels and complete pixels inside the overall edge contour is determined, and the total number is used as the number of pixels inside the overall edge contour.
6. The method for measuring polygonal area using a laser rangefinder according to claim 5, characterized in that: Determining the number of pixels inside the overall edge contour further includes: When the area measurement mode is the second measurement mode, the total number of complete pixels inside the overall edge contour is determined, and the pixel ratio value of each incomplete pixel inside the overall edge contour is determined, and the sum value of all pixel ratio values is calculated, and the total number of complete pixels corresponding to all the incomplete pixels is determined based on the sum value, and the sum of the total number of complete pixels and the total number of complete pixels corresponding to all the incomplete pixels is used as the number of pixels inside the overall edge contour; wherein the pixel ratio value is used to represent the ratio of the pixel area of the incomplete pixel to the pixel area of the complete pixel.
7. The method for measuring polygonal area using a laser rangefinder according to claim 1, characterized in that: The process of obtaining the linear proportional relationship includes: When the measured distance is the first standard measurement distance, a second image including the laser point and a designated square in the camera vision calibration plate illuminated by the laser point is acquired, and the second image is processed to determine a first image area corresponding to the designated square, and the number of pixel rows and the number of pixels in each row corresponding to the first image area are determined, and based on the number of pixel rows and the number of pixels in each row corresponding to the first image area, an area of a single pixel corresponding to the first standard measurement distance is determined; When the measured distance is the second standard measurement distance, a third image including the laser point and a designated square in the camera vision calibration plate illuminated by the laser point is obtained, and the third image is processed to determine a second image area corresponding to the designated square, and the number of pixel rows and the number of pixels in each row corresponding to the second image area are determined, and based on the number of pixel rows and the number of pixels in each row corresponding to the second image area, an area of a single pixel corresponding to the second standard measurement distance is determined; The linear proportional relationship is constructed based on the area of a single pixel corresponding to the first standard measurement distance and the area of a single pixel corresponding to the second standard measurement distance.
8. A laser rangefinder, characterized in that: include: Monocular camera; A laser ranging module, wherein the laser ranging module is communicatively connected to the monocular camera, and the laser ranging module is used to execute the laser rangefinder polygon area measurement method according to any one of claims 1 to 7.
9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the polygon area measurement method of a laser rangefinder according to any one of claims 1 to 7 is executed.
10. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the laser rangefinder polygon area measurement method as described in any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Method and device for measuring percolating water area of shield tunnel lining segment
CN102679914A
Monocular vision-based object size detection method and system, and storable medium
CN115540750A