Method and device for measuring diameter at breast height of stumpage, computer equipment and storage medium
By setting up rectangular positioning markers at the four corners of the standing tree's breast height area, and combining camera parameters and image processing technology, the breast diameter of the standing tree can be accurately calculated, solving the problems of low efficiency and large error in existing technologies, and realizing efficient and accurate breast diameter measurement.
Patent Information
- Application Number
- CN202511653225.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-11-12
AI Technical Summary
Existing techniques for measuring the diameter at breast height (DBH) of standing trees suffer from problems such as low efficiency, high labor intensity, and large measurement errors, making it impossible to balance efficiency and accuracy.
By setting up rectangular positioning markers with four corner points in the target breast height area of the standing tree to be measured, taking images of the standing tree with a camera and obtaining the camera's inherent parameters and the actual size information of the positioning markers, establishing an image space coordinate system, identifying the pixel positions of the tree trunk image and the positioning markers, determining the spatial pose parameters of the camera, and accurately calculating the diameter of the breast height section.
It enables efficient and accurate measurement of standing tree diameter at breast height (DBH), adapts to complex terrain, reduces labor intensity, improves measurement efficiency, and meets the accuracy requirements of forestry surveys.
Smart Images

Figure CN121544688A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of forest resource survey technology, and in particular to a method, apparatus, computer equipment, and storage medium for measuring the diameter at breast height (DBH) of standing trees. Background Technology
[0002] Diameter at breast height (DBH, the diameter of a tree trunk at 1.3 meters above the ground) is a core indicator in forestry surveys, and its measurement accuracy plays a decisive role in the reliability of resource assessment. However, traditional measurement methods and existing technologies have significant limitations.
[0003] Current techniques for measuring the diameter at breast height (DBH) of standing trees are mainly divided into two categories: contact measurement and non-contact measurement. Contact measurement, represented by manually holding a diameter gauge or calipers close to the tree trunk, relies heavily on manual operation. In practice, this method is not only inefficient and labor-intensive, but also difficult to carry out smoothly in complex terrain conditions such as steep slopes and dense forests. Furthermore, the manual reading process is prone to subjective errors, leading to poor consistency in data obtained by different surveyors and compromising the accuracy and reliability of the measurement results.
[0004] Non-contact measurement methods include laser ranging and conventional image measurement. Laser ranging requires multiple acquisitions of distance data from the tree trunk surface to fit the diameter; however, the uneven surface of tree trunks significantly impacts measurement results, increasing errors. Furthermore, the high cost of laser ranging equipment limits its widespread application. Conventional image measurement calculates the diameter by extracting the outline from images of the tree trunk; however, the lack of a clear dimensional reference makes it impossible to establish a precise correlation between pixels and actual dimensions, resulting in significant measurement errors and failing to meet the stringent accuracy requirements of forestry surveys.
[0005] In summary, existing techniques for measuring the diameter at breast height (DBH) of standing trees have significant shortcomings and cannot balance efficiency and accuracy. Therefore, there is an urgent need for an efficient and accurate DBH measurement solution for standing trees. Summary of the Invention
[0006] Therefore, the purpose of this application is to provide a method for measuring the diameter at breast height (DBH) of standing trees, so as to achieve efficient and accurate measurement of DBH of standing trees.
[0007] The method for measuring the diameter at breast height (DBH) of standing trees described in this application includes the following steps: The system acquires images of standing trees captured by a camera, as well as the camera's inherent parameters and the actual size information of the positioning markers. The standing tree image includes the trunk of the tree to be measured and two positioning markers placed on the target breast height area of the trunk. Each positioning marker is a rectangular marker with four corner points. Identify the tree trunk image in the standing tree image, and identify the pixel positions of each corner point of the positioning mark in the standing tree image; calculate the image size information of the positioning mark in the standing tree image based on the pixel positions; establish a first image space coordinate system based on the pixel positions, the image size information, and the actual size information. Based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information, the spatial pose parameters of the camera relative to the first image space coordinate system are determined; Based on the first image spatial coordinate system and the spatial pose parameters, the projection image of the breast height section of the standing tree to be measured in the tree trunk image is determined; based on the edge pixels of the projection area, the diameter of the breast height section is calculated as the diameter at breast height of the standing tree to be measured.
[0008] In the measurement preparation stage, rectangular positioning markers with four corner points are set up in the area of the target standing tree at breast height. An image of the standing tree, including the trunk and positioning markers, is captured using a camera. Simultaneously, the camera's inherent parameters and the actual size information of the positioning markers are obtained. This preliminary work lays the foundation for subsequent accurate measurement. Compared to traditional contact measurement methods that require manual operation of diameter measuring tools in complex terrain, the preliminary preparation in this embodiment is simpler, more efficient, and not limited by terrain. In the image processing stage, the pixel positions of the tree trunk and each corner point of the positioning markers are accurately identified in the standing tree image, and the size information of the positioning markers in the image is calculated accordingly, thereby establishing a first image space coordinate system. This process utilizes image recognition technology, avoiding subjective errors from manual readings and greatly ensuring data consistency. Simultaneously, the spatial pose parameters of the camera relative to the first image space coordinate system are determined based on the camera's inherent parameters, the pixel positions of the positioning markers, and the actual size information. This step fully considers the spatial state of the camera during the shooting process, providing crucial support for accurately obtaining breast height cross-sectional information and effectively overcoming the problem of inaccurate pixel-to-actual size correlation caused by the lack of a size reference in ordinary image measurement methods. Finally, based on the established first image space coordinate system and camera spatial pose parameters, the projection image of the section of the standing tree at breast height (DBH) to be measured in the trunk image is accurately determined. Then, through detailed analysis and processing of the edge pixels of the projection area, the diameter of the DBH section is accurately calculated as the diameter at breast height (DBH). The entire measurement process does not require multiple acquisitions of trunk surface distance data, avoiding the problem of laser ranging being greatly affected by the unevenness of the trunk surface. It also eliminates the need for manual operation close to the trunk, reducing labor intensity and improving measurement efficiency. Moreover, through rigorous coordinate system establishment and pose parameter determination, as well as precise pixel analysis, the measurement results are accurate and reliable, meeting the stringent accuracy requirements of forestry surveys. In summary, the embodiments of this application, from measurement preparation and image processing to the final DBH calculation, achieve efficient, accurate, and adaptable DBH measurement for standing trees in complex terrain through close cooperation and synergistic optimization of each step.
[0009] This application embodiment also provides a standing timber diameter at breast height (DBH) measuring device, including: The system acquires images of standing trees captured by a camera, as well as the camera's inherent parameters and the actual size information of the positioning markers. The standing tree image includes the trunk of the tree to be measured and two positioning markers placed on the target breast height area of the trunk. Each positioning marker is a rectangular marker with four corner points. Identify the tree trunk image in the standing tree image, and identify the pixel positions of each corner point of the positioning mark in the standing tree image; calculate the image size information of the positioning mark in the standing tree image based on the pixel positions; establish a first image space coordinate system based on the pixel positions, the image size information, and the actual size information. Based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information, the spatial pose parameters of the camera relative to the first image space coordinate system are determined; Based on the first image spatial coordinate system and the spatial pose parameters, the projection image of the breast height section of the standing tree to be measured in the tree trunk image is determined; based on the edge pixels of the projection area, the diameter of the breast height section is calculated as the diameter at breast height of the standing tree to be measured.
[0010] This application also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed, it controls the device where the computer-readable storage medium is located to implement the method described in any one of the embodiments of this application.
[0011] This application also provides a computer device, including a processor, a memory, and a computer-readable program stored in the memory, wherein the computer-readable program, when executed by the processor, implements the steps of the method described in any one of the embodiments of this application.
[0012] To better understand and implement this application, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description
[0013] Figure 1 This is a schematic flowchart of the method for measuring the diameter at breast height of standing trees according to an embodiment of this application; Figure 2 A schematic diagram illustrating the steps for establishing a first image space coordinate system in an embodiment of this application; Figure 3 This is a schematic diagram illustrating the steps of determining the spatial pose parameters of the camera relative to the first image space coordinate system in an embodiment of this application. Figure 4 This is a schematic diagram illustrating the method of solving for the diameter using three tangents based on circular geometry in an embodiment of this application. Figure 5 This is a schematic diagram of the structure of a computer device according to an embodiment of this application. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. Wherein, when the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements.
[0015] It should be understood that the embodiments described below do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application.
[0016] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application are also intended to include the plural forms unless the context clearly indicates otherwise. Furthermore, in the description of this application, unless otherwise stated, “a plurality” means two or more. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items, for example, A and / or B, which can represent: A alone, A and B together, and B alone; the character “ / ” generally indicates that the preceding and following objects are in an “or” relationship.
[0017] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, this information should not be limited to these terms, and these terms are only used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. Depending on the context, the word "if" as used in this application can be interpreted as "when," "when," or "in response to determination."
[0018] This application provides a method for measuring the diameter at breast height (DBH) of standing trees, solving the problems of low efficiency, high labor intensity, and large measurement errors in the prior art. Please refer to Figure 1 The method for measuring the diameter at breast height (DBH) of standing trees described in this application includes the following steps: S101: Acquire an image of the standing tree captured by the camera and acquire the inherent parameters of the camera and the actual size information of the positioning markers; wherein, the image of the standing tree includes the trunk of the standing tree to be measured and two positioning markers placed in the target breast height area of the trunk; the positioning markers are rectangular markers with four corner points; S102: Identify the tree trunk image in the standing tree image, and identify the pixel positions of each corner point of the positioning mark in the standing tree image; calculate the image size information of the positioning mark in the standing tree image based on the pixel positions; establish a first image space coordinate system based on the pixel positions, the image size information, and the actual size information; S103: Determine the spatial pose parameters of the camera relative to the first image space coordinate system based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information; S104: Based on the first image spatial coordinate system and the spatial pose parameters, determine the projection image of the breast height section of the standing tree to be measured in the tree trunk image; based on the edge pixels of the projection area, calculate the diameter of the breast height section as the diameter at breast height of the standing tree to be measured.
[0019] In the measurement preparation stage, rectangular positioning markers with four corner points are set up in the area of the target standing tree at breast height. An image of the standing tree, including the trunk and positioning markers, is captured using a camera. Simultaneously, the camera's inherent parameters and the actual size information of the positioning markers are obtained. This preliminary work lays the foundation for subsequent accurate measurement. Compared to traditional contact measurement methods that require manual operation of diameter measuring tools in complex terrain, the preliminary preparation in this embodiment is simpler, more efficient, and not limited by terrain. In the image processing stage, the pixel positions of the tree trunk and each corner point of the positioning markers are accurately identified in the standing tree image, and the size information of the positioning markers in the image is calculated accordingly, thereby establishing a first image space coordinate system. This process utilizes image recognition technology, avoiding subjective errors from manual readings and greatly ensuring data consistency. Simultaneously, the spatial pose parameters of the camera relative to the first image space coordinate system are determined based on the camera's inherent parameters, the pixel positions of the positioning markers, and the actual size information. This step fully considers the spatial state of the camera during the shooting process, providing crucial support for accurately obtaining breast height cross-sectional information and effectively overcoming the problem of inaccurate pixel-to-actual size correlation caused by the lack of a size reference in ordinary image measurement methods. Finally, based on the established first image space coordinate system and camera spatial pose parameters, the projection image of the section of the standing tree at breast height (DBH) to be measured in the trunk image is accurately determined. Then, through detailed analysis and processing of the edge pixels of the projection area, the diameter of the DBH section is accurately calculated as the diameter at breast height (DBH). The entire measurement process does not require multiple acquisitions of trunk surface distance data, avoiding the problem of laser ranging being greatly affected by the unevenness of the trunk surface. It also eliminates the need for manual operation close to the trunk, reducing labor intensity and improving measurement efficiency. Moreover, through rigorous coordinate system establishment and pose parameter determination, as well as precise pixel analysis, the measurement results are accurate and reliable, meeting the stringent accuracy requirements of forestry surveys. In summary, the embodiments of this application, from measurement preparation and image processing to the final DBH calculation, achieve efficient, accurate, and adaptable DBH measurement for standing trees in complex terrain through close cooperation and synergistic optimization of each step.
[0020] The method for measuring the diameter at breast height (DBH) of standing trees described in this application uses a computer as the execution entity. The following provides a detailed description of each step.
[0021] For step S101, the image of the standing tree captured by the camera is obtained, as well as the inherent parameters of the camera and the actual size information of the positioning marks; wherein, the image of the standing tree includes the trunk of the standing tree to be measured and two positioning marks placed in the target breast height area of the trunk; the positioning marks are rectangular marks with four corner points.
[0022] Among them, the camera's inherent parameters are the camera's own characteristic parameters, including focal length, principal point, etc. These parameters determine the geometric characteristics of the camera's imaging and are crucial for subsequent image processing and spatial coordinate transformation.
[0023] The positioning marker is a rectangular marker with four corner points, similar to a QR code but with higher recognition accuracy and robustness. Specifically, the AprilTag system can be used. By encoding unique ID information in the marker pattern and combining it with camera intrinsic parameters, high-precision target positioning and attitude estimation can be achieved.
[0024] This step involves capturing an image of the standing tree using a camera. The image must include the trunk of the tree to be measured and two positioning markers placed at breast height (approximately 1.3 meters above the ground) on the trunk. Rectangular markers with four corner points are used, as this design facilitates precise identification of the corner positions. Simultaneously, the camera's inherent parameters, such as focal length and principal point, are acquired; these parameters can be obtained from the camera manual or through camera calibration. Additionally, the actual dimensions of the positioning markers, i.e., their physical length and width in the real world, are obtained through direct measurement. This step provides the necessary data foundation for subsequent image processing and measurement calculations.
[0025] For step S102, identify the tree trunk image in the standing tree image, identify the pixel position of each corner point of the positioning mark in the standing tree image; calculate the image size information of the positioning mark in the standing tree image based on the pixel position; establish a first image space coordinate system based on the pixel position, the image size information and the actual size information.
[0026] The first image spatial coordinate system is a coordinate system established based on the pixel position of the positioning marker in the image of the standing tree, the image size information, and the actual size information. It is used to describe the spatial positional relationship of objects in the image and to provide a reference framework for subsequent measurements.
[0027] The pixel position identifier marks the pixel coordinates of each corner point in the image of the standing tree. Image recognition algorithms can accurately obtain the horizontal and vertical coordinates of these corner points in the image coordinate system, which reflect the position of the corner points on the two-dimensional image plane.
[0028] The image size information is calculated based on the pixel positions of each corner point of the positioning marker, determining its length and width (in pixels) within the standing tree image. This describes the size of the positioning marker in the image and is one of the important bases for establishing the image's spatial coordinate system.
[0029] Actual size information refers to the physical length and width of the location marker in the real world, which can be obtained through direct measurement. This information reflects the true size of the location marker and, combined with image size information, enables the conversion between image pixels and actual physical dimensions.
[0030] This step primarily involves image processing and coordinate system establishment. First, an image recognition algorithm is used to identify the tree trunk in the standing tree image, separating it from the background. Simultaneously, the pixel positions of each corner point of the positioning marker in the standing tree image are identified, thus determining the coordinates of these corner points in the image coordinate system. Based on these pixel positions, the image size information of the positioning marker in the standing tree image is calculated, such as the length and width of the positioning marker in the image (in pixels). Then, combined with the actual size information of the positioning marker, a first image space coordinate system is established. Specifically, a corner point of the positioning marker is used as the origin, and the coordinate axis directions are determined according to the side length direction of the positioning marker. This associates the pixel positions in the image with the actual physical dimensions, thereby establishing a coordinate system that can describe the spatial position of objects in the image.
[0031] In one embodiment, step S102, the step of identifying the tree trunk image in the standing tree image, includes: Step S1021: The standing tree image is semantically segmented using a preset image segmentation model to obtain a tree trunk image after removing the background.
[0032] Image segmentation models are neural network models trained on large amounts of data to learn feature representations of different objects (including tree trunks and various background elements). When processing images of standing trees, the image segmentation model analyzes each pixel in the image, matching its color, texture, shape, and other features with patterns learned during training. For example, tree trunks typically have specific texture and color features, clearly different from surrounding background elements such as leaves and the ground. The image segmentation model determines whether each pixel belongs to the tree trunk or the background by comparing pixel features with learned feature patterns. Pixels belonging to the tree trunk are labeled as tree trunks; pixels belonging to the background are labeled as background.
[0033] In this embodiment, the image segmentation model can adopt the general image segmentation model Segment Anything Model (SAM). SAM is a general image segmentation model proposed by Meta AI, whose core idea is to achieve fast and accurate segmentation of any image target. This model is trained based on a large-scale visual Transformer (ViT) structure, possessing powerful feature representation and generalization capabilities. Its "Promptable Segmentation" mechanism allows users to efficiently annotate targets in the image through clicking, box selection, or text prompts, enabling the model to complete accurate segmentation without additional training. In forest surveys, this type of model can automatically segment collected forest images, extract target regions such as tree trunks and crowns, and generate high-precision binary mask images, providing data support for parameter inversion, geometric feature extraction, and 3D modeling. Unlike traditional deep learning-based target segmentation models, it has stronger versatility and adaptability, maintaining stable performance under complex backgrounds, lighting changes, and different tree species structures.
[0034] Semantic segmentation is an important task in computer vision, aiming to classify each pixel in an image into different semantic categories. In this embodiment, the goal of semantic segmentation is to distinguish the tree trunk pixels from the background pixels in a standing tree image, thereby obtaining a tree trunk image after removing the background. An image segmentation model analyzes the input standing tree image, assigning a category label (tree trunk or background) to each pixel based on learned features and patterns, ultimately generating a binary image containing only the tree trunk region.
[0035] In this embodiment, images of standing trees captured by a camera are input into a preset image segmentation model. After semantic segmentation, the model outputs a binary mask image, where the pixel values of the tree trunk region are set to a specific value (e.g., 1), and the pixel values of the background region are set to another specific value (e.g., 0). In this way, a tree trunk image with the background removed is obtained. This image retains only the outline and internal pixels of the tree trunk, effectively removing background interference and providing a clear and accurate target region for subsequent measurement calculations. This highlights the characteristics of the target region and greatly improves the automation and consistency of the measurement.
[0036] Please refer to Figure 2 In one embodiment, step S102, which involves establishing a first image space coordinate system based on the pixel position, the image size information, and the actual size information, includes: Step S1022: Determine the center pixel position of the positioning identifier based on the pixel positions of each corner point of the positioning identifier.
[0037] This step is used to determine the center pixel position of the positioning marker. After obtaining the pixel positions of each corner point of the positioning marker in the standing tree image using an image recognition algorithm, the center coordinates of the positioning marker are calculated using these corner coordinates. For example, for a rectangular positioning marker, if the pixel coordinates of its four corner points are (x1, y1), (x2, y2), (x3, y3), and (x4, y4), then the center pixel coordinates (xc, yc) can be calculated using the following formulas: xc = (x1 + x2 + x3 + x4) / 4; yc = (y1 + y2 + y3 + y4) / 4. In this way, the center position of the positioning marker in the image can be accurately obtained, providing a crucial reference point for subsequently establishing a coordinate system.
[0038] Step S1023: Take the center pixel position of any of the positioning marks as the origin of the coordinate system; determine the straight line passing through the center pixel positions of the two positioning marks as the first coordinate axis; determine the straight line passing through the origin of the coordinate system, perpendicular to the first coordinate axis and parallel to the height direction of the standing tree as the second coordinate axis; determine the straight line passing through the origin of the coordinate system, perpendicular to the first coordinate axis and perpendicular to the second coordinate axis as the third coordinate axis; determine the second image space coordinate system based on the first coordinate axis, the second coordinate axis, the third coordinate axis and the first unit length; wherein, the first unit length is 1 pixel in the standing tree image.
[0039] In this embodiment, the first unit length is initially set to 1 pixel in the standing tree image. It is the basic unit of length when constructing the second image space coordinate system and is used to determine the scale intervals on the coordinate axes.
[0040] The second image space coordinate system is a coordinate system consisting of three coordinate axes determined according to specific rules, with the center pixel position of the positioning marker as the origin. Its first unit length is 1 pixel. This coordinate system provides the basic framework for the subsequent conversion to the first image space coordinate system of actual physical size.
[0041] This step first establishes the center pixel position of any positioning marker as the origin of the coordinate system. Then, the directions of the three coordinate axes are determined: the straight line passing through the center pixel positions of the two positioning markers is defined as the first coordinate axis (e.g., the X-axis), reflecting the relative positional relationship of the two positioning markers in the image; the straight line passing through the origin, perpendicular to the first coordinate axis, and parallel to the height direction of the standing tree is defined as the second coordinate axis (e.g., the Y-axis), which aligns with the height direction of the standing tree, providing a vertical reference for subsequent measurements; the straight line passing through the origin, perpendicular to both the first and second coordinate axes is defined as the third coordinate axis (e.g., the Z-axis). The Z-axis, along with the X and Y axes, forms a three-dimensional Cartesian coordinate system. Finally, the scale intervals on the coordinate axes are determined based on a first unit length (one pixel in the standing tree image), thus establishing a second image space coordinate system. This coordinate system, in pixels, describes the relative positional relationship of objects in the image, but is not yet associated with actual physical dimensions.
[0042] Step S1024: Determine the actual physical length corresponding to the pixel based on the ratio between the actual size information of the positioning identifier and the image size information; update the first unit length of the second image space coordinate system to the actual physical length corresponding to the pixel to obtain the first image space coordinate system.
[0043] The first image space coordinate system is derived from the second image space coordinate system by updating the first unit length to the actual physical length corresponding to a pixel based on the proportional relationship between the actual size information of the positioning marker and the image size information. It accurately describes the positional relationship of objects in the image within the actual physical space, providing a precise spatial reference for subsequent operations such as diameter at breast height (DBH) measurement.
[0044] This step first determines the actual physical length corresponding to a pixel based on the ratio between the actual size information of the positioning marker and the image size information. For example, if the actual length of the positioning marker is L(actual), and its length in the image (in pixels) is L(pixels), then the actual physical length l corresponding to the pixel is: l = L(pixels) / L(actual). Then, the first unit length of the second image space coordinate system is updated to the actual physical length l corresponding to the pixel. In this way, the original coordinate system based on pixels is transformed into a coordinate system based on actual physical length, i.e., the first image space coordinate system. This coordinate system can accurately describe the positional relationship of objects in the image within the actual physical space, providing a precise spatial reference for subsequent operations such as diameter at breast height (DBH) measurement, allowing the measurement results to directly reflect the actual size information of the standing tree.
[0045] In this embodiment, a first image space coordinate system is established with high precision and reliability by accurately calculating the center position of the positioning marker, reasonably determining the coordinate axis direction, and accurately converting unit lengths. In subsequent measurement processes, this coordinate system provides a solid foundation for determining camera spatial pose parameters, identifying tree trunk edge pixels, and ultimately calculating the diameter at breast height (DBH). Because the coordinate system accurately reflects the correspondence between image pixels and actual physical dimensions, the determination of camera pose parameters is more accurate, and the identification of tree trunk edge pixels is more precise, thus ensuring the high precision of the DBH measurement results.
[0046] For step S103, the spatial pose parameters of the camera relative to the first image space coordinate system are determined based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information.
[0047] Spatial pose parameters are parameters that describe the position and orientation of the camera in the first image space coordinate system, including rotation matrices and translation vectors, and are used to determine the spatial relationship between the camera and the object being measured.
[0048] This step estimates the initial camera extrinsic parameters based on the camera's inherent parameters, the pixel positions of the positioning markers, and their actual size information, using computer vision algorithms such as the EPnP algorithm. In one embodiment, the EPnP algorithm calculates the camera's pose parameters, including rotation matrices and translation vectors, by matching known 3D coordinates (the actual corner coordinates of the positioning markers) with corresponding 2D points in the image (the pixel coordinates of the positioning marker corners in the image). These parameters describe the camera's position and pose in the first image space coordinate system. Subsequently, optimization algorithms such as CeresSolver optimization can be used for nonlinear least squares optimization to further reduce reprojection errors, thereby obtaining high-precision and stable camera spatial pose parameters.
[0049] Please refer to Figure 3 In one embodiment, the inherent parameters of the camera include focal length, principal point coordinates, and pixel physical size.
[0050] Focal length is a crucial parameter of a camera lens, determining the angle of view of the image. A shorter focal length results in a wider angle of view, allowing for a broader field of view to be captured; a longer focal length results in a narrower angle of view, narrower field of view, but allows for sharper imaging of distant objects. In computer vision and photogrammetry, focal length is a key factor in the transformation between spatial coordinates and image pixel coordinates.
[0051] The principal point coordinates are a special point on the camera's imaging plane, usually located near the imaging center. It is the intersection of the optical axis and the imaging plane. Due to factors such as camera manufacturing and installation, the principal point may not be perfectly located at the imaging center, exhibiting a certain offset. The accuracy of the principal point coordinates is crucial for precisely calculating the relationship between pixel coordinates and spatial coordinates.
[0052] Pixel physical size refers to the actual physical size of each pixel on a camera sensor, usually measured in millimeters (mm). Pixel physical size is related to the camera's resolution and sensor size, establishing a conversion relationship between pixel size and actual physical size, and is the basis for spatial measurement and coordinate transformation.
[0053] Step S103, which involves determining the spatial pose parameters of the camera relative to the first image space coordinate system based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information, includes: Step S1031: Determine the camera's imaging angle based on the focal length parameter; determine the offset between the pixel coordinates and the imaging center based on the principal point coordinates; determine the conversion relationship between the pixel size and the actual physical size based on the pixel physical size; and determine the projection mapping rule from spatial coordinates to image pixel coordinates based on the camera's imaging angle, the offset between the pixel coordinates and the imaging center, and the conversion relationship between the pixel size and the actual physical size.
[0054] This step aims to determine the projection mapping rules from spatial coordinates to image pixel coordinates. First, the camera's imaging angle is determined based on the focal length parameter. The imaging angle is inversely proportional to the focal length; the focal length allows calculation of the camera's imaging angles in the horizontal and vertical directions, thus revealing the range of the scene the camera can capture. Next, the offset between the pixel coordinates and the imaging center is determined based on the principal point coordinates. Since the principal point may not be at the imaging center, this offset will cause a change in the correspondence between image pixel coordinates and actual spatial coordinates. By accurately measuring the principal point coordinates, this offset can be corrected, making subsequent coordinate transformations more accurate. Then, the conversion relationship between pixel size and actual physical size is determined based on the pixel physical size. The pixel physical size reflects the actual size of each pixel on the camera sensor, allowing the conversion of pixel distances in the image to actual physical distances. For example, if the pixel physical size is known to be d (unit: mm / pixel), and the pixel distance between two points in the image is n, then the actual physical distance between these two points is n×d. Finally, by combining the camera's imaging angle, the offset between pixel coordinates and the imaging center, and the conversion relationship between pixel size and actual physical size, the projection mapping rules from spatial coordinates to image pixel coordinates are determined. This rule describes how to project points in three-dimensional space onto a two-dimensional image plane, forming the basis for subsequent camera pose parameter calculation. In this embodiment, the projection mapping model can adopt a pinhole camera model. The pinhole camera model assumes that light rays originate from a spatial point, pass through the camera lens (similar to a pinhole), and are projected onto the imaging plane. A mathematical relationship between spatial coordinates and image pixel coordinates can be established through geometric relationships.
[0055] Step S1032: Based on the pixel position of the positioning identifier and the actual size information, determine the first image space coordinates of each corner point of the positioning identifier in the first image space coordinate system and the second image space coordinates in the second image space coordinate system.
[0056] The first image space coordinate system is obtained by updating the first unit length of the second image space coordinate system to the actual physical length corresponding to the pixel based on the proportional relationship between the actual size information of the positioning mark and the image size information. This coordinate system can accurately describe the positional relationship of objects in the image in the actual physical space.
[0057] The second image space coordinate system is a coordinate system consisting of three coordinate axes determined according to specific rules, with the center pixel position of the positioning marker as the origin. Its first unit length is 1 pixel, and it is mainly used to establish the initial spatial reference frame.
[0058] This step determines the coordinates of each corner point of the positioning marker in different coordinate systems. First, based on the pixel position and actual size information of the positioning marker, the first image space coordinates of each corner point are determined in the first image space coordinate system. Since the first image space coordinate system uses actual physical length as the unit, the coordinates of each corner point in the actual physical space can be accurately calculated by combining the actual size of the positioning marker with the pixel position in the image. Simultaneously, the second image space coordinates of each corner point are determined in the second image space coordinate system. The second image space coordinate system uses pixels as the unit; based on the previously obtained pixel positions of the positioning marker corner points and the definition of the coordinate system, the coordinates of each corner point in this coordinate system can be obtained.
[0059] By obtaining the coordinates of the positioning markers in two different coordinate systems, a necessary data foundation is provided for subsequent solutions to the camera pose parameters. This is because solving for camera pose parameters essentially involves finding a transformation relationship that matches the projection of a point in space onto the camera's imaging plane with the actual measured point in the image. The coordinates of the positioning markers in different coordinate systems provide crucial corresponding points for establishing this transformation relationship.
[0060] Step S1033: Based on the first image space coordinates and the second image space coordinates of each corner point of the positioning identifier and the projection mapping rule, obtain the spatial pose parameters.
[0061] Specifically, given the actual coordinates of the positioning marker in the first image space coordinate system and its pixel coordinates in the second image space coordinate system, as well as the projection mapping rules from spatial coordinates to image pixel coordinates, the spatial pose parameters of the camera can be solved using an optimization algorithm. The goal of the optimization algorithm is to find a set of camera pose parameters (position and orientation) such that the error between the projected coordinates of the positioning marker corner points in the image pixel coordinate system calculated based on these parameters and the projection mapping rules and the actual measured pixel coordinates of the positioning marker corner points is minimized. In this embodiment, the Levenberg-Marquardt algorithm can be used, which is an iterative optimization algorithm capable of quickly converging to the optimal solution when solving nonlinear least squares problems. By continuously adjusting the camera pose parameters, the error between the projected coordinates and the actual pixel coordinates gradually decreases. When the error meets the preset accuracy requirements, the accurate camera spatial pose parameters can be considered obtained. These parameters can accurately describe the position and orientation of the camera in the first image space coordinate system, providing important spatial reference information for subsequent operations such as measuring the diameter at breast height of standing trees.
[0062] This embodiment comprehensively considers factors such as the camera's focal length, principal point, and pixel physical size, as well as the coordinate information of the positioning marker in different coordinate systems. An optimized algorithm is used to accurately solve the camera pose parameters, resulting in high precision and reliability. In subsequent measurement procedures, accurate camera spatial pose parameters provide a solid foundation for identifying tree trunk edge pixels and ultimately calculating the diameter at breast height (DBH). Because the camera's position and orientation in space are precisely known, the actual spatial location of the tree trunk edge pixels in the image can be determined more accurately, thus ensuring high precision in the DBH measurement results.
[0063] In one embodiment, step S1033, which involves obtaining spatial pose parameters based on the first and second image spatial coordinates of each corner point of the positioning identifier and the projection mapping rule, includes: Step S10331: Based on the first and second image space coordinates of each corner point of the positioning marker and the projection mapping rule, the first spatial pose parameters are obtained by using the perspective n-point algorithm.
[0064] The Perspective n-Point (PnP) algorithm is a classic algorithm that solves for camera spatial pose using the known coordinates of n 3D spatial points and their corresponding 2D image points. This embodiment uses a variant of the EPnP algorithm, which utilizes the matching relationship between the spatial coordinates and pixel coordinates of the positioning marker corner points to construct a system of linear equations and solve for the initial pose parameters. It features high computational efficiency and strong noise resistance.
[0065] This step constructs a reprojection error function based on the first image space coordinates (3D physical coordinates) and the second image space coordinates (2D pixel coordinates) of the located corner points, combined with the pinhole camera projection model. The initial pose parameters are solved using the EPnP algorithm. These parameters include the rotation matrix R and the translation vector t, describing the rigid body transformation relationship of the camera from the world coordinate system to the image coordinate system.
[0066] Step S10332: Obtain the first image space coordinates of each corner point of the positioning marker and the third image space coordinates obtained by projecting the first spatial pose parameters.
[0067] Using the obtained first spatial pose parameters, the 3D corner coordinates in the first image space coordinate system are mapped to the image plane through the camera projection model to obtain the third image space coordinates (theoretical projection points). This step verifies the accuracy of the initial pose parameters and provides a benchmark for subsequent optimization.
[0068] Step S10333: When the deviation between the third image spatial coordinates and the second image spatial coordinates is greater than a preset deviation threshold, adjust the first spatial pose parameter until the deviation is less than or equal to the preset deviation threshold; determine that the first spatial pose parameter at this time is the spatial pose parameter of the camera relative to the first image spatial coordinate system.
[0069] The preset deviation threshold is a quantitative standard for measuring the degree of matching between the projected coordinates and the actual pixel coordinates, and is usually set according to the measurement accuracy requirements (e.g., 0.5 pixels). This threshold controls the termination condition of the optimization algorithm, ensuring that the pose parameters converge to a solution that meets the accuracy requirements.
[0070] This step calculates the Euclidean distance deviation between the third image spatial coordinates and the actual second image spatial coordinates. When the deviation exceeds a preset threshold, the Levenberg-Marquardt algorithm is used to adjust the pose parameters to minimize the reprojection error. This iterative process continues until the deviation is less than or equal to the threshold, ultimately determining high-precision camera spatial pose parameters. This optimization mechanism effectively overcomes local errors in the initial solution and improves the robustness of pose estimation.
[0071] This embodiment achieves high-precision estimation of camera spatial pose through a pose-solving strategy combining the PnP algorithm and iterative optimization, laying a solid spatial positioning foundation for measuring the diameter at breast height (DBH) of standing trees. Compared to traditional pose-solving methods, in terms of accuracy, this embodiment effectively eliminates the influence of factors such as camera distortion and marker recognition errors through a reprojection error minimization mechanism, achieving sub-pixel accuracy in pose parameters. Combined with the precise spatial reference provided by positioning markers, the accuracy of the DBH section projection calculation is ensured, ultimately controlling the DBH measurement error to within 1%, far superior to the 5%-10% error level of traditional contact measurements. In terms of efficiency, the linear solution characteristics of the EPnP algorithm and the rapid convergence characteristics of iterative optimization enable the entire pose-solving process to be completed in milliseconds, meeting the timeliness requirements of large-scale measurements in forestry surveys. Furthermore, this scheme requires no manual intervention, achieving a fully automated process from image acquisition to pose solving, significantly reducing manual operation costs. In terms of adaptability, through accurate pose estimation, the scheme can adapt to complex terrain conditions such as steep slopes and dense forests. Even when the camera is tilted at a large angle or the marker is partially obscured, accurate pose parameters can still be recovered through optimized algorithms, ensuring the continuity and reliability of the measurement process. In summary, this embodiment achieves synergistic optimization in accuracy, efficiency, and adaptability in standing tree diameter at breast height (DBH) measurement through innovative pose solving technology, providing efficient and reliable technical support for intelligent monitoring of forest resources.
[0072] For step S104, the projection image of the breast height section of the standing tree to be measured in the trunk image is determined according to the first image spatial coordinate system and the spatial pose parameters; the diameter of the breast height section is obtained as the diameter at breast height of the standing tree to be measured based on the edge pixels of the projection area.
[0073] This step, based on the established first image space coordinate system and the determined camera spatial pose parameters, utilizes the projection transformation principle to determine the projected image of the breast height (BHS) section of the standing tree to be measured in the trunk image. The projection transformation considers the imaging geometry of the camera and the spatial relationship between the camera and the object being measured, accurately projecting the BHS section from three-dimensional space onto the two-dimensional image plane. Then, the edge pixels of the projected area are analyzed and processed, and a suitable algorithm is used to calculate the diameter of the BHS section, which is the diameter at breast height (DBH) of the standing tree to be measured. In one embodiment, a loss function principle minimizing the tangent residual can be established based on circular geometric features, assuming the trunk cross-section is approximately circular, to calculate the diameter of the BHS section.
[0074] In one embodiment, step S104, which involves determining the projection image of the breast height section of the standing tree to be measured in the tree trunk image based on the first image spatial coordinate system and the spatial pose parameters, includes: Step S1041: Based on the spatial pose parameters, determine the projection mapping relationship between the first image spatial coordinate system and the tree trunk image.
[0075] The projection mapping relationship is a 3D to 2D transformation model constructed based on the camera spatial pose parameters and the first image space coordinate system. This relationship is realized through a pinhole camera model, which precisely mathematically expresses the projection position, shape, and scale of the chest height section (a circular plane in 3D space) on the imaging plane, serving as a bridge connecting physical space and image space.
[0076] This step, based on the solved camera spatial pose parameters (rotation matrix R, translation vector t) and combined with the physical unit characteristics of the first image spatial coordinate system, establishes a precise projection mapping between 3D spatial points and image pixels. This is specifically implemented through a camera projection model.
[0077] Step S1042: Based on the projection mapping relationship, determine the projection image of the breast height section of the standing tree to be measured onto the trunk image.
[0078] The breast height (BH) section projection image is a two-dimensional projection of the BH section onto the tree trunk image. Influenced by camera viewpoint, pose, and trunk morphology, this projection may appear as an ellipse or approximately a circle, and its geometric features (such as the major axis and minor axis) contain key information about the diameter at breast height (DBH).
[0079] This step involves projecting the chest-height section (the theoretical plane 1.3m above the ground) onto the tree trunk image based on the projection mapping relationship. First, the three-dimensional spatial position of the chest-height section is determined using the first image space coordinate system. Then, the edge points of this section are projected one by one onto the image plane using the projection mapping model, forming a closed projection region. This projected image directly reflects the actual shape of the chest-height section in the image, providing accurate pixel-level boundaries for subsequent diameter calculation.
[0080] This embodiment achieves cross-dimensional collaborative optimization of standing tree diameter at breast height (DBH) measurement from three-dimensional space to two-dimensional image by accurately constructing projection mapping relationships and precisely calculating the DBH section projection. In terms of accuracy, the projection model based on high-precision pose parameters eliminates the influence of perspective distortion on DBH measurement, ensuring a strict geometric correspondence between the section boundary in the projected image and the actual DBH, with measurement errors consistently controlled within 1%. In terms of efficiency, projection calculations are completed in milliseconds through matrix operations, supporting real-time measurement scenarios and meeting the timeliness requirements of large-scale forestry surveys. In terms of adaptability, this scheme effectively overcomes the problem of perspective changes caused by complex terrain (such as steep slopes and dense forests) through precise projection mapping relationships. Even with large camera tilt angles or irregular tree trunk surfaces, the accurate projection of the DBH section can still be recovered through a mathematical model. In summary, this embodiment achieves a comprehensive breakthrough in accuracy, efficiency, and adaptability in standing tree DBH measurement through the collaborative optimization of three-dimensional and two-dimensional projections, providing highly reliable technical support for intelligent monitoring of forest resources.
[0081] In one embodiment, step S104, which involves calculating the diameter of the breast height section as the diameter at breast height of the standing tree to be measured based on the edge pixels of the projection area, includes: Step S1043: Determine the fourth image space coordinates of each edge pixel point of the projection area in the second image space coordinate system.
[0082] The fourth image space coordinates are the precise coordinates of the edge pixels of the projected region within the second image space coordinate system (the initial coordinate system in pixels). These coordinates are obtained directly through the transformation relationship between the image coordinate system and the second coordinate system, preserving pixel-level spatial resolution and providing basic data for subsequent 3D reconstruction.
[0083] This step uses the tree trunk edge contour obtained by the image segmentation model, combined with the definition of the second coordinate system (the origin is the center of the positioning marker, and the coordinate axes are aligned with the height direction of the tree), to directly read the pixel coordinates of the edge points as the fourth image space coordinates. For example, if the coordinates of an edge point in the image are (200, 300), then its coordinates in the second coordinate system are (200, 300, 0) (the Z-axis is 0 by default because the second coordinate system is a two-dimensional planar coordinate system).
[0084] Step S1044: Determine the function of at least three tangents of the chest height section in the first image space coordinate system based on the fourth image space coordinates of each edge pixel and the spatial pose parameters.
[0085] The tangent function is a linear equation constructed based on the geometric characteristics of the chest height section. By back-projecting the two-dimensional edge points into three-dimensional space using spatial pose parameters, and combining the cross-sectional plane equation, the tangent expression is derived. Each tangent line reflects the instantaneous contact relationship between the cross-section and the imaging plane.
[0086] This step uses spatial pose parameters (rotation matrix R, translation vector t) to backproject the spatial coordinates of the fourth image onto the spatial coordinate system of the first image (three-dimensional physical coordinate system). Assuming the chest-height section is a horizontal plane 1.3m above the ground, its three-dimensional equation can be expressed as Z_w = 1.3. Using a pinhole camera model, a mapping relationship is established between the two-dimensional edge points (P_x, P_y) and the three-dimensional points (X_w, Y_w, Z_w).
[0087] Step S1045: Construct a set of geometric constraint equations for the circle based on the functions of the at least three tangents, and solve the circle's diameter using a fitting algorithm; determine the diameter of the circle as the diameter at breast height (DBH) of the standing tree to be measured.
[0088] The geometric constraint equations are a mathematical model for circle fitting, consisting of at least three simultaneous tangent equations. A nonlinear equation system is constructed using the geometric relationship between the tangent and the circle (e.g., the radius at the point of tangency is perpendicular to the tangent), and the circle parameters are ultimately solved through optimization.
[0089] This embodiment achieves a closed-loop accuracy process for diameter at breast height (DBH) measurement by precisely extracting edge pixel coordinates, mapping 3D and 2D tangents, and fitting circular geometric constraints. In terms of accuracy, the tangent function is constructed based on high-precision pose parameters and physical coordinate system transformation, eliminating the influence of perspective distortion on the cross-sectional shape. The circular fitting algorithm ensures that the circular parameters converge to the global optimum through multiple tangent constraints, keeping the measurement error stably within 0.5%, significantly better than the 5%-10% error range of traditional methods. In terms of efficiency, the entire process from edge coordinate extraction to circular fitting is automated, meeting the timeliness requirements of large-scale forestry surveys. Simultaneously, pixel-level positioning in the second image space coordinate system avoids subjective errors caused by manual intervention, improving data consistency. In terms of adaptability, this scheme effectively overcomes the problem of perspective changes caused by complex terrain (such as steep slopes and dense forests) through 3D and 2D collaborative optimization. Even with large camera tilt angles or irregular tree trunk surfaces, the accurate shape of the DBH cross-section can still be restored through precise projection mapping and geometric constraints, ensuring the continuity and reliability of the measurement process.
[0090] In this embodiment, let the pixel coordinates be:
[0091] Then its direction vector in the camera coordinate system is: Cn
[0092] in The interior orientation element matrix of the camera consists of focal length and principal image point:
[0093] in, , For camera focal length, This is the principal point.
[0094] Let the rotation matrix and translation vector from the world coordinate system (i.e., the first image space coordinate system) to the camera coordinate system be... If C tW , then the direction vector in the world coordinate system is expressed as: W n = Cn According to the properties of rotation matrices, then:
[0095] Therefore, Wn = Cn =
[0096] In summary, the ray corresponding to pixel coordinate u passes through the camera optical center, and the spatial coordinates of the camera optical center in the world coordinate system are: WtC CtW A point on the ray can then be represented as: WtC + s Wn (1) Where s is a variable scalar. Assuming the Z-axis of the world coordinate system is parallel to the Z-axis of the tree trunk cylinder, the Z-axis in formula (1) is discarded, and two-dimensional planar coordinates are obtained. Therefore, let the center of the circle to be estimated be... Breast diameter Then the tangent L has: ‖(x0 - WtC) × Wn‖= d / 2 For the tangent line L formed by the line containing the X-axis in the world coordinate system, since WtC = (0 0)T, Wn = (10)T, and let m = Wn = (1 0)T, it can be written as: ‖x0 × m‖ = d / 2. 3 tangent lines (such as...) Figure 4 (As shown) By combining the above equations, we can obtain the estimated value.
[0097] This application embodiment also provides a standing timber diameter at breast height (DBH) measuring device, including: The system acquires images of standing trees captured by a camera, as well as the camera's inherent parameters and the actual size information of the positioning markers. The standing tree image includes the trunk of the tree to be measured and two positioning markers placed on the target breast height area of the trunk. Each positioning marker is a rectangular marker with four corner points. Identify the tree trunk image in the standing tree image, and identify the pixel positions of each corner point of the positioning mark in the standing tree image; calculate the image size information of the positioning mark in the standing tree image based on the pixel positions; establish a first image space coordinate system based on the pixel positions, the image size information, and the actual size information. Based on the inherent parameters, the pixel position of the positioning identifier, and the actual size information, the spatial pose parameters of the camera relative to the first image space coordinate system are determined; Based on the first image spatial coordinate system and the spatial pose parameters, the projection image of the breast height section of the standing tree to be measured in the tree trunk image is determined; based on the edge pixels of the projection area, the diameter of the breast height section is calculated as the diameter at breast height of the standing tree to be measured.
[0098] It should be noted that the standing timber diameter at breast height (DBH) measuring device provided in this application embodiment is only illustrated by the above-described division of functional modules when performing the standing timber DBH measurement method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the standing timber DBH measuring device provided in this application embodiment and the standing timber DBH measurement method in this application embodiment belong to the same concept, and their implementation process is detailed in the method embodiment, which will not be repeated here.
[0099] The embodiments of the standing tree diameter at breast height (DBH) measuring device of this application can be applied to computer devices, such as computer equipment. These devices can be implemented through software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by a processor that reads and executes corresponding computer program instructions from memory. From a hardware perspective, the computer device in which it resides may include a processor and memory, which are interconnected via a data bus or other known methods.
[0100] Please refer to Figure 5 This application also discloses a computer device 401, including a memory 402, a processor 403, and a computer program 404 stored on the memory 402. The processor 403 executes the computer program 404 to implement the method described in any of the above embodiments applied to a server or smart lock.
[0101] The processor 403 may include one or more processing cores. The processor 403 connects to various parts within the computer device 401 using various interfaces and lines. It executes various functions of the computer device 401 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 402, and by calling data from the memory 402. Optionally, the processor 403 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 403 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required to be displayed on the touch screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 403 and may be implemented as a separate chip.
[0102] The memory 402 may include random access memory (RAM) or read-only memory. Optionally, the memory 402 may include a non-transitory computer-readable storage medium. The memory 402 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch instructions), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 402 may also be at least one storage device located remotely from the aforementioned processor 403.
[0103] This application also discloses a computer-readable storage medium storing a computer program thereon. When the computer program is executed, it controls the device where the computer-readable storage medium is located to implement the method described in any of the above embodiments. That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The computer program may include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The aforementioned storage medium includes: any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in computer-readable media may be appropriately added to or subtracted from the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, computer-readable media may not include electrical carrier signals and telecommunication signals, in accordance with legislation and patent practice.
[0104] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method of measuring the diameter at breast height of a standing tree, characterized by, The method comprises the following steps: obtaining a standing tree image captured by a camera and obtaining intrinsic parameters of the camera and actual size information of a positioning mark; wherein the standing tree image comprises a tree trunk of a standing tree to be measured and two positioning marks arranged in a target breast height area of the tree trunk; the positioning mark is a rectangular mark with four corner points; identifying a tree trunk image in the standing tree image, identifying pixel positions of the corner points of the positioning mark in the standing tree image, calculating image size information of the positioning mark in the standing tree image according to the pixel positions, and establishing a first image space coordinate system according to the pixel positions and the image size information and the actual size information; determining a space pose parameter of the camera relative to the first image space coordinate system according to the intrinsic parameters, the pixel positions of the positioning mark and the actual size information; determining a projection image of a breast height section of the standing tree to be measured in the tree trunk image according to the first image space coordinate system and the space pose parameter, and solving a diameter of the breast height section as a breast diameter of the standing tree to be measured according to edge pixel points of the projection region.
2. The standing tree breast diameter measurement method according to claim 1, wherein the step of identifying the tree trunk image in the standing tree image comprises: performing semantic segmentation processing on the standing tree image through a pre-set image segmentation model to obtain a tree trunk image after removing the background.
3. The standing tree breast diameter measurement method according to claim 1, wherein the step of establishing the first image space coordinate system according to the pixel positions, the image size information and the actual size information comprises: determining a center pixel position of the positioning mark according to the pixel positions of the corner points of the positioning mark; taking the center pixel position of any positioning mark as an origin of the coordinate system, determining a first coordinate axis as a straight line passing through the center pixel positions of the two positioning marks, determining a second coordinate axis as a straight line passing through the origin of the coordinate system, perpendicular to the first coordinate axis and parallel to the height direction of the standing tree, determining a third coordinate axis as a straight line passing through the origin of the coordinate system, perpendicular to the first coordinate axis and perpendicular to the second coordinate axis, and determining a second image space coordinate system according to the first coordinate axis, the second coordinate axis, the third coordinate axis and a first unit length; wherein the first unit length is 1 pixel in the standing tree image; determining a physical length corresponding to a pixel according to a proportional relationship between the actual size information and the image size information of the positioning mark, updating the first unit length of the second image space coordinate system to the physical length corresponding to the pixel to obtain the first image space coordinate system.
4. The standing tree breast diameter measuring method according to claim 3, characterized by, The intrinsic parameters of the camera include focal length parameters, image principal point coordinates and pixel physical size; the step of determining the space pose parameter of the camera relative to the first image space coordinate system according to the intrinsic parameters, the pixel positions of the positioning mark and the actual size information comprises: determine an imaging view angle of the camera according to the focal length parameter; determine a deviation of a pixel coordinate from an imaging center according to the image principal point coordinate; determine a conversion relationship between a pixel size and an actual physical size according to the pixel physical size; and determine a projection mapping rule of a spatial coordinate to an image pixel coordinate according to the imaging view angle of the camera, the deviation of the pixel coordinate from the imaging center, and the conversion relationship between the pixel size and the actual physical size; determine first image space coordinates of each corner point of the positioning mark in the first image space coordinate system and second image space coordinates in the second image space coordinate system according to the pixel position of the positioning mark and the actual size information; obtain the spatial pose parameter according to the first image space coordinates and the second image space coordinates of each corner point of the positioning mark and the projection mapping rule.
5. The standing tree breast diameter measurement method according to claim 4, wherein the step of obtaining the spatial pose parameter according to the first image space coordinates and the second image space coordinates of each corner point of the positioning mark and the projection mapping rule comprises: obtaining a first spatial pose parameter by a perspective n-point algorithm according to the first image space coordinates and the second image space coordinates of each corner point of the positioning mark and the projection mapping rule; projecting the first image space coordinates of each corner point of the positioning mark based on the first spatial pose parameter to obtain third image space coordinates; when a deviation between the third image space coordinates and the second image space coordinates is greater than a preset deviation threshold, adjusting the first spatial pose parameter until the deviation is less than or equal to the preset deviation threshold; and determining the first spatial pose parameter at this time as the spatial pose parameter of the camera relative to the first image space coordinate system.
6. The standing tree breast diameter measurement method according to claim 1, wherein the step of determining the projection image of the breast height section of the standing tree to be measured in the trunk image according to the first image space coordinate system and the spatial pose parameter comprises: determining a projection mapping relationship between the first image space coordinate system and the trunk image based on the spatial pose parameter; and determining the projection image of the breast height section of the standing tree to be measured in the trunk image according to the projection mapping relationship.
7. The standing tree breast diameter measurement method according to claim 1, wherein the step of obtaining the diameter of the breast height section as the breast diameter of the standing tree to be measured according to the edge pixel points of the projection region comprises: determining fourth image space coordinates of each edge pixel point of the projection region in the second image space coordinate system; determining a function of at least three tangent lines of the breast height section in the first image space coordinate system according to the fourth image space coordinates of each edge pixel point and the spatial pose parameter; and constructing a geometric constraint equation set of a circle according to the function of the at least three tangent lines, and obtaining the diameter of the circle by a fitting algorithm; and determining the diameter of the circle as the breast diameter of the standing tree to be measured. 8. A standing tree diameter measuring device, characterized by, Obtaining a standing tree image captured by a camera, and obtaining intrinsic parameters of the camera and actual size information of a positioning mark; wherein the standing tree image includes a tree trunk of a standing tree to be measured and two positioning marks arranged in a target breast height area of the tree trunk; the positioning mark is a rectangular mark with four corner points; Identifying a tree trunk image in the standing tree image, identifying pixel positions of each corner point of the positioning mark in the standing tree image; calculating image size information of the positioning mark in the standing tree image according to the pixel positions; and establishing a first image space coordinate system according to the pixel positions, the image size information and the actual size information; Determining a space pose parameter of the camera relative to the first image space coordinate system according to the intrinsic parameters, the pixel positions of the positioning mark and the actual size information; Determining a projection image of a breast height section of the standing tree to be measured in the tree trunk image according to the first image space coordinate system and the space pose parameter; and solving a diameter of the breast height section as a breast diameter of the standing tree to be measured according to edge pixel points of the projection region.
9. A computer-readable storage medium, characterized in that, A computer readable storage medium having stored thereon a computer program, the computer program, when executed, controlling a device in which the computer readable storage medium is located to implement the method of any one of claims 1 to 8.
10. A computer device, comprising: A computer program product comprising a processor, a memory, and a computer readable program stored in the memory, the computer readable program, when executed by the processor, implementing the steps of the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Standing tree information acquisition method and device based on images
CN105513078A
Stem DBH (diameter at breast height) measuring method based on machine visual sense and three dimensional reconstruction technology
CN107607053A
Multiple stumpage breast height diameter passive measurement method based on depth extraction model
CN109269430A
A method for measuring the height of a plurality of trees based on a smart phone
CN109285145A
Tree breast diameter measuring method based on halcon binocular stereoscopic vision
CN115439526A