WO2024103872A1 - 图像处理方法及电子设备 - Google Patents
图像处理方法及电子设备 Download PDFInfo
- Publication number
- WO2024103872A1 WO2024103872A1 PCT/CN2023/113755 CN2023113755W WO2024103872A1 WO 2024103872 A1 WO2024103872 A1 WO 2024103872A1 CN 2023113755 W CN2023113755 W CN 2023113755W WO 2024103872 A1 WO2024103872 A1 WO 2024103872A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- triangle
- subdivision
- image
- intersection
- vertex
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 26
- 238000012545 processing Methods 0.000 claims abstract description 149
- 230000033001 locomotion Effects 0.000 claims abstract description 75
- 238000000034 method Methods 0.000 claims abstract description 73
- 239000013598 vector Substances 0.000 claims abstract description 63
- 230000003068 static effect Effects 0.000 claims description 72
- 238000004590 computer program Methods 0.000 claims description 15
- 230000000007 visual effect Effects 0.000 abstract description 8
- 238000010586 diagram Methods 0.000 description 22
- 230000006870 function Effects 0.000 description 21
- 230000008569 process Effects 0.000 description 21
- 238000007726 management method Methods 0.000 description 17
- 238000004364 calculation method Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 14
- 238000005516 engineering process Methods 0.000 description 14
- 230000000694 effects Effects 0.000 description 12
- 238000009877 rendering Methods 0.000 description 11
- 230000005236 sound signal Effects 0.000 description 9
- 238000000605 extraction Methods 0.000 description 8
- 230000009466 transformation Effects 0.000 description 7
- 230000008859 change Effects 0.000 description 6
- 230000001133 acceleration Effects 0.000 description 5
- 230000015572 biosynthetic process Effects 0.000 description 5
- 238000013461 design Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 5
- 238000010295 mobile communication Methods 0.000 description 5
- 238000003786 synthesis reaction Methods 0.000 description 5
- 230000002159 abnormal effect Effects 0.000 description 4
- 230000020169 heat generation Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000013500 data storage Methods 0.000 description 3
- 239000000284 extract Substances 0.000 description 3
- 238000007667 floating Methods 0.000 description 3
- 230000004927 fusion Effects 0.000 description 3
- 238000010606 normalization Methods 0.000 description 3
- 230000007704 transition Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000013213 extrapolation Methods 0.000 description 2
- 238000010438 heat treatment Methods 0.000 description 2
- 230000010365 information processing Effects 0.000 description 2
- 238000005293 physical law Methods 0.000 description 2
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 210000000988 bone and bone Anatomy 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000017525 heat dissipation Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
Definitions
- the present application relates to the technical field of intelligent terminals, and in particular to an image processing method and an electronic device.
- Video interpolation technology aims to improve the frame rate and smoothness of videos, making them look smoother. As long as a predicted frame (or intermediate frame, transition frame, etc.) is inserted between adjacent real frames (or original frames), the frame rate of the video can be doubled, and the quality of the predicted frame is directly related to the smoothness of the video. The moving direction and speed of each object in the image are calculated through the information of two adjacent frames, and the objects in the image are moved accordingly to obtain the predicted frame.
- image warping is a way to better ensure image continuity.
- the image warping operation may cause local image distortion, making the difference between the predicted frame image and the real frame image obvious, greatly reducing the user's visual experience.
- an embodiment of the present application provides an image processing method and an electronic device.
- the electronic device when the electronic device calculates a predicted frame based on a first real frame and a second real frame, it first calculates the motion vectors corresponding to the first real frame and the second real frame, and creates an initial mesh Mesh corresponding to the second real frame, and then identifies the subdivision intersections based on the pixel depth values, and subdivides the initial Mesh based on the subdivision intersections to obtain a target Mesh, and then performs image distortion processing on the second real frame according to the target Mesh and the motion vector to generate a predicted frame image.
- the problem of local stretching in image areas with discontinuous depth values in the predicted frame can be avoided, so as to better retain continuous graphic information, improve the picture quality of the predicted frame image, and provide users with a better visual experience.
- an embodiment of the present application provides an image processing method.
- the method includes: an electronic device acquires a first image and a second image, and calculates a motion vector based on the first image and the second image; wherein the first image and the second image are real frame images; the electronic device creates an initial mesh Mesh of the second image, and determines the initial geometric figure to be subdivided corresponding to the static object in the initial Mesh; wherein the initial geometric figure has only two subdivision intersections, which are located on the edge of the initial geometric figure, and there is at most one subdivision intersection on each edge of each initial geometric figure; the subdivision intersection is determined based on the depth value of the pixel point in the initial geometric figure, which is the edge pixel point of the static object; the electronic device performs mesh subdivision on the corresponding initial geometric figure according to the two subdivision intersections of each initial geometric figure, and obtains the target Mesh of the second image; in the target Mesh, the line connecting the two subdivision intersections of each initial geometric figure is the edge of the target triangle, or part of the line
- the first image and the second image may be two adjacent real frame images in a video source.
- the first image and the second image may include only image information, or may include both image information and user interface information.
- the subdivision intersection is used to subdivide the initial geometric figures to be subdivided corresponding to the static objects in the initial Mesh, so that the pixel depth information of each geometric figure after subdivision is continuous.
- the initial geometric figure may be a triangle, a quadrilateral, a polygon, etc.
- the initial Mesh is a quadrilateral Mesh, and the initial geometric figure is a quadrilateral; after the electronic device creates the initial Mesh of the second image, the method further includes: the electronic device normalizes the quadrilateral Mesh to divide each quadrilateral into two triangles.
- the subdivision intersection of the quadrilateral to be subdivided is a first subdivision intersection and a second subdivision intersection, and the quadrilateral to be subdivided is divided into a first triangle and a second triangle;
- the first triangle is subdivided into a first sub-triangle, a second sub-triangle and a third sub-triangle; wherein the common side of the first sub-triangle and the second sub-triangle is the line connecting the first subdivision intersection and the second subdivision intersection, and the common side of the second sub-triangle and the third sub-triangle is the line connecting the first subdivision intersection or the second subdivision intersection and the vertex of the first triangle (in this case, refer to the situations shown in (1) and (2) in FIG. 13b ); or,
- the second triangle is subdivided into a fourth sub-triangle, a fifth sub-triangle and a sixth sub-triangle; wherein the common side of the fourth sub-triangle and the fifth sub-triangle is the line connecting the first subdivision intersection and the second subdivision intersection, and the common side of the fifth sub-triangle and the sixth sub-triangle is the line connecting the first subdivision intersection or the second subdivision intersection and the vertex of the second triangle (in this case, refer to the situations shown in (7) and (8) in FIG. 13b ); or,
- the first triangle is subdivided into the seventh sub-triangle, the eighth sub-triangle and the ninth sub-triangle
- the second triangle is subdivided into the tenth sub-triangle, the eleventh sub-triangle and the twelfth sub-triangle
- the common side of the seventh sub-triangle and the eighth sub-triangle is the line connecting the first sub-division intersection and the third point
- the common side of the eighth sub-triangle and the ninth sub-triangle is the line connecting the first sub-division intersection and the vertex of the first triangle
- the common side of the tenth sub-triangle and the eleventh sub-triangle is the line connecting the second sub-division intersection and the third point
- the common side of the eleventh sub-triangle and the twelfth sub-triangle is the line connecting the second sub-division intersection and the vertex of the second triangle
- the first triangle can be subdivided based on the subdivision intersection alone, or not, or it can be subdivided together with the second triangle based on the subdivision intersection.
- the pixel depth value of each sub-triangle is continuous, so that when the image is distorted with each subdivided sub-triangle as a unit, there will be no problem of geometric figure stretching and deformation, thereby avoiding the problem of local stretching in the image area with discontinuous depth values in the predicted frame image, and can better retain continuous graphic information.
- the method further includes: in the target Mesh, the electronic device sets the depth information of each triangle.
- the electronic device when it performs image distortion processing, it can combine the pixel depth information to ensure the correct depth sequence relationship between different objects in the predicted frame image.
- the electronic device performs image distortion processing on the second image according to the target Mesh and the motion vector, which may include: for each triangle in the target Mesh, the electronic device determines the motion vector of each vertex of the triangle, and moves the triangle according to the motion vector of each vertex of the triangle; when each triangle moves to the target position, the electronic device determines the coverage relationship between the triangle and other triangles at the target position based on the depth information of the triangle and the depth information of other triangles at the target position.
- the electronic device when it moves a triangle based on a motion vector, it can determine the covering relationship between the triangle and other triangles according to the depth information of the triangle, so as to ensure the correct depth order relationship between different objects in the predicted frame image.
- the subdivision intersection of the quadrilateral to be subdivided is a first subdivision intersection and a second subdivision intersection, and the quadrilateral to be subdivided is divided into a first triangle and a second triangle;
- the electronic device meshes the initial geometric figure according to the two subdivision intersections of the initial geometric figure, which may include: the electronic device meshes the first triangle and/or the second triangle using a matching mesh subdivision strategy based on the positional relationship between the first subdivision intersection and the second subdivision intersection and the first triangle and the second triangle.
- the electronic device can mesh the first triangle alone, mesh the second triangle alone, or mesh the first triangle and the second triangle together based on the positional relationship between the first subdivision intersection and the second subdivision intersection and the first triangle and the second triangle.
- the electronic device uses a matching mesh subdivision strategy to mesh the first triangle and/or the second triangle based on the positional relationship between the first subdivision intersection and the second subdivision intersection, the first triangle, and the second triangle, which may include: when the horizontal coordinate of the first subdivision intersection is equal to the horizontal coordinate of the first vertex and the second vertex of the first triangle, and the vertical coordinate of the second subdivision intersection is equal to the vertical coordinate of the second vertex and the third vertex of the first triangle, the electronic device connects the first subdivision intersection and the second subdivision intersection, and connects the first subdivision intersection and the third vertex of the first triangle or connects the second subdivision intersection and the first vertex of the first triangle, so as to subdivide the first triangle into three triangles alone.
- the electronic device performs mesh subdivision on the first triangle based on the first subdivision intersection and the second subdivision intersection, and does not perform mesh subdivision on the second triangle.
- the situations shown in (1) and (2) in FIG. 13b may be referred to.
- the electronic device performs mesh subdivision on the first triangle and/or the second triangle using a matching mesh subdivision strategy according to a positional relationship between the first subdivision intersection and the second subdivision intersection, the first triangle, and the second triangle, which may include:
- the electronic device connects the first subdivision intersection and the second subdivision intersection, and connects the first subdivision intersection and the third vertex of the second triangle or connects the second subdivision intersection and the first vertex of the second triangle to subdivide the second triangle into three triangles alone.
- the electronic device performs mesh subdivision on the second triangle based on the first subdivision intersection and the second subdivision intersection, but does not perform mesh subdivision on the first triangle.
- the situations shown in (7) and (8) in FIG. 13b may be referred to.
- the electronic device performs mesh subdivision on the first triangle and/or the second triangle using a matching mesh subdivision strategy according to a positional relationship between the first subdivision intersection and the second subdivision intersection, the first triangle, and the second triangle, including:
- the electronic device connects the first subdivision intersection and the second subdivision intersection, connects the first subdivision intersection and the first vertex of the first triangle, and connects the second subdivision intersection and the first vertex of the second triangle, so as to subdivide the first triangle and the second triangle into three triangles respectively (in this case, the situation shown in (3) in FIG. 13b may be referred to);
- the electronic device connects the first subdivision intersection and the second subdivision intersection, connects the first subdivision intersection and the third vertex of the first triangle, and connects the second subdivision intersection and the third vertex of the second triangle, so as to subdivide the first triangle and the second triangle into three triangles respectively (in this case, the situation shown in (5) in FIG. 13b may be referred to);
- the electronic device connects the first subdivision intersection and the second subdivision intersection, connects the first subdivision intersection and the first vertex of the first triangle, and connects the second subdivision intersection and the third vertex of the second triangle, so as to subdivide the first triangle and the second triangle into three triangles respectively (in this case, the situation shown in (4) in FIG. 13b may be referred to);
- the electronic device connects the first subdivision intersection and the second subdivision intersection, connects the first subdivision intersection and the third vertex of the first triangle, and connects the second subdivision intersection and the first vertex of the second triangle to subdivide the first triangle and the second triangle into three triangles respectively (at this time, you can refer to the situation shown in (6) in Figure 13b).
- the electronic device may jointly perform mesh subdivision on the first triangle and the second triangle according to the first subdivision intersection point and the second subdivision intersection point, so that the depth value of the pixel points of each subdivided triangle is continuous.
- the electronic device determines the initial geometric figures to be subdivided corresponding to the static object in the initial Mesh, which may include: the electronic device determines the initial geometric figures corresponding to the static object in the initial Mesh; the electronic device determines the subdivision intersections of each initial geometric figure; the electronic device uses the initial geometric figure with 2 subdivision intersections and at most one subdivision intersection on each edge as the initial geometric figure to be subdivided.
- the electronic device determines the subdivision intersection points of the initial geometric figure, which may include: the electronic device determines each edge pixel point in the initial geometric figure; wherein the depth value of the edge pixel point is within a preset range, and the difference in depth value between the edge pixel point and the surrounding pixel points exceeds a preset threshold; the electronic device uses the edge pixel points located on the edge of the initial geometric figure as the subdivision intersection points of the initial geometric figure.
- the first image and the second image are The rendered image.
- the predicted frame image calculated based on the two is also a rendered image, which can achieve halving the rendering at the same frame rate, thereby greatly reducing the power consumption of electronic devices and reducing the heat generation of electronic devices.
- the electronic device obtains the first image and the second image, which may include: the electronic device obtains the first resource image, and separates the user interface UI information in the first resource image to obtain the first image; the electronic device obtains the second resource image, and separates the UI information in the second resource image to obtain the second image; after the electronic device generates a predicted frame image corresponding to the first image and the second image, it also includes: the electronic device performs image completion processing on the predicted frame image, and fuses the predicted frame image after the completion processing and the UI information to obtain a target predicted frame image.
- the resource image includes image information and UI information.
- the UI information separated in the first resource image and the UI information separated in the second resource image may be the same or different.
- the electronic device When the UI information separated in the first resource image is different from the UI information separated in the second resource image, the electronic device fuses the second predicted frame image with the UI information corresponding to the second resource image to obtain a target predicted frame image, wherein the second resource image is the current frame resource image and the first resource image is the previous frame resource image of the current frame resource image.
- the electronic device separates the UI information from the resource image and then calculates the predicted frame image, which can effectively reduce the image data processing volume and improve the accuracy of the predicted frame image information.
- the first resource image and the second resource image are resource images in a game application.
- the image scene is relatively complex, there are many static objects (such as various buildings, etc.), and the depth difference of static objects in the scene is large (that is, the depth values of different static objects are discontinuous).
- static objects such as various buildings, etc.
- the depth difference of static objects in the scene is large (that is, the depth values of different static objects are discontinuous).
- large-angle scene shaking may only cause some objects in the image to move more, rather than causing all objects in the image to move more.
- the distribution of MV images calculated based on continuous real frame images is uneven, especially in image areas with large differences in depth information, the difference in MV values is also relatively large.
- the electronic device predicts the frame image based on the MV calculation, it is very likely that the edge area of static objects with discontinuous depth values will be distorted in the predicted frame image.
- the edge area of the static object in the game image is identified by the pixel depth value, the edge area is meshed based on the pixel depth information, and the image is distorted using the subdivided mesh geometry as a unit, thereby solving the problem of distortion of the edge area of the static object in the game scene prediction frame image and improving the user's gaming experience.
- an embodiment of the present application provides an electronic device.
- the electronic device includes: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device executes the first aspect and any of the first aspect.
- An image processing method is described.
- the second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively.
- the technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
- an embodiment of the present application provides a computer-readable storage medium.
- the computer-readable storage medium includes a computer program, and when the computer program is executed on an electronic device, the electronic device executes the image processing method in the first aspect and any one of the first aspects.
- the third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect, respectively.
- the technical effects corresponding to the third aspect and any implementation of the third aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
- an embodiment of the present application provides a computer program product, including a computer program, which, when executed, enables a computer to execute an image processing method as in the first aspect or any one of the first aspects.
- the fourth aspect and any implementation of the fourth aspect correspond to the first aspect and any implementation of the first aspect, respectively.
- the technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
- the present application provides a chip, the chip comprising a processing circuit and a transceiver pin, wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the image processing method of the first aspect or any one of the first aspects to control the receiving pin to receive a signal, and to control the sending pin to send a signal.
- the fifth aspect and any implementation of the fifth aspect correspond to the first aspect and any implementation of the first aspect, respectively.
- the technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
- FIG. 1a is a schematic diagram of an exemplary frame insertion mode
- FIG. 1b is an exemplary diagram showing a predicted frame interpolation example
- FIG. 2 is a schematic diagram of an exemplary generation process of a prediction frame image
- FIG3 is a schematic diagram of an exemplary image gridding
- FIG4 is an exemplary depth image
- FIG5 is a schematic diagram of an exemplary application scenario
- FIG6 is a schematic diagram showing an exemplary image grid distortion
- FIG7 is a schematic diagram showing a hardware structure of an electronic device
- FIG8 is a schematic diagram showing an exemplary software structure of an electronic device
- FIG9 is a schematic diagram showing the interaction of modules involved in the image processing method
- FIG10 is a schematic diagram of an exemplary image distortion process
- FIG11 is a schematic diagram showing an exemplary grid standardization
- FIG12 is a flowchart showing an exemplary method of determining a subdivided intersection point
- FIG13a is a schematic diagram showing an exemplary distribution of subdivided intersection points
- FIG13b is a schematic diagram showing an exemplary grid subdivision
- FIG14 is a schematic diagram showing an exemplary grid movement
- FIG15a is one of the schematic diagrams of an exemplary application scenario
- FIG. 15 b is one of the schematic diagrams of an exemplary application scenario.
- a and/or B in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist.
- a and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
- first and second in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects.
- a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
- words such as “exemplary” or “for example” are used to indicate examples, illustrations or descriptions. Any embodiment or design described as “exemplary” or “for example” in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as “exemplary” or “for example” is intended to present related concepts in a specific way.
- multiple refers to two or more than two.
- multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
- Video interpolation technology aims to improve the frame rate and smoothness of the video, making the video look smoother. As long as a predicted frame (or intermediate frame, transition frame, etc.) is inserted between adjacent real frames (or original frames, etc.), the frame rate of the video can be doubled.
- the image quality of the predicted frame is directly related to the smoothness of the video. Among them, the moving direction and speed of each object in the image are calculated through the image information of two adjacent real frames, and the objects in the image are moved accordingly to obtain the predicted frame.
- real frames refer to image frames originally existing in the video source, not image frames generated by prediction.
- real frames can be image frames drawn by developers when developing applications such as games, or image frames captured by image acquisition devices (such as cameras) when making videos.
- the video interpolation method can be divided into predicted frame interpolation and predicted frame extrapolation.
- the predicted frame interpolation method as shown in FIG1a (1), a predicted frame image is calculated based on two adjacent real frame images, and the predicted frame image is interpolated between the two real frame images, thereby improving the video frame rate.
- the predicted frame extrapolation method as shown in FIG1a (2), a predicted frame image is calculated based on two adjacent real frame images, and the predicted frame image is interpolated after the two real frame images as the next frame image, thereby improving the video frame rate.
- the prediction frame 1 is calculated based on the real frame 1 and the real frame 2, and the prediction frame 1 is inserted between the real frame 1 and the real frame 2; the prediction frame 2 is calculated based on the real frame 2 and the real frame 3, and the prediction frame 2 is inserted between the real frame 2 and the real frame 3; the prediction frame 3 is calculated based on the real frame 3 and the real frame 4, and the prediction frame 3 is inserted between the real frame 3 and the real frame 4; and so on.
- the frame rate of the video is improved by the prediction frame interpolation method, so that the movement transition of static objects and dynamic objects is smoother, and the picture is more fluent.
- the first real frame and the second real frame are two adjacent image frames in a certain game application. It is assumed that the second real frame is the current image frame and the first real frame is the previous image frame of the second real frame.
- the smart terminal can calculate the predicted frame based on the first real frame and the second real frame. Taking the predicted frame interpolation method as an example, the smart terminal can interpolate the calculated predicted frame between the two real frames for display, thereby increasing the frame rate of the game video and achieving half the rendering at the same frame rate.
- the real frame includes image information and UI (User Interface) information.
- image information can be understood as the picture information in the video source
- UI information refers to the overall design information of the human-computer interaction, operation logic, and interface aesthetics of the software.
- the smart terminal when calculating the predicted frame, can first extract the first image 101 and the first UI 102 in the first real frame, extract the second image 103 and the second UI 104 in the second real frame, and then perform image prediction operations based on the first image 101 and the second image frame to obtain the predicted frame image 107.
- the intelligent terminal may first calculate the motion vector (MV) 105 of the first image 101 and the second image 103, and perform image warping processing on the second image 103 based on the motion vector 105 to obtain the predicted frame image 106.
- the image warping processing refers to changing the position of the image pixels through a certain transformation, such as translation transformation, rotation transformation, scaling transformation, affine transformation, perspective transformation, columnar transformation, etc.
- the image distortion processing can better ensure the continuous movement of each object in the image, but because the movement speeds of each object in the image are different, the predicted frame image 106 obtained after the image distortion processing may have image information coverage or image information missing.
- the smart terminal also needs to perform image completion (Blur) processing on the predicted frame image 106 to obtain the predicted frame image 107.
- the smart terminal merges the second UI 104 and the predicted frame image 107 to obtain the predicted frame 108 calculated based on the first real frame and the second real frame.
- both the image distortion processing and the fusion UI information processing can be based on the information in the current real frame.
- the image distortion processing and the fusion UI information processing can also be based on the previous frame information of the current real frame, which is not limited in this embodiment.
- the intelligent terminal in computer graphics, mesh geometry is usually used as the basic unit of image processing.
- the intelligent terminal also uses mesh geometry as the basic unit to perform image distortion processing. That is to say, the intelligent terminal performs image distortion processing by forming a geometric group of triangles or quadrilaterals in the image.
- the image frame 20 is a global work group.
- a plurality of quadrilaterals 201 can be divided in the image frame 20, and each quadrilateral 201 includes a plurality of pixel points 2011.
- each quadrilateral 201 is a local work group, which is a basic unit for the intelligent terminal to perform image distortion processing.
- each object displayed in the image has depth information, so the depth value of each pixel in the image is not the same.
- the depth value of a pixel refers to the vertical distance (depth) from the image collector (such as a camera, etc.) to this point in the image scene, and the value range is a floating point number of 0-1.
- Figure 4 shows an exemplary depth image (depth image).
- a depth image refers to an image that uses the vertical distance (depth) from the image collector to each point in the scene as a pixel value. Since the depth value is only a floating point number, each pixel of the depth map only needs to store the floating point value of the r (red) channel, so the depth map we see is red and black (Figure 4 is shown in grayscale).
- the depth value from 0 to 1 represents the distance from the image collector from far to near.
- FIG5 exemplarily shows a schematic diagram of the comparison between a real frame and a predicted frame.
- the edge area of the pillar in the image is an area with discontinuous depth values, and the depth values of the pixels in the pillar area are significantly greater than the depth values of the pixels in the sky area.
- the edge of the pillar in the image is straight, while in the predicted frame shown in FIG5 (2), a local stretching problem occurs at the edge of the pillar in the image, and the depth values of some pixels in the sky area are greater than the depth values of the pixels in the pillar area (i.e., the sky is closer to the image collector than the pillar, and the object depth information is abnormal). In this way, the predicted frame image is distorted and differs greatly from the real frame.
- the image area with discontinuous depth values will have local stretching problems or even abnormal object depth information problems, which is quite different from the real scene, resulting in a poor visual experience for users.
- the embodiment of the present application provides an image processing method.
- the intelligent terminal subdivides the image grid based on the depth information of the pixel points, and performs image distortion processing based on the subdivided image mesh geometry as a unit, so as to solve the problem of local stretching in image areas with discontinuous depth values in the predicted frame image, so as to better retain continuous graphic information, thereby improving the picture quality of the predicted frame image and providing the user with a better visual experience.
- the smart terminal uses the subdivided image Mesh geometry as a unit for image distortion processing, it will also perform relevant processing based on the depth information of the pixel points so that the objects in the predicted frame image can maintain the correct depth relationship and avoid the problem of abnormal object depth information.
- the image processing method provided by the embodiment of the present application is suitable for image interpolation scenarios with large differences in depth information, such as game interpolation scenarios.
- the image scenes are relatively complex, there are many static objects (such as various buildings, etc.), and the depth differences of static objects in the scenes are relatively large (that is, the depth values of different static objects are discontinuous).
- static objects such as various buildings, etc.
- depth differences of static objects in the scenes are relatively large (that is, the depth values of different static objects are discontinuous).
- user operations often cause large-angle shaking of the game scene, unlike the physical world where object movement follows physical laws. Therefore, in the case of complex game scenes, large-angle scene shaking may only cause larger movement of some objects in the image, rather than larger movement of all objects in the image.
- the distribution of MV images calculated based on continuous real frame images is uneven, especially in image areas with large differences in depth information, the difference in MV values is also relatively large.
- FIG6 (1) exemplarily shows a grayscale image of a motion vector frame calculated based on a game image.
- the grayscale image shown in FIG6 (1) the lighter the grayscale (the closer the grayscale value is to 1), the smaller the motion vector is, and the darker the grayscale (the closer the grayscale value is to 0), the larger the motion vector is.
- the motion vectors on the left and right sides of the edge area of a static object in the image frame vary greatly.
- sub-area 3011 corresponds to the column area in the image
- sub-area 3012 corresponds to the sky area in the image.
- the motion vector corresponding to the column is smaller than the motion vector corresponding to the sky.
- the motion vector values on the left and right sides of the column edge area vary greatly.
- image distortion processing of the Mesh geometry based on the motion vector will inevitably lead to severe deformation of the Mesh geometry, and even the problem of overlapping of some Mesh geometry, and the correctness of the depth information of the object in the image cannot be guaranteed.
- the motion vectors corresponding to V0 and V1 are quite different from the motion vectors corresponding to V2 and V3.
- the Mesh geometry 201 is distorted into the Mesh geometry 201', which not only severely deforms the Mesh geometry, but also may cover other Mesh geometry. This will cause distortion in some areas of the predicted frame image, especially the edge area of the static object (i.e., the pixel area with discontinuous depth value), as shown in (4) of FIG6 .
- the edge area of the static object in the game image is identified by the pixel depth value, the edge area is meshed based on the pixel depth information, and the image is distorted using the mesh geometry after the subdivision as a unit, so as to solve the problem of the edge area of the static object in the game scene prediction frame image. domain distortion problem and improve the user's gaming experience.
- the electronic device 100 may be a terminal, which may also be referred to as a terminal device, a smart terminal, etc.
- the terminal may be a device such as a cellular phone or a tablet computer (pad), which is not limited in this application.
- the electronic device 100 shown in FIG7 is only an example of an electronic device, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations.
- the various components shown in FIG6 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application-specific integrated circuits.
- the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor, a gyroscope sensor, an acceleration sensor, a temperature sensor, a motion sensor, an air pressure sensor, a magnetic sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
- the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc.
- AP application processor
- GPU graphics processor
- ISP image signal processor
- controller a memory
- video codec a digital signal processor
- DSP digital signal processor
- NPU neural-network processing unit
- Different processing units may be independent devices or integrated in one or more processors.
- the controller may be the nerve center and command center of the electronic device 100.
- the controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
- a memory may also be provided in the processor 110 for storing instructions and data.
- the memory in the processor 110 is a cache memory.
- the USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
- the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones.
- the interface can also be used to connect other electronic devices, such as AR devices, etc.
- the charging management module 140 is used to receive charging input from a charger.
- the charger may be a wireless charger or a wired charger.
- the charging management module 140 may receive charging input from a wired charger through the USB interface 130.
- the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
- the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
- the power management module 141 receives input from the battery 142 and/or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
- the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
- Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
- Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas.
- antenna 1 can be reused as a diversity antenna for a wireless local area network.
- the antenna can be used in combination with a tuning switch.
- the mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100.
- the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
- LNA low noise amplifier
- the wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
- WLAN wireless local area networks
- Wi-Fi wireless fidelity
- BT Bluetooth
- GNSS global navigation satellite system
- FM frequency modulation
- NFC near field communication technology
- IR infrared technology
- antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.
- the electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor.
- the GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor.
- the GPU is used to perform mathematical and geometric calculations for graphics rendering.
- the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
- the GPU when generating a predicted frame image, can subdivide the image grid based on the image processing method provided in the embodiment of the present application, and perform image distortion processing based on the subdivided image grid to generate a predicted frame image.
- the GPU can also perform image completion processing on the predicted frame to achieve the effect of quickly completing the predicted frame image.
- the display screen 194 is used to display images, videos, etc.
- the display screen 194 includes a display panel.
- the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
- the electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
- the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
- the ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
- the camera 193 is used to capture still images or videos.
- the object generates an optical image through the lens and projects it onto the photosensitive element.
- the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
- CMOS complementary metal-oxide-semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal.
- the ISP outputs the digital image signal to the DSP for processing.
- the DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
- the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
- the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.
- the internal memory 121 can be used to store computer executable program codes, which include instructions.
- the processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121, for example, enabling the electronic device 100 to implement the image processing method in the embodiment of the present application.
- the internal memory 121 may include a program storage area and a data storage area.
- the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.
- the data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.
- the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
- UFS universal flash storage
- the electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
- the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
- the audio module 170 can also be used to encode and decode audio signals.
- the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
- the speaker 170A also called a "speaker" is used to convert an audio electrical signal into a sound signal.
- the electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
- the electronic device 100 can be provided with a plurality of speakers 170A.
- the receiver 170B also called a "earpiece" is used to convert audio electrical signals into sound signals.
- the voice can be received by placing the receiver 170B close to the human ear.
- Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C.
- the electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
- the earphone interface 170D is used to connect a wired earphone.
- the earphone interface 170D may be the USB interface 130, or may be a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
- OMTP open mobile terminal platform
- CTIA cellular telecommunications industry association of the USA
- the pressure sensor is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
- the pressure sensor can be disposed on the display screen 194.
- the electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor.
- the gyro sensor may be used to determine the motion posture of the electronic device 100.
- the angular velocity of the electronic device 100 around three axes ie, x, y, and z axes
- the gyro sensor may be used to determine the motion posture of the electronic device 100.
- the acceleration sensor can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the acceleration sensor can detect the magnitude and direction of gravity. The acceleration sensor can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching, pedometers, etc.
- the touch sensor is also called a "touch panel”.
- the touch sensor can be set on the display screen 194.
- the touch sensor and the display screen 194 form a touch screen, also called a "touch screen”.
- the touch sensor is used to detect a touch operation on or near it.
- the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
- the key 190 includes a power key (or power key), a volume key, etc.
- the key 190 may be a mechanical key or a touch key.
- the electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
- Motor 191 can generate vibration prompts.
- Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
- touch operations acting on different applications can correspond to different vibration feedback effects.
- the indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
- the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture.
- the embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
- FIG. 8 is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
- the layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and division of labor.
- the layers communicate with each other through software interfaces.
- the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android Runtime and the system library, and the kernel layer.
- the application layer can include a series of application packages.
- the application package may include applications such as games, videos, cameras, galleries, WLAN, Bluetooth, calls, calendars, maps, and navigation.
- the application framework layer provides application programming interface (API) and programming framework for the applications in the application layer.
- API application programming interface
- the application framework layer includes some predefined functions.
- the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
- the window manager is used to manage window programs.
- the window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
- Content providers are used to store and retrieve data and make it accessible to applications.
- the data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
- the phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
- the resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
- the notification manager allows applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, notification information is used to inform the completion of downloads, message reminders, etc.
- Notification information can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window.
- Notification information can also be a text message prompted in the status bar, a prompt sound, vibration, or flashing indicator light emitted by an electronic device, etc.
- the view system includes visual controls, such as controls for displaying text, controls for displaying images, etc.
- the view system can be used to build applications.
- a display interface can be composed of one or more views.
- a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
- Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.
- the core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
- the application layer and the application framework layer run in a virtual machine.
- the virtual machine executes the Java files of the application layer and the application framework layer as binary files.
- the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
- the system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), image extraction module, image synthesis module, prediction frame generation module, prediction frame completion module, etc.
- 3D graphics processing library such as OpenGL ES
- 2D graphics engine such as SGL
- image extraction module image synthesis module
- prediction frame generation module prediction frame completion module, etc.
- the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
- the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
- the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
- the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
- a 2D graphics engine is a drawing engine for 2D drawings.
- the prediction frame generation module can be used to generate a prediction frame image based on two adjacent frames of image information.
- the prediction frame generation module can include an MV calculation submodule and an image distortion submodule.
- the MV calculation submodule may be used to calculate the MV based on two consecutive image frames.
- the image distortion submodule can be used to perform image distortion processing on the image according to the MV.
- the image distortion submodule can perform image distortion processing on static objects and dynamic objects in the image respectively.
- the image distortion submodule can subdivide the image Mesh based on the depth information of the pixels, and perform image distortion processing on the subdivided image Mesh geometry as a unit.
- the image distortion submodule when the image distortion submodule performs image distortion processing on the subdivided image Mesh geometry as a unit, it will also perform relevant processing in combination with the depth information of the pixels, and overlay the image Mesh geometry with high pixel depth values on the image Mesh geometry with low pixel depth values, so that each object in the predicted frame image can maintain the correct depth relationship.
- the prediction frame completion module can be used to complete the blank area in the prediction frame image generated by the prediction frame generation module, such as fuzzy completion processing, to obtain the prediction frame image after image completion processing.
- the image extraction module can be used to separate image information and UI information in a resource image frame to obtain an image frame, which is used for intermediate frame prediction.
- the image extraction module may also be integrated into a three-dimensional graphics processing library, which is not limited in this embodiment.
- the image synthesis module can be used to fuse the predicted frame image after image completion processing and UI information to obtain the predicted frame to be displayed.
- the kernel layer is the layer between hardware and software.
- the kernel layer includes at least display driver, audio driver, Wi-Fi driver, sensor driver, etc.
- the hardware includes at least processor, display, Wi-Fi module, sensor, etc.
- the layers in the software structure shown in FIG8 and the components included in each layer do not constitute a specific limitation on the electronic device 100.
- the electronic device 100 may include more or fewer layers than shown in the figure, and each layer may include more or fewer components, which is not limited in the present application.
- the electronic device includes hardware and/or software modules corresponding to the execution of each function.
- the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
- FIG9 is a schematic diagram of the interaction of each module.
- the process of the image processing method provided by the embodiment of the present application specifically includes:
- the game APP sends a resource image to a 3D graphics processing library.
- Resource images refer to image data in a game app, which are images displayed in the game app interface. Resource images include image information and UI information.
- UI information refers to the overall design information of the software's human-computer interaction, operating logic, and interface aesthetics.
- the image information includes but is not limited to the GRB (Green, Red, Blue) value and depth value of each pixel.
- GRB Green, Red, Blue
- the three-dimensional image processing library renders the resource images of the game APP.
- the process of rendering the resource image by the three-dimensional image processing library can refer to the existing technology and will not be described in detail here.
- the image extraction module intercepts the rendered resource image, extracts the real frame image and UI information from the resource image, and stores the real frame image and UI information in correspondence.
- the UI information will not change, and the display position in each frame is also fixed and will not change.
- the UI information may include user operation controls and the like.
- the image information and UI information can be first separated through an image extraction module, and the intermediate frame prediction can be performed only based on the image information, thereby reducing the amount of image data processing and improving the accuracy of intermediate frame image prediction.
- the UI information may change.
- the electronic device may also separate the image information and the UI information through the image extraction module, and perform intermediate frame prediction based on the image information. After obtaining the intermediate frame image, it can be merged with the UI information of the current real frame image. This embodiment does not limit this.
- the image extraction module identifies the real frame image (ie, the game scene image) and UI information in the rendered resource image through features, and draws the real frame image into a private image frame cache.
- the image extraction module also stores the matched UI information accordingly.
- the UI information may include but is not limited to UI image content and display position information of the UI image.
- the MV calculation submodule calculates a motion vector according to two adjacent real frame images.
- the two adjacent real frame images may be a current real frame image and a real frame image preceding the current real frame image, such as the real frame image 103 and the real frame image 101 shown in FIG. 2 .
- the MV calculation submodule reads two adjacent real frame images in the image frame buffer and calculates motion vectors corresponding to the two real frame images.
- the MV calculation submodule can select a matching calculation method to calculate the motion vector corresponding to each image area according to the object attributes (such as static objects, dynamic objects) pre-annotated in each image area in the real frame image, so as to obtain the motion vector corresponding to the current frame image, such as the motion vector frame 105 shown in Figure 2.
- object attributes such as static objects, dynamic objects
- some objects in the image are pre-labeled with dynamic object (i.e., objects in motion) attributes, and other unlabeled objects in the image (such as the sky, pillars, etc.) are static objects.
- the MV calculation submodule may use a reprojection method to calculate corresponding motion vectors; for image regions corresponding to dynamic objects, the MV calculation submodule may use an optical flow method to calculate corresponding motion vectors.
- the steps for calculating motion vectors using the reprojection method and the optical flow method may refer to existing technologies and will not be described in detail herein.
- the image distortion submodule performs image distortion on the current frame image based on the motion vector to obtain a first predicted frame image, and sends the first predicted frame image to the predicted frame completion module.
- the image distortion submodule After the MV calculation submodule calculates the motion vector corresponding to the current frame image based on the current frame image and the frame image before the current frame image, the image distortion submodule performs image distortion on the current frame image based on the motion vector to obtain a first predicted frame image.
- the predicted frame image calculated by the image distortion submodule based on the motion vector may have image information overlap or image information missing. That is, the first predicted frame image is the predicted frame image to be completed, such as the predicted frame image 106 shown in FIG. 2 .
- the image distortion submodule when the image distortion submodule performs image distortion on the current frame image based on the motion vector, it first performs image distortion processing on the image area corresponding to the static object in the current frame image based on the motion vector, and then performs image distortion processing on the image area corresponding to the dynamic object in the current frame image based on the motion vector, so as to obtain the first predicted frame image.
- S405 may specifically include:
- the image distortion submodule creates and subdivides the mesh of the current frame image, and performs image distortion processing on the static objects in the current frame image based on the motion vector and the subdivided mesh geometry as the processing unit.
- the image distortion submodule performs image distortion processing on the dynamic object in the current frame image based on the motion vector using the created and standardized Mesh geometry as a processing unit.
- the image distortion submodule After the image distortion submodule creates the mesh of the current frame image, the mesh can be standardized for geometric processing. Therefore, the image distortion submodule performs image distortion processing on the dynamic objects in the current frame image based on the motion vector and the standardized mesh geometry as the processing unit.
- the creation and standardization of the image mesh can be referred to below and will not be repeated here.
- the module performs image distortion processing on the Mesh geometry corresponding to the static object in the current frame image based on the motion vector
- the Mesh geometry is first subdivided based on the depth information of the pixels, so that the pixel depth values corresponding to the subdivided Mesh geometry are continuous. That is, in each subdivided Mesh geometry, the depth values of the pixels are continuous, or the depth value differences of the pixels are relatively small.
- the continuous graphic information of the static object can be better preserved to avoid the problem of distortion in the edge area of the static object.
- the image distortion processing of Mesh geometry based on motion vector refers to moving the position of each Mesh geometry vertex according to the motion vector corresponding to each Mesh geometry vertex. Whether the refined Mesh geometry is used as the processing unit to move the static object or the unrefined Mesh geometry is used as the processing unit to move the dynamic object, the processing method is the same, the only difference is the degree of refinement of the Mesh geometry.
- S4051 can be embodied as S501 to S509.
- the image distortion submodule performs image distortion processing on the static object in the current frame image, specifically including:
- the image distortion submodule creates a grid of the current image frame.
- the image warping submodule creates a mesh of the current image frame, which can also be called meshing the current image frame, in order to divide the current frame image into geometric shapes that are easier to process, such as polygons, triangles or quadrilaterals.
- the image distortion submodule creates a Mesh of the current image frame with the same size as the current image frame, so that each graphic filled in the Mesh can cover a pixel area of the current image frame.
- the image distortion submodule may create a quadrilateral grid of the current image frame, that is, grid the current image frame according to the size of the quadrilateral, wherein the quadrilateral may be a square.
- the image distortion submodule performs standardization processing on the grid.
- the image distortion submodule can standardize the non-triangular mesh so that each non-triangle in the mesh is divided into multiple triangles to facilitate graphics calculation.
- the image warping submodule creates a quadrilateral mesh of the current image frame, and the image warping submodule may divide each quadrilateral in the quadrilateral mesh into two triangles again to achieve mesh standardization.
- Each quadrilateral or triangle in the quadrilateral mesh may be indexed by a vertex.
- the vertex order of each quadrilateral or triangle may be in a clockwise direction to normalize the vertex index of the image mesh.
- each quadrilateral 201 in the current image frame grid can be divided into triangle 201_1 and triangle 201_2.
- the quadrilateral can be divided into triangle Tringle1 (V0-V1-V2) and triangle Tringle2 (V2-V3-V0).
- V0 is the starting vertex and V2 is the ending vertex; in triangle Tringle2, V2 is the starting vertex and V0 is the ending vertex.
- the starting vertex V0 of the first triangle i.e., Tringle1 (V0-V1-V2)
- the starting vertex V0 of the quadrilateral Square V0-V1-V2-V3
- the starting side V0-V1 of the first triangle is the starting side V0-V1 of the quadrilateral.
- the ending vertex V2 of the first triangle is the starting vertex V2 of the second triangle (i.e., Tringle2 (V2-V3-V0)
- the ending side V0-V1 of the second triangle is the starting vertex V2 of the second triangle.
- Vertex V0 is the starting vertex V0 of the first triangle.
- the image distortion submodule sequentially uses each geometric figure before the Mesh normalization process as a current processing figure (or a currently processed Mesh geometric figure).
- the image distortion submodule uses each geometric figure created before the standardization process as a processing unit to determine whether mesh subdivision is required and how to perform mesh subdivision and image distortion. That is, the image distortion submodule determines in turn whether mesh subdivision is required for each quadrilateral before the standardization process and how to perform mesh subdivision and image distortion. In the mesh division example shown in (1) of FIG. 11 , the image distortion submodule determines in turn whether mesh subdivision is required for each quadrilateral and how to perform mesh subdivision and image distortion.
- the image distortion submodule can also concurrently determine whether each geometric figure before the normalization process needs to be meshed and how to perform meshing and image distortion. For each geometric figure, the judgment and processing flow of the image distortion submodule can refer to S504 to S508.
- the image distortion submodule determines whether the current processing graphic corresponds to a static object in the current image frame, if so, execute S505, if not, execute S509.
- this embodiment only needs to mesh the geometric figures corresponding to the static objects so that the pixel depth values in each geometric figure corresponding to the static object are continuous. Therefore, the image distortion submodule needs to determine whether the currently processed figure corresponds to a static object.
- the image distortion submodule can determine whether the currently processed graphic corresponds to a static object based on the image pre-annotation information. If not, it will continue to judge the next geometric figure in the Mesh in order until all geometric figures in the current image frame Mesh are processed. If so, the image distortion submodule will continue to determine whether the currently processed graphic meets the mesh subdivision conditions.
- the image distortion submodule determines the subdivision intersection of the currently processed graphic.
- the image distortion submodule determines whether there is a subdivision intersection corresponding to the current processing graph, and further determines whether the current processing graph meets the grid subdivision condition according to the number of subdivision intersections.
- the subdivision intersection is a pixel point used to subdivide the geometric figure in the Mesh, and the pixel point is located on the edge of the geometric figure. Taking the quadrilateral in the quadrilateral Mesh as an example, the subdivision intersection needs to be located on any edge of the quadrilateral.
- FIG12 exemplarily shows the process of determining the subdivision intersection.
- the specific process of the image distortion submodule determining the subdivision intersection of the current processing graphic includes:
- the image distortion submodule sequentially uses each pixel point in the current processing graph as the current processing pixel point.
- the image distortion submodule determines whether each pixel point in the current processing graph is a subdivision intersection point of the current processing graph.
- the image distortion submodule can also determine in parallel whether each pixel point in the current processing graph is a subdivision intersection point of the current processing graph. For each pixel point in each current processing graph, the judgment process of the image distortion submodule can refer to S5052 to S5056.
- the image distortion submodule determines whether the depth value of the currently processed pixel is within a preset depth range, if so, execute S5053, if not, execute S5055.
- the preset depth range can be understood as the depth range of interest, within which the edge of static objects can be Prone to distortion when the image is distorted.
- the image distortion submodule determines whether the depth value difference between the currently processed pixel and the surrounding pixels exceeds a preset threshold, if so, execute S5054, if not, execute S5055.
- the depth value difference between the currently processed pixel and the surrounding pixels exceeds a preset threshold, it indicates that the depth value of the currently processed pixel is significantly different from the surrounding pixels, and the currently processed pixel may be located on the edge of a static object.
- the image distortion submodule marks the currently processed pixel point as an edge point corresponding to the currently processed graphic.
- edge points also called static object edge points
- static object edge points are pixel points on the edge of a static object.
- the image distortion submodule determines whether all pixels in the currently processed image have been processed.
- the image distortion submodule first identifies each edge point among all the pixel points of the currently processed graphic, and then determines whether there is a subdivision intersection of the currently processed graphic among each edge point.
- the image distortion submodule determines that the pixel is a static object edge point.
- the image distortion submodule determines, from the edge points of the static objects corresponding to the current processing graphic, pixel points located on the edge of the current processing graphic as subdivision intersection points of the current processing graphic.
- the image distortion submodule identifies each static object edge point, it determines whether each static object edge point is located on the edge of the current processing graph. If so, the static object edge point is used as a subdivision intersection point of the current processing graph.
- the image distortion submodule can determine whether each static object edge point is located on the edge of the current processing graphic based on the compute shader calculation.
- the detailed explanation of the compute shader can refer to the existing technology and will not be repeated here.
- the image distortion submodule may also determine the subdivision intersection points corresponding to each geometric figure after determining the edge points of each static object corresponding to each geometric figure.
- the image distortion submodule can generate a mask image of the static object edge points after determining the edge points of each static object corresponding to each geometric figure.
- the grayscale value of the static object edge points is 1, and the grayscale values of the remaining pixels are 0.
- the image distortion submodule can also determine the mask image of the geometric figure edge in the Mesh. In the mask image of the geometric figure edge, the grayscale value of the pixel points on the geometric figure edge is 1, and the grayscale value of the remaining pixels is 0.
- the image distortion submodule can calculate the static object edge points located on the edge of the geometric figure, that is, the subdivision focus, based on the mask image of the geometric figure and the mask image of the calculated static object edge points.
- the image distortion submodule performs an "AND" operation on the mask image of the static object edge points and the mask image of the geometric figure edge to obtain the mask image of the subdivision intersection.
- the grayscale value of the subdivision intersection is 1, and the grayscale values of the remaining pixels are 0.
- the image distortion submodule can record the coordinates of the subdivision intersection corresponding to each geometric figure in the Mesh.
- the number of subdivision intersections of different geometric figures in the Mesh may not be the same.
- the number of subdivision intersections can be any value of 1, 2, 3, or 4.
- Figure 13a (1), (2), and (3) in Figure 13a respectively illustrate the subdivision intersections of the quadrilateral in the Mesh.
- FIG13a exemplarily shows the case where the number of subdivision intersection points of the quadrilateral in the Mesh is 1
- (5) in FIG13a exemplarily shows the case where the number of subdivision intersection points of the quadrilateral in the Mesh is 4
- (6) in FIG13a exemplarily shows the case where the number of subdivision intersection points of the quadrilateral in the Mesh is 4.
- the number of subdivision intersection points of the geometric figures in the Mesh can also be other values, and the number of subdivision intersection points on each edge is not necessarily only one.
- the image distortion submodule determines whether the current processed graphic meets the grid subdivision condition according to the number of subdivision intersections, if so, execute S507, if not, execute S508.
- the mesh subdivision condition may be that the number of subdivision intersections of the geometric figure in the Mesh is 2, and the two subdivision intersections are located on different sides of the geometric figure. That is, the mesh subdivision condition may be that there are and only are two subdivision intersections of the geometric figure, and there is at most one subdivision intersection on each side of the geometric figure.
- the image distortion submodule subdivides the current processing graph according to the subdivided intersection points, and performs image distortion processing on the subdivided current processing graph according to the motion vector.
- the current processing graphic meets the grid subdivision conditions, and the image distortion submodule subdivides the current processing graphic according to the two subdivision intersections, and performs image distortion processing on the standardized and subdivided current processing graphic.
- the image distortion submodule When the image distortion submodule subdivides the current processing graph according to the two subdivision intersection points, it can select a matching subdivision strategy to subdivide the corresponding triangle according to the coordinate relationship between the two subdivision foci and each triangle vertex after normalization of the current processing graph.
- the quadrilateral Square (V0-V1-V2-V3) is divided into the first triangle (i.e., triangle Tringle1 (V0-V1-V2)) and the second triangle (i.e., triangle Tringle2 (V2-V3-V0)).
- the horizontal coordinate of the first subdivision intersection is equal to the horizontal coordinates of the first vertex (or starting vertex) and the second vertex (or intermediate vertex) of the first triangle
- the vertical coordinate of the second subdivision intersection is equal to the vertical coordinates of the second vertex and the third vertex (or ending vertex) of the first triangle.
- the image warping submodule may connect the first subdivision intersection point and the second subdivision intersection point, and connect the first subdivision intersection point and the third vertex of the first triangle, so as to perform mesh subdivision on the first triangle and obtain a plurality of subdivided triangles.
- the horizontal coordinate of the first subdivision intersection Point2 is equal to the horizontal coordinate of the first vertex V0 and the second vertex V1 of the first triangle
- the vertical coordinate of the second subdivision intersection Point1 is equal to the vertical coordinate of the second vertex V1 and the third vertex V2 of the first triangle.
- the image distortion submodule connects the first subdivision intersection Point2 to the second subdivision intersection Point1, and connects the first subdivision intersection Point2 to the third vertex V2 of the first triangle, so as to subdivide the first triangle Tringle1 (V0-V1-V2) into: the first subdivision triangle S-Tringle1 (V0-Point2-V2), the second subdivision triangle S-Tringle1 (V0-Point2-V2), and the third subdivision triangle S-Tringle1 (V0-Point2-V2).
- the second subdivided triangle S-Tringle2 Point2-Point1-V2
- the third subdivided triangle S-Tringle3 Point2-V1-Point1).
- the image warping submodule may also connect the first subdivision intersection point with the second subdivision intersection point, and connect the second subdivision intersection point with the first vertex of the first triangle, so as to perform mesh subdivision on the first triangle to obtain a plurality of subdivided triangles.
- the image distortion submodule connects the first subdivision intersection Point2 and the second subdivision intersection Point1, and connects the second subdivision intersection Point1 and the first vertex V0 of the first triangle, so as to subdivide the first triangle Tringle1 (V0-V1-V2) into: the first subdivision triangle S-Tringle1 (V0-Point2-Point1), the second subdivision triangle S-Tringle2 (Point2-V1-Point1) and the third subdivision triangle S-Tringle3 (Point1-V2-V0).
- the vertex index of each subdivided triangle is also sorted clockwise. The following situation is also the same, which will not be described in detail below.
- the starting edge (V0-Point2) of the first subdivided triangle S-Tringle1 is located on the starting edge (V0-V1) of the first triangle, that is, on the starting edge (V0-V1) of the quadrilateral, which does not affect the geometric processing order of the first triangle and facilitates developers to perform subdivision programming.
- the first triangle and the second triangle need to be meshed together.
- the ordinate of the first subdivision intersection is equal to the ordinates of the second vertex and the third vertex of the first triangle
- the ordinate of the second subdivision intersection is equal to the ordinates of the second vertex and the third vertex of the second triangle.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection, and connect the first subdivision intersection and the first vertex of the first triangle, and connect the second subdivision intersection and the first vertex of the second triangle to mesh the first triangle and the second triangle to obtain multiple subdivided triangles.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection
- the line connecting the first subdivision intersection and the second subdivision intersection intersects with the terminal edge of the first triangle (that is, the terminal edge of the second triangle), so that the first triangle and the second triangle can be meshed at the same time.
- the ordinate of the first subdivision intersection Point1 is equal to the ordinates of the second vertex V1 and the third vertex V2 of the first triangle
- the ordinate of the second subdivision intersection Point2 is equal to the ordinates of the second vertex V3 and the third vertex V0 of the second triangle.
- the image distortion submodule needs to perform mesh subdivision on the first triangle and the second triangle based on the subdivision intersections Point1 and Point2.
- the image distortion submodule connects the first subdivision intersection Point1 to the second subdivision intersection Point2, and connects the first subdivision intersection Point1 to the first vertex V0 of the first triangle, and connects the second subdivision intersection Point2 to the first vertex V2 of the second triangle.
- the line connecting the first subdivision intersection Point1 and the second subdivision intersection Point2 intersects with the terminal edge (V2-V0) of the first triangle (that is, the terminal edge (V0-V2) of the second triangle) at the point PointInter.
- the first triangle Tringle1 (V0-V1-V2) is subdivided into: the first subdivided triangle S-Tringle1 (V0-V1-Point1), the second subdivided triangle S-Tringle2 (V0-Point1-PointInter) and the third subdivided triangle S-Tringle3 (PointInter-Point1-V2).
- the second triangle Tringle2 (V2-V3-V0) is subdivided into: the first subdivided triangle S-Tringle1 (V2-V3-Point2), the second subdivided triangle S-Tringle2 (V0-Point1-PointInter) and the third subdivided triangle S-Tringle3 (PointInter-Point1-V2).
- Sub-triangle S-Tringle2 (V2-Point2-PointInter) and the third subdivided triangle S-Tringle3 (PointInter-Point2-V0).
- the ordinate of the first subdivision intersection is equal to the ordinates of the second vertex and the third vertex of the first triangle
- the abscissa of the second subdivision intersection is equal to the abscissa of the first vertex and the second vertex of the second triangle.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection, and connect the first subdivision intersection and the first vertex of the first triangle, and connect the second subdivision intersection and the third vertex of the second triangle to mesh the first triangle and the second triangle to obtain multiple subdivided triangles.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection
- the line connecting the first subdivision intersection and the second subdivision intersection intersects with the terminal edge of the first triangle (that is, the terminal edge of the second triangle), so that the first triangle and the second triangle can be meshed at the same time.
- the ordinate of the first subdivision intersection Point1 is equal to the ordinates of the second vertex V1 and the third vertex V2 of the first triangle
- the abscissa of the second subdivision intersection Point2 is equal to the abscissa of the first vertex V2 and the second vertex V3 of the second triangle.
- the image distortion submodule needs to perform mesh subdivision on the first triangle and the second triangle based on the subdivision intersections Point1 and Point2.
- the image distortion submodule connects the first subdivision intersection Point1 to the second subdivision intersection Point2, and connects the first subdivision intersection Point1 to the first vertex V0 of the first triangle, and connects the second subdivision intersection Point2 to the third vertex V0 of the second triangle.
- the line connecting the first subdivision intersection Point1 and the second subdivision intersection Point2 intersects with the terminal edge (V2-V0) of the first triangle (that is, the terminal edge (V0-V2) of the second triangle) at the point PointInter.
- the first triangle Tringle1 (V0-V1-V2) is subdivided into: the first subdivision triangle S-Tringle1 (V0-V1-Point1), the second subdivision triangle S-Tringle2 (V0-Point1-PointInter) and the third subdivision triangle S-Tringle3 (PointInter-Point1-V2).
- the second triangle Tringle2 (V2-V3-V0) is subdivided into: a first subdivided triangle S-Tringle1 (V2-Point2-PointInter), a second subdivided triangle S-Tringle2 (Point2-V0-PointInter) and a third subdivided triangle S-Tringle3 (Point2-V3-V0).
- the horizontal coordinate of the first subdivision intersection is equal to the horizontal coordinates of the first vertex and the second vertex of the first triangle
- the horizontal coordinate of the second subdivision intersection is equal to the horizontal coordinates of the first vertex and the second vertex of the second triangle.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection, and connect the first subdivision intersection and the third vertex of the first triangle, and connect the second subdivision intersection and the third vertex of the second triangle to mesh the first triangle and the second triangle to obtain multiple subdivided triangles.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection
- the line connecting the first subdivision intersection and the second subdivision intersection intersects with the terminal edge of the first triangle (that is, the terminal edge of the second triangle), so that the first triangle and the second triangle can be meshed at the same time.
- the horizontal coordinate of the first subdivision intersection point Point1 is equal to the horizontal coordinates of the first vertex V0 and the second vertex V1 of the first triangle
- the horizontal coordinate of the second subdivision intersection point Point2 is equal to the horizontal coordinates of the first vertex V0 and the second vertex V1 of the second triangle.
- the horizontal coordinates of V2 and the second vertex V3 are equal.
- the image distortion submodule needs to perform mesh subdivision on the first triangle and the second triangle according to the subdivision intersection points Point1 and Point2.
- the image distortion submodule connects the first subdivision intersection Point1 to the second subdivision intersection Point2, and connects the first subdivision intersection Point1 to the third vertex V2 of the first triangle, and connects the second subdivision intersection Point2 to the third vertex V0 of the second triangle.
- the line connecting the first subdivision intersection Point1 and the second subdivision intersection Point2 intersects with the terminal edge (V2-V0) of the first triangle (that is, the terminal edge (V0-V2) of the second triangle) at the point PointInter.
- the first triangle Tringle1 (V0-V1-V2) is subdivided into: the first subdivision triangle S-Tringle1 (V0-Point1-PointInter), the second subdivision triangle S-Tringle2 (Point1-V2-PointInter) and the third subdivision triangle S-Tringle3 (Point1-V1-V2).
- the second triangle Tringle2 (V2-V3-V0) is subdivided into: a first subdivided triangle S-Tringle1 (V2-Point2-PointInter), a second subdivided triangle S-Tringle2 (Point2-V0-PointInter) and a third subdivided triangle S-Tringle3 (Point2-V3-V0).
- the horizontal coordinate of the first subdivision intersection is equal to the horizontal coordinates of the first vertex and the second vertex of the first triangle
- the vertical coordinate of the second subdivision intersection is equal to the vertical coordinates of the second vertex and the third vertex of the second triangle.
- the image distortion submodule can connect the first subdivision intersection with the second subdivision intersection, and connect the first subdivision intersection with the third vertex of the first triangle, and connect the second subdivision intersection with the first vertex of the second triangle to mesh the first triangle and the second triangle to obtain multiple subdivided triangles.
- the image distortion submodule can connect the first subdivision intersection and the second subdivision intersection
- the line connecting the first subdivision intersection and the second subdivision intersection intersects with the terminal edge of the first triangle (that is, the terminal edge of the second triangle), so that the first triangle and the second triangle can be meshed at the same time.
- the horizontal coordinate of the first subdivision intersection Point1 is equal to the horizontal coordinates of the first vertex V0 and the second vertex V1 of the first triangle
- the vertical coordinate of the second subdivision intersection Point2 is equal to the vertical coordinates of the second vertex V3 and the third vertex V0 of the second triangle.
- the image distortion submodule connects the first subdivision intersection Point1 to the second subdivision intersection Point2, and connects the first subdivision intersection Point1 to the third vertex V2 of the first triangle, and connects the second subdivision intersection Point2 to the first vertex V2 of the second triangle.
- the line connecting the first subdivision intersection Point1 and the second subdivision intersection Point2 intersects with the terminal edge (V2-V0) of the first triangle (that is, the terminal edge (V0-V2) of the second triangle) at the point PointInter.
- the first triangle Tringle1 (V0-V1-V2) is subdivided into: the first subdivision triangle S-Tringle1 (V0-Point1-PointInter), the second subdivision triangle S-Tringle2 (Point1-V2-PointInter) and the third subdivision triangle S-Tringle3 (Point1-V1-V2).
- the second triangle Tringle2 (V2-V3-V0) is subdivided into: a first subdivided triangle S-Tringle1 (V2-V3-Point2), a second subdivided triangle S-Tringle2 (Point2-PointInter-V2) and a third subdivided triangle S-Tringle3 (Point2-V0-PointInter).
- two subdivision intersections jointly subdivide two triangles.
- the starting edge of the first subdivided triangle obtained by dividing the first triangle is located on the starting edge (V0-V1) of the first triangle, that is, on the starting edge (V0-V1) of the quadrilateral; the starting edge of the first subdivided triangle obtained by dividing the second triangle is also located on the starting edge (V0-V1) of the second triangle.
- This mesh subdivision is not It affects the order of geometric processing of triangles before subdivision, making it easier for developers to perform subdivision programming.
- the horizontal coordinate of the first subdivision intersection is equal to the horizontal coordinate of the first vertex and the second vertex of the second triangle
- the vertical coordinate of the second subdivision intersection is equal to the vertical coordinate of the second vertex and the third vertex of the first triangle.
- the image warping submodule may connect the first subdivision intersection point with the second subdivision intersection point, and connect the first subdivision intersection point with the third vertex of the second triangle, so as to perform mesh subdivision on the second triangle and obtain a plurality of subdivided triangles.
- the horizontal coordinate of the first subdivision intersection Point1 is equal to the horizontal coordinates of the first vertex V2 and the second vertex V3 of the second triangle
- the vertical coordinate of the second subdivision intersection Point2 is equal to the vertical coordinates of the second vertex V3 and the third vertex V0 of the second triangle.
- the image distortion submodule connects the first subdivision intersection Point1 and the second subdivision intersection Point2, and connects the first subdivision intersection Point1 and the third vertex V0 of the second triangle, so as to subdivide the second triangle Tringle1 (V2-V3-V0) into: the first subdivision triangle S-Tringle1 (V2-Point1-V0), the second subdivision triangle S-Tringle2 (Point1-Point2-V0) and the third subdivision triangle S-Tringle3 (Point1-V3-Point2).
- the image warping submodule may also connect the first subdivision intersection point with the second subdivision intersection point, and connect the second subdivision intersection point with the first vertex of the second triangle, so as to perform mesh subdivision on the second triangle to obtain a plurality of subdivided triangles.
- the image distortion submodule connects the first subdivision intersection Point1 and the second subdivision intersection Point2, and connects the second subdivision intersection Point2 and the first vertex V2 of the second triangle, so as to subdivide the second triangle Tringle1 (V2-V3-V0) into: the first subdivision triangle S-Tringle1 (V2-Point1-Point2), the second subdivision triangle S-Tringle2 (Point1-V3-Point2) and the third subdivision triangle S-Tringle3 (Point2-V0-V2).
- the starting edge (V2-Point1) of the first subdivided triangle S-Tringle1 is located on the starting edge (V2-V3) of the second triangle, which will not affect the geometric processing order of the second triangle, making it easier for developers to perform subdivision programming.
- the image distortion submodule meshes the triangles according to the subdivision intersections, the geometric figures with discontinuous depth information in the Mesh are subdivided, and the depth information in the geometric figures obtained after the subdivision process will not differ too much. Furthermore, when the image distortion submodule moves these subdivided geometric figures, it can avoid the problem of serious deformation of the geometric figures due to excessive differences in mesh depth information, ensure the correctness of the image content, and then improve the picture instructions, so that the predicted frame image is closer to the real frame image.
- the image distortion processing can be performed on the standardized and subdivided current processing graph according to the motion vector.
- each vertex of the triangle is moved to a corresponding position according to a motion vector corresponding thereto, so as to obtain a triangle after image distortion.
- the image distortion submodule can also set the depth information of the triangle according to the depth values of the triangle vertices.
- the image distortion submodule performs interpolation processing according to the depth values of each vertex of the triangle to obtain the depth value of each pixel point in the triangle as the depth information of the triangle.
- the image warping submodule moves a triangle based on the motion vector, it can determine the covering relationship between the triangle and other triangles according to the depth information of the triangle. For example, when the depth information of triangle 1 is greater than the depth information of triangle 2, triangle 1 covers triangle 2.
- triangle 2 is the triangle at the target position when triangle 1 is moved according to the corresponding motion vector.
- the image warping submodule refers to the pixel depth information when moving geometric figures in the Mesh, which can ensure the correct depth order relationship between different objects.
- Fig. 14 exemplarily shows an example of a scene diagram for image distortion based on subdivided geometric figures.
- the first triangle Tringle1 (V0-V1-V2) is subdivided into: subdivided triangle S-Tringle1 (V0-V1-Point1), subdivided triangle S-Tringle2 (V0-Point1-PointInter) and subdivided triangle S-Tringle3 (PointInter-Point1-V2).
- the second triangle Tringle2 (V2-V3-V0) is subdivided into: subdivided triangle S-Tringle1' (V2-V3-Point2), subdivided triangle S-Tringle2' (V2-Point2-PointInter) and subdivided triangle S-Tringle3' (PointInter-Point2-V0).
- the depth information of S-Tringle1 (V0-V1-Point1), S-Tringle2 (V0-Point1-PointInter) and S-Tringle3’ (PointInter-Point2-V0) is relatively consistent
- the depth information of S-Tringle3 (PointInter-Point1-V2), S-Tringle1’ (V2-V3-Point2), and S-Tringle2’ (V2-Point2-PointInter) is relatively consistent.
- the subdivided triangles S-Tringle1, S-Tringle2, S-Tringle3, S-Tringle1’, S-Tringle2’, and S-Tringle3’ are moved according to the motion vectors corresponding to their respective vertices. For example, S-Tringle1(V0-V1-Point1) moves to S-Tringle1(V0’-V1’-Point1’), S-Tringle2(V0-Point1-PointInter) moves to S-Tringle2(V0’-Point1’-PointInter’), and S-Tringle3(PointInter-Point1-V2) moves to S-Tringle3(PointInter”-Point1”-V2”).
- S-Tringle1’ (V2-V3-Point2) moves to S-Tringle1’(V2”-V3”-Point2”)
- S-Tringle2 (V2-Point2-PointInter) moves to S-Tringle2’(V2”-Point2”-PointInter”)
- S-Tringle3 (PointInter-Point2-V0) moves to S-Tringle3’(PointInter’-Point2’-V0’).
- Figure 14 (1) to (3) exemplarily shows different image distortion scenarios.
- the movement directions of triangles with consistent depth information are also relatively consistent, which can avoid the problem of serious deformation of triangles due to excessive differences in depth information within the triangles.
- the image distortion submodule performs image distortion processing on the current processing image according to the motion vector.
- the current processing graph does not meet the mesh subdivision condition, and the image distortion submodule directly performs image distortion processing on the standardized current processing graph.
- the image distortion submodule performs image distortion processing on each triangle obtained by standardization.
- each vertex of the triangle is moved to a corresponding position according to the motion vector corresponding to it, so as to obtain a triangle after image distortion.
- the image warping submodule can also set the depth information of the triangle according to the depth value of the vertex.
- the image warping submodule performs interpolation processing according to the depth value of each vertex of the triangle to obtain the depth value of each pixel in the triangle as the depth information of the triangle.
- the image warping submodule moves a triangle based on the motion vector, it can determine the covering relationship between the triangle and other triangles according to the depth information of the triangle, so as to ensure the correct depth order relationship between different objects.
- the image distortion submodule completes the image distortion operation for the geometric figures corresponding to the static objects in the current image frame Mesh.
- the image warping submodule continues to perform image warping operations on triangles corresponding to dynamic objects in the current image frame Mesh. At this time, in the created and standardized current image frame Mesh, the image warping submodule searches for each triangle corresponding to the dynamic object and performs image warping processing on each triangle corresponding to the dynamic object.
- each vertex of the triangle is moved to a corresponding position according to the corresponding motion vector, so as to obtain a distorted triangle of the image.
- the image distortion submodule can also set the depth information of the triangle according to the depth value of the vertex.
- the image distortion submodule performs interpolation processing according to the depth value of each vertex of the triangle to obtain the depth value of each pixel point in the triangle as the depth information of the triangle.
- the image warping submodule moves a triangle based on the motion vector, it can determine the covering relationship between the triangle and other triangles according to the depth information of the triangle, so as to ensure the correct depth order relationship between different objects.
- the image distortion submodule completes the image distortion operation for the Mesh geometry corresponding to the dynamic object in the current image frame. That is, the image distortion submodule completes the image distortion operation for the current frame image.
- the prediction frame generation image module continues to complete the related operations of the rasterization phase and the pixel processing phase to generate the first prediction frame image. Among them, the details of the prediction frame image generation process that are not fully explained in this embodiment can be referred to the existing technology, and will not be repeated here.
- the image distortion submodule may also create a triangle Mesh for the current frame image. At this time, the image distortion submodule may determine whether each triangle in the triangle Mesh needs to be meshed. Subdivision, and how to perform mesh subdivision and image distortion. The judgment and processing flow for each triangle can also refer to the above, and will not be repeated here. It should be pointed out that if the number of subdivision intersections of a triangle is 2, the triangle meets the mesh subdivision conditions, and the triangle can be meshed by referring to the subdivision method of case 1 or case 3.
- the image distortion submodule can also create a polygonal mesh and perform standardization processing. At this time, the image distortion submodule can determine whether each triangle in the polygonal mesh needs to be meshed, and how to perform mesh subdivision and image distortion. Among them, the judgment and processing flow for each triangle can also refer to the above, and will not be repeated here. It should be pointed out that if the number of subdivision intersections of a polygon in the polygonal mesh is 2, the polygon meets the mesh subdivision conditions, and the polygon can be meshed with reference to the subdivision methods of situations one to three above.
- FIG15a exemplarily shows an example of a predicted frame image.
- region 601 adopts the existing technical solution for image distortion processing
- region 602 adopts the solution provided in this embodiment for image distortion processing.
- region 601 and region 602 are only regions where the depth information of static objects is discontinuous.
- FIG15b exemplarily shows a comparison diagram of a predicted frame image.
- the predicted frame image shown in (1) of FIG15b is generated by performing image distortion processing using the solution provided in this embodiment
- the predicted frame image shown in (2) of FIG15b is generated by performing image distortion processing using the existing technical solution.
- Area 603 of FIG15b (1) and area 604 of FIG15b (2) are the same image areas, both of which are areas where the depth information of static objects is discontinuous.
- the prediction frame completion module completes the first prediction frame image to obtain a second prediction frame image, and sends the second prediction frame image to the image synthesis module.
- the first predicted frame image calculated by the electronic device based on the motion vector may have image information overlap or image information missing. That is, the first predicted frame image is a predicted frame image to be completed.
- the prediction frame completion module needs to complete the first prediction frame image to obtain the second prediction frame image, wherein the second prediction frame image is the prediction frame image obtained after completing the image completion process on the first prediction frame image.
- the image synthesis module synthesizes the second predicted frame image with the UI information to obtain a target predicted frame image, and sends the target predicted frame image for display.
- the image synthesis module synthesizes the second predicted frame image and the UI information corresponding to the current real frame image to obtain a target predicted frame image.
- the prediction frame image is completed, it is synthesized with the UI information to obtain the target prediction frame image, and then the target prediction frame image can be output to the electronic device display screen for display.
- Games with high refresh rates on mobile platforms are often prone to heating or lag due to power consumption or CPU and GPU capability limitations, thus affecting the user experience.
- game developers often lower the original refresh rate and then generate predicted frames in the image space to halve the rendering operations at the same frame rate, thereby significantly reducing the power consumption of smart terminals and reducing the heating of smart terminals.
- the image processing method provided by the embodiment of the present application can be used to solve the problem well, thereby improving the image quality of the predicted frame image.
- the smoothness of the game can be ensured to remain unchanged when the number of rendering frames is halved, the power consumption of the smart terminal is reduced, and the heat generation of the smart terminal is reduced, thereby improving the user experience.
- the image processing method provided in the embodiment of the present application can also be used to perform image distortion processing to improve the image quality of the predicted frame image, which will not be elaborated here.
- This embodiment further provides a computer storage medium, in which computer instructions are stored.
- the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image processing method in the above-mentioned embodiment.
- This embodiment further provides a computer program product.
- the computer program product When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the image processing method in the above-mentioned embodiment.
- an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the image processing method in the above-mentioned method embodiments.
- the electronic device such as a mobile phone, etc.
- computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
- the disclosed devices and methods can be implemented in other ways.
- the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
- Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
本申请实施例提供了一种图像处理方法及电子设备。该方法中,在基于第一真实帧和第二真实帧计算预测帧时,首先计算与第一真实帧和第二真实帧对应的运动矢量,并创建与第二真实帧对应的初始网格Mesh,然后基于像素深度值识别出细分交点,并基于细分交点对初始Mesh进行细分得到目标Mesh,再根据目标Mesh和运动矢量,对第二真实帧进行图像扭曲处理,生成预测帧图像。这样能够避免预测帧中深度值不连续的图像区域出现局部拉伸的问题,以较好地保留连续的图形信息,提升预测帧图像的画面质量,使得用户的视觉体验较佳。
Description
本申请要求于2022年11月18日提交中国国家知识产权局、申请号为202211444045.9、申请名称为“图像处理方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及智能终端技术领域,尤其涉及一种图像处理方法及电子设备。
视频插帧技术旨在提高视频的帧率和流畅度,让视频看起来更加“丝滑”。只要在相邻的真实帧(或称原始帧)之间插入一个预测帧(或称中间帧、过渡帧等),视频的帧率就可以提高一倍,而预测帧的画质直接关系着视频的流畅程度。其中,通过相邻两帧图像信息计算出图像中各对象的移动方向和速度,并将图像中各对象进行相应的移动即可得到预测帧。
在当前的预测帧生成技术中,图像扭曲是能够较好地保证图像连续性的方式。然而,在一些图像区域中,图像扭曲操作可能会导致局部图像失真的问题,使得预测帧图像与真实帧图像之间的差异比较明显,极大地降低了用户视觉体验。
发明内容
为了解决上述技术问题,本申请实施例提供一种图像处理方法及电子设备。该方法中,在电子设备基于第一真实帧和第二真实帧计算预测帧时,首先计算与第一真实帧和第二真实帧对应的运动矢量,并创建与第二真实帧对应的初始网格Mesh,然后基于像素深度值识别出细分交点,并基于细分交点对初始Mesh进行细分得到目标Mesh,再根据目标Mesh和运动矢量,对第二真实帧进行图像扭曲处理,生成预测帧图像。这样能够避免预测帧中深度值不连续的图像区域出现局部拉伸的问题,以较好地保留连续的图形信息,提升预测帧图像的画面质量,使得用户的视觉体验较佳。
第一方面,本申请实施例提供一种图像处理方法。该方法包括:电子设备获取第一图像和第二图像,并根据第一图像和第二图像计算运动矢量;其中,第一图像和第二图像为真实帧图像;电子设备创建第二图像的初始网格Mesh,并在初始Mesh中确定与静态对象对应的待细分的初始几何图形;其中,初始几何图形的细分交点有且只有两个,位于初始几何图形的边上,且每个初始几何图形的每个边上至多存在一个细分交点;细分交点是根据初始几何图形中像素点的深度值确定的,为静态对象的边缘像素点;电子设备根据每个初始几何图形的两个细分交点,分别对相应的初始几何图形进行网格细分,得到第二图像的目标Mesh;在目标Mesh中,每个初始几何图形的两个细分交点的连线为目标三角形的边,或者连线上的部分线段为目标三角形的边;其中,目标三角形为在
目标Mesh中划分的几何图形;电子设备根据目标Mesh和运动矢量,对第二图像进行图像扭曲处理,生成与第一图像和第二图像对应的预测帧图像。
其中,第一图像和第二图像可以为视频源中相邻的两帧真实帧图像。
示例性的,第一图像和第二图像中可以仅包括图像信息,也可以既包括图像信息又包括用户界面信息。
其中,细分交点,用于将初始Mesh中与静态对象对应的待细分的初始几何图形进行细分,以使细分后的每个几何图形的像素深度信息是连续的。
示例性的,初始几何图形可以为三角形,也可以为四边形、多边形等。
这样,能够避免预测帧图像中深度值不连续的图像区域出现局部拉伸的问题,以较好地保留连续的图形信息,提升预测帧图像的画面质量,使得用户的视觉体验较佳。
根据第一方面,初始Mesh为四边形Mesh,初始几何图形为四边形;在电子设备创建第二图像的初始Mesh之后,该方法还包括:电子设备将四边形Mesh进行标准化,以将每个四边形划分为两个三角形。
这样,在创建Mesh时划分的初始几何图形为非三角形时,对Mesh进行标准化处理,将每个初始几何图形划分为三角形,更有利于进行图形计算处理。
根据第一方面,或者以上第一方面的任意一种实现方式,待细分的四边形的细分交点为第一细分交点和第二细分交点,待细分的四边形划分为第一三角形和第二三角形;
其中,在目标Mesh中:
第一三角形细分为第一子三角形、第二子三角形和第三子三角形;其中,第一子三角形和第二子三角形的共用边为第一细分交点和第二细分交点的连线,第二子三角形和第三子三角形的共用边为第一细分交点或第二细分交点与第一三角形顶点的连线(此时可以参照图13b中(1)、(2)所示的情形);或者,
第二三角形细分为第四子三角形、第五子三角形和第六子三角形;其中,第四子三角形和第五子三角形的共用边为第一细分交点和第二细分交点的连线,第五子三角形和第六子三角形的共用边为第一细分交点或第二细分交点与第二三角形顶点的连线(此时可以参照图13b中(7)、(8)所示的情形);或者,
第一三角形细分为第七子三角形、第八子三角形和第九子三角形,第二三角形细分为第十子三角形、第十一子三角形和第十二子三角形;其中,第七子三角形和第八子三角形的共用边为第一细分交点与第三点的连线,第八子三角形和第九子三角形的共用边为第一细分交点与第一三角形顶点的连线;第十子三角形和第十一子三角形的共用边为第二细分交点与第三点的连线,第十一子三角形和第十二子三角形的共用边为第二细分交点与第二三角形顶点的连线;第一细分交点和第二细分交点的连线,与第一三角形和第二三角形的共用边的交点为第三点(此时可以参照图13b中(3)~(6)所示的情形)。
其中,第一三角形可以基于细分交点单独细分,也可以不不细分,还可以基于细分交点与第二三角形共同进行细分。这样,在目标Mesh中,划分的每个子三角形的像素点深度值都是连续的,这样以每个细分后的子三角形为单元进行图像扭曲处理时不会出现几何图形拉伸变形的问题,以此避免了预测帧图像中深度值不连续的图像区域出现局部拉伸的问题,能够较好地保留连续的图形信息。
根据第一方面,或者以上第一方面的任意一种实现方式,该方法还包括:在目标Mesh中,电子设备设置每个三角形的深度信息。
这样,电子设备进行图像扭曲处理时,可以结合像素深度信息,以保证预测帧图像中不同对象之间正确的深度先后关系。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备根据目标Mesh和运动矢量,对第二图像进行图像扭曲处理,可以包括:针对目标Mesh中每个三角形,电子设备确定三角形各顶点的运动矢量,并根据三角形各顶点的运动矢量对三角形进行移动;在每个三角形移动至目标位置时,电子设备根据三角形的深度信息与目标位置处其他三角形的深度信息,确定三角形与目标位置处其他三角形的覆盖关系。
这样,电子设备在基于运动矢量移动一个三角形时,可以根据该三角形的深度信息确定其与其他三角形的覆盖关系,以保证预测帧图像中不同对象之间正确的深度先后关系。
根据第一方面,或者以上第一方面的任意一种实现方式,待细分的四边形的细分交点为第一细分交点和第二细分交点,待细分的四边形划分为第一三角形和第二三角形;电子设备根据初始几何图形的两个细分交点,对初始几何图形进行网格细分,可以包括:电子设备根据第一细分交点和第二细分交点,与第一三角形以及与第二三角形的位置关系,采用匹配的网格细分策略对第一三角形和/或第二三角形进行网格细分。
其中,电子设备根据第一细分交点和第二细分交点,与第一三角形以及与第二三角形的位置关系,可以单独对第一三角形进行网格细分,也可以单独对第二三角形进行网格细分,还可以共同对第一三角形和第二三角形进行网格细分。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备根据第一细分交点和第二细分交点,与第一三角形以及与第二三角形的位置关系,采用匹配的网格细分策略对第一三角形和/或第二三角形进行网格细分,可以包括:当第一细分交点的横坐标与第一三角形的第一顶点、第二顶点的横坐标相等,且第二细分交点的纵坐标与第一三角形的第二顶点、第三顶点的纵坐标相等时,电子设备连接第一细分交点和第二细分交点,以及连接第一细分交点和第一三角形的第三顶点或者连接第二细分交点和第一三角形的第一顶点,以单独将第一三角形细分为三个三角形。
在此情形下,电子设备根据第一细分交点和第二细分交点单独对第一三角形进行网格细分,不对第二三角形进行网格细分,此时可以参照图13b中(1)、(2)所示的情形。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备根据第一细分交点和第二细分交点,与第一三角形以及与第二三角形的位置关系,采用匹配的网格细分策略对第一三角形和/或第二三角形进行网格细分,可以包括:
当第一细分交点的横坐标与第二三角形的第一顶点、第二顶点的横坐标相等,且第二细分交点的纵坐标与第二三角形的第二顶点、第三顶点的纵坐标相等时,电子设备连接第一细分交点和第二细分交点,以及连接第一细分交点和第二三角形的第三顶点或者连接第二细分交点和第二三角形的第一顶点,以单独将第二三角形细分为三个三角形。
在此情形下,电子设备根据第一细分交点和第二细分交点单独对第二三角形进行网格细分,不对第一三角形进行网格细分,此时可以参照图13b中(7)、(8)所示的情形。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备根据第一细分交点和第二细分交点,与第一三角形以及与第二三角形的位置关系,采用匹配的网格细分策略对第一三角形和/或第二三角形进行网格细分,包括:
当第一细分交点的纵坐标与第一三角形的第二顶点、第三顶点的纵坐标相等,且第二细分交点的纵坐标与第二三角形的第二顶点、第三顶点的纵坐标相等时,电子设备连接第一细分交点和第二细分交点,连接第一细分交点和第一三角形的第一顶点,以及连接第二细分交点和第二三角形的第一顶点,以将第一三角形和第二三角形分别细分为三个三角形(此时可以参照图13b中(3)所示的情形);
当第一细分交点的横坐标与第一三角形的第一顶点、第二顶点的横坐标相等,且第二细分交点的横坐标与第二三角形的第一顶点、第二顶点的横坐标相等时,电子设备连接第一细分交点和第二细分交点,连接第一细分交点和第一三角形的第三顶点,以及连接第二细分交点和第二三角形的第三顶点,以将第一三角形和第二三角形分别细分为三个三角形(此时可以参照图13b中(5)所示的情形);
当第一细分交点的纵坐标与第一三角形的第二顶点、第三顶点的纵坐标相等,且第二细分交点的横坐标与第二三角形的第一顶点、第二顶点的横坐标相等时,电子设备连接第一细分交点和第二细分交点,连接第一细分交点和第一三角形的第一顶点,以及连接第二细分交点和第二三角形的第三顶点,以将第一三角形和第二三角形分别细分为三个三角形(此时可以参照图13b中(4)所示的情形);
当第一细分交点的横坐标与第一三角形的第一顶点、第二顶点的横坐标相等,且第二细分交点的纵坐标与第二三角形的第二顶点、第三顶点的纵坐标相等时,电子设备连接第一细分交点和第二细分交点,连接第一细分交点和第一三角形的第三顶点,以及连接第二细分交点和第二三角形的第一顶点,以将第一三角形和第二三角形分别细分为三个三角形(此时可以参照图13b中(6)所示的情形)。
在上述这四种情形下,电子设备可以根据第一细分交点和第二细分交点共同对第一三角形和第二三角形进行网格细分,使得每个细分后的三角形的像素点深度值都是连续的。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备在初始Mesh中确定与静态对象对应的待细分的初始几何图形,可以包括:电子设备在初始Mesh中确定与静态对象对应的初始几何图形;电子设备确定每个初始几何图形的细分交点;电子设备将细分交点数量为2且每个边上至多存在一个细分交点的初始几何图形,作为待细分的初始几何图形。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备确定初始几何图形的细分交点,可以包括:电子设备在初始几何图形中确定各个边缘像素点;其中,边缘像素点的深度值在预设范围内,且边缘像素点与周围像素点的深度值之差超过预设阈值;电子设备将位于初始几何图形的边上的边缘像素点作为初始几何图形的细分交点。
这样,在图像中静态对象边缘上的像素点中确定细分交点,以使细分后的三角形的像素点深度值都是连续的。
根据第一方面,或者以上第一方面的任意一种实现方式,第一图像和第二图像为已
渲染的图像。
由于第一图像和第二图像为已渲染的图像,基于二者计算得到的预测帧图像也为已渲染图像,能够实现同帧率下渲染减半,从而大幅度降低电子设备功耗,减少电子设备的发热。
根据第一方面,或者以上第一方面的任意一种实现方式,电子设备获取第一图像和第二图像,可以包括:电子设备获取第一资源图像,并在第一资源图像中分离用户界面UI信息,得到第一图像;电子设备获取第二资源图像,并在第二资源图像中分离UI信息,得到第二图像;在电子设备生成与第一图像和第二图像对应的预测帧图像之后,还包括:电子设备对预测帧图像进行图像补全处理,并将补全处理后的预测帧图像和UI信息进行融合,得到目标预测帧图像。
其中,资源图像中包括图像信息和UI信息。
其中,在第一资源图像中分离的UI信息与在第二资源图像中分离的UI信息可以相同也可以不同。
在第一资源图像中分离的UI信息与在第二资源图像中分离的UI信息不同时,电子设备将第二预测帧图像和与第二资源图像对应的UI信息进行融合,得到目标预测帧图像。其中,第二资源图像为当前帧资源图像,第一资源图像为当前帧资源图像的前一帧资源图像。
这样,电子设备在资源图像中分离UI信息后再进行预测帧图像计算,能够有效降低图像数据处理量,也能提升预测帧图像信息的准确性。
根据第一方面,或者以上第一方面的任意一种实现方式,第一资源图像和第二资源图像为游戏应用中的资源图像。
在游戏插帧场景中,图像场景比较复杂,静态对象(例如各种建筑物等)较多且静态对象在场景中的深度差异较大(也即不同静态对象的深度值不连续)。另外,由于游戏多为虚拟世界,在用户玩手机游戏时,用户操作往往会导致游戏场景的大角度晃动,不像物理世界中对象移动会遵循物理规律。由此,在游戏场景比较复杂的情况下,大角度的场景晃动有可能只会使图像中部分对象的移动较大,而非能使图像中所有对象的移动幅度都较大。也就是说,在游戏场景中,基于连续的真实帧图像计算得到的MV图像的分布是不均匀的,尤其是在深度信息差异较大的图像区域中,MV值的差异也是比较大的。在游戏插帧场景中,电子设备基于MV计算预测帧图像时,预测帧图像中极大可能出现深度值不连续的静态对象边缘区域失真的问题。
在本申请实施例提供的技术方案中,通过像素深度值识别出游戏图像中静态对象的边缘区域,基于像素点深度信息对边缘区域进行Mesh几何细分,并以细分后的Mesh几何图形为单元进行图像扭曲处理,以此解决在游戏场景预测帧图像中的静态对象边缘区域失真的问题,提升用户的游戏体验。
第二方面,本申请实施例提供一种电子设备。该电子设备包括:一个或多个处理器;存储器;以及一个或多个计算机程序,其中一个或多个计算机程序存储在存储器上,当计算机程序被一个或多个处理器执行时,使得电子设备执行第一方面以及第一方面中任
意一项的图像处理方法。
第二方面以及第二方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第二方面以及第二方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第三方面,本申请实施例提供一种计算机可读存储介质。该计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得电子设备执行第一方面以及第一方面中任意一项的图像处理方法。
第三方面以及第三方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第三方面以及第三方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第四方面,本申请实施例提供一种计算机程序产品,包括计算机程序,当计算机程序被运行时,使得计算机执行如第一方面或第一方面中任意一项的图像处理方法。
第四方面以及第四方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第四方面以及第四方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第五方面,本申请提供了一种芯片,该芯片包括处理电路、收发管脚。其中,该收发管脚和该处理电路通过内部连接通路互相通信,该处理电路执行如第一方面或第一方面中任意一项的图像处理方法,以控制接收管脚接收信号,以控制发送管脚发送信号。
第五方面以及第五方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第五方面以及第五方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
图1a为示例性示出的插帧模式示意图;
图1b为示例性示出的预测帧插帧示例图;
图2为示例性示出的预测帧图像的生成流程示意图;
图3为示例性示出的图像网格化示意图;
图4为示例性示出的深度图像;
图5为示例性示出的应用场景示意图;
图6为示例性示出的图像网格扭曲示意图;
图7为示例性示出的电子设备的硬件结构示意图;
图8为示例性示出的电子设备的软件结构示意图;
图9为示例性示出的图像处理方法涉及的模块交互示意图;
图10为示例性示出的图像扭曲流程示意图;
图11为示例性示出的网格标准化示意图;
图12为示例性示出的细分交点的确定流程图;
图13a为示例性示出的细分交点分布示意图;
图13b为示例性示出的网格细分示意图;
图14为示例性示出的网格移动示意图;
图15a为示例性示出的应用场景示意图之一;
图15b为示例性示出的应用场景示意图之一。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。
本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。
随着电子技术的发展,智能终端屏幕的刷新率越来越高,视频源的帧率也越来越高,在智能终端中的内存占用和渲染功耗也会随之增加。然而,由于智能终端功耗或CPU、GPU的能力限制,高刷新率和高帧率往往会使智能终端出现发热或卡顿的现象,从而影响用户的使用体验。
以手机游戏为例,随着大型手机游戏的发展和推广,现代手机游戏的渲染管线越来越复杂,资源负载也越来越大。同时,现代智能终端的算力增长并未满足现代大型手游的需要,且智能终端受限于有限的电池容量和散热能力。因此,开发者聚焦在如何在保证游戏画质不受明显影响的情况下,减少不必要的渲染开销,提高有限的帧率和流畅度,减小发热。
为了提升用户的使用体验,开发者往往会降低视频源的帧率,再通过视频插帧技术提高视频帧率,实现同帧率下渲染减半,从而大幅度降低智能终端功耗,减少智能终端的发热。
视频插帧技术旨在提高视频的帧率和流畅度,让视频看起来更加“丝滑”。只要在相邻的真实帧(或称原始帧等)之间插入一个预测帧(或称中间帧、过渡帧等),视频的帧率就可以提高一倍。而预测帧的画质直接关系着视频的流畅程度。其中,通过相邻两个真实帧的图像信息计算出图像中各对象的移动方向和速度,并将图像中各对象进行相应的移动即可得到预测帧。
顾名思义,真实帧指的是视频源中原始存在的图像帧,并非是通过预测手段生成的图像帧。示例性的,真实帧可以是在游戏等应用开发时开发人员绘制的图像帧,也可以是在视频制作时通过图像采集设备(例如摄像机等)采集到的图像帧。
参照图1a所示,视频插帧方式可以分为预测帧内插和预测帧外插。在预测帧内插方式中,如图1a中(1)所示,根据相邻的两帧真实帧图像计算出预测帧图像,并将预测帧图像插帧这两帧真实帧图像之间,以此提高视频帧率。在预测帧外插方式中,如图1a中(2)所示,根据相邻的两帧真实帧图像计算出预测帧图像,并将预测帧图像插帧这两帧真实帧图像之后作为下一帧图像,以此提高视频帧率。
以预测帧内插方式为例,参照图1b所示:根据真实帧1和真实帧2计算出预测帧1,并将预测帧1插入真实帧1和真实帧2之间;根据真实帧2和真实帧3计算出预测帧2,并将预测帧2插入真实帧2和真实帧3之间;根据真实帧3和真实帧4计算出预测帧3,并将预测帧3插入真实帧3和真实帧4之间;以此类推。这样,通过预测帧内插的方式提高了视频的帧率,使静态对象和动态对象移动过渡得更加平滑,画面更加流畅。
下述以游戏场景为例,对预测帧的生成过程进行简要说明。需要指出的是,本实施例举例示出的相关附图均以灰度图形式示出。
如图2所示,第一真实帧和第二真实帧是某游戏应用中相邻的两个图像帧。其中,假设第二真实帧是当前图像帧,第一真实帧是第二真实帧的前一图像帧。由此,智能终端可以根据第一真实帧和第二真实帧计算预测帧。以预测帧内插方式为例,智能终端可以将计算得到的预测帧插帧于这两个真实帧之间进行显示,以此提高游戏视频的帧率,实现同帧率下渲染减半。
在该游戏应用中,真实帧中包括图像信息和UI(User Interface,用户界面)信息。其中,图像信息可以理解为视频源中的画面信息,UI信息指的是对软件的人机交互、操作逻辑、界面美观的整体设计信息。在智能终端基于相邻的真实帧计算预测帧时,由于界面UI信息不会发生变化,则智能终端可以首先将图像信息和UI信息分离,只基于图像信息进行预测帧的计算,以此降低图像数据的处理量,并提高预测帧的准确性。由此,如图2所示,在计算预测帧时,智能终端可以首先在第一真实帧中提取第一图像101和第一UI 102,在第二真实帧中提取第二图像103和第二UI 104,再根据第一图像101和第二图像帧进行图像预测操作,以得到预测帧图像107。
继续参照图2,在计算预测帧图像107时,智能终端可以首先计算第一图像101和第二图像103的运动矢量(Motion Vector,MV)105,并基于运动矢量105对第二图像103进行图像扭曲(Warping)处理,得到预测帧图像106。其中,图像扭曲处理是指通过一定的变换改变图像像素的位置,例如平移变换、旋转变换、比例缩放变换、仿射变换、透视变换、柱状变换等。
其中,图像扭曲处理能够较好地保证图像中各对象的连续移动,但由于图像各个对象的移动速度不同,故经过图像扭曲处理得到的预测帧图像106中可能会出现图像信息覆盖或图像信息缺失的情况,智能终端还需要对预测帧图像106进行图像补全(Blur)处理,以得到预测帧图像107。此时,智能终端再将第二UI 104和预测帧图像107进行融合,即可得到基于第一真实帧和第二真实帧计算得到的预测帧108。
需要注意的是,无论是图像扭曲处理,还是融合UI信息处理,均可以是以当前真实帧中的信息为基准的。当然,图像扭曲处理以及融合UI信息处理,也可以是以当前真实帧的前一帧信息为基准的,本实施例对此不做限定。
其中,在计算机图形学中,通常以网格(Mesh)几何作为图像处理的基本单元。类似的,在上述提及的图像扭曲处理阶段,智能终端也是以网格几何为基本单位进行图像扭曲处理的。也就是说,智能终端通过在图像中形成三角形或四边形的几何组来执行图像扭曲处理。以四边形网格为例,如图3所示,图像帧20为一个全局工作组。在图像帧20中可以划分出多个四边形201,每个四边形201中包括多个像素点2011。其中,每个四边形201为一个局部工作组,为智能终端进行图像扭曲处理的一个基本单元。
然而,在图像中显示的各对象是带有深度信息的,故在图像中每个像素的深度值不尽相同。其中,一个像素点的深度值,是指从图像采集器(例如相机等)到图像场景中这个点的垂直距离(深度),取值范围为0-1的浮点数。图4示例性的示出了一张深度图像(depth image)。深度图像是指将从图像采集器到场景中各点的垂直距离(深度)作为像素值的图像。由于深度值只是一个浮点数,故深度图的每个像素就只需要存储r(red)通道的浮点数值即可,因此我们看到的深度图是红黑色的(图4以灰度图形式示出)。示例性的,如图4所示,当对象离图像采集器越近,深度图上对应的区域越红(深度值接近1),越远则越黑(深度值接近0)。也就是说,深度值从0到1代表的是对象距离图像采集器从远到近。
在像素的深度值不连续的图像区域中,如Mesh中同一个几何图形中像素点的深度值不连续,以该几何图形作为图像扭曲处理的一个基本单元会导致图像出现局部拉伸的问题,甚至是对象深度信息异常的问题,使得预测帧图像画面失真,进而会使得预测帧与真实帧的差异较大,用户视觉体验差。例如,在图像Mesh的一个几何图形中,某个像素点与其周围像素的深度值差值大于设定阈值,则该几何图形中像素深度值不连续。
图5示例性的示出了真实帧和预测帧的对比示意图。在如图5所示的图像场景中,图像中柱子的边缘区域为深度值不连续的区域,柱子区域像素点的深度值明显大于天空区域像素点的深度值。如图5中(1)所示的真实帧中,图像中柱子的边缘是直的,而在如图5中(2)所示的预测帧中,图像中柱子的边缘处出现了局部拉伸问题,且部分天空区域像素点的深度值大于柱子区域像素点的深度值(即天空距离图像采集器比柱子更近,对象深度信息异常)。这样,预测帧图像出现了失真的问题,与真实帧差异较大。
由此,在经过图像扭曲处理生成的预测帧中,深度值不连续图像区域会出现了局部拉伸的问题,甚至是对象深度信息异常的问题,与真实场景区别较大,使得用户的视觉体验较差。
为了解决上述问题,本申请实施例提供了一种图像处理方法。在该方法中,针对深度值不连续的图像区域,智能终端基于像素点的深度信息对图像网格进行细分,并以细分后的图像Mesh几何为单元进行图像扭曲处理,以此解决在预测帧图像中深度值不连续的图像区域会出现局部拉伸的问题,以较好地保留连续的图形信息,进而提升预测帧图像的画面质量,使得用户的视觉体验较佳。
另外,智能终端以细分后的图像Mesh几何为单元进行图像扭曲处理时,还会结合像素点的深度信息进行相关处理,以使预测帧图像中的对象能够保持正确的深度关系,避免出现对象深度信息异常的问题。
其中,本申请实施例提供图像处理方法适用于深度信息差异较大的图像插帧场景中,例如游戏插帧场景中。
众所周知,在手机游戏中,图像场景比较复杂,静态对象(例如各种建筑物等)较多且静态对象在场景中的深度差异较大(也即不同静态对象的深度值不连续)。另外,由于游戏多为虚拟世界,在用户玩手机游戏时,用户操作往往会导致游戏场景的大角度晃动,不像物理世界中对象移动会遵循物理规律。由此,在游戏场景比较复杂的情况下,大角度的场景晃动有可能只会使图像中部分对象的移动较大,而非能使图像中所有对象的移动幅度都较大。也就是说,在游戏场景中,基于连续的真实帧图像计算得到的MV图像的分布是不均匀的,尤其是在深度信息差异较大的图像区域中,MV值的差异也是比较大的。
由此,在游戏插帧场景中,电子设备基于MV计算预测帧图像时,预测帧图像中极大可能出现深度值不连续的静态对象边缘区域失真的问题。
图6中(1)示例性的示出了基于游戏图像计算得到的运动矢量帧的灰度图。在如图6中(1)所示的灰度图中,灰度越浅(灰度值越接近于1)的区域的运动矢量越小,灰度越深(灰度值越接近于0)的区域的运动矢量越大。继续参照图6中(1),图像帧中静态对象的边缘区域左右两侧的运动矢量变化大。结合图6中(1)和(2),以区域301为例,子区域3011对应于图像中的柱子区域,子区域3012对应于图像中的天空区域,与柱子对应的运动矢量明细小于与天空对应的运动矢量。也就是说,柱子边缘区域左右两侧的运动矢量值的变化较大。在此情形下,一旦同一个图像Mesh几何中不同像素区域对应的运动矢量差异较大,基于运动矢量对该Mesh几何进行图像扭曲处理必然会导致Mesh几何图形严重变形,甚至出现部分Mesh几何图形交叠的问题,而且也无法保证图像中对象深度信息的正确性。如图6中(3)所示,在Mesh几何图形201四个顶点中,V0和V1对应的运动矢量,与V2和V3对应的运动矢量差别较大,将各个顶点按照各自对应的运动矢量移动后,Mesh几何图形201扭曲为Mesh几何图形201’,不仅Mesh几何图形严重变形,而且有可能覆盖其他的Mesh几何图形。这样会使得预测帧图像部分区域失真,尤其是静态对象的边缘区域(即深度值不连续的像素区域)失真,可以参照图6中(4)所示。
在本申请实施例提供的技术方案中,通过像素深度值识别出游戏图像中静态对象的边缘区域,基于像素点深度信息对边缘区域进行Mesh几何细分,并以细分后的Mesh几何图形为单元进行图像扭曲处理,以此解决在游戏场景预测帧图像中的静态对象边缘区
域失真的问题,提升用户的游戏体验。
如图7所示为电子设备100的结构示意图。可选地,电子设备100可以为终端,也可以称为终端设备、智能终端等,终端可以为蜂窝电话(cellular phone)或平板电脑(pad)等设备,本申请不做限定。应该理解的是,图7所示的电子设备100仅是电子设备的一个范例,并且电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图6中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器,陀螺仪传感器,加速度传感器,温度传感器,运动传感器,气压传感器,磁传感器,距离传感器,接近光传感器,指纹传感器,触摸传感器,环境光传感器,骨传导传感器等。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
在本申请实施例中,在生成预测帧图像时,GPU可以基于本申请实施例提供的图像处理方法对图像网格进行细分,并基于细分后的图像网格进行图像扭曲处理,以生成预测帧图像。GPU还可以对预测帧进行图像补全处理,达到快速补全预测帧图像的效果。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理,例如使得电子设备100实现本申请实施例中的图像处理方法。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。在一些实施例中,电子设备100可以设置多个扬声器170A。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器可以设置于显示屏194。电子设备100也可以根据压力传感器的检测信号计算触摸的位置。
陀螺仪传感器可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。
加速度传感器可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当
电子设备100静止时加速度传感器可检测出重力的大小及方向。加速度传感器还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
触摸传感器,也称“触控面板”。触摸传感器可以设置于显示屏194,由触摸传感器与显示屏194组成触摸屏,也称“触控屏”。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。
按键190包括开机键(或称电源键),音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图8是本申请实施例的电子设备100的软件结构框图。
电子设备100的分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android Runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图8所示,应用程序包可以包括游戏、视频、相机、图库、WLAN、蓝牙、通话、日历、地图、导航等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图8所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知信息被用于告知下载完成,消息提醒等。通知信息还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。通知信息例如还可以是在状态栏提示的文本信息,电子设备发出的提示音、振动,指示灯的闪烁等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
Android Runtime包括核心库和虚拟机。Android Runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL),图像提取模块、图像合成模块、预测帧生成模块、预测帧补全模块等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
在本申请实施例中,预测帧生成模块可以用于基于相邻的两帧图像信息生成预测帧图像。如图8所示,预测帧生成模块可以包括MV计算子模块和图像扭曲子模块。
其中,MV计算子模块可以用于根据连续的两帧图像计算MV。
图像扭曲子模块可以用于根据MV对图像进行图像扭曲处理。在本申请实施例中,图像扭曲子模块可以分别对图像中的静态对象和动态对象进行图像扭曲处理。在对静态对象进行图像扭曲处理时,图像扭曲子模块可以基于像素点的深度信息对图像Mesh进行细分,并以细分后的图像Mesh几何为单元进行图像扭曲处理。而且,图像扭曲子模块以细分后的图像Mesh几何为单元进行图像扭曲处理时,还会结合像素点的深度信息进行相关处理,将像素点深度值高的图像Mesh几何覆盖于像素点深度值低的图像Mesh几何上,以使预测帧图像中的各对象能够保持正确的深度关系。
预测帧补全模块可以用于对预测帧生成模块生成的预测帧图像中的空白区域进行补全处理,例如模糊补全处理,得到图像补全处理后的预测帧图像。
图像提取模块可以用于在资源图像帧中分离图像信息和UI信息,得到图像帧,该图像帧用于进行中间帧预测。
其中,图像提取模块也可以集成于三维图形处理库中,本实施例对此不做限定。
图像合成模块可以用于将图像补全处理后的预测帧图像和UI信息进行融合,得到待送显的预测帧。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,音频驱动,Wi-Fi驱动,传感器驱动等。其中,硬件至少包括处理器、显示屏、Wi-Fi模块、传感器等。
可以理解的是,图8示出的软件结构中的层以及各层中包含的部件,并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的层,以及每个层中可以包括更多或更少的部件,本申请不做限定。
可以理解的是,电子设备为了实现本申请实施例中的图像处理方法,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
如图9所示为各模块的交互示意图。参照图9,在游戏插帧场景中,本申请实施例提供的图像处理方法的流程,具体包括:
S401,游戏APP向三维图形处理库发送资源图像。
资源图像,指的是在游戏APP的图像数据,旨在游戏APP界面中显示的图像。其中,资源图像中包括图像信息和UI信息。
其中,UI信息,指的是对软件的人机交互、操作逻辑、界面美观的整体设计信息。
其中,图像信息包括但不限于每个像素点的GRB(Green,Red,Blue)值和深度值。
S402,三维图像处理库对游戏APP的资源图像进行渲染。
关于三维图像处理库对资源图像进行渲染的流程可以参照已有技术,在此不再赘述。
S403,图像提取模块拦截渲染后的资源图像,在资源图像中提取真实帧图像和UI信息,并将真实帧图像和UI信息对应进行存储。
其中,在大多情形下,UI信息不会发生变化,在每帧画面中的显示位置也是固定的,不会发生变化。示例性的,在游戏应用界面中,UI信息可以包括用户操作控件等。
在电子设备基于相邻的真实帧图像预测中间帧图像时,由于界面UI信息不会发生变化,则可以首先通过图像提取模块将图像信息和UI信息分离,只基于图像信息进行中间帧预测,以此降低图像数据的处理量,并提高中间帧图像预测的准确性。
在一些特殊情形下,UI信息可能会发生变化,电子设备也可以通过图像提取模块先将图像信息和UI信息分离,并基于图像信息进行中间帧预测,在得到中间帧图像之后再将其与当前真实帧图像的UI信息进行融合即可,本实施例对此不做限定。
图像提取模块在渲染后的资源图像中通过特征识别出真实帧图像(即游戏场景图像)和UI信息,并将真实帧图像绘制到私有的图像帧缓存中。
同时,图像提取模块也将匹配的UI信息对应进行存储。示例性的,UI信息可以包括但不限于UI图像内容以及UI图像的显示位置信息等。
S404,MV计算子模块根据相邻的两个真实帧图像,计算运动矢量。
其中,相邻的两个真实帧图像可以是当前真实帧图像以及当前真实帧图像的前一真实帧图像,例如图2中所示的真实帧图像103和真实帧图像101。
MV计算子模块在图像帧缓存中读取相邻的两帧真实帧图像,并计算与这两帧真实帧图像对应的运动矢量。
其中,MV计算子模块可以根据真实帧图像中各图像区域预标注的对象属性(如静态对象、动态对象),选择匹配的计算方式分别计算与各图像区域对应的运动矢量,以得到与当前帧图像对应的运动矢量,例如图2中所示的运动矢量帧105。
在一种可选的实施方式中,在图像中一些对象(例如人等)预标注有动态对象(即呈现运动状态的对象)属性,在该图像中其他未标注的对象(例如天空、柱子等)即为静态对象。
示例性的,针对与静态对象对应的图像区域,MV计算子模块可以采用重投影法计算相应的运动矢量;针对与动态对象对应的图像区域,MV计算子模块可以采用光流法计算相应的运动矢量。关于重投影法和光流法计算运动矢量的方法步骤可以参照已有技术,在此不再赘述。
S405,图像扭曲子模块基于运动矢量对当前帧图像进行图像扭曲,得到第一预测帧图像,并将第一预测帧图像发送至预测帧补全模块。
在MV计算子模块基于当前帧图像以及当前帧图像的前一帧图像,计算得到与当前帧图像对应的运动矢量之后,图像扭曲子模块即基于运动矢量对当前帧图像进行图像扭曲,以得到第一预测帧图像。
需要指出的是,由于在视频源中各个对象的移动速度不同,图像扭曲子模块基于运动矢量计算得到的预测帧图像会出现图像信息覆盖和图像信息缺失的情况。也即,第一预测帧图像为待图像补全的预测帧图像,例如图2中所示的预测帧图像106。
其中,图像扭曲子模块基于运动矢量对当前帧图像进行图像扭曲时,首先基于运动矢量对当前帧图像中与静态对象对应的图像区域进行图像扭曲处理,再基于运动矢量对当前帧图像中与动态对象对应的图像区域进行图像扭曲处理,以此得到第一预测帧图像。
作为一种可选的实施方式,S405可以具体为:
S4051,图像扭曲子模块创建并细分当前帧图像的网格(Mesh),并基于运动矢量以细分后的Mesh几何为处理单元对当前帧图像中的静态对象进行图像扭曲处理。
S4052,图像扭曲子模块基于运动矢量以创建及标准化的Mesh几何为处理单元对当前帧图像中的动态对象进行图像扭曲处理。
其中,在图像扭曲子模块创建当前帧图像的Mesh之后,可以对Mesh进行标准化处理,以便于几何图形处理。故而,图像扭曲子模块基于运动矢量以标准化后的Mesh几何为处理单元对当前帧图像中的动态对象进行图像扭曲处理。关于图像Mesh的创建及标准化可以参照下文,在此不再赘述。
由于深度值不连续的图像区域通常在图像中静态对象的边缘区域,故在图像扭曲子
模块基于运动矢量对当前帧图像中与静态对象对应的Mesh几何进行图像扭曲处理时,首先基于像素点的深度信息对Mesh几何进行细分,使得细分后的Mesh几何所对应的像素深度值是连续的。也即,在细化后的每个Mesh几何中,像素点的深度值是连续的,或称像素点的深度值差异比较小。
图像扭曲子模块基于运动矢量对细分后的网格进行图像扭曲处理时,能够较好地保留静态对象连续的图形信息,以避免静态对象边缘区域出现失真的问题。
需要指出的是,基于运动矢量对Mesh几何进行图像扭曲处理,指的是按照与每个Mesh几何顶点分别对应的运动矢量,分别对每个Mesh几何顶点的位置进行移动。其中,无论是以细化后的Mesh几何为处理单元以对静态对象进行移动,还是以未细化的Mesh几何为处理单元以对动态对象进行移动,处理方式均是一致的,区别仅在于Mesh几何的细化程度不同。
作为一种可选的实施方式,S4051可以具体化为S501~S509。如图10所示,图像扭曲子模块对当前帧图像中的静态对象进行图像扭曲处理的流程,具体包括:
S501,图像扭曲子模块创建当前图像帧的网格。
图像扭曲子模块创建当前图像帧的网格(Mesh),也可以称之为将当前图像帧网格化,是为了将当前帧图像分割为更易于处理的几何图形,比如多边形、三角形或四边形。
其中,图像扭曲子模块创建当前图像帧的Mesh与当前图像帧的尺寸一致,这样Mesh中填充的每个图形都能覆盖当前图像帧的一块像素区域。
示例性的,在本申请实施例中,图像扭曲子模块可以创建当前图像帧的四边形网格,也即依据四边形的尺寸对当前图像帧进行网格化。其中,四边形可以为正方形。
S502,图像扭曲子模块将网格进行标准化处理。
其中,若图像扭曲子模块针对当前图像帧创建的是非三角形网格,例如四边形网格等,图像扭曲子模块则可以将非三角形网格进行标准化处理,以使网格中的每个非三角形划分为多个三角形,便于进行图形计算。
示例性的,图像扭曲子模块创建当前图像帧的四边形网格,则图像扭曲子模块可以将四边形网格中的每个四边形再次划分为两个三角形,以实现网格标准化。
其中,在四边形网格中的每个四边形或三角形都可以通过顶点进行索引。示例性的,为了便于计算处理,每个四边形或三角形的顶点排序可以为顺时针方向,以将图像网格的顶点索引规范化。
如图11中(1)所示,针对当前图像帧网格中的每个四边形201,可以划分为三角形201_1和三角形201_2。如图11中(2)所示,以四边形Square(V0-V1-V2-V3)为例,该四边形可以划分为三角形Tringle1(V0-V1-V2),以及三角形Tringle2(V2-V3-V0)。其中,在三角形Tringle1中,V0为起始顶点,V2为终止顶点;在三角形Tringle2中,V2为起始顶点,V0为终止顶点。
需要指出的是,在将四边形Square(V0-V1-V2-V3)标准化的过程中,第一三角形(即Tringle1(V0-V1-V2))的起始顶点V0为四边形Square(V0-V1-V2-V3)的起始顶点V0,第一三角形的起始边V0-V1为四边形的起始边V0-V1。同时,第一三角形的终止顶点V2为第二三角形(即Tringle2(V2-V3-V0))的起始顶点V2,第二三角形的终止
顶点V0为第一三角形的起始顶点V0。
S503,图像扭曲子模块依次将Mesh标准化处理前每个几何图形作为当前处理图形(或称当前处理Mesh几何图形)。
其中,图像扭曲子模块是以标准化处理前创建的每个几何图形为处理单元判断是否需要进行网格细分以及如何进行网格细分和图像扭曲。也就是说,图像扭曲子模块依次判断标准化处理前的每个四边形是否需要进行网格细分以及如何进行网格细分和图像扭曲。在如图11中(1)所示的网格划分示例中,图像扭曲子模块依次判断每个四边形是否需要进行网格细分以及如何进行网格细分和图像扭曲。
需要指出的是,图像扭曲子模块也可以并行地判断标准化处理前的每个几何图形是否需要进行网格细分以及如何进行网格细分和图像扭曲。针对每个几何图形,图像扭曲子模块的判断及处理流程可以参照S504~S508。
S504,图像扭曲子模块判断当前处理图形是否对应于当前图像帧中的静态对象,若是,则执行S505,若否,则执行S509。
在当前图像帧的Mesh中,本实施例只需对与静态对象对应的几何图形进行网格细分,以使在与静态对象对应的每个几何图形中像素点深度值都是连续的,因此图像扭曲子模块需要判断当前处理图形是否对应于静态对象。
其中,图像扭曲子模块可以根据图像预标注信息判断当前处理图形是否对应于静态对象,若否则继续按顺序对Mesh中的下一个几何图形进行判断,直至处理完当前图像帧Mesh中的所有几何图形。若是,图像扭曲子模块则会继续判断当前处理图形是否满足网格细分条件。
S505,图像扭曲子模块确定当前处理图形的细分交点。
在判断当前处理图形是否满足网格细分条件时,图像扭曲子模块确定是否存在与当前处理图形对应的细分交点,进而可以根据细分交点的数量确定当前处理图形是否满足网格细分条件。
其中,细分交点为用于对Mesh中几何图形进行网格细分的像素点,该像素点位于几何图形的边上。以四边形Mesh中的四边形为例,细分交点需要位于四边形的任意一个边上。
图12示例性的示出了细分交点的确定流程。如图12所示,图像扭曲子模块确定当前处理图形的细分交点的具体流程,包括:
S5051,图像扭曲子模块依次将当前处理图形中的每个像素点作为当前处理像素点。
图像扭曲子模块判断当前处理图形中的每个像素点是否为当前处理图形的细分交点。
需要指出的是,图像扭曲子模块也可以并行地判断当前处理图形中的每个像素点是否为当前处理图形的细分交点。针对每个当前处理图形中的每个像素点,图像扭曲子模块的判断流程可以参照S5052~S5056。
S5052,图像扭曲子模块判断当前处理像素点的深度值是否处于预设深度范围,若是,则执行S5053,若否,则执行S5055。
其中,预设深度范围可以理解为感兴趣的深度范围,该深度范围内静态对象边缘容
易在图像扭曲时出现失真。
S5053,图像扭曲子模块判断当前处理像素点与周围像素点的深度值之差是否超过预设阈值,若是,则执行S5054,若否,则执行S5055。
若当前处理像素点与周围像素点的深度值之差超过预设阈值,表明当前处理像素点的深度值与其四周像素点差异较大,当前处理像素点可能位于静态对象边缘上。
S5054,图像扭曲子模块将当前处理像素点标记为与当前处理图形对应的边缘点。
其中,边缘点,也称静态对象边缘点,即为静态对象边缘上的像素点。
S5055,图像扭曲子模块判断是否处理完当前处理图形中的所有像素点。
图像扭曲子模块首先在当前处理图形的所有像素点中识别出各个边缘点,然后判断各个边缘点中是否存在当前处理图形的细分交点。
针对当前处理图形中的任意一个像素点,如果其深度值处于预设深度范围,且其与四周任意一个像素点的深度值之差超过预设阈值,则图像扭曲子模块判断出该像素点为静态对象边缘点。
S5056,图像扭曲子模块在与当前处理图形对应的各静态对象边缘点中确定位于当前处理图形边上的像素点,作为当前处理图形的细分交点。
在当前处理图形中,图像扭曲子模块识别出各个静态对象边缘点之后,判断每个静态对象边缘点是否位于当前处理图形的边上,若是,则将该静态对象边缘点作为当前处理图形的细分交点。
示例性的,图像扭曲子模块可以基于计算着色器(Compute Shader)计算判断每个静态对象边缘点是否位于当前处理图形的边上。关于计算着色器的详细解释可以参照已有技术,在此不再赘述。
在一种可能的实施方式中,图像扭曲子模块也可以在确定出与每个几何图形对应的各静态对象边缘点之后,再同时确定每个几何图形对应的细分交点。
示例性的,图像扭曲子模块可以在确定出与每个几何图形对应的各静态对象边缘点之后,可以生成静态对象边缘点的掩膜图像。其中,在静态对象边缘点的掩膜图像中,静态对象边缘点的灰度值为1,其余像素点的灰度值为0。另外,根据创建的当前图像帧的Mesh,图像扭曲子模块也可以在确定出Mesh中几何图形边的掩膜图像。其中,在几何图形边的掩膜图像中,在几何图形边上的像素点的灰度值为1,其余像素点的灰度值为0。
其中,图像扭曲子模块可以根据几何图形的掩膜图像以及计算得到的静态对象边缘点的掩膜图像,计算位于几何图形边上的静态对象边缘点,也即细分焦点。图像扭曲子模块将静态对象边缘点的掩膜图像与几何图形边的掩膜图像进行“与”操作,即可得到细分交点的掩膜图像。在细分交点的掩膜图像中,细分交点的灰度值为1,其余像素点的灰度值为0。这样,图像扭曲子模块即可记录与Mesh中每个几何图形对应的细分交点的坐标。
需要指出的是,鉴于图像场景不同,Mesh中不同几何图形的细分交点的数量不一定相同。以四边形Mesh中的四边形为例,其细分交点的数量可以是1、2、3、4中任意值。如图13a所示,图13a中(1)、(2)、(3)分别示例性的示出了Mesh中四边形的细分交
点数量为2的情形,图13a中(4)示例性的示出了Mesh中四边形的细分交点数量为1的情形,图13a中(5)示例性的示出了Mesh中四边形的细分交点数量为4的情形,图13a中(6)示例性的示出了Mesh中四边形的细分交点数量为4的情形。针对一些特殊场景,Mesh中几何图形的细分交点的数量还可以是其他值,每条边上的细分交点的数量也不一定只有一个。
S506,图像扭曲子模块根据细分交点的数量判断当前处理图形是否满足网格细分条件,若是,则执行S507,若否,则执行S508。
在本申请实施例中,网格细分条件可以为Mesh中几何图形的细分交点数量为2,且两个细分交点位于几何图形不同的边上。也即,网格细分条件可以为几何图形的细分交点有且只有两个,且几何图形的每条边上至多存在一个细分交点。
S507,图像扭曲子模块根据细分交点对当前处理图形进行细分,并根据运动矢量对细分后的当前处理图形进行图像扭曲处理。
如果当前处理图形的细分交点的数量为2,且两个细分交点位于当前处理图形不同的边上,则当前处理图形满足网格细分条件,图像扭曲子模块根据这两个细分交点对当前处理图形进行细分,并对标准化且细分后的当前处理图形进行图像扭曲处理。
图像扭曲子模块根据两个细分交点对当前处理图形进行细分时,可以根据两个细分焦点与当前处理图形标准化后每个三角形顶点的坐标关系,选择匹配的细分策略对相应的三角形进行细分。
下面结合如图11中(2)所示的标准化Mesh中,分别对各种网格细分情形进行解释说明。其中,在如图11中(2)所示的标准化Mesh中,四边形Square(V0-V1-V2-V3)划分为第一三角形(即三角形Tringle1(V0-V1-V2))和第二三角形(即三角形Tringle2(V2-V3-V0))。
情形一
本情形只需对第一三角形单独进行网格细分,无需对第二三角形进行网格细分。
在两个细分交点中,第一细分交点的横坐标与第一三角形的第一顶点(或称起始顶点)和第二顶点(或称中间顶点)的横坐标相等,且第二细分交点的纵坐标与第一三角形的第二顶点和第三顶点(或称终止顶点)的纵坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第一三角形单独进行网格细分,无需对第二三角形进行网格细分。
在一种实施方式中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第一三角形的第三顶点相连,以对第一三角形进行网格细分,得到多个细分三角形。
如图13b中(1)所示,第一细分交点Point2的横坐标与第一三角形的第一顶点V0和第二顶点V1的横坐标相等,第二细分交点Point1的纵坐标与第一三角形的第二顶点V1和第三顶点V2的纵坐标相等。此时,图像扭曲子模块需要根据细分交点Point2和Point1对第一三角形单独进行网格细分,无需对第二三角形进行网格细分。
继续参照图13b中(1)所示,图像扭曲子模块将第一细分交点Point2和第二细分交点Point1相连,以及将第一细分交点Point2和第一三角形的第三顶点V2相连,以将第一三角形Tringle1(V0-V1-V2)细分为:第一细分三角形S-Tringle1(V0-Point2-V2)、第
二细分三角形S-Tringle2(Point2-Point1-V2)和第三细分三角形S-Tringle3(Point2-V1-Point1)。
在另一种实施方式中,图像扭曲子模块也可以将第一细分交点和第二细分交点相连,以及将第二细分交点和第一三角形的第一顶点相连,以对第一三角形进行网格细分,得到多个细分三角形。
如图13b中(2)所示,图像扭曲子模块将第一细分交点Point2和第二细分交点Point1相连,以及将第二细分交点Point1和第一三角形的第一顶点V0相连,以将第一三角形Tringle1(V0-V1-V2)细分为:第一细分三角形S-Tringle1(V0-Point2-Point1)、第二细分三角形S-Tringle2(Point2-V1-Point1)和第三细分三角形S-Tringle3(Point1-V2-V0)。
其中,每个细分三角形的顶点索引也是按照顺时针排序的。下述情形也是如此,下文不再赘述。
在如图13b中(1)和(2)所示的细分方式中,第一细分三角形S-Tringle1的起始边(V0-Point2)位于第一三角形的起始边(V0-V1)上,也即位于四边形的起始边(V0-V1)上,不会影响第一三角形的几何处理顺序,便于开发人员进行细分编程。
情形二
本情形需要对第一三角形和第二三角形共同进行网格细分。
(1)在两个细分交点中,第一细分交点的纵坐标与第一三角形的第二顶点和第三顶点的纵坐标相等,第二细分交点的纵坐标与第二三角形的第二顶点和第三顶点的纵坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第一三角形和第二三角形共同进行网格细分。
其中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第一三角形的第一顶点相连,将第二细分交点和第二三角形的第一顶点相连,以对第一三角形和第二三角形进行网格细分,得到多个细分三角形。
需要指出的是,在图像扭曲子模块可以将第一细分交点和第二细分交点相连时,第一细分交点和第二细分交点的连线与第一三角形的终止边(也即第二三角形的终止边)相交,能够同时对第一三角形和第二三角形进行网格细分。
如图13b中(3)所示,第一细分交点Point1的纵坐标与第一三角形的第二顶点V1和第三顶点V2的纵坐标相等,第二细分交点Point2的纵坐标与第二三角形的第二顶点V3和第三顶点V0的纵坐标相等。此时,图像扭曲子模块需要根据细分交点Point1和Point2共同对第一三角形和第二三角形进行网格细分。
继续参照图13b中(3)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第一细分交点Point1和第一三角形的第一顶点V0相连,将第二细分交点Point2和第二三角形的第一顶点V2相连。其中,第一细分交点Point1和第二细分交点Point2的连线与第一三角形的终止边(V2-V0)(也即第二三角形的终止边(V0-V2))相交于PointInter点。这样,第一三角形Tringle1(V0-V1-V2)被细分为:第一细分三角形S-Tringle1(V0-V1-Point1)、第二细分三角形S-Tringle2(V0-Point1-PointInter)和第三细分三角形S-Tringle3(PointInter-Point1-V2)。第二三角形Tringle2(V2-V3-V0)被细分为:第一细分三角形S-Tringle1(V2-V3-Point2)、第二细
分三角形S-Tringle2(V2-Point2-PointInter)和第三细分三角形S-Tringle3(PointInter-Point2-V0)。
(2)在两个细分交点中,第一细分交点的纵坐标与第一三角形的第二顶点和第三顶点的纵坐标相等,第二细分交点的横坐标与第二三角形的第一顶点和第二顶点的横坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第一三角形和第二三角形共同进行网格细分。
其中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第一三角形的第一顶点相连,将第二细分交点和第二三角形的第三顶点相连,以对第一三角形和第二三角形进行网格细分,得到多个细分三角形。
需要指出的是,在图像扭曲子模块可以将第一细分交点和第二细分交点相连时,第一细分交点和第二细分交点的连线与第一三角形的终止边(也即第二三角形的终止边)相交,能够同时对第一三角形和第二三角形进行网格细分。
如图13b中(4)所示,第一细分交点Point1的纵坐标与第一三角形的第二顶点V1和第三顶点V2的纵坐标相等,第二细分交点Point2的横坐标与第二三角形的第一顶点V2和第二顶点V3的横坐标相等。此时,图像扭曲子模块需要根据细分交点Point1和Point2共同对第一三角形和第二三角形进行网格细分。
继续参照图13b中(4)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第一细分交点Point1和第一三角形的第一顶点V0相连,将第二细分交点Point2和第二三角形的第三顶点V0相连。其中,第一细分交点Point1和第二细分交点Point2的连线与第一三角形的终止边(V2-V0)(也即第二三角形的终止边(V0-V2))相交于PointInter点。这样,第一三角形Tringle1(V0-V1-V2)被细分为:第一细分三角形S-Tringle1(V0-V1-Point1)、第二细分三角形S-Tringle2(V0-Point1-PointInter)和第三细分三角形S-Tringle3(PointInter-Point1-V2)。第二三角形Tringle2(V2-V3-V0)被细分为:第一细分三角形S-Tringle1(V2-Point2-PointInter)、第二细分三角形S-Tringle2(Point2-V0-PointInter)和第三细分三角形S-Tringle3(Point2-V3-V0)。
(3)在两个细分交点中,第一细分交点的横坐标与第一三角形的第一顶点和第二顶点的横坐标相等,第二细分交点的横坐标与第二三角形的第一顶点和第二顶点的横坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第一三角形和第二三角形共同进行网格细分。
其中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第一三角形的第三顶点相连,将第二细分交点和第二三角形的第三顶点相连,以对第一三角形和第二三角形进行网格细分,得到多个细分三角形。
需要指出的是,在图像扭曲子模块可以将第一细分交点和第二细分交点相连时,第一细分交点和第二细分交点的连线与第一三角形的终止边(也即第二三角形的终止边)相交,能够同时对第一三角形和第二三角形进行网格细分。
如图13b中(5)所示,第一细分交点Point1的横坐标与第一三角形的第一顶点V0和第二顶点V1的横坐标相等,第二细分交点Point2的横坐标与第二三角形的第一顶点
V2和第二顶点V3的横坐标相等。此时,图像扭曲子模块需要根据细分交点Point1和Point2共同对第一三角形和第二三角形进行网格细分。
继续参照图13b中(5)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第一细分交点Point1和第一三角形的第三顶点V2相连,将第二细分交点Point2和第二三角形的第三顶点V0相连。其中,第一细分交点Point1和第二细分交点Point2的连线与第一三角形的终止边(V2-V0)(也即第二三角形的终止边(V0-V2))相交于PointInter点。这样,第一三角形Tringle1(V0-V1-V2)被细分为:第一细分三角形S-Tringle1(V0-Point1-PointInter)、第二细分三角形S-Tringle2(Point1-V2-PointInter)和第三细分三角形S-Tringle3(Point1-V1-V2)。第二三角形Tringle2(V2-V3-V0)被细分为:第一细分三角形S-Tringle1(V2-Point2-PointInter)、第二细分三角形S-Tringle2(Point2-V0-PointInter)和第三细分三角形S-Tringle3(Point2-V3-V0)。
(4)在两个细分交点中,第一细分交点的横坐标与第一三角形的第一顶点和第二顶点的横坐标相等,第二细分交点的纵坐标与第二三角形的第二顶点和第三顶点的纵坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第一三角形和第二三角形共同进行网格细分。
其中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第一三角形的第三顶点相连,将第二细分交点和第二三角形的第一顶点相连,以对第一三角形和第二三角形进行网格细分,得到多个细分三角形。
需要指出的是,在图像扭曲子模块可以将第一细分交点和第二细分交点相连时,第一细分交点和第二细分交点的连线与第一三角形的终止边(也即第二三角形的终止边)相交,能够同时对第一三角形和第二三角形进行网格细分。
如图13b中(6)所示,第一细分交点Point1的横坐标与第一三角形的第一顶点V0和第二顶点V1的横坐标相等,第二细分交点Point2的纵坐标与第二三角形的第二顶点V3和第三顶点V0的纵坐标相等。此时,图像扭曲子模块需要根据细分交点Point1和Point2共同对第一三角形和第二三角形进行网格细分。
继续参照图13b中(6)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第一细分交点Point1和第一三角形的第三顶点V2相连,将第二细分交点Point2和第二三角形的第一顶点V2相连。其中,第一细分交点Point1和第二细分交点Point2的连线与第一三角形的终止边(V2-V0)(也即第二三角形的终止边(V0-V2))相交于PointInter点。这样,第一三角形Tringle1(V0-V1-V2)被细分为:第一细分三角形S-Tringle1(V0-Point1-PointInter)、第二细分三角形S-Tringle2(Point1-V2-PointInter)和第三细分三角形S-Tringle3(Point1-V1-V2)。第二三角形Tringle2(V2-V3-V0)被细分为:第一细分三角形S-Tringle1(V2-V3-Point2)、第二细分三角形S-Tringle2(Point2-PointInter-V2)和第三细分三角形S-Tringle3(Point2-V0-PointInter)。
在如图13b中(3)~(6)所示的细分方式中,两个细分交点共同对两个三角形进行细分。其中,对第一三角形划分所得的第一细分三角形,其起始边位于第一三角形的起始边(V0-V1)上,也即位于四边形的起始边(V0-V1)上;对第二三角形划分所得的第一细分三角形,其起始边也位于第二三角形的起始边(V0-V1)上。这样的网格细分不
会影响细分前三角形的几何处理顺序,便于开发人员进行细分编程。
情形三
本情形无需对第一三角形进行网格细分,只需对第二三角形单独进行网格细分。
在两个细分交点中,第一细分交点的横坐标与第二三角形的第一顶点和第二顶点的横坐标相等,且第二细分交点的纵坐标与第一三角形的第二顶点和第三顶点的纵坐标相等。此时,图像扭曲子模块需要根据这两个细分交点对第二三角形单独进行网格细分,无需对第一三角形进行网格细分。
在一种实施方式中,图像扭曲子模块可以将第一细分交点和第二细分交点相连,以及将第一细分交点和第二三角形的第三顶点相连,以对第二三角形进行网格细分,得到多个细分三角形。
如图13b中(7)所示,第一细分交点Point1的横坐标与第二三角形的第一顶点V2和第二顶点V3的横坐标相等,第二细分交点Point2的纵坐标与第二三角形的第二顶点V3和第三顶点V0的纵坐标相等。此时,图像扭曲子模块需要根据细分交点Point2和Point1对第二三角形单独进行网格细分,无需对第一三角形进行网格细分。
继续参照图13b中(7)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第一细分交点Point1和第二三角形的第三顶点V0相连,以将第二三角形Tringle1(V2-V3-V0)细分为:第一细分三角形S-Tringle1(V2-Point1-V0)、第二细分三角形S-Tringle2(Point1-Point2-V0)和第三细分三角形S-Tringle3(Point1-V3-Point2)。
在另一种实施方式中,图像扭曲子模块也可以将第一细分交点和第二细分交点相连,以及将第二细分交点和第二三角形的第一顶点相连,以对第二三角形进行网格细分,得到多个细分三角形。
如图13b中(8)所示,图像扭曲子模块将第一细分交点Point1和第二细分交点Point2相连,以及将第二细分交点Point2和第二三角形的第一顶点V2相连,以将第二三角形Tringle1(V2-V3-V0)细分为:第一细分三角形S-Tringle1(V2-Point1-Point2)、第二细分三角形S-Tringle2(Point1-V3-Point2)和第三细分三角形S-Tringle3(Point2-V0-V2)。
在如图13b中(7)和(8)所示的细分方式中,第一细分三角形S-Tringle1的起始边(V2-Point1)位于第二三角形的起始边(V2-V3)上,不会影响第二三角形的几何处理顺序,便于开发人员进行细分编程。
这样,根据上文阐述的细分策略对三角形进行细分,能够得到更小的控制单元,使得图像扭曲操作更加精细。而且,由于图像扭曲子模块根据细分交点对三角形进行网格细分的,使得Mesh中深度信息不连续的几何图形得到了细分处理,且在细分处理后得到的几何图形中深度信息不会差异过大。进而,图像扭曲子模块在对这些细分处理后的几何图形进行移动时,能够避免由于网格深度信息差异过大而使得几何图形变形严重的问题,确保图像内容的正确性,进而提升画面指令,使得预测帧图像更加接近于真实帧图像。
其中,在图像扭曲子模块根据细分交点对当前处理图形进行网格细分之后,即可根据运动矢量对标准化且细分后的当前处理图形进行图像扭曲处理。针对细分后的每个三
角形,图像扭曲子模块在其进行图像扭曲处理时,将三角形的每个顶点按照与其对应的运动矢量移动到相应的位置,以此得到图像扭曲后的三角形。
与此同时,针对每个三角形(无论是细分后得到的还是未细分的),图像扭曲子模块还可以根据三角形顶点的深度值设置三角形的深度信息。示例性的,图像扭曲子模块根据三角形各顶点的深度值进行插值处理,得到三角形内各像素点的深度值,作为该三角形的深度信息。
这样,图像扭曲子模块在基于运动矢量移动一个三角形时,可以根据该三角形的深度信息确定其与其他三角形的覆盖关系。例如,当三角形1的深度信息大于三角形2的深度信息时,则三角形1覆盖三角形2。其中,三角形2为三角形1按照相应的运动矢量移动时目标位置处的三角形。
由此,图像扭曲子模块在Mesh中移动几何图形时参照了像素深度信息,能够保证不同对象之间正确的深度先后关系。
图14示例性的示出了基于细分后的几何图形进行图像扭曲的场景示例图。如图14所示,在四边形Square(V0-V1-V2-V3)中,第一三角形Tringle1(V0-V1-V2)被细分为:细分三角形S-Tringle1(V0-V1-Point1)、细分三角形S-Tringle2(V0-Point1-PointInter)和细分三角形S-Tringle3(PointInter-Point1-V2)。第二三角形Tringle2(V2-V3-V0)被细分为:细分三角形S-Tringle1’(V2-V3-Point2)、细分三角形S-Tringle2’(V2-Point2-PointInter)和细分三角形S-Tringle3’(PointInter-Point2-V0)。
其中,S-Tringle1(V0-V1-Point1)、S-Tringle2(V0-Point1-PointInter)和S-Tringle3’(PointInter-Point2-V0)的深度信息比较一致,S-Tringle3(PointInter-Point1-V2)、S-Tringle1’(V2-V3-Point2)、S-Tringle2’(V2-Point2-PointInter)的深度信息比较一致。
在进行图像扭曲处理时,细分三角形S-Tringle1、S-Tringle2、S-Tringle3、S-Tringle1’、S-Tringle2’、S-Tringle3’分别按照与各自顶点对应的运动矢量进行移动。示例性的,S-Tringle1(V0-V1-Point1)移动至S-Tringle1(V0’-V1’-Point1’),S-Tringle2(V0-Point1-PointInter)移动至S-Tringle2(V0’-Point1’-PointInter’),S-Tringle3(PointInter-Point1-V2)移动至S-Tringle3(PointInter”-Point1”-V2”)。类似的,S-Tringle1’(V2-V3-Point2)移动至S-Tringle1’(V2”-V3”-Point2”),S-Tringle2’(V2-Point2-PointInter)移动至S-Tringle2’(V2”-Point2”-PointInter”),S-Tringle3’(PointInter-Point2-V0)移动至S-Tringle3’(PointInter’-Point2’-V0’)。
图14中(1)~(3)示例性的示出了不同的图像扭曲场景。在图14中(1)~(3)中所示的场景中,深度信息一致的三角形移动方向也比较一致,能够避免由于三角形内深度信息差异过大而使得三角形变形严重的问题。
其中,在Mesh中移动三角形时,需要根据该三角形的深度信息确定其与其他三角形的覆盖关系。以图14中(3)为例,相比于S-Tringle3(PointInter-Point1-V2)、S-Tringle1’(V2-V3-Point2)和S-Tringle2’(V2-Point2-PointInter),S-Tringle1(V0-V1-Point1)、S-Tringle2(V0-Point1-PointInter)和S-Tringle3’(PointInter-Point2-V0)的深度值更大一些。因此,在移动S-Tringle1(V0-V1-Point1)、S-Tringle2(V0-Point1-PointInter)和S-Tringle3’(PointInter-Point2-V0),以及移动S-Tringle3(PointInter-Point1-V2)、S-Tringle1’
(V2-V3-Point2)和S-Tringle2’(V2-Point2-PointInter)时,如果移动目标位置存在重叠区域,则S-Tringle1(V0’-V1’-Point1’)、S-Tringle2(V0’-Point1’-PointInter’)和S-Tringle3’(PointInter’-Point2’-V0’),会覆盖S-Tringle3(PointInter”-Point1”-V2”)、S-Tringle1’(V2”-V3”-Point2”)和S-Tringle2’(V2”-Point2”-PointInter”),以此确保图像区域对象正确的深度先后关系。
S508,图像扭曲子模块根据运动矢量对当前处理图形进行图像扭曲处理。
如果当前处理图形的细分交点的数量不为2,或者当前处理图形的细分交点的数量为2但这两个细分交点位于当前处理图形的同一条边上,则当前处理图形不满足网格细分条件,图像扭曲子模块直接对标准化的当前处理图形进行图像扭曲处理。针对当前处理图形,图像扭曲子模块分别对标准化得到的每个三角形进行图像扭曲处理。其中,图像扭曲子模块在对三角形进行图像扭曲处理时,将三角形的每个顶点按照与其对应的运动矢量移动到相应的位置,以此得到图像扭曲后的三角形。
类似的,针对未细分的每个三角形,图像扭曲子模块还可以根据顶点的深度值设置三角形的深度信息。示例性的,图像扭曲子模块根据三角形各顶点的深度值进行插值处理,得到三角形内各像素点的深度值,作为该三角形的深度信息。
这样,图像扭曲子模块在基于运动矢量移动一个三角形时,可以根据该三角形的深度信息确定其与其他三角形的覆盖关系,以保证不同对象之间正确的深度先后关系。
S509,图像扭曲子模块是否处理完当前图像帧Mesh中的所有几何图形,若是,则执行S4052,若否,则执行S504。
至此,针对当前图像帧Mesh中与静态对象对应的几何图形,图像扭曲子模块完成图像扭曲操作。
图像扭曲子模块继续针对当前图像帧Mesh中与动态对象对应的三角形完成图像扭曲操作。此时,在创建且标准化的当前图像帧Mesh中,图像扭曲子模块搜索与动态对象对应的各个三角形,并将与动态对象对应的每个三角形分别进行图像扭曲处理。
同样的,针对与动态对象对应的每个三角形,将三角形的每个顶点按照与其对应的运动矢量移动到相应的位置,以此得到图像扭曲后的三角形。
同时,针对与动态对象对应的每个三角形,图像扭曲子模块还可以根据顶点的深度值设置三角形的深度信息。示例性的,图像扭曲子模块根据三角形各顶点的深度值进行插值处理,得到三角形内各像素点的深度值,作为该三角形的深度信息。
这样,图像扭曲子模块在基于运动矢量移动一个三角形时,可以根据该三角形的深度信息确定其与其他三角形的覆盖关系,以保证不同对象之间正确的深度先后关系。
至此,针对当前图像帧中与动态对象对应的Mesh几何,图像扭曲子模块完成图像扭曲操作。也即,图像扭曲子模块完成针对当前帧图像完成了图像扭曲操作。在图像扭曲阶段操作完成之后,预测帧生成图像模块继续完成光栅化阶段、像素处理阶段的相关操作,以生成第一预测帧图像。其中,关于预测帧图像生成流程本实施例未尽详解解释之处可以参照已有技术,在此不再赘述。
在另一种可选的实施方式中,针对当前帧图像,图像扭曲子模块也可以创建三角形Mesh。此时,图像扭曲子模块可以判断三角形Mesh中的每个三角形是否需要进行网格
细分,以及如何进行网格细分和图像扭曲。其中,针对每个三角形的判断及处理流程也可以参照上文,在此不再赘述。需要指出的是,若某个三角形的细分交点数量为2,则该三角形满足网格细分条件,可以参照情形一或情形三的细分方式对该三角形进行网格细分。
在又一种可选的实施方式中,针对当前帧图像,图像扭曲子模块也可以创建多边形Mesh并进行标准化处理。此时,图像扭曲子模块可以判断多边形Mesh中的每个三角形是否需要进行网格细分,以及如何进行网格细分和图像扭曲。其中,针对每个三角形的判断及处理流程也可以参照上文,在此不再赘述。需要指出的是,若多边形Mesh中某个多边形的细分交点数量为2,则该多边形满足网格细分条件,可以参照上文情形一至情形三的细分方式对该多边形进行网格细分。
图15a示例性的示出了一种预测帧图像的示例。在如图15a所示的预测帧图像中,区域601采用已有技术方案进行图像扭曲处理,区域602采用本实施例提供的方案进行图像扭曲处理。其中,区域601和区域602仅为静态对象深度信息不连续的区域。对比区域601和区域602可知,区域601图像失真,尤其是静态对象边缘区域严重变形,而区域602的画面效果更好,静态对象边缘区域清晰,不存在静态对象边缘区域变形的现象。
图15b示例性的示出了一种预测帧图像的对比示意图。其中,图15b中(1)所示的预测帧图像是采用本实施例提供的方案进行图像扭曲处理而生成的,而图15b中(2)所示的预测帧图像是采用已有技术方案进行图像扭曲处理而生成的。图15b中(1)的区域603,与图15b中(2)的区域604是相同的图像区域,均为静态对象深度信息不连续的区域。对比图15b中(1)和(2)可知,区域604图像失真,尤其是静态对象边缘区域严重变形,而区域603的画面效果更好,静态对象边缘区域清晰,不存在静态对象边缘区域变形的现象。
S406,预测帧补全模块对第一预测帧图像进行图像补全,得到第二预测帧图像,并将第二预测帧图像发送至图像合成模块。
由于在原始视频中各个对象的移动速度不同,电子设备基于运动矢量计算得到的第一预测帧图像会出现图像信息覆盖和图像信息缺失的情况。也即,第一预测帧图像为待图像补全的预测帧图像。
由此,预测帧补全模块需要对第一预测帧图像进行图像补全,得到第二预测帧图像。其中,第二预测帧图像,即为对第一预测帧图像完成图像补全处理后得到的预测帧图像。
S407,图像合成模块将第二预测帧图像与UI信息合成,得到目标预测帧图像,并将目标预测帧图像送显。
其中,图像合成模块将第二预测帧图像和与当前真实帧图像对应的UI信息合成,以得到目标预测帧图像。
这样,在对预测帧图像完成补全处理后,将其与UI信息进行图像合成,即可得到目标预测帧图像,进而可以将目标预测帧图像输出至电子设备显示屏进行显示。
需要指出的是,上述流程仅以处理一帧预测帧图像为例进行解释说明,针对每帧预预测帧图像进行处理的流程亦是如此,不再赘述。关于目标预测帧图像的送显顺序,与
预测帧图像的插帧方式有关,可以参照已有技术,在此不再赘述。关于本流程未尽详细解释之处也可以参照已有技术,在此不再赘述。
对于高刷新率的游戏在移动平台上往往由于功耗或CPU、GPU能力的限制容易出现发热或卡顿现象,从而影响用户体验,游戏开发者为了增强游戏流畅性体验,往往会使用降低原始刷新率,再在图像空间生成预测帧,实现同帧率下渲染操作减半,从而大幅度降低智能终端功耗,减少智能终端的发热。
针对预测帧图像存在图像失真的情况,尤其是在深度信息不连续的区域静态对象边缘变形的问题,采用本申请实施例提供的图像处理方法能够较好地解决,以此提升预测帧图像的画质。这样,在渲染帧数减半的情况下能够确保游戏的流畅性不变,降低了智能终端功耗,减少了智能终端的发热,从而提升了用户的使用体验。
在其他插帧应用场景中,若图像中存在深度信息不连续(或深度差异较大)的区域,也可以采用本申请实施例提供的图像处理方法对进行图像扭曲处理,以提升预测帧图像的画质,对此不再赘述。
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的图像处理方法。
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的图像处理方法。
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的图像处理方法。
其中,本实施例提供的电子设备(如手机等)、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对
前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。
Claims (16)
- 一种图像处理方法,其特征在于,包括:获取第一图像和第二图像,并根据所述第一图像和所述第二图像计算运动矢量;其中,所述第一图像和所述第二图像为真实帧图像;创建所述第二图像的初始网格Mesh,并在所述初始Mesh中确定与静态对象对应的待细分的初始几何图形;其中,所述初始几何图形的细分交点有且只有两个,位于所述初始几何图形的边上,且每个所述初始几何图形的每个边上至多存在一个细分交点;所述细分交点是根据所述初始几何图形中像素点的深度值确定的,为静态对象的边缘像素点;根据每个所述初始几何图形的两个细分交点,分别对相应的初始几何图形进行网格细分,得到所述第二图像的目标Mesh;在所述目标Mesh中,每个所述初始几何图形的两个细分交点的连线为目标三角形的边,或者所述连线上的部分线段为目标三角形的边;其中,所述目标三角形为在所述目标Mesh中划分的几何图形;根据所述目标Mesh和所述运动矢量,对所述第二图像进行图像扭曲处理,生成与所述第一图像和所述第二图像对应的预测帧图像。
- 根据权利要求1所述的方法,其特征在于,所述初始Mesh为四边形Mesh,所述初始几何图形为四边形;在创建所述第二图像的初始Mesh之后,还包括:将所述四边形Mesh进行标准化,以将每个四边形划分为两个三角形。
- 根据权利要求2所述的方法,其特征在于,所述待细分的四边形的细分交点为第一细分交点和第二细分交点,所述待细分的四边形划分为第一三角形和第二三角形;其中,在所述目标Mesh中:所述第一三角形细分为第一子三角形、第二子三角形和第三子三角形;其中,所述第一子三角形和第二子三角形的共用边为所述第一细分交点和所述第二细分交点的连线,所述第二子三角形和第三子三角形的共用边为所述第一细分交点或所述第二细分交点与所述第一三角形顶点的连线;或者,所述第二三角形细分为第四子三角形、第五子三角形和第六子三角形;其中,所述第四子三角形和第五子三角形的共用边为所述第一细分交点和所述第二细分交点的连线,所述第五子三角形和第六子三角形的共用边为所述第一细分交点或所述第二细分交点与所述第二三角形顶点的连线;或者,所述第一三角形细分为第七子三角形、第八子三角形和第九子三角形,所述第二三角形细分为第十子三角形、第十一子三角形和第十二子三角形;其中,第七子三角形和第八子三角形的共用边为所述第一细分交点与第三点的连线,第八子三角形和第九子三角形的共用边为所述第一细分交点与所述第一三角形顶点的连线;第十子三角形和第十一子三角形的共用边为所述第二细分交点与所述第三点的连线,第十一子三角形和第十 二子三角形的共用边为所述第二细分交点与所述第二三角形顶点的连线;所述第一细分交点和所述第二细分交点的连线,与所述第一三角形和第二三角形的共用边的交点为所述第三点。
- 根据权利要求1所述的方法,其特征在于,还包括:在所述目标Mesh中,设置每个三角形的深度信息。
- 根据权利要求4所述的方法,其特征在于,根据所述目标Mesh和所述运动矢量,对所述第二图像进行图像扭曲处理,包括:针对所述目标Mesh中每个三角形,确定所述三角形各顶点的运动矢量,并根据所述三角形各顶点的运动矢量对所述三角形进行移动;在每个三角形移动至目标位置时,根据所述三角形的深度信息与所述目标位置处其他三角形的深度信息,确定所述三角形与所述目标位置处其他三角形的覆盖关系。
- 根据权利要求2所述的方法,其特征在于,所述待细分的四边形的细分交点为第一细分交点和第二细分交点,所述待细分的四边形划分为第一三角形和第二三角形;根据所述初始几何图形的两个细分交点,对所述初始几何图形进行网格细分,包括:根据所述第一细分交点和所述第二细分交点,与所述第一三角形以及与所述第二三角形的位置关系,采用匹配的网格细分策略对所述第一三角形和/或所述第二三角形进行网格细分。
- 根据权利要求6所述的方法,其特征在于,根据所述第一细分交点和所述第二细分交点,与所述第一三角形以及与所述第二三角形的位置关系,采用匹配的网格细分策略对所述第一三角形和/或所述第二三角形进行网格细分,包括:当所述第一细分交点的横坐标与所述第一三角形的第一顶点、第二顶点的横坐标相等,且所述第二细分交点的纵坐标与所述第一三角形的第二顶点、第三顶点的纵坐标相等时,连接所述第一细分交点和所述第二细分交点,以及连接所述第一细分交点和所述第一三角形的第三顶点或者连接所述第二细分交点和所述第一三角形的第一顶点,以单独将所述第一三角形细分为三个三角形。
- 根据权利要求6所述的方法,其特征在于,根据所述第一细分交点和所述第二细分交点,与所述第一三角形以及与所述第二三角形的位置关系,采用匹配的网格细分策略对所述第一三角形和/或所述第二三角形进行网格细分,包括:当所述第一细分交点的横坐标与所述第二三角形的第一顶点、第二顶点的横坐标相等,且所述第二细分交点的纵坐标与所述第二三角形的第二顶点、第三顶点的纵坐标相等时,连接所述第一细分交点和所述第二细分交点,以及连接所述第一细分交点和所述第二三角形的第三顶点或者连接所述第二细分交点和所述第二三角形的第一顶点,以单独将所述第二三角形细分为三个三角形。
- 根据权利要求6所述的方法,其特征在于,根据所述第一细分交点和所述第二细分交点,与所述第一三角形以及与所述第二三角形的位置关系,采用匹配的网格细分策略对所述第一三角形和/或所述第二三角形进行网格细分,包括:当所述第一细分交点的纵坐标与所述第一三角形的第二顶点、第三顶点的纵坐标相等,且所述第二细分交点的纵坐标与所述第二三角形的第二顶点、第三顶点的纵坐标相等时,连接所述第一细分交点和所述第二细分交点,连接所述第一细分交点和所述第一三角形的第一顶点,以及连接所述第二细分交点和所述第二三角形的第一顶点,以将所述第一三角形和所述第二三角形分别细分为三个三角形;当所述第一细分交点的横坐标与所述第一三角形的第一顶点、第二顶点的横坐标相等,且所述第二细分交点的横坐标与所述第二三角形的第一顶点、第二顶点的横坐标相等时,连接所述第一细分交点和所述第二细分交点,连接所述第一细分交点和所述第一三角形的第三顶点,以及连接所述第二细分交点和所述第二三角形的第三顶点,以将所述第一三角形和所述第二三角形分别细分为三个三角形;当所述第一细分交点的纵坐标与所述第一三角形的第二顶点、第三顶点的纵坐标相等,且所述第二细分交点的横坐标与所述第二三角形的第一顶点、第二顶点的横坐标相等时,连接所述第一细分交点和所述第二细分交点,连接所述第一细分交点和所述第一三角形的第一顶点,以及连接所述第二细分交点和所述第二三角形的第三顶点,以将所述第一三角形和所述第二三角形分别细分为三个三角形;当所述第一细分交点的横坐标与所述第一三角形的第一顶点、第二顶点的横坐标相等,且所述第二细分交点的纵坐标与所述第二三角形的第二顶点、第三顶点的纵坐标相等时,连接所述第一细分交点和所述第二细分交点,连接所述第一细分交点和所述第一三角形的第三顶点,以及连接所述第二细分交点和所述第二三角形的第一顶点,以将所述第一三角形和所述第二三角形分别细分为三个三角形。
- 根据权利要求1所述的方法,其特征在于,在所述初始Mesh中确定与静态对象对应的待细分的初始几何图形,包括:在所述初始Mesh中确定与静态对象对应的初始几何图形;确定每个所述初始几何图形的细分交点;将细分交点数量为2且每个边上至多存在一个细分交点的初始几何图形,作为所述待细分的初始几何图形。
- 根据权利要求10所述的方法,其特征在于,确定所述初始几何图形的细分交点,包括:在所述初始几何图形中确定各个边缘像素点;其中,所述边缘像素点的深度值在预设范围内,且所述边缘像素点与周围像素点的深度值之差超过预设阈值;将位于所述初始几何图形的边上的所述边缘像素点作为所述初始几何图形的细分交点。
- 根据权利要求1-11任一项所述的方法,其特征在于,所述第一图像和所述第二图像为已渲染的图像。
- 根据权利要求12所述的方法,其特征在于,所述获取第一图像和第二图像,包括:获取第一资源图像;在所述第一资源图像中分离用户界面UI信息,得到所述第一图像;获取第二资源图像;在所述第二资源图像中分离UI信息,得到所述第二图像;在生成与所述第一图像和所述第二图像对应的预测帧图像之后,还包括:对所述预测帧图像进行图像补全处理,并将补全处理后的预测帧图像和UI信息进行融合,得到目标预测帧图像。
- 根据权利要求13所述的方法,其特征在于,所述第一资源图像和所述第二资源图像为游戏应用中的资源图像。
- 一种电子设备,其特征在于,包括:一个或多个处理器;存储器;以及一个或多个计算机程序,其中所述一个或多个计算机程序存储在所述存储器上,当所述计算机程序被所述一个或多个处理器执行时,使得所述电子设备执行如权利要求1-14中任一项所述的图像处理方法。
- 一种计算机可读存储介质,包括计算机程序,其特征在于,当所述计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1-14中任一项所述的图像处理方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211444045.9 | 2022-11-18 | ||
CN202211444045.9A CN118057456A (zh) | 2022-11-18 | 2022-11-18 | 图像处理方法及电子设备 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024103872A1 true WO2024103872A1 (zh) | 2024-05-23 |
Family
ID=91068506
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/113755 WO2024103872A1 (zh) | 2022-11-18 | 2023-08-18 | 图像处理方法及电子设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN118057456A (zh) |
WO (1) | WO2024103872A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6879324B1 (en) * | 1998-07-14 | 2005-04-12 | Microsoft Corporation | Regional progressive meshes |
CN112199140A (zh) * | 2020-09-09 | 2021-01-08 | Oppo广东移动通信有限公司 | 应用插帧方法及相关装置 |
US20210366133A1 (en) * | 2019-01-11 | 2021-11-25 | Beijing Boe Optoelectronics Technology Co., Ltd. | Image frame prediction method, image frame prediction apparatus and head display apparatus |
CN114708289A (zh) * | 2020-12-16 | 2022-07-05 | 华为技术有限公司 | 一种图像帧预测的方法及电子设备 |
-
2022
- 2022-11-18 CN CN202211444045.9A patent/CN118057456A/zh active Pending
-
2023
- 2023-08-18 WO PCT/CN2023/113755 patent/WO2024103872A1/zh unknown
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6879324B1 (en) * | 1998-07-14 | 2005-04-12 | Microsoft Corporation | Regional progressive meshes |
US20210366133A1 (en) * | 2019-01-11 | 2021-11-25 | Beijing Boe Optoelectronics Technology Co., Ltd. | Image frame prediction method, image frame prediction apparatus and head display apparatus |
CN112199140A (zh) * | 2020-09-09 | 2021-01-08 | Oppo广东移动通信有限公司 | 应用插帧方法及相关装置 |
CN114708289A (zh) * | 2020-12-16 | 2022-07-05 | 华为技术有限公司 | 一种图像帧预测的方法及电子设备 |
Also Published As
Publication number | Publication date |
---|---|
CN118057456A (zh) | 2024-05-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20240037836A1 (en) | Image rendering method and apparatus, and electronic device | |
US20220291816A1 (en) | Interface display method and device | |
US20230419570A1 (en) | Image Processing Method and Electronic Device | |
CN109191549B (zh) | 显示动画的方法及装置 | |
WO2022007862A1 (zh) | 图像处理方法、系统、电子设备及计算机可读存储介质 | |
CN116055786B (zh) | 一种显示多个窗口的方法及电子设备 | |
WO2022252924A1 (zh) | 图像传输与显示方法、相关设备及系统 | |
US20230419454A1 (en) | Control blurring method and apparatus, terminal device, and readable storage medium | |
CN114911390B (zh) | 显示方法及电子设备 | |
CN113643186A (zh) | 一种图像增强方法及电子设备 | |
EP4325877A1 (en) | Photographing method and related device | |
CN111813490A (zh) | 插帧处理方法及装置 | |
CN113377479A (zh) | 应用视觉主题的切换方法、装置、存储介质及终端 | |
US20240095988A1 (en) | Method and Apparatus for Animation Transition in Application | |
CN114756184A (zh) | 协同显示方法、终端设备及计算机可读存储介质 | |
CN115934314A (zh) | 一种应用运行方法以及相关设备 | |
CN113409427A (zh) | 动画播放方法、装置、电子设备及计算机可读存储介质 | |
CN111031377B (zh) | 移动终端及视频制作方法 | |
WO2024103872A1 (zh) | 图像处理方法及电子设备 | |
CN118159341A (zh) | 一种图像帧的渲染方法及相关装置 | |
CN116708931B (zh) | 图像处理方法及电子设备 | |
WO2023280241A1 (zh) | 图像画面渲染方法及电子设备 | |
CN117082295B (zh) | 图像流处理方法、设备及存储介质 | |
CN114866641B (zh) | 一种图标处理方法、终端设备及存储介质 | |
CN116700655B (zh) | 一种界面显示方法及电子设备 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23890311 Country of ref document: EP Kind code of ref document: A1 |