Image processing method and apparatus, device, computer-readable storage medium, and product

By adding and cropping preset pixels around the image, the problem of stretching and jumping when the image is displayed on the terminal device after processing by the cloud server is solved, the display effect of the image is optimized, and the user experience is improved.

WO2024199011A1PCT designated stage expired Publication Date: 2024-10-03BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Application Number
PCT/CN2024/082468
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-31
Filing Date
2024-03-19
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

When using a cloud server for image processing, since the algorithm used by the cloud server to process images can only process images of specified sizes, the acquired target image may stretch or jump when displayed on the terminal device, affecting users. experience.

Method used

Add preset pixels around the image to be processed and adjust it to the specified size that the cloud server can handle. After obtaining it, crop the preset pixels in the target image to ensure that it is consistent with the rendering canvas size to avoid image stretching and jumping. Change to optimize the display effect.

Benefits of technology

Through preset pixel addition and cropping operations, it is ensured that the image does not stretch or jump when the display is switched, which improves the image display effect and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024082468_03102024_PF_FP_ABST
    Figure CN2024082468_03102024_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide an image processing method and apparatus, a device, a computer-readable storage medium, and a product. The method comprises: in response to an image processing operation triggered by a user, obtaining a first image of a first preset size; adjusting the size of the first image to a second preset size matched to a preset image processing algorithm, obtaining a second image; based on the image processing algorithm, performing image processing operations on the second image to obtain a third image; adjusting the size of the third image to the first preset size, obtaining a target image; and, on a rendering canvas of the first preset size, rendering the gradual switching effects of switching from the first image to the target image.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, device, equipment, computer-readable storage medium and product

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is based on the Chinese application with application number 202310342564.2 and application date March 31, 2023, and claims its priority. The disclosed content of the Chinese application is hereby introduced as a whole into this application. Technical Field

[0003] The embodiments of the present disclosure relate to the field of image processing technology, and in particular to an image processing method, apparatus, device, computer-readable storage medium, and product. Background Art

[0004] Currently, users can perform image editing operations on application software. For example, in response to an editing operation triggered by the user, an image generated by the user can be converted into an image with a comic effect.

[0005] As an implementable method, the image generated by the user can be uploaded to the cloud server for image processing, and then the image processing result fed back by the cloud server can be obtained for display.

[0006] Summary of the Invention

[0007] Embodiments of the present disclosure provide an image processing method, apparatus, device, computer-readable storage medium, and product.

[0008] In one aspect, an embodiment of the present disclosure provides an image processing method, comprising:

[0009] In response to an image processing operation triggered by a user, acquiring a first image of a first preset size;

[0010] Adjusting the size of the first image to a second preset size that matches a preset image processing algorithm to obtain a second image;

[0011] performing an image processing operation on the second image based on the image processing algorithm to obtain a third image;

[0012] Adjusting the size of the third image to the first preset size to obtain a target image;

[0013] A gradual switching effect from the first image to the target image is rendered on a rendering canvas of a first preset size.

[0014] In another aspect, an embodiment of the present disclosure provides an image processing apparatus, comprising:

[0015] an acquisition module, configured to acquire a first image of a first preset size in response to an image processing operation triggered by a user;

[0016] an editing module, configured to adjust the size of the first image to a second preset size that matches a preset image processing algorithm, to obtain a second image;

[0017] a processing module, configured to perform an image processing operation on the second image based on the image processing algorithm to obtain a third image;

[0018] an adjusting module, configured to adjust the size of the third image to the first preset size to obtain a target image;

[0019] The switching module is configured to render a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size.

[0020] In another aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;

[0021] The memory stores computer-executable instructions;

[0022] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image processing method as described in the above aspect and various possible designs of this aspect.

[0023] In another aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When a processor executes the computer-executable instructions, the image processing method described in the above aspect and various possible designs of this aspect is implemented.

[0024] In another aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the image processing method described in the above aspect and various possible designs of this aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0026] FIG1 is a schematic diagram of a flow chart of an image processing method provided by an embodiment of the present disclosure;

[0027] FIG2 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0028] FIG3 is a schematic flow chart of an image processing method provided by yet another embodiment of the present disclosure;

[0029] FIG4 is a schematic diagram of a cropping adjustment method provided in an embodiment of the present disclosure;

[0030] FIG5 is a schematic diagram of a filling adjustment method provided in an embodiment of the present disclosure;

[0031] FIG6 is a schematic flow chart of an image processing method provided by yet another embodiment of the present disclosure;

[0032] FIG7 is a schematic flow chart of an image processing method provided by yet another embodiment of the present disclosure;

[0033] FIG8 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure;

[0034] FIG9 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0036] In order to solve the technical problem of poor display effect when displaying processing results fed back by a cloud server, the present disclosure provides an image processing method, apparatus, device, computer-readable storage medium and product.

[0037] It should be noted that the image processing method, apparatus, device, computer-readable storage medium, and product provided by the present disclosure can be applied to any image processing scenario requiring end-cloud collaboration.

[0038] Currently, when using cloud servers for image processing, the algorithms used by cloud servers are only capable of processing images of a specified size, which differs from the rendering canvas size of the terminal device. Therefore, after receiving the processed target image from the cloud server, displaying it on the terminal device may cause image stretching or jumps, resulting in poor display quality and a negative user experience.

[0039] In the process of solving the above technical problems, the inventors discovered through research that in order to avoid jumps and image stretching when displaying the target image, before sending the image to be processed to the cloud server for image processing, preset pixels can be added around the image to be processed to adjust it to a specified size image that the cloud server can process. After obtaining the target image feedback from the cloud server, the preset pixels in the target image are cropped to obtain an image to be displayed that is consistent with the size of the rendering canvas. The image to be displayed corresponds one-to-one to the pixels in the image to be processed. Therefore, when the display switching effect is displayed, there will be no jumps or stretching, which optimizes the display effect of the image.

