Image processing method and device, electronic equipment and storage medium

By preprocessing and sampling the initial video to generate the target video and converting it into a target image with an image interchange format, the problems of large bytes and slow processing speed generated in the prior art are solved, and efficient image compression and processing are achieved.

CN120050465APending Publication Date: 2025-05-27BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311586689.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing video to GIF image generated by GIF images takes up a large number of bytes and slow processing speed, which requires a lot of space and overhead during storage and transmission.

Method used

By buffering each frame image of the initial video into the memory space, an image list is constructed, and preprocessed based on the playback time and video content, the preprocessed video is obtained. The candidate image is then sampled from the preprocessed video, the target video is generated and converted into the target image with an image interchange format.

Benefits of technology

The footprint of the initial video is significantly compressed, the footprint of the generated target GIF image is reduced, the processing efficiency and the compression rate of the generated image are improved, and the integrity and coherence of the video content is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050465A_ABST
    Figure CN120050465A_ABST
Patent Text Reader

Abstract

The invention relates to an image processing method and device, electronic equipment and a storage medium, and the method comprises the steps: caching each frame of image in an obtained initial video into a memory space, and constructing an image list in the memory space; on the basis of the playing time and / or the video content of the initial video, preprocessing each frame of image in the initial video to obtain a preprocessed video; sampling from each frame of image included in the preprocessed video to obtain a candidate image, and storing the candidate image to the image list; and converting a target video generated based on each candidate image in the image list to obtain a target image with an image interchange format. According to the method, the occupied space of the initial video is greatly compressed, the occupied space of the generated target image is further greatly reduced, and content presentation is not affected while the compression ratio is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing, and in particular to an image processing method, device, electronic device and storage medium. Background Art

[0002] At present, GIF (Graphics Interchange Format) images are widely used in various online communication platforms. Many large Internet companies are actively promoting the development and application of video-to-GIF image technology, and many manufacturers regard it as one of the key functions of social media products. At the same time, some online video-to-GIF websites have also emerged, where users can upload their own video files for compression and generate GIF images, which is convenient and fast.

[0003] Most of the current methods for converting videos to GIF images simply compress and convert the video format. The generated GIF images still occupy a large number of bytes. Especially when generating GIF images from large video files, the processing speed is slow and the generated GIF images occupy a large number of bytes, which requires a lot of storage space and overhead during storage and transmission. Summary of the invention

[0004] The present disclosure provides an image processing method, device, electronic device and storage medium to overcome the problem that the generated GIF image occupies a large number of bytes and has a slow processing speed.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method, including:

[0006] Cache each frame image in the acquired initial video into a memory space, and construct an image list in the memory space;

[0007] Preprocessing each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video;

[0008] Sampling candidate images from each frame image included in the preprocessed video, and storing the candidate images in the image list;

[0009] The target video generated based on each of the candidate images in the image list is converted to obtain a target image in an image interchange format.

[0010] In some embodiments, preprocessing each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video includes:

[0011] Determining a cropping duration for cropping the initial video based on the playback time of the initial video;

[0012] Determine the number of frames of the cropping process based on the cropping duration;

[0013] Crop each frame image within the start range and end range of the initial video according to the number of frames of the cropping process to obtain the preprocessed video.

[0014] In some embodiments, the preprocessing of each frame image in the initial video to obtain a preprocessed video based on the playback time and / or video content of the initial video includes:

[0015] Split the initial video into a start part, a middle part, and an end part according to the playback time;

[0016] Extract the video content of the start part, the middle part, and the end part respectively to obtain start content, middle content, and end content;

[0017] In the case where the difference value between the start content and the middle content is greater than a preset difference threshold, and / or the difference value between the end content and the middle content is greater than a preset difference threshold, crop the start part and / or the end part to obtain the preprocessed video.

[0018] In some embodiments, sampling candidate images from each frame image included in the preprocessed video includes:

[0019] Determine a sampling interval based on the number of frames of the images included in the initial video;

[0020] Sample the candidate images from each frame image included in the preprocessed video according to the sampling interval.

[0021] In some embodiments, storing the candidate images in the image list includes:

[0022] Determine candidate images with an image size greater than a preset size as images to be adjusted;

[0023] Reduce the image size of the images to be adjusted to the preset size to obtain adjusted images;

