Plane segmentation method and device for three-dimensional rendering gradient multi-order plane
By performing gradient multi-order plane segmentation processing on the three-dimensional rendering technology, the existing three-dimensional rendering technology has solved the problems of high complexity and high computational cost, and achieved more efficient three-dimensional rendering operation efficiency.
Patent Information
- Application Number
- CN202411280530.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-09-12
AI Technical Summary
The existing three-dimensional rendering technology has high complexity and high computational capacity, resulting in long rendering time, limiting the application scenarios of real-time rendering technology.
A three-dimensional rendering method for the multi-order plane of gradient rendering is proposed. By performing preset image processing, three-dimensional projection, pixel point grouping, vertex determination, intersection connection and gradient color rendering on the target image, the three-dimensional rendering algorithm is optimized and the amount of calculated data is reduced. .
The algorithm optimization of three-dimensional rendering technology is realized, which reduces the amount of computational data, improves the computing efficiency of three-dimensional rendering, and supports faster real-time rendering.
Smart Images

Figure CN119444766A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a plane segmentation method and device for three-dimensional rendering gradient multi-order planes. Background Art
[0002] With the rapid development of computer graphics, three-dimensional image rendering technology has become an indispensable core technology in many fields such as visual arts, game design, film and television production, and architectural design. However, the existing three-dimensional image rendering technology still faces many challenges and shortcomings in practical applications. Among them, the current three-dimensional real-time rendering technology relies on complex algorithms and huge data, which leads to high difficulty of the algorithms involved and huge amount of calculation. For large-scale or high-resolution three-dimensional scenes, the rendering time may be very long, which limits the application scenarios of real-time rendering technology. It can be seen that it is particularly important to propose a corresponding solution to the technical problems of high complexity of rendering algorithms, large amount of calculation, and low rendering efficiency in existing three-dimensional rendering technologies. Summary of the invention
[0003] The present invention provides a plane segmentation method and device for three-dimensional rendering of a gradient multi-order plane, which can help reduce the amount of calculation data for three-dimensional rendering, realize algorithm optimization of three-dimensional rendering technology, and improve the calculation efficiency of three-dimensional rendering.
[0004] In order to solve the above technical problems, the first aspect of the present invention discloses a plane segmentation method for three-dimensional rendering gradient multi-order planes, the method comprising:
[0005] Performing a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, wherein the first image processing at least includes grayscale conversion;
[0006] According to a preset pixel grouping condition, performing a second image processing on the first image processing result to obtain a second image processing result corresponding to the first image processing result, wherein the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets;
[0007] Performing a third image processing on each of the triangular facets in the second image processing result to obtain a third image processing result corresponding to all the triangular facets, wherein the third image processing includes determining the vertices of each of the triangular facets, determining the intersection points between the plane where each of the triangular facets is located and a preset cross section, and connecting the intersection points;
[0008] For the non-triangular part of the third image processing result, a fourth image processing is performed according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, wherein the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendered image corresponding to the target image.
[0009] As an optional implementation, in the first aspect of the present invention, performing second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result includes:
[0010] Constructing a stereo model, and then establishing a three-dimensional coordinate system matching the stereo model; the first image processing result includes a grayscale image corresponding to the target image, the three-dimensional coordinate system has a length of the grayscale image as a first axis, a width of the grayscale image as a second axis, and a grayscale value of the grayscale image as a third axis; the first axis and the second axis are in the same base plane, and the third axis is perpendicular to the base plane;
[0011] Projecting the first image processing result into the three-dimensional coordinate system to obtain a three-dimensional projection result corresponding to the first image processing result; the three-dimensional projection result is composed of a plurality of three-dimensional pixel points; the three-dimensional projection result includes a three-dimensional projection image corresponding to the grayscale image and a two-dimensional viewing angle image, wherein the two-dimensional viewing angle image is obtained by projecting all the three-dimensional pixel points onto the base plane;
[0012] Performing pixel division on all the three-dimensional pixel points in the two-dimensional viewing angle image to obtain a plurality of quadrilaterals, each of the quadrilaterals being composed of four three-dimensional pixel points, and all the quadrilaterals do not overlap with each other;
[0013] For each of the quadrilaterals, the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral are calculated, and according to the preset pixel grouping requirements, a target diagonal distance is selected from the two diagonal distances corresponding to the quadrilateral, and the two diagonal pixel points corresponding to the target diagonal distance are connected as the diagonal connection result corresponding to the quadrilateral; the diagonal pixel points are the three-dimensional pixel points at the diagonal position in any of the quadrilaterals;
[0014] The diagonal connection results corresponding to all the quadrilaterals are determined as second image processing results corresponding to the first image processing results.
[0015] As an optional implementation, in the first aspect of the present invention, selecting the target diagonal distance from the two diagonal distances corresponding to the quadrilateral according to the preset pixel grouping requirement includes:
[0016] Determine, according to the grayscale value corresponding to each of the diagonal pixel points, a pixel attribute of the diagonal pixel point, wherein the pixel attribute includes a negative attribute or a positive attribute, and when the pixel attribute of the diagonal pixel point is the negative attribute, the diagonal pixel point is below the base plane in the three-dimensional projection image; when the pixel attribute of the diagonal pixel point is the positive attribute, the diagonal pixel point is in the base plane or above the base plane in the three-dimensional projection image;
[0017] The two diagonal pixel points with the same pixel attributes in the quadrilateral are determined as a first pixel pair, and the two diagonal pixel points with different pixel attributes in the quadrilateral are determined as a second pixel pair; and the quadrilateral includes a first diagonal distance and a second diagonal distance;
[0018] When the quadrilateral satisfies a preset first grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, determining the second diagonal distance as a target diagonal distance;
[0019] When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is smaller than the second diagonal distance, determining the first diagonal distance as a target diagonal distance;
[0020] Specifically, the quadrilateral satisfies the first grouping condition in that the first pixel pair and the second pixel pair exist in the quadrilateral at the same time; and the second grouping condition is opposite to the first grouping condition.
[0021] As an optional implementation, in the first aspect of the present invention, performing the third image processing on each of the triangular facets in the second image processing result to obtain the third image processing results corresponding to all the triangular facets includes:
[0022] Determine a target cross section and a corresponding plane equation, wherein the target cross section is the base plane or a plane parallel to the base plane;
[0023] For each of the triangular facets in the second image processing result, determining the vertex coordinates corresponding to each triangular vertex in the triangular facet according to a set fixed-point function;
[0024] According to the plane equation and the vertex coordinates corresponding to each of the triangle vertices in the triangular facet, the intersection coordinates corresponding to two target intersection points between the target cross section and the triangular facet are calculated, and then the two target intersection points are connected to obtain the intersection connection result corresponding to the triangular facet;
[0025] The intersection connection results corresponding to all the triangle faces and all the target intersections are determined as the third image processing result.
[0026] As an optional implementation manner, in the first aspect of the present invention, performing fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result includes:
[0027] For the non-triangular part of the third image processing result, segmentation processing is performed according to the pixel grouping condition until it is determined that the third image processing result is composed of the triangular facets, thereby obtaining a segmentation processing result corresponding to the third image processing result;
[0028] For all the triangular facets in the segmentation processing result, taking the target cross section as a reference, dividing each triangular facet above the target cross section into a first facet, and dividing each triangular facet below the target cross section into a second facet;
[0029] generating a plurality of first closed veneers according to all the first slices, generating a plurality of second closed veneers according to all the second slices, and determining all the first closed veneers and all the second closed veneers as target closed veneers;
[0030] According to a preset rendering method, gradient color rendering is performed on each of the target closed surfaces to obtain a gradient color rendering result corresponding to each of the target closed surfaces as a fourth image processing result.
[0031] As an optional implementation manner, in the first aspect of the present invention, performing gradient color rendering on each of the target closed surfaces according to a preset rendering method to obtain a gradient color rendering result corresponding to each of the target closed surfaces includes:
[0032] Acquire a two-dimensional tiling projection corresponding to each of the target closed tilings on the base plane, wherein the two-dimensional tiling projection includes a first sub-tiling projection corresponding to each of the first closed tilings and a second sub-tiling projection corresponding to each of the second closed tilings;
[0033] According to a preset first color system, in a counterclockwise direction, gradient color rendering is performed on each of the first sub-tiling projections to obtain a first rendering result corresponding to each of the first sub-tiling projections;
[0034] According to a preset second color system, in a counterclockwise direction, the gradient color rendering is performed on each of the second sub-tiling projections to obtain a second rendering result corresponding to each of the second sub-tiling projections;
[0035] All of the first rendering results and all of the second rendering results are determined as gradient color rendering results.
[0036] As an optional implementation manner, in the first aspect of the present invention, for each of the quadrilaterals, calculating the diagonal distance corresponding to any two diagonal pixel points in the quadrilateral includes:
[0037] For each of the quadrilaterals, determine the three-dimensional coordinates corresponding to each of the three-dimensional pixel points in the quadrilateral, and simultaneously determine two of the three-dimensional pixel points in diagonal positions in the quadrilateral as a group of diagonal pixel pairs, each group of the diagonal pixel pairs including two diagonal pixel points;
[0038] For each group of diagonal pixel pairs in each of the quadrilaterals, the distance between the two diagonal pixel points in the group of diagonal pixel pairs is calculated according to a preset two-point distance formula to obtain the diagonal distance corresponding to the two diagonal pixel points in the group of diagonal pixel pairs.
[0039] A second aspect of the present invention discloses a plane segmentation device for three-dimensional rendering of a gradient multi-order plane, the device comprising:
[0040] A first image processing module, configured to perform a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, wherein the first image processing at least includes grayscale conversion;
[0041] A second image processing module, configured to perform a second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result, wherein the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets;
[0042] A third image processing module, configured to perform a third image processing on each of the triangular facets in the second image processing result to obtain a third image processing result corresponding to all the triangular facets, wherein the third image processing includes determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and a preset cross section, and connecting the intersection points;
[0043] A fourth image processing module is used to perform a fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, wherein the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendered image corresponding to the target image.
[0044] As an optional implementation, in the second aspect of the present invention, the second image processing module performs second image processing on the first image processing result according to a preset pixel grouping condition, and a method of obtaining a second image processing result corresponding to the first image processing result specifically includes:
[0045] Constructing a stereo model, and then establishing a three-dimensional coordinate system matching the stereo model; the first image processing result includes a grayscale image corresponding to the target image, the three-dimensional coordinate system has a length of the grayscale image as a first axis, a width of the grayscale image as a second axis, and a grayscale value of the grayscale image as a third axis; the first axis and the second axis are in the same base plane, and the third axis is perpendicular to the base plane;
[0046] Projecting the first image processing result into the three-dimensional coordinate system to obtain a three-dimensional projection result corresponding to the first image processing result; the three-dimensional projection result is composed of a plurality of three-dimensional pixel points; the three-dimensional projection result includes a three-dimensional projection image corresponding to the grayscale image and a two-dimensional viewing angle image, wherein the two-dimensional viewing angle image is obtained by projecting all the three-dimensional pixel points onto the base plane;
[0047] Performing pixel division on all the three-dimensional pixel points in the two-dimensional viewing angle image to obtain a plurality of quadrilaterals, each of the quadrilaterals being composed of four three-dimensional pixel points, and all the quadrilaterals do not overlap with each other;
[0048] For each of the quadrilaterals, the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral are calculated, and according to the preset pixel grouping requirements, a target diagonal distance is selected from the two diagonal distances corresponding to the quadrilateral, and the two diagonal pixel points corresponding to the target diagonal distance are connected as the diagonal connection result corresponding to the quadrilateral; the diagonal pixel points are the three-dimensional pixel points at the diagonal position in any of the quadrilaterals;
[0049] The diagonal connection results corresponding to all the quadrilaterals are determined as second image processing results corresponding to the first image processing results.
[0050] As an optional implementation, in the second aspect of the present invention, the second image processing module selects the target diagonal distance from the two diagonal distances corresponding to the quadrilateral according to the preset pixel grouping requirement, specifically including:
[0051] Determine, according to the grayscale value corresponding to each of the diagonal pixel points, a pixel attribute of the diagonal pixel point, wherein the pixel attribute includes a negative attribute or a positive attribute, and when the pixel attribute of the diagonal pixel point is the negative attribute, the diagonal pixel point is below the base plane in the three-dimensional projection image; when the pixel attribute of the diagonal pixel point is the positive attribute, the diagonal pixel point is in the base plane or above the base plane in the three-dimensional projection image;
[0052] The two diagonal pixel points with the same pixel attributes in the quadrilateral are determined as a first pixel pair, and the two diagonal pixel points with different pixel attributes in the quadrilateral are determined as a second pixel pair; and the quadrilateral includes a first diagonal distance and a second diagonal distance;
[0053] When the quadrilateral satisfies a preset first grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, determining the second diagonal distance as a target diagonal distance;
[0054] When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is smaller than the second diagonal distance, determining the first diagonal distance as a target diagonal distance;
[0055] Specifically, the quadrilateral satisfies the first grouping condition in that the first pixel pair and the second pixel pair exist in the quadrilateral at the same time; and the second grouping condition is opposite to the first grouping condition.
[0056] As an optional implementation, in the second aspect of the present invention, the third image processing module performs the third image processing on each of the triangular facets in the second image processing result, and a method of obtaining the third image processing results corresponding to all the triangular facets specifically includes:
[0057] Determine a target cross section and a corresponding plane equation, wherein the target cross section is the base plane or a plane parallel to the base plane;
[0058] For each of the triangular facets in the second image processing result, determining the vertex coordinates corresponding to each triangular vertex in the triangular facet according to a set fixed-point function;
[0059] According to the plane equation and the vertex coordinates corresponding to each of the triangle vertices in the triangular facet, the intersection coordinates corresponding to two target intersection points between the target cross section and the triangular facet are calculated, and then the two target intersection points are connected to obtain the intersection connection result corresponding to the triangular facet;
[0060] The intersection connection results corresponding to all the triangle faces and all the target intersections are determined as the third image processing result.
[0061] As an optional implementation, in the second aspect of the present invention, the fourth image processing module performs fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition, and the manner in which the fourth image processing result corresponding to the third image processing result is obtained specifically includes:
[0062] For the non-triangular part of the third image processing result, segmentation processing is performed according to the pixel grouping condition until it is determined that the third image processing result is composed of the triangular facets, thereby obtaining a segmentation processing result corresponding to the third image processing result;
[0063] For all the triangular facets in the segmentation processing result, taking the target cross section as a reference, dividing each triangular facet above the target cross section into a first facet, and dividing each triangular facet below the target cross section into a second facet;
[0064] generating a plurality of first closed veneers according to all the first slices, generating a plurality of second closed veneers according to all the second slices, and determining all the first closed veneers and all the second closed veneers as target closed veneers;
[0065] According to a preset rendering method, gradient color rendering is performed on each of the target closed surfaces to obtain a gradient color rendering result corresponding to each of the target closed surfaces as a fourth image processing result.
[0066] As an optional implementation, in the second aspect of the present invention, the fourth image processing module performs gradient color rendering on each of the target closed surfaces according to a preset rendering method, and the method of obtaining the gradient color rendering result corresponding to each of the target closed surfaces specifically includes:
[0067] Acquire a two-dimensional tiling projection corresponding to each of the target closed tilings on the base plane, wherein the two-dimensional tiling projection includes a first sub-tiling projection corresponding to each of the first closed tilings and a second sub-tiling projection corresponding to each of the second closed tilings;
[0068] According to a preset first color system, in a counterclockwise direction, gradient color rendering is performed on each of the first sub-tiling projections to obtain a first rendering result corresponding to each of the first sub-tiling projections;
[0069] According to a preset second color system, in a counterclockwise direction, the gradient color rendering is performed on each of the second sub-tiling projections to obtain a second rendering result corresponding to each of the second sub-tiling projections;
[0070] All of the first rendering results and all of the second rendering results are determined as gradient color rendering results.
[0071] As an optional implementation, in the second aspect of the present invention, the second image processing module calculates, for each quadrilateral, a diagonal distance corresponding to any two diagonal pixels in the quadrilateral, specifically including:
[0072] For each of the quadrilaterals, determine the three-dimensional coordinates corresponding to each of the three-dimensional pixel points in the quadrilateral, and simultaneously determine two of the three-dimensional pixel points in diagonal positions in the quadrilateral as a group of diagonal pixel pairs, each group of the diagonal pixel pairs including two diagonal pixel points;
[0073] For each group of diagonal pixel pairs in each of the quadrilaterals, the distance between the two diagonal pixel points in the group of diagonal pixel pairs is calculated according to a preset two-point distance formula to obtain the diagonal distance corresponding to the two diagonal pixel points in the group of diagonal pixel pairs.
[0074] The third aspect of the present invention discloses another plane segmentation device for three-dimensional rendering of a gradient multi-order plane, the device comprising:
[0075] A memory storing executable program code;
[0076] a processor coupled to the memory;
[0077] The processor calls the executable program code stored in the memory to execute the plane segmentation method for three-dimensional rendering gradient multi-order planes disclosed in the first aspect of the present invention.
[0078] The fourth aspect of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the plane segmentation method for three-dimensional rendering gradient multi-order planes disclosed in the first aspect of the present invention.
[0079] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0080] In an embodiment of the present invention, a plane segmentation method for a three-dimensionally rendered gradient multi-order plane is provided, the method comprising: performing a preset first image processing on an acquired target image to obtain a first image processing result corresponding to the target image, the first image processing at least comprising grayscale conversion; performing a second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result, the second image processing comprising three-dimensional projection and pixel point grouping, the second image processing result comprising a plurality of triangular facets; performing a third image processing on each triangular facet in the second image processing result to obtain a third image processing result corresponding to all triangular facets, the third image processing comprising determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and a preset cross section, and connecting the intersection points; performing a fourth image processing on a non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, the fourth image processing comprising segmentation processing, classification processing, and gradient color rendering; the fourth image processing result comprises a target rendered image corresponding to the target image. It can be seen that by implementing the present invention, after acquiring the target image to be processed, the target image can be automatically converted into a grayscale image, thereby removing color interference in the target image and reducing the amount of data processing for the target image, which is beneficial to improving the computational efficiency of subsequent processing of the target image; then, the three-dimensionalization of the first image processing result is achieved through the set three-dimensional projection. Compared with direct operation on a two-dimensional image, the use of three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel grouping) is performed in the three-dimensional model, which can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimizing the storage and rendering process of the three-dimensional model, further improving the three-dimensional The model processing efficiency of the model is improved; then, based on the preset cross section, the cross section intersection is determined and connected for each triangular facet in the second image processing result, and the boundary points on the segmentation plane (preset cross section) are supplemented through the set third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the triangular facets of different categories are grouped and precisely matched, thereby improving the subsequent image processing accuracy of triangular facets of different categories; finally, through the set segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient color of each triangular facet and the three-dimensional appearance of the surface, thereby improving the flexibility and accuracy of processing the rendered gradient multi-stage images. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0082] Figure 1 It is a flow chart of a plane segmentation method for three-dimensional rendering gradient multi-order plane disclosed in an embodiment of the present invention;
[0083] Figure 2 It is a flow chart of another plane segmentation method for three-dimensional rendering gradient multi-order plane disclosed in an embodiment of the present invention;
[0084] Figure 3 It is a structural schematic diagram of a plane segmentation device for three-dimensional rendering of a gradient multi-order plane disclosed in an embodiment of the present invention;
[0085] Figure 4 It is a structural schematic diagram of another plane segmentation device for three-dimensional rendering of a gradient multi-order plane disclosed in an embodiment of the present invention;
[0086] Figure 5 is a schematic diagram of an operation effect of a second image processing disclosed in an embodiment of the present invention;
[0087] Figure 6 is a schematic diagram of another operation effect of the second image processing disclosed in an embodiment of the present invention;
[0088] Figure 7 It is a schematic diagram of two-dimensional and three-dimensional effects of a segmentation processing result corresponding to a third image processing result disclosed in an embodiment of the present invention;
[0089] Figure 8 It is a schematic diagram of two-dimensional and three-dimensional effects corresponding to a target closed veneer disclosed in an embodiment of the present invention;
[0090] Fig. 9 It is a schematic diagram of the operation of performing gradient color rendering on each target closed surface disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0091] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0092] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.
[0093] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0094] The present invention discloses a plane segmentation method and device for three-dimensional rendering of a gradient multi-order plane. After acquiring a target image to be processed, the target image can be automatically converted into a grayscale image, thereby removing color interference in the target image and reducing the amount of data processing for the target image, which is beneficial to improving the calculation efficiency when the target image is subsequently processed. Then, a three-dimensionalization of a first image processing result is achieved by setting a three-dimensional projection. Compared with directly operating on a two-dimensional image, the three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel point grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel point grouping) is performed in the three-dimensional model, which can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimizing the storage and rendering process of the three-dimensional model. The process further improves the model processing efficiency of the three-dimensional model; then, based on the preset cross section, the section intersection is determined and connected for each triangular face in the second image processing result, and the boundary points on the segmentation plane (preset cross section) are supplemented through the third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the triangular facets of different categories are grouped and precisely matched, thereby improving the subsequent image processing accuracy of triangular facets of different categories; finally, through the segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient color of each triangular facet and the three-dimensional appearance of the surface, thereby improving the flexibility and accuracy of the processing to obtain the rendered gradient multi-level image. The following are detailed descriptions.
[0095] Embodiment 1
[0096] See also Figure 1 , Figure 1 1 is a flow chart of a method for plane segmentation of a three-dimensional rendering gradient multi-order plane disclosed in an embodiment of the present invention. Figure 1 The described plane segmentation method for three-dimensional rendering of a gradually changing multi-order plane can be applied to a plane segmentation device for three-dimensional rendering of a gradually changing multi-order plane, and the embodiment of the present invention does not limit this. Figure 1 As shown, the plane segmentation method for three-dimensional rendering of a gradient multi-order plane may include the following operations:
[0097] 101. Perform a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, where the first image processing at least includes grayscale conversion.
[0098] In the embodiment of the present invention, before step 101 performs a preset first image processing on the acquired target image, the method further includes:
[0099] It is determined whether the target image is a grayscale image. When the determination result is no, step 101 is triggered to be executed; when the determination result is yes, the target image is updated to the first image processing result, and step 102 is triggered to be executed.
[0100] In the embodiment of the present invention, when the processing space corresponding to the processing target image is the RGB space, the grayscale conversion formula corresponding to the grayscale conversion is specifically:
[0101] G=0.299·I r +0.587·I g +0.114·I b
[0102] Among them, I r ,I g ,I b They are R, G, and B channel images in the RGB space, respectively, and G corresponds to the grayscale image after grayscale conversion of the target image;
[0103] When the processing space corresponding to the processing target image is the YUV space, the grayscale conversion formula corresponding to the grayscale conversion is specifically:
[0104] G=I_y
[0105] Where I_y is the Y channel in YUV space.
[0106] 102. Perform second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result.
[0107] In the embodiment of the present invention, the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets.
[0108] 103. Perform third image processing on each triangular facet in the second image processing result to obtain a third image processing result corresponding to all triangular facets.
[0109] In the embodiment of the present invention, the third image processing includes determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and the preset cross section, and connecting the intersection points;
[0110] 104. Perform fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result.
[0111] In the embodiment of the present invention, the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendering image corresponding to the target image.
[0112] It can be seen that the implementation Figure 1 The described plane segmentation method for three-dimensional rendering of gradient multi-order planes can automatically convert the target image into a grayscale image after acquiring the target image to be processed, thereby removing color interference in the target image and reducing the amount of data processing for the target image, which is beneficial to improving the calculation efficiency when the target image is subsequently processed; then, the three-dimensionalization of the first image processing result is achieved by setting a three-dimensional projection. Compared with directly operating on a two-dimensional image, the three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel point grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel point grouping) is performed in the three-dimensional model, which can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimizing the storage and rendering process of the three-dimensional model, and further The first step is to improve the model processing efficiency of the three-dimensional model; then, based on the preset cross section, the cross-section intersection is determined and connected for each triangular facet in the second image processing result, and the boundary points on the segmentation plane (preset cross section) are supplemented through the set third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the triangular facets of different categories are grouped and accurately matched, thereby improving the subsequent image processing accuracy of triangular facets of different categories; finally, through the set segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient color of each triangular facet and the three-dimensional appearance of the curved surface, thereby improving the flexibility and accuracy of processing the rendered gradient multi-stage image.
[0113] In an optional embodiment, step 102 performs second image processing on the first image processing result according to a preset pixel grouping condition, and a method of obtaining a second image processing result corresponding to the first image processing result specifically includes:
[0114] Constructing a stereo model, and then establishing a three-dimensional coordinate system matching the stereo model; the first image processing result includes a grayscale image corresponding to the target image, the three-dimensional coordinate system has the length of the grayscale image as the first axis, the width of the grayscale image as the second axis, and the grayscale value of the grayscale image as the third axis; the first axis and the second axis are in the same base plane, and the third axis is perpendicular to the base plane;
[0115] The first image processing result is projected into a three-dimensional coordinate system to obtain a three-dimensional projection result corresponding to the first image processing result; the three-dimensional projection result is composed of a plurality of three-dimensional pixel points; the three-dimensional projection result includes a three-dimensional projection image corresponding to the grayscale image and a two-dimensional viewing angle image, and the two-dimensional viewing angle image is obtained by projecting all three-dimensional pixel points onto a base plane;
[0116] Perform pixel division on all three-dimensional pixel points in the two-dimensional perspective image to obtain a plurality of quadrilaterals, each of which is composed of four three-dimensional pixel points, and all quadrilaterals do not overlap with each other;
[0117] For each quadrilateral, the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral are calculated, and according to the preset pixel grouping requirements, the target diagonal distance is selected from the two diagonal distances corresponding to the quadrilateral, and the two diagonal pixel points corresponding to the target diagonal distance are connected as the diagonal connection result corresponding to the quadrilateral; the diagonal pixel points are the three-dimensional pixel points at the diagonal position in any quadrilateral;
[0118] The diagonal connection results corresponding to all quadrilaterals are determined as the second image processing result corresponding to the first image processing result.
[0119] In this optional embodiment, the three-dimensional coordinate system uses the length of the grayscale image as the first axis, the width of the grayscale image as the second axis, and the grayscale value of the grayscale image as the third axis. In actual application, the length of the grayscale image is the x-axis, the width of the grayscale image is the y-axis, and the grayscale value of the grayscale image is the z-axis. Correspondingly, the base plane refers to the plane with a z-axis coordinate of 0 in the three-dimensional coordinate system.
[0120] In this alternative embodiment, see Figure 5 , Figure 5 is a schematic diagram of the effect of the second image processing operation disclosed in an embodiment of the present invention. The above pixel division is performed on all three-dimensional pixel points in the two-dimensional perspective image to obtain a plurality of quadrilaterals. The plurality of quadrilaterals are as follows Figure 5As shown in the figure on the left; further, the above connection of two diagonal pixel points corresponding to the diagonal distance of the target, the final second image processing result is shown in the effect diagram Figure 5 As shown in the figure on the right.
[0121] In this optional embodiment, it should be noted that: Figure 5 In the drawings on the left and right, the solid line portion indicates that it is in or above the base plane, and the dotted line portion indicates that it is below the base plane.
[0122] It can be seen that in this optional embodiment, the three-dimensionalization of the first image processing result is achieved by setting a three-dimensional projection. Compared with operating directly on a two-dimensional image, the three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel grouping) is performed in the three-dimensional model. This can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimizing the storage and rendering process of the three-dimensional model, thereby further improving the model processing efficiency of the three-dimensional model.
[0123] In another optional embodiment, the method of selecting the target diagonal distance from the two diagonal distances corresponding to the quadrilateral according to the preset pixel grouping requirement specifically includes:
[0124] Determine the pixel attribute of each diagonal pixel point according to the gray value corresponding to the diagonal pixel point, the pixel attribute includes a negative attribute or a positive attribute, when the pixel attribute of the diagonal pixel point is a negative attribute, the diagonal pixel point is below the base plane in the three-dimensional projection image; when the pixel attribute of the diagonal pixel point is a positive attribute, the diagonal pixel point is in the base plane or above the base plane in the three-dimensional projection image;
[0125] Two diagonal pixel points with the same pixel attributes in the quadrilateral are determined as a first pixel pair, and two diagonal pixel points with different pixel attributes in the quadrilateral are determined as a second pixel pair; and the quadrilateral includes a first diagonal distance and a second diagonal distance;
[0126] When the quadrilateral satisfies a preset first grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, the second diagonal distance is determined to be the target diagonal distance;
[0127] When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is smaller than the second diagonal distance, determining the first diagonal distance as the target diagonal distance;
[0128] Specifically, the quadrilateral satisfies the first grouping condition in that the quadrilateral contains both the first pixel pair and the second pixel pair; and the second grouping condition is opposite to the first grouping condition.
[0129] In this optional embodiment, specifically, corresponding to the above description, in the three-dimensional coordinate system, when the pixel attribute of the diagonal pixel point is a negative attribute, the corresponding z-axis coordinate indicating the diagonal pixel point is a negative number, and when the pixel attribute of the diagonal pixel point is a positive attribute, the corresponding z-axis coordinate indicating the diagonal pixel point is 0 or a positive number.
[0130] In this optional embodiment, it should be noted that when the quadrilateral satisfies the preset first grouping condition and the first diagonal distance is less than the second diagonal distance, the first diagonal distance is determined to be the target diagonal distance;
[0131] When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, the second diagonal distance is determined to be the target diagonal distance.
[0132] In this optional embodiment, for the setting of the first grouping condition and the second grouping condition, please refer to Figure 6 , Figure 6 is a schematic diagram of another operation effect of the second image processing disclosed in an embodiment of the present invention, such as Figure 6 As shown in the left figure, the two-dimensional viewing plane includes the first pixel pair BE and its corresponding first diagonal distance d BE , the second pixel pair AF and its corresponding second diagonal distance d AF ; At this time, the quadrilateral meets the preset first grouping condition, and at this time the first diagonal distance is less than the second diagonal distance (corresponding to d AF ≥d BE ), then select the first diagonal distance d BE The case where the quadrilateral meets the second grouping condition is similar to the case where the first grouping condition is met. For details, please refer to Figure 6 , which will not be elaborated here.
[0133] It can be seen that in this optional embodiment, the pixel attributes of each diagonal pixel can be automatically determined according to the grayscale value of the diagonal pixel, and then the target diagonal distance can be accurately determined according to each quadrilateral satisfying different grouping conditions, thereby improving the accuracy of determining the target diagonal distance and its corresponding set of diagonal pixels.
[0134] In this optional embodiment, further, for each quadrilateral, the above method of calculating the diagonal distance corresponding to any two diagonal pixel points in the quadrilateral specifically includes:
[0135] For each quadrilateral, determine the three-dimensional coordinates corresponding to each three-dimensional pixel point in the quadrilateral, and simultaneously determine two three-dimensional pixel points in diagonal positions in the quadrilateral as a group of diagonal pixel pairs, each group of diagonal pixel pairs including two diagonal pixel points;
[0136] For each diagonal pixel pair in each quadrilateral, the distance between the two diagonal pixel points in the diagonal pixel pair is calculated according to a preset two-point distance formula to obtain the diagonal distance corresponding to the two diagonal pixel points in the diagonal pixel pair.
[0137] In this optional embodiment, the two-point distance formula is as follows:
[0138]
[0139] Among them, d is the diagonal distance corresponding to two diagonal pixels; and the pixel coordinates of a group of diagonal pixels are (x1, y1, z1) and (x2, y2, z2).
[0140] It can be seen that in this optional embodiment, the grayscale value calculation of the third dimension of the three-dimensional pixel point is introduced through the set distance calculation formula, which improves the calculation accuracy of the distance between two three-dimensional pixel points (diagonal pixel points).
[0141] In yet another optional embodiment, the method of performing the third image processing on each triangular facet in the second image processing result to obtain the third image processing result corresponding to all the triangular facets specifically includes:
[0142] Determine the target section and its corresponding plane equation, the target section is the base plane or a plane parallel to the base plane;
[0143] For each triangular facet in the second image processing result, determine the vertex coordinates corresponding to each triangular vertex in the triangular facet according to the set fixed-point function;
[0144] According to the plane equation and the vertex coordinates corresponding to each triangle vertex in the triangular facet, the intersection coordinates corresponding to the two target intersection points between the target section and the triangular facet are calculated, and then the two target intersection points are connected to obtain the intersection connection result corresponding to the triangular facet;
[0145] The intersection connection results corresponding to all triangle faces and all target intersections are determined as the third image processing result.
[0146] In this optional embodiment, the plane equation corresponding to the target section is: α·x+β·y+γ·z+δ=0, and the definition function F(x, y, z)=α·x+β·y+γ·z+δ; point A=(x A ,y A , z A ), B=(xB, yB, zB), E=(x E ,y E , z E ). Then Q=(x Q ,y Q, z Q )、R=(x R ,y R , z R ); points A, B, and C are the three vertices of any triangular face; Q and R are the intersection points of the triangular face and the target section; α, β, γ, and δ in the plane equation are equation coefficients, which are obtained by selecting the coordinates of three coplanar and non-colinear three-dimensional pixel points in the actual application scenario and combining them with the plane equation.
[0147] Furthermore, the calculation formula for the Q point among the two intersection points is as follows:
[0148]
[0149] The calculation formula for point R among the two intersection points is as follows:
[0150]
[0151] It can be seen that in this optional embodiment, based on the preset cross-section, the cross-section intersection determination and connection are performed on each triangular facet in the second image processing result, and the boundary points on the segmentation plane (preset cross-section) are supplemented through the set third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the precise matching processing is performed on the different categories of triangular facets, thereby improving the subsequent image processing accuracy of different categories of triangular facets.
[0152] Embodiment 2
[0153] See also Figure 2 , Figure 2 1 is a flow chart of another method for plane segmentation of a three-dimensional rendering gradient multi-order plane disclosed in an embodiment of the present invention. Figure 2 The described plane segmentation method for three-dimensional rendering of a gradually changing multi-order plane can be applied to a plane segmentation device for three-dimensional rendering of a gradually changing multi-order plane, and the embodiment of the present invention does not limit this. Figure 2 As shown, the plane segmentation method for three-dimensional rendering of a gradient multi-order plane may include the following operations:
[0154] 201. Perform a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, where the first image processing at least includes grayscale conversion.
[0155] 202. Perform second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result.
[0156] 203. Perform third image processing on each triangular facet in the second image processing result to obtain a third image processing result corresponding to all triangular facets.
[0157] In the embodiment of the present invention, the third image processing includes determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and the preset cross section, and connecting the intersection points.
[0158] 204. Perform segmentation processing on the non-triangular part of the third image processing result according to the pixel grouping condition until it is determined that the third image processing result is composed of triangular faces, and obtain a segmentation processing result corresponding to the third image processing result.
[0159] In the embodiment of the present invention, the third image processing result obtained by processing through steps 201 to 203 cannot be directly processed to obtain a third image processing result including all triangle facets after performing triangular face division. Therefore, it is necessary to set the segmentation processing step to convert all polygons in the third image processing result into triangular facets that are easy to process subsequently.
[0160] In the embodiment of the present invention, please refer to Figure 7 , Figure 7 is a schematic diagram of two-dimensional and three-dimensional effects of a segmentation processing result corresponding to a third image processing result disclosed in an embodiment of the present invention, such as Figure 7 As shown, Figure 7 The left side of the figure is a two-dimensional rendering of the segmentation result. Figure 7 The right side of the figure is a three-dimensional rendering of the segmentation processing result.
[0161] 205. For all the triangular facets in the segmentation processing result, with the target cross section as a reference, each triangular facet above the target cross section is divided into a first facet, and each triangular facet below the target cross section is divided into a second facet.
[0162] 206. Generate a plurality of first closed veneers according to all the first slices, generate a plurality of second closed veneers according to all the second slices, and determine all the first closed veneers and all the second closed veneers as target closed veneers.
[0163] In the embodiment of the present invention, please refer to Figure 8 , Figure 8 is a schematic diagram of two-dimensional and three-dimensional effects corresponding to a target closed veneer disclosed in an embodiment of the present invention; Figure 8 As shown, Figure 8 The two pictures above, Figure 8 The picture on the right below is a two-dimensional rendering of all target closed veneers. Figure 8 The image on the left below shows the three-dimensional renderings of all target closed veneers.
[0164] 207 . Perform gradient color rendering on each target closed surface according to a preset rendering method to obtain a gradient color rendering result corresponding to each target closed surface as a fourth image processing result.
[0165] In the embodiment of the present invention, for other descriptions of step 201 to step 203, please refer to other specific descriptions of step 101 to step 103 in embodiment 1, and the embodiment of the present invention will not be repeated here.
[0166] It can be seen that the implementation Figure 2 The described plane segmentation method for three-dimensional rendering of gradient multi-order planes, through the set segmentation processing, classification processing and gradient color rendering, can generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient color of each triangle facet and the three-dimensional appearance of the surface, thereby improving the flexibility and accuracy of processing the rendered gradient multi-order image.
[0167] In an alternative embodiment, see Fig. 9 , Fig. 9 is a schematic diagram of the operation of performing gradient color rendering on each target closed surface disclosed in an embodiment of the present invention; Fig. 9 As shown, the above-mentioned method of performing gradient color rendering on each target closed surface according to the preset rendering method to obtain the gradient color rendering result corresponding to each target closed surface specifically includes:
[0168] Obtain a two-dimensional tiling projection corresponding to each target closed tiling on the base plane, wherein the two-dimensional tiling projection includes a first sub-tiling projection corresponding to each first closed tiling and a second sub-tiling projection corresponding to each second closed tiling;
[0169] According to the preset first color system, in a counterclockwise direction, gradient color rendering is performed on each first sub-tile projection to obtain a first rendering result corresponding to each first sub-tile projection;
[0170] According to the preset second color system, in a counterclockwise direction, each second sub-tile projection is subjected to gradient color rendering to obtain a second rendering result corresponding to each second sub-tile projection;
[0171] All first rendering results and all second rendering results are determined as gradient color rendering results.
[0172] It can be seen that in this optional embodiment, by setting up segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient colors of individual triangle facets and the three-dimensional shape of the curved surface, thereby improving the flexibility and accuracy of processing and rendering gradient multi-level images.
[0173] Embodiment 3
[0174] See also Figure 3 , Figure 3 1 is a schematic diagram of the structure of a plane segmentation device for three-dimensional rendering gradient multi-order planes disclosed in an embodiment of the present invention. The plane segmentation device for three-dimensional rendering gradient multi-order planes can be a plane segmentation terminal, device, system or server for three-dimensional rendering gradient multi-order planes. The server can be a local server, a remote server, or a cloud server (also known as a cloud server). When the server is a non-cloud server, the non-cloud server can communicate with the cloud server, which is not limited in the embodiment of the present invention. Figure 3 As shown, the plane segmentation device for three-dimensional rendering gradient multi-order plane may include a first image processing module 301, a second image processing module 302, a third image processing module 303, and, wherein:
[0175] A first image processing module 301 is used to perform a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, where the first image processing at least includes grayscale conversion;
[0176] A second image processing module 302 is used to perform a second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result, wherein the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets;
[0177] A third image processing module 303 is used to perform a third image processing on each triangular facet in the second image processing result to obtain a third image processing result corresponding to all the triangular facets, wherein the third image processing includes determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and the preset cross section, and connecting the intersection points;
[0178] The fourth image processing module 304 is used to perform the fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, and the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendered image corresponding to the target image.
[0179] It can be seen that the implementation Figure 3The described plane segmentation device for three-dimensional rendering of gradient multi-order planes can automatically convert the target image into a grayscale image after acquiring the target image to be processed, thereby removing color interference in the target image and reducing the amount of data processing for the target image, which is beneficial to improving the calculation efficiency when the target image is subsequently processed; then, the three-dimensionalization of the first image processing result is achieved through the set three-dimensional projection. Compared with the direct operation on the two-dimensional image, the three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel point grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel point grouping) is performed in the three-dimensional model, which can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimize the storage and rendering process of the three-dimensional model, and further The first step is to improve the model processing efficiency of the three-dimensional model; then, based on the preset cross section, the cross-section intersection is determined and connected for each triangular facet in the second image processing result, and the boundary points on the segmentation plane (preset cross section) are supplemented through the set third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the triangular facets of different categories are grouped and accurately matched, thereby improving the subsequent image processing accuracy of triangular facets of different categories; finally, through the set segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient color of each triangular facet and the three-dimensional appearance of the curved surface, thereby improving the flexibility and accuracy of processing the rendered gradient multi-stage image.
[0180] In an optional embodiment, the second image processing module 302 performs the second image processing on the first image processing result according to the preset pixel grouping condition, and the manner of obtaining the second image processing result corresponding to the first image processing result specifically includes:
[0181] Constructing a stereo model, and then establishing a three-dimensional coordinate system matching the stereo model; the first image processing result includes a grayscale image corresponding to the target image, the three-dimensional coordinate system has the length of the grayscale image as the first axis, the width of the grayscale image as the second axis, and the grayscale value of the grayscale image as the third axis; the first axis and the second axis are in the same base plane, and the third axis is perpendicular to the base plane;
[0182] The first image processing result is projected into a three-dimensional coordinate system to obtain a three-dimensional projection result corresponding to the first image processing result; the three-dimensional projection result is composed of a plurality of three-dimensional pixel points; the three-dimensional projection result includes a three-dimensional projection image corresponding to the grayscale image and a two-dimensional viewing angle image, and the two-dimensional viewing angle image is obtained by projecting all three-dimensional pixel points onto a base plane;
[0183] Perform pixel division on all three-dimensional pixel points in the two-dimensional perspective image to obtain a plurality of quadrilaterals, each of which is composed of four three-dimensional pixel points, and all quadrilaterals do not overlap with each other;
[0184] For each quadrilateral, the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral are calculated, and according to the preset pixel grouping requirements, the target diagonal distance is selected from the two diagonal distances corresponding to the quadrilateral, and the two diagonal pixel points corresponding to the target diagonal distance are connected as the diagonal connection result corresponding to the quadrilateral; the diagonal pixel points are the three-dimensional pixel points at the diagonal position in any quadrilateral;
[0185] The diagonal connection results corresponding to all quadrilaterals are determined as the second image processing result corresponding to the first image processing result.
[0186] It can be seen that in this optional embodiment, the three-dimensionalization of the first image processing result is achieved by setting a three-dimensional projection. Compared with operating directly on a two-dimensional image, the three-dimensional processing technology has higher image processing efficiency and better image processing effect. At the same time, pixel grouping is set to process the first image processing result to obtain multiple triangular facets, and triangle grouping (corresponding to the pixel grouping) is performed in the three-dimensional model. This can further refine the surface structure of the three-dimensional model corresponding to the second image processing, and is beneficial to optimizing the storage and rendering process of the three-dimensional model, thereby further improving the model processing efficiency of the three-dimensional model.
[0187] In another optional embodiment, the second image processing module 302 selects the target diagonal distance from the two diagonal distances corresponding to the quadrilateral according to the preset pixel grouping requirement, specifically including:
[0188] Determine the pixel attribute of each diagonal pixel point according to the gray value corresponding to the diagonal pixel point, the pixel attribute includes a negative attribute or a positive attribute, when the pixel attribute of the diagonal pixel point is a negative attribute, the diagonal pixel point is below the base plane in the three-dimensional projection image; when the pixel attribute of the diagonal pixel point is a positive attribute, the diagonal pixel point is in the base plane or above the base plane in the three-dimensional projection image;
[0189] Two diagonal pixel points with the same pixel attributes in the quadrilateral are determined as a first pixel pair, and two diagonal pixel points with different pixel attributes in the quadrilateral are determined as a second pixel pair; and the quadrilateral includes a first diagonal distance and a second diagonal distance;
[0190] When the quadrilateral satisfies a preset first grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, the second diagonal distance is determined to be the target diagonal distance;
[0191] When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is smaller than the second diagonal distance, determining the first diagonal distance as the target diagonal distance;
[0192] Specifically, the quadrilateral satisfies the first grouping condition in that the quadrilateral contains both the first pixel pair and the second pixel pair; and the second grouping condition is opposite to the first grouping condition.
[0193] It can be seen that in this optional embodiment, the pixel attributes of each diagonal pixel can be automatically determined according to the grayscale value of the diagonal pixel, and then the target diagonal distance can be accurately determined according to each quadrilateral satisfying different grouping conditions, thereby improving the accuracy of determining the target diagonal distance and its corresponding set of diagonal pixels.
[0194] In this optional embodiment, the second image processing module 302 calculates, for each quadrilateral, the diagonal distance corresponding to any two diagonal pixels in the quadrilateral in a manner that specifically includes:
[0195] For each quadrilateral, determine the three-dimensional coordinates corresponding to each three-dimensional pixel point in the quadrilateral, and simultaneously determine two three-dimensional pixel points in diagonal positions in the quadrilateral as a group of diagonal pixel pairs, each group of diagonal pixel pairs including two diagonal pixel points;
[0196] For each diagonal pixel pair in each quadrilateral, the distance between the two diagonal pixel points in the diagonal pixel pair is calculated according to a preset two-point distance formula to obtain the diagonal distance corresponding to the two diagonal pixel points in the diagonal pixel pair.
[0197] It can be seen that in this optional embodiment, the grayscale value calculation of the third dimension of the three-dimensional pixel point is introduced through the set distance calculation formula, which improves the calculation accuracy of the distance between two three-dimensional pixel points (diagonal pixel points).
[0198] In yet another optional embodiment, the third image processing module 303 performs the third image processing on each triangular facet in the second image processing result, and the manner of obtaining the third image processing results corresponding to all the triangular facets specifically includes:
[0199] Determine the target section and its corresponding plane equation, the target section is the base plane or a plane parallel to the base plane;
[0200] For each triangular facet in the second image processing result, determine the vertex coordinates corresponding to each triangular vertex in the triangular facet according to the set fixed-point function;
[0201] According to the plane equation and the vertex coordinates corresponding to each triangle vertex in the triangular facet, the intersection coordinates corresponding to the two target intersection points between the target section and the triangular facet are calculated, and then the two target intersection points are connected to obtain the intersection connection result corresponding to the triangular facet;
[0202] The intersection connection results corresponding to all triangle faces and all target intersections are determined as the third image processing result.
[0203] It can be seen that in this optional embodiment, based on the preset cross-section, the cross-section intersection determination and connection are performed on each triangular facet in the second image processing result, and the boundary points on the segmentation plane (preset cross-section) are supplemented through the set third image processing, thereby generating triangular facets of different categories on both sides of the plane (corresponding to the third image processing result), and then the precise matching processing is performed on the different categories of triangular facets, thereby improving the subsequent image processing accuracy of different categories of triangular facets.
[0204] In another optional embodiment, the fourth image processing module 304 performs the fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition, and the manner in which the fourth image processing result corresponding to the third image processing result is obtained specifically includes:
[0205] For the non-triangular part of the third image processing result, segmentation processing is performed according to the pixel grouping condition until it is determined that the third image processing result is composed of triangular faces, and a segmentation processing result corresponding to the third image processing result is obtained;
[0206] For all the triangular facets in the segmentation processing result, taking the target cross section as a reference, each triangular facet above the target cross section is divided into a first facet, and each triangular facet below the target cross section is divided into a second facet;
[0207] Generate a plurality of first closed veneers according to all the first slices, generate a plurality of second closed veneers according to all the second slices, and determine all the first closed veneers and all the second closed veneers as target closed veneers;
[0208] According to a preset rendering method, gradient color rendering is performed on each target closed surface to obtain a gradient color rendering result corresponding to each target closed surface as a fourth image processing result.
[0209] It can be seen that in this optional embodiment, by setting up segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient colors of individual triangle facets and the three-dimensional shape of the curved surface, thereby improving the flexibility and accuracy of processing and rendering gradient multi-level images.
[0210] In this optional embodiment, the fourth image processing module 304 performs gradient color rendering on each target closed surface according to a preset rendering method, and the method of obtaining the gradient color rendering result corresponding to each target closed surface specifically includes:
[0211] Obtain a two-dimensional tiling projection corresponding to each target closed tiling on the base plane, wherein the two-dimensional tiling projection includes a first sub-tiling projection corresponding to each first closed tiling and a second sub-tiling projection corresponding to each second closed tiling;
[0212] According to the preset first color system, in a counterclockwise direction, gradient color rendering is performed on each first sub-tile projection to obtain a first rendering result corresponding to each first sub-tile projection;
[0213] According to the preset second color system, in a counterclockwise direction, each second sub-tile projection is subjected to gradient color rendering to obtain a second rendering result corresponding to each second sub-tile projection;
[0214] All first rendering results and all second rendering results are determined as gradient color rendering results.
[0215] It can be seen that in this optional embodiment, by setting up segmentation processing, classification processing and gradient color rendering, it is possible to generate multi-layer customized gradient effects by using a very small amount of vertex space without changing the real-time rendering gradient colors of individual triangle facets and the three-dimensional shape of the curved surface, thereby improving the flexibility and accuracy of processing and rendering gradient multi-level images.
[0216] Embodiment 4
[0217] See also Figure 5 , Figure 5 Schematic diagram of another plane segmentation device for three-dimensional rendering of a gradient multi-level plane disclosed in an embodiment of the present invention. Figure 5 As shown, the plane segmentation device for three-dimensional rendering of a gradient multi-order plane may include:
[0218] A memory 401 storing executable program codes;
[0219] a processor 402 coupled to the memory 401;
[0220] The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the plane segmentation method for three-dimensional rendering gradient multi-order planes described in the first embodiment of the present invention or the second embodiment of the present invention.
[0221] Embodiment 5
[0222] An embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the steps in the plane segmentation method for three-dimensional rendering gradient multi-order planes described in Embodiment 1 or Embodiment 2 of the present invention.
[0223] Embodiment 6
[0224] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps in the plane segmentation method for three-dimensional rendering gradient multi-order planes described in embodiment one or embodiment two.
[0225] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0226] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or partly contributed to the prior art in the form of a software product, and the computer software product can be stored in a computer storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0227] Finally, it should be noted that the plane segmentation method and device for three-dimensional rendering gradient multi-order plane disclosed in the embodiment of the present invention only discloses the preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that it is still possible to modify the technical solutions recorded in the aforementioned embodiments, or to make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A plane segmentation method for three-dimensional rendering of a gradient multi-order plane, characterized in that: The method comprises: Performing a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, wherein the first image processing at least includes grayscale conversion; According to a preset pixel grouping condition, performing a second image processing on the first image processing result to obtain a second image processing result corresponding to the first image processing result, wherein the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets; Performing a third image processing on each of the triangular facets in the second image processing result to obtain a third image processing result corresponding to all the triangular facets, wherein the third image processing includes determining the vertices of each of the triangular facets, determining the intersection points between the plane where each of the triangular facets is located and a preset cross section, and connecting the intersection points; For the non-triangular part of the third image processing result, a fourth image processing is performed according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, wherein the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendered image corresponding to the target image.
2. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to claim 1, characterized in that: The performing second image processing on the first image processing result according to the preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result includes: Constructing a stereo model, and then establishing a three-dimensional coordinate system matching the stereo model; the first image processing result includes a grayscale image corresponding to the target image, the three-dimensional coordinate system has a length of the grayscale image as a first axis, a width of the grayscale image as a second axis, and a grayscale value of the grayscale image as a third axis; the first axis and the second axis are in the same base plane, and the third axis is perpendicular to the base plane; Projecting the first image processing result into the three-dimensional coordinate system to obtain a three-dimensional projection result corresponding to the first image processing result; the three-dimensional projection result is composed of a plurality of three-dimensional pixel points; the three-dimensional projection result includes a three-dimensional projection image corresponding to the grayscale image and a two-dimensional viewing angle image, wherein the two-dimensional viewing angle image is obtained by projecting all the three-dimensional pixel points onto the base plane; Performing pixel division on all the three-dimensional pixel points in the two-dimensional viewing angle image to obtain a plurality of quadrilaterals, each of the quadrilaterals being composed of four three-dimensional pixel points, and all the quadrilaterals do not overlap with each other; For each of the quadrilaterals, the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral are calculated, and according to the preset pixel grouping requirements, a target diagonal distance is selected from the two diagonal distances corresponding to the quadrilateral, and the two diagonal pixel points corresponding to the target diagonal distance are connected as the diagonal connection result corresponding to the quadrilateral; the diagonal pixel points are the three-dimensional pixel points at the diagonal position in any of the quadrilaterals; The diagonal connection results corresponding to all the quadrilaterals are determined as second image processing results corresponding to the first image processing results.
3. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to claim 2, characterized in that: The step of selecting a target diagonal distance from two diagonal distances corresponding to the quadrilateral according to a preset pixel grouping requirement includes: Determine, according to the grayscale value corresponding to each of the diagonal pixel points, a pixel attribute of the diagonal pixel point, wherein the pixel attribute includes a negative attribute or a positive attribute, and when the pixel attribute of the diagonal pixel point is the negative attribute, the diagonal pixel point is below the base plane in the three-dimensional projection image; when the pixel attribute of the diagonal pixel point is the positive attribute, the diagonal pixel point is in the base plane or above the base plane in the three-dimensional projection image; The two diagonal pixel points with the same pixel attributes in the quadrilateral are determined as a first pixel pair, and the two diagonal pixel points with different pixel attributes in the quadrilateral are determined as a second pixel pair; and the quadrilateral includes a first diagonal distance and a second diagonal distance; When the quadrilateral satisfies a preset first grouping condition and the first diagonal distance is greater than or equal to the second diagonal distance, determining the second diagonal distance as a target diagonal distance; When the quadrilateral satisfies a preset second grouping condition and the first diagonal distance is smaller than the second diagonal distance, determining the first diagonal distance as a target diagonal distance; Specifically, the quadrilateral satisfies the first grouping condition in that the first pixel pair and the second pixel pair exist in the quadrilateral at the same time; and the second grouping condition is opposite to the first grouping condition.
4. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to claim 2 or 3, characterized in that: The performing the third image processing on each of the triangular facets in the second image processing result to obtain the third image processing results corresponding to all the triangular facets includes: Determine a target cross section and a corresponding plane equation, wherein the target cross section is the base plane or a plane parallel to the base plane; For each of the triangular facets in the second image processing result, determining the vertex coordinates corresponding to each triangular vertex in the triangular facet according to a set fixed-point function; According to the plane equation and the vertex coordinates corresponding to each of the triangle vertices in the triangular facet, the intersection coordinates corresponding to two target intersection points between the target cross section and the triangular facet are calculated, and then the two target intersection points are connected to obtain the intersection connection result corresponding to the triangular facet; The intersection connection results corresponding to all the triangle faces and all the target intersections are determined as the third image processing result.
5. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to any one of claims 1 to 3, characterized in that: The performing fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result includes: For the non-triangular part of the third image processing result, segmentation processing is performed according to the pixel grouping condition until it is determined that the third image processing result is composed of the triangular facets, thereby obtaining a segmentation processing result corresponding to the third image processing result; For all the triangular facets in the segmentation processing result, taking the target cross section as a reference, dividing each triangular facet above the target cross section into a first facet, and dividing each triangular facet below the target cross section into a second facet; generating a plurality of first closed veneers according to all the first slices, generating a plurality of second closed veneers according to all the second slices, and determining all the first closed veneers and all the second closed veneers as target closed veneers; According to a preset rendering method, gradient color rendering is performed on each of the target closed surfaces to obtain a gradient color rendering result corresponding to each of the target closed surfaces as a fourth image processing result.
6. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to claim 5, characterized in that: The step of performing gradient color rendering on each of the target closed surfaces according to a preset rendering method to obtain a gradient color rendering result corresponding to each of the target closed surfaces includes: Acquire a two-dimensional tiling projection corresponding to each of the target closed tilings on the base plane, wherein the two-dimensional tiling projection includes a first sub-tiling projection corresponding to each of the first closed tilings and a second sub-tiling projection corresponding to each of the second closed tilings; According to a preset first color system, in a counterclockwise direction, gradient color rendering is performed on each of the first sub-tiling projections to obtain a first rendering result corresponding to each of the first sub-tiling projections; According to a preset second color system, in a counterclockwise direction, the gradient color rendering is performed on each of the second sub-tiling projections to obtain a second rendering result corresponding to each of the second sub-tiling projections; All of the first rendering results and all of the second rendering results are determined as gradient color rendering results.
7. The plane segmentation method for three-dimensional rendering gradient multi-order plane according to claim 2 or 3, characterized in that: For each of the quadrilaterals, calculating the diagonal distances corresponding to any two diagonal pixel points in the quadrilateral includes: For each of the quadrilaterals, determine the three-dimensional coordinates corresponding to each of the three-dimensional pixel points in the quadrilateral, and simultaneously determine two of the three-dimensional pixel points in diagonal positions in the quadrilateral as a group of diagonal pixel pairs, each group of the diagonal pixel pairs including two diagonal pixel points; For each group of diagonal pixel pairs in each of the quadrilaterals, the distance between the two diagonal pixel points in the group of diagonal pixel pairs is calculated according to a preset two-point distance formula to obtain the diagonal distance corresponding to the two diagonal pixel points in the group of diagonal pixel pairs.
8. A plane segmentation device for three-dimensional rendering of a gradient multi-order plane, characterized in that: The device comprises: A first image processing module, configured to perform a preset first image processing on the acquired target image to obtain a first image processing result corresponding to the target image, wherein the first image processing at least includes grayscale conversion; A second image processing module, configured to perform a second image processing on the first image processing result according to a preset pixel grouping condition to obtain a second image processing result corresponding to the first image processing result, wherein the second image processing includes three-dimensional projection and pixel point grouping, and the second image processing result includes a plurality of triangular facets; A third image processing module, configured to perform a third image processing on each of the triangular facets in the second image processing result to obtain a third image processing result corresponding to all the triangular facets, wherein the third image processing includes determining the vertices of each triangular facet, determining the intersection points between the plane where each triangular facet is located and a preset cross section, and connecting the intersection points; A fourth image processing module is used to perform a fourth image processing on the non-triangular part of the third image processing result according to the pixel grouping condition to obtain a fourth image processing result corresponding to the third image processing result, wherein the fourth image processing includes segmentation processing, classification processing and gradient color rendering; the fourth image processing result includes a target rendered image corresponding to the target image.
9. A plane segmentation device for three-dimensional rendering of a gradient multi-order plane, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the plane segmentation method for three-dimensional rendering of gradient multi-order planes as described in any one of claims 1-7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the plane segmentation method for three-dimensional rendering gradient multi-order planes as described in any one of claims 1-7.
Citation Information
Patent Citations
Reconstruction method of two-dimensional tangent plane of three-dimensional model, mobile terminal and electronic equipment
CN110458949A
Image rendering method and device
CN112184575A
Customizable fineness three-dimensional model voxelization method based on grid segmentation and BVH
CN118365837A
Image forming apparatus, image forming method, and computer product
US20050062994A1
A Method and System for Image Processing
US20170249744A1