[0040] The system architecture on which the present disclosure is based includes at least a terminal device and a server. The terminal device is communicatively connected to the server. The terminal device is capable of acquiring a first image generated by a user, and adding preset pixels to the edge of the first image, editing the first image into a second image of a second preset size. The second image is sent to the server so that the server performs image processing operations on the second image. Furthermore, the terminal device can acquire a third image fed back by the server, and perform a cropping operation on the preset pixels in the third image to obtain a target image. A gradient switching effect from the first image to the target image is rendered on a rendering canvas of the first preset size.

[0041] FIG1 is a flow chart of an image processing method provided by an embodiment of the present disclosure. As shown in FIG1 , the method includes:

[0042] Step 101: In response to an image processing operation triggered by a user, a first image of a first preset size is acquired.

[0043] In this embodiment, the user can trigger an image processing operation based on actual needs. The image processing operation may include image beautification, face beautification, image style conversion, and other image processing operations. For example, the user can trigger an image processing operation to convert a user-generated image into a comic-style image.

[0044] Optionally, a plurality of different image processing types may be displayed on the terminal device, and the user may trigger an image processing operation by performing a triggering operation on the image processing type.

[0045] In response to a user-triggered image processing request, a first image of a first preset size may be obtained. The first preset size may be a renderable size of a rendering canvas. For example, the first preset size may be 9:16.

[0046] The user may directly generate an original image of the first preset size and determine the original image as the first image. Alternatively, the user may generate an original image of any size and adjust the original image to the first image of the first preset size.

[0047] Step 102: Adjust the size of the first image to a second preset size that matches a preset image processing algorithm to obtain a second image.

[0048] In this embodiment, a preset image processing algorithm can be used to perform image processing operations on the first image. This image processing algorithm can perform image processing operations on images of a second preset size. The second preset size that can be processed by the image processing algorithm is generally any size that is a multiple of 64. The image size that can be processed by the image processing algorithm may differ from the first preset size. Therefore, to perform the image processing operation, the first image can be resized to the second preset size that matches the preset image processing algorithm to obtain a second image.

[0049] For example, the first preset size may be 9:16, and the image size that can be processed by the image processing algorithm may be 768*1280. Therefore, in order to implement the image processing operation, the first image of the first preset size may be adjusted to 768*1280.

[0050] It should be noted that the image processing algorithm can be coupled to the terminal device, so that the image processing operation can be directly implemented in the terminal device. Alternatively, the image processing algorithm can also be coupled to a preset image processing terminal, so that the terminal device can send the second image to the image processing terminal for image processing operations.

[0051] Step 103: Perform an image processing operation on the second image based on the image processing algorithm to obtain a third image.

[0052] In this embodiment, after the first image is edited into a second image of a second preset size, an image processing operation may be performed based on the second image to obtain a third image.

[0053] Continuing with the above example, if the image processing algorithm is coupled to the image processing terminal, the second image can be sent to the image processing terminal for image processing operations to obtain a third image. Alternatively, if the image processing algorithm is coupled to the terminal device, the image processing operations can be performed directly on the terminal device to obtain the third image. This disclosure does not limit this.

[0054] Step 104: Adjust the size of the third image to the first preset size to obtain a target image.

[0055] In this embodiment, after acquiring the third image, it is necessary to render it on the rendering canvas so that the user can view it. However, since the size of the third image is the same as that of the second image, which is the second preset size, that is, the third image is different from the first preset size of the rendering canvas, directly rendering the third image may cause image stretching or jumps, resulting in poor display quality. Therefore, it is necessary to resize the third image of the second preset size to the target image of the first preset size.

[0056] Step 105 : Rendering a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size.

[0057] In this embodiment, after obtaining the target image of the first preset size, the target image can be rendered on a rendering canvas of the first preset size, so that the user can view the result of image processing.

[0058] As an implementable approach, a gradual switching effect from the first image to the target image may be rendered on a rendering canvas of a first preset size, thereby improving the display effect of the target image and enhancing the user experience.

[0059] The image processing method provided in this embodiment obtains a second image by, after acquiring a first image of a first preset size, adjusting the first image to a second preset size that matches a preset image processing end. An image processing operation is performed on the second image of the second preset size to obtain a third image. The third image is then adjusted to a target image that matches the pixel position in the first image. A gradient switching effect is rendered from the first image to the target image. By rendering a gradient switching effect from the first image to the target image, the display effect in the display interface can be optimized. In addition, since the pixels in the first image and the target image are one-to-one corresponding, and the first image and the target image are the same size, there will be no jump or stretching when the switching effect is displayed, thereby optimizing the display effect of the image.

[0060] As an practicable manner, based on any of the above embodiments, step 102 includes:

[0061] Editing the first image into a second image of a second preset size by adding preset pixels to an edge of the first image;

[0062] Step 104 includes:

[0063] A cropping operation is performed on preset pixels in the third image to obtain a target image.

[0064] In this embodiment, in order to implement the image processing operation on the first image using the preset image processing algorithm, the size of the first image may be adjusted to a second preset size that matches the image processing algorithm.

[0065] To resize the first image, preset pixels may be pre-set. The preset pixels may be pixels of a preset color and / or a preset texture. After acquiring the first image, the preset pixels may be added to the edge of the first image to edit the first image into a second image of a second preset size.

[0066] As an implementable approach, preset pixels of different colors and textures can be pre-set. After acquiring a first image, preset pixels matching the first image can be selected based on the image features of the first image to perform a fill operation on the first image. The image features include, but are not limited to, the hue, texture, and type of object in the first image. For example, if the first image is dark, black preset pixels can be selected to fill the first image. If the object in the first image is a cute object such as a pet, preset pixels with a cute texture can be selected to fill the first image.

[0067] As an practicable approach, after filling the first image with the preset pixels, the display position and coverage of the preset pixels in the second image, along with the second image, can also be sent to the image processing algorithm. The image processing algorithm can then process the valid image content in the second image excluding the preset pixels based on the display position and coverage of the preset pixels, helping the image processing algorithm save computing power and achieve higher-quality image processing results.