[0024] Store the adjusted images and candidate images with an image size less than or equal to the preset size in the image list.

[0025] In some embodiments, converting the target video generated based on each of the candidate images in the image list into a target image with an image interchange format includes:

[0026] A target video generated based on each of the candidate images in the image list is converted into a dynamic image with an image interchange format;

[0027] Based on the difference degree between the color information of each frame image in the dynamic image, the dynamic image is compressed to obtain the target image.

[0028] In some embodiments, the compressing the dynamic image based on the difference degree between the color information of each frame image to obtain the target image includes:

[0029] Determine the difference between the color values of each frame image in the dynamic image;

[0030] Adjust two color values corresponding to the difference within a preset range to be the same to obtain a compressed dynamic image;

[0031] Determine the compressed dynamic image as the target image.

[0032] According to the second aspect of the embodiments of the present disclosure, there is provided an image processing apparatus, including:

[0033] A first processing module configured to cache each frame image in the acquired initial video into a memory space and construct an image list in the memory space;

[0034] A second processing module configured to preprocess each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video;

[0035] A sampling module configured to sample candidate images from each frame image included in the preprocessed video and store the candidate images into the image list;

[0036] A conversion module configured to convert a target video generated based on each of the candidate images in the image list into a target image with an image interchange format.

[0037] In some embodiments, the second processing module is further configured to:

[0038] Determine a cropping duration for performing cropping processing on the initial video based on the playback time of the initial video;

[0039] Determine the number of frames for the cropping processing based on the cropping duration;

[0040] Crop each frame image within the start range and end range of the initial video according to the number of frames for the cropping processing to obtain the preprocessed video.

[0041] In some embodiments, the second processing module is further configured to:

[0042] Split the initial video into a start part, a middle part, and an end part according to the playback time;

[0043] Extract the video content of the start part, the middle part, and the end part respectively to obtain start content, middle content, and end content;

[0044] When the difference value between the start content and the middle content is greater than a preset difference threshold, and / or the difference value between the end content and the middle content is greater than the preset difference threshold, crop the start part and / or the end part to obtain the preprocessed video.

[0045] In some embodiments, the sampling module is further configured to:

[0046] Determine a sampling interval based on the number of frames of the images included in the initial video;

[0047] Sample the candidate images from each frame image included in the preprocessed video according to the sampling interval.

[0048] In some embodiments, the sampling module is further configured to:

[0049] Determine the candidate images with an image size greater than a preset size as the images to be adjusted;

[0050] Reduce the image size of the images to be adjusted to the preset size to obtain the adjusted images;

[0051] Store the adjusted images and the candidate images with an image size less than or equal to the preset size in the image list.

[0052] In some embodiments, the conversion module is further configured to:

[0053] Convert the target video generated from each candidate image in the image list into a dynamic image with an image interchange format;

[0054] Compress the dynamic image based on the difference degree between the color information of each frame image in the dynamic image to obtain the target image.

[0055] In some embodiments, the conversion module is further configured to:

[0056] Determine the difference between the color values of each frame image in the dynamic image;

[0057] Adjust two color values corresponding to the difference within a preset range to be the same to obtain the compressed dynamic image;

[0058] Determine the compressed dynamic image as the target image.

[0059] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0060] A processor;

[0061] A memory configured to store executable instructions executable by the processor;

[0062] Wherein, the processor is configured to be able to execute the image processing method described in the first aspect above when calling the executable instructions in the memory.

[0063] According to a fourth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the image processing method described in the first aspect above.

[0064] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:

[0065] In the image processing method of the present disclosure, each frame image in the acquired initial video is cached into the memory space, and an image list is constructed in the memory space. Based on the playback time and / or video content of the initial video, each frame image of the initial video in the memory space is preprocessed to obtain a preprocessed video. Candidate images are sampled from each frame image included in the preprocessed video, and the candidate images are stored in the image list. The target image with an image interchange format is obtained by converting the target video generated based on each candidate image in the image list. That is to say, first, most of the operations of the present disclosure are performed in the memory, making the image processing process fast and efficient. Second, the present disclosure generates a target video based on the candidate images obtained by preprocessing and sampling the initial video, and obtains the target image based on the target video, which is equivalent to compressing the initial video and then generating the target image. In this way, the occupied space of the initial video is greatly compressed, and further the occupied space of the generated target image is also greatly reduced. The compression ratio is high while not affecting the content presentation.

