Image processing method and device, electronic equipment and storage medium
By conducting depth detection and dynamic rendering of two-dimensional images to generate three-dimensional dynamic images, the problems of single image display method and high generation cost are solved, and user experience and processing efficiency are improved.
Patent Information
- Application Number
- CN202410155483.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the image display method is single, and the dynamic image generation requires the participation of designers, which increases time and labor costs, and reduces image processing efficiency.
By conducting depth detection on two-dimensional images, a depth image is generated, and the visual attribute parameters of pixel points are dynamically adjusted according to the depth value to form a three-dimensional dynamic image, and the image is three-dimensional and dynamically changed using depth detection models and rendering technology.
It enriches the image display method, improves user experience and processing efficiency, reduces labor and time costs, and realizes the automatic generation of three-dimensional dynamic images.
Smart Images

Figure CN120411192A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular, to an image processing method and apparatus, an electronic device, a storage medium, and a program product. Background Art
[0002] In different application scenarios such as video applications, music applications, and game applications, images need to be displayed to convey information, etc. For example, in a video application, a poster image of the video needs to be displayed.
[0003] In the related art, usually two-dimensional images or simple dynamic images are displayed, and the display method is relatively single. Moreover, the generation of dynamic images usually requires the participation of designers, increasing the time cost and labor cost and reducing the image processing efficiency. Summary of the Invention
[0004] Embodiments of the present application provide an image processing method and apparatus, an electronic device, a storage medium, and a program product, which can display a three-dimensional dynamic image according to a two-dimensional image, enrich the image display method, and improve the user experience and image processing efficiency.
[0005] According to one aspect of the embodiments of the present application, an image processing method is provided. The method includes:
[0006] Obtain a target image to be processed, and perform depth detection on the target image to obtain a depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image;
[0007] Render the target image to a set display area according to the depth image;
[0008] Dynamically adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image;
[0009] Render the adjusted target image to the set display area.
[0010] According to one aspect of the embodiments of the present application, an image processing apparatus is provided. The apparatus includes:
[0011] An obtaining module configured to obtain a target image to be processed, and perform depth detection on the target image to obtain a depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image;
[0012] A first rendering module configured to render the target image to a set display area according to the depth image;
[0013] An adjustment module, configured to dynamically adjust visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image, so as to obtain an adjusted target image;
[0014] A second rendering module, configured to render the adjusted target image to the set display area.
[0015] According to one aspect of the embodiments of the present application, an electronic device is provided, including:
[0016] One or more processors;
[0017] A storage device, configured to store one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the method as described above.
[0018] According to one aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor of an electronic device, causes the electronic device to implement the method as described above.
[0019] According to one aspect of the embodiments of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method as described above.
[0020] In the technical solution provided by the embodiments of the present application, first, a target image to be processed is obtained, and depth detection is performed on the target image to obtain a depth image of the target image, where the depth image includes the depth value of each pixel point in the target image. Then, according to the depth image, the target image is rendered to a set display area, so that the target image is more three-dimensional; and according to the depth value of each pixel point included in the depth image, the visual attribute parameters of each pixel point are dynamically adjusted to obtain an adjusted target image, and the adjusted target image is rendered to the set display area, thereby forming a three-dimensional dynamic image, enriching the display method, improving the user experience, and saving time and labor costs and improving the image processing efficiency.
[0021] It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a schematic diagram of an implementation environment shown in an exemplary embodiment of the present application;
[0023] Figure 2 is a flowchart of an image processing method shown in an exemplary embodiment of the present application;
[0024] Figure 3 It is a schematic diagram of a selection interface shown in an exemplary embodiment of the present application;
[0025] Figure 4 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0026] Figure 5 It is a schematic diagram of an image processing method shown in another exemplary embodiment of the present application;
[0027] Figure 6 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0028] Figure 7 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0029] Figure 8 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0030] Figure 9 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0031] Figure 10 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0032] Figure 11 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0033] Figure 12 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0034] Figure 13 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0035] Figure 14 It is a schematic diagram of the moving process of a target image shown in another exemplary embodiment of the present application;
[0036] Figure 15 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0037] Figure 16 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0038] Figure 17 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0039] Figure 18It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0040] Figure 19 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0041] Figure 20 It is a flowchart of an image processing method shown in another exemplary embodiment of the present application;
[0042] Figure 21 It is a block diagram of an image processing method shown in an exemplary embodiment of the present application;
[0043] Figure 22 It is a schematic diagram of an image processing apparatus shown in an exemplary embodiment of the present application;
[0044] Figure 23 It shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners
[0045] Now, the exemplary embodiments will be described in a more comprehensive manner with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as being limited to these examples; on the contrary, these embodiments are provided so that the present application is more comprehensive and complete, and the concept of the exemplary embodiments can be fully conveyed to those skilled in the art.
[0046] In addition, the features, structures, or characteristics described in the present application can be combined in any suitable manner in one or more embodiments. In the following description, there are many specific details so that the embodiments of the present application can be fully understood. However, those skilled in the art should be aware that when implementing the technical solutions of the present application, not all the detailed features in the embodiments are required, one or more specific details can be omitted, or other methods, elements, devices, steps, etc. can be adopted.
[0047] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0048] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0049] The flowcharts shown in the drawings are only illustrative and do not necessarily include all contents and operations / steps, nor do they have to be executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0050] It should also be noted that: "a plurality of" mentioned in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0051] The technical solutions of the embodiments of this application are introduced in detail below:
[0052] In the related art, usually two-dimensional images or simple dynamic images are displayed, and the display method is relatively single. Moreover, the generation of dynamic images usually requires the participation of designers, increasing the time cost and labor cost and reducing the image processing efficiency. Based on this, the embodiments of this application provide an image processing method, device, electronic device, storage medium, and program product, which can display three-dimensional dynamic images according to two-dimensional images, enriching the display method and improving the user experience and image processing efficiency.
[0053] Please refer to Figure 1 , Figure 1 which is a schematic diagram of an implementation environment related to this application. This implementation environment includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 communicate through a wired or wireless network. The terminal device 110 can upload its own data to the server 120 or obtain data from the server 120.
[0054] Among them, the terminal device 110 may include, but is not limited to, mobile phones, tablets, laptop computers, computers, voice interaction devices, household appliances, vehicle-mounted terminals, aircraft, remote driving terminals, etc.; the server 120 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The specific forms of the terminal device and the server are not limited herein.
[0055] It should be noted that Figure 1 the numbers of the terminal device 110 and the server 120 in are merely illustrative, and according to actual needs, there may be any number of terminal devices 110 and servers 120.
[0056] In an exemplary embodiment, the image processing method provided by the embodiments of the present application may be executed by the terminal device 110. Exemplarily, the terminal device 110 may first obtain a target image to be processed, perform depth detection on the target image to obtain a depth image of the target image, where the depth image contains the depth value of each pixel point in the target image. Then, according to the depth image, the target image is rendered to a set display area; and according to the depth value of each pixel point included in the depth image, the visual attribute parameters of each pixel point are dynamically adjusted to obtain an adjusted target image, and the adjusted target image is rendered to the set display area, thereby forming a three-dimensional dynamic image, enriching the display method, improving the visual display effect and user experience, and moreover, the three-dimensional dynamic image can be automatically generated by an algorithm, and there is no need to perform three-dimensional modeling, etc., improving the image processing efficiency.
[0057] In another exemplary embodiment, the server 120 may have a function similar to that of the terminal device 110, so as to execute the image processing method provided by the embodiments of the present application. Exemplarily, the server 120 may first obtain a target image to be processed, perform depth detection on the target image to obtain a depth image of the target image, where the depth image contains the depth value of each pixel point in the target image. Then, according to the depth image, the target image is rendered to a set display area; and according to the depth value of each pixel point included in the depth image, the visual attribute parameters of each pixel point are dynamically adjusted to obtain an adjusted target image, and the adjusted target image is rendered to the set display area.
[0058] In another exemplary embodiment, the terminal device 110 and the server 120 may also jointly execute the image processing method provided by the embodiments of the present application. Exemplarily, after obtaining the target image to be processed, the server 120 may perform depth detection on the target image to obtain the depth image of the target image, and then send the target image and the depth image of the target image to the terminal device 110; the terminal device 110 renders the target image to the set display area according to the depth image, and dynamically adjusts the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain the adjusted target image, and renders the adjusted target image to the set display area.
[0059] The image processing method in the embodiments of the present application can be applied to image display scenarios in various applications. For example, the display of posters in applications such as video, education, tourism, games, information, browsers, and audiobooks. These applications can be installed in in-vehicle terminals or other devices such as mobile phones. The applications include, but are not limited to, native applications, non-native applications, applets, web applications, etc. In the embodiments of the present application, data related to users such as target images and data detected by the angular velocity detection device are involved. When the method of the present application is applied to specific products or technologies, they are all obtained with the permission or consent of the user, and the extraction, use, and processing of relevant data comply with local safety standards and local laws and regulations.
[0060] See Figure 2 , Figure 2 is a flowchart of an image processing method shown in an exemplary embodiment of the present application. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in the implementation environment shown by Figure 1 or can be executed by the server 120 in the implementation environment shown by Figure 1 or can be jointly executed by the terminal device 110 and the server 120 in the implementation environment shown by Figure 1 shown.
[0061] As Figure 2 shown, in an exemplary embodiment, the image processing method may include steps S210 - S240, which are introduced in detail as follows:
[0062] Step S210, obtain the target image to be processed, and perform depth detection on the target image to obtain the depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image.
[0063] It should be noted that the target image refers to any two-dimensional image that needs to be processed. For example, it can be an image, a video frame, etc. Depending on the application scenario, the type of the target image is different. For example, if it is applied to poster display, the target image can be a poster image of a video, a novel, music, a commodity, an advertisement, etc.
[0064] To make the target image more three-dimensional, the depth value of each pixel point in the target image can be detected, and a depth image corresponding to the target image can be constructed according to the depth value of each pixel point in the target image. Among them, the pixel points in the depth image correspond one by one to the pixel points in the target image, and the pixel value of each pixel point in the depth image represents the depth value. Optionally, the depth image can be a grayscale image, and the grayscale value of each pixel point in the depth image characterizes the depth value of the corresponding pixel point in the target image; or, the depth image can also be a color image, and the depth value can be calculated according to the color value of each pixel point in the depth image. For example, the grayscale value of each pixel point in the depth image can be calculated according to the color value of each pixel point in the depth image, and this grayscale value is the depth value.
[0065] Among them, the specific method of depth detection can be flexibly set according to actual needs. In an optional example, a depth detection model can be pre-trained, and the target image can be depth-detected through the depth detection model to obtain the depth image of the target image. Among them, the depth detection model takes a two-dimensional image as the input and the depth image of the two-dimensional image as the output, and is used to detect the depth data of the two-dimensional image. Its model types include but are not limited to at least one of convolutional neural networks (Convolutional Neural Networks, CNN), recurrent neural networks, etc. The convolutional neural network includes but is not limited to at least one of residual networks (Residual Network, ResNet), visual geometry group networks (Visual Geometry Group Network, VGG), semantic segmentation networks (U-Net), etc. Optionally, to improve the model performance, the depth detection model can include feature extraction networks of different scales, so as to extract features of different scales from the two-dimensional image, fuse the features of different scales, and perform depth detection based on the fused features, so as to capture scene structures of different scales; optionally, the depth detection model can include an attention mechanism, so that the model automatically focuses on important regions during the training process; the depth detection model can include residual connections and skip connections to accelerate the training process and reduce the problem of gradient disappearance; the depth detection model can also include a batch normalization layer to accelerate the training process and improve the model performance.
[0066] To obtain a depth detection model, a large number of two-dimensional images and the corresponding depth images can be collected from different sources (e.g., public datasets, web images, professional photography, etc.). Then, the two-dimensional images and the corresponding depth images are preprocessed, and the preprocessed two-dimensional images and depth images are divided into a test dataset, a validation dataset, and a training dataset. The trained depth detection model is tested using the test dataset, the function of the depth detection model is verified using the validation dataset, and the initial depth detection model is trained using the training dataset to obtain a trained depth detection model.
[0067] Among them, to improve the generalization performance of the model, the collected two-dimensional images can include different scenes and contents; the depth images can be obtained through devices such as depth cameras (e.g., Kinect), lidar, etc., or can be obtained by processing multiple two-dimensional images taken from different perspectives of the same scene using multi-view stereo algorithms. The ways to preprocess the two-dimensional images and the corresponding depth images include but are not limited to at least one of the following ways: performing operations such as scaling, cropping, and rotating on the two-dimensional images to increase the robustness of the model; normalizing the depth values included in the depth images so that the depth values are within a set numerical range, for example, greater than or equal to 0 and less than or equal to 1; performing data augmentation on the two-dimensional images, where the ways of data augmentation include but are not limited to flipping, adding noise, adjusting brightness and contrast, etc., to improve the generalization ability of the model.
[0068] Optionally, at least one of the following loss functions can be used to calculate the loss between the true depth image of the two-dimensional image and the predicted depth image of the two-dimensional image detected by the depth detection model: a. Mean Squared Error (MSE), which is used to measure the square of the average difference between the predicted depth image and the true depth image; b. Mean Absolute Error (MAE), which is used to measure the absolute value of the average difference between the predicted depth image and the true depth image; c. Structural Similarity (SSIM), which is used to measure the structural, contrast, and brightness similarity between the predicted depth image and the true depth image. Optionally, if at least two loss functions are included, the loss values calculated by these two loss functions can be weighted and summed to obtain the final loss value, where the weight values corresponding to the loss functions can vary dynamically according to the application scenario.
[0069] Optionally, during the training process of the depth detection model, the Early Stopping strategy can be used. That is to say, after each training of the depth detection model, the depth detection model after this training can be verified through the validation dataset to obtain the performance of the depth detection model, and the performance of the depth detection model before this training can be obtained by verifying it through the validation dataset. If the performance has not improved or the improvement amplitude is small compared with before this training, the training can be stopped to avoid overfitting.
[0070] Optionally, during the training process of the depth detection model, the generalization ability of the model can also be evaluated through Cross Validation.
[0071] Optionally, through Data Parallelism and Model Parallelism technologies, the model can be trained using a multi-core Central Processing Unit (CPU) and multiple Graphics Processing Units (GPUs) to improve the model training efficiency.
[0072] Step S220: Render the target image to the set display area according to the depth image.
[0073] The set display area refers to the area used to display the target image. For example, if the target image is an advertising poster, the set display area can be the advertising space on the page.
[0074] Displaying the target image in the set display area according to the depth image of the target image can enhance the three-dimensional sense of the displayed target image and make the two-dimensional image three-dimensional.
[0075] Optionally, before step S220, it can also be determined whether a conversion instruction corresponding to the target image is received. If so, step S220 and subsequent steps are executed; if not, the target image is directly rendered to the set display area. Optionally, a selection interface for the target image can be displayed. The selection interface includes a control for selecting the target image and a control for selecting whether to convert the target image from a two-dimensional image to a three-dimensional image. If the user selects to convert the target image from a two-dimensional image to a three-dimensional image, step S220 and subsequent steps are executed to display the three-dimensional dynamic image corresponding to the target image in the set display area; for example, see Figure 3 as shown Figure 3It is an exemplary selection interface. The user can select a target image through two controls, namely "Please select an image" and "Please enter an image link", and can select whether to convert the target image from a 2D image to a 3D image through the "Yes" and "No" controls for 2D to 3D conversion.
[0076] Step S230: Dynamically adjust the visual attribute parameters of each pixel point included in the depth image according to the depth value of each pixel point to obtain an adjusted target image.
[0077] The visual attribute parameters refer to the parameters that can affect the visual viewing effect, including but not limited to at least one of color value, brightness value, position, etc.
[0078] After rendering the target image to the set display area, in order to attract users, the target image displayed in the set display area can be controlled to change dynamically. Among them, for each pixel point in the target image, its visual attribute parameters can be dynamically adjusted according to its depth value, so as to obtain an adjusted target image. Since the visual attribute parameters of each pixel point are adjusted according to the depth value of the pixel point, it can cause a parallax between the foreground and the background, making the adjusted target image more three-dimensional.
[0079] Step S240: Render the adjusted target image to the set display area.
[0080] Use the adjusted target image to replace the target image before adjustment, so as to display the adjusted target image in the set display area, making the target image displayed in the set display area not only three-dimensional but also dynamically changing, which can attract the user's attention more. That is to say, the image displayed in the set display area is a 3D dynamic image.
[0081] Optionally, the target image and the adjusted target image can be rendered using a shader in the Open Graphics Library (OpenGL) or Metal rendering. Among them, OpenGL is an application programming interface for rendering 2D and 3D images; Metal rendering is an application programming interface for low-level rendering.
[0082] Optionally, during the process of rendering the target image and the adjusted target image, multi-threading technology and GPU acceleration functions can be used to distribute the rendering tasks to multiple processor cores or GPUs, thereby improving the rendering performance.
[0083] In Figure 2In the illustrated embodiment, depth detection is performed on the target image to obtain the depth image of the target image. Based on the depth image, the target image is rendered to a set display area, making the target image more three-dimensional. Then, according to the depth value of each pixel point included in the depth image, the visual attribute parameters of each pixel point are dynamically adjusted to obtain the adjusted target image, and the adjusted target image is rendered to the set display area, thus forming a three-dimensional dynamic image, enriching the display method, enhancing the user experience, and saving time and labor costs, improving the image processing efficiency.
[0084] In an exemplary embodiment, refer to Figure 4 , Figure 4 which is Figure 2 a flowchart of an image processing method proposed based on what is shown in Figure 1 The method can be applied to the Figure 1 illustrated implementation environment, which can be executed by the terminal device 110 in the Figure 1 illustrated implementation environment, or can be executed by the server 120 in the Figure 1 illustrated implementation environment, or can also be jointly executed by the terminal device 110 and the server 120 in the
[0085] As Figure 4 shown, step S220 may include steps S410 - S420, which are introduced in detail as follows:
[0086] Step S410: Perform dilation processing on the depth image to obtain the dilated depth image.
[0087] Perform dilation processing on the depth image, and use the dilated depth image after the dilation processing as the dilated depth image, so as to expand or shrink the corresponding part of the foreground area in the depth image, and avoid distortion of the foreground area during the process of rendering the target image to the set display area according to the depth image.
[0088] Step S420: Render the target image to the set display area according to the dilated depth image.
[0089] Render the target image to the set display area according to the depth data of the target image included in the dilated depth image, so as to avoid distortion of the foreground elements in the target image during the rendering process.
[0090] It should be noted that Figure 4 the specific implementation details of step S210, steps S230 - S240 shown in Figure 2 can refer to step S210, steps S230 - S240 shown in
[0091] Herein, they will not be elaborated further. Figure 4In the illustrated embodiment, before rendering the target image to the set display area, the depth image of the target image is first dilated to expand or shrink the foreground area in the depth image, avoiding distortion of the foreground in the target image during the process of rendering the target image based on the depth image and improving the display effect.
[0092] In one exemplary embodiment, refer to Figure 5 , Figure 5 which is Figure 4 a flowchart of an image processing method proposed based on what is shown in Figure 1 The illustrated implementation environment, which can be executed by the terminal device 110 in the Figure 1 illustrated implementation environment, can also be executed by the server 120 in the Figure 1 illustrated implementation environment, or, can also be jointly executed by the terminal device 110 and the server 120 in the Figure 1 illustrated implementation environment.
[0093] As Figure 5 shown, step S410 may include steps S510 - S540, which are introduced in detail as follows:
[0094] Step S510, obtain the dilation parameter and dilation distance corresponding to the depth image; wherein, the dilation distance is positively correlated with the size of the depth image.
[0095] Among them, the dilation parameter is the parameter that needs to be used during the dilation process, and the specific value of the dilation parameter can be flexibly set according to actual needs. The dilation distance is used to determine the reference pixel corresponding to each pixel point. Among them, the distance between each pixel point and its corresponding reference pixel point is less than or equal to the dilation distance, and the dilation distance can be positively correlated with the size of the depth image; optionally, the dilation distance can include a horizontal dilation distance and a vertical dilation distance. The distance between each pixel point and its corresponding reference pixel point in the horizontal direction is less than the horizontal dilation distance, and the distance in the vertical direction is less than the vertical dilation distance. Among them, the horizontal direction refers to the width direction of the image, and the vertical direction refers to the height direction of the image. The horizontal dilation distance is positively correlated with the width of the depth image, and the vertical dilation distance is positively correlated with the height of the image.
[0096] In an optional example, the horizontal dilation distance and the vertical dilation distance can be obtained in the following way: calculate the dilation step according to the set maximum radius and the dilation parameter; determine the horizontal dilation distance according to the ratio of the dilation step to the width of the depth image, and determine the vertical dilation distance according to the ratio of the dilation step to the height of the texture image; wherein, the calculation formulas for the dilation step, the horizontal dilation distance, and the vertical dilation distance are as follows:
[0097] dilationStep = abs(dilation) / MAX_RADIUS
[0098] px_w = dilationStep / widthPx
[0099] px_h = dilationStep / heightPx
[0100] Among them, dilationStep is the dilation step size, dilation is the dilation parameter, abs(dilation) is the absolute value of the dilation parameter, MAX_RADIUS is the maximum radius, px_w is the horizontal dilation distance, px_h is the vertical dilation distance, widthPx is the width of the depth image, and heightPx is the height of the depth image.
[0101] Step S520: According to the dilation distance, find multiple reference pixel points corresponding to each pixel point in the depth image; among them, the distance between the reference pixel point and each pixel point in the depth image is less than or equal to the dilation distance.
[0102] For each pixel point in the depth image, traverse the pixel points whose distance from it is less than or equal to the dilation distance in the depth image, and take the found pixel points as the reference pixel points of this pixel point. That is to say, the distance between each pixel point and its corresponding reference pixel point is less than or equal to the dilation distance.
[0103] Optionally, if the dilation distance includes the horizontal dilation distance and the vertical dilation distance, then the horizontal distance between each pixel point and its corresponding reference pixel point is less than or equal to the horizontal dilation distance, and the vertical distance is less than or equal to the vertical dilation distance.
[0104] Step S530: Obtain the original depth values corresponding to multiple reference pixel points from the depth image, and select target reference pixel points from the multiple reference pixel points according to the dilation parameter and the original depth values corresponding to the multiple reference pixel points respectively.
[0105] Take the depth value of the pixel point in the depth image as the original depth value. For each pixel point in the depth image, a target reference pixel point can be selected from its corresponding multiple reference pixel points, where the target reference pixel point is selected according to the dilation parameter and the original depth values corresponding to the multiple reference pixel points respectively, and the specific selection method can be flexibly set according to actual needs.
[0106] Step S540: Take the original depth value corresponding to the target reference pixel point as the target depth value of each pixel point in the depth image, and update the depth value of each pixel point in the depth image according to the target depth value to obtain the dilated depth image.
[0107] The target depth value refers to the updated depth value. For each pixel point in the depth image, the original depth value of its corresponding target reference pixel point is used as the target depth value. That is to say, the depth value of each pixel point is updated to the original depth value of its corresponding target reference pixel point.
[0108] It should be noted that Figure 5 The specific implementation details of the steps S210, S230 - S240 shown can be referred to Figure 2 the steps S210, S230 - S240 shown Figure 5 The specific implementation details of the step S420 shown can be referred to Figure 4 the step S420 shown, which will not be elaborated here.
[0109] In Figure 5 the embodiment shown, by dilating the depth value of each pixel point in the depth image according to the dilation distance and dilation parameter, the dilation accuracy can be improved.
[0110] In an exemplary embodiment, referring to Figure 6 , Figure 6 is a flowchart of an image processing method proposed based on Figure 5 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in Figure 1 the implementation environment shown, or can be executed by the server 120 in Figure 1 the implementation environment shown, or, alternatively, can be jointly executed by the terminal device 110 and the server 120 in Figure 1 the implementation environment shown.
[0111] As Figure 6 shown, step S530 may include steps S610 - S630, which are introduced in detail as follows:
[0112] Step S610, obtaining the original depth values corresponding to multiple reference pixel points from the depth image.
[0113] Among them, the original depth value of each reference pixel point can be sampled from the depth image according to the coordinates of each reference pixel point.
[0114] Step S620, if the dilation parameter is greater than or equal to the set parameter threshold, then the pixel point with the largest original depth value among the multiple reference pixel points is used as the target reference pixel point.
[0115] The set parameter threshold is used to select the target reference pixel point. Among them, if the dilation parameter is greater than or equal to the set parameter threshold, then the pixel point with the largest original depth value is selected from the multiple reference pixel points, and the selected pixel point is used as the target reference pixel point.
[0116] Among them, the specific value of the set parameter threshold can be flexibly set according to actual needs. For example, it can be set to 0, that is, if the dilation parameter is positive, the reference pixel point with the largest original depth value is selected as the target reference pixel point.
[0117] In step S630, if the dilation parameter is less than the set parameter threshold, the pixel point with the smallest depth value among the multiple reference pixel points is used as the target reference pixel point.
[0118] If the dilation parameter is less than the set parameter threshold, the pixel point with the smallest original depth value can be selected from the multiple reference pixel points, and the selected pixel point is used as the target reference pixel point. For example, if the set parameter threshold is 0, under the condition that the dilation parameter is negative, the reference pixel point with the smallest original depth value is selected as the target reference pixel point.
[0119] It should be noted that Figure 6 The specific implementation details of the shown step S210, step S230 - step S240 can be referred to Figure 2 The shown step S210, step S230 - step S240 Figure 6 The specific implementation details of the shown step S420 can be referred to Figure 4 The shown step S420 Figure 6 The specific implementation details of the shown step S510 - step S520, step S540 can be referred to Figure 5 The shown step S510 - step S520, step S540, which will not be elaborated here.
[0120] In Figure 6 In the shown embodiment, selecting the reference pixel point with the smallest or largest original depth value as the target reference pixel point according to the dilation parameter can improve the dilation effect, and the dilation effect can be adjusted by adjusting the dilation parameter, further improving the controllability of the dilation process.
[0121] In an exemplary embodiment, referring to Figure 7 , Figure 7 is a flowchart of an image processing method proposed on the basis of Figure 2 shown. This method can be applied to Figure 1 the shown implementation environment, which can be executed by the terminal device 110 in Figure 1 the shown implementation environment, or can be executed by the server 120 in Figure 1 the shown implementation environment, or, can also be jointly executed by the terminal device 110 and the server 120 in Figure 1 the shown implementation environment.
[0122] Such as Figure 7As shown, step S220 may include steps S710 - S730, which are introduced in detail as follows:
[0123] Step S710, obtain the texture image of the target image; the texture image contains the color value of each pixel point in the target image.
[0124] The texture image of the target image is the texture representation of the target image, which contains the color value of each pixel point in the target image. In the texture image, the texture coordinates of each pixel point are within a set range, for example, [0, 1].
[0125] Step S720, perform depth perspective processing on the texture image according to the depth image to obtain a perspective texture image.
[0126] From the depth image of the target image, the depth value of each pixel point in the texture image of the target image can be obtained. Perform depth perspective processing on the texture image according to the depth image, and use the processed texture image as the perspective texture image, so that the perspective texture image is more three - dimensional visually.
[0127] Optionally, the depth image after dilation processing (i.e., the dilated depth image) can also be used to perform depth perspective processing on the texture image to obtain a perspective texture image.
[0128] Step S730, map the perspective texture image to a set display area.
[0129] After obtaining the perspective texture image, map the perspective texture image to a set display area, so as to display the target image in the set display area, making the target image displayed in the set display area more three - dimensional.
[0130] It should be noted that Figure 7 The specific implementation details of the steps S210, S230 - S240 shown can refer to Figure 2 The steps S210, S230 - S240 shown, which will not be elaborated here.
[0131] In Figure 7 In the embodiment shown, performing depth perspective processing on the texture image of the target image according to the depth image can make the processed target image more three - dimensional and improve the display effect.
[0132] In an exemplary embodiment, refer to Figure 8 , Figure 8 is a flowchart of an image processing method proposed based on Figure 7 shown. This method can be applied to Figure 1 the implementation environment shown, which can be composed of Figure 1It can be executed by the terminal device 110 in the shown implementation environment, or can be executed by Figure 1 the server 120 in the shown implementation environment, or, can also be jointly executed by Figure 1 the terminal device 110 and the server 120 in the shown implementation environment.
[0133] As Figure 8 shown, step S720 may include steps S810 - S840, and the details are introduced as follows:
[0134] Step S810, obtain the depth value of each pixel point in the texture image from the depth image, and obtain the scaling ratio and offset corresponding to the texture image.
[0135] Among them, the scaling ratio corresponding to the texture image of the target image refers to the ratio of scaling the texture image during the depth perspective process of the texture image; the offset of the texture image of the target image refers to the offset distance of the texture image during the depth perspective process of the texture image. Among them, the specific values of the scaling ratio and the offset can be flexibly set according to actual needs.
[0136] The depth image contains the depth value of each pixel point in the texture image of the target image. Therefore, the depth value of each pixel point can be found from the depth image.
[0137] In an optional implementation manner, during the process of obtaining the depth value of each pixel point in the texture image of the target image, the original texture coordinates of each pixel point in the texture image of the target image can be obtained, and sampling is performed in the depth image according to the original texture coordinates, and the depth value of each pixel point is calculated according to the sampled value; among them, the grayscale value of the pixel point can be used to represent the depth value. Under this condition, the depth value of each pixel point in the texture image can be obtained through the following formula:
[0138] depthValue = grayscale(color(displacementMap(TextureCoord)))
[0139] Among them, depthValue is the depth value of the pixel point, TextureCoord refers to the original texture coordinates of the pixel point, color(displacementMap(TextureCoord)) refers to the color value obtained by sampling in the depth image using the original texture coordinates, and grayscale(x) is a function that converts the color value to a grayscale value.
[0140] Optionally, a depth texture image corresponding to the depth image can be obtained, and the depth value of each pixel can be sampled from the depth texture image according to the original texture coordinates of each pixel. Since both the depth texture image and the texture image of the target image are in the texture coordinate system, the original texture coordinates do not need to be converted, and the original texture coordinates can be directly used for sampling in the depth texture image, improving the sampling efficiency. The depth texture image is a texture representation of the depth image and contains the depth values of each pixel in the depth image.
[0141] Step S820: Calculate the movement vector of each pixel in the texture image according to the scaling ratio, the offset, and the depth value of each pixel in the texture image.
[0142] For each pixel in the texture image, the movement vector of the pixel can be calculated according to the scaling ratio, the offset, and the depth value of the pixel. The movement data may include a movement distance, and the movement distance includes a horizontal movement distance and a vertical movement distance. Optionally, the movement distance can be positively correlated with the scaling ratio, positively correlated with the offset, positively correlated or negatively correlated with the depth value of the pixel. That is, the depth values of each pixel are different, and the corresponding movement distances are different, so that the movement amplitudes of the foreground and the background are different, thereby forming a parallax, making the moved texture image more three-dimensional in visual effect.
[0143] Optionally, the product of the scaling ratio, the offset, and the depth value of each pixel in the texture image can be used as the movement vector of each pixel in the texture image.
[0144] Step S830: Obtain the original texture coordinates of each pixel in the texture image from the texture image, and calculate the target texture coordinates of each pixel in the texture image according to the movement vector and the original texture coordinates of each pixel in the texture image.
[0145] For each pixel in the texture image of the target image, the texture coordinates of the pixel in the texture image are used as the original texture coordinates. According to the original texture coordinates and the movement vector of the pixel, the new texture coordinates of the pixel, that is, the target texture coordinates, can be calculated.
[0146] In an optional example, the target texture coordinates of each pixel can be calculated by the following formula:
[0147] newTextureCoord = TextureCoord + depthValue * scale * offset
[0148] Among them, newTextureCoord is the target texture coordinate of the pixel point, scale is the scaling ratio, and offset is the offset amount.
[0149] Step S840: Move each pixel point in the texture image according to the target texture coordinate of each pixel point in the texture image to obtain a perspective texture map.
[0150] After obtaining the target texture coordinates of each pixel point in the texture image of the target image, move each pixel point according to the target texture coordinates, and use the texture image after the pixel points are moved as the perspective texture image. Since the moving distance of each pixel point in the perspective texture image is related to its corresponding depth value, the perspective texture image can be made more three-dimensional in visual effect.
[0151] It should be noted that Figure 8 The specific implementation details of the shown step S210 and steps S230 - S240 can be referred to Figure 2 the shown step S210 and steps S230 - S240 Figure 8 The specific implementation details of the shown step S710 and steps S730 can be referred to Figure 7 the shown step S710 and steps S730, which will not be elaborated here.
[0152] In Figure 8 the shown embodiment, during the depth perspective processing, migrating the pixel points according to the scaling ratio, offset, and the depth value of each pixel point in the texture image can improve the accuracy of the depth perspective processing and enhance the three-dimensional effect of the target image.
[0153] In an exemplary embodiment, referring to Figure 9 , Figure 9 is a flowchart of an image processing method proposed based on Figure 2 shown. This method can be applied to Figure 1 the shown implementation environment, which can be executed by the terminal device 110 in Figure 1 the shown implementation environment, or can be executed by the server 120 in Figure 1 the shown implementation environment, or, alternatively, can be jointly executed by the terminal device 110 and the server 120 in Figure 1 the shown implementation environment.
[0154] As Figure 9 shown, step S230 may include step S910, which is introduced in detail as follows:
[0155] Step S910: In response to an adjustment operation on the target image, adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image, and obtain the adjusted target image.
[0156] The adjustment operation on the target image is used to adjust the target image. The adjustment operation refers to the user operation detected through the user input interface on the image processing device. Here, the image processing device is used to control the rotation of the target image, and it can be the device to which the set display area belongs. The user input interface includes but is not limited to physical buttons, touch screen areas, and other sensor devices capable of detecting user operations. Correspondingly, the adjustment operation includes but is not limited to the operation of touching physical buttons, the operation of touching the touch screen area (i.e., touch operation), the operation detected through sensor devices, etc.; among them, physical buttons include but are not limited to the power on / off button, volume increase / decrease buttons, mute button, etc., and the touch operation includes but is not limited to click operation, double click operation, long press operation (press operation with a pressing duration reaching the corresponding duration threshold), swipe touch operation, hard press operation (press operation with a pressing pressure reaching the corresponding pressure threshold), etc. The sensor device includes but is not limited to an angular velocity detection device (e.g., gyroscope, etc.), an infrared sensor, etc. Through the angular velocity detection device, it can be detected whether the user rotates the image processing device, as well as the rotation angle and rotation direction, so as to adjust the target image according to the rotation angle and rotation direction; through the infrared sensor, the distance and orientation between the image processing device and the user can be detected, so as to adjust the target image according to the distance and orientation, etc. In an optional example, the movement and scaling of the target image can be controlled according to the user's movement direction and distance, as well as the depth image. For example, if the infrared sensor detects that the user approaches the image processing device, the target image can be enlarged, and if it detects that the user moves away from the image processing device, the target image can be reduced, etc.
[0157] After detecting the adjustment operation on the target image, for each pixel point in the target image, the depth value of this pixel point can be obtained from the depth image, and the visual attribute parameters of this pixel point are adjusted according to the obtained depth value to obtain the adjusted target image, so as to display the adjusted target image in the set display area. That is to say, the image displayed in the set display area can change according to the user's operation, thereby enhancing the interactivity. Moreover, during the adjustment process, the depth image of the image will be referred to, so that the displayed image is more three-dimensional, and a dynamically changing three-dimensional image is obtained.
[0158] It should be noted that Figure 9 The specific implementation details of the shown Step S210 - Step S220 and Step S240 can refer to Figure 2 the shown Step S210 - Step S220 and Step S240, which will not be elaborated here.
[0159] In Figure 9 the illustrated embodiment, the target image can be adjusted according to the user's adjustment operation, improving the interactivity and thus enhancing the user experience.
[0160] Refer to Figure 10 , Figure 10 which is a flowchart of an image processing method proposed based on what is shown in Figure 9 . This method can be applied to the implementation environment shown in Figure 1 , which can be executed by the terminal device 110 in the implementation environment shown in Figure 1 , or can be executed by the server 120 in the implementation environment shown in Figure 1 , or, can also be jointly executed by the terminal device 110 and the server 120 in the implementation environment shown in Figure 1 .
[0161] As Figure 10 shown, step S910 may include steps S1010 - S1030, which are introduced in detail as follows:
[0162] Step S1010, calculate the rotation parameters in response to the data detected by the angular velocity detection device; wherein, the angular velocity detection device includes a gyroscope.
[0163] The angular velocity detection device is used to detect the attitude, rotation angle, etc., of the device, including but not limited to a gyroscope. Optionally, the adjustment operation corresponding to the target image can be the operation detected by the angular velocity detection device, and wherein, the rotation parameters of the image processing device can be calculated according to the data detected by the angular velocity detection device. Among them, the rotation parameters may include data such as the rotation direction and rotation angle
[0164] Step S1020, calculate the rotation vector of each pixel point according to the rotation parameters and the depth value of each pixel point included in the depth image.
[0165] For each pixel point in the target image, the rotation vector of the pixel point can be calculated according to the rotation parameters and the depth value of the pixel point, so as to control the rotation of the target image according to the rotation vector. Among them, the rotation vector may include the rotation direction and rotation angle, the rotation direction in the rotation vector may be the same as or opposite to the rotation direction in the rotation parameters, the rotation angle in the rotation vector may be positively or negatively correlated with the rotation angle in the rotation parameters, and the rotation angle in the rotation vector may be positively or negatively correlated with the depth value of the pixel point, so that there is a difference in the rotation amplitude between the foreground and the background in the target image, forming a parallax and making the target image more three-dimensional.
[0166] Step S1030: Move each pixel point according to the rotation vector of each pixel point to obtain an adjusted target image.
[0167] For each pixel point in the target image, after determining its rotation vector, it can be moved to rotate the target image and obtain an adjusted target image.
[0168] It should be noted that Figure 10 The specific implementation details of the steps S210 - S220 and step S240 shown can be referred to Figure 2 The steps S210 - S220 and step S240 shown, which will not be elaborated here.
[0169] In Figure 10 the shown embodiment, the target image can be rotated according to the data detected by the angular velocity detection device, thereby increasing the interaction channels, enhancing the interaction interest, and further improving the satisfaction; and during the rotation process, the rotation vector of each pixel point is calculated according to the depth value of the pixel point, which can make the rotation amplitudes of the foreground and background different, thus making the target image more three - dimensional.
[0170] In an exemplary embodiment, referring to Figure 11 , Figure 11 is a flowchart of an image processing method proposed based on Figure 9 shown. This method can be applied to the implementation environment shown in Figure 1 and can be executed by the terminal device 110 in the implementation environment shown in Figure 1 , or can be executed by the server 120 in the implementation environment shown in Figure 1 , or can be jointly executed by the terminal device 110 and the server 120 in the implementation environment shown in Figure 1 shown.
[0171] As Figure 11 shown, step S910 can include step S1110, which is introduced in detail as follows:
[0172] Step S1110: In response to a touch operation on the target image, adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image.
[0173] The adjustment operation for the target image can be a touch operation. After detecting a touch operation for adjusting the target image, for each pixel point in the target image, its visual attribute parameters can be adjusted according to its depth value. For example, adjust the position, color value, brightness value, etc. of the pixel point. Among them, the adjustment amplitude can be positively or negatively correlated with the depth value.
[0174] It should be noted that Figure 11 The specific implementation details of steps S210 - S220 and step S240 shown can be referred to Figure 2 Steps S210 - S220 and step S240 shown, which will not be elaborated here.
[0175] In Figure 11 the embodiment shown, the target image can be adjusted according to the touch operation, enhancing the interaction channel and user experience.
[0176] In an exemplary embodiment, referring to Figure 12 , Figure 12 it is a flowchart of an image processing method proposed based on Figure 11 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in Figure 1 the implementation environment shown, or can be executed by the server 120 in Figure 1 the implementation environment shown, or, alternatively, can be jointly executed by the terminal device 110 and the server 120 in Figure 1 the implementation environment shown.
[0177] As Figure 12 shown, step S1110 can include steps S1210 - S1230, which are introduced in detail as follows:
[0178] Step S1210, in response to a sliding touch operation on the target image, obtain the sliding direction and sliding distance of the sliding touch operation.
[0179] The touch operation for adjusting the target image can be a sliding touch operation. After detecting the sliding touch operation for adjusting the target image, the sliding direction and sliding distance of this sliding touch operation can be obtained.
[0180] Step S1220, according to the sliding direction, sliding distance, and the depth value of each pixel point included in the depth image, calculate the movement vector of each pixel point.
[0181] For each pixel point in the target image, the movement vector of this pixel point can be calculated according to the sliding direction and sliding distance of the sliding touch operation, and the depth value of this pixel point. Among them, the movement vector includes a movement direction and a movement distance. The movement direction can be the same as or opposite to the sliding direction of the sliding touch operation, and the movement distance can be positively or negatively correlated with the sliding distance of the sliding touch operation, and the movement distance can be positively or negatively correlated with the depth value of the pixel point.
[0182] Step S1230, according to the movement vector of each pixel point, move each pixel point to obtain the adjusted target image.
[0183] After calculating the motion vector of each pixel point in the target image, each pixel point can be moved according to the motion vector to obtain the adjusted target image.
[0184] It should be noted that Figure 12 For the specific implementation details of the steps S210 - step S220 and step S240 shown, reference can be made to Figure 2 the steps S210 - step S220 and step S240 shown, which will not be elaborated here.
[0185] In Figure 12 the embodiment shown, the target image can be moved according to the sliding touch operation. Moreover, during the moving process, the motion vector of each pixel point is determined according to the depth value of each pixel point, so that the moving amplitudes of the foreground and the background are different, forming a parallax, making the target image more three - dimensional.
[0186] In an exemplary embodiment, referring to Figure 13 , Figure 13 is a flowchart of an image processing method proposed based on Figure 9 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in Figure 1 the implementation environment shown, or can be executed by the server 120 in Figure 1 the implementation environment shown, or, can also be jointly executed by the terminal device 110 and the server 120 in Figure 1 the implementation environment shown.
[0187] As Figure 13 shown, step S910 may include steps S1310 - step S1320, which are introduced in detail as follows:
[0188] Step S1310, obtain the time difference between the time when the target image is rendered to the set display area and the current time, and calculate the target visual attribute parameter of each pixel point according to the time difference and the depth value of each pixel point included in the depth image.
[0189] Obtain the current time, and calculate the time difference between the time when the target image is rendered to the set display area and the current time.
[0190] Optionally, after the target image is rendered to the set display area, timing can be performed through a timer, and the duration obtained by timing is used as the time difference.
[0191] After obtaining the time difference, for each pixel in the target image, the target visual attribute parameter of the pixel can be calculated based on the time difference and the depth value of the pixel. Among them, the target visual attribute parameter refers to the adjusted visual attribute parameter, including but not limited to the color value, position, brightness value, etc. of the pixel.
[0192] Step S1320, update the visual attribute parameter of each pixel according to the target visual attribute parameter to obtain the adjusted target image.
[0193] For each pixel in the target image, update its visual attribute parameter according to the target visual attribute parameter. The target image after the parameter update is the adjusted target image. That is to say, in the image displayed in the set display area, the target visual attribute information of each pixel changes dynamically with the time difference, and among them, this change can be periodic.
[0194] In an optional example, the color gradient effect of the target image can be adjusted according to the time difference. Correspondingly, the target visual attribute parameter is the target color value. In this process, the color gradient parameter can be calculated according to the time difference. Then, for each pixel in the target image, the target color value of the pixel is calculated based on the color gradient parameter and the depth value of the pixel, and the color value of the pixel is updated according to the target color value, so as to adjust the color gradient effect of the target image. Among them, the calculation of the color value can be performed through a set color gradient function.
[0195] In an optional example, the target image can be moved horizontally according to the time difference. Correspondingly, the target visual attribute parameter is the target position. In this process, the moving distance and moving direction of the target image can be calculated according to the time difference. For each pixel in the target image, the moving distance and moving direction of the pixel are calculated based on the depth value of the pixel, the moving distance and moving direction of the target image, so as to move the pixel according to the moving distance and moving direction of the pixel. Among them, the moving direction of the pixel is the same as the moving direction of the target image, and the moving distance of the pixel is positively correlated with the moving distance of the target image and negatively correlated with the depth value of the pixel. Optionally, during the movement, the target image can also be scaled to form a visual difference and make the image more three-dimensional. Under this condition, the scaling ratio can be calculated according to the time difference. For each pixel in the target image, the moving distance and moving direction of the pixel are calculated based on the depth value of the pixel, the moving distance, moving direction and scaling ratio of the target image; among them, if the moving direction is the specified direction, the target image can be enlarged, that is, the scaling ratio of the target image is greater than 1. If the moving direction is not the specified direction, the scaling ratio of the target image is less than 1, that is, the target image is reduced. For example, see Figure 14As shown, before the movement (i.e., the target image is at the origin), the display of the target image in the set display area is as shown by the rectangular frame 1401. After moving to the right, the display of the target image in the set display area is as shown by the rectangular frame 1402. After moving back from the right to the origin, the display of the target image in the set display area is as shown by the rectangular frame 1403. After moving from the origin to the left, the display of the target image in the set display area is as shown by the rectangular frame 1404. Then, moving from the left back to the origin, it returns to the rectangular frame 1401, thus forming a cycle. Among them, during the process of moving from the origin to the right and from the right back to the origin, the target image is gradually enlarged. Among them, the moving amplitude of the foreground (e.g., the person in the figure) is larger than that of the background (e.g., the tree in the figure), and the magnification amplitude of the foreground is larger than that of the background; during the process of moving from the origin to the left and from the left back to the origin, the target image is gradually reduced. Among them, the moving amplitude of the foreground (e.g., the person in the figure) is larger than that of the background (e.g., the tree in the figure), and the scaling amplitude of the foreground is larger than that of the background reduction.
[0196] It should be noted that Figure 13 For the specific implementation details of the steps S210 - step S220 and step S240 shown, reference can be made to Figure 2 the steps S210 - step S220 and step S240 shown, which will not be elaborated here.
[0197] In Figure 13 the embodiment shown, it is possible to dynamically adjust the target image according to the time difference between the time when the target image is rendered to the set display area and the current time, so as to automatically form a three-dimensional dynamic image.
[0198] In an exemplary embodiment, referring to Figure 15 , Figure 15 it is a flowchart of an image processing method proposed based on Figure 13 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in Figure 1 the implementation environment shown, or can be executed by the server 120 in Figure 1 the implementation environment shown, or, alternatively, can be jointly executed by the terminal device 110 and the server 120 in Figure 1 the implementation environment shown.
[0199] As Figure 15 shown, step S1310 may include steps S1510 - step S1530, which are introduced in detail as follows:
[0200] Step S1510: Obtain the time difference between the time when the target image is rendered to the set display area and the current time, and calculate the lighting parameters based on the time difference; where the lighting parameters include at least one of the lighting intensity and the lighting direction.
[0201] Based on the time difference, the lighting parameters in the target image can be adjusted, so that the lighting in the target image changes dynamically. Therefore, the lighting parameters of the target image can be calculated according to the display duration. Among them, the lighting parameters include but are not limited to at least one of the lighting intensity, the lighting direction, etc.
[0202] Optionally, the change of the lighting parameters can be periodic. For example, the lighting intensity can be changed from strong to weak, then from weak to strong, and then from strong to weak, and so on in a cycle.
[0203] Step S1520: Obtain the original color value of each pixel point from the target image, and calculate the target color value of each pixel point based on the lighting parameters, the depth value of each pixel point included in the depth image, and the original color value of each pixel point.
[0204] The change of the lighting parameters is reflected as the change of the color value in the image. Therefore, for each pixel point in the target image, its color value can be obtained from the target image as the original color value, and the target color value of this pixel point can be calculated according to the lighting parameters, the original color value of this pixel point, and the depth value of this pixel point. That is to say, the target visual attribute parameter includes the target color value.
[0205] Optionally, the target color value of each pixel point can be calculated through a set lighting model, such as the Phong lighting model, the PBR lighting model, etc., where PBR refers to Physically Based Rendering, physically based rendering.
[0206] Step S1530: Use the target color value of each pixel point as the target visual attribute parameter of each pixel point.
[0207] After obtaining the target color value of each pixel point, use it as the target visual attribute parameter. That is to say, the target visual attribute parameter includes the target color value.
[0208] It should be noted that Figure 15 The specific implementation details of the steps S210 - S220 and step S240 shown can be referred to Figure 2 The steps S210 - S220 and step S240 shown, Figure 15 The specific implementation details of the step S1320 shown can be referred to Figure 13 The step S1320 shown, which will not be elaborated here.
[0209] In Figure 15 the illustrated embodiment, the illumination parameters in the target image can be dynamically adjusted according to the duration, enriching the adjustment method, enhancing the interest, being more attractive to users, and improving the user experience.
[0210] In one exemplary embodiment, referring to Figure 16 , Figure 16 is a flowchart of an image processing method proposed on the basis of Figure 2 shown. This method can be applied to Figure 1 the illustrated implementation environment, which can be executed by the terminal device 110 in Figure 1 the illustrated implementation environment, or can be executed by the server 120 in Figure 1 the illustrated implementation environment, or, alternatively, can be jointly executed by the terminal device 110 and the server 120 in Figure 1 the illustrated implementation environment.
[0211] As Figure 16 shown, step S220 may include steps S1610 - S1630, which are introduced in detail as follows:
[0212] Step S1610, calculate the edge optimization parameter according to the performance parameter of the rendering device for rendering the target image.
[0213] The rendering device is used to render the target image, and the performance parameter of the rendering device is used to characterize the performance of the rendering device, including but not limited to at least one of the idle resource amount of the CPU of the rendering device, the idle resource amount of the GPU, the computing speed of the CPU, the processing speed of the GPU, the number of cores included in the CPU and GPU, etc.
[0214] Edge optimization refers to optimizing the edges of the elements included in the image, including but not limited to at least one of edge enhancement processing, edge smoothing processing, etc. The edge optimization parameter will affect the edge optimization effect, where the edge optimization parameter includes but not limited to the number of edge optimization times, and the amplitude threshold, distance threshold, contrast enhancement coefficient, standard deviation of the Gaussian filter, etc. recorded later.
[0215] The performance of the rendering device for rendering the target image will affect the rendering efficiency. Therefore, in order to improve the rendering efficiency, the performance parameter of the rendering device can be obtained, and the edge optimization parameter can be calculated according to the performance parameter. Among them, the edge optimization effect corresponding to the edge optimization parameter can be positively correlated with the performance of the rendering device, that is, the better the performance of the rendering device, the better the edge optimization effect corresponding to the edge optimization parameter.
[0216] Step S1620, perform edge optimization processing on the target image according to the edge optimization parameter to obtain the optimized target image.
[0217] According to the edge optimization parameter, edge optimization processing can be performed on the target image, and the target image after edge optimization processing is the optimized target image.
[0218] Step S1630: Render the optimized target image to a set display area according to the depth image.
[0219] After obtaining the optimized target image, the optimized target image can be rendered to a set display area according to the depth image.
[0220] Optionally, the edge optimization processing can also be performed on the adjusted target image by using the edge optimization parameter, and the adjusted target image after edge optimization processing is rendered to a set display area.
[0221] In an alternative embodiment, an adjustment operation for the target image can also be obtained, the edge optimization parameter is calculated according to the adjustment operation, and the edge optimization processing is performed on the target image and the adjusted target image according to the edge optimization parameter, so as to dynamically adjust the edge optimization parameter according to the user's interaction situation, realize personalized edge optimization, and improve the user experience; for example, the edge optimization parameter can be determined according to the trigger frequency of the adjustment operation, where the edge optimization effect corresponding to the edge optimization parameter is negatively correlated with the trigger frequency, that is, the higher the trigger frequency, the lower the optimization effect corresponding to the edge optimization parameter; for another example, if the user rotates left on the touch screen, the edge optimization effect corresponding to the edge optimization parameter can be increased, and if the user rotates right on the touch screen, the edge optimization effect corresponding to the edge optimization parameter can be decreased.
[0222] It should be noted that Figure 16 The specific implementation details of the shown step S210, step S230 - step S240 can refer to Figure 2 The shown step S210, step S230 - step S240, which will not be elaborated here.
[0223] In Figure 16 In the shown embodiment, the edge optimization parameter can be adjusted according to the performance parameters of the rendering device, so as to ensure the rendering efficiency while ensuring the edge optimization effect.
[0224] In an exemplary embodiment, refer to Figure 17 , Figure 17 is a flowchart of an image processing method proposed on the basis of Figure 16 shown. This method can be applied to Figure 1 the shown implementation environment, which can be executed by the terminal device 110 in Figure 1 the shown implementation environment, or can be executed by the server 120 in Figure 1 the shown implementation environment, or, Figure 1The terminal device 110 and the server 120 in the illustrated implementation environment execute jointly.
[0225] As Figure 17 shown, step S1620 may include steps S1710 - S1750, which are introduced in detail as follows:
[0226] Step S1710, calculate the change amplitude of the depth value of each pixel point according to the depth image; wherein, the change amplitude of the depth value of each pixel point is used to describe the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point.
[0227] The edge optimization parameter includes an amplitude threshold, and the amplitude threshold is used to determine edge pixel points, wherein the amplitude threshold may be positively or negatively correlated with the performance of the rendering device.
[0228] The change amplitude of the depth value of each pixel point is used to describe the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point. The greater the difference, the greater the change amplitude of the depth value. Optionally, if there is only one adjacent pixel point for each pixel point, the difference between the depth value of each pixel point and the depth value of the adjacent pixel point may be calculated, and the absolute value of the difference is used as the change amplitude of the depth value of each pixel point; if there are multiple adjacent pixel points for each pixel point, the difference between the depth value of each pixel point and the depth value of each adjacent pixel point may be calculated, and the sum of the squares of the differences corresponding to the multiple adjacent pixel points is calculated, and the square root of the sum of the squares is used as the change amplitude of the depth value of each pixel point. In an optional example, in order to reduce the data processing amount, the change amplitude of the depth value corresponding to any pixel point may be calculated by the following formula:
[0229] Change amplitude of depth value = sqrt(horizontal change amplitude^2 + vertical change amplitude^2)
[0230] Wherein, the horizontal change amplitude is used to describe the difference between the depth value of the pixel point and the depth value of the adjacent pixel point in the horizontal direction, and the vertical change amplitude is used to describe the difference between the depth value of the pixel point and the depth value of the adjacent pixel point in the vertical direction. The horizontal change amplitude may be calculated in the following manner: calculate the difference between the depth value of the pixel point and the depth value of the adjacent pixel point on the left side of the pixel point, calculate the difference between the depth value of the pixel point and the depth value of the adjacent pixel point on the right side of the pixel point, calculate the sum of the squares of these two differences, and use the square root of the sum of the squares as the horizontal change amplitude; the vertical change amplitude may be calculated in the following manner: calculate the difference between the depth value of the pixel point and the depth value of the adjacent pixel point above the pixel point, calculate the difference between the depth value of the pixel point and the depth value of the adjacent pixel point below the pixel point, calculate the sum of the squares of these two differences, and use the square root of the sum of the squares as the horizontal change amplitude.
[0231] Step S1720: Search for edge pixel points in the target image whose depth value change amplitude is greater than the amplitude threshold included in the edge optimization parameter, and search for multiple target pixel points in the target image whose distance from the edge pixel points is less than the distance threshold.
[0232] The edge optimization parameter includes an amplitude threshold for searching edge pixel points. If the depth value change amplitude of any pixel point is greater than the amplitude threshold, then this pixel point is an edge pixel point; wherein, the amplitude threshold is positively correlated with the performance of the rendering device.
[0233] The distance threshold is used to search for target pixel points. Among them, the target pixel point refers to a pixel point whose distance from the edge pixel point is less than the distance threshold. The specific value of the distance threshold can be flexibly set according to actual needs. Optionally, the edge optimization parameter can include the distance threshold, and the distance threshold can be positively correlated with the performance of the rendering device.
[0234] Step S1730: Calculate the weight of each target pixel point according to the distance between each target pixel point and the edge pixel point; wherein, the weight of each target pixel point is negatively correlated with the distance.
[0235] The weight of the target pixel point is positively correlated with the distance between it and the edge pixel point. That is to say, the farther the distance, the lower the weight.
[0236] Step S1740: Perform weighted summation processing on the color values corresponding to multiple target pixel points according to the weights corresponding to the multiple target pixel points respectively, and update the color value of the edge pixel point according to the color value obtained by the weighted summation processing.
[0237] Perform weighted summation on the color values corresponding to multiple target pixel points according to the weights corresponding to the multiple target pixel points respectively, and use the obtained value as the updated color value of the edge pixel point, so as to achieve edge smoothing processing.
[0238] Optionally, the weighted summation processing can be performed on the pixel points in the edge area through a Gaussian filter. Among them, the weight of each target pixel point in the Gaussian filter can be calculated by the following formula:
[0239] Weight of the target pixel point = exp(-(Lx^2 + Ly^2) / (2*(σ^2)))
[0240] Wherein, exp(x) is the square root function, Lx is the horizontal distance between the target pixel point and the edge pixel point, Ly is the vertical distance between the target pixel point and the edge pixel point, and σ is the standard deviation of the Gaussian filter. This standard deviation can be flexibly set according to actual needs, or this standard deviation can be positively correlated with the performance of the rendering device.
[0241] Step S1750: Use the target image with the color values of the edge pixels updated as the optimized target image.
[0242] After updating the color values of the edge pixels in the target image, edge optimization processing of the target image is achieved, and the obtained target image with updated values is used as the optimized target image.
[0243] It should be noted that Figure 17 For the specific implementation details of the shown steps S210, S230 - S240, reference can be made to Figure 2 the shown steps S210, S230 - S240 Figure 17 For the specific implementation details of the shown steps S1610, S1630, reference can be made to Figure 16 the shown steps S1610, S1630, which will not be elaborated here.
[0244] In Figure 17 the shown embodiment, the amplitude threshold is adjusted according to the performance parameters of the rendering device, so as to ensure the rendering efficiency while guaranteeing the edge optimization effect; and, it is also possible to perform weighted summation processing on the color values corresponding to multiple target pixels according to the weights respectively corresponding to the multiple target pixels, and update the color values of the edge pixels according to the color values obtained from the weighted summation processing, thereby performing edge smoothing processing on the target image, avoiding jagged phenomena, and improving the image display effect.
[0245] In an exemplary embodiment, refer to Figure 18 , Figure 18 which is a flowchart of an image processing method proposed based on Figure 16 shown. This method can be applied to Figure 1 the shown implementation environment, which can be executed by the terminal device 110 in Figure 1 the shown implementation environment, or can be executed by the server 120 in Figure 1 the shown implementation environment, or, can also be jointly executed by the terminal device 110 and the server 120 in Figure 1 the shown implementation environment.
[0246] As Figure 18 shown, step S1620 may include steps S1810 - S1840, which are introduced in detail as follows:
[0247] Step S1810: Find the edge pixels from the target image according to the depth image and the edge optimization parameters.
[0248] Among them, for the specific determination method of the edge pixels, reference can be made to the foregoing records, which will not be elaborated here.
[0249] Step S1820: Calculate the depth value change amplitude corresponding to each pixel point according to the difference between the depth value of each pixel point and the depth values of the adjacent pixel points of each pixel point.
[0250] Among them, the specific calculation method of the depth value change amplitude can be referred to the foregoing description and will not be elaborated here.
[0251] Step S1830: Obtain the original brightness value of the edge pixel points from the target image, and calculate the target brightness value of the edge pixel points according to the original brightness value of the edge pixel points and the depth value change amplitude corresponding to the edge pixel points; wherein, the target brightness value is greater than the original brightness value.
[0252] In each edge optimization process, record the brightness value of the edge pixel points in the target image before edge optimization as the original brightness value. According to the depth value change amplitude of the edge pixel points, the original brightness value of the edge pixel points can be increased to obtain the target brightness value of the edge pixel points. That is to say, the target brightness value is greater than the original brightness value; then, update the brightness value of the edge pixel points according to the target brightness value of the edge pixel points, thereby enhancing the contrast between the edge area and the non-edge area, making the edge area clearer and more natural.
[0253] Optionally, the amplitude of the increase in the brightness value can be positively correlated with the depth value change amplitude of the edge pixel points. That is to say, the greater the depth value change amplitude, the greater the difference between the target brightness value and the original brightness value.
[0254] In an optional example, the target brightness value of the edge pixel points can be calculated by the following formula:
[0255] Target brightness value = original brightness value × (1 + contrast enhancement coefficient × depth value change amplitude of the edge pixel points)
[0256] Among them, the contrast enhancement coefficient can be preset, and its specific value can be flexibly set according to actual needs. Or, the contrast enhancement coefficient can be positively correlated with the performance of the rendering device.
[0257] Step S1840: Update the brightness value of the edge pixel points according to the target brightness value, and use the target image with the brightness value of the edge pixel points updated as the optimized target image.
[0258] After updating the brightness value of the edge pixel points in the target image from the original brightness value to the target brightness value, edge enhancement of the target image is achieved, making the edges of the elements included in the target image clearer and more natural, and using the updated target image as the optimized target image.
[0259] It should be noted that Figure 18The specific implementation details of step S210 and steps S230 - S240 shown can be referred to Figure 2 step S210 and steps S230 - S240 shown Figure 18 The specific implementation details of step S1610 and step S1630 shown can be referred to Figure 16 step S1610 and step S1630 shown, which will not be elaborated here.
[0260] In Figure 18 the embodiment shown, the brightness value of the edge pixel points can be enhanced according to the change amplitude of the depth values corresponding to the edge pixel points, so as to perform edge enhancement on the target image, make the edges in the target image clearer, and improve the image display effect.
[0261] In an exemplary embodiment, refer to Figure 19 , Figure 19 is a flowchart of an image processing method proposed on the basis of Figure 2 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by Figure 1 the terminal device 110 in the implementation environment shown, or can be executed by Figure 1 the server 120 in the implementation environment shown, or, can also be jointly executed by Figure 1 the terminal device 110 and the server 120 in the implementation environment shown.
[0262] As Figure 19 shown, step S220 may include steps S1910 - S1920, and the details are introduced as follows:
[0263] Step S1910, obtain the performance parameters of the rendering device for rendering the target image, and determine the rendering parameters of the target image according to the performance parameters.
[0264] The performance of the rendering device affects the rendering efficiency, and the quality of the rendering parameters affects the rendering efficiency and rendering effect. Therefore, in order to improve the rendering efficiency, the rendering parameters of the target image can be determined according to the performance parameters of the rendering device. Among them, the rendering effect corresponding to the rendering parameters is positively correlated with the performance of the rendering device. That is to say, the better the performance of the rendering device, the better the rendering effect corresponding to the rendering parameters, so as to improve the display effect of the target image; the worse the performance of the rendering device, the worse the rendering effect corresponding to the rendering parameters, so as to ensure the rendering efficiency.
[0265] Step S1920, render the target image to the set display area according to the depth image and the rendering parameters.
[0266] Render the target image to the set display area according to the depth image and rendering parameters, so as to balance the rendering effect and rendering rate.
[0267] Optionally, for the rendering of the adjusted target image, steps S1910 - S1920 can also be used for rendering, which will not be elaborated here.
[0268] It should be noted that Figure 19 The specific implementation details of steps S210, S230 - S240 shown can be referred to Figure 2 Steps S210, S230 - S240 shown, which will not be elaborated here.
[0269] In Figure 19 In the embodiment shown, the rendering parameters of the target image can be adjusted according to the performance parameters of the rendering device, so as to ensure the rendering efficiency while ensuring the rendering effect.
[0270] In an exemplary embodiment, refer to Figure 20 , Figure 20 is a flowchart of an image processing method proposed based on Figure 19 shown. This method can be applied to Figure 1 the implementation environment shown, which can be executed by the terminal device 110 in Figure 1 the implementation environment shown, or can be executed by the server 120 in Figure 1 the implementation environment shown, or, can also be jointly executed by the terminal device 110 and the server 120 in Figure 1 the implementation environment shown.
[0271] As Figure 20 shown, step S1920 can include steps S2010 - S2040, which are introduced in detail as follows:
[0272] Step S2010, obtain the number of texture levels from the rendering parameters, and obtain the texture image corresponding to the target image; wherein, the number of texture levels is negatively correlated with the performance parameters of the rendering device.
[0273] The number of texture levels refers to the number of texture images of the target image that need to be generated during rendering, so as to obtain multi-level textures.
[0274] Among them, the number of texture levels is negatively correlated with the performance of the rendering device, that is, the better the performance of the rendering device, the lower the number of texture levels, and the worse the performance of the rendering device, the higher the number of texture levels.
[0275] The texture image of the target image refers to the texture representation of the target image, which contains the color values of each pixel point in the target image.
[0276] For a target image, multiple corresponding texture images can be obtained, where the resolutions of the multiple texture images are different.
[0277] Optionally, a texture image corresponding to the target image can be obtained first, and the texture image can be scaled using different scaling ratios to obtain multiple texture images with different resolutions. Optionally, the mipmap technique can also be used to generate multiple texture images with different resolutions corresponding to the target image.
[0278] Step S2020: Take the texture image as the first texture image and perform a shrinking process on the first texture image to obtain a second texture image.
[0279] To improve the rendering efficiency, the texture image of the target image can be taken as the first texture image and shrunk, thereby reducing the resolution of the first texture image so that the resolution of the obtained second texture image is less than that of the first texture image. Among them, the shrinking ratio can be flexibly set according to actual needs. For example, it can be 1 / 2, that is to say, the size of the second texture image is half of the size of the first texture image.
[0280] Optionally, before taking the texture image as the first texture image, the texture image can be scaled so that the size of the texture image matches the size of the set display area, and then the texture image is taken as the first texture image.
[0281] Step S2030: Take the second texture image as the next first texture image and perform a shrinking process on the next first texture image until multiple texture images matching the number of texture levels are obtained.
[0282] After obtaining the second texture image, the second texture image can be taken as the new first texture image, that is, the next first texture image, and a shrinking process is performed on the new first texture image to obtain a new second texture image, and this is repeated in a loop. If the number of obtained texture images matches the number of texture levels, the loop ends.
[0283] Optionally, during the process of generating texture images, the MipMap technique can be used to generate the second texture image based on the first texture image.
[0284] Step S2040: Sample from the multiple texture images according to the depth image and map the sampled color values to the set display area to render the target image to the set display area.
[0285] After obtaining multiple texture images, sampling can be performed from them according to the depth image, and the sampled color values are mapped to the set display area, thereby realizing rendering the target image to the set display area.
[0286] Optionally, during the sampling process, for each pixel point in the set display area, the corresponding texture image can be selected from multiple texture images according to its corresponding depth value, and sampling can be performed from the selected texture image according to the texture coordinates corresponding to the pixel point, and the sampled color value is used as the color value of the pixel point; among them, the lower the depth value, the higher the resolution of the selected texture image, that is to say, the depth value is negatively correlated with the resolution of the selected texture image. For example, for pixel points with a smaller depth value (for example, pixel points corresponding to the foreground area), sampling can be performed from a texture image with a higher resolution, so that the resolution of the foreground in the set display area is higher and clearer; for pixel points with a larger depth value (for example, pixel points corresponding to the background area), sampling can be performed from a texture image with a lower resolution, thereby improving the rendering efficiency.
[0287] It should be noted that Figure 20 The specific implementation details of the steps S210, S230 - S240 shown can be referred to Figure 2 the steps S210, S230 - S240 shown Figure 20 The specific implementation details of the step S1910 shown can be referred to Figure 19 the step S1910 shown, which will not be elaborated here.
[0288] In Figure 20 the embodiment shown, the number of texture levels can be adjusted according to the performance of the rendering device, and the number of texture levels is negatively correlated with the performance of the rendering device. Among them, the more the number of texture levels, the smaller the minimum resolution in the generated texture image, thereby improving the rendering efficiency; the fewer the number of texture levels, the larger the minimum resolution in the generated texture image, thereby ensuring the rendering effect.
[0289] For better understanding of the present invention, here an example is given where the target image is a poster image of a video to be displayed in a video application. Among them, see Figure 21 shown Figure 21 is a block diagram of the image processing method provided in this embodiment.
[0290] Among them, see Figure 21 shown, a depth detection model can be pre-trained to obtain a trained depth detection model. During the training process of the depth detection model, a training data set can be obtained, a loss function can be determined, and the model can be trained using the training data set and the loss function to optimize the model parameters, and the trained depth detection model can be deployed. Among them, the depth detection model takes a two-dimensional image as input and the depth image of the two-dimensional image as output, and is used to detect the depth data of the two-dimensional image.
[0291] After obtaining the trained depth detection model, the user can select the poster image to be displayed through the selection interface provided by the server and select whether to convert the poster image from a two-dimensional image to a three-dimensional image. Among them, the selection interface can be as Figure 3 shown. If the user selects the function of converting the poster image from a two-dimensional image to a three-dimensional image, the server uses the trained depth detection model to perform depth detection on the poster image, outputs the depth image of the poster image, and saves the depth image.
[0292] When the terminal device installed with the video application needs to display the poster image in the set display area, it can send a poster image request to the server to obtain the poster image and the depth image of the poster image from the server. Then, the terminal device determines whether the user has selected to convert the poster image from a two-dimensional image to a three-dimensional image. If not, it directly renders the poster image to the set display area. If so, the terminal device can obtain relevant parameters (for example, texture coordinates of pixel points, dilation distance, dilation parameters, edge optimization parameters, etc.), input the relevant parameters into the shader rendering algorithm in OpenGL, Metal, etc., and render the poster image to the set display area through the shader rendering algorithm, and perform dynamic changes on the poster image according to the data detected by the gyroscope, touch operations, and the timing in the timer to form a three-dimensional dynamic poster.
[0293] Among them, the specific rendering process is as follows:
[0294] Obtain vertex output data: Use triangles to segment the poster image, and define a structure, for example, MMTIVertexOut, to store the vertex output data of the vertices of the triangles in the poster image. Among them, the vertex output data includes the position coordinates of the vertices in the poster image and the texture coordinates of the vertices in the texture coordinate system.
[0295] Perform dilation processing operation: Perform dilation processing operation on the depth image of the poster image.
[0296] Optionally, a fragment shader function named dilationFragment is preset. Among them, the target depth value of each pixel point in the depth image of the poster image is calculated through the dilationFragment function, and the depth value of each pixel point is updated according to the target depth, so as to achieve dilation.
[0297] During the dilation process, the dilationFragment function can obtain the depth texture image corresponding to the depth image, obtain the texture coordinates of each pixel point in the depth texture image, call the dilate function, and input the texture coordinates, dilation distance, texture sampler (uSampler), sampler state (sampler2D), and dilation parameter (dilation) into the dilate function, so that the dilate function calculates the target depth value corresponding to the texture coordinates according to the texture coordinates, dilation distance, texture sampler (uSampler), sampler state (sampler2D), and dilation parameter (dilation), and returns the target depth value of the texture coordinates to the dilationFragment function. The dilationFragment function then determines the target depth value of the pixel point corresponding to the texture coordinates according to the target depth value of the texture coordinates and updates accordingly. Among them, the sampler state is used to indicate how the texture sampler samples.
[0298] Among them, when the dilate function calculates the target depth value corresponding to the texture coordinates according to the texture coordinates, dilation distance (px), texture sampler (uSampler), sampler state (sampler2D), and dilation parameter (dilation), it can find a rectangular area centered on the texture coordinates with a width of 2 * horizontal dilation distance and a height of 2 * vertical dilation distance from the depth texture image, sample the depth values of pixel points from the rectangular area through the texture sampler, and traverse the depth values of each pixel point in the rectangular area. If the dilation parameter is positive, the maximum depth value in the rectangular area is used as the target depth value of the texture coordinates. If the dilation parameter is negative, the minimum depth value in the rectangular area is used as the target depth value of the texture coordinates. Among them, in the depth texture image, the grayscale value of the pixel point is used as the depth value. Therefore, the target depth value of the texture coordinates can be calculated by the following formula:
[0299] dilationValue(TextureCoord, px, uSampler, sampler2D, dilation) = max / min{grayscale(color(uv'))}
[0300] Among them, TextureCoord, px, uSampler, sampler2D, and dilation are input parameters. TextureCoord is the texture coordinate for which the target depth value needs to be calculated. uv' is the texture coordinate in the rectangular area. color(uv') is the color value corresponding to uv'. grayscale(x) is used to calculate the grayscale value. max refers to the maximum value function, and min refers to the minimum value function.
[0301] Perform depth perspective processing: Perform a depth perspective processing operation on the texture image of the poster image.
[0302] Optionally, a fragment shader function named depthPerspectiveFragment can be preset, taking the depth texture image, the texture image of the poster image, the texture sampler, the dimensions, scale, offset, and sampler state (sampler2D) of the texture image of the poster image as inputs, and outputting the perspective texture image after depth perspective processing.
[0303] Among them, during the depth perspective processing, color values can be sampled from the depth texture image through the texture sampler, and depth values can be sampled from the texture image of the poster image. Among them, for the specific process of depth perspective processing, please refer to the description in the foregoing embodiments. The depth texture image referred to during the depth perspective processing can also be the depth texture image corresponding to the dilated depth image.
[0304] Perform dynamic processing: Map the texture image of the poster image (which can also be the perspective texture image) to the set display area, and dynamically change the texture image according to the gyroscope, touch operation, and the timing of the timer, so as to implement a three-dimensional dynamic image.
[0305] Optionally, the data detected by the gyroscope is used to control the rotation of the poster image. For example, when the user tilts the terminal device to the left, the elements on the poster image will also tilt to the left. The touch operation is used to control the horizontal movement of the poster image. For example, when the user swipes left on the screen, the elements on the poster image will also slide to the left, thus enhancing the user's interaction experience and the attractiveness of the poster image. The duration output by the timer is used to control the light intensity and color gradient effect in the poster image. Among them, after the texture image of the poster image is rendered to the set display area, the timer starts timing, so as to control the dynamic transformation of the poster image according to the duration output by the timer, further enhancing the attractiveness of the poster image.
[0306] During the process of controlling the transformation of the poster image through gyroscope data and touch operations, the data detected by the gyroscope and the touch operation can be input into the vertex shader. The vertex shader calculates the transformation matrix corresponding to the texture image of the poster image. Among them, the transformation matrix contains the transformation vectors of each pixel point in the texture image, and each pixel point in the texture image is transformed through the transformation matrix to obtain the transformed texture image, and the transformed texture image is rendered to the set display area.
[0307] Among them, the transformation matrix can be calculated through the following formula:
[0308] transformMatrix = rotationMatrix * translationMatrix * scalingMatrix
[0309] Among them, transformMatrix is the transformation matrix, rotationMatrix is the rotation matrix calculated based on gyroscope data, which contains the rotation vector of each pixel point in the texture image; translationMatrix is the translation matrix calculated based on touch operations, which contains the translation vector of each pixel point, and scalingMatrix is the scaling matrix calculated based on touch operations.
[0310] During the process of controlling the transformation of the poster image through the duration output by the timer, the light intensity and color gradient parameters can be calculated based on the duration output by the timer, and the light intensity and color gradient parameters are used as uniform variables in the shader, so as to control the changes of the light intensity and color gradient effect in the poster image through the uniform variables. Among them, the light intensity and color gradient parameters can be calculated by the following formulas:
[0311] lightIntensity = f(time)
[0312] colorGradient = g(time)
[0313] Among them, lightIntensity is the light intensity, time is the duration output by the timer, colorGradient is the color gradient parameter, f(time) is a pre-set function for calculating the light intensity, and g(time) is a pre-set function for calculating the color gradient parameter.
[0314] Among them, for the specific process of controlling the changes of the light intensity and color gradient effect in the poster image, reference can be made to the description of the foregoing embodiments, which will not be elaborated here.
[0315] Edge optimization processing: Before rendering the texture image of the poster image and the transformed texture image to the set display area, edge optimization processing can also be performed on the texture image.
[0316] Among them, for the specific method of edge optimization processing, reference can be made to the description of the foregoing embodiments, which will not be elaborated here.
[0317] Performance optimization processing: During the rendering process, the rendering parameters, edge optimization parameters, etc. can be dynamically adjusted according to the performance of the terminal device.
[0318] In this embodiment, a three-dimensional dynamic poster image can be displayed based on a two-dimensional poster image, making the poster more attractive to users and improving the display method of the poster image. Moreover, users can control the changes of the poster image, thereby enhancing the interactivity and interest and improving the user experience. Also, during the rendering process, the rendering parameters and edge optimization parameters can be dynamically adjusted according to the device performance, so as to ensure the rendering efficiency and rendering effect. Additionally, the three-dimensional dynamic poster image is generated by an algorithm without the participation of designers, which can reduce the labor cost and improve the generation efficiency. Furthermore, rendering technologies such as openGL and Metal can be used for rendering, which can expand the scope of application.
[0319] See Figure 22 , Figure 22 is a block diagram of an image processing device shown in an exemplary embodiment of the present application. As Figure 22 shown, the device includes:
[0320] An acquisition module 2201, configured to acquire a target image to be processed and perform depth detection on the target image to obtain a depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image.
[0321] A first rendering module 2202, configured to render the target image to a set display area according to the depth image.
[0322] An adjustment module 2203, configured to dynamically adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image.
[0323] A second rendering module 2204, configured to render the adjusted target image to a set display area.
[0324] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: perform dilation processing on the depth image to obtain a dilated depth image; and render the target image to a set display area according to the dilated depth image.
[0325] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: obtain the dilation parameter and the dilation distance corresponding to the depth image; wherein, the dilation distance is positively correlated with the size of the depth image; according to the dilation distance, find multiple reference pixel points corresponding to each pixel point in the depth image; wherein, the distance between the reference pixel point and each pixel point in the depth image is less than or equal to the dilation distance; obtain the original depth values corresponding to the multiple reference pixel points respectively from the depth image, and select a target reference pixel point from the multiple reference pixel points according to the dilation parameter and the original depth values corresponding to the multiple reference pixel points respectively; use the original depth value corresponding to the target reference pixel point as the target depth value of each pixel point in the depth image, and update the depth value of each pixel point in the depth image according to the target depth value to obtain a dilated depth image.
[0326] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: if the dilation parameter is greater than or equal to the set parameter threshold, use the pixel point with the largest original depth value among the multiple reference pixel points as the target reference pixel point; if the dilation parameter is less than the set parameter threshold, use the pixel point with the smallest depth value among the multiple reference pixel points as the target reference pixel point.
[0327] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: obtain the texture image of the target image; the texture image contains the color values of each pixel point in the target image; perform depth perspective processing on the texture image according to the depth image to obtain a perspective texture image; map the perspective texture image to a set display area.
[0328] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: obtain the depth value of each pixel point in the texture image from the depth image, and obtain the scaling ratio and offset corresponding to the texture image; calculate the movement vector of each pixel point in the texture image according to the scaling ratio, the offset, and the depth value of each pixel point in the texture image; obtain the original texture coordinates of each pixel point in the texture image from the texture image, and calculate the target texture coordinates of each pixel point in the texture image according to the movement vector and the original texture coordinates of each pixel point in the texture image; move each pixel point in the texture image according to the target texture coordinates of each pixel point in the texture image to obtain a perspective texture image.
[0329] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: in response to an adjustment operation on the target image, adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image.
[0330] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: calculate rotation parameters in response to data detected by an angular velocity detection device; wherein, the angular velocity detection device includes a gyroscope; calculate a rotation vector for each pixel point included in the depth image according to the rotation parameters and the depth value of each pixel point; and move each pixel point according to the rotation vector of each pixel point to obtain an adjusted target image.
[0331] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: adjust visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image in response to a touch operation on the target image to obtain an adjusted target image.
[0332] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: obtain a sliding direction and a sliding distance of a sliding touch operation in response to a sliding touch operation on the target image; calculate a movement vector for each pixel point according to the sliding direction, the sliding distance, and the depth value of each pixel point included in the depth image; and move each pixel point according to the movement vector of each pixel point to obtain an adjusted target image.
[0333] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: obtain a time difference between the time when the target image is rendered to a set display area and the current time, and calculate target visual attribute parameters for each pixel point according to the time difference and the depth value of each pixel point included in the depth image; and update the visual attribute parameters of each pixel point according to the target visual attribute parameters to obtain an adjusted target image.
[0334] In an exemplary embodiment, based on the foregoing solution, the adjustment module 2203 is specifically configured to: calculate lighting parameters according to the time difference; wherein, the lighting parameters include at least one of a lighting intensity and a lighting direction; obtain an original color value of each pixel point from the target image, and calculate a target color value of each pixel point according to the lighting parameters, the depth value of each pixel point included in the depth image, and the original color value of each pixel point; and use the target color value of each pixel point as the target visual attribute parameter of each pixel point.
[0335] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: calculate edge optimization parameters according to performance parameters of a rendering device for rendering the target image; perform edge optimization processing on the target image according to the edge optimization parameters to obtain an optimized target image; and render the optimized target image to a set display area according to the depth image.
[0336] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: calculate the change amplitude of the depth value of each pixel point according to the depth image; wherein, the change amplitude of the depth value of each pixel point is used to describe the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point; find edge pixel points in the target image whose change amplitude of the depth value is greater than the amplitude threshold included in the edge optimization parameter, and find a plurality of target pixel points in the target image whose distance from the edge pixel points is less than the distance threshold; calculate the weight of each target pixel point according to the distance between each target pixel point and the edge pixel point; wherein, the weight of each target pixel point is negatively correlated with the distance; perform weighted summation processing on the color values corresponding to the plurality of target pixel points according to the weights corresponding to the plurality of target pixel points respectively, and update the color value of the edge pixel point according to the color value obtained by the weighted summation processing; use the target image with the updated color value of the edge pixel point as the optimized target image.
[0337] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: find edge pixel points in the target image according to the depth image and the edge optimization parameter; calculate the change amplitude of the depth value corresponding to each pixel point according to the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point; obtain the original brightness value of the edge pixel point from the target image, and calculate the target brightness value of the edge pixel point according to the original brightness value of the edge pixel point and the change amplitude of the depth value corresponding to the edge pixel point; wherein, the target brightness value is greater than the original brightness value; update the brightness value of the edge pixel point according to the target brightness value, and use the target image with the updated brightness value of the edge pixel point as the optimized target image.
[0338] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: obtain the performance parameters of the rendering device for rendering the target image, and determine the rendering parameters of the target image according to the performance parameters; render the target image to a set display area according to the depth image and the rendering parameters.
[0339] In an exemplary embodiment, based on the foregoing solution, the first rendering module 2202 is specifically configured to: obtain the number of texture levels from the rendering parameters, and obtain the texture image corresponding to the target image; wherein, the number of texture levels is negatively correlated with the performance parameters of the rendering device; use the texture image as the first texture image, and perform a shrinking process on the first texture image to obtain a second texture image; use the second texture image as the next first texture image, and perform a shrinking process on the next first texture image until a plurality of texture images matching the number of texture levels are obtained; sample among the plurality of texture images according to the depth image, and map the sampled color values to a set display area to render the target image to the set display area.
[0340] It should be noted that Figure 22 The provided image processing device and the image processing method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit perform operations have been described in detail in the method embodiments and will not be elaborated here.
[0341] An embodiment of the present application also provides an electronic device, including: one or more processors; a storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the image processing methods provided in the above various embodiments.
[0342] Figure 23 The structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application is shown. The electronic device may be Figure 1 the terminal device 110 or the server 120 shown.
[0343] It should be noted that Figure 23 The shown computer system 2300 of the electronic device is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0344] As Figure 23 shown, the computer system 2300 includes a central processing unit (CPU) 2301, which can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 2302 or the computer programs loaded from the storage section 2308 into the random access memory (RAM) 2303, such as executing the image processing method in the above embodiments. In the RAM 2303, various computer programs and data required for system operations are also stored. The CPU 2301, ROM 2302, and RAM 2303 are connected to each other through a bus 2304. The input / output (I / O) interface 2305 is also connected to the bus 2304.
[0345] In some embodiments, the following components are connected to the I / O interface 2305: an input part 2306 including a keyboard, a mouse, etc.; an output part 2307 including such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part 2308 including a hard disk, etc.; and a communication part 2309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 2309 performs communication processing via a network such as the Internet. The driver 2310 is also connected to the I / O interface 2305 as required. A removable medium 2311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the driver 2310 as required so that a computer program read from it can be installed into the storage part 2308 as required.
[0346] Specifically, according to an embodiment of the present application, a computer program for implementing an image processing method can be carried on a computer-readable medium, and the computer program can be downloaded and installed from a network through the communication part 2309, and / or installed from the removable medium 2311.
[0347] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a computer program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer program contained in the computer-readable medium may be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0348] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and a computer program.
[0349] The units involved in the embodiments described in this application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not, in some cases, constitute a limitation on the units themselves.
[0350] Another aspect of this application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor of an electronic device, the electronic device implements the image processing method as described above. The computer-readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device.
[0351] Another aspect of this application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the image processing methods provided in the above various embodiments. Among them, the computer program can be stored in a computer-readable storage medium. The computer program product can be a computer program as a product, for example, an APP (Application, mobile phone application software), a web page, a small program, etc.; or, the computer program product can also be a storage medium, a device, a terminal, a virtual machine, etc. that contains the computer program.
[0352] The above content is only a preferred exemplary embodiment of this application and is not used to limit the implementation of this application. Those of ordinary skill in the art can easily make corresponding adaptations or modifications according to the main concept and spirit of this application. Therefore, the protection scope of this application should be subject to the protection scope required by the claims.
Claims
1. An image processing method, characterized in that, The method includes: Obtaining a target image to be processed, and performing depth detection on the target image to obtain a depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image; Rendering the target image to a set display area according to the depth image; Dynamically adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image; Rendering the adjusted target image to the set display area.
2. The method according to claim 1, characterized in that, The rendering the target image to a set display area according to the depth image includes: Performing dilation processing on the depth image to obtain a dilated depth image; Rendering the target image to a set display area according to the dilated depth image.
3. The method according to claim 2, wherein The performing dilation processing on the depth image to obtain a dilated depth image includes: Obtaining a dilation parameter and a dilation distance corresponding to the depth image; wherein, the dilation distance is positively correlated with the size of the depth image; Searching for a plurality of reference pixel points corresponding to each pixel point in the depth image according to the dilation distance; wherein, the distance between the reference pixel point and each pixel point in the depth image is less than or equal to the dilation distance; Obtaining the original depth values respectively corresponding to the plurality of reference pixel points from the depth image, and selecting a target reference pixel point from the plurality of reference pixel points according to the dilation parameter and the original depth values respectively corresponding to the plurality of reference pixel points; Taking the original depth value corresponding to the target reference pixel point as the target depth value of each pixel point in the depth image, and updating the depth value of each pixel point in the depth image according to the target depth value to obtain the dilated depth image.
4. The method according to claim 3, characterized in that, The selecting a target reference pixel point from the plurality of reference pixel points according to the dilation parameter and the original depth values respectively corresponding to the plurality of reference pixel points includes: If the dilation parameter is greater than or equal to a set parameter threshold, taking the pixel point with the largest original depth value among the plurality of reference pixel points as the target reference pixel point; If the dilation parameter is less than the set parameter threshold, taking the pixel point with the smallest depth value among the plurality of reference pixel points as the target reference pixel point.
5. The method according to claim 1, wherein The rendering the target image to a set display area according to the depth image includes: Obtaining a texture image of the target image; the texture image includes the color value of each pixel point in the target image; Performing depth perspective processing on the texture image according to the depth image to obtain a perspective texture image; Mapping the perspective texture image to the set display area.
6. The method according to claim 5, characterized in that The performing depth perspective processing on the texture image according to the depth image to obtain a perspective texture image includes: Obtaining the depth value of each pixel point in the texture image from the depth image, and obtaining a scaling ratio and an offset corresponding to the texture image; Calculate the movement vector of each pixel point in the texture image according to the scaling ratio, the offset, and the depth value of each pixel point in the texture image; Obtain the original texture coordinates of each pixel point in the texture image from the texture image, and calculate the target texture coordinates of each pixel point in the texture image according to the movement vector and the original texture coordinates of each pixel point in the texture image; Move each pixel point in the texture image according to the target texture coordinates of each pixel point in the texture image to obtain the perspective texture image.
7. The method according to claim 1, characterized in that, The dynamically adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image includes: In response to an adjustment operation on the target image, adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image.
8. The method according to claim 7, wherein The responding to an adjustment operation on the target image and adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image includes: Calculate a rotation parameter in response to data detected by an angular velocity detection device; wherein, the angular velocity detection device includes a gyroscope; Calculate the rotation vector of each pixel point according to the rotation parameter and the depth value of each pixel point included in the depth image; Move each pixel point according to the rotation vector of each pixel point to obtain an adjusted target image.
9. The method according to claim 7, wherein The responding to an adjustment operation on the target image and adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image includes: In response to a touch operation on the target image, adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image.
10. The method according to claim 9, wherein The responding to a touch operation on the target image and adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image includes: In response to a swipe touch operation on the target image, obtain the swipe direction and the swipe distance of the swipe touch operation; Calculate the movement vector of each pixel point according to the swipe direction, the swipe distance, and the depth value of each pixel point included in the depth image; Move each pixel point according to the movement vector of each pixel point to obtain an adjusted target image.
11. The method according to claim 1, characterized in that, The dynamically adjusting the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image includes: Obtain the time difference between the time when the target image is rendered to the set display area and the current time, and calculate the target visual attribute parameter of each pixel point included in the depth image according to the time difference and the depth value of each pixel point; Update the visual attribute parameter of each pixel point according to the target visual attribute parameter to obtain an adjusted target image.
12. The method according to claim 11, wherein The calculating the target visual attribute parameter of each pixel point according to the time difference and the depth value of each pixel point included in the depth image includes: Calculate lighting parameters according to the time difference; wherein, the lighting parameters include at least one of light intensity and light direction; Obtain the original color value of each pixel point from the target image, and calculate the target color value of each pixel point according to the lighting parameters, the depth value of each pixel point included in the depth image, and the original color value of each pixel point; Use the target color value of each pixel point as the target visual attribute parameter of each pixel point.
13. The method according to claim 1, characterized in that, The rendering the target image to a set display area according to the depth image includes: Calculate edge optimization parameters according to the performance parameters of the rendering device for rendering the target image; Perform edge optimization processing on the target image according to the edge optimization parameters to obtain an optimized target image; Render the optimized target image to the set display area according to the depth image.
14. The method according to claim 13, wherein The performing edge optimization processing on the target image according to the edge optimization parameters to obtain an optimized target image includes: Calculate the depth value change amplitude of each pixel point according to the depth image; wherein, the depth value change amplitude of each pixel point is used to describe the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point; Find edge pixel points in the target image whose depth value change amplitude is greater than the amplitude threshold included in the edge optimization parameters, and find a plurality of target pixel points in the target image whose distance from the edge pixel points is less than the distance threshold; Calculate the weight of each target pixel point according to the distance between each target pixel point and the edge pixel point; wherein, the weight of each target pixel point is negatively correlated with the distance; Perform weighted summation processing on the color values corresponding to the plurality of target pixel points according to the weights corresponding to the plurality of target pixel points respectively, and update the color value of the edge pixel point according to the color value obtained by the weighted summation processing; Use the target image with the color value of the edge pixel point updated as the optimized target image.
15. The method according to claim 13, wherein The performing edge optimization processing on the target image according to the edge optimization parameters to obtain an optimized target image includes: Find edge pixel points from the target image according to the depth image and the edge optimization parameters; Calculate the depth value change amplitude corresponding to each pixel point according to the difference between the depth value of each pixel point and the depth value of the adjacent pixel point of each pixel point; Obtain the original brightness value of the edge pixel points from the target image, and calculate the target brightness value of the edge pixel points according to the original brightness value of the edge pixel points and the change amplitude of the depth value corresponding to the edge pixel points; wherein, the target brightness value is greater than the original brightness value; Update the brightness value of the edge pixel points according to the target brightness value, and use the target image with the updated brightness value of the edge pixel points as the optimized target image.
16. The method according to claim 1, wherein The step of rendering the target image to a set display area according to the depth image further includes: Obtain the performance parameters of the rendering device for rendering the target image, and determine the rendering parameters of the target image according to the performance parameters; Render the target image to the set display area according to the depth image and the rendering parameters.
17. The method according to claim 16, characterized in that, The step of rendering the target image to the set display area according to the depth image and the rendering parameters includes: Obtain the number of texture levels from the rendering parameters, and obtain the texture image corresponding to the target image; wherein, the number of texture levels is negatively correlated with the performance parameters of the rendering device; Use the texture image as the first texture image, and perform a downscaling process on the first texture image to obtain a second texture image; Use the second texture image as the next first texture image, and perform a downscaling process on the next first texture image until multiple texture images matching the number of texture levels are obtained; Sample from the multiple texture images according to the depth image, and map the sampled color values to the set display area to render the target image to the set display area.
18. An image processing apparatus, characterized in that, The device includes: An acquisition module configured to acquire a target image to be processed, and perform depth detection on the target image to obtain a depth image of the target image; wherein, the depth image includes the depth value of each pixel point in the target image; A first rendering module configured to render the target image to a set display area according to the depth image; An adjustment module configured to dynamically adjust the visual attribute parameters of each pixel point according to the depth value of each pixel point included in the depth image to obtain an adjusted target image; A second rendering module configured to render the adjusted target image to the set display area.
19. An electronic device, characterized in that, including: One or more processors; A storage device for storing one or more computer programs, which when executed by the one or more processors, cause the electronic device to implement the method according to any one of claims 1-17.
20. A computer-readable storage medium, characterized in that A computer program is stored thereon, which when executed by a processor of an electronic device, causes the electronic device to implement the method according to any one of claims 1-17.