[0068] Optionally, the preset pixels may be redundant pixels, such as black pixels. When the first image is filled with these redundant pixels, a black border effect can be presented around the first image. When the preset pixels are redundant pixels, these redundant pixels do not contain any information. Therefore, after the first image is filled with redundant pixels, when the image processing algorithm processes the second image, no image processing is required for the redundant pixel regions, as these redundant pixels do not contain any information. This reduces the computational complexity of the image processing algorithm and improves image processing efficiency.

[0069] As an practicable approach, after filling the first image with the preset pixels, the display position and coverage of the preset pixels in the second image, along with the second image, can also be sent to the image processing algorithm. The image processing algorithm can then process the valid image content in the second image excluding the preset pixels based on the display position and coverage of the preset pixels, helping the image processing algorithm save computing power and achieve higher-quality image processing results.

[0070] For example, the first image can be padded with black preset pixels (black borders). The first preset size can be 9:16, and the image size that the image processing algorithm can process can be 768*1280. Therefore, to implement the image processing operation, black borders can be padded around the first image of the first preset size, converting the 9:16 first image into a second image of 768*1280.

[0071] Furthermore, after obtaining the third image processed by the preset image processing algorithm, it is necessary to render the third image on the rendering canvas so that the user can view the third image. However, because the size of the third image differs from the first preset size corresponding to the rendering canvas, directly rendering the third image may cause image stretching or jumps, resulting in poor display quality. Therefore, it is necessary to resize the third image from the second preset size to the first preset size.

[0072] As an practicable approach, the third image can be cropped to obtain a target image of the first preset size. Since the third image is obtained by image processing based on the second image filled with the preset pixels, the third image also includes the same preset pixels as the second image. Therefore, the target image can be obtained by directly cropping the preset pixels in the third image. By cropping the preset pixels, the target image of the first preset size can be obtained. Furthermore, cropping and damage to valid pixels in the target image are not caused, thereby ensuring the quality of the target image.

[0073] The image processing method provided in this embodiment obtains a second image of a second preset size by filling the first image with preset pixels. After image processing is performed based on the second image, a third image including the preset pixels can be obtained. After acquiring the third image, a target image that matches the pixel position in the first image can be obtained by cropping the preset pixels at the edge of the third image. Therefore, in the subsequent rendering process, since the first image and the target image have the same size and no pixel cropping occurs during the image processing process, the pixels in the first image and the target image are one-to-one corresponding. Therefore, when rendering a gradient switching effect, no jump or stretching occurs, thereby optimizing the display effect of the image.

[0074] As an operative approach, if the first predetermined size is larger than the second predetermined size, the first image is cropped to obtain a second image of the second predetermined size. The second image is processed using a predetermined image processing algorithm to obtain a third image of the predetermined size. The third image is padded with predetermined pixels to obtain a target image of the first predetermined size.

[0075] Through the above processing, the image processing algorithm can realize the processing operation on the second image. In addition, since the target image has the same size as the first image, no jump or stretching will occur when rendering the gradient switching effect.

[0076] Furthermore, based on any of the above embodiments, step 103 includes:

[0077] performing a feature recognition operation on the second image to obtain feature information corresponding to the second image;

[0078] sending the second image and the feature information to the image processing end, so that the image processing end performs image processing on the second image using the image processing algorithm based on the feature information; and

[0079] Acquire the third image sent by the image processing end.

[0080] In this embodiment, to reduce the computational complexity of the terminal device, image processing can be performed on an image processing terminal. This image processing terminal is pre-configured with an image processing algorithm that can perform image processing on an image of the second preset size. Therefore, the second image can be sent to the image processing terminal for image processing, resulting in a third image being fed back by the server.

[0081] Furthermore, in order to enable the image processing end to achieve higher-quality image processing effects, before sending the second image, a feature recognition operation can be performed on the second image to obtain feature information corresponding to the second image. For example, the user's gender, location, key points, and other content included in the second image can be identified to obtain feature information. The second image and feature information are sent to a preset image processing end, so that the image processing end uses the image processing algorithm based on the feature information to process the second image to obtain a third image. By sending the feature information, the processing accuracy of the image processing end can be improved. Furthermore, the third image sent by the image processing end can be obtained.

[0082] Figure 2 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure. As shown in Figure 2, a terminal device 21 can obtain a first image 22 of a first preset size, add preset pixels around the first image 22, and obtain a second image 23 of a second preset size. The second image 23 is sent to a server 24, which performs image processing on the second image to obtain a third image 25, where the third image 25 also includes the preset pixels. The third image 25 is then received from the server 24, and the preset pixels in the third image 25 are cropped to obtain a target image 26. This allows for the rendering of a gradual transition effect from the first image to the target image.

[0083] The image processing method provided in this embodiment performs image processing operations on a cloud server, thereby effectively reducing the computing pressure on the terminal and avoiding lag on the terminal while ensuring the image processing effect.

[0084] FIG3 is a flowchart of an image processing method provided by another embodiment of the present disclosure. Based on any of the above embodiments, as shown in FIG3 , step 101 includes:

[0085] Step 301: In response to an image processing operation triggered by a user, an original image generated by the user is obtained;

[0086] Step 302: Determine the size information of the original image;

[0087] Step 303: Adjust the size of the original image according to the size information using an image size adjustment method that matches the size information to obtain a first image of the first preset size.

[0088] In this embodiment, the user can generate an original image. The original image can be captured by the user in real time, or selected and uploaded by the user from a preset storage path. The size of the original image can be the same as the size of the rendering canvas, or it can be any size.

[0089] When the size of the original image is different from the size of the rendering canvas, the size of the original image can be adjusted to be the first image of the first preset size. Conversely, when the size of the original image is the same as the size of the rendering canvas, the original image can be directly determined as the first image of the first preset size.