[0066] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.

[0068] Figure 1 is a flowchart showing an image processing method according to an exemplary embodiment Figure 1 .

[0069] Figure 2 is a schematic flowchart of an image processing method shown according to an exemplary embodiment Figure 2 .

[0070] Figure 3 is a schematic flowchart of an image processing method shown according to an exemplary embodiment Figure 3 .

[0071] Figure 4 is a schematic flowchart of an image processing method shown according to an exemplary embodiment Figure 4 .

[0072] Figure 5 is a schematic structural diagram of an image processing apparatus shown according to an exemplary embodiment.

[0073] Figure 6 is a schematic structural diagram of an electronic device shown according to an exemplary embodiment. Detailed implementation manners

[0074] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present disclosure. On the contrary, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0075] In the specification, unless otherwise clearly stated, the terms "first" and "second" are only used for description to distinguish constituent elements and should not be construed as indicating an order. Unless otherwise clearly stated, the terms "connection", "fixation", etc. should be understood in a broad sense, including but not limited to "connection", "fixation" directly, indirectly, detachably, etc.

[0076] Figure 1 is a flowchart of an image processing method shown according to an exemplary embodiment Figure 1 , as Figure 1 shown, the method mainly includes the following steps:

[0077] In step 101, each frame of image in the acquired initial video is cached into the memory space, and an image list is constructed in the memory space.

[0078] In this embodiment, the obtained initial video can be directly obtained after a user shoots with an electronic device having a camera function, or can be a video downloaded and stored by the user from the Internet, or can be a video received, transmitted, and stored by other electronic devices. Of course, the electronic device that generates the initial video and the electronic device that executes the image processing method can be the same device or different devices. The electronic device can be a handheld device (such as a mobile phone, a laptop computer, a tablet computer, etc.), a vehicle-mounted device, a wearable device, a computing device, etc., which can perform the image processing method.

[0079] For the initial video, each frame image in the initial video is read frame by frame and cached into the memory space, and an image list is constructed in the memory space. The image list can store the data generated during the image processing process or can store the finally generated GIF image. During the storage process, each frame image can be stored in order according to the playback time.

[0080] In step 102, based on the playback time and / or video content of the initial video, each frame image in the initial video is preprocessed to obtain a preprocessed video.

[0081] In this embodiment, not all frame images in the initial video are necessarily the content required when generating the GIF image. Some frame images have excessive noise, and some frame images are not the core content of the initial video. This part of the frames in the initial video needs to be processed to compress the size of the initial video while improving the processing efficiency and processing quality of the subsequent video conversion to GIF image.

[0082] Generally speaking, most of the video head and video tail are not the core content of the video and may also have relatively large noise. Therefore, the video head and video tail can be cropped based on the playback time. Of course, this method may not be accurate. It is also possible to determine whether the video head and video tail are core content based on the content of the video head part, the content of the middle part of the video, and the content of the video tail part.

[0083] In addition, the present disclosure can also determine the moment when the scene changes in the initial video based on the video content, and the images of the frames corresponding to the moment when the scene changes and the adjacent frames generally have relatively large noise, and these frame images can be subjected to noise reduction processing or cropping processing.

[0084] That is to say, the preprocessing in this embodiment is an image processing operation that can improve the quality of the initial video and reduce the occupied space of the initial video. The preprocessing can include cropping processing, noise reduction processing, adjustment of image size, adjustment of image resolution, etc.

[0085] In step 103, candidate images are sampled from each frame image included in the preprocessed video, and the candidate images are stored in the image list.

[0086] In this embodiment, since the image content of adjacent frames in the initial video mostly overlaps, there is redundant image information, and in the process of converting the initial video into a GIF image, it is not necessary to use every frame in the initial video. Therefore, after preprocessing the initial video, the preprocessed video can be sampled to obtain candidate images.

[0087] In step 104, a target image with an image interchange format is converted from the target video generated from each candidate image in the image list.

[0088] In this embodiment, a target video is generated based on the candidate images sampled from the image list. At this time, compared with the preprocessed video and the initial video, the space occupied by the target video is greatly reduced, which is beneficial to reducing the size of the target image with the image interchange format subsequently.

