CN115187469A - Image processing method and device in 3D printing, storage medium and terminal - Google Patents

Image processing method and device in 3D printing, storage medium and terminal Download PDF

Info

Publication number
CN115187469A
CN115187469A CN202210621905.5A CN202210621905A CN115187469A CN 115187469 A CN115187469 A CN 115187469A CN 202210621905 A CN202210621905 A CN 202210621905A CN 115187469 A CN115187469 A CN 115187469A
Authority
CN
China
Prior art keywords
contour line
edge pixel
pixel block
same
coordinates
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210621905.5A
Other languages
Chinese (zh)
Inventor
刘鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Anycubic Technology Co Ltd
Original Assignee
Shenzhen Anycubic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Anycubic Technology Co Ltd filed Critical Shenzhen Anycubic Technology Co Ltd
Priority to CN202210621905.5A priority Critical patent/CN115187469A/en
Publication of CN115187469A publication Critical patent/CN115187469A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/73Deblurring; Sharpening
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • G06T2207/10012Stereo images

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses an image processing method and device, a storage medium and a terminal in 3D printing, relates to the technical field of 3D printing, and mainly aims to solve the problem that the rendering performance of slice layer images in the existing 3D printing is poor. The method comprises the following steps: acquiring contour line information of a target printing model sliced layer and calculating the contour line slope of each contour line according to the contour line information; determining the edge pixel block covered by each contour line according to the contour line slope, and calculating the gray value of the edge pixel block; and rendering the corresponding edge pixel block based on the gray value of the edge pixel block. The method is mainly used for image rendering in 3D printing.

Description