[0090] Optionally, in response to an image processing operation triggered by a user, an original image generated by the user is obtained, size information of the original image is determined, and different size adjustment methods can be selected to adjust the size of the original image according to different size information.

[0091] After determining the size information of the original image, the size of the original image may be adjusted according to the size information using an image size adjustment method that matches the size information to obtain a first image of a first preset size.

[0092] The image processing method provided in this embodiment converts an original image into a first image of a first preset size using a resizing method that matches the original image size, if the original image size differs from the rendering canvas size. Consequently, when the original image is displayed on a terminal device, the resized first image is the same size as the rendering canvas, preventing image distortion or jumps in the original image display.

[0093] Optionally, based on any of the above embodiments, step 303 includes:

[0094] If the size information is smaller than a preset target size threshold, adjusting the size of the original image by cropping to obtain a first image of the first preset size; and

[0095] If the size information is larger than a preset target size threshold, the size of the original image is adjusted in a filling mode to obtain a first image of the first preset size.

[0096] In this embodiment, two different image resizing modes can be pre-set: cropping mode and fill mode. In fill mode, the fitight / fitwidth can be automatically selected, and no pixels are cropped from the input image to the result image, but black edges may be present. In cropping mode, the fitight / fitwidth can be automatically selected, and no preset pixels (black edges) are filled in from the input image to the result image, but cropping may occur.

[0097] Therefore, after determining the size of the original image, if it is detected that the size information is smaller than the preset target size threshold, the size of the original image is adjusted by cropping to obtain a first image of the first preset size. If it is detected that the size information is larger than the preset target size threshold, the size of the original image is adjusted by filling mode to obtain a first image of the first preset size.

[0098] Furthermore, based on any of the above embodiments, the step of adjusting the size of the original image by cropping to obtain the first image of the first preset size includes:

[0099] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image; and

[0100] A cropping operation is performed on the height or width of the stretched original image that does not match the target size threshold to obtain a first image of the first preset size.

[0101] In this embodiment, in the cropping mode, the width or height of the original image can be stretched to a width or height that matches the target size threshold to obtain a stretched original image. The height or width portion of the stretched original image that does not match the target size threshold is cropped to obtain a first image of the first preset size.

[0102] FIG4 is a schematic diagram of a cropping adjustment method provided in an embodiment of the present disclosure. As shown in FIG4 , if the size information of an original image 41 is smaller than a preset target size threshold, the width of the original image 41 can be stretched to a width that matches the target size threshold, thereby obtaining a stretched original image 42. A cropping operation is performed on the height region of the stretched original image 42 that does not match the target size threshold, thereby obtaining a first image 43 of the first preset size.

[0103] Furthermore, based on any of the above embodiments, the size of the original image is adjusted in a fill mode to obtain the first image of the first preset size, including:

[0104] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image; and

[0105] A first image of the first preset size is obtained by filling a height or width portion of the stretched original image that does not match the target size threshold with preset pixels.

[0106] In this embodiment, in fill mode, the width or height of the original image can be stretched to a width or height that matches the target size threshold, thereby obtaining a stretched original image. The portion of the height or width of the stretched original image that does not match the target size threshold is padded with preset pixels to obtain a first image of a first preset size. For example, the portion of the height or width of the stretched original image that does not match the target size threshold can be padded with black borders to obtain the first image.

[0107] The preset pixel may be a pixel of a preset color and / or preset texture preset by a user.

[0108] FIG5 is a schematic diagram of a padding adjustment method provided in an embodiment of the present disclosure. As shown in FIG5 , if the size information of an original image 51 is larger than a preset target size threshold, the width of the original image 51 can be stretched to a width that matches the target size threshold, thereby obtaining a stretched original image 52. The height or width portions of the stretched original image 52 that do not match the target size threshold are padded with preset pixels to obtain a first image 53 of a first preset size. Specifically, the preset pixels can be black pixels, displayed as black borders.

[0109] The image processing method provided in this embodiment uses different methods to adjust the size of original images of different sizes, thereby accurately adjusting the size of original images of different sizes, and further realizing normal display of original images of different sizes.

[0110] FIG6 is a flowchart of an image processing method provided by another embodiment of the present disclosure. Based on any of the above embodiments, as shown in FIG6 , after step 105, the method further includes:

[0111] Step 601: In response to the image saving request triggered by the user, a stitching operation is performed on the original image of any size and the target image to obtain a stitched image; and

[0112] Step 602: Save the stitched image.

[0113] In this embodiment, after the first image is processed to obtain the target image, the user can trigger an image save request. In response to the image save request, the original image of any size and the target image can be spliced ​​to obtain a spliced ​​image, which is then saved.

[0114] Further, based on any of the above embodiments, step 601 includes:

[0115] If the first preset size of the original image is smaller than a preset size ratio, horizontally stitching the original image and the target image to obtain the stitched image; and

[0116] If the first preset size of the original image is larger than a preset size ratio, the original image and the target image are cropped according to the preset size ratio, and the cropped original image and the target image are vertically spliced ​​to obtain the spliced ​​image.

[0117] In this embodiment, since the sizes of the original image and the target image may be different, different splicing methods may be used to perform splicing processing for original images of different sizes.

[0118] Optionally, if the first preset size of the original image is smaller than a preset size ratio, a horizontal stitching method may be selected for the stitching operation. The original image and the target image may be stitched horizontally to obtain a stitched image. If the first preset size of the original image is larger than the preset size ratio, a vertical stitching method may be selected for the stitching operation. The original image and the target image may be cropped according to the preset size ratio, and the cropped original image and target image may be stitched vertically to obtain a stitched image.

[0119] The image processing method provided in this embodiment responds to an image saving request triggered by a user and performs image stitching operations in different ways based on the size of the original image, thereby improving the image quality of the stitched image and enhancing the user experience.

[0120] Further, based on any of the above embodiments, step 105 includes:

[0121] A gradual switching effect of switching from the first image to the target image is rendered on a rendering canvas of a first preset size within a preset time range.

[0122] In this embodiment, the time range can be preset, for example, the time range can be one second. Alternatively, the time range can be set according to the actual needs of the user, and the present disclosure does not limit this.

[0123] After the time range is determined, a gradual switching effect from the first image to the target image can be rendered on a rendering canvas of a first preset size within the preset time range.

[0124] FIG7 is a flow chart of an image processing method provided by another embodiment of the present disclosure. Based on any of the above embodiments, as shown in FIG7 , rendering a gradual transition effect from the first image to the target image on a rendering canvas of a first preset size within a preset time range includes:

[0125] Step 701: for a current time frame within the preset time range, determine a target value corresponding to the current time frame, wherein the target value range is the same as the grayscale value range, and the target value range is evenly distributed within the preset time range in ascending order, corresponding one-to-one to each time frame within the time range;

[0126] Step 702: performing grayscale processing on the first image to determine grayscale values ​​corresponding to pixels in the first image;

[0127] Step 703: for at least one target pixel in the first image, compare the grayscale value corresponding to the target pixel with the target value corresponding to the current time frame to obtain a comparison result; and

[0128] Step 704: Render a gradual switching effect from the first image to the target image according to the comparison result.

[0129] In this embodiment, after determining the time range, a target value can be set based on the time range. A different target value corresponds to each time frame within the time range. The target value range is the same as the grayscale value range, and the target value range is evenly distributed within the preset time range in ascending order. For example, the target value corresponding to the current time frame may be 0.25, and the target value corresponding to the next time frame may be 0.26.

[0130] For a current time frame within a preset time range, a target value corresponding to the current time frame is determined. Grayscale processing is performed on the first image to obtain a grayscale value corresponding to each pixel in the first image. For at least one target pixel in the first image, the grayscale value corresponding to the target pixel is compared with the target value corresponding to the current time frame to obtain a comparison result. A gradient transition effect from the first image to the target image is rendered based on the comparison result.

[0131] As the time frame changes, the target value also changes. Consequently, the comparison between the grayscale value and the target value also changes, thereby achieving a gradual rendering effect from the first image to the target image.

[0132] Furthermore, based on any of the above embodiments, rendering a gradual switching effect from the first image to the target image according to the comparison result includes:

[0133] If the grayscale value of the target pixel is less than the target value, rendering the target pixel in the first image on the rendering canvas; and

[0134] If the grayscale value of the target pixel value is greater than the target value, the pixel matching the target pixel in the target image is rendered on the rendering canvas to present a gradual switching effect from the first image to the target image.

[0135] In this embodiment, after obtaining the comparison result, if the grayscale value of the target pixel is less than the target value, the target pixel in the first image is rendered on the rendering canvas. If the grayscale value of the target pixel is greater than the target value, the pixel in the target image that matches the target pixel is rendered on the rendering canvas, presenting a gradual transition effect from the first image to the target image.

[0136] For example, if a pixel has a grayscale value of 0.25 and a target value of 0.26, and the grayscale value is less than the target value, the pixel in the first image can be rendered. If a pixel has a grayscale value of 0.27 and a target value of 0.26, and the grayscale value is greater than the target value, the pixel in the target image can be rendered.

[0137] The image processing method provided in this embodiment pre-sets the target numerical value corresponding to the time frame, so that in different time frames, the grayscale value corresponding to each pixel can be compared with the target numerical value corresponding to the current time frame to determine whether to render the first image or the rendering target image, thereby achieving a gradual switching display effect and improving the user experience.

[0138] Figure 8 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure. As shown in Figure 8, the device includes: an acquisition module 81, an editing module 82, a processing module 83, an adjustment module 84, and a switching module 85. Among them, the acquisition module 81 is used to acquire a first image of a first preset size in response to an image processing operation triggered by a user. The editing module 82 is used to adjust the size of the first image to a second preset size that matches a preset image processing algorithm to obtain a second image. The processing module 83 is used to perform an image processing operation on the second image based on the image processing algorithm to obtain a third image. The adjustment module 84 is used to adjust the size of the third image to the first preset size to obtain a target image. The switching module 85 is used to render a gradient switching effect from the first image to the target image on a rendering canvas of a first preset size.

[0139] Further, based on any of the above embodiments, the acquisition module is used to: acquire the original image generated by the user in response to an image processing operation triggered by the user; determine the size information of the original image; and adjust the size of the original image according to the size information using an image size adjustment method that matches the size information to obtain a first image of the first preset size.

[0140] Further, based on any of the above embodiments, the acquisition module is used to: if the size information is smaller than a preset target size threshold, adjust the size of the original image by cropping to obtain a first image of the first preset size; and if the size information is larger than the preset target size threshold, adjust the size of the original image by filling mode to obtain a first image of the first preset size.

[0141] Furthermore, based on any of the above embodiments, the acquisition module is used to: stretch the width or height of the original image to a width or height that matches the target size threshold to obtain the stretched original image; and crop the height or width of the stretched original image that does not match the target size threshold to obtain the first image of the first preset size.

[0142] Furthermore, based on any of the above embodiments, the acquisition module is used to: stretch the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image; and fill the height or width portion of the stretched original image that does not match the target size threshold with preset pixels to obtain a first image of the first preset size.

[0143] Furthermore, based on any of the above embodiments, the editing module is used to add preset pixels to the edge of the first image to edit the first image into a second image of a second preset size; the adjustment module is used to perform a cropping operation on the preset pixels in the third image to obtain the target image.

[0144] Furthermore, based on any of the above embodiments, the processing module is used to: perform feature recognition operations on the second image to obtain feature information corresponding to the second image; send the second image and the feature information to the image processing end, so that the image processing end uses the image processing algorithm to perform image processing on the second image based on the feature information; and obtain the third image sent by the image processing end.