[0089] It should be noted that the compression method of the initial video in this application does not adopt a complex video compression algorithm, but preprocesses the initial video to reduce its size, then samples to obtain candidate images that can represent the complete content of the video, generates a target video based on the candidate images, so as to further compress the size of the initial video, while ensuring the integrity and coherence of the video content. On this basis, a target image is obtained based on the target video, so that a large video file can also generate a smaller GIF image, realizing better storage and transmission of the GIF image.

[0090] A GIF (Graphics Interchange Format, which can be translated as image interchange format) image is used to display indexed color images in the way of Hypertext Markup Language. GIF images include static GIF images and dynamic GIF images. The target image in this embodiment can be a dynamic image in GIF format or a static image in GIF format.

[0091] In some embodiments, as Figure 2 shown, based on the playback time and / or video content of the initial video, each frame image in the initial video is preprocessed to obtain a preprocessed video, including:

[0092] In step 202, based on the playback time of the initial video, the cropping duration for cropping the initial video is determined;

[0093] In step 203, the number of frames for the cropping process is determined based on the cropping duration;

[0094] In step 204, according to the number of frames for the cropping process, each frame image within the start range and end range of the initial video is cropped to obtain a preprocessed video.

[0095] In this embodiment, since the core content of the video is generally in the middle part of the video, the cropping duration for cropping the starting part and the ending part of the initial video can be determined based on the playing time of the initial video. For example, when the playing time of the initial video is within the first time range (e.g., 0 min - 5 min), the cropping duration is the first duration (e.g., 12 s); when the playing duration of the initial video is within the second time range (e.g., 5 min - 10 min), the cropping duration is the second duration (e.g., 30 s), that is, the duration corresponding to the time range to which the playing time belongs is determined as the cropping duration. Generally speaking, there is a positive correlation between the playing time and the cropping duration. Of course, when the playing time is greater than the preset maximum time threshold, the cropping duration no longer increases as the playing time increases.

[0096] After determining the cropping duration, the number of frames to be cropped can be determined based on the cropping duration and the frame rate of the initial video. The frame rate of the video is the number of frames displayed per second, so multiplying the cropping duration by the frame rate of the initial video can obtain the number of frames to be cropped. Based on the number of frames to be cropped, the starting range and the ending range to be cropped can be determined. For example, if the number of frames to be cropped is 300 frames, then the first frame to the 300th frame of the initial video is the starting range to be cropped, and the 1701st frame to the 2000th frame (the last frame) of the initial video is the ending range to be cropped.

[0097] In this embodiment, Figure 2 For the specific implementation details of step 201, step 205, and step 206 in [], reference can be made to other embodiments, and details will not be elaborated here.

[0098] In one embodiment, as Figure 3 shown, preprocess each frame image in the initial video based on the playing time of the initial video and / or the video content to obtain a preprocessed video, including:

[0099] In step 302, split the initial video into a starting part, a middle part, and an ending part according to the playing time;

[0100] In step 303, extract the video content of the starting part, the middle part, and the ending part respectively to obtain starting content, middle content, and ending content;

[0101] In step 304, when the difference value between the starting content and the middle content is greater than the preset difference threshold, and / or the difference value between the ending content and the middle content is greater than the preset difference threshold, crop the starting part and / or the ending part to obtain the preprocessed video.

[0102] In this embodiment, the first splitting moment between the starting part and the middle part, and the second splitting moment between the middle part and the ending part can be determined according to the playing time. Based on the first splitting moment and the second splitting moment, the initial video is split into a starting part, a middle part, and an ending part. For different playing times, the first splitting moment and the second splitting moment are also different. Generally speaking, the duration of the middle part obtained after splitting is greater than the sum of the durations of the starting part and the ending part.

[0103] During the process of extracting video content, the starting part, the middle part, and the ending part can be respectively input into a pre-trained video content extraction model to obtain a feature vector representing the starting content, a feature vector representing the middle content, and a feature vector representing the ending content. Among them, the video content extraction model can be constructed and trained by using one or a combination of a convolutional neural network, a recurrent neural network, a long short-term memory network, a support vector machine, etc. in the field of machine learning. In addition, in order to reduce the processing time, the starting part, the middle part, and the ending part can also be sampled and then input into the video content extraction model.

