Method for determining slice information of three-dimensional polygonal geometric body model, and printer
By extracting the region of interest from a color image of a polygonal geometry, creating a grid coordinate system, and constructing surface and bottom triangular patches of a 3D polygonal geometry model, the problem of inaccurate printing precision in existing technologies is solved, and higher precision 3D polygonal geometry model printing is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2026-03-05
AI Technical Summary
Existing 3D printing technology has the problem that the printed product deviates from the user's expectations when generating three-dimensional polygonal geometric models, resulting in insufficient printing accuracy.
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, and removing the triangular patches with a preset vertex height, the slicing information is determined, and a more accurate 3D polygonal geometry model is generated.
It improves the printing accuracy of 3D polygonal geometry models, ensures clear and distinct model boundaries, eliminates the problem of large rectangular patches at the bottom, and achieves higher printing accuracy.
Smart Images

Figure CN2025116672_05032026_PF_FP_ABST
Abstract
Description
Methods for determining slice information of 3D polygon geometry models and printers
[0001] Related applications
[0002] This application claims priority to Chinese patent application filed on August 26, 2024, application number 2024111783140, entitled "Method and related apparatus for determining slice information of three-dimensional polygonal geometric model", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of computer vision technology, and in particular to a method for determining slice information of a three-dimensional polygonal geometric model and a printer. Background Technology
[0004] 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 polygonal geometric printed products, as personalized works of art and decorations, are increasingly welcomed and loved by users.
[0005] Currently, to meet users' printing needs, some platforms offer user-friendly interfaces that allow users to upload 2D polygon images and convert them into 3D polygon models, providing real-time previews so users can modify and adjust layers and colors, ultimately printing the corresponding finished product based on the user-selected image. However, 3D printed products using these methods still deviate somewhat from user expectations. Summary of the Invention
[0006] Therefore, it is necessary to provide a method and printer for determining the slice information of a three-dimensional polygonal geometric model that can support the generation of more accurate 3D printed products, in order to address the above-mentioned technical problems.
[0007] Firstly, this application provides a method for determining slice information of a three-dimensional polygonal geometric model, including:
[0008] Extracting the region of interest (ROI) image containing the polygonal geometry from a color image of the polygonal geometry;
[0009] Based on the image of the region of interest, a grid coordinate system is created;
[0010] 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.
[0011] Based on the region of interest image, the slice information of the three-dimensional polygonal geometry model is determined.
[0012] Secondly, this application also provides a printer, including a controller and a printhead. The controller is used to perform the steps in the above-described embodiment of the method for determining the slice information of a three-dimensional polygonal geometry model, process the acquired polygonal geometry color image, determine the slice information of the three-dimensional polygonal geometry model corresponding to the polygonal geometry, and control the printhead to move based on the slice information to print the three-dimensional polygonal geometry model.
[0013] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.
[0015] Figure 1 is an application environment diagram of the method for determining slice information of three-dimensional polygon geometry model in one or more embodiments;
[0016] Figure 2 is a flowchart illustrating the method for determining slice information of a three-dimensional polygonal geometry model based on one or more embodiments;
[0017] Figure 3 is a schematic diagram of the Mesh Grid coordinate system generated according to one or more embodiments;
[0018] Figure 4 is a flowchart illustrating the method for determining slice information of a three-dimensional polygonal geometry model based on one or more embodiments;
[0019] Figure 5 is a flowchart illustrating the steps for determining the target grayscale weight according to one or more embodiments;
[0020] Figure 6 is a flowchart illustrating the steps for obtaining slice information according to one or more embodiments;
[0021] Figure 7 is a flowchart illustrating the steps for obtaining an image of a region of interest according to one or more embodiments;
[0022] Figure 8 is a structural block diagram of the device for determining slice information of a three-dimensional polygonal geometry model based on one or more embodiments;
[0023] Figure 9 is a structural block diagram of the device for determining slice information of a three-dimensional polygonal geometry model based on one or more embodiments;
[0024] Figure 10 is an internal structural diagram of a computer device according to one or more embodiments. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] The method for determining slice information of a three-dimensional polygonal geometry model provided in this application embodiment can be applied to the application environment shown in Figure 1. In this method, 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 located in the cloud or on another network server. The data storage system can pre-store images of the regions of interest of the polygonal geometry.
[0027] 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.
[0028] 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.
[0029] In some exemplary embodiments, as shown in FIG2, a method for determining slice information of a three-dimensional polygonal geometry model is provided. Taking the application of this method to server 104 in FIG1 as an example, the method includes the following steps S100 to S400. Wherein:
[0030] S100: Extract the region of interest image containing the polygon geometry from the color image of the polygon geometry.
[0031] In practical applications, polygonal geometries include, but are not limited to, badges, car models, dolls, and other items. A polygonal geometry color image (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, typically containing a specific object or image feature 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.
[0032] 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. Here, 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, retaining 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.
[0033] In practical applications, the region of interest (ROI) image can be extracted from a 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 the polygonal geometry's identification information (such as a number), it retrieves the ROI image associated with that polygonal geometry's identification from the data storage system. In other embodiments, a user can upload a color image of a polygonal geometry to the server via a terminal and send a model generation message to the server. The server then extracts the ROI image from the color image of the polygonal geometry using the image processing methods described above.
[0034] S200: Create a grid coordinate system based on the region of interest image.
[0035] 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.
[0036] In practice, after obtaining the region of interest (ROI) image, the server can perform preprocessing such as denoising, scaling, grayscale conversion, and normalization. Then, according to a preset grid cell size (e.g., 50 pixels), horizontal and vertical grid lines are created in the ROI image. Next, coordinate markers are added at each grid intersection to obtain the Mesh Grid coordinate system. Furthermore, the grid cell size can be adjusted based on the size of the ROI image and actual requirements.
[0037] 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.
[0038] The 3D polygonal geometry model is a Triangle Mesh 3D model (hereinafter referred to as the model) of polygonal geometry. This model approximates the surface of a 3D object by using a series of connected triangles. Surface triangular patches refer to the triangular patches used to construct the surface of the model. Base triangular patches refer to the triangular patches that constitute the base of the model.
[0039] 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.
[0040] Following the previous step, after the server creates a Mesh Grid coordinate system in the region of interest (ROI) image, it can map the points in the ROI image 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 facets. Specifically, it can iterate through the points in the Mesh Grid coordinate system, generate four vertices for each point's (i,j) coordinates, and then construct two triangles based on these four vertices to build the model's surface. This process is repeated to construct all the surface triangular facets of the model. Taking vertex (i,j) as an example, its coordinates in the Mesh Grid coordinate system are (x0,y0,z0). The coordinates of its three adjacent vertices are (x1,y1,z1), (x2,y2,z2), and (x3,y3,z3). The order of the first triangle is (x0,y0,z0) → (x2,y2,z2) → (x1,y1,z1), and the order of the second triangle is (x0,y0,z0) → (x3,y3,z3) → (x2,y2,z2). Triangles constructed in this way share an edge (0-1) with two opposite directions, ensuring that the generated triangle faces can calculate normal vectors in the same direction. Finally, the vertex coordinates and vertex indices of the constructed triangles are saved to generate the index structure of the Triangle Mesh.
[0041] After constructing the surface triangles of the model, the bottom surface of the model will have a large area of 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. For example, this can be done by traversing all vertices, obtaining their Z-axis height values, determining if there are vertices with 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. In this process, 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.
[0042] 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.
[0043] S400 determines the slicing information of a 3D polygonal geometry model based on the region of interest image.
[0044] 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.
[0045] 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.
[0046] Specifically, the server can determine parameters such as the slicing direction and spacing. Then, the 3D polygonal geometry model is divided into multiple slices. Based on the color and texture information in the region of interest image, each slice is assigned corresponding attributes such as color and height 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.
[0047] 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.
[0048] As shown in Figure 4, in some exemplary embodiments, 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.
[0049] 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.
[0050] S400 includes: S402, determining slice information of the target 3D polygonal geometry model based on the region of interest image.
[0051] 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.
[0052] In practice, after obtaining the region of interest (ROI) image, the server can perform preprocessing such as denoising, scaling, grayscale conversion, edge detection, and normalization. Then, based on the depth or height information in the ROI image, a point cloud is generated. 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.
[0053] After the above processing, once the server generates a point cloud map, it can create a Mesh Grid coordinate system 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. Equally spaced x-axis coordinates are generated, and the x-axis coordinate of each row of point clouds is stored 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 are generated with the number of rows in the point cloud map as the length, and the y-axis coordinate of each column of point clouds is stored in the array. Specifically, the Mesh Grid coordinate system can be illustrated as shown in Figure 3. 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, the Mesh Grid coordinate of point (i,j) is (x...). i,j ,y i,j ,z i,j 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.
[0054] 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.
[0055] 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 3D polygon geometry model is reduced by 10 times. Furthermore, scaling from a small 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.
[0056] After the model undergoes face reduction, the server calculates the normals of its triangular faces and inverts them to adapt to the lighting and reflection effects of the slicing software, allowing users to observe clear surface textures. Since building the Triangle Mesh involves traversing the input color image in reverse order, the model needs to be rotated back to a normal viewing angle when generating the final 3D polygonal geometry model. After completing the above post-processing operations, the post-processed 3D polygonal geometry model can be saved in the STL (STereoLithography) format, a common format for 3D printing.
[0057] In some exemplary embodiments, 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-filling processing on the initial point cloud image to obtain a point cloud image.
[0058] 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.
[0059] In other embodiments, the server may first determine the optimal target grayscale weight, then convert the region of interest image into a grayscale image based on the target grayscale weight, then reduce the size of the grayscale image, and finally perform image normalization 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.
[0060] Next, after obtaining the target grayscale image, the server can convert the grayscale information in the target grayscale image into height information using a preset height value conversion formula, thus obtaining an initial point cloud map. Specifically, the height value conversion formula is as follows:
[0061] Among them, H max and H min G represents the maximum and minimum heights of the generated 3D polygonal geometry model. (i,j) G is the grayscale value of a pixel in the target grayscale image. max and G min These are the maximum and minimum gray levels of the target grayscale image, respectively.
[0062] After converting grayscale values into height values, the server generates an initial point cloud image based on the height values of the pixels. Further, the initial point cloud image can be padded with zeros to obtain a point cloud image with zero boundaries.
[0063] 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.
[0064] As shown in Figure 5, in some exemplary embodiments, the target grayscale weight is determined based on the following steps:
[0065] S222, obtain the initial grayscale weights.
[0066] S224, combine the initial grayscale weights to obtain multiple grayscale weight combinations.
[0067] 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.
[0068] S228, determine the average standard deviation based on the standard deviation of the grayscale image under each grayscale weight combination.
[0069] 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.
[0070] This embodiment describes how to determine the optimal target grayscale weights. For example, the server can first initialize the grayscale weights to (0.2989, 0.5870, 0.1140), and then arrange and combine the initialized weights to obtain six different grayscale weight combinations. Next, 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. Thus, six different grayscale images and six different standard deviations are obtained. Then, 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 weight can be determined using the following formula: gray = w R ×R+w G ×G+w B ×B
[0071] Among them, w R w G w B 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.
[0072] 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.
[0073] In some exemplary embodiments, as shown in FIG6, in some of these embodiments, S400 includes:
[0074] 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.
[0075] S440 converts the color value of each level into a height value to obtain the level color height.
[0076] 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.
[0077] S480, based on the adjusted layer height range and the preset slice layer height, determines the slice layer sequence.
[0078] 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.
[0079] Specifically, the server can determine the number of clusters n of the region of interest image by using the elbow rule or other optimal clustering number determination methods, and determine the number of clusters as the number of layers in the model. Then, 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.
[0080] 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.
[0081] After obtaining the color values for each level, the server can convert the color values to height values using 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.
[0082] 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.
[0083] 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.
[0084] 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.
[0085] 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.
[0086] In some embodiments, S440 includes: grayscale processing of the color value of each level, and converting the color value of each level into a height value.
[0087] 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 server can extract the RGB (Red, Green, Blue) channel values from the region of interest image and calculate the optimal target grayscale weights for the region of interest image. Subsequently, based on the optimal target grayscale weights, 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.
[0088] In this embodiment, grayscale conversion can quickly and accurately convert the color values of the region of interest image into height values.
[0089] As shown in Figure 7, in some embodiments, S100 includes:
[0090] S120, acquire the color image of the polygonal geometry, and determine the foreground mask of the color image of the polygonal geometry.
[0091] S140, merge the foreground mask with the polygonal geometry color image to obtain the target RGBA (Red, Green, Blue, Alpha) image.
[0092] S160, determine the maximum bounding rectangle of the foreground mask in the target RGBA image.
[0093] S180: Extract the region of interest image containing polygonal geometry from the target RGBA image, which matches the area of the largest bounding rectangle.
[0094] 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. Alpha channels can control the transparency of corresponding areas displayed in the image.
[0095] 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 image matting inference engine. For example, the server can select a U2-Net model and convert it to ONNX format as the image 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 to obtain the input and output dimensions of the ONNX model. Next, image preprocessing is performed on the user-input color badge image (hereinafter referred to as the color image), converting 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, followed by normalization. The normalization formula is as follows:
[0096] Among them, Min c Max represents the current minimum value of the c channel. c This indicates the current maximum value of channel c. This represents the pixel value at coordinate (i,j) in the c channel of a color image.
[0097] The server converts the normalized color image from a 3D array into a 1D array, following the order of red channels first and blue channels 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 the 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).
[0098] 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.
[0099] 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.
[0100] In some embodiments, 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.
[0101] Following the previous embodiment, after the server performs 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 coarse. 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.
[0102] 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.
[0103] 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:
[0104] 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.
[0105] S2, merge the foreground mask with the polygonal geometry color image to obtain the target RGBA image.
[0106] S3, determine the maximum bounding rectangle of the foreground mask in the target RGBA image.
[0107] S4, extract the region of interest image containing polygonal geometry from the target RGBA image that matches the area of the largest bounding rectangle.
[0108] 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.
[0109] Specifically, regarding grayscale processing, the server can perform grayscale processing on the region of interest image 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 the initialized weights 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, thus obtaining 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 the selected standard deviation is then determined as the target grayscale weight.
[0110] S6, based on the point cloud map, creates a grid coordinate system.
[0111] 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.
[0112] 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.
[0113] 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.
[0114] 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.
[0115] 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.
[0116] S12 converts the color value of each level into a height value to obtain the level color height.
[0117] S13, sort the layer color heights, and adjust the initial layer height range based on the sorted layer color heights.
[0118] S14. Based on the adjusted layer height range and the preset slice layer height, determine the slice layer sequence.
[0119] 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.
[0120] Furthermore, the server can also control the connected printer to print out a three-dimensional polygonal geometric model that closely resembles the color image of the polygonal geometry, based on the slice information.
[0121] 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.
[0122] 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.
[0123] In some exemplary embodiments, as shown in FIG8, a three-dimensional polygonal geometry model slice information determination device 800 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:
[0124] 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.
[0125] The coordinate system creation module 820 is used to create a grid coordinate system based on the region of interest image.
[0126] 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.
[0127] 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.
[0128] In some exemplary embodiments, 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.
[0129] In some exemplary embodiments, the slice information determination module 840 is further configured to perform grayscale processing on the color values of each layer, converting the color values of each layer into height values.
[0130] In some exemplary embodiments, 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 including size reduction processing, and creating a grid coordinate system based on the point cloud map.
[0131] As shown in Figure 9, 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.
[0132] In some exemplary embodiments, 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.
[0133] In some exemplary embodiments, the coordinate system creation module 820 is also used to determine the target grayscale weight and perform grayscale processing on the region of interest image based on the target grayscale weight.
[0134] In some exemplary embodiments, 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.
[0135] As shown in Figure 9, in some exemplary embodiments, 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.
[0136] In some embodiments, 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.
[0137] In some exemplary embodiments, the image extraction module 810 is further configured to perform mask prediction on the color image of the polygonal geometry 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 color image of the polygonal geometry.
[0138] 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.
[0139] In some embodiments, a printer is provided, comprising a controller and a printhead. The controller is configured to perform the steps in the embodiment of the method for determining slice information of a three-dimensional polygonal geometry model as described above, processing an acquired color image of a 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. The specific process by which the controller determines the slice information of the three-dimensional polygonal geometry model is not described in detail here.
[0140] 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.
[0141] 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.
[0142] 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.
[0143] In some exemplary embodiments, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 10. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores data such as color images of polygonal geometries, region-of-interest images, and slice information. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for determining slice information of a three-dimensional polygonal geometry model.
[0144] Those skilled in the art will understand that the structure shown in Figure 10 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 may combine certain components, or may have different component arrangements.
[0145] In some exemplary embodiments, a computer device is provided, 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 geometry model.
[0146] In some embodiments, 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 embodiments of the method for determining slice information of a three-dimensional polygonal geometry model described above.
[0147] In some embodiments, 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.
[0148] 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.
[0149] 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.
[0150] 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 specification.
[0151] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the 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 patent 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 3D polygonal geometric model are constructed. Triangular patches with vertex heights of preset values are removed, and bottom triangular patches of the 3D polygonal geometric model are constructed to obtain the 3D polygonal geometric model; and 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 of pixels in the region of interest image. Based on the adjusted layer height range and the preset slice layer height, the slice layer sequence is determined; and 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 method further 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 map; and The initial point cloud map is subjected to boundary zero-filling processing to obtain the point cloud map.
6. The method according to claim 5, characterized in that, The image of the region of interest is converted to grayscale, including: Determine the target grayscale weight; and Based on the target grayscale weight, the image of the region of interest is converted to grayscale.
7. The method according to claim 3, characterized in that, The color values at each level are converted to grayscale, including: Determine the target grayscale weight; and Based on the target grayscale weight, the color value of each level is grayscale processed.
8. The method according to claim 6 or 7, characterized in that, The determination of the target grayscale weight includes: Obtain the initial grayscale weights; By combining the initial grayscale weights, multiple grayscale weight combinations are obtained; Based on each of the gray-level weight combinations, 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; and 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.
9. The method according to any one of claims 1 to 7, 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; and From the target RGBA image, extract the region of interest image containing polygonal geometry that matches the area of the largest bounding rectangle.
10. The method according to claim 9, 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; and The largest connected region after filling is determined as the foreground mask of the polygonal geometry color image.
11. A printer, comprising a controller and a printhead, characterized in that, The controller is configured to: Obtain a color image of a polygonal geometry; Extract the region of interest image containing the polygonal geometry from the 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, determine the slice information of the three-dimensional polygonal geometry model; as well as Based on the slice information, the nozzle is moved to print a three-dimensional polygonal geometric model.
12. The printer according to claim 11, characterized in that, When the controller performs the step of determining the slice information of the three-dimensional polygonal geometry model based on the region of interest image, it is further configured to: 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 of pixels in the region of interest image. Based on the adjusted layer height range and the preset slice layer height, the slice layer sequence is determined; and The slice information includes the layer color height, the adjusted layer height range, and the slice layer number sequence.
13. The printer according to claim 12, characterized in that, When performing the step of converting the color value of each level to a height value, the controller is also configured to: The color values of each level are converted to grayscale, and then the color values of each level are converted to height values.
14. The printer according to claim 11, characterized in that, When executing the step of creating a grid coordinate system based on the region of interest image, the controller is further configured to: 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; The controller is also configured to: Post-processing is performed on the three-dimensional polygonal geometry model to obtain the target three-dimensional polygonal geometry model. The post-processing of the model includes enlarging the three-dimensional polygonal geometry model to a preset size.
15. The printer according to claim 14, characterized in that, When the controller performs image preprocessing on the region of interest image to generate a point cloud map, it is further configured to: 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; as well as The initial point cloud map is subjected to boundary zero-filling processing to obtain the point cloud map.
16. The printer according to claim 15, characterized in that, When performing the step of grayscale conversion of the region of interest image, the controller is further configured to: Determine the target grayscale weight; as well as Based on the target grayscale weight, the image of the region of interest is converted to grayscale.
17. The printer according to claim 13, characterized in that, When performing the step of grayscale conversion of color values at each level, the controller is also configured to: Determine the target grayscale weight; as well as Based on the target grayscale weight, the color value of each level is grayscale processed.
18. The printer according to claim 16 or 17, characterized in that, When performing the step of determining the target grayscale weight, the controller is also configured to: Obtain the initial grayscale weights; By combining the initial grayscale weights, multiple grayscale weight combinations are obtained; Based on each of the gray-level weight combinations, 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; as well as 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.
19. The printer according to any one of claims 11 to 17, characterized in that, When performing the step of extracting the region of interest image containing the polygonal geometry from the color image of the polygonal geometry, the controller is further configured to: 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; as well as From the target RGBA image, extract the region of interest image containing polygonal geometry that matches the area of the largest bounding rectangle.
20. The printer according to claim 19, characterized in that, When performing the step of determining the foreground mask of the color image of the polygonal geometry, the controller is further configured to: 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. as well as The largest connected region after filling is determined as the foreground mask of the polygonal geometry color image.
Citation Information
Patent Citations
Guide plate 3D printing model establishing method based on VR
CN110341192A
Three-dimensional object printing method, data processing device and computer equipment
CN113681898A
Three-dimensional model generating system, device, method and program for deleting overlapping point and computer readable recording medium recording program
JP2002222223A
Method and apparatus for generating slice data of 3D printer
KR102305843B1
Method and apparatus for identifying buildings in textured 3D mesh data and generating 3D building models
US20170084077A1