[0145] Furthermore, based on any of the above embodiments, the device also includes: a stitching module, which is used to respond to the image saving request triggered by the user, to stitch the original image of any size with the target image to obtain a stitched image; and a saving module, which is used to save the stitched image.

[0146] Further, based on any of the above embodiments, the stitching module is used to: if the first preset size of the original image is smaller than the preset size ratio, then horizontally stitch the original image and the target image to obtain the stitched image; and if the first preset size of the original image is larger than the preset size ratio, then crop the original image and the target image according to the preset size ratio respectively, and vertically stitch the cropped original image and the target image to obtain the stitched image.

[0147] Furthermore, based on any of the above embodiments, the switching module is configured to render a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size within a preset time range.

[0148] Further, based on any of the above embodiments, the switching module is used to: determine the target numerical value corresponding to the current time frame within the preset time range, wherein the numerical range of the target numerical value is the same as the grayscale value range, and the numerical range of the target numerical value is evenly distributed within the preset time range in order from small to large, corresponding one-to-one to each time frame within the time range; perform grayscale processing on the first image to determine the grayscale value corresponding to the pixel in the first image; for at least one target pixel in the first image, compare the grayscale value corresponding to the target pixel with the target numerical value corresponding to the current time frame to obtain a comparison result; and render a gradual switching effect from the first image to the target image based on the comparison result.

[0149] Further, based on any of the above embodiments, the switching module is used to: if the grayscale value of the target pixel is less than the target value, render the target pixel in the first image on the rendering canvas; and if the grayscale value of the target pixel value is greater than the target value, render the pixel in the target image that matches the target pixel on the rendering canvas, presenting a gradual switching effect from the first image to the target image.

[0150] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.

[0151] In order to implement the above embodiment, the present disclosure further provides an electronic device, including: a processor and a memory;

[0152] The memory stores computer-executable instructions;

[0153] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the image processing method as described in any of the above embodiments.

[0154] FIG9 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG9 , the electronic device 900 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device shown in FIG9 is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0155] As shown in Figure 9, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0156] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although FIG9 shows an electronic device 900 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.

[0157] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.

[0158] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media 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 or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0159] In order to implement the above embodiments, the embodiments of the present disclosure further provide a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the image processing method described in any of the above embodiments is implemented.

[0160] In order to implement the above embodiments, the embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the image processing method as described in any of the above embodiments when executed by a processor.

[0161] In order to implement the above embodiments, the embodiments of the present disclosure further provide a computer program, which, when executed by a processor, implements the image processing method as described in any of the above embodiments.

[0162] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0163] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0164] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0165] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0166] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.

[0167] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0168] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0169] In one aspect, according to one or more embodiments of the present disclosure, there is provided an image processing method, comprising:

[0170] In response to an image processing operation triggered by a user, acquiring a first image of a first preset size;

[0171] Adjusting the size of the first image to a second preset size that matches a preset image processing algorithm to obtain a second image;

[0172] performing an image processing operation on the second image based on the image processing algorithm to obtain a third image;

[0173] Adjusting the size of the third image to the first preset size to obtain a target image;

[0174] A gradual switching effect from the first image to the target image is rendered on a rendering canvas of a first preset size.

[0175] According to one or more embodiments of the present disclosure, the step of acquiring a first image of a first preset size in response to an image processing operation triggered by a user includes:

[0176] In response to an image processing operation triggered by a user, obtaining an original image generated by the user;

[0177] Determining size information of the original image;

[0178] The size of the original image is adjusted according to the size information using an image size adjustment method that matches the size information to obtain a first image of the first preset size.

[0179] According to one or more embodiments of the present disclosure, adjusting the size of the original image according to the size information using an image size adjustment method that matches the size information to obtain a first image of the first preset size includes:

[0180] If the size information is smaller than a preset target size threshold, adjusting the size of the original image by cropping to obtain a first image of the first preset size;

[0181] If the size information is larger than a preset target size threshold, the size of the original image is adjusted in a filling mode to obtain a first image of the first preset size.

[0182] According to one or more embodiments of the present disclosure, adjusting the size of the original image by cropping to obtain the first image of the first preset size includes:

[0183] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image;

[0184] A cropping operation is performed on the height or width of the stretched original image that does not match the target size threshold to obtain a first image of the first preset size.

[0185] According to one or more embodiments of the present disclosure, adjusting the size of the original image in a fill mode to obtain the first image of the first preset size includes:

[0186] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image;

[0187] A first image of the first preset size is obtained by filling a height or width portion of the stretched original image that does not match the target size threshold with preset pixels.

[0188] According to one or more embodiments of the present disclosure, adjusting the size of the first image to a second preset size that matches a preset image processing algorithm to obtain the second image includes:

[0189] Adding preset pixels to the edge of the first image to edit the first image into a second image of a second preset size;

[0190] The step of adjusting the size of the third image to the first preset size to obtain a target image includes:

[0191] A cropping operation is performed on preset pixels in the third image to obtain the target image.

[0192] According to one or more embodiments of the present disclosure, performing an image processing operation on the second image based on the image processing algorithm to obtain a third image includes:

[0193] performing a feature recognition operation on the second image to obtain feature information corresponding to the second image;

[0194] sending the second image and the feature information to the image processing end, so that the image processing end performs image processing on the second image using the image processing algorithm based on the feature information; and

[0195] Acquire the third image sent by the image processing end.

[0196] According to one or more embodiments of the present disclosure, after rendering the gradual switching effect from the first image to the target image on the rendering canvas of the first preset size, the method further includes:

[0197] In response to the image saving request triggered by the user, performing a stitching operation on the original image of any size and the target image to obtain a stitched image;

[0198] The stitched image is saved.

[0199] According to one or more embodiments of the present disclosure, performing a stitching operation on the original image of any size and the target image to obtain a stitched image includes:

[0200] If the first preset size of the original image is smaller than a preset size ratio, horizontally stitching the original image and the target image to obtain the stitched image;