[0104] During the process of determining the difference value between the starting content and the middle content, the Euclidean distance, or cosine similarity, or Manhattan distance, etc. between the feature vector of the starting content and the feature vector of the middle content can be calculated as the difference value. The smaller the difference value, the more similar the starting content and the middle content are, and the less likely it is to crop the starting part. The larger the difference value, the less similar the starting content and the middle content are, and the more likely it is to crop the starting part. Similarly, the difference value between the ending content and the middle content can also be calculated by using the foregoing method to determine whether to crop the ending part.

[0105] In this embodiment, Figure 3 For the specific implementation details of step 301, step 305, and step 306 in , reference can be made to other embodiments and will not be elaborated here.

[0106] In one embodiment, in step 103, sampling candidate images from each frame image included in the preprocessed video includes: determining a sampling interval based on the number of frames included in the initial video; and sampling the candidate images from each frame image included in the preprocessed video according to the sampling interval.

[0107] In this embodiment, the number of frames included in the preprocessed video is determined, and the sampling interval is determined based on the frame number range to which the frame number belongs. For example: when the number of frames is less than 8 frames, the sampling interval is determined to be 1 frame; when the number of frames is greater than 9 frames and less than 20 frames, the sampling interval is determined to be 2 frames; when the number of frames is greater than 21 frames and less than 30 frames, the sampling interval is determined to be 3 frames; when the number of frames is greater than 30 frames and less than 40 frames, the sampling interval is determined to be 4 frames; when the number of frames is greater than 40 frames, the sampling interval is determined to be 5 frames.

[0108] In addition, during the sampling process, in order to ensure the integrity and coherence of the video content, it is also possible to determine the target moments when scene changes occur in the preprocessed video, divide the preprocessed video into multiple video segments based on the target moments, and then determine the sampling interval corresponding to each video segment based on the number of frames included in each video segment. In this way, the candidate images obtained by sampling cover all scene contents while ensuring the compression of the preprocessed video.

[0109] In some embodiments, in step 103, storing the candidate images in the image list includes: determining the candidate images with an image size larger than a preset size as the images to be adjusted; reducing the image size of the images to be adjusted to the preset size to obtain the adjusted images; and storing the adjusted images and the candidate images with an image size smaller than or equal to the preset size in the image list.

[0110] In this embodiment, during the process of storing the candidate images in the image list, the image sizes of each candidate image can be obtained first. The candidate images with an image size larger than the preset size are adjusted, and then the images with the adjusted size and the candidate images that meet the size requirements are stored in the image list. In this way, the size of the generated target video is reduced by reducing the image size. During the storage process, the candidate images can be stored in the order of the frame sequence in the preprocessed video, which is convenient for generating GIF images subsequently.

[0111] In some embodiments, as Figure 4 shown, converting the target video generated based on each candidate image in the image list into a target image with an image interchange format includes:

[0112] In step 404, converting the target video generated based on each candidate image in the image list into a dynamic image with an image interchange format;

[0113] In step 405, compressing the dynamic image based on the difference degree between the color information of each frame image in the dynamic image to obtain the target image.

[0114] In this embodiment, the target video generated from each candidate image in the image list is converted into a dynamic image in GIF format. A dynamic image refers to an image that produces a certain dynamic effect when a group of static images are switched at a specified frequency. Therefore, in order to further reduce the space occupied by the dynamic image, the color information of each frame image in the dynamic image can be obtained, the difference degree between the color information of each frame can be calculated, and the dynamic image can be compressed based on the difference degree to obtain the target image.

[0115] It can be understood that dynamic images need to store the color information of all colors in each frame of the image. Although some colors are different, they are very close to each other and do not affect the visual experience during viewing. Therefore, two colors with close but different color information can be processed to reduce the storage amount of color information, thereby achieving the compression of dynamic images.

[0116] In some embodiments, step 405 further includes: determining the difference between the color values of each frame of the dynamic image; adjusting two color values corresponding to the difference within a preset range to be the same to obtain a compressed dynamic image; and determining the compressed dynamic image as the target image.

[0117] In this embodiment, for each frame of the dynamic image, the color values of all colors included in the frame can be counted, and then the difference between the color values corresponding to different frames of the image can be calculated. When the difference is within the preset range, the two color values corresponding to the difference are adjusted to be the same. For example: the color values of all colors included in the first frame of the image are {RGB1, RGB2, RGB3, RGB4}, and the color values of all colors included in the second frame of the image are {RGB1, RGB2, RGB5, RGB6, RGB7}, and the same for other frames. Calculate the difference between the color value RGB1 in the first frame and all the color values in the second frame. When the difference is within the preset range, it means that these two colors are two colors that are very close but different. At this time, the two color values can be unified into one color value. The unified color value can be any one of the two color values or the average value of the two color values.