Image processing method and device in 3D printing, storage medium and terminal
Technical Field
The present invention relates to the field of 3D printing technologies, and in particular, to an image processing method and apparatus, a storage medium, and a terminal in 3D printing.
Background
In 3D printing, after a user creates a printing model, the model needs to be sliced, and then each sliced layer is rendered to obtain an image of each sliced layer, so that printing is performed in a printing device according to each sliced layer image. Typically, image antialiasing is required to render each slice layer image, and the antialiasing of the image is actually a process that softens the edge, i.e. replaces "exact" with "blurred".
In the existing image rendering in 3D printing, MSAA (Multi-Sample Anti-Aliasing) multisampling antialiasing is commonly used for image antialiasing processing, and the method obtains N sub-sampling points of an image to be processed, obtains an image according to each sub-sampling point, and finally superimposes images obtained through all the sub-sampling points to obtain a processed image. Because each sub-sampling point can obtain a picture during MSAA processing, if the image processing is fine, the sub-sampling points can be more, so that the pictures needing to be cached by the CPU can be more, further, the anti-aliasing processing occupies an overhigh background buffer area and a depth buffer area in the CPU, the data processing amount and the anti-aliasing level are linearly related, namely, the higher-order anti-aliasing processing is performed, the resource consumption is more, and the image rendering performance in the existing 3D printing is poorer.
Disclosure of Invention
In view of the above, the present invention provides an image processing method and apparatus in 3D printing, a storage medium, and a terminal, and mainly aims to solve the problem that the rendering performance of the image processing method in the existing 3D printing is poor.
According to an aspect of the present invention, there is provided an image processing method in 3D printing, including:
acquiring contour line information of a target printing model sliced layer and calculating the contour line slope of each contour line according to the contour line information;
determining the edge pixel block covered by each contour line according to the contour line slope, and calculating the gray value of the edge pixel block;
and rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
Further, after determining the edge pixel block covered by each contour line according to the slope of the contour line and calculating the gray value of the edge pixel block, the method further comprises:
identifying the standard pixel block of the slice layer according to the gray value of the edge pixel block;
rendering the standard pixel block based on a standard gray value.
Further, the contour line information includes a contour line starting point coordinate and a contour line end point coordinate, the determining, according to the contour line slope, the edge pixel block covered by each contour line, and the calculating the gray value of the edge pixel block includes:
judging whether the contour line starting point coordinates and the contour line end point coordinates of the same contour line are in the same row or the same column;
if the coordinates of the starting point and the ending point of the contour line of the same contour line are in the same row or the same column, determining the pixel block between the starting point and the ending point of the contour line as the edge pixel block covered by the contour line, and calculating the gray value of the edge pixel block, wherein each edge pixel block has the same gray value;
or if the coordinates of the starting point and the ending point of the contour line of the same contour line are not in the same line or the same column, determining the slope of the contour line based on the starting point and the ending point of the contour line, determining the edge pixel block covered by the contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block, wherein the gray values of all the edge pixel blocks are not identical.
Further, the determining whether the contour line starting point coordinates and the contour line end point coordinates of the same contour line are in the same row or the same column includes:
acquiring the line coordinates and the column coordinates of the contour line starting point coordinates and the contour line end point coordinates;
and judging whether the line coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not, and whether the column coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not.
Further, the calculating the gray value of the edge pixel block comprises:
determining the intersection coordinates of the contour lines and the edge pixel blocks, and calculating the area ratio of the area of the edge pixel blocks covered by the contour lines in the slice layer to the total area of the single edge pixel blocks according to the intersection coordinates and the vertex coordinates of the edge pixel blocks in the slice layer;
determining a product between the area ratio of the edge pixel block and a standard grayscale value as a grayscale value of the edge pixel block.
Further, the identifying the standard pixel block of the slice layer according to the gray value of the edge pixel block comprises:
dividing the edge pixel blocks which are positioned on the same line and on the same contour line into a group of pixel block data sets;
acquiring the gray value of the edge pixel block in the pixel block data set;
and when the gray value change of the edge pixel blocks along the row arrangement direction is judged to accord with a preset change rule, determining a pixel block between two adjacent edge pixel blocks as a standard pixel block, wherein the two adjacent edge pixel blocks are positioned in different pixel block data sets.
Further, after obtaining the gray value of the edge pixel block in the pixel block data set, the method further includes:
identifying the edge pixel blocks in the pixel block data set according to the coordinates of the edge pixel blocks;
when detecting that pixel block data sets which are positioned in the same row but in different groups have edge pixel blocks with the same identification, superposing a plurality of gray values corresponding to the edge pixel blocks with the same identification;
wherein, the superimposing the plurality of gray values corresponding to the edge pixel blocks with the same identifier comprises:
and accumulating a plurality of gray values corresponding to the edge pixel blocks with the same identification, and rendering the edge pixel blocks by using the standard gray values if the accumulated gray values of the edge pixel blocks are greater than the standard gray values.
According to another aspect of the present invention, there is provided an image processing apparatus in 3D printing, including:
the acquisition module is used for acquiring contour line information of the target printing model sliced layer;
the computing module is used for determining the edge pixel block covered by each contour line according to the contour line slope and computing the gray value of the edge pixel block;
and the processing module is used for rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
Further, the apparatus further comprises: the identification module is used for identifying the module,
the identification module is used for identifying the standard pixel block of the slice layer according to the gray value of the edge pixel block;
the rendering module is further configured to render the standard pixel block based on a standard gray value.
Further, the contour line information includes a contour line start point coordinate and a contour line end point coordinate, and the calculation module includes:
the judging unit is used for judging whether the contour line starting point coordinates and the contour line end point coordinates of the same contour line are in the same row or the same column;
the first calculation unit is used for determining a pixel block between the starting point and the end point of the contour line as an edge pixel block covered by the contour line and calculating the gray value of the edge pixel block if the coordinates of the starting point and the end point of the contour line of the same contour line are in the same row or the same column, wherein each edge pixel block has the same gray value;
and the second calculation unit is used for determining the slope of the contour line based on the contour line starting point and the contour line end point if the contour line starting point coordinate and the contour line end point coordinate of the same contour line are not in the same row or the same column, determining the edge pixel block covered by the contour line according to the contour line slope, and calculating the gray value of the edge pixel block, wherein the gray values of all the edge pixel blocks are not completely the same.
Further, the determining unit is specifically configured to obtain a row coordinate and a column coordinate of the contour line starting point coordinate and the contour line end point coordinate; and judging whether the line coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not, and whether the column coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not.
Further, the first calculating unit specifically determines intersection coordinates of the contour line and the edge pixel block, and calculates an area ratio between an area of the edge pixel block covered by the contour line inside the slice layer and a total area of the edge pixel block according to the intersection coordinates and vertex coordinates of the edge pixel block inside the slice layer; determining a product between the area ratio of the edge pixel block and a standard gray value as a gray value of the edge pixel block.
Further, the identification module includes:
the dividing unit is used for dividing the edge pixel blocks which are positioned on the same line and on the same contour line into a group of pixel block data sets;
an obtaining unit, configured to obtain a grayscale value of the edge pixel block in the pixel block data set;
and the determining unit is used for determining a pixel block between two adjacent edge pixel blocks as a standard pixel block when the gray value change of the edge pixel blocks along the row arrangement direction is judged to accord with a preset change rule, wherein the two adjacent edge pixel blocks are positioned in different pixel block data sets.
Further, the identification module further comprises:
the identification unit is used for identifying the edge pixel block in the pixel block data set according to the coordinates of the edge pixel block;
and the superposition unit is used for superposing a plurality of gray values corresponding to the edge pixel blocks with the same identification when the pixel block data sets with the same identification in the same row but different groups are detected.
According to still another aspect of the present invention, there is provided a storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to perform an operation corresponding to the image processing method in the 3D printing as described above.
According to still another aspect of the present invention, there is provided a terminal including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the image processing method in the 3D printing.
By the technical scheme, the technical scheme provided by the embodiment of the invention at least has the following advantages:
the invention provides an image processing method and device, a storage medium and a terminal in 3D printing, compared with the prior art, the embodiment of the invention obtains the contour line information of a target printing model slice layer and calculates the contour line slope of each contour line according to the contour line information; determining the edge pixel block covered by each contour line according to the contour line slope, and calculating the gray value of the edge pixel block; the corresponding edge pixel block is rendered based on the gray value of the edge pixel block, the contour line slope is obtained through calculation of contour line information of each slice layer, the edge pixel block covered by each contour line can be determined according to the contour line slope, then slice layer image rendering is carried out according to the determined gray value of the edge pixel block, a picture is obtained without obtaining each sub-sampling point, the pictures needing to be cached during processing of a CPU are greatly reduced, assignment of the edge pixel block is more accurate, data processing amount is reduced, and image rendering performance in 3D printing is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 shows a flowchart of an image processing method in 3D printing according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating an image processing method in 3D printing according to another embodiment of the invention;
FIG. 3 is a flow chart of another method for processing images in 3D printing according to an embodiment of the present invention;
FIG. 4 is a block diagram illustrating an image processing apparatus for 3D printing according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The method aims at the problems that when slice layer images are rendered in the existing 3D printing, the anti-aliasing processing occupies too high background buffer areas and depth buffer areas, and the data processing amount and the anti-aliasing level are linearly related, namely the higher order anti-aliasing processing is performed, the more resources are consumed, and the image rendering performance in the existing 3D printing is poor. An embodiment of the present invention provides an image processing method in 3D printing, as shown in fig. 1, the method includes:
101. and acquiring contour line information of the target printing model sliced layer and calculating the contour line slope of each contour line according to the contour line information.
The user processes the target printing model through slicing software as required, and can slice the printing model according to the preset slice thickness so as to obtain the contour line information of each slice layer. And the contour line information at least comprises the starting point coordinates and the end point coordinates of each contour line, so that the contour line slope can be calculated according to the coordinates of the two end points of the contour lines.
102. And determining the edge pixel block covered by each contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block.
It should be noted that after the slicing software slices the target print model to obtain the sliced layers, contour lines included in each sliced layer are obtained, each contour line generally covers a plurality of edge pixel blocks, and a sliced layer image is obtained by rendering according to the contour lines, and the sliced layer image rendering assigns gray values of the pixel blocks of the sliced layer, so that the 3D printing device can solidify a corresponding amount of print media according to the pixel values of the pixel blocks of the sliced layer image during printing to complete printing of each sliced layer. A commonly used image processing method is to color the pixel block according to the gray value of the entity part if the triangle patch covers the center point of the pixel block during rasterization, and not color the pixel if the triangle does not cover the center point of the pixel. When the triangle patch is rasterized, the covered pixel blocks are discrete and discontinuous, so that the saw teeth are formed.
Therefore, when rendering a sliced layer image according to a sliced layer contour line in 3D printing, anti-aliasing processing is required, and anti-aliasing is jagged pixel blocks at the edge of the image, so that the picture looks finer and smoother, and the image quality is better as the anti-aliasing level is increased. In the embodiment of the application, the slope of the contour line is calculated, the edge pixel block covered by the contour line is adjusted according to the slope of the contour line in the rendering process, and then the gray value of the edge pixel block is calculated and rendered, so that the edge pixel block is more accurately assigned.
103. And rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
When the slice layer is rendered, rendering is required according to gray values of all pixel blocks covered after rasterization of the slice layer, namely a plurality of edge pixel blocks covered by the contour lines and a plurality of standard pixel blocks located inside the slice layer and not at the edges.
The invention provides an image processing method and device, a storage medium and a terminal in 3D printing, compared with the prior art, the embodiment of the invention calculates the contour line slope of each contour line by obtaining the contour line information of a target printing model slice layer and according to the contour line information; determining edge pixel blocks covered by each contour line according to the slope of the contour lines, and calculating the gray value of each edge pixel block; rendering the corresponding edge pixel blocks based on the gray value of each edge pixel block, so that the contour line slope is obtained through calculation of the contour line information of each slice layer, the gray value of each edge pixel block covered by each contour line and each edge pixel block can be determined according to the contour line slope, and then rendering of the slice layer images is performed according to the determined gray value of the edge pixel blocks, so that the assignment to the edge pixel blocks is more accurate, the data processing amount is reduced, and the image rendering performance in 3D printing is improved.
In the above embodiment, it can be understood that the contour line information includes a contour line starting point coordinate and a contour line ending point coordinate, as shown in fig. 2, step 102 determines the edge pixel block covered by each contour line according to the slope of the contour line, and calculates the gray value of the edge pixel block, specifically including:
201. and judging whether the coordinates of the starting points and the ending points of the contour lines of the same contour line are in the same row or the same column.
It should be noted that, the slice layer contour lines may be vertical lines, horizontal lines, or other straight lines, and when the contour lines are vertical lines or horizontal lines, the contour lines extend along the arrangement direction of the pixel blocks, the segmentation proportion of the contour lines to the covered edge pixel blocks is the same, that is, the gray values of the covered edge pixel blocks are the same, and when the contour lines are other types of straight lines, the gray values of the covered edge pixel blocks are different, so in order to calculate the gray values of the edge pixel blocks more accurately in this embodiment of the present application, it is first determined whether the contour lines are vertical lines, horizontal lines, or other straight lines, so as to perform a corresponding calculation manner of the gray values of the edge pixel blocks according to the types of the contour lines.
In this embodiment, step 201 may specifically include: acquiring a line coordinate and a column coordinate of a contour line starting point coordinate and a contour line end point coordinate; and judging whether the line coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not and whether the column coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not.
Because the contour line information contains the coordinate information of the starting point and the end point of each contour line, when the contour line is a vertical line or a horizontal line, at least one coordinate value of the starting point and the coordinate value of the end point is the same. Specifically, if the row coordinates are the same and the column coordinates are different, it can be determined that the coordinates of the starting point and the ending point of the contour line are in the same row, that is, the vertical line; if the line coordinates are different and the column coordinates are the same, confirming that the coordinates of the starting point of the contour line and the coordinates of the ending point of the contour line are in the same column, namely, the horizontal line; and if the line coordinates and the column coordinates are different, determining that the coordinates of the starting point of the contour line and the coordinates of the ending point of the contour line are not in the same column and are not in the same line, namely, determining that the contour line is a straight line of other types.
202. And if the coordinates of the starting point and the ending point of the contour line of the same contour line are in the same row or the same column, determining a pixel block between the starting point and the ending point of the contour line as an edge pixel block covered by the contour line, and calculating the gray value of the edge pixel block, wherein each edge pixel block has the same gray value.
As can be seen from the above 202, when the coordinates of the starting point and the ending point of the contour line are in the same row or the same column, it indicates that the contour line is a vertical line or a horizontal line, and the edge pixel block covered by the contour line is the pixel block between the starting point and the ending point and has the same gray value, so that only the gray value of one of the edge pixel blocks needs to be calculated during calculation. Illustratively, if the coordinates of the starting point of the horizontal contour line are (0.00, 2.00) and the coordinates of the ending point of the horizontal contour line are (20.48, 2.00), the pixel blocks covered by the horizontal contour line are the pixel blocks from the pixel block corresponding to the starting point of the contour line to the pixel block corresponding to the ending point. Similarly, the confirmation method of the edge pixel block of the vertical contour line is the same as that of the horizontal contour line, and is not described herein again.
Specifically, calculating the gray values of the edge pixel blocks in step 202 includes: determining the intersection coordinates of the contour lines and the edge pixel blocks, and calculating the area ratio of the area of the edge pixel blocks covered by the contour lines in the slice layer to the total area of the single edge pixel blocks according to the intersection coordinates and the vertex coordinates of the edge pixel blocks in the slice layer; and determining the product of the area ratio of the edge pixel block and the standard gray value as the gray value of the edge pixel block.
Wherein the standard gray value is the maximum gray value that can be rendered by a single pixel block, for example, the standard gray value is 256. It is understood that when the edge contour lines are horizontal lines or vertical lines, the areas of the edge pixel blocks covered by the contour lines in the inner area of the slice layer are the same, so that the gray values corresponding to the pixel blocks are also the same, and therefore, when the gray values of the edge pixel blocks are determined, the gray values of any one of the edge pixel blocks covered by the contour lines can be calculated, and the edge pixel blocks covered by the horizontal contour lines or the vertical contour lines are assigned according to the pixel values.
Illustratively, if the coordinates of the intersection point of the horizontal contour line and a certain edge pixel block are (2,2.5) and (3,2.5), and the coordinates of the edge pixel block located inside the slice layer are (2,2) and (3,2), the area ratio between the area of the edge pixel block covered by the contour line inside the slice layer and the total area of the edge pixel blocks is (1 × 0.5) ÷ (1 × 1) =0.5, so the gray value of the edge pixel block covered by the horizontal contour line is 0.5 × 256=128.
203. If the coordinates of the starting point and the ending point of the contour line of the same contour line are not in the same line or the same column, determining the slope of the contour line based on the starting point and the ending point of the contour line, determining the edge pixel block covered by the contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block, wherein the gray values of all the edge pixel blocks are not completely the same.
When the contour line is not a horizontal line or a vertical line, the gray values of the edge pixel block to be assigned and the edge pixel block need to be determined during image rendering. When starting from any end point of the contour line, due to the influence of the slope of the contour line, each time the contour line moves laterally for a certain displacement, a longitudinal accumulated amount related to the slope exists in the longitudinal direction of the contour line, and when the longitudinal accumulated amount reaches a pixel block size, pixel blocks corresponding to the points on the contour line are not in the same row any more, which means that the rendering of the image needs to adjust the coloring trend of the pixel blocks.
Suppose that the coordinates of two end points of the contour line are respectively (x) 0 ,y 0 ) And (x) 1 ,y 1 ) And x is 0 <x 1 From these two end point coordinates, the contour line representation function can be derived as y = kx + b for the value from (x) 0 ,y 0 ) Starting with a real point, we discretize to take the point (x) i ,y i ) In order to facilitate calculation, a pixel block where a contour line endpoint is located may be selected as a reference pixel block from a certain contour line endpoint, when any discrete point exists, and a variation of a vertical coordinate between the discrete point and the endpoint exceeds a preset threshold, such as a unit height of a pixel block, it may be determined that the discrete point and the pixel block where the contour line endpoint is located are not in the same row, a pixel block where a line jump occurs may be marked, and then a next pixel block where a line jump occurs may be determined and marked with the discrete point as a reference until a pixel block where another endpoint of the contour line is located. It should be noted that, for the edge pixel blocks covered by the same contour line, each line may include one or more pixel blocks, and each line has a pixel block that identifies line jumping, so that the rendering direction may be adjusted according to the pixel blocks during rendering of the sliced layer image to ensure the accuracy of rendering of the sliced layer image.
Specifically, calculating the gray value of the edge pixel block in step 203 includes: determining the intersection coordinates of the contour line and each edge pixel block, and calculating the area ratio of the area of each edge pixel block covered by the contour line in the slice layer to the total area of the single edge pixel block according to the intersection coordinates and the vertex coordinates of the edge pixel block in the slice layer; the product of the area ratio of each edge pixel block and the standard gray value is determined as the gray value of each edge pixel block.
Illustratively, if coordinates of intersection points of a contour line and a certain edge pixel block are (2,2) and (2.5,3), and coordinates of the edge pixel block located inside a slice layer are (2,2) and (3,2), an area ratio between an area of the edge pixel block covered by the contour line inside the slice layer and a total area of the edge pixel blocks is (1 + 0.5) × 1 × 0.5 ÷ (1 × 1) =0.75, so that a gray value of the edge pixel block covered by the horizontal contour line is 0.75 × 256=192. Since the coordinates of the center point of each pixel block, the unit size of the pixel block, and the coordinates of the intersection point between the contour line and each pixel block are known, the gray value of each edge pixel block can be obtained by multiplying the ratio of the two areas by the standard gray value 256, but is not limited thereto.
In some embodiments of the present application, after determining the edge pixel block covered by each contour line according to the slope of the contour line and calculating the gray value of the edge pixel block in step 102, the image processing method further includes:
104. identifying a standard pixel block of the sliced layer according to the gray value of the edge pixel block;
105. rendering the standard pixel blocks based on the standard gray values.
After the gray value of the edge pixel block of the slice layer contour line is determined, the change trend of the gray value of the pixel block in the same line can be judged according to the gray value of the edge pixel block, and because the gray value of the standard pixel block of the solid part in the slice layer is the maximum value, namely the standard gray value, when the contour line is transited from the outer area to the inner area, the gray value of the pixel block is gradually increased, and conversely, when the contour line is transited from the inner area to the outer area, the gray value of the pixel block is gradually decreased. Therefore, if the change trend in the same line is changed from small to large and then from large to small according to the gray values of the edge pixel blocks covered by the two contour lines, the region between the two contour lines can be determined as the entity portion. On the contrary, if the change trend in the same line is changed from large to small and then from small to large according to the gray values of the edge pixel blocks covered by the two contour lines, the region between the two contour lines can be determined as a non-solid part, that is, the pixel blocks in the region are not required to be assigned. Therefore, in the embodiment of the present application, after determining the gray value of each edge pixel block, the standard pixel block covered by the slice layer is identified according to the gray value of the edge pixel block.
In this embodiment of the application, as shown in fig. 3, the step 104 of identifying the standard pixel block of the slice layer according to the gray-level value of the edge pixel block specifically may include:
301. dividing edge pixel blocks which are positioned on the same line and on the same contour line into a group of pixel block data sets;
302. acquiring the gray value of an edge pixel block in a pixel block data set;
303. and when the gray value change of the edge pixel blocks along the row arrangement direction is judged to accord with a preset change rule, determining a pixel block between two adjacent edge pixel blocks as a standard pixel block, wherein the two adjacent edge pixel blocks are positioned in different pixel block data sets.
It will be appreciated that two adjacent ones of the edge pixel blocks are located in different pixel block data sets. Since the contour line of each slice layer obtained after the slicing software processes the target model file is closed, and the middle of the closed contour line is the solid part of the model, two contour lines usually pass through the same line of pixel blocks. If the edge pixel blocks located on the same line and on the same contour are divided into a set of pixel block data sets, there are generally at least two sets of pixel block data sets.
The preset change rule can be that the gray value of the pixel block is changed from small to large and then from large to small. It should be noted that, for the edge pixel block covered by the contour line, not all the pixel blocks belong to the inside of the slice layer due to the segmentation by the contour line, that is, the gray value of the edge pixel block is smaller than the gray value of the partial pixel block inside the slice layer surrounded by the contour line, so that if the gray value of a certain row of pixel blocks is changed from small to large and then from large to small due to the segmentation of two adjacent contour lines, the part between the two contour lines is the solid part, that is, the pixel block of the part is the standard pixel block. For example, two pixel block data sets are shared in the same row of pixel blocks, the gray value of the edge pixel block in the pixel block data set 1 is increased from small to large, and the gray value of the edge pixel block in the pixel block data set 2 is decreased from large to small, so that a standard pixel block is arranged between the pixel block data set 1 and the pixel block data set 2, that is, two adjacent edge pixel blocks are respectively located in the pixel block data set 1 and the pixel block data set 2.
In order to improve the accuracy of the gray value of the edge pixel block, in this embodiment of the application, after the step 302 acquires the gray value of the edge pixel block in the pixel block data set, the image processing method further includes:
304. identifying edge pixel blocks in the pixel block data set according to the coordinates of the edge pixel blocks;
305. when detecting that pixel block data sets which are positioned in the same row but in different groups have edge pixel blocks with the same identification, superposing a plurality of gray values corresponding to the edge pixel blocks with the same identification;
wherein, the overlapping of the multiple gray values corresponding to the edge pixel blocks with the same identifier comprises:
and accumulating a plurality of gray values corresponding to the edge pixel blocks with the same identification, and rendering the edge pixel blocks by using the standard gray values if the accumulated gray values of the edge pixel blocks are greater than the standard gray values.
It should be noted that, for a certain pixel block, the inside of the certain pixel block may include a plurality of contour lines covering the pixel block, for example, an edge pixel block where a contour line end is located, the gray value of the edge pixel block needs to be determined by the gray values corresponding to the respective contour lines when all the contour lines covering the edge pixel block are cut, so when it is detected that the pixel block data sets have the same identifier, that is, at least 2 contour lines cover the edge pixel block, at this time, the gray values of the edge pixel blocks which are commonly covered in each pixel block data set need to be superimposed to obtain the final gray value of each pixel block. The sum of the areas of the same edge pixel block covered by the contour lines in the slice layer may exceed the area of the standard pixel block, and correspondingly, the accumulated gray values corresponding to the same edge pixel block also exceed the standard gray value, so that when the accumulated gray value is greater than the standard gray value, the edge pixel block is rendered by the standard gray value.
In addition, in order to render the sliced layer picture orderly and comprehensively, the pixel block data sets are ordered in an ascending order in the y-axis direction according to the coordinates of each reference pixel block, and the x-min, the x-max, the y-min and the y-max corresponding to each pixel block data set are determined, so that the scanning is performed from the lowest point to the maximum value in each row when the sliced layer picture is rendered, all the pixel blocks are identified and colored, and the accuracy of the picture rendering is ensured. The invention provides an image processing method and device, a storage medium and a terminal in 3D printing, compared with the prior art, the embodiment of the invention calculates the contour line slope of each contour line by obtaining the contour line information of a target printing model slice layer and according to the contour line information; determining an edge pixel block covered by each contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block; identifying the entity part of the slice layer according to the gray value of the edge pixel block; the method comprises the steps of rendering a sliced layer image based on gray values of an entity part and an edge pixel block, calculating contour line information of each sliced layer to obtain a contour line slope, determining the gray values of the edge pixel blocks and the edge pixel blocks covered by each contour line according to the contour line slope, identifying the entity part of the sliced layer according to the gray values of the edge pixel blocks, and rendering the sliced layer image, so that assignment to the edge pixel blocks is more accurate, data processing amount is reduced, and image rendering performance in 3D printing is improved.
Specifically, as an implementation of the method shown in fig. 1, an embodiment of the present application provides an image processing apparatus in 3D printing, as shown in fig. 4, the apparatus including: an acquisition module 31, a calculation module 32 and a processing module 33.
The acquisition module 31 is used for acquiring contour line information of the target printing model sliced layer;
the calculation module 32 is used for determining the edge pixel block covered by each contour line according to the slope of the contour line and calculating the gray value of the edge pixel block;
and the processing module 33 is configured to render the corresponding edge pixel block based on the gray value of the edge pixel block.
Specifically, as shown in fig. 4, the image processing apparatus further includes:
the identification module 34 is configured to identify the standard pixel block of the slice layer according to the gray value of the edge pixel block;
the processing module 33 is further configured to render the standard pixel block based on the standard gray value. .
Specifically, as shown in fig. 4, the contour line information includes coordinates of a contour line start point and coordinates of a contour line end point, and the calculation module 32 includes:
a judging unit 3201, configured to judge whether the contour line starting point coordinates and the contour line end point coordinates of the same contour line are in the same row or the same column;
a first calculating unit 3202, configured to determine a pixel block between a starting point and an ending point of a contour line as an edge pixel block covered by the contour line if coordinates of the starting point and the ending point of the contour line of the same contour line are in the same row or the same column, and calculate a gray value of the edge pixel block, where each edge pixel block has the same gray value;
the second calculating unit 3203 is configured to determine a contour line slope based on the contour line start point and the contour line end point if the contour line start point coordinates and the contour line end point coordinates of the same contour line are not in the same row or the same column, determine an edge pixel block covered by the contour line according to the contour line slope, and calculate a gray value of the edge pixel block, where the gray values of the edge pixel blocks are not completely the same.
Specifically, as shown in fig. 4, the determining unit 3201 is specifically configured to obtain a row coordinate and a column coordinate of the contour line starting point coordinate and the contour line ending point coordinate; and judging whether the line coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not, and whether the column coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not.
Specifically, as shown in fig. 4, the first calculating unit 3202 specifically determines intersection coordinates of the contour line and the edge pixel block, and calculates an area ratio between an area of the edge pixel block covered by the contour line inside the sliced layer and a total area of the single edge pixel block according to the intersection coordinates and vertex coordinates of the edge pixel block inside the sliced layer; and determining the product of the area ratio of the edge pixel block and the standard gray value as the gray value of the edge pixel block.
Specifically, as shown in fig. 4, the identification module 34 includes:
a dividing unit 3401 configured to divide edge pixel blocks located in the same row and on the same contour line into a group of pixel block data sets;
an obtaining unit 3402 configured to obtain a grayscale value of an edge pixel block in the pixel block data set;
the determining unit 3403 is configured to determine, when it is determined that the change of the gray value of the edge pixel block along the row arrangement direction meets a preset change rule, a pixel block between two adjacent edge pixel blocks as a standard pixel block, where the two adjacent edge pixel blocks are located in different pixel block data sets.
Specifically, as shown in fig. 4, the identification module 34 further includes:
an identifying unit 3404, configured to identify an edge pixel block in the pixel block data set according to a coordinate of the edge pixel block;
and the overlapping unit 3405 is configured to overlap, when it is detected that pixel block data sets located in the same row but in different groups have edge pixel blocks with the same identifier, multiple gray values corresponding to the edge pixel blocks with the same identifier.
Compared with the prior art, the embodiment of the invention obtains the contour line information of the target printing model slice layer and calculates the contour line slope of each contour line according to the contour line information; determining edge pixel blocks covered by each contour line according to the slope of the contour lines, and calculating the gray value of the edge pixel blocks; the corresponding edge pixel blocks are rendered based on the gray values of the edge pixel blocks, the contour line slope is obtained through calculation of the contour line information of each slice layer, the gray values of the edge pixel blocks covered by each contour line and the edge pixel blocks can be determined according to the contour line slope, and then slice layer image rendering is performed according to the determined gray values of the edge pixel blocks, so that the assignment to the edge pixel blocks is more accurate, the data processing amount is reduced, and the image rendering performance in 3D printing is improved.
According to an embodiment of the present invention, a storage medium is provided, the storage medium storing at least one executable instruction, and the computer executable instruction is capable of performing image rendering in 3D printing in any of the method embodiments described above.
Fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention, where the specific embodiment of the present invention does not limit a specific implementation of the terminal.
As shown in fig. 5, the terminal may include: a processor (processor) 402, a communication Interface 404, a memory 404, and a communication bus 408.
Wherein: the processor 402, communication interface 404, and memory 406 communicate with each other via a communication bus 408.
A communication interface 404 for communicating with network elements of other devices, such as clients or other servers.
The processor 402 is configured to execute the program 410, and may specifically execute relevant steps in the embodiment of the image processing method in 3D printing.
In particular, program 410 may include program code comprising computer operating instructions.
The processor 402 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the invention. The terminal comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
A memory 406 for storing a program 410. Memory 406 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 410 may specifically be configured to cause the processor 402 to perform the following operations:
obtaining contour line information of a target printing model sliced layer and calculating contour line slopes of contour lines according to the contour line information;
determining edge pixel blocks covered by each contour line according to the slope of the contour lines, and calculating the gray value of the edge pixel blocks;
and rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An image processing method for 3D printing, comprising:
obtaining contour line information of a target printing model sliced layer and calculating contour line slopes of contour lines according to the contour line information;
determining the edge pixel block covered by each contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block;
and rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
2. The image processing method according to claim 1, wherein after determining the edge pixel block covered by each contour line according to the contour line slope and calculating the gray value of the edge pixel block, the method further comprises:
identifying the standard pixel block of the slice layer according to the gray value of the edge pixel block;
rendering the standard pixel block based on a standard gray value.
3. The image processing method of claim 2, wherein the contour line information includes a contour line start point coordinate and a contour line end point coordinate, the determining the edge pixel block covered by each contour line according to the contour line slope, and the calculating the gray value of the edge pixel block includes:
judging whether the contour line starting point coordinates and the contour line end point coordinates of the same contour line are in the same row or the same column;
if the coordinates of the starting point and the ending point of the contour line of the same contour line are in the same row or the same column, determining the pixel block between the starting point and the ending point of the contour line as the edge pixel block covered by the contour line, and calculating the gray value of the edge pixel block, wherein each edge pixel block has the same gray value;
or if the coordinates of the starting point and the ending point of the contour line of the same contour line are not in the same line or the same column, determining the slope of the contour line based on the starting point and the ending point of the contour line, determining the edge pixel block covered by the contour line according to the slope of the contour line, and calculating the gray value of the edge pixel block, wherein the gray values of all the edge pixel blocks are not identical.
4. The image processing method according to claim 3, wherein said determining whether the coordinates of the starting point and the ending point of the contour line of the same contour line are in the same row or column comprises:
acquiring a row coordinate and a column coordinate of the contour line starting point coordinate and the contour line end point coordinate;
and judging whether the line coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not and whether the column coordinates of the contour line starting point coordinates and the contour line end point coordinates are the same or not.
5. The method of claim 3, wherein the computing the gray value of the block of edge pixels comprises:
determining the intersection coordinates of the contour line and the edge pixel block, and calculating the area ratio of the area of the edge pixel block covered by the contour line in the slice layer to the total area of the single edge pixel block according to the intersection coordinates and the vertex coordinates of the edge pixel block in the slice layer;
determining a product between the area ratio of the edge pixel block and the standard grayscale value as a grayscale value of the edge pixel block.
6. The method according to claim 2, wherein the identifying the standard pixel block of the sliced layer according to the gray-level value of the edge pixel block comprises:
dividing the edge pixel blocks which are positioned on the same line and on the same contour line into a group of pixel block data sets;
acquiring the gray value of the edge pixel block in the pixel block data set;
and determining a pixel block between two adjacent edge pixel blocks as a standard pixel block when the change of the gray value of the edge pixel blocks along the row arrangement direction is judged to accord with a preset change rule, wherein the two adjacent edge pixel blocks are positioned in different pixel block data sets.
7. The method of claim 6, wherein after obtaining the gray-scale values for the edge pixel blocks in the pixel block data set, the method further comprises:
identifying the edge pixel blocks in the pixel block data set according to the coordinates of the edge pixel blocks;
when detecting that pixel block data sets which are positioned in the same row but in different groups have edge pixel blocks with the same identification, superposing a plurality of gray values corresponding to the edge pixel blocks with the same identification;
wherein, the superimposing the plurality of gray values corresponding to the edge pixel blocks with the same identifier comprises:
and accumulating a plurality of gray values corresponding to the edge pixel blocks with the same identification, and rendering the edge pixel blocks by using the standard gray values if the accumulated gray values of the edge pixel blocks are greater than the standard gray values.
8. An image processing apparatus in 3D printing, characterized by comprising:
the acquisition module is used for acquiring contour line information of the target printing model slice layer;
the calculation module is used for calculating the contour line slope of each contour line according to the contour line information;
the computing module is further used for determining the edge pixel blocks covered by the contour lines according to the contour line slopes and computing the gray values of the edge pixel blocks;
and the processing module is used for rendering the corresponding edge pixel block based on the gray value of the edge pixel block.
9. A storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the image processing method in 3D printing according to any one of claims 1 to 7.
10. A terminal, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction which causes the processor to execute the operation corresponding to the image processing method in the 3D printing according to any one of claims 1-7.
CN202210621905.5A 2022-06-02 2022-06-02 Image processing method and device in 3D printing, storage medium and terminal Pending CN115187469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210621905.5A CN115187469A (en) 2022-06-02 2022-06-02 Image processing method and device in 3D printing, storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210621905.5A CN115187469A (en) 2022-06-02 2022-06-02 Image processing method and device in 3D printing, storage medium and terminal

