Image compression method and image compression device
By dynamically compressing videos and photos using different compression parameters based on matching of user preferences and scene modules, the problem of important content distortion in the existing technology is solved, and intelligent compression and memory saving are achieved.
Patent Information
- Application Number
- CN202110897200.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-08-05
AI Technical Summary
Existing technologies can easily cause important content to be distorted or lost when compressing videos and photos, and cannot effectively save the memory of electronic devices.
By using different compression parameters to dynamically compress different scene modules based on the matching of user-preferred scenes and different scene modules in the interface to be compressed, it ensures high-definition restoration of important content and saves memory.
It realizes intelligent compression of videos and photos, ensuring high-definition restoration of important content while effectively saving the memory of electronic devices.
Smart Images

Figure CN113676734B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and specifically relates to an image compression method and an image compression device. Background Art
[0002] With the rise of short videos, more and more people like to shoot a large number of videos and photos to record and share their lives. However, the memory of electronic devices is limited, so these video and photo data need to be compressed and stored to reduce the memory occupied.
[0003] In the prior art, when compressing captured videos and photos, a default compression method is used to directly complete the compression, which may cause distortion or loss of important content in the compressed videos or photos. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an image compression method and an image compression device, which can solve the problem of distortion or loss of important content in compressed videos or photos.
[0005] In a first aspect, an embodiment of the present application provides an image compression method, the method comprising:
[0006] receiving a first input from a user;
[0007] In response to the first input, based on the matching between the first type of the user and the first scene label, different compression parameters are used to compress different scene modules in the interface to be compressed, wherein the first scene label corresponds to the first scene module in the interface to be compressed;
[0008] Among them, the first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one second type matches at least one second scene label, and one second scene label matches at least one second type.
[0009] In a second aspect, an embodiment of the present application provides an image compression device, the device comprising:
[0010] A first receiving module, used to receive a first input from a user;
[0011] A first compression module, configured to respond to the first input and compress different scene modules in the interface to be compressed by using different compression parameters based on the matching between the first type of the user and the first scene label, wherein the first scene label corresponds to the first scene module in the interface to be compressed;
[0012] Among them, the first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one second type matches at least one second scene label, and one second scene label matches at least one second type.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0016] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is one of the flowcharts of the image compression method provided in the embodiment of the present application;
[0018] Figure 2 is a schematic diagram of a first input provided in an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of a scene module provided in an embodiment of the present application;
[0020] Figure 4 This is the second flow chart of the image compression method provided in the embodiment of the present application;
[0021] Figure 5 is a schematic diagram of a second input provided in an embodiment of the present application;
[0022] Figure 6 It is a schematic diagram of a video recording interface that is compressed as memory changes according to an embodiment of the present application;
[0023] Figure 7 It is one of the structural schematic diagrams of the image compression device provided in the embodiment of the present application;
[0024] Figure 8 This is the second structural schematic diagram of the image compression device provided in the embodiment of the present application;
[0025] Fig. 9 This is the third structural schematic diagram of the image compression device provided in the embodiment of the present application;
[0026] Fig.10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0027] Fig.11 It is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] The image compression method and device provided in the embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0031] Figure 1 is one of the flowcharts of the image compression method provided in the embodiment of the present application, such as Figure 1 As shown, the method includes the following process:
[0032] Step 100, receiving a first input from a user;
[0033] Step 110, in response to the first input, based on the matching between the user's first type and the first scene label, different compression parameters are used to compress different scene modules in the interface to be compressed, wherein the first scene label corresponds to the first scene module in the interface to be compressed;
[0034] Among them, the first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one second type matches at least one second scene label, and one second scene label matches at least one second type.
[0035] Optionally, the execution subject of the embodiment of the present application may be an electronic device with a recording or photographing function. The electronic device here may be a mobile phone, a tablet computer, etc. The embodiment of the present application does not specifically limit this. In the embodiment of the present application, the execution subject is taken as an example of a mobile phone.
[0036] Optionally, an embodiment of the present application provides a dynamic compression scheme, which can be based on the user's first input, realize the matching of the user's first type and the first scene label, and use different compression parameters to compress different scene modules in the interface to be compressed, wherein the first scene label corresponds to the first scene module in the interface to be compressed.
[0037] Optionally, the first input may include a user's voice input.
[0038] Optionally, the first input may include a single click operation of the user on a “dynamic compression button” in a video recording interface or a shooting interface of the electronic device.
[0039] Optionally, the first input may include an operation in which a user long presses a “dynamic compression button” in a video recording interface or a shooting interface of the electronic device for a period of time exceeding a first time threshold.
[0040] For example, after the electronic device receives input from the user pressing the "dynamic compression button" for more than 3 seconds, it can be determined that dynamic compression is started.
[0041] Optionally, the first input may include an operation of the user drawing a designated special symbol or graphic in any area of the electronic device, or in any area of any interface displayed by the electronic device, or in a video recording interface, or in a photographing interface.
[0042] For example, when the electronic device displays a video recording interface, upon receiving an input from a user drawing a designated special symbol (such as a circle or a triangle) in a designated area (such as the upper right area of the video recording interface), it can be determined that dynamic compression is started.
[0043] For example, when the electronic device displays any interface, after receiving an input from a user drawing a designated special symbol (such as a circle or a triangle) on the back of the electronic device, it can be determined that dynamic compression is started.
[0044] Optionally, the first input may include an operation in which the user makes a designated gesture in the air above the screen of the electronic device.
[0045] For example, after the electronic device receives an input that the user waves his hand two times continuously from left to right above the screen of the electronic device, it can be determined that dynamic compression is started.
[0046] Optionally, the first input may include a user's operation of clicking a designated area of the electronic device multiple times in succession.
[0047] For example, it may include an operation in which a user clicks the right border of the electronic device three times in a row, or it may include an operation in which a user clicks the upper right corner of the screen of the electronic device twice in a row.
[0048] Optionally, the first input may include an operation of sliding a finger of the user in a fixed direction on any display interface, video recording interface, or shooting interface.
[0049] For example, it may include an operation in which a user slides two fingers on the video recording interface from top to bottom, or it may include an operation in which a user slides three fingers on the video recording interface from right to left.
[0050] Optionally, taking the example that the first input of the user includes the operation of the user clicking the "dynamic compression button" once, Figure 2 is a schematic diagram of the first input provided in the embodiment of the present application, such as Figure 2 As shown, before starting the recording function, the electronic device can display a dynamic compression button, and the electronic device can receive a first input from a user clicking the dynamic compression button, and can then respond to the first input to perform a dynamic compression scheme on the recorded video after the recording function is started.
[0051] Optionally, the first scene tag may correspond to the first scene module in the interface to be compressed.
[0052] Optionally, the correspondence between the first scene label and the first scene module may be preset.
[0053] Optionally, the first type of the user may be that the user corresponds to one or more first types, wherein the first type may be a portrait of the user made by an electronic device through artificial intelligence technologies such as big data analysis and mining, image recognition, or neural network classification analysis, which can be used to indicate the user's favorite scenes, for example, landscapes and children, etc. Accordingly, the first type of the user may include landscape enthusiasts and professional baby-showing users.
[0054] Optionally, the preset second type may include all possible types of users, such as building enthusiasts, landscape enthusiasts, professional baby-showing enthusiasts, gardening enthusiasts, and fitness enthusiasts, etc.
[0055] Optionally, the first type of user may be one of the preset second types. For example, the first type of user may be a professional baby-showing user among the preset second types.
[0056] Optionally, the first type of user may be multiple types of the preset second types. For example, the first type of user may be a landscape lover and a gardening lover of the preset second type.
[0057] Optionally, when determining the first type of the user, it may be determined which one or more categories of the preset second type the user belongs to, that is, the user is classified.
[0058] Optionally, during the video recording process, the recorded image may first be pre-processed by image recognition or image processing technology, such as noise reduction, enhancement, image segmentation, and image module extraction, to divide the entire video recording interface into multiple scene modules.
[0059] Optionally, after the entire video recording interface is divided into a plurality of scene modules, the plurality of scene modules may be subjected to artificial intelligence algorithm training or neural network analysis to predict and obtain a first scene label corresponding to each scene module.
[0060] Figure 3 is a schematic diagram of a scene module provided in an embodiment of the present application, such as Figure 3 As shown, the interface to be compressed includes clouds, sea and people, and the first scene labels of different scene modules in the interface to be compressed are cloud module, sea module and person module respectively.
[0061] Optionally, the preset second scene label may include all possible scene labels of scene modules, such as cloud module, sea module, person module, mountain module, building module, furniture module, plant module, daily necessities module, and electrical appliance module, etc., which is not limited to the embodiments of the present application.
[0062] Optionally, the preset second scene label may be pre-configured by the system, or determined based on historical information in the electronic device, or determined based on historical behavior information of the user, which is not limited in the embodiments of the present application.
[0063] Optionally, the first scene tag may be one of the preset second scene tags. For example, the first scene tag may be a mountain module in the preset second scene tag.
[0064] Optionally, the first scene tag may be a plurality of preset second scene tags. For example, the first scene tag may be a mountain module and a person module in the preset second scene tag.
[0065] Optionally, the character module in the preset second scene label may also include a family module, a children module, a friend module, a classmate module, a stranger module, etc. In this case, when it is determined that the first scene label includes a character module, further identification may be performed to determine whether the character is a family member, a friend, a classmate, a stranger, etc.; wherein the recognition function for identifying a character as a family member, a friend, a classmate, a stranger, etc. may be obtained by pre-machine learning.
[0066] Optionally, when determining the first scene label corresponding to a certain scene module, it may be determined to which one or more categories of the preset second scene labels this scene module belongs, that is, to classify this scene module.
[0067] Optionally, one second type may match at least one second scene tag, and one second scene tag may match at least one second type.
[0068] For example, the mountain module in the preset second scene tag can be matched with the landscape lover in the preset second type.
[0069] For example, the sea module in the preset second scene label can also be matched with the landscape lovers in the preset second type.
[0070] For example, the children module in the preset second scene tag can be matched with the professional baby-showing users in the preset second type.
[0071] For example, the building module in the preset second scene label can be matched with the building enthusiast in the preset second type.
[0072] For example, the plant module in the preset second scene tag can be matched with the landscape lovers and gardening lovers in the preset second type.
[0073] For example, if it is determined that the user's first type is a landscape lover, then when it is determined that the first scene label of the scene module in the interface to be compressed includes a mountain module, a sea module, and a character module, it can be determined that the user's first type matches the mountain module and the sea module, and it can be considered that the mountain module and the sea module in the interface to be compressed are scenes that the user likes or content that is important to the user, and the compression ratio selected when compressing the mountain module and the sea module can be as small as possible to avoid distortion of the mountain module and the sea module, and it can be determined that the user's first type does not match the character module, and it can be determined that the character module is not a scene that the user likes or is not important to the user, and the compression ratio selected when compressing the character module can be as large as possible to save memory.
[0074] Optionally, the matching relationship between the second type and the second scene label may be preset, and the matching status between the user's first type and the first scene label may be determined based on the preset matching relationship.
[0075] Optionally, the compression parameter may include a compression ratio of the image, and different compression parameters or compression ratios may correspond to the same or different compression methods.
[0076] For example, multiple compression modes, such as three, four, or five, may be set according to different compression ratios, and this embodiment of the present application is not limited to this.
[0077] For example, multiple compression levels of a compression method can be set according to different compression ratios, such as three, four or five. The embodiments of the present application are not limited to this. Different compression levels correspond to different compression ratios, that is, to different compression degrees.
[0078] Taking the example of setting three compression methods according to different compression ratios, these three compression methods may include:
[0079] Conventional compression: The snappy algorithm can be used, and the compression ratio can be set to 10:5. The compression speed and compression ratio are relatively balanced, and the suffix of the generated video file name can be .snp. For example, for the scene module that appears for the first time or the scene module that fails to determine the first scene label, conventional compression can be used;
[0080] Deep compression: The zlib algorithm can be used, and the compression ratio can be set to 10:2. The compression ratio is relatively large, but the distortion is also large. The suffix of the generated video file name can be .zlib. For example, for scene modules that do not match the user's first type, deep compression can be used;
[0081] Shallow compression: The lzo algorithm can be used, and the compression ratio can be set to 10:8. The compression ratio is relatively small, and the distortion is also small. The suffix of the generated video name can be .lzo; for example, for the scene module that matches the first type of the user, shallow compression can be used.
[0082] Optionally, during the recording process, a short video file can be generated at regular intervals, and then processed using dynamic compression, for example, every 1 minute, 3 minutes or 5 minutes, etc., which is not specifically limited in this embodiment. Finally, multiple dynamically compressed short video files can be synthesized and saved.
[0083] Optionally, Figure 4 This is a second flow chart of the image compression method provided in the embodiment of the present application. Figure 4 As shown, the method includes the following:
[0084] Step 410, the electronic device receives a user input and determines whether the user turns on a dynamic compression button;
[0085] When the system receives a signal that the user has turned on the dynamic compression button, the system proceeds to step 420 ; otherwise, the system proceeds to step 450 to directly record the video.
[0086] Step 420, the electronic device pre-processes the recorded video or image by image processing technology such as image recognition, such as noise reduction, enhancement, image segmentation and image module extraction, and divides the entire video interface into multiple modules;
[0087] Optionally, the electronic device may first divide the image into a foreground image and a background image based on image processing technology, and then perform module extraction on the foreground image to obtain multiple different scene modules. Since the background image may not have any meaning to the user, the background image may directly enter the deep compression module or be compressed in other compression methods. For the foreground image, the different scene modules may be transmitted to the next step 440 for subsequent dynamic compression. Finally, after all the different scene modules of the foreground image are compressed, the compressed foreground image and the compressed background image may be synthesized using image processing technology.
[0088] Step 430, the electronic device performs artificial intelligence algorithm training and neural network analysis on the preprocessing results, i.e., multiple scene modules, to predict the classification of each scene module of the current video, such as a person module, a landscape module, and a sky module;
[0089] Step 440, matching the classification of the current video interface module with the portrait of the user by the mobile phone system to obtain their matching status, thereby determining the compression ratio of each scene module and the corresponding compression method;
[0090] For example, shallow compression can be performed on modules with a high degree of matching, that is, the scene modules that users like can be restored as highly as possible; deep compression can be performed on modules with a low degree of matching or no matching to save memory; regular compression can be performed on modules with a medium degree of matching or around medium.
[0091] Step 450, dynamically compressing the video while recording it in a dynamic compression manner.
[0092] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device.
[0093] Optionally, the compressing different scene modules in the interface to be compressed by using different compression parameters based on the matching between the first type of the user and the first scene tag includes at least one of the following:
[0094] Determine at least one third scene tag matching the first type in the first scene tags, and compress the first scene module corresponding to the third scene tag using a first compression parameter;
[0095] determining at least one fourth scene tag in the first scene tags that does not match the first type, and compressing the first scene module corresponding to the fourth scene tag using a second compression parameter;
[0096] The compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
[0097] Optionally, the third scene label may be one or more scene labels that match the first scene labels corresponding to different scene modules in the interface to be compressed and the first type of the user.
[0098] Optionally, the fourth scene label may be one or more scene labels that do not match the first scene labels corresponding to different scene modules in the to-be-compressed interface and the first type of the user.
[0099] For example, after determining that the first scene label of the scene module in the interface to be compressed includes a mountain module, a sea module and a character module, and the first type of users includes architecture enthusiasts, professional baby-showing users and gardening enthusiasts, it can be determined that the character module in the first scene label matches the professional baby-showing users in the first type of users, while the mountain module and sea module in the first scene label do not match the first type of users, it can be determined that the third scene label includes a character module, and the fourth scene label includes a mountain module and a sea module.
[0100] For example, after determining that the first scene label of the scene module in the interface to be compressed includes a cloud module, a sea module and a character module, and the first type of users includes landscape enthusiasts, professional baby-showing users and gardening enthusiasts, it can be determined that the sea module in the first scene label matches the landscape enthusiasts in the user's first type, the character module in the first scene label matches the professional baby-showing users in the user's first type, and the cloud module in the first scene label does not match the user's first type, it can be determined that the third scene label includes a sea module and a character module, and the fourth scene label includes a cloud module.
[0101] Optionally, the scene corresponding to the third scene label may indicate a scene preferred by the user, or may be content that is important to the user.
[0102] Optionally, the scene corresponding to the fourth scene label may indicate a scene that the user does not like, or may be content that is not important to the user.
[0103] Optionally, the first compression parameter may be used to compress the first scene module corresponding to the third scene tag.
[0104] Optionally, the first scene module corresponding to the fourth scene tag may be compressed using the second compression parameter.
[0105] Optionally, the compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
[0106] For example, the first scene module corresponding to the third scene label includes a character module, and the first scene module corresponding to the fourth scene label includes a mountain module and a sea module. It can be considered that the character module in the interface to be compressed is a scene that the user likes or is important to the user, and the mountain module and the sea module are not scenes that the user likes or are not important to the user. In this case, a first compression parameter with a smaller compression degree can be used to compress the character module to avoid distortion of the character module, and a second compression parameter with a larger compression degree can be used to compress the mountain module and the sea module to save memory of the electronic device.
[0107] The embodiment of the present application compresses the first scene module corresponding to the third scene tag by using a first compression parameter with a smaller compression degree, thereby avoiding distortion of scenes preferred by users or content important to users, and compresses the first scene module corresponding to the fourth scene tag by using a second compression parameter with a larger compression degree, thereby effectively saving memory of the electronic device.
[0108] Optionally, the adopting the first compression parameter to compress the first scene module corresponding to the third scene tag includes:
[0109] Determine a weight value corresponding to each of the third scene labels, wherein the weight value corresponding to the third scene label is the sum of all weights of the first type that match the third scene label, and the weight of the first type is used to indicate the user's preference for the scene indicated by the first type;
[0110] Based on the weight value corresponding to each of the third scene tags, the first compression parameter of each of the first scene modules is determined; wherein the weight value is inversely proportional to the compression degree corresponding to the first compression parameter.
[0111] Optionally, the user's first type weight may be used to indicate the user's preference for the scene indicated by the first type.
[0112] For example, according to the historical data statistics on the user's electronic device, if the photos or videos of children account for 50% of the historical data, it can be said that the user's liking for children is 50%, and the weight of the first type of professional baby-showing users can be 0.5.
[0113] Optionally, the weight value corresponding to the third scene label may be the sum of all first-type weights matching the third scene label.
[0114] For example, if it is determined that the user's first type is a landscape lover and a gardening lover, where the weight of the landscape lover is 0.7 and the weight of the gardening lover is 0.3, then when it is determined that the first scene label of the scene module in the interface to be compressed includes a mountain module, a sea module, a children's module, a building module, and a plant module, it can be determined that the user's first type of landscape lover matches the mountain module, the sea module, and the plant module, and it can be determined that the user's first type of gardening lover matches the plant module; wherein the weight value corresponding to the plant module is 1=0.7+0.3, the weight value corresponding to the mountain module is 0.7, and the weight value corresponding to the sea module is 0.7, and the user's first type does not match the children module and the building module, then it can be considered that the plant module in the interface to be compressed is the user's favorite scene or the most important content for the user, then the compression ratio selected when compressing the plant module can be the smallest, the compression ratio selected when compressing the mountain module and the sea module can be the second largest, and the compression ratio selected when compressing the children module and the building module can be the largest.
[0115] The embodiment of the present application determines the weight of the user's first type and then determines the weight corresponding to the third scene label. Then, based on the weight corresponding to the third scene label, it determines the non-identical or completely different compression parameters corresponding to different scene modules in the interface to be compressed, thereby realizing intelligent compression of different scene modules to different degrees.
[0116] Optionally, based on the above method embodiment, the image compression method further includes:
[0117] receiving a second input from a user, where the second input is an operation of the user selecting a third compression parameter;
[0118] In response to the second input, all scene modules are compressed using the third compression parameter.
[0119] Optionally, examples of operations corresponding to the second input of the user can be analogous to all optional examples of user operations corresponding to the aforementioned first input, and are not described in detail here.
[0120] Optionally, an embodiment of the present application provides a manual compression solution, which can be based on the user's second input to achieve manual adjustment of the compression method based on changes in the user's subjective feelings.
[0121] Optionally, Figure 5 is a schematic diagram of the second input provided in the embodiment of the present application, such as Figure 5 As shown, taking the user's second input including the user clicking the "manual compression button" once and clicking the buttons corresponding to different third compression parameters in the display interface corresponding to the "manual compression button" once as an example, the electronic device can display the manual compression button before starting the recording function, and the electronic device can receive the second input of the user clicking the manual compression button and selecting the third compression parameter, and then can respond to this second input to perform a manual compression scheme on the recorded video after the recording function is started.
[0122] Optionally, different third compression parameters may include different compression ratios, and different third compression parameters or compression ratios may correspond to the same or different compression methods.
[0123] For example, multiple compression modes, such as three, four or five, may be set according to different compression ratios, wherein each compression mode may correspond to a compression ratio, and different compression parameters may correspond to different compression ratios.
[0124] For example, the third compression parameter may include Figure 5 The "shallow compression button" corresponds to the shallow compression method, the "normal compression button" corresponds to the normal compression method, and the "deep compression button" corresponds to the deep compression method.
[0125] For example, multiple compression levels of a compression method can be set according to different compression ratios, such as three, four or five. The embodiments of the present application are not limited to this. Different compression levels correspond to different compression ratios, that is, to different compression degrees.
[0126] Optionally, the second input of the user may include an operation before the video recording starts, an operation during the video recording process, or an operation after the video recording ends.
[0127] For example, before the video recording starts, the electronic device receives the user's single click operation of the "manual compression button" and the "deep compression button", and then the subsequent videos can all be compressed in a deep compression manner and stored in the electronic device.
[0128] The embodiment of the present application sets a manual compression scheme, which makes it easy for users to manually adjust the compression method of videos or pictures according to changes in their subjective feelings.
[0129] Optionally, based on the above method embodiment, the image compression method further includes:
[0130] Determining the percentage of remaining memory of the electronic device;
[0131] Determining a fourth compression parameter based on a preset range to which the proportion of the remaining memory belongs, wherein different preset ranges correspond to different fourth compression parameters;
[0132] The different scene modules are compressed using the fourth compression parameter.
[0133] Optionally, during the video recording process, the remaining memory of the electronic device may be obtained in real time, and the percentage of the remaining memory to the total memory, that is, the proportion of the remaining memory of the electronic device, may be calculated.
[0134] Optionally, the proportion of the remaining memory may be divided into a plurality of different preset ranges, such as 3 or 4 or 5. The embodiment of the present application does not specifically limit the number of preset ranges.
[0135] For example, the proportion of remaining memory can be divided into three different preset ranges, namely [0.0, 0.3), [0.3, 0.6) and [0.6, 1.0), wherein the half bracket ")" indicates exclusion, and the half bracket "[" indicates inclusion. Moreover, the compression parameter corresponding to the preset range [0.0, 0.3) is a compression ratio of 10:2, which may be deep compression, the compression parameter corresponding to the preset range [0.3, 0.6) is a compression ratio of 10:5, which may be conventional compression, and the compression parameter corresponding to the preset range [0.6, 1.0) is a compression ratio of 10:8, which may be shallow compression.
[0136] Figure 6 is a schematic diagram of a video recording interface that is compressed as memory changes, as provided in an embodiment of the present application. Figure 6As shown, taking the electronic device as a user's mobile phone as an example, if the remaining memory percentage of a user's mobile phone is 0.92, the current remaining memory percentage can be displayed in a certain area of the mobile phone, such as the upper right corner, and because its memory percentage is included in the preset range [0.6, 1.0), the user's mobile phone can automatically switch to the deep compression method corresponding to the preset range [0.6, 1.0) for compression.
[0137] The embodiment of the present application obtains the remaining memory of the electronic device in real time, determines different compression parameters according to the change in the remaining memory ratio, and realizes adaptive adjustment of the compression method as the remaining memory of the electronic device changes, thereby effectively saving the memory of the electronic device.
[0138] Optionally, based on the above method embodiment, the image compression method further includes:
[0139] Based on album data of the electronic device of the user, a first type of the user is determined.
[0140] Optionally, based on the historical data of the user's mobile phone album, through artificial intelligence technologies such as big data analysis and mining, image recognition and neural network classification analysis, the mobile phone system can profile the mobile phone user, thereby determining the first type of the user.
[0141] For example, if a user’s mobile phone album contains photos of children, the sea, and mountains, these image data are identified and analyzed through artificial intelligence algorithms, and the first type of users include professional baby-showing posters and landscape enthusiasts.
[0142] The embodiment of the present application determines the first type of the user based on the historical data of the photo album of the user's electronic device, so as to facilitate the acquisition of the scenes that the user likes.
[0143] Optionally, determining the first type of the user based on album data of the electronic device of the user includes:
[0144] Determining an initial first type of the user based on album data of the electronic device of the user;
[0145] determining a second user, the second user's first type comprising the user's initial first type;
[0146] Based on the first type of the second user, a first type of the user is determined.
[0147] Optionally, based on the historical data of the photo album of the user's electronic device, through artificial intelligence technologies such as big data analysis and mining, image recognition and neural network classification analysis, the electronic device can profile the user, and can first determine the user's initial first type, and then can determine the user's first type based on the first type of a second user who has the same preferences as the user and the user's initial first type.
[0148] For example, the electronic device of user A may analyze the historical data of the photo album and find that the initial first type of user A includes a professional baby-showing-off and a landscape enthusiast. Furthermore, the electronic device may find through big data analysis and statistics that the first type of the second user B includes a professional baby-showing-off, a fitness enthusiast, and an architecture enthusiast. The mobile phone system may then collaboratively filter the initial first type of user A and the first type of the second user B and determine that the first type of user A includes not only a professional baby-showing-off and a landscape enthusiast, but also a fitness enthusiast and an architecture enthusiast.
[0149] When determining the first type of a user, the embodiment of the present application not only determines the first type of the user based on the user's historical photo albums, but also determines the user's potential interests by analyzing scenes liked by other users and adopting association rules such as collaborative filtering, thereby enriching the scenes liked by the user.
[0150] It should be noted that the image compression method provided in the embodiment of the present application can be executed by an image compression device or a control module in the image compression device for executing the image compression method. In the embodiment of the present application, the image compression device provided in the embodiment of the present application is described by taking the image compression method executed by the image compression device as an example.
[0151] Figure 7 is one of the structural schematic diagrams of the image compression device provided in the embodiment of the present application, such as Figure 7 As shown, the device includes: a first receiving module 710 and a first compression module 720; wherein:
[0152] The first receiving module 710 is used to receive a first input from a user;
[0153] The first compression module 720 is used to respond to the first input and compress different scene modules in the interface to be compressed by using different compression parameters based on the matching between the first type of the user and the first scene label, wherein the first scene label corresponds to the first scene module in the interface to be compressed;
[0154] Among them, the first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one second type matches at least one second scene label, and one second scene label matches at least one second type.
[0155] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device.
[0156] Optionally, the first compression module is further used for:
[0157] Determine at least one third scene tag in the first scene tags that matches the first type, and compress the first scene module corresponding to the third scene tag using a first compression parameter;
[0158] determining at least one fourth scene tag in the first scene tags that does not match the first type, and compressing the first scene module corresponding to the fourth scene tag using a second compression parameter;
[0159] The compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
[0160] Optionally, the first compression module is further used for:
[0161] Determine a weight value corresponding to each of the third scene labels, wherein the weight value corresponding to the third scene label is the sum of all weights of the first type that match the third scene label, and the weight of the first type is used to indicate the user's preference for the scene indicated by the first type;
[0162] Based on the weight value corresponding to each of the third scene tags, the first compression parameter of each of the first scene modules is determined; wherein the weight value is inversely proportional to the compression degree corresponding to the first compression parameter.
[0163] Optionally, based on the above-mentioned device embodiment, Figure 8 This is a second structural diagram of the image compression device provided in the embodiment of the present application. Figure 8As shown, the image compression device further includes: a second receiving module 810 and a second compression module 820; wherein:
[0164] The second receiving module 810 is used to receive a second input from a user, where the second input is an operation of the user selecting a third compression parameter;
[0165] The second compression module 820 is used to compress the different scene modules using the third compression parameter in response to the second input.
[0166] Optionally, based on the above-mentioned device embodiment, Fig. 9 This is a third structural diagram of the image compression device provided in the embodiment of the present application. Fig. 9 As shown, the image compression device further includes: a memory acquisition module 910, a first determination module 920 and a third compression module 930; wherein:
[0167] The memory acquisition module 910 is used to determine the proportion of the remaining memory of the electronic device;
[0168] The first determination module 920 is used to determine a fourth compression parameter based on a preset range to which the proportion of the remaining memory belongs, wherein different preset ranges correspond to different fourth compression parameters;
[0169] The third compression module 930 is used to compress the different scene modules by adopting the fourth compression parameter.
[0170] Optionally, based on the above-mentioned device embodiment, the image compression device further includes: a second determination module, configured to determine the first type of the user based on album data of the user's electronic device.
[0171] Optionally, the second determining module is further used for:
[0172] Determining an initial first type of the user based on album data of the electronic device of the user;
[0173] determining a second user, the second user's first type comprising the user's initial first type;
[0174] Based on the first type of the second user, a first type of the user is determined.
[0175] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device.
[0176] The image compression device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0177] The image compression device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0178] The image compression device provided in the embodiment of the present application can achieve Figures 1 to 6 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0179] Optionally, Fig.10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.10 As shown, an embodiment of the present application also provides an electronic device 1000, including a processor 1001, a memory 1002, and a program or instruction stored in the memory 1002 and executable on the processor 1001. When the program or instruction is executed by the processor 1001, each process of the above-mentioned image compression method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0180] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0181] Fig.11 It is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0182] The electronic device 1100 includes but is not limited to: a radio frequency unit 1101, a network module 1102, an audio output unit 1103, an input unit 1104, a sensor 1105, a display unit 1106, a user input unit 1107, an interface unit 1108, a memory 1109, and a processor 1110 and other components.
[0183] Those skilled in the art will appreciate that the electronic device 1100 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.11 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0184] The user input unit 1107 is used for:
[0185] receiving a first input from a user;
[0186] The processor 1110 is used to:
[0187] In response to the first input, based on the matching between the first type of the user and the first scene label, different compression parameters are used to compress different scene modules in the interface to be compressed, wherein the first scene label corresponds to the first scene module in the interface to be compressed;
[0188] Among them, the first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one second type matches at least one second scene label, and one second scene label matches at least one second type.
[0189] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device.
[0190] Optionally, the processor 1110 is further configured to:
[0191] Determine at least one third scene tag matching the first type in the first scene tags, and compress the first scene module corresponding to the third scene tag using a first compression parameter;
[0192] determining at least one fourth scene tag in the first scene tags that does not match the first type, and compressing the first scene module corresponding to the fourth scene tag using a second compression parameter;
[0193] The compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
[0194] Optionally, the processor 1110 is further configured to:
[0195] Determine a weight value corresponding to each of the third scene labels, wherein the weight value corresponding to the third scene label is the sum of all weights of the first type that match the third scene label, and the weight of the first type is used to indicate the user's preference for the scene indicated by the first type;
[0196] Based on the weight value corresponding to each of the third scene tags, the first compression parameter of each of the first scene modules is determined; wherein the weight value is inversely proportional to the compression degree corresponding to the first compression parameter.
[0197] Optionally, the user input unit 1107 is used to:
[0198] receiving a second input from a user, where the second input is an operation of the user selecting a third compression parameter;
[0199] The processor 1110 is further configured to:
[0200] In response to the second input, all scene modules are compressed using the third compression parameter.
[0201] Optionally, the processor 1110 is further configured to:
[0202] Determining the percentage of remaining memory of the electronic device;
[0203] Determining a fourth compression parameter based on a preset range to which the proportion of the remaining memory belongs, wherein different preset ranges correspond to different fourth compression parameters;
[0204] The different scene modules are compressed using the fourth compression parameter.
[0205] Optionally, the processor 1110 is further configured to:
[0206] Based on album data of the electronic device of the user, a first type of the user is determined.
[0207] Optionally, the processor 1110 is further configured to:
[0208] Determining an initial first type of the user based on album data of the electronic device of the user;
[0209] determining a second user, the second user's first type comprising the user's initial first type;
[0210] Based on the first type of the second user, a first type of the user is determined.
[0211] In an embodiment of the present application, by using different compression parameters to compress different scene modules in the same interface to be compressed based on the matching of the user's preferred scenes and the first scene labels corresponding to different scene modules in the interface to be compressed, it is possible to intelligently perform different degrees of dynamic compression on different scene modules in the same interface to be compressed according to the user's preference for different scenes, thereby ensuring that important content in the taken photos or videos can be restored in high definition, realizing intelligent compression and storage of the taken photos or videos, and effectively saving the memory of the electronic device.
[0212] It should be understood that in the embodiment of the present application, the input unit 1104 may include a graphics processor (Graphics Processing Unit, GPU) 11041 and a microphone 11042, and the graphics processor 11041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1106 may include a display panel 11061, and the display panel 11061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1107 includes a touch panel 11071 and other input devices 11072. The touch panel 11071 is also called a touch screen. The touch panel 11071 may include two parts: a touch detection device and a touch controller. Other input devices 11072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1109 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1110 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1110.
[0213] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned image compression method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0214] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0215] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image compression method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0216] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0217] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0218] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0219] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image compression method, characterized in that: The method comprises: receiving a first input from a user; In response to the first input, based on the matching between the first type of the user and the first scene label, different compression parameters are used to compress different scene modules in the interface to be compressed, wherein the first scene label corresponds to the first scene module in the interface to be compressed; The first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one of the second types matches at least one of the second scene labels, and one of the second scene labels matches at least one of the second types; The method further comprises: determining the first type of the user based on the album data of the electronic device of the user; The determining the first type of the user based on the album data of the electronic device of the user includes: Determining an initial first type of the user based on album data of the electronic device of the user; determining a second user, the second user's first type comprising the user's initial first type; Based on the first type of the second user, a first type of the user is determined.
2. The image compression method according to claim 1, characterized in that: The compressing different scene modules in the to-be-compressed interface by using different compression parameters based on the matching between the first type and the first scene tag of the user includes at least one of the following: Determine at least one third scene tag matching the first type in the first scene tags, and compress the first scene module corresponding to the third scene tag using a first compression parameter; determining at least one fourth scene tag in the first scene tags that does not match the first type, and compressing the first scene module corresponding to the fourth scene tag using a second compression parameter; The compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
3. The image compression method according to claim 2, characterized in that: The using the first compression parameter to compress the first scene module corresponding to the third scene tag includes: Determine a weight value corresponding to each of the third scene labels, wherein the weight value corresponding to the third scene label is the sum of all weights of the first type that match the third scene label, and the weight of the first type is used to indicate the user's preference for the scene indicated by the first type; Based on the weight value corresponding to each of the third scene tags, the first compression parameter of each of the first scene modules is determined; wherein the weight value is inversely proportional to the compression degree corresponding to the first compression parameter.
4. The image compression method according to claim 1, characterized in that: Also includes: receiving a second input from a user, where the second input is an operation of the user selecting a third compression parameter; In response to the second input, all scene modules are compressed using the third compression parameter.
5. The image compression method according to claim 1, characterized in that: Also includes: Determining the percentage of remaining memory of the electronic device; Determining a fourth compression parameter based on a preset range to which the proportion of the remaining memory belongs, wherein different preset ranges correspond to different fourth compression parameters; The different scene modules are compressed using the fourth compression parameter.
6. An image compression device, characterized in that: The device comprises: A first receiving module, used to receive a first input from a user; A first compression module, configured to respond to the first input and compress different scene modules in the interface to be compressed by using different compression parameters based on the matching between the first type of the user and the first scene label, wherein the first scene label corresponds to the first scene module in the interface to be compressed; The first type is one of the preset second types, the first type is used to indicate the scene preferred by the user, the first scene label is one of the preset second scene labels, one of the second types matches at least one of the second scene labels, and one of the second scene labels matches at least one of the second types; The device further includes: a second determination module, configured to determine the first type of the user based on the album data of the electronic device of the user; Among them, the second determination module is also used to: determine the initial first type of the user based on the album data of the user's electronic device; determine a second user, the first type of the second user includes the initial first type of the user; determine the first type of the user based on the first type of the second user.
7. The image compression device according to claim 6, characterized in that: The first compression module is also used for: Determine at least one third scene tag in the first scene tags that matches the first type, and compress the first scene module corresponding to the third scene tag using a first compression parameter; determining at least one fourth scene tag in the first scene tags that does not match the first type, and compressing the first scene module corresponding to the fourth scene tag using a second compression parameter; The compression degree corresponding to the first compression parameter is smaller than the compression degree corresponding to the second compression parameter.
8. The image compression device according to claim 6, characterized in that: The device also includes: A memory acquisition module, used to determine the proportion of remaining memory of the electronic device; A first determining module, configured to determine a fourth compression parameter based on a preset range to which the proportion of the remaining memory belongs, wherein different preset ranges correspond to different fourth compression parameters; The third compression module is used to compress the different scene modules by adopting the fourth compression parameter.
Citation Information
Patent Citations
Video processing method and device, electronic equipment and computer storage medium
CN110149517A