[0118] Figure 4 For the specific implementation details of steps 401, 402, and 403, reference can be made to the steps of other embodiments and will not be elaborated here.

[0119] The image processing method of the present disclosure reduces the size of the initial video by preprocessing the initial video, reduces the size of the preprocessed video by sampling, compresses the size of the initial video by generating a target video based on the candidate image, and reduces the size of the target image by compressing the generated dynamic image. In this way, while improving the image processing efficiency, it is ensured that a large video file can also generate a smaller GIF image, realizing better storage and transmission of the GIF image.

[0120] Figure 5 is an image processing device shown according to an exemplary embodiment, as Figure 5 shown, the device includes:

[0121] A first processing module 501, configured to cache each frame of the initial video obtained into the memory space and construct an image list in the memory space;

[0122] A second processing module 502, configured to preprocess each frame image in the initial video based on the playing time and / or video content of the initial video to obtain a preprocessed video;

[0123] A sampling module 503, configured to sample candidate images from each frame image included in the preprocessed video and store the candidate images in the image list;

[0124] A conversion module 504, configured to convert a target video generated based on each of the candidate images in the image list to obtain a target image with an image interchange format.

[0125] In some embodiments, the second processing module 502 is further configured to:

[0126] Determine a cropping duration for cropping the initial video based on the playing time of the initial video;

[0127] Determine the number of frames for the cropping process based on the cropping duration;

[0128] Crop each frame image within the start range and end range of the initial video according to the number of frames for the cropping process to obtain the preprocessed video.

[0129] In some embodiments, the second processing module 502 is further configured to:

[0130] Split the initial video into a start part, a middle part, and an end part according to the playing time;

[0131] Extract the video content of the start part, the middle part, and the end part respectively to obtain start content, middle content, and end content;

[0132] In a case where the difference value between the start content and the middle content is greater than a preset difference threshold, and / or the difference value between the end content and the middle content is greater than the preset difference threshold, crop the start part and / or the end part to obtain the preprocessed video.

[0133] In some embodiments, the sampling module 503 is further configured to:

[0134] Determine a sampling interval based on the number of frames of the images included in the initial video;

[0135] Sample the candidate images from each frame image included in the preprocessed video according to the sampling interval.

[0136] In some embodiments, the sampling module 503 is further configured to:

[0137] Determine a candidate image with an image size larger than a preset size as an image to be adjusted;

[0138] Reduce the image size of the image to be adjusted to the preset size to obtain an adjusted image;

[0139] Store the adjusted image and candidate images with an image size smaller than or equal to the preset size in the image list.

[0140] In some embodiments, the conversion module 504 is further configured to:

[0141] Convert a target video generated based on each candidate image in the image list into a dynamic image with an image interchange format;

[0142] Compress the dynamic image based on the difference degree between the color information of each frame image in the dynamic image to obtain the target image.

[0143] In some embodiments, the conversion module 504 is further configured to:

[0144] Determine the difference between the color values of each frame image in the dynamic image;

[0145] Adjust two color values corresponding to a difference within a preset range to be the same to obtain a compressed dynamic image;

[0146] Determine the compressed dynamic image as the target image.

[0147] Regarding the image processing apparatus in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0148] As Figure 6 shown, an embodiment of the present disclosure further provides an electronic device 600, including:

[0149] A memory 604 for storing processor-executable instructions;

[0150] A processor 620, connected to the memory 604;

[0151] Wherein, the processor 620 is configured to execute the image processing method provided by any of the foregoing technical solutions.

[0152] A block diagram of an electronic device 600 shown according to an exemplary embodiment. For example, the electronic device 600 may be a smart phone, a tablet computer, a notebook computer, a portable learning machine, etc.

[0153] Refer to Figure 6, the electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 618.

[0154] The processing component 602 generally controls the overall operation of the electronic device 60, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-described methods. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0155] The memory 604 is configured to store various types of data to support the operation of the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 60, contact data, phone book data, messages, pictures, videos, and the like. The memory 604 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.