Publications (1)

Publication Number Publication Date
CN115187469A true CN115187469A (en) 2022-10-14

Family

ID=83514131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210621905.5A Pending CN115187469A (en) 2022-06-02 2022-06-02 Image processing method and device in 3D printing, storage medium and terminal

Country Status (1)

Country Link
CN (1) CN115187469A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116433515A (en) * 2023-03-30 2023-07-14 格兰菲智能科技有限公司 Image rotation antialiasing method, apparatus, computer device, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868696A (en) * 2016-03-23 2016-08-17 奇瑞汽车股份有限公司 Method and device for detecting multiple lane lines
CN112008980A (en) * 2020-02-24 2020-12-01 清锋(北京)科技有限公司 3D printing model processing method and system
CN112743851A (en) * 2020-12-28 2021-05-04 深圳市创想三维科技有限公司 Photocuring 3D printing method, 3D printer, computer device and medium
US11126162B1 (en) * 2020-09-17 2021-09-21 Shanghai Fusion Tech Co., Ltd. 3D printing slicing method, apparatus, device, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868696A (en) * 2016-03-23 2016-08-17 奇瑞汽车股份有限公司 Method and device for detecting multiple lane lines
CN112008980A (en) * 2020-02-24 2020-12-01 清锋(北京)科技有限公司 3D printing model processing method and system
US11126162B1 (en) * 2020-09-17 2021-09-21 Shanghai Fusion Tech Co., Ltd. 3D printing slicing method, apparatus, device, and storage medium
CN112743851A (en) * 2020-12-28 2021-05-04 深圳市创想三维科技有限公司 Photocuring 3D printing method, 3D printer, computer device and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨旭 等: "基于试件强度及成型精度的DLP光敏树脂3D打印工艺参数研究", 《中国胶粘剂》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116433515A (en) * 2023-03-30 2023-07-14 格兰菲智能科技有限公司 Image rotation antialiasing method, apparatus, computer device, and storage medium

