Ground stacking determination method and device, electronic equipment and storage medium
By acquiring projected raster images to generate or update ground models, and using the watershed algorithm to determine stacking areas, the problems of inaccurate and inefficient stacking area segmentation are solved, achieving efficient and accurate segmentation of stacks of different shapes and specifications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG SOUTH DIGITAL TECH
- Filing Date
- 2025-01-10
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies suffer from inaccurate stacking area segmentation, low efficiency, and lack of reusability, especially for irregular objects and poor applicability between different storage yards.
By acquiring projected raster images of the target area, a ground model is generated or updated, and the watershed algorithm is used to determine the stacking area. Combined with a preset fault tolerance threshold and instance partitioning model, interference areas are filtered out, thereby improving the accuracy and universality of the stacking area.
It enables efficient and accurate segmentation of stacks of different shapes and sizes, reduces labor costs and training sample requirements, and improves the timeliness and accuracy of stack area division.
Smart Images

Figure CN119963591B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to a method, apparatus, electronic device, and storage medium for determining ground stacking. Background Technology
[0002] In scenarios such as factories and ports, it is necessary to monitor and extract the stacking range of goods or containers in the yard, so as to assist in the cargo scheduling work based on the stacking location.
[0003] In existing technologies, there are three main strategies for extracting the stacking range in a yard. The first strategy involves designing algorithms specifically for regular objects, such as designing a target detection algorithm for containers or using instance segmentation algorithms to obtain the target object range and thus determine the stacking range. The second strategy involves having workers manually draw the approximate area of a single stack and then calculating an approximate outline. The third strategy involves using a deep learning 3D segmentation model to segment and predict point cloud data to obtain the final stacking outline range.
[0004] However, the first strategy in the existing technology is suitable for stacks with fixed characteristics, and its applicability is limited. It is less effective at extracting irregular objects such as coal piles. The second strategy relies heavily on the experience of the operators, and the extracted stack area may not accurately reflect the actual stack area. Furthermore, this strategy requires a significant amount of time, resulting in low efficiency. In the third strategy, the training model may suffer from incomplete sample coverage, insufficient sample data, and difficulty in drawing sample labels, thus preventing the algorithm model from being reused between different stockpiles. Summary of the Invention
[0005] The purpose of this application is to address the shortcomings of the prior art by providing a ground stacking determination method, apparatus, electronic device, and storage medium to solve the problems of inaccurate stacking area segmentation, low efficiency, and lack of reusability in the prior art.
[0006] To achieve the above objectives, the technical solution adopted in this application is as follows:
[0007] In a first aspect, this application provides a method for determining ground stacking, the method comprising:
[0008] A projection raster image of the target area is obtained by projecting a point cloud within the target area. The pixel value of each pixel in the projection raster image is the height value of the point cloud corresponding to that pixel.
[0009] Determine if a ground model exists;
[0010] If so, the ground model is updated based on the projected raster image; otherwise, a ground model is generated based on the projected raster image, wherein the pixel value of the non-ground pixel in the projected raster image corresponding to the pixel in the ground model is the pixel value corresponding to the ground pixel.
[0011] Based on the projected raster image, the ground model, and the preset fault tolerance threshold, at least one candidate area in the ground model is determined, and the candidate area is a partial stacking area.
[0012] Based on the candidate regions, the stacking regions in the ground model are determined using the watershed algorithm, and the stacking regions in the target region are determined based on the stacking regions in the ground model.
[0013] Optionally, generating a ground model based on the projected raster image includes:
[0014] Determine the height mode in the projected raster image;
[0015] A horizontal plane estimate is generated based on the height mode and a preset mode threshold.
[0016] The ground model is generated based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value.
[0017] Optionally, generating the ground model based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane includes:
[0018] Traverse each pixel in the projected raster image. For the first current pixel, determine whether the pixel value of the first current pixel is greater than the estimated horizontal plane value. If so, replace the pixel value of the first current pixel with the estimated horizontal plane value to obtain the pixel value of the pixel corresponding to the first current pixel in the ground model.
[0019] Optionally, updating the ground model based on the projected raster image includes:
[0020] Determine whether there are any pixels without data in the projected raster image;
[0021] If so, the pixel values of the undata pixels in the projected raster image are replaced with the pixel values of the corresponding pixels in the ground model before the update to obtain the updated projected raster image. The pixel values of each pixel in the updated projected raster image are compared with the pixel values of the corresponding pixels in the ground model before the update, and the lower pixel value is used as the pixel value of the corresponding pixel in the ground model.
[0022] If not, compare the pixel values of each pixel in the projected raster image with the pixel values of the corresponding pixels in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0023] Optionally, determining the candidate area based on the projected raster image, the ground model, and a preset fault tolerance threshold includes:
[0024] Traverse the pixels in the ground model, and for the second current pixel, calculate the difference between the pixel value of the corresponding pixel in the projected raster image and the pixel value of the second current pixel.
[0025] If the difference is greater than the preset fault tolerance threshold, then the second current pixel is selected as a pixel in a candidate region.
[0026] Optionally, determining the stacking area in the ground model based on the watershed algorithm according to each of the candidate areas includes:
[0027] The candidate region is dilated and inverted to obtain the background region;
[0028] Multiple first water injection points are determined based on the distance between edge pixels in the background region and pixels in each of the candidate regions, and the background region is used as the second water injection point;
[0029] Based on multiple first water injection points and second water injection points, the stacking area in the ground model is determined according to the watershed algorithm.
[0030] Optionally, before determining the stacking area in the target area based on the stacking area in the ground model, the process includes:
[0031] Traverse each stacking region. For the current stacking region, input the pixel value of each pixel in the current stacking region and the pixel value of the corresponding pixel in the projected raster image into the pre-trained instance partitioning model, and output the angle of repose parameter, area parameter and minimum bounding rectangle parameter of each stacking region.
[0032] The current stacking area is determined to be an interference area based on the angle of repose threshold, area threshold, minimum bounding rectangle threshold, the angle of repose parameter, the area parameter, and the minimum bounding rectangle parameter.
[0033] If so, then the interference area is filtered out.
[0034] Optionally, the method further includes:
[0035] Obtain local modification parameters input by the user, the local modification parameters including the range of the modified pixel and the modified pixel value;
[0036] The pixels to be changed in the ground model are determined based on the range of the pixels to be changed.
[0037] Replace the pixel value of the pixel to be changed with the changed pixel value.
[0038] Secondly, this application provides a ground stacking determination device, the device comprising:
[0039] The acquisition module is used to acquire a projected raster image within a target area. The projected raster image is obtained by projecting a point cloud within the target area. The pixel value of each pixel in the projected raster image is the height value of the point cloud corresponding to that pixel.
[0040] The judgment module is used to determine whether a ground model exists;
[0041] A generation and update module is used to update the ground model according to the projected raster image if the condition is met, and otherwise generate the ground model according to the projected raster image, wherein the pixel value of the non-ground pixel in the projected raster image is the pixel value of the ground pixel in the ground model.
[0042] The first determining module is used to determine at least one candidate area in the ground model based on the projected raster image, the ground model and a preset fault tolerance threshold, wherein the candidate area is a partial stacking area.
[0043] The second determining module is used to determine the stacking area in the ground model based on the watershed algorithm according to each of the candidate areas, and to determine the stacking area in the target area according to the stacking area in the ground model.
[0044] Optionally, the generation and update module is specifically used for:
[0045] Determine the height mode in the projected raster image;
[0046] A horizontal plane estimate is generated based on the height mode and a preset mode threshold.
[0047] The ground model is generated based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value.
[0048] Optionally, the generation and update module is specifically used for:
[0049] Traverse each pixel in the projected raster image. For the first current pixel, determine whether the pixel value of the first current pixel is greater than the estimated horizontal plane value. If so, replace the pixel value of the first current pixel with the estimated horizontal plane value to obtain the pixel value of the pixel corresponding to the first current pixel in the ground model.
[0050] Optionally, the generation and update module is specifically used for:
[0051] Determine whether there are any pixels without data in the projected raster image;
[0052] If so, the pixel values of the undata pixels in the projected raster image are replaced with the pixel values of the corresponding pixels in the ground model before the update to obtain the updated projected raster image. The pixel values of each pixel in the updated projected raster image are compared with the pixel values of the corresponding pixels in the ground model before the update, and the lower pixel value is used as the pixel value of the corresponding pixel in the ground model.
[0053] If not, compare the pixel values of each pixel in the projected raster image with the pixel values of the corresponding pixels in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0054] Optionally, the first determining module is specifically used for:
[0055] Traverse the pixels in the ground model, and for the second current pixel, calculate the difference between the pixel value of the corresponding pixel in the projected raster image and the pixel value of the second current pixel.
[0056] If the difference is greater than the preset fault tolerance threshold, then the second current pixel is selected as a pixel in a candidate region.
[0057] Optionally, the second determining module is specifically used for:
[0058] The candidate region is dilated and inverted to obtain the background region;
[0059] Multiple first water injection points are determined based on the distance between edge pixels in the background region and pixels in each of the candidate regions, and the background region is used as the second water injection point;
[0060] Based on multiple first water injection points and second water injection points, the stacking area in the ground model is determined according to the watershed algorithm.
[0061] Optionally, the second determining module is further configured to:
[0062] Traverse each stacking region. For the current stacking region, input the pixel value of each pixel in the current stacking region and the pixel value of the corresponding pixel in the projected raster image into the pre-trained instance partitioning model, and output the angle of repose parameter, area parameter and minimum bounding rectangle parameter of each stacking region.
[0063] The current stacking area is determined to be an interference area based on the angle of repose threshold, area threshold, minimum bounding rectangle threshold, the angle of repose parameter, the area parameter, and the minimum bounding rectangle parameter.
[0064] If so, then the interference area is filtered out.
[0065] Optionally, the generation and update module is specifically used for:
[0066] Obtain local modification parameters input by the user, the local modification parameters including the range of the modified pixel and the modified pixel value;
[0067] The pixels to be changed in the ground model are determined based on the range of the pixels to be changed.
[0068] Replace the pixel value of the pixel to be changed with the changed pixel value.
[0069] Thirdly, this application provides an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the ground stacking determination method described above.
[0070] Fourthly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described ground stacking determination method.
[0071] The beneficial effects of this application are as follows: By acquiring projected raster images within the target area, and then generating or updating a ground model based on the projected raster images, ground height data is provided for determining the stacking area. Then, based on the projected raster images, the ground model, and a preset fault tolerance threshold, at least one candidate area in the ground model is determined. Based on the candidate areas, a watershed algorithm is used to determine the stacking area in the ground model, thereby avoiding the situation where multiple stacks are connected to form a tightly packed stack, improving the accuracy of stacking area division. Furthermore, the stacking area of the target area is determined based on the stacking area in the ground model, avoiding interference from buildings and vehicles, further improving the accuracy of stacking area division. This embodiment iteratively acquires projected raster images within the target area, allowing the ground model to be continuously updated and refined, improving the timeliness and accuracy of stacking area division. Moreover, since this application does not limit the target area or the projected raster images, it can segment stacks of different shapes and sizes, possessing universality. In addition, this application does not require a large number of training samples, therefore label creation is simple, labor costs are low, and efficiency is high. Attached Figure Description
[0072] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0073] Figure 1 This is a flowchart illustrating a method for determining ground stacking according to an embodiment of this application;
[0074] Figure 2 This is a schematic diagram of a process for generating a ground model provided in an embodiment of this application;
[0075] Figure 3 This is a schematic diagram of a process for updating a ground model provided in an embodiment of this application;
[0076] Figure 4 This is a schematic diagram of a candidate region provided in an embodiment of this application;
[0077] Figure 5 This is a schematic flowchart of a method for determining a stacking area provided in an embodiment of this application;
[0078] Figure 6 This is a schematic flowchart of a method for filtering out interference regions provided in an embodiment of this application;
[0079] Figure 7 This is a schematic flowchart of a method for locally changing the pixel value of a pixel in a ground model, provided in an embodiment of this application.
[0080] Figure 8 This is a schematic diagram of the structure of a ground stacking determination device provided in an embodiment of this application;
[0081] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0082] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0083] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0084] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0085] Existing stacking range extraction strategies, which design algorithms specifically for regular objects, are only applicable to stacks with fixed characteristics, resulting in limited applicability. Hand-drawing stacking areas by workers is time-consuming and yields inaccurate results. When using deep learning 3D segmentation models for segmentation prediction, issues such as incomplete sample coverage, insufficient data collection, and difficulty in labeling samples during model training can prevent the reuse of algorithms across different stacking sites.
[0086] Based on this, this application proposes a method for determining ground stacking. This method creates and iterates a ground model based on iteratively updated projected raster images, and determines the stacking area based on the projected raster images and the ground model using a watershed algorithm. Since this application uses projected raster images of the target area to ultimately determine the stacking range, and projected raster images are not limited by region or stacking shape, this method has a wide range of applications and is reusable, avoiding interference caused by incomplete training samples. Furthermore, because this invention first creates and iterates a ground model using projected raster images, and then uses the ground model and projected raster images combined with the watershed algorithm to determine the stacking range, it avoids the phenomenon of stacking range consolidation, thus achieving high accuracy in determining the stacking range. This method only requires inputting projected raster images to ultimately determine the stacking range, therefore it has high computational efficiency and does not require significant time costs.
[0087] The ground stacking determination method of the present invention can be applied to scenarios such as factory areas and ports. During the handling and stacking of goods, the ground stacking determination method is used to determine the stacking range of goods or containers, thereby assisting in cargo scheduling based on the stacking location.
[0088] Figure 1 This is a flowchart illustrating a method for determining ground stacking according to an embodiment of this application. The following refers to... Figure 1 The method for determining ground stacking is described in detail. Optionally, the method for determining ground stacking can be applied to electronic devices with computing capabilities.
[0089] S101. Obtain the projected raster image within the target area. The projected raster image is obtained by projecting the point cloud within the target area. The pixel value of each pixel in the projected raster image is the height value of the point cloud corresponding to the pixel.
[0090] Specifically, a point cloud of the ground is acquired beforehand using a scanner or similar device. This point cloud indicates the coordinate position of each point in a coordinate system. The projected raster image is obtained by projecting the point cloud data from top to bottom onto a horizontal plane, where the pixel value of each pixel represents the height value of the point cloud corresponding to that pixel.
[0091] It is worth mentioning that during the iterative acquisition of the projected raster image, the projected raster image can be an image of any local area within the target area. For example, if the target area is Factory A, the currently acquired projected raster image can be an image of the southeast corner of Factory A, and the next acquired projected raster image will be an image of the center of Factory A.
[0092] It is worth noting that the pixels in each of the acquired projection raster images are in the same coordinate system, and multiple projection raster images in the target area can be stitched together to form a projection raster image of the target area.
[0093] S102. Determine if a ground model exists.
[0094] In the ground model, the pixel value of each pixel can include the height value corresponding to that pixel.
[0095] Optionally, when the projected raster image of the target area is acquired for the first time, there is no ground model. A ground model needs to be generated based on the projected raster image. After the ground model is generated, when the projected raster image of the target area is acquired again, the existing ground model can be updated.
[0096] S103. If yes, update the ground model based on the projected raster image; otherwise, generate the ground model based on the projected raster image, wherein the pixel value of the non-ground pixel in the projected raster image is the pixel value of the ground pixel in the ground model.
[0097] Specifically, if a ground model exists, the ground model is updated based on the position coordinates of each pixel in the projected raster image. For example, if the currently acquired projected raster image is the southeast corner image of Plant A, the model at the southeast corner position in the ground model is updated.
[0098] As an optional implementation, in the first iteration, a projected raster image of a first local region within the target area is acquired, and a ground model of that first local region is generated based on this image. In the second iteration, a projected raster image of a second local region within the target area is acquired, wherein the second local region does not partially overlap with the first local region. A ground model is then generated based on the non-overlapping portions of the projected raster images of the second and first local regions, and the ground model is updated based on the overlapping portions of the projected raster images of the second and first local regions.
[0099] Optionally, non-ground pixels in the projected raster image are pixels in areas where stacking exists, while ground pixels are pixels in areas where stacking does not exist. Ground pixels and non-ground pixels can be determined based on the pixel values of each pixel.
[0100] As an optional implementation, the mode of each pixel value can be determined and used as a dividing point. Pixels with pixel values lower than or equal to the mode are ground pixels, and others are non-ground pixels.
[0101] After determining the non-ground pixels and ground pixels in the projected raster image using the above method, the pixel values of the non-ground pixels are replaced with the pixel values of the ground pixels, thereby generating or updating the ground model.
[0102] S104. Based on the projected raster image, the ground model, and the preset fault tolerance threshold, determine at least one candidate area in the ground model. The candidate area is a partial stacking area.
[0103] Optionally, a preset fault tolerance threshold is used to determine the candidate area based on the projected raster image and the ground model. The candidate area is a local range of the stacked area. With the same projected raster image and ground model, the larger the preset fault tolerance threshold, the smaller the candidate area; the smaller the preset fault tolerance threshold, the larger the candidate area.
[0104] S105. Based on each candidate area, determine the stacking area in the ground model using the watershed algorithm, and determine the stacking area in the target area based on the stacking area in the ground model.
[0105] Optionally, the watershed algorithm is a morphological segmentation method based on topological theory. This application utilizes the watershed algorithm to determine the stacking regions in the ground model. As an optional implementation, the stacking regions in the ground model can be determined based on each candidate region in the ground model and the corresponding pixels in the ground model in the projected raster image.
[0106] After determining the stacking regions in the ground model using the watershed algorithm, these regions may contain areas that are not actually stacked, such as interference areas like cranes and buildings. Therefore, it is necessary to filter the stacking regions in the ground model and convert the coordinate system of the filtered stacking regions to the coordinate system of the target region, thereby generating the stacking regions of the target region.
[0107] In this embodiment, a ground model is generated or updated based on a projected raster image of the target area to provide ground height data for determining the stacking area. Then, at least one candidate area in the ground model is determined based on the projected raster image, the ground model, and a preset fault tolerance threshold. The stacking area in the ground model is then determined based on the candidate area using a watershed algorithm, thus avoiding the situation where multiple stacks are connected to form a tightly packed stack, improving the accuracy of stacking area segmentation. The stacking area of the target area is then determined based on the stacking area in the ground model, avoiding interference from buildings and vehicles, further improving the accuracy of stacking area segmentation. This embodiment iteratively acquires the projected raster image of the target area, allowing the ground model to be continuously updated and refined, improving the timeliness and accuracy of stacking area segmentation. Furthermore, since this application does not limit the target area or the projected raster image, it can segment stacks of different shapes and sizes, possessing universality. In addition, this application does not require a large number of training samples, therefore label creation is simple, labor costs are low, and efficiency is high.
[0108] Figure 2This is a schematic diagram illustrating a process for generating a ground model according to an embodiment of this application. After providing an overview of how to determine the ground stacking, the following refers to... Figure 2 This paper introduces one method for generating a ground model from a projected raster image.
[0109] S201. Determine the height mode in the projected raster image.
[0110] As an optional implementation, the most frequently occurring pixel value among all pixels in the projected raster image can be used as the height mode. For example, if there are 10 pixels in the projected raster image, and the pixel values of each pixel are 1, 3.1, 1.1, 3.5, 1.3, 1.1, 1.2, 1.1, 1.3 and 1.1 respectively, then the height mode is 1.1.
[0111] As another optional implementation, the pixel values of each pixel in the projected raster image can be divided into intervals according to a pre-set interval division standard. The interval set with the largest number of pixels among multiple interval sets is determined, and the highest pixel value in this interval set is taken as the height mode. If there are 5 pixels in the projected raster image, with pixel values of 0.001, 0.002, 0.321, 0.821, and 1.0, the interval can be divided according to the minimum and maximum pixel values. For example, dividing the interval from 0.001 to 1.0 into 20 equal parts will result in the largest number of pixels falling within the interval from 0.001 to 0.05. The maximum value of this interval, 0.05, is taken as the height mode of the projected raster image.
[0112] It is worth noting that before determining the mode of height, pixels with negative values or values of 0 need to be filtered out.
[0113] S202. Generate a horizontal plane estimate based on the height mode and a preset mode threshold.
[0114] Since using the height mode of each pixel value in the projected raster image as the height value of the horizontal plane has a certain error, a preset mode threshold can be set in advance. Specifically, the sum of the height mode and the preset mode threshold is used as the estimated value of the horizontal plane.
[0115] For example, the preset mode threshold can be 0.5, in meters.
[0116] S203. Generate a ground model based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value.
[0117] As an optional implementation, the pixel values of pixels in the projected raster image that are greater than the estimated horizontal plane value are replaced with the estimated horizontal plane value, and the replaced pixels are combined with the pixels whose pixel values are greater than the estimated horizontal plane value to generate a ground model.
[0118] As an optional implementation, after replacing the pixel values of pixels in the projected raster image that are greater than the estimated horizontal plane value with the estimated horizontal plane value, the following steps can be performed: The pixels whose pixel values are replaced with the estimated horizontal plane value are combined with the pixels whose pixel values are greater than the estimated horizontal plane value to generate a candidate ground model. It is then determined whether there are abnormal pixel values or missing pixel values in each pixel of the projected raster image, where abnormal pixel values include pixel values exceeding a preset threshold. If such a case exists, the pixel value of that pixel is replaced with the height mode to reduce interference from abnormal pixels in the projected raster image. Then, the pixel values of each pixel in the replaced projected raster image are compared with the pixel values of the corresponding pixels in the candidate ground model, and the lower pixel value is used as the pixel value of the corresponding pixel in the ground model, thus obtaining the ground model. The above process of obtaining the ground model can be expressed by formula (1):
[0119] (1)
[0120] in, Let be the pixel value of the i-th pixel in the ground model. Let i be the pixel value of the i-th pixel in the replaced projected raster image. This is an estimate of the horizontal plane.
[0121] In this embodiment, the height mode in the projected raster image is first determined, and then a horizontal plane estimate is generated based on the height mode and a preset mode threshold. The ground model generated using the horizontal plane estimate has higher pixel value accuracy than the ground model generated directly using the height mode.
[0122] Furthermore, the specific steps in step S203 above, which involve generating a ground model based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value, are described below:
[0123] Optionally, each pixel in the projected raster image is traversed. For the first current pixel, it is determined whether the pixel value of the first current pixel is greater than the horizontal plane estimate. If so, the pixel value of the first current pixel is replaced with the horizontal plane estimate to obtain the pixel value of the corresponding pixel in the ground model.
[0124] Specifically, if the pixel value of the first current pixel is greater than the horizontal plane estimate, then the first current pixel is a non-ground pixel; if the pixel value of the first current pixel is less than or equal to the horizontal plane estimate, then the first current pixel is a ground pixel.
[0125] In this embodiment, the pixel values of the corresponding pixels in the ground model are obtained by traversing each pixel in the projected raster image and replacing the pixel values of the pixels with the estimated horizontal plane value with the estimated horizontal plane value.
[0126] The above explains how to generate a ground model from a projected raster image. Next, we will introduce how to update the ground model based on the projected raster image. Figure 3 This is a schematic diagram of a process for updating a ground model provided in an embodiment of this application. The following refers to... Figure 3 The steps for updating the ground model are described.
[0127] S301. Determine whether there are any pixels without data in the projected raster image.
[0128] Among them, pixel values for pixels with no data are missing, or abnormal conditions have occurred. An abnormal condition is when the pixel value exceeds a preset threshold range.
[0129] S302. If so, replace the pixel value of the pixel without data in the projected raster image with the pixel value of the corresponding pixel in the ground model before the update to obtain the updated projected raster image. Then compare the pixel value of each pixel in the updated projected raster image with the pixel value of the corresponding pixel in the ground model before the update, and take the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0130] If the projected raster image contains pixels without data, to ensure that subsequent pixel value comparisons do not produce anomalies, the pixel values of these missing pixels in the projected raster image need to be replaced with the corresponding pixel values from the ground model before the update. The ground model before the update refers to the ground model that existed prior to acquiring this projected raster image.
[0131] S303. If not, compare the pixel values of each pixel in the projected raster image with the pixel values of the corresponding pixels in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0132] Using low pixel values as the corresponding pixel values in the ground model will not interfere with the subsequently determined stacking area.
[0133] It is worth noting that projected raster images of different locations within the target area can be acquired iteratively. Then, based on the coordinates of each pixel in each acquired projected raster image, the corresponding pixels in the ground model are updated, thus obtaining the overall ground model of the target area. By iteratively updating the ground model of local locations within the target area, the computational load on electronic devices can be reduced, and the pressure of acquiring projected raster images can be lessened.
[0134] In this embodiment, by determining whether there are any dataless pixels in the projected raster image and updating the projected raster image, the interference caused by dataless pixels on the comparison results is avoided. The updated projected raster image and the pixel value with the lower pixel value in the ground model before the update are selected as the pixel value of the corresponding pixel in the ground model. This can eliminate the tolerance in the pixel value estimation of the ground model, retain a more realistic height value of the ground, and thus improve the accuracy of the stacking area division.
[0135] It should be understood that directly classifying areas where the pixel values of each pixel in the ground model are lower than those in the projected raster image as stacked regions may lead to inaccurate division of stacked regions due to the possibility of multiple stacks being connected and forming tight stacks. Therefore, it is necessary to calculate and obtain candidate areas that definitely contain stacks, and then determine the stacked regions in the ground model based on these candidate areas.
[0136] Therefore, after determining the ground model, the following section will introduce the specific steps in step S104 above for determining the candidate area based on the projected raster image, the ground model, and the preset fault tolerance threshold.
[0137] Optionally, the pixels in the ground model are traversed, and for the second current pixel, the difference between the pixel value of the corresponding pixel in the projected raster image and the pixel value of the second current pixel is calculated.
[0138] Optionally, if the difference between the pixel value of the second current pixel and the pixel value of the corresponding pixel in the projected raster image is greater than 0, it indicates that the second current pixel can correspond to a non-ground pixel in the projected raster image. If the difference between the pixel value of the second current pixel and the pixel value of the corresponding pixel in the projected raster image is less than or equal to 0, it indicates that the second current pixel can correspond to a ground pixel in the projected raster image.
[0139] As an optional implementation, the boundary of pixels with a difference greater than 0 is the outer contour of the stack.
[0140] Optionally, if the difference is greater than a preset fault tolerance threshold, the second current pixel is selected as a pixel in a candidate region.
[0141] Optionally, within the same projected raster image, a higher preset fault tolerance threshold results in fewer pixels in the candidate area, while a lower preset fault tolerance threshold results in more pixels in the candidate area. Setting a preset fault tolerance threshold can filter out pixels that are stuck together due to close stacking.
[0142] As an optional implementation, the electronic device can traverse the ground model from the first pixel to the last pixel. If a pixel has a difference greater than a preset fault tolerance threshold, it is considered a pixel in the candidate region. If a pixel has a difference less than or equal to the preset fault tolerance threshold, it is considered a pixel outside the candidate region. The boundary line between the candidate regions is the line connecting the pixels in the candidate regions and the pixels outside the candidate regions. It is determined whether multiple pixels with differences greater than the preset fault tolerance threshold are connected; if so, the multiple pixels belong to the same candidate region.
[0143] Figure 4 This is a schematic diagram of a candidate region provided in an embodiment of this application. (Refer to...) Figure 4 The pixels within the dashed line indicate that the candidate area is a partially stacked region. The difference between the pixel value of a pixel within the dashed line and the pixel value of the second current pixel is greater than 0. The solid line represents the candidate area corresponding to the dashed line.
[0144] In this embodiment, the pixels in the ground model are traversed, and the difference between the pixel value of the second current pixel in the projected raster image and the pixel value of the second current pixel is calculated. The pixels in the candidate area are determined based on the comparison result of the difference and the preset fault tolerance threshold, thereby filtering out interfering pixels. Since the candidate area must belong to the stacking area, the stacking area is divided and determined according to the candidate area, so that the division result is accurate.
[0145] Figure 5 This is a schematic flowchart of a method for determining a stacking area according to an embodiment of this application. After determining the candidate areas, the following describes step S105 above, which involves determining the stacking area in the ground model based on each candidate area.
[0146] S501. Dilate and invert the selected area to obtain the background area.
[0147] Specifically, the selected area is first dilated, and then the dilated area is inverted to obtain the background area. The dilation process can be as follows: a pixel block is pre-defined, which has a core pixel. The core pixel of the pixel block is then placed sequentially among the pixels in the selected area. All pixels covered by the pixel block are taken as the pixels included in the dilated area.
[0148] Optionally, since the selected area is inverted and expanded, the background area is the ground area.
[0149] S502. Determine multiple first water injection points based on the edge pixels in the background area and the distance between each pixel in each candidate area, and use the background area as the second water injection point.
[0150] In this context, edge pixels in the background region are those located at the edges of the background region. These pixels can fall into two categories: those located at the edge of the target region, and those adjacent to pixels in the candidate region.
[0151] Specifically, each candidate region is traversed. For the current candidate region, the shortest distance between each pixel in the current candidate region and the edge pixels in the background region is calculated. The pixel in the current candidate region corresponding to the maximum value of the shortest distance is taken as the first water injection point.
[0152] Optionally, all pixels in the background area can be used as the second water injection point.
[0153] S503. Based on multiple first and second water injection points, the stacking area in the ground model is determined according to the watershed algorithm.
[0154] The watershed algorithm is used to find the peaks and troughs of pixel values at each pixel in the ground model, thereby segmenting and determining the stacking area of the ground model. Specifically, water is injected simultaneously at multiple first and second injection points. The boundary between the water injected at each injection point is used as the dividing line. This dividing line, combined with the boundary line of the candidate area, serves as the boundary line of the stacking area. This boundary line can be a boundary line between the first and second injection points, a boundary line between multiple first injection points, or a boundary line between multiple first and second injection points.
[0155] As an alternative implementation, the pixels in the candidate area can be used as a mask in combination with the watershed algorithm to determine the stacking area in the ground model, so as to reduce the amount of computation and improve the computational efficiency.
[0156] In this embodiment, the background region is obtained by dilating and inverting the selected region. The first water injection point is determined based on the distance between each pixel in the background region and the selected region. The background region is used as the second water injection point to reduce the amount of computation and avoid a large number of interfering boundary lines. Finally, based on multiple first and second water injection points, the stacking region in the ground model is determined according to the watershed algorithm, thereby avoiding the problem of inaccurate division of the stacking region caused by multiple stacks being connected to form a tight stack.
[0157] Next, before determining the stacking area in the target area based on the stacking area in the ground model in step S105 above, the following steps can also be performed. Among them, Figure 6 This is a schematic flowchart of a method for filtering out interference regions provided in an embodiment of this application.
[0158] S601. Traverse each stacking region. For the current stacking region, input the pixel value of each pixel in the current stacking region and the pixel value of the corresponding pixel in the projected raster image into the pre-trained instance partitioning model, and output the repose angle parameter, area parameter and minimum bounding rectangle parameter of each stacking region.
[0159] The instance partitioning model can determine the angle of repose, area, and minimum bounding rectangle parameters of each stacking region based on the pixel values of the current stacking region and the pixels in the projected raster image.
[0160] S602. Determine whether the current stacking area is an interference area based on the angle of repose threshold, area threshold, minimum bounding rectangle threshold, angle of repose parameter, area parameter, and minimum bounding rectangle parameter.
[0161] Specifically, it is determined whether the angle of repose parameter exceeds the angle of repose threshold. If it does, the current stacking area is an interference area. And / or, it is determined whether the area parameter exceeds the area threshold. If it does, the current stacking area is an interference area. And / or, it is determined whether the minimum bounding rectangle parameter exceeds the minimum bounding rectangle threshold. If it does, the current stacking area is an interference area.
[0162] For example, the angle of repose threshold can be 85°, the area threshold can be 100°, and the minimum bounding rectangle threshold can indicate an aspect ratio greater than 10. The interference region can be a region with an angle of repose parameter greater than 85°, or an area parameter less than 100°, and a minimum bounding rectangle parameter indicating an aspect ratio greater than 10.
[0163] S603. If so, then filter out the interference area.
[0164] Specifically, remove pixels from the interference area from the pixels in the stacked area.
[0165] The area affected by the interference may include cranes and buildings.
[0166] In this embodiment, the repose angle parameter, area parameter and minimum bounding rectangle parameter of each stacking area are output by a pre-trained instance partitioning model, and interference areas are filtered out according to the above parameters and corresponding thresholds, thereby improving the accuracy of the stacking area.
[0167] As an alternative implementation, the pixel values of pixels in the ground model can also be locally modified. This method can be applied before updating the ground model based on the projected raster image. See below for further details. Figure 7 The above methods will be introduced as follows:
[0168] S701. Obtain the local modification parameters input by the user. The local modification parameters include the range of the modified pixel and the modified pixel value.
[0169] Specifically, the pixels are changed to those in the ground model.
[0170] S702. Determine the pixels to be changed in the ground model based on the range of pixels to be changed.
[0171] S703, Replace the pixel value of the pixel to be changed with the pixel value to be changed.
[0172] As an optional implementation, a first mask can be constructed based on the range of pixels to be modified. The first mask for the pixels to be modified is set to 0, and the first masks for other pixels are set to 1. The mask of each pixel is multiplied by its pixel value to obtain the first pixel value for each pixel. Pixels with non-zero pixel values are retained as the first pixel cluster. A second mask is then constructed based on the range of pixels to be modified. The second mask for the pixels to be modified is set to the pixel value to be modified, and the second masks for other pixels are set to 0. Pixels with non-zero pixel values are retained as the second pixel cluster. The first pixel cluster is combined with the second pixel cluster to form the updated ground model.
[0173] It is worth noting that after obtaining the local modification parameters input by the user and changing the pixel values of the pixels in the ground model according to the local modification parameters, the ground model is no longer updated according to the pixel values of the corresponding area in the projected raster image.
[0174] In this embodiment, by obtaining the local modification parameters input by the user, the pixels to be modified in the ground model are determined according to the range of the modified pixels, and the pixel values of the pixels to be modified are replaced with the modified pixel values. This is suitable for situations where a ground model needs to be built for special circumstances, so that the ground model fits the actual ground height and the stacking area is more accurate.
[0175] Based on the same inventive concept, this application also provides a ground stacking determination device corresponding to the ground stacking determination method. Since the principle of the device in this application is similar to the ground stacking determination method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0176] Reference Figure 8The diagram shown is a structural schematic of a ground stacking determination device provided in an embodiment of this application. The device includes: an acquisition module 801, a judgment module 802, a generation / update module 803, a first determination module 804, and a second determination module 805; wherein:
[0177] The acquisition module 801 is used to acquire the projected raster image within the target area. The projected raster image is obtained by projecting the point cloud within the target area. The pixel value of each pixel in the projected raster image is the height value of the point cloud corresponding to the pixel.
[0178] Module 802 is used to determine whether a ground model exists;
[0179] The generation update module 803 is used to update the ground model according to the projected raster image if the condition is met, and otherwise generate the ground model according to the projected raster image. The pixel value of the non-ground pixel in the projected raster image is the pixel value of the ground pixel in the ground model.
[0180] The first determining module 804 is used to determine at least one candidate area in the ground model based on the projected raster image, the ground model and the preset fault tolerance threshold. The candidate area is a partial stacking area.
[0181] The second determining module 805 is used to determine the stacking area in the ground model based on the watershed algorithm according to each candidate area, and to determine the stacking area in the target area according to the stacking area in the ground model.
[0182] Optionally, the generation update module 803 is specifically used for:
[0183] Determine the height mode in the projected raster image;
[0184] A horizontal plane estimate is generated based on the height mode and a preset mode threshold.
[0185] A ground model is generated based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value.
[0186] Optionally, the generation update module 803 is specifically used for:
[0187] Traverse each pixel in the projected raster image. For the first current pixel, determine whether the pixel value of the first current pixel is greater than the horizontal plane estimate. If so, replace the pixel value of the first current pixel with the horizontal plane estimate to obtain the pixel value of the corresponding pixel in the ground model.
[0188] Optionally, the generation update module 803 is specifically used for:
[0189] Determine whether there are pixels without data in the projected raster image;
[0190] If so, replace the pixel values of the undata pixels in the projected raster image with the pixel values of the corresponding pixels in the ground model before the update to obtain the updated projected raster image. Then compare the pixel values of each pixel in the updated projected raster image with the pixel values of the corresponding pixels in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0191] If not, compare the pixel values of each pixel in the projected raster image with the corresponding pixel values in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model.
[0192] Optionally, the first determining module 804 is specifically used for:
[0193] Traverse the pixels in the ground model, and for the second current pixel, calculate the difference between the pixel value of the corresponding pixel in the projected raster image and the pixel value of the second current pixel.
[0194] If the difference is greater than the preset fault tolerance threshold, the second current pixel will be selected as a pixel in the candidate region.
[0195] Optionally, the second determining module 805 is specifically used for:
[0196] The selected area is expanded and inverted to obtain the background area;
[0197] Multiple first water injection points are determined based on the distance between edge pixels in the background region and pixels in each candidate region, and the background region is used as the second water injection point;
[0198] Based on multiple first and second water injection points, the stacking area in the ground model is determined according to the watershed algorithm.
[0199] Optionally, the second determining module 805 is also used for:
[0200] Traverse each stacking region. For the current stacking region, input the pixel value of each pixel in the current stacking region and the pixel value of the corresponding pixel in the projected raster image into the pre-trained instance partitioning model, and output the angle of repose parameter, area parameter and minimum bounding rectangle parameter of each stacking region.
[0201] Determine whether the current stacking area is an interference area based on the angle of repose threshold, area threshold, minimum bounding rectangle threshold, angle of repose parameter, area parameter, and minimum bounding rectangle parameter;
[0202] If so, then filter out the interfering area.
[0203] Optionally, the generation update module 803 is specifically used for:
[0204] Obtain the local modification parameters input by the user. The local modification parameters include the range of the modified pixels and the modified pixel value.
[0205] Determine the pixels to be changed in the ground model based on the range of pixels to be changed;
[0206] Replace the pixel value of the pixel to be changed with the pixel value to be changed.
[0207] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0208] This application also provides an electronic device, such as... Figure 9 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application, including: a processor 901, a memory 902, and a bus. The memory 902 stores machine-readable instructions executable by the processor 901 (e.g., ...). Figure 8 The device includes an acquisition module 801, a judgment module 802, a generation and update module 803, a first determination module 804, and a second determination module 805 (and corresponding execution instructions, etc.). When the computer device is running, the processor 901 and the memory 902 communicate via a bus. When the machine-readable instructions are executed by the processor 901, the above-mentioned ground stacking determination method is performed.
[0209] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described ground stacking determination method.
[0210] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0211] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0212] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for determining ground stacking, characterized in that, The method includes: A projection raster image of the target area is obtained by projecting a point cloud within the target area. The pixel value of each pixel in the projection raster image is the height value of the point cloud corresponding to that pixel. Determine if a ground model exists; If so, the ground model is updated based on the projected raster image; otherwise, a ground model is generated based on the projected raster image, wherein the pixel value of the non-ground pixel in the projected raster image corresponding to the pixel in the ground model is the pixel value corresponding to the ground pixel. Based on the projected raster image, the ground model, and the preset fault tolerance threshold, at least one candidate area in the ground model is determined, and the candidate area is a partial stacking area. Based on each of the candidate regions, the stacking region in the ground model is determined using the watershed algorithm, and the stacking region in the target region is determined based on the stacking region in the ground model. Updating the ground model based on the projected raster image includes: Determine whether there are any pixels without data in the projected raster image; If so, the pixel values of the undata pixels in the projected raster image are replaced with the pixel values of the corresponding pixels in the ground model before the update to obtain the updated projected raster image. The pixel values of each pixel in the updated projected raster image are compared with the pixel values of the corresponding pixels in the ground model before the update, and the lower pixel value is used as the pixel value of the corresponding pixel in the ground model. If not, compare the pixel values of each pixel in the projected raster image with the pixel values of the corresponding pixels in the ground model before the update, and use the lower pixel value as the pixel value of the corresponding pixel in the ground model. The step of generating a ground model based on the projected raster image includes: Determine the height mode in the projected raster image; A horizontal plane estimate is generated based on the height mode and a preset mode threshold. The ground model is generated based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane value. The step of generating the ground model based on the pixel values of each pixel in the projected raster image and the estimated horizontal plane includes: Traverse each pixel in the projected raster image. For the first current pixel, determine whether the pixel value of the first current pixel is greater than the estimated horizontal plane value. If so, replace the pixel value of the first current pixel with the estimated horizontal plane value to obtain the pixel value of the pixel corresponding to the first current pixel in the ground model.
2. The method for determining ground stacking according to claim 1, characterized in that, The step of determining the candidate area based on the projected raster image, the ground model, and a preset fault tolerance threshold includes: Traverse the pixels in the ground model, and for the second current pixel, calculate the difference between the pixel value of the corresponding pixel in the projected raster image and the pixel value of the second current pixel. If the difference is greater than the preset fault tolerance threshold, then the second current pixel is selected as a pixel in a candidate region.
3. The method for determining ground stacking according to claim 1, characterized in that, The step of determining the stacking area in the ground model based on the watershed algorithm according to each of the candidate areas includes: The candidate region is dilated and inverted to obtain the background region; Multiple first water injection points are determined based on the distance between edge pixels in the background region and pixels in each of the candidate regions, and the background region is used as the second water injection point; Based on multiple first water injection points and second water injection points, the stacking area in the ground model is determined according to the watershed algorithm.
4. The method for determining ground stacking according to claim 1, characterized in that, Before determining the stacking area in the target area based on the stacking area in the ground model, the process includes: Traverse each stacking region. For the current stacking region, input the pixel value of each pixel in the current stacking region and the pixel value of the corresponding pixel in the projected raster image into the pre-trained instance partitioning model, and output the angle of repose parameter, area parameter and minimum bounding rectangle parameter of each stacking region. The current stacking area is determined to be an interference area based on the angle of repose threshold, area threshold, minimum bounding rectangle threshold, the angle of repose parameter, the area parameter, and the minimum bounding rectangle parameter. If so, then the interference area is filtered out.
5. The method for determining ground stacking according to claim 1, characterized in that, The method further includes: Obtain local modification parameters input by the user, the local modification parameters including the range of the modified pixel and the modified pixel value; The pixels to be changed in the ground model are determined based on the range of the pixels to be changed. Replace the pixel value of the pixel to be changed with the changed pixel value.
6. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when the electronic device is running, are executed by the processor to perform the steps of the ground stacking determination method as described in any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the ground stacking determination method as described in any one of claims 1 to 5.