Three-dimensional polygon geometry model slice information determination method and related device
By extracting the region of interest from a color image of a polygonal geometry, creating a grid coordinate system, and constructing triangular facets of a 3D polygonal geometry model, the problem of the bottom rectangular facets of a 3D badge model was solved, achieving a higher accuracy printing effect.
Patent Information
- Application Number
- CN202411178314.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-03
AI Technical Summary
When the 3D badge model generated by the existing technology is displayed in the preview interface, there are large rectangular patches at the bottom of the polygonal model, which makes the printed model inaccurate.
By extracting the region of interest image from the color image of the polygonal geometry, creating a grid coordinate system, constructing the surface and bottom triangular patches of the 3D polygonal geometry model, removing triangular patches with vertex heights of preset values, determining the slicing information, and generating an accurate 3D polygonal geometry model.
The generated 3D polygonal geometry model has a bottom surface with precise boundaries, eliminating the rectangular patch problem when previewing the model and improving the accuracy of the printed model.
Smart Images

Figure CN121600503A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and in particular to a method, apparatus, printer, computer equipment, computer-readable storage medium, and computer program product for determining slice information of a three-dimensional polygonal geometric model. Background Technology
[0002] In recent years, with the popularization of 3D printers, the printing accuracy and speed of home 3D printers have been greatly improved. 3D printed products are not only used as practical tools, but also as decorations or works of art. Among them, 3D badge models, as personalized works of art and decorations, are increasingly popular and loved by users.
[0003] Currently, to meet users' printing needs, some platforms offer user-friendly interfaces that allow users to upload 2D badge images and convert them into 3D badge models, providing real-time previews so users can modify and adjust the layer colors themselves.
[0004] However, the above solution requires users to perform a series of complex operations, and the generated 3D badge model is not a polygonal model when displayed in the preview interface. It has a large rectangular patch at the bottom, meaning that the constructed polygonal model is not accurate enough. As a result, the polygonal model printed later is also not accurate enough. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, printer, computer equipment, computer-readable storage medium, and computer program product that can support the generation of more accurate three-dimensional polygonal geometry model slice information to address the above-mentioned technical problems.
[0006] Firstly, this application provides a method for determining slice information of a three-dimensional polygonal geometric model, including:
[0007] Extracting the region of interest (ROI) image containing the polygonal geometry from a color image of the polygonal geometry;
[0008] Based on the image of the region of interest, a grid coordinate system is created;
[0009] Based on the region of interest image and the grid coordinate system, surface triangular patches of a three-dimensional polygonal geometric model are constructed, triangular patches with vertex heights of preset values are removed, and bottom triangular patches of the three-dimensional polygonal geometric model are constructed to obtain the three-dimensional polygonal geometric model.
[0010] Based on the region of interest image, the slice information of the three-dimensional polygonal geometry model is determined.
[0011] Secondly, this application also provides a device for determining slice information of a three-dimensional polygonal geometry model, comprising:
[0012] The image extraction module is used to extract the region of interest containing the polygonal geometry from a color image of the polygonal geometry;
[0013] The coordinate system creation module is used to create a grid coordinate system based on the image of the region of interest;
[0014] The model building module is used to construct surface triangular patches of a three-dimensional polygonal geometric model based on the region of interest image and the grid coordinate system, remove triangular patches with a preset vertex height, construct the bottom triangular patches of the three-dimensional polygonal geometric model, and obtain the three-dimensional polygonal geometric model.
[0015] The slice information determination module is used to determine the slice information of the three-dimensional polygonal geometry model based on the image of the region of interest.
[0016] Thirdly, this application also provides a printer, including a controller and a printhead. The controller is used to perform the steps of the three-dimensional polygon geometry model slice information determination method described above, to process the acquired polygon geometry color image, to determine the slice information of the three-dimensional polygon geometry model corresponding to the polygon geometry, and to control the printhead to move based on the slice information to print the three-dimensional polygon geometry model.
[0017] Fourthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometric model.
[0018] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometry model.
[0019] Sixthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometry model.
[0020] The aforementioned method, apparatus, printer, computer equipment, computer-readable storage medium, and computer program product for determining the slice information of a three-dimensional polygonal geometry model provide a scheme for generating a three-dimensional polygonal geometry model corresponding to the polygonal geometry based on a two-dimensional image of the polygonal geometry. Specifically, after extracting the region of interest (ROI) image containing the polygonal geometry from the color image of the polygonal geometry, a grid coordinate system is created in the ROI image. Based on the ROI image and the grid coordinate system, surface triangular patches of the three-dimensional polygonal geometry model are constructed. Triangular patches with a preset vertex height are removed, which helps to remove invalid or overlapping patches. Then, triangular patches with a preset vertex height are removed, and the bottom triangular patches of the three-dimensional polygonal geometry model are constructed to obtain the three-dimensional polygonal geometry model. Finally, the slice information of the three-dimensional polygonal geometry model is determined based on the ROI image. The entire solution can generate accurate 3D polygonal geometry models based on different 2D color images of polygonal geometries input by the user, determine the model slicing information, support automated printing of 3D models, and eliminate invalid or overlapping faces by removing triangular faces with preset vertex heights. This simplifies the structure of the 3D polygonal geometry model, giving the generated model a bottom surface with precise boundaries and eliminating the problem of large rectangular faces at the bottom when the user previews the model. This results in clearer and more accurate boundaries for the subsequently printed 3D polygonal geometry model. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is an application environment diagram of a method for determining slice information of a three-dimensional polygonal geometry model in one embodiment;
[0023] Figure 2 This is a flowchart illustrating a method for determining slice information of a three-dimensional polygonal geometry model in one embodiment;
[0024] Figure 3 This is a schematic diagram of the Mesh Grid coordinate system generated in one embodiment;
[0025] Figure 4 This is a flowchart illustrating a method for determining slice information of a three-dimensional polygon geometry model in another embodiment;
[0026] Figure 5 This is a flowchart illustrating the steps for determining the target grayscale weight in one embodiment;
[0027] Figure 6 This is a flowchart illustrating the steps for obtaining slice information in one embodiment;
[0028] Figure 7 This is a flowchart illustrating the steps of obtaining an image of a region of interest in one embodiment;
[0029] Figure 8 A structural block diagram of a device for determining slice information of a three-dimensional polygonal geometry model in one embodiment;
[0030] Figure 9 A structural block diagram of a device for determining slice information of a three-dimensional polygon geometry model in another embodiment;
[0031] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0033] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0034] The method for determining slice information of a three-dimensional polygonal geometry model provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server. The data storage system can pre-store images of regions of interest for polygonal geometry.
[0035] Specifically, a user can upload a color image of a polygonal geometry to a server 104 via terminal 102 and send a model generation message to the server 104. The server 104 responds to the model generation message by extracting a region of interest (ROI) image containing the polygonal geometry from the color image of the polygonal geometry. Then, based on the ROI image, a mesh coordinate system is created. Subsequently, based on the ROI image and the mesh coordinate system, surface triangular patches of the 3D polygonal geometry model are constructed. Triangular patches with vertex heights of preset values are removed, and bottom triangular patches of the 3D polygonal geometry model are constructed to obtain the 3D polygonal geometry model. Finally, based on the ROI image, the slicing information of the 3D polygonal geometry model is determined.
[0036] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, and projection devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. The server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. It is understood that the above method can also be applied to printers, or printing systems that include a control terminal and a printer.
[0037] In one exemplary embodiment, such as Figure 2 As shown, a method for determining slice information of a three-dimensional polygonal geometry model is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps S100 to S400. Wherein:
[0038] S100: Extract the region of interest image containing the polygon geometry from the color image of the polygon geometry.
[0039] In practical applications, polygonal geometries include, but are not limited to, badges, car models, dolls, and other items. A color image of a polygonal geometry (hereinafter referred to as a color image) is a two-dimensional color image of a polygonal geometry to be printed, uploaded by the user. The Region of Interest (ROI) image is a portion of the image; this portion typically contains specific objects or image features of interest to the user. In this embodiment, the ROI image refers to a local image containing the polygonal geometry; the portion of the image not belonging to the ROI is the background.
[0040] In practice, extracting the region of interest (ROI) image from a color image of a polygonal geometry can be achieved by thresholding the color image (hereinafter referred to as the color image) to convert it into a binary image, where the foreground is white and the background is black. Then, contour detection can be used to filter out the contours representing the polygonal geometry. Next, a blank binary image of the same size as the original color image is created. Based on the filtered contours representing the polygonal geometry, the foreground region in the mask image is filled to obtain the foreground mask, where white pixels (usually represented as 1) represent the ROI, and black pixels (usually represented as 0) represent the background. The filled foreground mask is then applied to the original color image, preserving the information of the positions corresponding to white pixels in the color image and setting the positions corresponding to black pixels in the foreground mask to black. Finally, the ROI image containing the polygonal geometry is extracted from the merged image. It can be understood that the ROI image retains the color information from the original color image.
[0041] In practical applications, the region of interest (ROI) image can be extracted from the color image beforehand using the image processing methods described above. This ROI image is then associated with a polygonal geometry and stored in the server's data storage system. When the server receives a model generation message carrying a polygonal geometry identifier, it retrieves the ROI image associated with that identifier from the data storage system. In other embodiments, the user can upload a color image of a polygonal geometry to the server via a terminal and send a model generation message. The server then extracts the ROI image from the color image of the polygonal geometry using the image processing methods described above.
[0042] S200: Create a grid coordinate system based on the region of interest image.
[0043] Mesh coordinates, also known as grid coordinates, are a two-dimensional array or structure used to represent values or points in a Cartesian coordinate system.
[0044] In practice, after obtaining the region of interest (ROI) image, preprocessing such as denoising, scaling, grayscale conversion, and normalization can be performed. Then, horizontal and vertical grid lines are created in the ROI image according to a preset grid cell size, such as 50 pixels. Next, coordinate markers are added at each grid intersection point to obtain the MeshGrid coordinate system. Furthermore, the grid cell size can be adjusted according to the size of the ROI image and actual requirements.
[0045] S300: Based on the region of interest image and the grid coordinate system, construct the surface triangular facets of the three-dimensional polygonal geometric model, remove the triangular facets with a preset vertex height, construct the bottom triangular facets of the three-dimensional polygonal geometric model, and obtain the three-dimensional polygonal geometric model.
[0046] A 3D polygonal geometry model is a Triangle Mesh 3D model (hereinafter referred to as the model). This model approximates the surface of a 3D object using a series of connected triangles. Surface triangles refer to the triangular facets used to construct the surface of the model. Base triangles refer to the triangular facets that form the base of the model.
[0047] In Triangle Mesh, each triangle is called a face (triangular facet). Triangular faces are the basic building blocks of a 3D polygonal geometry model, forming the face of the model. Each facet is a planar region defined by three vertices, which define a unique plane in 3D space. Its main attributes include vertex coordinates and triangle indices. The vertex coordinates are a two-dimensional array, with each row containing the coordinates of a vertex in 3D space. The triangle indices are a two-dimensional array, with each row containing the indices of the three vertices of a triangle, corresponding to the vertex coordinates.
[0048] Following the previous step, after creating a Mesh Grid coordinate system in the region of interest (ROI) image, points in the ROI image can be mapped onto the grid based on the Mesh Grid coordinate system. For each point in the grid, a triangulation algorithm can be used to construct triangular faces. Specifically, this can be done by traversing the points in the Mesh Grid coordinate system and processing each point... The coordinates generate four vertices, and based on these four vertices, two triangles are formed to construct the surface of the model. All surface triangles of the model are constructed in this way. For example, its coordinates in the Mesh Grid coordinate system are... The coordinates of its three adjacent vertices are: , and Then the order of the first triangle is... - - The order of the second triangle is - - In this way, the triangles constructed share edges (0-1) with two opposite directions, ensuring that the generated triangle faces can have normal vectors in the same direction. Finally, the coordinates and indices of the constructed triangle vertices are saved to generate the index structure of the Triangle Mesh.
[0049] After constructing the surface triangles of the model, the bottom surface will have large rectangular faces (each rectangular face is composed of two triangles). Therefore, triangles with a vertex height of a preset value, such as 0, can be removed. Specifically, this can be done by traversing all vertices, obtaining their Z-axis height values, determining if any vertices have a height of 0, removing triangles with a height of 0, and storing vertices that meet the condition (vertex height not equal to 0) in a temporary space. During the vertex traversal, triangle indices are constructed according to the vertex traversal order. A new mesh structure is generated to store vertex coordinates and vertex index order. This traversal process is also the process of constructing the surface triangles of the model. It is understood that in other embodiments, invalid faces with heights of 0.01, 0.02, or other heights can also be removed.
[0050] After traversing all vertices and removing triangles with a height of 0, the temporary space stored during the surface mesh construction process can be used to obtain the vertices and their triangle indices for all surfaces. Then, using projection rules, the coordinates of the remaining surface vertices projected onto the base face are calculated, yielding the base face coordinates of the vertices. Having obtained the base face coordinates of all surface vertices, the vertices projected onto the base face can be connected sequentially in the reverse order of the surface triangle face construction to complete the construction of the base triangle face. This results in a complete 3D polygonal geometry model.
[0051] S400 determines the slicing information of a 3D polygonal geometry model based on the region of interest image.
[0052] In this embodiment, slicing refers to cutting a three-dimensional polygonal geometric model according to a certain direction or interval to obtain a series of two-dimensional cross-sections (slices). Slicing information includes, but is not limited to, the number of slice layers of the three-dimensional polygonal geometric model, the color of each layer, the color height, and the height range. Slicing information can be used to analyze the internal structure of the model, assist in the manufacturing process (such as 3D printing), or perform other forms of data processing.
[0053] In practical applications, to reproduce the color style of the original image, 3D printers need to print in layers using consumables of different colors. Therefore, after generating the three-dimensional polygonal geometric model, it is also necessary to determine the color information and slicing information such as color height for each layer of the model.
[0054] Specifically, parameters such as slice direction and slice spacing can be determined. Then, the 3D polygonal geometry model is divided into multiple slices. Based on the color and texture information in the region of interest image, corresponding attributes such as color and height are assigned to each slice to obtain slice information. After obtaining the slice information, the printer can be controlled to print the 3D polygonal geometry model according to this slice information.
[0055] The aforementioned method for determining the slice information of a 3D polygonal geometry model provides a scheme for generating a 3D polygonal geometry model corresponding to the polygonal geometry based on a 2D image of the polygonal geometry. Specifically, after extracting the region of interest (ROI) image containing the polygonal geometry from the color image of the polygonal geometry, a grid coordinate system is created based on the ROI image. Based on the ROI image and the grid coordinate system, surface triangular patches of the 3D polygonal geometry model are constructed. Triangular patches with vertex heights of preset values are removed, which helps to eliminate invalid or overlapping patches. Then, triangular patches with vertex heights of preset values are removed, and the bottom triangular patches of the 3D polygonal geometry model are constructed to obtain the 3D polygonal geometry model. Finally, the slice information of the 3D polygonal geometry model is determined based on the ROI image. The entire solution can generate corresponding 3D polygonal geometry models based on different 2D color images of polygonal geometries input by the user, and determine the model slicing information. It supports automated printing of 3D models. Furthermore, by removing triangular faces with preset vertex heights, it can eliminate invalid or overlapping faces, simplifying the structure of the 3D polygonal geometry model. This results in the generated 3D polygonal geometry model having a bottom surface with precise boundaries, and eliminates the problem of large rectangular faces at the bottom when the user previews the model. Consequently, the boundaries of the 3D model printed based on the 3D polygonal geometry model and slicing information are clearer and more accurate.
[0056] like Figure 4 As shown, in an exemplary embodiment, S200 includes: S220, performing image preprocessing on the region of interest image to generate a point cloud map, the image preprocessing including size reduction processing, and creating a grid coordinate system based on the point cloud map.
[0057] S300, followed by: S320, performing post-processing on the three-dimensional polygonal geometry model to obtain the target three-dimensional polygonal geometry model, the post-processing including enlarging the three-dimensional polygonal geometry model to a preset size.
[0058] S400 includes: S402, determining slice information of the target 3D polygonal geometry model based on the region of interest image.
[0059] A point cloud contains a series of points located in 3D space, each point representing a pixel location on the original image and its depth information.
[0060] In practice, after obtaining the region of interest (ROI) image, preprocessing such as denoising, scaling, grayscale conversion, edge detection, and normalization can be performed. Then, a point cloud is generated based on the depth or height information in the ROI image. It should be noted that constructing a point cloud from the original image to generate a Triangle Mesh is too time-consuming. Due to the high resolution of the original image, the number of point clouds generated is large, and constructing the Triangle Mesh requires traversing each point cloud to build a triangle sequence, resulting in significant computational time. Therefore, in this embodiment, scaling the ROI image refers to reducing its resolution (i.e., reducing its size) to decrease computational load and memory usage, thus accelerating the subsequent generation of the Triangle Mesh. For example, if the ROI image resolution is 1920x1080, scaling it down to half its original size results in a resolution of 960x540.
[0061] After the above processing, once the point cloud map is generated, a MeshGrid coordinate system can be created based on the attributes of the point cloud data in the map. Specifically, when constructing the Mesh Grid coordinate system, for the x-axis coordinate, an array of the same size as the point cloud map can be created, with the number of columns in the point cloud map as the length, generating equally spaced x-axis coordinates, and storing the x-axis coordinate of each row of point clouds in the array. If the point cloud data has N columns, an array of length N will be generated, with the elements of this array increasing at fixed intervals d according to their position along the x-axis. Similarly, for the y-axis coordinate, equally spaced y-axis coordinates can be generated with the number of rows in the point cloud map as the length, storing the y-axis coordinate of each column of point clouds in an array. Specifically, the Mesh Grid coordinate system can be as follows: Figure 3 As shown. The z-axis array stores the value of each point cloud. The x, y, and z arrays constitute the Mesh Grid coordinate system. For example, point... The coordinates of the Mesh Grid are Subsequently, based on the Mesh Grid coordinate system, the pixels in the region of interest image are mapped to three-dimensional space, and a three-dimensional polygonal geometric model is obtained according to the model construction method described in the above embodiment.
[0062] After obtaining the 3D polygonal geometry model, post-processing operations can be performed on the model to generate a model suitable for 3D printer slicing and printing. Specifically, in this embodiment, post-processing mainly includes face reduction, normal inversion, and rotation operations.
[0063] It should be noted that the polygon reduction operation in this embodiment differs from traditional 3D model polygon reduction operations. Instead, it involves scaling up the generated 3D polygon geometry model from a small size to a preset large size. Specifically, because the size of the region of interest image was reduced in the preceding image preprocessing stage, a second scaling operation is needed after constructing the 3D polygon geometry model to bring it back to the required size. Since the scaling operation has low computational complexity and almost no time consumption, the time to construct the T 3D polygon geometry model is reduced by 10 times. Furthermore, scaling from a small 3D polygon geometry model to a large size achieves the same polygon reduction effect as 3D model polygon reduction algorithms, while simultaneously reducing the memory size of the generated model by 9 times, without incurring additional time and resources for polygon reduction calculations.
[0064] After reducing the number of faces in the model, the normals of the triangular faces are calculated and inverted to adapt to the lighting and reflection effects of the slicing software, allowing users to observe clear surface textures. Since the construction of the Triangle Mesh involves traversing the input color image in reverse order, the model needs to be rotated back to a normal viewpoint when generating the final 3D polygon geometry model. After completing the above post-processing operations, the post-processed 3D polygon geometry model can be saved in the STL format, a common format for 3D printing.
[0065] In an exemplary embodiment, image preprocessing is performed on the region of interest image to generate a point cloud image, including: performing grayscale processing, size reduction processing, and normalization processing on the region of interest image to obtain a target grayscale image; converting the grayscale information in the target grayscale image into height information to obtain an initial point cloud image; and performing boundary zero-padding processing on the initial point cloud image to obtain a final point cloud image.
[0066] In this embodiment, image preprocessing is performed on the region of interest image, including but not limited to grayscale conversion, size reduction, and normalization. Grayscale conversion of the region of interest image can also be performed using preset grayscale weights to obtain a grayscale image.
[0067] In other embodiments, the optimal target grayscale weight may be determined first. Then, based on the target grayscale weight, the region of interest image may be converted into a grayscale image. Subsequently, the size of the grayscale image may be reduced. Finally, image normalization may be performed to map the pixel values to a smaller range to obtain the target grayscale image. This reduces the dynamic range of the data, reduces the impact of changes in illumination and exposure, and improves the stability of subsequent algorithm steps.
[0068] Next, after obtaining the target grayscale image, the grayscale information in the target grayscale image can be converted into height information using a preset height value conversion formula to obtain the initial point cloud map. Specifically, the height value conversion formula is as follows:
[0069]
[0070] in, and These are the maximum and minimum heights for generating a 3D polygonal geometry model. It is the gray value of a pixel in the target grayscale image. and These are the maximum and minimum gray levels of the target grayscale image, respectively.
[0071] After converting grayscale values to height values, an initial point cloud is generated based on the height values of the pixels. Further, the initial point cloud can be padded with zeros to obtain a point cloud with zero boundaries.
[0072] In this embodiment, by performing grayscale conversion, size reduction, and normalization on the region of interest image, and then applying zero-padding to the generated grayscale image, a high-quality point cloud image with clear boundaries is obtained. Furthermore, grayscale conversion facilitates data dimensionality reduction and saves memory space, significantly reducing image storage requirements and improving the computational efficiency of subsequent processing.
[0073] like Figure 5 As shown, in an exemplary embodiment, the target grayscale weight is determined based on the following steps:
[0074] S222, obtain the initial grayscale weights.
[0075] S224, combine the initial grayscale weights to obtain multiple grayscale weight combinations.
[0076] S226, based on each gray-level weight combination, convert the region of interest image into a grayscale image and determine the standard deviation of the grayscale image.
[0077] S228, determine the average standard deviation based on the standard deviation of the grayscale image under each grayscale weight combination.
[0078] S230, the grayscale weights corresponding to the standard deviations with the largest difference from the mean standard deviations are combined and determined as the target grayscale weights.
[0079] This embodiment explains how to determine the optimal target grayscale weights. For example, the grayscale weights can be initialized to (0.2989, 0.5870, 0.1140). Then, the initialized weights are arranged and combined to obtain six different grayscale weight combinations. Subsequently, based on each grayscale weight combination, the region of interest image is converted to a grayscale image, and the standard deviation of the converted grayscale image is determined. This results in six different grayscale images and six different standard deviations. Next, based on the standard deviations of the grayscale images under each grayscale weight combination, the average standard deviation is determined. Each standard deviation is then compared with the average standard deviation, and the standard deviation with the largest difference from the average standard deviation is selected. The grayscale weight combination corresponding to the selected standard deviation is then determined as the target grayscale weight. Specifically, the grayscale weights can be determined using the following formula:
[0080]
[0081]
[0082] in, , , These are the weights for the red, green, and blue channels, respectively. stddev is the calculated standard deviation, N is the number of pixels, μ is the average pixel value, avg_stddev is the average standard deviation of all grayscale weights, and M is the number of grayscale weight combinations.
[0083] In this embodiment, by combining the initial grayscale weights and comparing the difference between the standard deviation and the average of the standard deviations of the grayscale weights, the optimal grayscale weights can be determined conveniently and reasonably. Furthermore, the grayscale difference between different color systems can be maximized in subsequent grayscale processing.
[0084] In one exemplary embodiment, such as Figure 6 As shown, in one embodiment, S400 includes:
[0085] S420: Cluster the pixels in the region of interest image, and determine the color value of each level of the 3D polygon geometry model based on the center point of each cluster.
[0086] S440 converts the color value of each level into a height value to obtain the level color height.
[0087] S460: Sort the hierarchical color heights and adjust the initial hierarchical height range of the 3D polygonal geometry model based on the sorted hierarchical color heights. The initial hierarchical height range is determined based on the number of clusters.
[0088] S480, based on the adjusted layer height range and the preset slice layer height, determines the slice layer sequence.
[0089] In this embodiment, the slice information includes the model's layer color height, layer height range, and slice layer sequence. The number of clusters refers to the optimal number of color clusters for the region of interest image, and this number is also the number of layers in the model.
[0090] Specifically, the number of clusters n in the region of interest image can be determined by the elbow rule or other optimal clustering number determination methods. The number of clusters is then used as the number of layers in the model. Subsequently, based on the number of layers, the model is divided into n layers according to the maximum height of the model, and the initial layer height range of the model is determined.
[0091] Next, based on the number of clusters, the pixels in the region of interest image are clustered using a clustering algorithm such as k-means to obtain multiple clusters. Subsequently, the center point of each cluster is extracted, and the color of the center pixel of each cluster is determined as the color value for each level.
[0092] After obtaining the color values for each level, the color values can be converted into height values through grayscale conversion or color mapping to obtain the level color height. Color mapping refers to defining a mapping table from color to height values, which maps specific color ranges to specific height values, allowing different colors in a color image to represent different heights. Since there is a one-to-one correspondence between level color information and level color height information, quicksort can be used to sort the level color height information in ascending order, while adjusting the indices of each level color information to correspond to the sorted level color height information.
[0093] Since the layer color height and the initial layer height are corresponding to each layer, it is necessary to determine whether the color height of the current layer is within the range of the initial layer height. If the color height is not within the range of the initial layer height, the upper or lower limit of the initial layer height range needs to be adjusted to include the layer color height information. For example, if the color height of the current layer exceeds the upper limit of the current layer height, the upper limit of the current layer is set to that color height, and the lower limit of the height range of the next layer is set to the color height of the current layer to avoid discontinuous height ranges. Similarly, if the color height of the current layer is less than the lower limit of the current layer height, the lower limit of the current layer is set to the color height of the current layer, and the height range of the previous layer is adjusted.
[0094] Before printing, 3D printers need to slice the three-dimensional polygonal geometric model and output the number of slice layers to determine the printing motion logic. The number of slice layers depends on the layer height set by the slicing software. Therefore, after obtaining the layer height range and layer color height of the model, the slice layer sequence of the model can be determined based on the adjusted layer height range. In this way, the model can be rendered during model preview to make it closely resemble the effect of the actual 3D printed product.
[0095] For example, this can be achieved by iterating through each layer, dividing the height of each layer by the slice layer height to obtain the specific slice layer number. Then, the upper limit of the current layer is rounded up, and the lower limit of the next layer is increased by 1 from the upper limit of the current layer, thus obtaining the slice layer sequence of the model. Finally, the layer color height, the adjusted layer height range, and the slice layer sequence are aggregated and integrated to obtain the final slice information.
[0096] In this embodiment, by using clustering and color height conversion processing, the slicing information, including the model's layer color height, the adjusted layer height range, and the slice layer sequence, is determined. This enables the 3D printer to directly print layers based on the slicing information, producing a 3D model that matches the effect of the color image, without requiring the user to perform settings operations in numerous color and layer configurations.
[0097] In one embodiment, S440 includes: performing grayscale processing on the color value of each level, and converting the color value of each level into a height value.
[0098] Because different color images have different color systems, using the default grayscale coefficient for grayscale conversion will result in similar grayscale values for different color systems, leading to different color systems being assigned to the same layer height, which affects the final color layering effect. Therefore, in this embodiment, the values of the RGB (Red, Green, Blue) channels in the region of interest image can be extracted, and the optimal target grayscale weight of the region of interest image can be calculated. Then, according to the optimal target grayscale weight, the color values of each layer are grayscaled, converting the color values of each layer into grayscale values, and then converting the grayscale values into height values, thus achieving the conversion from color values to height values for each layer. A higher grayscale value represents a higher height. The target grayscale weight refers to the grayscale weight used to maximize the grayscale difference between different color systems. It is understandable that the target grayscale weight can also be obtained by combining the initial grayscale weights to obtain multiple grayscale weight combinations. Based on each grayscale weight combination, the region of interest image is converted into a grayscale image, the standard deviation of the grayscale image is determined, and the average standard deviation is determined based on the standard deviation of the grayscale image under each grayscale weight combination. The grayscale weight combination corresponding to the standard deviation with the largest difference from the average standard deviation is determined as the target grayscale weight. For the specific process, please refer to the determination process of the target grayscale weight in the above embodiment.
[0099] In this embodiment, grayscale conversion can quickly and accurately convert the color values of the region of interest image into height values.
[0100] like Figure 7 As shown, in one embodiment, S100 includes:
[0101] S120, acquire the color image of the polygonal geometry, and determine the foreground mask of the color image of the polygonal geometry.
[0102] S140, merge the foreground mask with the polygonal geometry color image to obtain the target RGBA (Red, Green, Blue, Alpha) image.
[0103] S160, determine the maximum bounding rectangle of the foreground mask in the target RGBA image.
[0104] S180: Extract the region of interest image containing polygonal geometry from the target RGBA image, which matches the area of the largest bounding rectangle.
[0105] A foreground mask, also known as a mask, is a binary image used to identify foreground objects in an image. In this embodiment, the foreground mask of a polygonal geometric color image refers to a binary image used to identify polygonal geometric objects in the image. RGBA is a color representation method, short for Red, Green, Blue, and Alpha Channel. The Alpha channel controls the transparency of the corresponding area displayed in the image.
[0106] In practical applications, taking a color image of a polygonal geometric shape as an example of a color badge image, the user can upload the color badge image to the server via a terminal. The server first initializes the matting inference engine. For example, it can select the u2net model and convert it to ONNX format as the matting inference engine. Specifically, this includes loading the local ONNX model file, setting the graph optimization level of the ONNX runtime, capturing the number of CPU cores on the local device, and adapting the most suitable number of threads in the internal thread pool and the number of threads for parallel operations. An ONNX runtime session is created, and the input and output dimensions of the ONNX model are obtained. Next, the user-input color badge image (hereinafter referred to as the color image) is preprocessed to convert the input color image to ONNX input format. Specifically, the color image can be scaled to a dimension of (320, 320, 3). Then, the maximum and minimum values of the red, green, and blue channels in the color image are calculated, and normalization is performed. The normalization formula is as follows:
[0107]
[0108] in, This represents the current minimum value of channel c. This indicates the current maximum value of channel c. Indicates the c channel of a color image The pixel value of the coordinate.
[0109] The normalized color image is converted from a 3D array to a 1D array, with the red channel first and the blue channel last. The tensor data stream is defined as (320, 320, 3), and data is copied into the tensor stream. Next, the acquired tensor stream is input into an ONNX model for inference, and the model output is converted into a 32-bit Mat data structure. This output is then normalized to restore the values, thus obtaining the foreground mask for a single channel of the image. The foreground mask is then merged with the original input color image (which has red, green, and blue channels). This means the foreground mask is applied to the color image, and the visibility of corresponding pixels in the color image is controlled by the pixel value in the foreground mask, resulting in a polygonal geometric RGBA image (i.e., the target RGBA image).
[0110] Next, the foreground mask is separated from the channels of the polygon geometry RGBA image, and then the connected component is calculated on the foreground mask to determine the maximum bounding rectangle of the foreground mask. The region of interest image containing the polygon geometry that matches the maximum bounding rectangle is then cropped from the polygon geometry RGBA image.
[0111] In this embodiment, a series of image processing steps are used to achieve precise isolation, transparency support, and resource optimization of polygonal geometry, laying a solid foundation for subsequent visual analysis and applications.
[0112] In one embodiment, S120 includes: performing mask prediction on the color image of the polygonal geometry to obtain an initial foreground mask, performing image post-processing on the initial foreground mask, the image post-processing including edge smoothing and connected region filling, and determining the connected region with the largest area as the foreground mask of the color image of the polygonal geometry.
[0113] Following the previous embodiment, after performing mask prediction on the color image of the polygonal geometry using model inference to obtain the initial foreground mask, the edges of the initial foreground mask obtained by model inference are relatively rough. Therefore, it is necessary to optimize and smooth the jagged edges. Specifically, this can be done by performing an opening operation on the initial foreground mask, connecting adjacent pixels at the edges of the foreground mask, and then smoothing it with Gaussian blur. Then, the image is segmented to facilitate parallel alpha matting processing and reduce processing time. Secondly, a connected component refers to a continuous set of pixels with similar properties in an image. Since the initial foreground mask output by the model may contain multiple connected components, and the polygonal geometry that the user wants to print is usually the connected component with the largest area in the color image of the polygonal geometry, it can be done by finding all connected components in the initial foreground mask through connected component analysis. Then, the connected component with the largest area is extracted from all connected components, and the holes in the largest connected component are filled to form a complete foreground mask without holes. Specifically, the process can begin by filling the holes in each connected region of the initial foreground mask using a full-water filling algorithm. Then, connected regions within the initial foreground mask are identified, their contour coordinates are calculated, and the area of each connected region is determined. Finally, the connected region with the largest area is selected from all connected regions, redrawn, and designated as the final foreground mask.
[0114] In this embodiment, edge smoothing of the foreground mask can reduce the jagged effect in the initial foreground mask, making the boundary smoother and more natural, thus more accurately reflecting the true outline of the polygonal geometry. By filling connected regions, small holes can be filled to ensure that the mask covers the entire target polygonal geometry, thereby improving the quality of the foreground mask.
[0115] To provide a clearer explanation of the method for determining slice information of a three-dimensional polygonal geometric model provided in this application, a specific embodiment is described below, which includes the following steps:
[0116] S1. Obtain a color image of a polygonal geometry, perform mask prediction on the color image of the polygonal geometry to obtain an initial foreground mask, and perform image post-processing on the initial foreground mask. Image post-processing includes edge smoothing and connected region filling. The connected region with the largest area is determined as the foreground mask of the color image of the polygonal geometry.
[0117] S2, merge the foreground mask with the polygonal geometry color image to obtain the target RGBA image.
[0118] S3, determine the maximum bounding rectangle of the foreground mask in the target RGBA image.
[0119] S4, extract the region of interest image containing polygonal geometry from the target RGBA image that matches the area of the largest bounding rectangle.
[0120] S5. Perform grayscale conversion, size reduction, and normalization on the region of interest image to obtain the target grayscale image. Convert the grayscale information in the target grayscale image into height information to obtain the initial point cloud image. Perform zero-filling processing on the boundary of the initial point cloud image to obtain the final point cloud image.
[0121] Specifically, regarding grayscale processing, the region of interest (ROI) image can be grayscaled based on the optimal target grayscale weights. Determining the target grayscale weights can be achieved by first initializing the grayscale weights to (0.2989, 0.5870, 0.1140), and then permuting and combining these initial weights to obtain six different grayscale weight combinations. Subsequently, based on each grayscale weight combination, the ROI image is converted to a grayscale image, and the standard deviation of the converted grayscale image is determined, resulting in six different grayscale images and six different standard deviations. Next, based on the standard deviations of the grayscale images under each grayscale weight combination, the average standard deviation is determined. Then, each standard deviation is compared with the average standard deviation, and the standard deviation with the largest difference from the average standard deviation is selected. The grayscale weight combination corresponding to this selected standard deviation is then determined as the target grayscale weight.
[0122] S6, based on the point cloud map, creates a grid coordinate system.
[0123] S7, based on the grid coordinate system and point cloud map, constructs surface triangular patches of a 3D polygonal geometric model and removes triangular patches with vertex height of 0.
[0124] S8. Determine the coordinates of the remaining vertices projected onto the bottom surface. Connect the vertices based on the bottom surface coordinates to construct the bottom triangular facets of the three-dimensional polygonal geometry model, thus obtaining the three-dimensional polygonal geometry model.
[0125] S9, perform post-processing on the three-dimensional polygon geometry model to obtain the target three-dimensional polygon geometry model corresponding to the polygon geometry. The post-processing includes enlarging the three-dimensional polygon geometry model to a preset size.
[0126] S10, determine the number of clusters in the region of interest image, and based on the number of clusters, determine the initial hierarchical height range of the target 3D polygonal geometry model.
[0127] S11, based on the number of clusters, cluster the pixels in the region of interest image, and determine the color value of each level according to the center point of each cluster.
[0128] S12 converts the color value of each level into a height value to obtain the level color height.
[0129] S13, sort the layer color heights, and adjust the initial layer height range based on the sorted layer color heights.
[0130] S14. Based on the adjusted layer height range and the preset slice layer height, determine the slice layer sequence.
[0131] S15, collect the layer color height, the adjusted layer height range, and the slice layer sequence to obtain the slice information of the three-dimensional polygon geometry model.
[0132] Furthermore, based on the slice information, different colored consumables can be used to print out a three-dimensional polygonal geometric model that closely resembles the effect of a color image of a polygonal geometry.
[0133] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0134] Based on the same inventive concept, this application also provides a three-dimensional polygonal geometric model slice information determination device for implementing the above-described method for determining three-dimensional polygonal geometric model slice information. The solution provided by this device is similar to the solution described in the above-described method. Therefore, the specific limitations of one or more embodiments of the three-dimensional polygonal geometric model slice information determination device provided below can be found in the limitations of the three-dimensional polygonal geometric model slice information determination method described above, and will not be repeated here.
[0135] In one exemplary embodiment, such as Figure 8 As shown, a device 800 for determining slice information of a three-dimensional polygonal geometry model is provided, including: an image extraction module 810, a coordinate system creation module 820, a model construction module 830, and a slice information determination module 840, wherein:
[0136] The image extraction module 810 is used to extract the region of interest containing the polygon geometry from a color image of the polygon geometry.
[0137] The coordinate system creation module 820 is used to create a grid coordinate system based on the region of interest image.
[0138] The model building module 830 is used to construct surface triangular patches of a 3D polygonal geometry model based on the region of interest image and the grid coordinate system, remove triangular patches with a preset vertex height, construct the bottom triangular patches of the 3D polygonal geometry model, and obtain the 3D polygonal geometry model.
[0139] The slice information determination module 840 is used to determine the slice information of a three-dimensional polygonal geometric model based on the region of interest image.
[0140] In one exemplary embodiment, the slice information determination module 840 is further configured to cluster the pixels in the region of interest image, determine the color value of each level of the three-dimensional polygonal geometry model based on the center point of each cluster, convert the color value of each level into a height value to obtain the level color height, sort the level color heights, adjust the initial level height range of the three-dimensional polygonal geometry model based on the sorted level color heights, the initial level height range being determined based on the number of clusters, and determine the slice layer number sequence based on the adjusted level height range and the preset slice layer height, wherein the slice information includes the level color height, the adjusted level height range, and the slice layer number sequence.
[0141] In one exemplary embodiment, the slice information determination module 840 is further configured to perform grayscale processing on the color value of each layer, converting the color value of each layer into a height value.
[0142] In one exemplary embodiment, the coordinate system creation module 820 is further configured to perform image preprocessing on the region of interest image to generate a point cloud map. The image preprocessing includes size reduction processing and, based on the point cloud map, creating a grid coordinate system.
[0143] like Figure 9 As shown, the device also includes a model post-processing module 850, which is used to perform model post-processing on the three-dimensional polygonal geometry model to obtain the target three-dimensional polygonal geometry model. The model post-processing includes enlarging the three-dimensional polygonal geometry model to a preset size.
[0144] In one exemplary embodiment, the coordinate system creation module 820 is further configured to perform grayscale processing, size reduction processing, and normalization processing on the region of interest image to obtain a target grayscale image, convert the grayscale information in the target grayscale image into height information to obtain an initial point cloud image, and perform boundary zero-filling processing on the initial point cloud image to obtain a point cloud image.
[0145] In one exemplary embodiment, the coordinate system creation module 820 is further configured to determine a target grayscale weight and, based on the target grayscale weight, perform grayscale processing on the region of interest image.
[0146] In one exemplary embodiment, the slice information determination module 840 is further configured to determine a target grayscale weight and, based on the target grayscale weight, perform grayscale processing on the color value of each level.
[0147] like Figure 9 As shown, in one exemplary embodiment, the device further includes a target grayscale weight determination module 860, which is used to obtain initial grayscale weights, combine the initial grayscale weights to obtain multiple grayscale weight combinations, convert the region of interest image into a grayscale image based on each grayscale weight combination, determine the standard deviation of the grayscale image, determine the average standard deviation based on the standard deviation of the grayscale image under each grayscale weight combination, and determine the grayscale weight combination corresponding to the standard deviation with the largest difference from the average standard deviation as the target grayscale weight.
[0148] In one embodiment, the image extraction module 810 is further configured to acquire a color image of a polygonal geometry, determine a foreground mask of the color image of the polygonal geometry, merge the foreground mask with the color image of the polygonal geometry to obtain a target RGBA image, determine the maximum bounding rectangle of the foreground mask in the target RGBA image, and extract a region of interest image containing a polygonal geometry from the target RGBA image that matches the area of the maximum bounding rectangle.
[0149] In one exemplary embodiment, the image extraction module 810 is further configured to perform mask prediction on the polygonal geometric color image to obtain an initial foreground mask, perform image post-processing on the initial foreground mask, the image post-processing including edge smoothing and connected region filling, and determine the connected region with the largest area in the filled connected region as the foreground mask of the polygonal geometric color image.
[0150] The modules in the aforementioned device for determining the slice information of a 3D polygonal geometric model can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0151] In one embodiment, a printer is provided, which includes a controller and a printhead. The controller is used to perform the steps in the embodiment of the method for determining the slice information of a three-dimensional polygonal geometry model as described above, processing the acquired color image of the polygonal geometry to determine the slice information of the three-dimensional polygonal geometry model corresponding to the polygonal geometry, and controlling the printhead to move based on the slice information to print out the three-dimensional polygonal geometry model.
[0152] It is understood that in some other embodiments, the steps of the above-mentioned method for determining the slice information of a three-dimensional polygon geometry model can also be executed by a server or other terminal with computing capabilities. The obtained polygon geometry color image is processed to determine the slice information of the three-dimensional polygon geometry model corresponding to the polygon geometry. Then, a print message carrying the slice information of the three-dimensional polygon geometry model is sent to the printer, and the printer performs the printing task to print out the three-dimensional polygon geometry model.
[0153] It is understandable that, in addition to the modules listed above, printers may also include other modules such as printheads, camera devices, and power supply modules, which will not be listed here.
[0154] Those skilled in the art will understand that the structure in the printer described above is only a part of the structure related to the solution of this application, and does not constitute a limitation on the printer to which the solution of this application is applied. A specific printer may include more or fewer components than those listed above, or combine certain components, or have different component arrangements.
[0155] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as color images of polygonal geometries, region-of-interest (ROI) images, and slice information. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for determining slice information of a three-dimensional polygonal geometry model.
[0156] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0157] In one exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometry model.
[0158] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometry model.
[0159] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the method for determining slice information of a three-dimensional polygonal geometry model.
[0160] It should be noted that the data involved in this application (including but not limited to data used for analysis such as color images of polygonal geometry and images of regions of interest, stored data, and displayed data) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations.
[0161] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0163] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for determining slice information of a three-dimensional polygonal geometric model, characterized in that, The method includes: Extracting the region of interest (ROI) image containing the polygonal geometry from a color image of the polygonal geometry; Based on the image of the region of interest, a grid coordinate system is created; Based on the region of interest image and the grid coordinate system, surface triangular patches of a three-dimensional polygonal geometric model are constructed, triangular patches with vertex heights of preset values are removed, and bottom triangular patches of the three-dimensional polygonal geometric model are constructed to obtain the three-dimensional polygonal geometric model. Based on the region of interest image, the slice information of the three-dimensional polygonal geometry model is determined.
2. The method according to claim 1, characterized in that, The step of determining the slice information of the three-dimensional polygonal geometry model based on the region of interest image includes: Cluster the pixels in the region of interest image, and determine the color value of each level of the three-dimensional polygonal geometry model based on the center point of each cluster obtained by clustering. Convert the color value of each level to a height value to obtain the level color height; The hierarchical color heights are sorted, and the initial hierarchical height range of the three-dimensional polygonal geometry model is adjusted based on the sorted hierarchical color heights. The initial hierarchical height range is determined based on the number of clusters. Based on the adjusted layer height range and the preset slice layer height, determine the slice layer number sequence; The slice information includes the layer color height, the adjusted layer height range, and the slice layer number sequence.
3. The method according to claim 2, characterized in that, The process of converting the color value of each level to a height value includes: The color values of each level are converted to grayscale, and then the color values of each level are converted to height values.
4. The method according to claim 1, characterized in that, The step of creating a grid coordinate system based on the region of interest image includes: The image of the region of interest is preprocessed to generate a point cloud map. The image preprocessing includes a size reduction process. Based on the point cloud map, create a grid coordinate system; After obtaining the three-dimensional polygonal geometric model, the process also includes: The three-dimensional polygonal geometry model is post-processed to obtain the target three-dimensional polygonal geometry model. The post-processing includes enlarging the three-dimensional polygonal geometry model to a preset size.
5. The method according to claim 4, characterized in that, The step of preprocessing the image of the region of interest to generate a point cloud map includes: The region of interest image is subjected to at least one of the following processing methods: grayscale conversion, size reduction, and normalization, to obtain a target grayscale image. The grayscale information in the target grayscale image is converted into height information to obtain an initial point cloud image; The initial point cloud map is subjected to boundary zero-filling processing to obtain the point cloud map.
6. The method according to claim 3 or 5, characterized in that, The image of the region of interest or the color values of each level are converted to grayscale, including: Determine the target grayscale weight; Based on the target grayscale weight, the image of the region of interest or the color value of each level is grayscaled.
7. The method according to claim 6, characterized in that, The determined target grayscale weights include: Obtain the initial grayscale weights; By combining the initial grayscale weights, multiple grayscale weight combinations are obtained; Based on each gray-level weight combination, the region of interest image is converted into a grayscale image, and the standard deviation of the grayscale image is determined. Determine the average standard deviation based on the standard deviation of the grayscale image under each grayscale weight combination; The grayscale weights corresponding to the standard deviations that have the largest difference from the average standard deviation are combined and determined as the target grayscale weights.
8. The method according to any one of claims 1 to 5, characterized in that, The step of extracting the region of interest image containing the polygonal geometry from the color image of the polygonal geometry includes: Acquire a color image of a polygonal geometry and determine the foreground mask of the color image of the polygonal geometry; The foreground mask is merged with the color image of the polygonal geometry to obtain the target RGBA image; Determine the maximum bounding rectangle of the foreground mask in the target RGBA image; From the target RGBA image, extract the region of interest image containing polygonal geometry that matches the area of the largest bounding rectangle.
9. The method according to claim 8, characterized in that, Determining the foreground mask of the polygonal geometry color image includes: Perform mask prediction on the color image of the polygonal geometry to obtain an initial foreground mask; The initial foreground mask is subjected to image post-processing, which includes edge smoothing and connected region filling. The largest connected region after filling is determined as the foreground mask of the polygonal geometry color image.
10. A printer, characterized in that, The device includes a controller and a nozzle. The controller is used to perform the steps of the method for determining slice information of a three-dimensional polygonal geometry model as described in any one of claims 1 to 9, processing the acquired polygonal geometry color image, determining the slice information of the three-dimensional polygonal geometry model corresponding to the polygonal geometry, and controlling the movement of the nozzle based on the slice information to print the three-dimensional polygonal geometry model.