Similar Documents

Publication Publication Date Title
CN110008809B (en) Method and device for acquiring form data and server
CN100399358C (en) Image processing apparatus and method of same
CN110197180B (en) Character defect detection method, device and equipment
CN115187469A (en) Image processing method and device in 3D printing, storage medium and terminal
US5317679A (en) Digital image processor including correction for undesirable edge emphasis in outline-demarcated fonts
EP2782065B1 (en) Image-processing device removing encircling lines for identifying sub-regions of image
EP0159880B1 (en) Apparatus for evaluating density and evenness of printed patterns
US5050229A (en) Method and apparatus for thinning alphanumeric characters for optical character recognition
CN113221895A (en) Small target detection method, device, equipment and medium
US7873226B2 (en) Image encoding apparatus
CN108446702A (en) A kind of image character dividing method, device, equipment and storage medium
CN115082887A (en) Motor vehicle road auxiliary line detection system and image processing device and method thereof
JP5254250B2 (en) Method and system for generating boundaries in the process of rasterizing vector graphics, and method for manufacturing the system
JPH09130614A (en) Image processing unit
CN113052928A (en) Image processing method and image processing system
CN111814803A (en) Graph segmentation method, device and equipment and computer readable storage medium
EP0811953B1 (en) Image processing apparatus and method
CN112348807B (en) Endoscope highlight point repairing method and system based on contour pixel statistics
CN114648455A (en) Ultrasonic image processing method, electronic device and storage medium
US7409086B2 (en) Segmentation of image data
CN111630558B (en) Image processing and matching method, device and storage medium
CN113362319A (en) Laser printing method and device based on image processing, laser printer and computer readable storage medium
CN111839580A (en) Dental film image generation method and device, electronic equipment and storage medium
CN108154497B (en) Automatic detection method and system for graphic road conditions
CN105447831B (en) License plate image processing method and processing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20221014

RJ01 Rejection of invention patent application after publication