[0156] The power component 606 provides power to the various components of the electronic device 600. The power component 606 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 600.

[0157] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.

[0158] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 604 or transmitted via the communication component 618. In some embodiments, the audio component 610 further includes a speaker for outputting audio signals.

[0159] The I / O interface 612 provides an interface between the processing component 602 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power button, and a lock button.

[0160] The sensor component 614 includes one or more sensors for providing status assessments of various aspects of the electronic device 600. For example, the sensor component 614 can detect the on / off state of the electronic device 600, the relative positioning of components, such as the display and the keypad of the electronic device 600. The sensor component 614 can also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor component 614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 614 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 614 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0161] The communication component 618 is configured to facilitate communication between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 can access a communication standard-based wireless network, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 618 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 618 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0162] In an exemplary embodiment, the electronic device 600 can be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.

[0163] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the above instructions can be executed by a processor 620 of the electronic device 600 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0164] An embodiment of the present application provides a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a processor of a computer, the computer can execute the image processing method described in one or more of the foregoing technical solutions.

[0165] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0166] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. An image processing method, It is characterized in that include: Cache each frame image in the acquired initial video into a memory space, and construct an image list in the memory space; Preprocessing each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video; Sampling candidate images from each frame image included in the preprocessed video, and storing the candidate images in the image list; The target video generated based on each of the candidate images in the image list is converted to obtain a target image in an image interchange format.

2. The image processing method according to claim 1, It is characterized in that The preprocessing of each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video includes: Determining a cropping duration for cropping the initial video based on the playback time of the initial video; Determining the number of frames for the cropping process based on the cropping duration; According to the number of frames to be cropped, each frame image within the starting range and the ending range of the initial video is cropped to obtain the pre-processed video.

3. The image processing method according to claim 1, It is characterized in that The preprocessing of each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a preprocessed video includes: According to the playing time, the initial video is divided into a starting part, a middle part and an ending part; Extracting the video contents of the starting part, the middle part and the ending part respectively to obtain the starting content, the middle content and the ending content; When the difference between the starting content and the middle content is greater than a preset difference threshold, and / or the difference between the ending content and the middle content is greater than a preset difference threshold, the starting part and / or the ending part are cropped to obtain the preprocessed video.

4. The image processing method according to claim 1, It is characterized in that The step of sampling the candidate images from the frames of images included in the pre-processed video comprises: Determining a sampling interval based on the number of frames of images included in the initial video; The candidate image is obtained by sampling from each frame image included in the preprocessed video according to the sampling interval.

5. The image processing method according to claim 1, It is characterized in that The storing the candidate images into the image list comprises: Determine the candidate images whose image sizes are larger than the preset size as images to be adjusted; Reducing the image size of the image to be adjusted to the preset size to obtain an adjusted image; The adjusted image and candidate images whose image size is less than or equal to the preset size are stored in the image list.

6. The image processing method according to claim 1, It is characterized in that The target video generated based on each of the candidate images in the image list is converted into a target image having an image interchange format, comprising: Converting a target video generated based on each of the candidate images in the image list to obtain a dynamic image in an image interchange format; Based on the difference between the color information of each frame image in the dynamic image, the dynamic image is compressed to obtain the target image.

7. The image processing method according to claim 6, It is characterized in that The step of compressing the dynamic image based on the difference between the color information of each frame image to obtain the target image includes: Determine the difference between the color values ​​of each frame image in the dynamic image; Adjusting two color values ​​corresponding to the difference values ​​within a preset range to be the same, thereby obtaining a compressed dynamic image; The compressed dynamic image is determined as the target image.

8. An image processing device, It is characterized in that include: A first processing module is configured to cache each frame image in the acquired initial video into a memory space and construct an image list in the memory space; A second processing module is configured to pre-process each frame image in the initial video based on the playback time and / or video content of the initial video to obtain a pre-processed video; A sampling module, configured to sample candidate images from each frame image included in the pre-processed video, and store the candidate images in the image list; The conversion module is configured to convert the target video generated based on each of the candidate images in the image list to obtain a target image with an image interchange format.

9. An electronic device, It is characterized in that include: processor; a memory configured to store processor-executable instructions; The processor is configured to execute the image processing method according to any one of claims 1 to 7 when calling the executable instructions in the memory. 10 . A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image processing method according to any one of claims 1 to 7.