[0201] If the first preset size of the original image is larger than a preset size ratio, the original image and the target image are cropped according to the preset size ratio, and the cropped original image and the target image are vertically spliced ​​to obtain the spliced ​​image.

[0202] According to one or more embodiments of the present disclosure, rendering a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size includes:

[0203] A gradual switching effect of switching from the first image to the target image is rendered on a rendering canvas of a first preset size within a preset time range.

[0204] According to one or more embodiments of the present disclosure, rendering a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size within a preset time range includes:

[0205] For a current time frame within the preset time range, determining a target value corresponding to the current time frame, wherein the target value range is the same as the grayscale value range, and the target value range is evenly distributed within the preset time range in ascending order, corresponding one-to-one to each time frame within the time range;

[0206] performing grayscale processing on the first image to determine grayscale values ​​corresponding to pixels in the first image;

[0207] For at least one target pixel in the first image, performing a comparison operation on a grayscale value corresponding to the target pixel and a target value corresponding to the current time frame to obtain a comparison result;

[0208] A gradual switching effect of switching from the first image to the target image is rendered according to the comparison result.

[0209] According to one or more embodiments of the present disclosure, rendering a gradual switching effect from the first image to the target image according to the comparison result includes:

[0210] If the grayscale value of the target pixel is less than the target value, rendering the target pixel in the first image on the rendering canvas;

[0211] If the grayscale value of the target pixel value is greater than the target value, the pixel matching the target pixel in the target image is rendered on the rendering canvas to present a gradual switching effect from the first image to the target image.

[0212] In another aspect, according to one or more embodiments of the present disclosure, there is provided an image processing apparatus, including:

[0213] an acquisition module, configured to acquire a first image of a first preset size in response to an image processing operation triggered by a user;

[0214] an editing module, configured to adjust the size of the first image to a second preset size that matches a preset image processing algorithm, to obtain a second image;

[0215] a processing module, configured to perform an image processing operation on the second image based on the image processing algorithm to obtain a third image;

[0216] an adjusting module, configured to adjust the size of the third image to the first preset size to obtain a target image;

[0217] The switching module is configured to render a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size.

[0218] According to one or more embodiments of the present disclosure, the acquisition module is configured to:

[0219] In response to an image processing operation triggered by a user, obtaining an original image generated by the user;

[0220] Determining size information of the original image;

[0221] The size of the original image is adjusted according to the size information using an image size adjustment method that matches the size information to obtain a first image of the first preset size.

[0222] According to one or more embodiments of the present disclosure, the acquisition module is configured to:

[0223] If the size information is smaller than a preset target size threshold, adjusting the size of the original image by cropping to obtain a first image of the first preset size;

[0224] If the size information is larger than a preset target size threshold, the size of the original image is adjusted in a filling mode to obtain a first image of the first preset size.

[0225] According to one or more embodiments of the present disclosure, the acquisition module is configured to:

[0226] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image;

[0227] A cropping operation is performed on the height or width of the stretched original image that does not match the target size threshold to obtain a first image of the first preset size.

[0228] According to one or more embodiments of the present disclosure, the acquisition module is configured to:

[0229] Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image;

[0230] A first image of the first preset size is obtained by filling a height or width portion of the stretched original image that does not match the target size threshold with preset pixels.

[0231] According to one or more embodiments of the present disclosure, the editing module is configured to add preset pixels to an edge of the first image to edit the first image into a second image of a second preset size;

[0232] The adjustment module is used to perform a cropping operation on preset pixels in the third image to obtain the target image.

[0233] According to one or more embodiments of the present disclosure, the processing module is configured to:

[0234] performing a feature recognition operation on the second image to obtain feature information corresponding to the second image;

[0235] sending the second image and the feature information to the image processing end, so that the image processing end performs image processing on the second image using the image processing algorithm based on the feature information;

[0236] Acquire the third image sent by the image processing end.

[0237] According to one or more embodiments of the present disclosure, the apparatus further includes:

[0238] a stitching module, configured to stitch an original image of any size with the target image in response to an image saving request triggered by the user, to obtain a stitched image;

[0239] A saving module is used to save the stitched image.

[0240] According to one or more embodiments of the present disclosure, the splicing module is used to:

[0241] If the first preset size of the original image is smaller than a preset size ratio, horizontally stitching the original image and the target image to obtain the stitched image;

[0242] If the first preset size of the original image is larger than a preset size ratio, the original image and the target image are cropped according to the preset size ratio, and the cropped original image and the target image are vertically spliced ​​to obtain the spliced ​​image.

[0243] According to one or more embodiments of the present disclosure, the switching module is configured to:

[0244] A gradual switching effect of switching from the first image to the target image is rendered on a rendering canvas of a first preset size within a preset time range.

[0245] According to one or more embodiments of the present disclosure, the switching module is configured to:

[0246] For a current time frame within the preset time range, determining a target value corresponding to the current time frame, wherein the target value range is the same as the grayscale value range, and the target value range is evenly distributed within the preset time range in ascending order, corresponding one-to-one to each time frame within the time range;

[0247] performing grayscale processing on the first image to determine grayscale values ​​corresponding to pixels in the first image;

[0248] For at least one target pixel in the first image, performing a comparison operation on a grayscale value corresponding to the target pixel and a target value corresponding to the current time frame to obtain a comparison result;

[0249] A gradual switching effect of switching from the first image to the target image is rendered according to the comparison result.

[0250] According to one or more embodiments of the present disclosure, the switching module is configured to:

[0251] If the grayscale value of the target pixel is less than the target value, rendering the target pixel in the first image on the rendering canvas;

[0252] If the grayscale value of the target pixel value is greater than the target value, the pixel matching the target pixel in the target image is rendered on the rendering canvas to present a gradual switching effect from the first image to the target image.

[0253] In another aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, including: at least one processor and a memory;

[0254] The memory stores computer-executable instructions;

[0255] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image processing method described in the above aspect and various possible designs of this aspect.

