Image processing method, apparatus and electronic device
By establishing a correspondence between texture images and 3D model surfaces and adjusting the mapping area using offset coefficients, the problem of insufficient flexibility in VR images in existing technologies is solved, achieving better display effects and flexibility.
Patent Information
- Application Number
- CN202210262157.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-16
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-03-16
AI Technical Summary
In existing technologies, obtaining VR images by pre-setting vertex texture coordinates has poor flexibility, resulting in poor VR image display quality.
By determining the correspondence between texture images and 3D model surfaces, and using offset coefficients to flexibly determine mapping regions in texture images, these regions are combined into sampling regions to be mapped to 3D models, thereby improving the flexibility of VR image acquisition.
It improves the display effect and acquisition flexibility of VR images, avoids cracks between model surfaces, and enhances the display effect of 3D images.
Smart Images

Figure CN114596399B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to an image processing method, apparatus and electronic device. Background Technology
[0002] Terminal devices can create virtual reality (VR) videos using cube-mapping. For example, a terminal device can apply six texture images corresponding to a two-dimensional image onto the six faces of a cube to obtain a VR image corresponding to the two-dimensional image, and thus a virtual reality video.
[0003] Currently, the vertex texture coordinates of each face of the model can be pre-set. The model can then acquire multiple regions from the texture image according to the pre-set vertex texture coordinates and map them back to the model to obtain a VR image. For example, when a cube model receives six texture images, the cube model can acquire target regions from the six texture images respectively according to the pre-set vertex texture coordinates of each face, and then map the six target regions onto the six faces to obtain a VR image. However, according to the above method, the regions acquired by the model from the texture image based on the pre-set vertex texture coordinates are fixed, resulting in poor flexibility in acquiring VR images. Summary of the Invention
[0004] This disclosure provides an image processing method, apparatus, and electronic device to solve the technical problem of poor flexibility in acquiring VR images in the prior art.
[0005] In a first aspect, this disclosure provides an image processing method, the method comprising:
[0006] Determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the 3D model, where N is an integer greater than 1;
[0007] Based on the correspondence and offset coefficient, a mapping region corresponding to each model face is determined in the N texture images, wherein the mapping region is at least a portion of the texture image;
[0008] The mapping regions in the N texture images are mapped to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0009] In a second aspect, this disclosure provides an image processing apparatus, which includes a first determining module, a second determining module, and a mapping module, wherein:
[0010] The first determining module is used to determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the three-dimensional model, where N is an integer greater than 1;
[0011] The second determining module is used to determine the mapping region corresponding to each model face in the N texture images according to the correspondence and offset coefficient, wherein the mapping region is at least a part of the texture image;
[0012] The mapping module is used to map the mapping regions in the N texture images to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0013] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor and a memory;
[0014] The memory stores computer-executed instructions;
[0015] The processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the image processing method as described in the first aspect and various possible designs of the first aspect.
[0016] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the image processing method described in the first aspect and various possible designs of the first aspect.
[0017] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the image processing method described in the first aspect and various possible designs of the first aspect.
[0018] This disclosure provides an image processing method, apparatus, and electronic device. The method determines N texture images corresponding to a first image, and the correspondence between the N texture images and N model faces of a 3D model, where N is an integer greater than 1. Based on the correspondence and offset coefficients, a mapping region corresponding to each model face is determined in the N texture images, where the mapping region is at least a portion of the texture image. The mapping regions in the N texture images are then mapped to the 3D model to obtain the 3D image corresponding to the first image. In this method, the terminal device can flexibly obtain the mapping region in the texture images through the correspondence and offset coefficients, thereby improving the flexibility of obtaining VR images and enhancing the display effect of VR images. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present disclosure;
[0020] Figure 2 A schematic flowchart of an image processing method provided in an embodiment of this disclosure;
[0021] Figure 3 This is a schematic diagram illustrating a process for determining a correspondence, provided in an embodiment of the present disclosure.
[0022] Figure 4 This is a schematic diagram illustrating a process for acquiring a sampling area, provided by an embodiment of the present disclosure.
[0023] Figure 5 This is a schematic diagram illustrating a process for determining a mapping region, as provided in an embodiment of the present disclosure.
[0024] Figure 6 This is a schematic flowchart of a method for determining an offset coefficient provided in an embodiment of the present disclosure;
[0025] Figure 7 This is a schematic diagram of an image processing method provided in an embodiment of the present disclosure;
[0026] Figure 8 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of the present disclosure;
[0027] Figure 9 This is a schematic diagram of another image processing apparatus provided in an embodiment of the present disclosure;
[0028] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0030] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0031] In related technologies, terminal devices can overlay multiple texture images corresponding to a 2D image onto a model surface to obtain a VR image of the 2D image. Currently, the vertex texture coordinates of each face of the model can be pre-set. The model can then acquire multiple regions from the texture image according to the pre-set vertex texture coordinates and map them onto the model surface. For example, when a cube model receives 6 texture images, the cube model can acquire a target region in each texture image according to the pre-set texture coordinates of each model face, and then map the 6 target regions onto the corresponding model faces. However, when the quality of the texture image is poor, the model can only acquire regions from the texture image in a fixed way according to the pre-set vertex texture coordinates, resulting in poor flexibility in acquiring VR images.
[0032] To address the technical problem of poor flexibility in acquiring VR images in related technologies, this disclosure provides an image processing method. The method determines N texture images corresponding to a first image, and the correspondence between the N texture images and N model faces of a 3D model. Based on the correspondence, the N texture images are combined into an L-row, K-column region to obtain a sampling region. Based on the sampling region and an offset coefficient, a mapping region corresponding to the model face is determined, wherein the mapping region is at least a portion of the texture image. The mapping regions in the N texture images are mapped to the 3D model to obtain the 3D image corresponding to the first image. Thus, even when the texture image quality is poor, the terminal device can flexibly acquire the mapping region from the texture image using the correspondence and offset coefficient, which not only improves the display effect of the VR image but also enhances the flexibility of acquiring VR images.
[0033] Below, in conjunction with Figure 1 The application scenarios of this disclosure are explained.
[0034] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this disclosure. Please refer to [link / reference]. Figure 1 The process includes a first image and a 3D model, where the 3D model is a cube model. A preset algorithm is used to obtain texture images corresponding to the first image, including texture images A, B, C, D, E, and F. The correspondence between each texture image and a face of the cube model is determined. Using this correspondence and offset coefficients, six mapping regions are identified in the texture images and mapped onto the corresponding faces of the cube model to obtain the 3D image corresponding to the first image. This allows for flexible adjustment of the mapped regions when obtaining the model faces, preventing gaps between the mapped 3D faces, improving the display effect of the 3D image, and increasing the flexibility of 3D image acquisition.
[0035] The technical solutions of this disclosure and how they solve the aforementioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this disclosure will now be described with reference to the accompanying drawings.
[0036] Figure 2 This is a schematic flowchart illustrating an image processing method provided in an embodiment of this disclosure. Please refer to [link / reference]. Figure 2 The method may include:
[0037] S201. Determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the 3D model.
[0038] The execution entity of this disclosure embodiment can be a terminal device or an image processing device installed in the terminal device. The image processing device can be implemented in software or a combination of software and hardware.
[0039] Optionally, the first image can be an image from a video. For example, when converting a video to a VR video, the first image can be each frame of the video. By converting each frame of the video into a VR image, the corresponding VR video is obtained.
[0040] Optionally, the first image can also be a depth image. For example, the first image can be any spatial image with image depth, such as a landscape image or a scene image. By processing the first image, it can be converted into a VR image.
[0041] Optionally, the texture image can be an image that includes the texture of the first image. The texture is used to indicate variations in the color and grayscale of the first image. For example, an image may exhibit irregularities in local areas but show a general pattern overall; this characteristic of local irregularity with macroscopic regularity is called texture.
[0042] Optionally, the N texture images corresponding to the first image can be determined according to the following feasible implementation: The first image is processed using a preset algorithm to obtain the N texture images corresponding to the first image. Here, N is an integer greater than 1. For example, the engine can use a CommandBuffer model to obtain the texture images corresponding to video frames. For instance, when N is 6, the CommandBuffer technology can be used to obtain 6 texture images corresponding to the first image.
[0043] Optionally, the 3D model can be a cube model. For example, the structure of the 3D model can be a cube, and when the 3D model is a cube model, it can include 6 model faces. Optionally, the correspondence is used to indicate the relationship between the texture image and each model face. For example, when the 3D model is a cube model, the 3D model includes 6 model faces, the number of texture images corresponding to the first image is 6, and each texture image has a corresponding model face.
[0044] Optionally, when the preset algorithm obtains N texture images corresponding to the first image, it can output the correspondence between the N texture images and the N faces of the 3D model. For example, the first texture image output by the preset algorithm corresponds to the left face of the cube model, the second texture image corresponds to the front face of the cube model, the third texture image corresponds to the right face of the cube model, the fourth texture image corresponds to the bottom face of the cube model, the fifth texture image corresponds to the back face of the cube model, and the sixth texture image corresponds to the top face of the cube model.
[0045] Below, in conjunction with Figure 3 The process of determining the correspondence is explained.
[0046] Figure 3 This is a schematic diagram illustrating a process for determining a correspondence according to an embodiment of this disclosure. Please refer to... Figure 3 The dataset includes a first image and a cube model. The cube model unfolds into 6 faces. The first image is processed using a preset algorithm to obtain 6 texture images corresponding to the first image. Texture image A is the first texture image, texture image B is the second texture image, texture image C is the third texture image, texture image D is the fourth texture image, texture image E is the fifth texture image, and texture image F is the sixth texture image.
[0047] Please see Figure 3 Texture image A corresponds to the left side of the cube model, texture image B corresponds to the front side of the cube model, texture image C corresponds to the right side of the cube model, texture image D corresponds to the bottom side of the cube model, texture image E corresponds to the back side of the cube model, and texture image F corresponds to the top side of the cube model.
[0048] S202. Based on the correspondence and offset coefficient, determine the mapping region corresponding to each model surface in N texture images.
[0049] Optionally, the mapping region is at least a portion of the texture image. For example, the mapping region can be the upper region, lower region, middle region, etc. of the texture image. The 3D model can flexibly obtain the mapping region in the texture image, thereby improving the flexibility of image mapping.
[0050] Optionally, at least a portion of the area can be the central region of the texture image. For example, the mapping region of the model face of the 3D model can be the central region of the texture image (e.g., the area remaining after cropping the texture image by 0.5 pixels). This allows for accurate acquisition of the mapping region of the model face, thereby avoiding cracks between model faces and improving the display effect of the 3D model.
[0051] Optionally, the offset coefficient is used to adjust the size of the mapped region. For example, the terminal device can use the offset coefficient to crop 0.5 pixels from the edges of the texture image to obtain the mapped region. Optionally, the mapped region corresponding to each model face can be determined from N texture images according to the following feasible implementation: based on the correspondence, the N texture images are combined into a region of L rows and K columns to obtain a sampling region; based on the sampling region and the offset coefficient, the mapped region corresponding to the model face is determined. Here, the product of L and K is N, and L and K are positive integers. For example, if the number of texture images corresponding to the first image is 6, the terminal device can combine the 6 texture images into a sampling region of 2 rows and 3 columns.
[0052] Below, in conjunction with Figure 4 The process of obtaining the sampling area is explained.
[0053] Figure 4 This is a schematic diagram illustrating a process for acquiring a sampling area according to an embodiment of this disclosure. Please refer to [link / reference]. Figure 4 The first image is processed using a preset algorithm to obtain texture images A, B, C, D, E, and F. Since texture image A represents the left side of the cube model, texture image B the front side, texture image C the right side, texture image D the bottom side, texture image E the back side, and texture image F the top side, these six texture images can be combined into a 2-row, 3-column sampling area. The first row of the sampling area includes texture images A, B, and C, and the second row includes texture images D, E, and F.
[0054] Optionally, based on the sampling region and offset coefficient, the mapping region corresponding to the model face is determined. Specifically, for any model face, the first position of the texture image corresponding to the model face in the sampling region is determined. For example, the sampling region corresponding to a cube model is... Figure 4 In the sampling area shown, if the model face of the cube model is the bottom face, then the texture image corresponding to the bottom face is the image in the second row and the first column at the first position of the sampling area.
[0055] Obtain the vertex texture coordinates of the model face. The vertex texture coordinates include the x-coordinate and y-coordinate of the vertex texture. For example, each face of a cube model includes 4 vertex texture coordinates. Optionally, the minimum value for the x-coordinate and y-coordinate of the vertex texture is 0, and the maximum value is 1. For example, a cube model face may have 4 vertex texture coordinates, where the 4 vertex texture coordinates are (0, 0), (0, 1), (1, 0), and (1, 1).
[0056] Vertex sampling coordinates are determined within the sampling region based on vertex texture coordinates, offset coefficients, and a first position. These vertex sampling coordinates are the vertex coordinates of the mapped region. For example, each vertex texture coordinate of a model face includes corresponding vertex sampling coordinates within the mapped region, allowing the mapping region to be obtained from the sampling region. Optionally, vertex sampling coordinates can be determined using the following feasible implementation: the abscissa of the vertex sampling coordinates is determined based on the vertex texture coordinates, the first position, the column number of the sampling region, and the offset coefficient. The first position can be represented by the rows and columns of the sampling region. For example, the first position can be the image position in the first row and first column of the sampling region, or it can be the image position in the second row and third column of the sampling region.
[0057] Alternatively, the x-coordinate of the vertex sampling coordinates can be determined using the following formula:
[0058] targetCol=mod(destIndex / columnNum)
[0059] x′=x / columnNum+targetCol / columnNum×scalePercent.x
[0060] Wherein, targetCol indicates the column of the vertex sampling coordinates in the sampling region; destIndex is the index of the texture image (e.g., the first texture image in the sampling region, optional, when N is 6, the value of destIndex is 0-5); columnNum is the number of columns in the sampling region; scalePercent.x is the offset coefficient in the x direction; x is the x-coordinate of the vertex texture coordinates; and x′ is the x-coordinate of the vertex sampling coordinates.
[0061] Optionally, the above formula is only an example to illustrate the method of obtaining the x-coordinate of vertex sampling coordinates. Other formulas or methods can also be used to determine the column of vertex sampling coordinates in the sampling region (e.g., when the range of destIndex values is different, targetCol can be calculated by other formulas, or the x-coordinate of the sampled vertex can be obtained by the shader). Those skilled in the art are not limited in this regard.
[0062] The ordinate of the vertex sampling coordinates is determined based on the vertex texture coordinates, the first position, the number of columns in the sampling region, the number of rows in the sampling region, and the offset coefficient.
[0063] Optionally, the ordinate of the vertex sampling coordinates can be determined according to the following formula:
[0064] targetRow=floor(destIndex, columnNum)
[0065] y′=y / rowNum+targetRow / rowNum×scalePercent.y
[0066] Wherein, targetRow indicates the row of the vertex sampling coordinates in the sampling region; destIndex is the index of the texture image (e.g., the first texture image in the sampling region, optional, when N is 6, the value of destIndex is in the range of 0-5); columnNum is the number of columns in the sampling region; rowNum is the number of rows in the sampling region; scalePercent.y is the offset coefficient in the y direction; y is the ordinate of the vertex texture coordinates; y′ is the ordinate of the vertex sampling coordinates.
[0067] Optionally, the above formula is only an example to illustrate the method of obtaining the vertical coordinate of vertex sampling coordinates. The row of vertex sampling coordinates in the sampling area can also be determined by other formulas or methods (e.g., when the range of destIndex values is different, targetRow can also be calculated by other formulas, or the vertical coordinate of the sampled vertex can be obtained by the shader). Those skilled in the art are not limited in this regard.
[0068] Vertex sampling coordinates are obtained by using the x-coordinate and y-coordinate of the vertex sampling coordinates. The sampling region allows for accurate determination of the pixel spacing (pixel difference) between texture images. When determining the mapping region of a model face, the terminal device can adjust the vertex sampling coordinates of each model face based on an offset coefficient. This allows for flexible acquisition of the mapping region for each model face within the sampling region, improving the flexibility and accuracy of mapping region acquisition and ultimately enhancing the display effect of the 3D model.
[0069] Based on the vertex sampling coordinates and the first position, determine the mapping region corresponding to the model face. Optionally, when the number of rows in the sampling region is 2, determining the mapping region corresponding to the model face based on the vertex sampling coordinates and the first position has the following two cases:
[0070] Case 1: The first position is located in the first row of the sampling area.
[0071] If the first position is located in the first row of the sampling area, the mapping area corresponding to the model face is determined based on the vertex sampling coordinates. For example, when the sampling area includes 2 rows and 3 columns, and includes 6 texture images, if the texture image is located in the first row, the mapping area corresponding to the model face is determined based on the vertex sampling coordinates. Optionally, if the texture image is located in the first row of the sampling area, the first region corresponding to the vertex sampling coordinates in the sampling area is determined, and this first region is determined as the mapping area corresponding to the model face. For example, using 4 vertex sampling coordinates or 2 vertex sampling coordinates (e.g., the vertex sampling coordinates of diagonal vertices), a region can be obtained in the sampling area, and this region can then be determined as the mapping area of the model face. In this way, when the vertex sampling coordinates are located in the first row, the terminal device can quickly and accurately determine the mapping area of the model face based on the vertex sampling coordinates.
[0072] Below, in conjunction with Figure 5 The process of determining the mapping region is explained.
[0073] Figure 5 This is a schematic diagram illustrating a process for determining a mapping region according to an embodiment of this disclosure. Please refer to [link / reference]. Figure 5 The system includes a texture image and a cube model. The front face of the cube model includes texture vertices A, B, C, and D. The texture image is the image corresponding to the front face of the cube model. The texture image includes sampled vertices E, F, G, and H. Texture vertex A corresponds to sampled vertex E, texture vertex B to sampled vertex F, texture vertex C to sampled vertex G, and texture vertex D to sampled vertex H. The area enclosed by sampled vertices E, F, G, and H is the mapping area of the front face of the cube model. This allows for flexible adjustment of the mapping area size when acquiring the model's face, avoiding gaps between model faces, improving the 3D image display effect, and increasing the flexibility of 3D image acquisition.
[0074] Case 2: The first position is located in the second row of the sampling area.
[0075] If the first position is located in the second row of the sampling area, the vertex sampling coordinates are flipped by a preset angle to obtain the target vertex sampling coordinates. Based on the target vertex sampling coordinates, the corresponding mapping area of the model face is determined. For example, in practical applications, if the texture image is located in the second row of the sampling area, the texture image is rotated 90 degrees to the right in the sampling area. Therefore, when the texture image is located in the second row of the sampling area, the obtained vertex sampling coordinates can be rotated 90 degrees to the left to obtain the target vertex sampling coordinates. Then, the positively displayed mapping area can be obtained through the target vertex sampling coordinates.
[0076] Optionally, the vertex sampling coordinates can be flipped at a preset angle according to the following formula:
[0077] xyscale=vec2(1.0 / columnNum, 1.0 / rowNum)
[0078] xyBegin=vec2(targetCol / columnNum, targetRow / rowNum)
[0079] xyEnd=vec2(xyscale.x+targetCol / columnNum,xyscale.y+targetRow / rowNum)
[0080] x′=(y′-xyBegin.y)×xyscale.x / xyscale.y+xyBegin.x
[0081] y′=(xyEnd.xx′)×xyscale.y / xyscale.x+xyBegin.y
[0082] Wherein, targetRow indicates the row of the vertex sampling coordinates in the sampling region; targetCol indicates the column of the vertex sampling coordinates in the sampling region; columnNum is the number of columns in the sampling region; rowNum is the number of rows in the sampling region; xyscale is the xy ratio of the two-dimensional vector (e.g., if rowNum is 2, then xyscale.y is 0.5); xyBegin is the two-dimensional vector at the beginning of the xy position; xyEnd is the two-dimensional vector at the end of the xy position; x′ is the x-coordinate of the vertex sampling coordinates; and y′ is the y-coordinate of the vertex sampling coordinates.
[0083] Optionally, the vertex sampling coordinates can be flipped by a preset angle using the above formula (e.g., a 90-degree flip). The above formula is just an example and is not a limitation on the flipping method. Other methods can also be used to flip the coordinates (e.g., flipping the sampled vertex coordinates using a shader). This disclosure does not limit this method.
[0084] Optionally, based on the target vertex sampling coordinates, the mapping region corresponding to the model face is determined. Specifically, a second region corresponding to the target vertex sampling coordinates in the sampling region is determined, and this second region is designated as the mapping region corresponding to the model face. For example, using four target vertex sampling coordinates, or two target vertex sampling coordinates (e.g., the target vertex sampling coordinates of diagonal vertices), a region can be obtained in the sampling region, and this region can then be designated as the mapping region of the model face. In this way, by flipping the vertex sampling coordinates in the second row, a positively displayed mapping region can be obtained, improving the display effect of the 3D model.
[0085] S203. Map the mapping regions in the N texture images to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0086] Optionally, the mapped region of each texture image can be mapped to the model surface of the corresponding 3D model to obtain the 3D image corresponding to the first image. For example, if the mapped region of texture image A is region A and the model surface corresponding to texture image A is model surface A, then region A is mapped to model surface A; if the mapped region of texture image B is region B and the model surface corresponding to texture image B is model surface B, then region B is mapped to model surface B. Through the above method, each mapped region can be mapped to the corresponding model surface to obtain the 3D image corresponding to the first image.
[0087] Optionally, the terminal device can process each frame of the video to obtain a corresponding 3D image. For example, the terminal device can acquire six texture images corresponding to each frame of the video in real time, and determine six mapping regions corresponding to each frame of the video through correspondence and offset coefficients. By mapping the six mapping regions of each frame of the video to the model faces of a cube model, the VR video corresponding to the video is obtained.
[0088] This disclosure provides an image processing method that determines N texture images corresponding to a first image, and the correspondence between the N texture images and N model faces of a 3D model. Based on the correspondence, the N texture images are combined into an L-row, K-column region to obtain a sampling region. Based on the sampling region and an offset coefficient, a mapping region corresponding to the model face is determined, wherein the mapping region is at least a portion of the texture image. The mapping regions in the N texture images are mapped to the 3D model to obtain the 3D image corresponding to the first image. Thus, even when the texture image quality is poor, the terminal device can flexibly obtain the mapping region from the texture image using the correspondence and offset coefficient, which not only improves the display effect of the VR image but also increases the flexibility of obtaining the VR image.
[0089] exist Figure 2Based on the illustrated embodiment, the above image processing method further includes a method for determining offset coefficients. Below, in conjunction with... Figure 6 The method for determining the offset coefficient is explained.
[0090] Figure 6 This is a schematic flowchart illustrating a method for determining an offset coefficient according to an embodiment of this disclosure. Please refer to... Figure 6 The method process includes:
[0091] S601. Obtain the preset region size of the edges of N texture images.
[0092] Optionally, the preset region can be the black border region of the texture image. For example, when obtaining N texture images corresponding to the first image using a preset algorithm, if the image quality of the first image is poor (e.g., low image resolution, black borders), the edges of the extracted texture images will also have black border regions. For example, when a sampling region is composed of N texture images, small black border regions (due to pixel differences) will also appear between the edges of the texture images.
[0093] Optionally, the size of the preset region can be obtained through an image detection algorithm. For example, when obtaining the texture image corresponding to the first image, the size of the black border region at the edge of the texture image can be determined through an image detection algorithm. Similarly, when obtaining the sampling region, the size of the black border in the sampling region can be detected through an image detection algorithm.
[0094] S602. Determine the offset coefficient based on the preset area size.
[0095] Optionally, the offset coefficient can be determined according to the following feasible implementation method: obtaining a first preset relationship. The first preset relationship includes at least one region size and a coefficient corresponding to each region size. For example, the first preset relationship can be as shown in Table 1:
[0096] Table 1
[0097] Area size coefficient Area size 1 Coefficient 1 Area size 2 Coefficient 2 Area size 3 Coefficient 3 …… ……
[0098] It should be noted that Table 1 is only an example to illustrate the first preset relationship, and is not a limitation on the first preset relationship.
[0099] The offset coefficient is determined based on the preset region size and the first preset relationship. For example, if the preset region size is region size 1, then the offset coefficient corresponding to the preset region size is coefficient 1; if the preset region size is region size 2, then the offset coefficient corresponding to the preset region size is coefficient 2; if the preset region size is region size 3, then the offset coefficient corresponding to the preset region size is coefficient 3.
[0100] Optionally, the mapped region can be obtained by scaling the texture image using an offset coefficient. For example, when the offset coefficient is greater than 1, a mapped region larger than the texture image size can be obtained in the sampling region; when the offset coefficient is less than 1, a mapped region smaller than the texture image size can be obtained in the sampling region.
[0101] This disclosure provides a method for determining offset data. The method involves obtaining preset region sizes for N texture image edges, obtaining a first preset relationship, and determining the offset coefficient based on the preset region sizes and the first preset relationship. This allows the terminal device to flexibly adjust the offset coefficient according to the preset region sizes, and thus flexibly and accurately obtain a mapped region excluding black borders in the texture image. Since the mapped region does not include black border areas, the display effect of the VR image can be improved, thereby increasing the flexibility of obtaining VR images.
[0102] Based on any of the above embodiments, the following, in conjunction with Figure 7 The process of the above image processing method will be explained.
[0103] Figure 7 This is a schematic diagram illustrating an image processing method provided in an embodiment of this disclosure. Please refer to [link / reference]. Figure 7 The system includes a first image and a cube model. The first image is processed using a preset algorithm to obtain corresponding texture images, which include texture images A, B, C, D, E, and F. Based on the correspondence between the texture images and each model face, the texture images are combined to obtain a 2-row, 3-column sampling region. Specifically, texture image A corresponds to the left side, texture image B to the front, texture image C to the right side, texture image D to the bottom, texture image E to the back, and texture image F to the top.
[0104] Please see Figure 7Based on the correspondence and offset coefficients, the mapping region corresponding to each model face is determined. When determining the mapping region of the left face of the cube model, mapping region A is obtained at the first row and first column of the sampling region. Using the same method, the mapping region corresponding to each face of the cube model in the sampling region can be obtained (e.g., the mapping region corresponding to the top face is mapping region F). The mapping regions are mapped onto the corresponding cube model to obtain the 3D image corresponding to the first image. Specifically, mapping region A is mapped to the left face, mapping region B to the front face, mapping region C to the right face, mapping region D to the bottom face, mapping region E to the back face, and mapping region F to the top face. In this way, when obtaining the mapping region of the cube model, the range of the mapping region corresponding to the model face can be flexibly adjusted according to the correspondence and offset coefficients, and the size difference between the mapping region and the texture image can be within 1 pixel (e.g., the edge of the texture image can be cropped by 0.5 pixels, leaving the mapping region), thereby avoiding gaps between the 3D model faces, improving the display effect of the 3D image, and increasing the flexibility of obtaining 3D images.
[0105] Figure 8 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of this disclosure. Please refer to [link / reference]. Figure 8 The image processing device 10 includes a first determining module 11, a second determining module 12, and a mapping module 13, wherein:
[0106] The first determining module 11 is used to determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the three-dimensional model, where N is an integer greater than 1;
[0107] The second determining module 12 is used to determine the mapping region corresponding to each model surface in the N texture images according to the correspondence and offset coefficient, wherein the mapping region is at least a part of the texture image;
[0108] The mapping module 13 is used to map the mapping regions in the N texture images to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0109] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0110] According to the correspondence, the N texture images are combined into a region of L rows and K columns to obtain a sampling region, where the product of L and K is N, and L and K are positive integers;
[0111] The mapping region corresponding to the model surface is determined based on the sampling region and the offset coefficient.
[0112] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0113] Determine the first position of the texture image corresponding to the model surface in the sampling area;
[0114] Obtain the vertex texture coordinates of the model face;
[0115] Based on the vertex texture coordinates, the offset coefficient, and the first position, the vertex sampling coordinates are determined in the sampling region;
[0116] Based on the vertex sampling coordinates and the first position, the mapping region corresponding to the model surface is determined.
[0117] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0118] The abscissa of the vertex sampling coordinate is determined based on the vertex texture abscissa, the first position, the number of columns of the sampling region, and the offset coefficient;
[0119] The ordinate of the vertex sampling coordinate is determined based on the vertex texture ordinate, the first position, the number of columns of the sampling region, the number of rows of the sampling region, and the offset coefficient.
[0120] The vertex sampling coordinates are obtained based on the x-coordinate and y-coordinate of the vertex sampling coordinates.
[0121] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0122] If the first position is located in the first row of the sampling area, then the mapping area corresponding to the model surface is determined according to the vertex sampling coordinates;
[0123] If the first position is located in the second row of the sampling area, the vertex sampling coordinates are flipped by a preset angle to obtain the target vertex sampling coordinates, and the mapping area corresponding to the model surface is determined based on the target vertex sampling coordinates.
[0124] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0125] Determine the first region corresponding to the vertex sampling coordinates in the sampling region;
[0126] The first region is determined as the mapping region corresponding to the model surface.
[0127] According to one or more embodiments disclosed herein, the second determining module 12 is specifically used for:
[0128] Determine the second region corresponding to the target vertex sampling coordinates in the sampling region;
[0129] The second region is determined as the mapping region corresponding to the model surface.
[0130] The image processing apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0131] Figure 9 This is a schematic diagram of another image processing apparatus provided in an embodiment of this disclosure. Figure 8 Based on the illustrated embodiments, please refer to Figure 9 The image processing apparatus 10 further includes an acquisition module 14, which is used for:
[0132] Obtain the preset region size of the edges of the N texture images;
[0133] The offset coefficient is determined based on the preset region size.
[0134] This disclosure includes one or more embodiments, wherein the acquisition module 14 is specifically used for:
[0135] Obtain a first preset relationship, which includes at least one region size and a coefficient corresponding to each region size;
[0136] The offset coefficient is determined based on the preset region size and the first preset relationship.
[0137] The image processing apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0138] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Please refer to [link / reference]. Figure 10 The diagram illustrates a structural schematic of an electronic device 900 suitable for implementing embodiments of the present disclosure. The electronic device 900 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0139] like Figure 10 As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0140] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0141] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.
[0142] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0143] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0144] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
[0145] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0146] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0147] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0148] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0149] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0150] In a first aspect, this disclosure provides one or more embodiments of an image processing method, the method comprising:
[0151] Determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the 3D model, where N is an integer greater than 1;
[0152] Based on the correspondence and offset coefficient, a mapping region corresponding to each model face is determined in the N texture images, wherein the mapping region is at least a portion of the texture image;
[0153] The mapping regions in the N texture images are mapped to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0154] This disclosure includes one or more embodiments, wherein the at least partial region is the central region of the texture image; and determining the mapping region corresponding to each model surface in the N texture images according to the correspondence and offset coefficient, including:
[0155] According to the correspondence, the N texture images are combined into a region of L rows and K columns to obtain a sampling region, where the product of L and K is N, and L and K are positive integers;
[0156] The mapping region corresponding to the model surface is determined based on the sampling region and the offset coefficient.
[0157] This disclosure includes one or more embodiments, targeting any model surface; determining the mapping region corresponding to the model surface based on the sampling region and the offset coefficient, including:
[0158] Determine the first position of the texture image corresponding to the model surface in the sampling area;
[0159] Obtain the vertex texture coordinates of the model face;
[0160] Based on the vertex texture coordinates, the offset coefficient, and the first position, the vertex sampling coordinates are determined in the sampling region;
[0161] Based on the vertex sampling coordinates and the first position, the mapping region corresponding to the model surface is determined.
[0162] This disclosure includes one or more embodiments, wherein the vertex texture coordinates include a vertex texture horizontal coordinate and a vertex texture vertical coordinate; determining vertex sampling coordinates in the sampling region based on the vertex texture coordinates, the offset coefficient, and the first position includes:
[0163] The abscissa of the vertex sampling coordinate is determined based on the vertex texture abscissa, the first position, the number of columns of the sampling region, and the offset coefficient;
[0164] The ordinate of the vertex sampling coordinate is determined based on the vertex texture ordinate, the first position, the number of columns of the sampling region, the number of rows of the sampling region, and the offset coefficient.
[0165] The vertex sampling coordinates are obtained based on the x-coordinate and y-coordinate of the vertex sampling coordinates.
[0166] This disclosure includes one or more embodiments, wherein the number of rows in the sampling region is 2; determining the mapping region corresponding to the model surface based on the vertex sampling coordinates and the first position includes:
[0167] If the first position is located in the first row of the sampling area, then the mapping area corresponding to the model surface is determined according to the vertex sampling coordinates;
[0168] If the first position is located in the second row of the sampling area, the vertex sampling coordinates are flipped by a preset angle to obtain the target vertex sampling coordinates, and the mapping area corresponding to the model surface is determined based on the target vertex sampling coordinates.
[0169] This disclosure includes one or more embodiments for determining the mapping region corresponding to the model surface based on the vertex sampling coordinates, including:
[0170] Determine the first region corresponding to the vertex sampling coordinates in the sampling region;
[0171] The first region is determined as the mapping region corresponding to the model surface.
[0172] This disclosure includes one or more embodiments of determining the mapping region corresponding to the model surface based on the sampled coordinates of the target vertex, including:
[0173] Determine the second region corresponding to the target vertex sampling coordinates in the sampling region;
[0174] The second region is determined as the mapping region corresponding to the model surface.
[0175] According to one or more embodiments of this disclosure, before determining the mapping region corresponding to each model surface in the N texture images based on the correspondence and offset coefficient, the method further includes:
[0176] Obtain the preset region size of the edges of the N texture images;
[0177] The offset coefficient is determined based on the preset region size.
[0178] This disclosure includes one or more embodiments, in which the offset coefficient is determined based on the preset region size, including:
[0179] Obtain a first preset relationship, which includes at least one region size and a coefficient corresponding to each region size;
[0180] The offset coefficient is determined based on the preset region size and the first preset relationship.
[0181] Secondly, one or more embodiments of this disclosure provide an image processing apparatus, including a first determining module, a second determining module, and a mapping module, wherein:
[0182] The first determining module is used to determine the N texture images corresponding to the first image, and the correspondence between the N texture images and the N model faces of the three-dimensional model, where N is an integer greater than 1;
[0183] The second determining module is used to determine the mapping region corresponding to each model face in the N texture images according to the correspondence and offset coefficient, wherein the mapping region is at least a part of the texture image;
[0184] The mapping module is used to map the mapping regions in the N texture images to the three-dimensional model to obtain the three-dimensional image corresponding to the first image.
[0185] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0186] According to the correspondence, the N texture images are combined into a region of L rows and K columns to obtain a sampling region, where the product of L and K is N, and L and K are positive integers;
[0187] The mapping region corresponding to the model surface is determined based on the sampling region and the offset coefficient.
[0188] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0189] Determine the first position of the texture image corresponding to the model surface in the sampling area;
[0190] Obtain the vertex texture coordinates of the model face;
[0191] Based on the vertex texture coordinates, the offset coefficient, and the first position, the vertex sampling coordinates are determined in the sampling region;
[0192] Based on the vertex sampling coordinates and the first position, the mapping region corresponding to the model surface is determined.
[0193] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0194] The abscissa of the vertex sampling coordinate is determined based on the vertex texture abscissa, the first position, the number of columns of the sampling region, and the offset coefficient;
[0195] The ordinate of the vertex sampling coordinate is determined based on the vertex texture ordinate, the first position, the number of columns of the sampling region, the number of rows of the sampling region, and the offset coefficient.
[0196] The vertex sampling coordinates are obtained based on the x-coordinate and y-coordinate of the vertex sampling coordinates.
[0197] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0198] If the first position is located in the first row of the sampling area, then the mapping area corresponding to the model surface is determined according to the vertex sampling coordinates;
[0199] If the first position is located in the second row of the sampling area, the vertex sampling coordinates are flipped by a preset angle to obtain the target vertex sampling coordinates, and the mapping area corresponding to the model surface is determined based on the target vertex sampling coordinates.
[0200] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0201] Determine the first region corresponding to the vertex sampling coordinates in the sampling region;
[0202] The first region is determined as the mapping region corresponding to the model surface.
[0203] According to one or more embodiments disclosed herein, the second determining module is specifically used for:
[0204] Determine the second region corresponding to the target vertex sampling coordinates in the sampling region;
[0205] The second region is determined as the mapping region corresponding to the model surface.
[0206] According to one or more embodiments disclosed herein, the image processing apparatus further includes an acquisition module, the acquisition module being configured to:
[0207] Obtain the preset region size of the edges of the N texture images;
[0208] The offset coefficient is determined based on the preset region size.
[0209] This disclosure includes one or more embodiments, wherein the acquisition module is specifically used for:
[0210] Obtain a first preset relationship, which includes at least one region size and a coefficient corresponding to each region size;
[0211] The offset coefficient is determined based on the preset region size and the first preset relationship.
[0212] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor and a memory;
[0213] The memory stores computer-executed instructions;
[0214] The processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the image processing method as described in the first aspect and various possible designs of the first aspect.
[0215] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the image processing method described in the first aspect and various possible designs of the first aspect.
[0216] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the image processing method described in the first aspect and various possible designs of the first aspect.
[0217] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0218] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0219] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. An image processing method, characterized by, The method comprises the following steps: determining N texture images corresponding to a first image and the corresponding relationship between the N texture images and N model surfaces of a three-dimensional model, N being an integer greater than 1; determining a sampling region according to the corresponding relationship; determining a first position of the texture image corresponding to the model surface in the sampling region; if the first position is located in the first row of the sampling region, determining a mapping region corresponding to the model surface according to a vertex sampling coordinate, the vertex sampling coordinate being determined in the sampling region based on the vertex texture coordinate of the model surface, an offset coefficient and the first position; if the first position is located in the second row of the sampling region, performing a preset angle flip processing on the vertex sampling coordinate to obtain a target vertex sampling coordinate, and determining a mapping region corresponding to the model surface according to the target vertex sampling coordinate, the mapping region being at least part of the texture image; mapping the mapping region in the N texture images to the three-dimensional model to obtain a three-dimensional image corresponding to the first image.
2. The method of claim 1, wherein, The at least part of the region is a middle region of the texture image; determining a sampling region according to the corresponding relationship comprises: combining the N texture images into L rows and K columns of regions according to the corresponding relationship to obtain a sampling region, the product of L and K being N, L and K being positive integers.
3. The method of claim 2, wherein, After determining the first position of the texture image corresponding to the model surface in the sampling region, the method further comprises: obtaining a vertex texture coordinate of the model surface; determining a vertex sampling coordinate in the sampling region according to the vertex texture coordinate, the offset coefficient and the first position.
4. The method of claim 3, wherein, The vertex texture coordinate comprises a vertex texture horizontal coordinate and a vertex texture vertical coordinate; determining a vertex sampling coordinate in the sampling region according to the vertex texture coordinate, the offset coefficient and the first position comprises: determining a horizontal coordinate of the vertex sampling coordinate according to the vertex texture horizontal coordinate, the first position, the number of columns of the sampling region and the offset coefficient; determining a vertical coordinate of the vertex sampling coordinate according to the vertex texture vertical coordinate, the first position, the number of columns of the sampling region, the number of rows of the sampling region and the offset coefficient; obtaining the vertex sampling coordinate according to the horizontal coordinate of the vertex sampling coordinate and the vertical coordinate of the vertex sampling coordinate.
5. The method of claim 1, wherein, Determining a mapping region corresponding to the model surface according to the vertex sampling coordinate comprises: determining a first region corresponding to the vertex sampling coordinate in the sampling region; determining the first region as the mapping region corresponding to the model surface.
6. The method of claim 1, wherein, Determining a mapping region corresponding to the model surface according to the target vertex sampling coordinate comprises: determining a second region corresponding to the target vertex sampling coordinate in the sampling region; determining the second region as the mapping region corresponding to the model surface.
7. The method according to any one of claims 1 to 4, characterized in that, Before determining a mapping region corresponding to each model surface in the N texture images according to the corresponding relationship and the offset coefficient, the method further comprises: obtaining a preset region size of the edges of the N texture images; The offset coefficient is determined according to the preset region size.
8. The method of claim 7, wherein, The offset coefficient is determined according to the preset region size, including: A first preset relationship is acquired, the first preset relationship including at least one region size and a corresponding coefficient of each region size; The offset coefficient is determined according to the preset region size and the first preset relationship.
9. An image processing apparatus characterized by comprising: The method comprises a first determining module, a second determining module and a mapping module, wherein: The first determining module is configured to determine a corresponding relationship between N texture images corresponding to a first image and N model surfaces of a three-dimensional model, the N being an integer greater than 1; The second determining module is configured to determine a sampling region according to the corresponding relationship; The second determining module is further configured to determine a first position of the texture image corresponding to the model surface in the sampling region; If the first position is located in a first row of the sampling region, a mapping region corresponding to the model surface is determined according to a vertex sampling coordinate, the vertex sampling coordinate being determined in the sampling region based on a vertex texture coordinate of the model surface, an offset coefficient and the first position; If the first position is located in a second row of the sampling region, a target vertex sampling coordinate is obtained by performing a preset angle flip processing on the vertex sampling coordinate, and a mapping region corresponding to the model surface is determined according to the target vertex sampling coordinate, the mapping region being at least a part of the texture image; The mapping module is configured to map the mapping region in the N texture images to the three-dimensional model to obtain a three-dimensional image corresponding to the first image.
10. An electronic device, comprising: The method comprises: a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the image processing method according to any one of claims 1 to 8.
11. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the image processing method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the image processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image processing method and apparatus
CN109427087A
Image processing method and device, electronic equipment and storage medium
CN114140568A
Graphics processing employing cube map texturing
US20180174352A1