[0256] In another aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the image processing method described in the above aspect and various possible designs of this aspect is implemented.

[0257] In another aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the image processing method described in the above aspect and various possible designs of this aspect.

[0258] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.

[0259] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0260] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims

1. An image processing method, comprising: In response to an image processing operation triggered by a user, acquiring a first image of a first preset size; Adjusting the size of the first image to a second preset size matching a preset image processing algorithm to obtain a second image; Performing an image processing operation on the second image based on the image processing algorithm to obtain a third image; Adjusting the size of the third image to the first preset size to obtain a target image; A gradual switching effect from the first image to the target image is rendered on a rendering canvas of a first preset size.

2. The method according to claim 1, wherein: The step of acquiring a first image of a first preset size in response to an image processing operation triggered by a user includes: In response to an image processing operation triggered by a user, acquiring an original image generated by the user; Determine the size information of the original image; The size of the original image is adjusted according to the size information by using an image size adjustment method that matches the size information to obtain a first image of the first preset size.

3. The method according to claim 2, wherein: The step of adjusting the size of the original image according to the size information by using an image size adjustment method that matches the size information to obtain a first image of the first preset size includes: If the size information is smaller than a preset target size threshold, adjusting the size of the original image by cropping to obtain a first image of the first preset size; If the size information is larger than a preset target size threshold, the size of the original image is adjusted in a filling mode to obtain a first image of the first preset size.

4. The method according to claim 3, wherein: The step of adjusting the size of the original image by cropping to obtain the first image of the first preset size includes: Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image; A cropping operation is performed on the height or width of the stretched original image that does not match the target size threshold to obtain a first image of the first preset size.

5. The method according to claim 3 or 4, wherein: The step of adjusting the size of the original image by using the fill mode to obtain the first image of the first preset size includes: Stretching the width or height of the original image to a width or height that matches the target size threshold to obtain a stretched original image; A filling operation is performed on a height or width portion of the stretched original image that does not match the target size threshold using preset pixels to obtain a first image of the first preset size.

6. The method according to any one of claims 1 to 5, wherein: The step of adjusting the size of the first image to a second preset size matching a preset image processing algorithm to obtain a second image includes: Adding preset pixels to the edge of the first image, editing the first image into a second image of a second preset size; The step of adjusting the size of the third image to the first preset size to obtain a target image includes: A cropping operation is performed on preset pixels in the third image to obtain the target image.

7. The method according to any one of claims 1 to 6, wherein: The step of performing an image processing operation on the second image based on the image processing algorithm to obtain a third image includes: performing a feature recognition operation on the second image to obtain feature information corresponding to the second image; sending the second image and the feature information to the image processing end, so that the image processing end performs image processing on the second image using the image processing algorithm based on the feature information; Acquire the third image sent by the image processing end.

8. The method according to any one of claims 1 to 7, wherein: After rendering the gradual switching effect of switching from the first image to the target image on the rendering canvas of the first preset size, the method further includes: In response to the image saving request triggered by the user, performing a stitching operation on the original image of any size and the target image to obtain a stitched image; The stitched image is saved.

9. The method according to claim 8, wherein: The step of performing a stitching operation on the original image of any size and the target image to obtain a stitched image includes: If the first preset size of the original image is smaller than the preset size ratio, horizontally stitching the original image and the target image to obtain the stitched image; If the first preset size of the original image is larger than the preset size ratio, the original image and the target image are cropped according to the preset size ratio, and the cropped original image and the target image are vertically spliced ​​to obtain the spliced ​​image.

10. The method according to any one of claims 1 to 9, wherein: The step of rendering a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size includes: A gradual switching effect of switching from the first image to the target image is rendered on a rendering canvas of a first preset size within a preset time range.

11. The method according to claim 10, wherein: The step of rendering a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size within a preset time range includes: For the current time frame within the preset time range, determine the target value corresponding to the current time frame, wherein the value range of the target value is the same as the gray value range, and the value range of the target value is evenly distributed within the preset time range in order from small to large, corresponding one to one to each time frame within the time range; Performing grayscale processing on the first image to determine grayscale values ​​corresponding to pixels in the first image; For at least one target pixel in the first image, a grayscale value corresponding to the target pixel is compared with a target value corresponding to the current time frame to obtain a comparison result; A gradual switching effect of switching from the first image to the target image is rendered according to the comparison result.

12. The method according to claim 11, wherein: The rendering of a gradual switching effect from the first image to the target image according to the comparison result includes: If the grayscale value of the target pixel is less than the target value, rendering the target pixel in the first image on the rendering canvas; If the grayscale value of the target pixel value is greater than the target value, the pixel matching the target pixel in the target image is rendered on the rendering canvas to present a gradual switching effect from the first image to the target image.

13. An image processing device, comprising: An acquisition module, configured to acquire a first image of a first preset size in response to an image processing operation triggered by a user; An editing module, used for adjusting the size of the first image to a second preset size matching a preset image processing algorithm, to obtain a second image; A processing module, configured to perform an image processing operation on the second image based on the image processing algorithm to obtain a third image; An adjustment module, used for adjusting the size of the third image to the first preset size to obtain a target image; A switching module is used to render a gradual switching effect from the first image to the target image on a rendering canvas of a first preset size.

14. An electronic device comprising: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the image processing method according to any one of claims 1 to 12.

15. A computer-readable storage medium, wherein: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the image processing method according to any one of claims 1 to 12 is implemented.

16. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 12 is implemented.

17. A computer program, wherein When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Image processing method and terminal

    CN107423663A

  • Image processing method and device and electronic equipment

    CN110825286A

  • Image processing method and device, storage medium and equipment

    CN113034348A

  • Image processing method, device and equipment, computer readable storage medium and product

    CN116309961A

  • Automated animated transitions between screens of a GUI application

    US8504925B1

Cited By

  • Image rendering method and electronic equipment

    CN120259513A