Self-adaptive image scaling method and device of mobile platform information
A technology for image zooming and moving platforms, which is applied in image coding, image data processing, instruments, etc., and can solve problems such as inability to properly adjust the compression factor
Active Publication Date: 2014-05-14
TCL CORPORATION
6 Cites 1 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0008] In view of the shortcomings of the prior art above, the purpose of the present invention is to provide an adaptive image scaling method and d...
Method used
In summary, the self-adaptive image scaling method and device of the mobile platform information provided by the present invention, in combination with the number of images and the total capacity of the attachment, when judging that the total capacity of the current attachment exceeds the maximum capacity of the attachment, then Select the next compression level sequentially for compression until the total capacity of the current attachment is less than the maximum capacity of the attachment or the lowest compression level has been selected sequentially. At the same time, the compressed image can be changed to a higher or lower compression level, and the compression result can be adaptively adjusted to make use of the limited space as much as possible while maintaining the maximum image precision, so as to meet the different compression needs of users. The self-adaptive image scaling method can effectively improve the precis...
Abstract
The invention discloses a self-adaptive image scaling method and device of mobile platform information. The method comprises the steps that when an information editing interface is opened to add files, whether a current file can be added or not is judged according to the maximum capacity of an attachment; when the file is added, scaling processing of a corresponding compression level is conducted on all images in the attachment according to the types, the number, the size and the maximum capacity of the attachment of the added files; the surplus capacity of the attachment is detected, a user is prompted to add files continuously when the surplus capacity is available, and when the surplus capacity is insufficient, the user is prompted to delete the file. According to the self-adaptive image scaling method and device of the mobile platform information, self-adaptive compression of the corresponding compression level can be chosen according to the capacity, finite space is completely used, meanwhile, the maximum image accuracy can be maintained, and the demand of users is met.
Application Domain
Image coding
Technology Topic
Self adaptiveReal-time computing +3
Image
Examples
- Experimental program(1)
Example Embodiment
[0070] The present invention provides an adaptive image scaling method and device for mobile platform information. In order to make the purpose, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
[0071] The adaptive image scaling method for mobile platform information provided by the embodiment of the present invention is applicable to various systems. Taking the Firefox OS system as an example, the adaptive image scaling method for mobile platform information is based on compression according to the number of images. An adaptive scaling process according to the capacity is added, so that when there are few images in the attachment and the images are not very large, the images are kept as much as possible according to a higher compression level (that is, the image size changes little or very little after compression). original precision. When there are many images in the attachment, or the images are relatively large, compress them at a lower compression level (that is, the size of the images becomes smaller after compression), and store as many images as possible while maintaining a certain accuracy. The compression levels in this embodiment include: zero-level compression (no compression), one-level compression (Vresized≤0.4×limitation), and two-level compression (Vresized≤0.2×limitation), where Vresized represents the size of the compressed image, and limitation represents the size of the compressed image. Attachment maximum capacity; zero-level compression has the highest level, and second-level compression has the lowest level.
[0072] That is to say, when the adaptive image scaling method provided in this embodiment determines that the total capacity of the current attachment (that is, the sum of the sizes of all files in the attachment) exceeds the maximum capacity of the attachment, the next compression level is selected in sequence until the The total capacity of the attachment is currently smaller than the maximum capacity of the attachment or the lowest compression level has been selected in sequence. At the same time, the compressed image can be changed to a higher or lower compression level, the compression result can be adjusted adaptively, and the limited space can be used as much as possible while maintaining the maximum image precision to meet the different compression requirements of users.
[0073] see figure 1 , the adaptive image scaling method of the mobile platform information includes:
[0074] S100. When opening the information editing interface to add a file, determine whether the current file can be added according to the maximum capacity of the attachment.
[0075] S200. When the file can be added, according to the type, number, size of the added file and the maximum capacity of the attachment, perform scaling processing on all images in the attachment corresponding to the compression level.
[0076] S300 , detecting the size of the remaining capacity of the attachment, and prompting the user to continue adding files when there is remaining capacity, and prompting the user to delete files when the remaining capacity is insufficient.
[0077] Take the Firefox OS system as an example, open the sms application of Firefox OS, create a new message, and start adding files in the attachment. The improvement of this embodiment is that, before compression, two queues need to be initialized to store images to be compressed. The step S100 specifically includes: initializing the compressed queue and the to-be-amplified queue when the information editing interface is opened. When adding a file, it is judged whether the total capacity of the current attachment is less than the preset maximum capacity of the attachment: if so, the file can be added, and step B is performed; otherwise, the file cannot be added, indicating that the capacity of the attachment is insufficient.
[0078] The compressed queue is: a queue after the files are compressed, used for displaying all files in the attachments and temporary storage for sending attachments, and further compression later. The queue to be enlarged is: it is a queue of files without any processing. It is called when the image is zoomed after deleting the file in the attachment, or when a certain image compression level is specified. The files in the to-be-amplified queue and the compressed queue may include one or more of images, video, and audio. These two kinds of queues are essentially the paths for storing the same files after different processing. Among them, the files in the queue to be enlarged can be considered as copies of the source files (that is, the original files), that is, they are exactly the same as the source files, and are used for subsequent calls. . The files in the compressed queue are equivalent to the files after the source files are compressed (video and audio are usually not compressed). In this embodiment, users in the compressed queue are visible, but users in the queue to be enlarged are invisible.
[0079] Step S200 is executed when the added file can be compressed, which specifically includes:
[0080] Step 201: Store the file in the compressed queue and the to-be-amplified queue.
[0081] Step 202: Determine whether the added file type is an image, if so, go to Step 203, otherwise go to Step 204.
[0082] Since audio and video are not compressed but only images are compressed, different types of attachments adopt different compression methods.
[0083] Step 203: When it is judged that the number of images is greater than 1, or the total capacity of the attachment is greater than the maximum capacity of the attachment, compress the images in the compressed queue according to the first compression algorithm.
[0084] see figure 2 , the first compression algorithm is:
[0085] S11. Scan the compressed queue, extract all images without a specified compression level, and store them in the image queue. All images do not include images with a specified compression level, and the compression process is performed in the image queue. In this way, extracting (equivalent to copying) the image to be compressed separately can avoid affecting other files in the compressed queue (such as audio, video, and images that have been assigned a compression level) to be compressed at the same time.
[0086] S12, determine whether the number of the images is less than 3 and greater than 0; if so, execute S13; otherwise, execute S14;
[0087] S13. Adopt one-level compression, and the compression limit of each image is 0.4 times the maximum capacity of the attachment;
[0088] S14. Two-level compression is adopted, and the compression limit of each image is 0.2 times the maximum capacity of the attachment;
[0089] S15. Compress the images in the image queue according to the corresponding compression level, and control the size of the compressed image within the compression limit; update the compressed queue with the compression result in the image queue. That is, the images in the compressed queue are stored according to the compressed size.
[0090] During specific implementation, the default maximum capacity of attachments in the Firefox OS system is 300K. If the added file is not an image (that is, the attachment is audio or video), step 204 needs to be executed to determine that the total capacity of the attachment is greater than the maximum capacity of the attachment, and when the file can still be compressed, compress the images in the compressed queue according to the second compression algorithm . Specifically:
[0091] First determine whether the total capacity of the current attachment is greater than the maximum capacity of the attachment, if not, prompt the user to continue adding files. If so, it is judged whether the compression level of the current attachment is the last level. If so, the user is prompted that the attachment capacity is insufficient, and some files are suggested to be deleted; otherwise, the images in the compressed queue are compressed according to the second compression algorithm. see image 3 , the second compression algorithm is:
[0092] S21. Scan the compressed queue, extract all images without a specified compression level, and store them in the image queue.
[0093] S22. Determine whether the number of the images is greater than 0; if so, execute S23, and if not, end.
[0094] S23. Detect the compression level of the images in the image queue. That is, the current compression level L is detected as zero-level compression, first-level compression or second-level compression.
[0095]S24. Compress the images in the image queue to the next compression level, and update the compressed queue with the compression result in the image queue. That is, let L=L+1, and update the corresponding image in the compressed queue with the compression result.
[0096] S25. Determine whether the compression level of the images in the compressed queue is secondary compression, or whether the total capacity of the current attachment is less than the maximum capacity of the attachment; if it is already secondary compression or the total capacity of the current attachment is less than the maximum capacity of the attachment, end; otherwise, return S24.
[0097] In specific implementation, after the step 203, that is, after compressing the images in the compressed queue according to the first compression algorithm, the method further includes: judging whether the total capacity of the current attachment is greater than the maximum capacity of the attachment, and if so, the second compression algorithm is required. Compress the images in the compressed queue again. Otherwise, the user is prompted to continue adding files.
[0098] After the compression is completed, that is, after being compressed by the second compression algorithm in the above step 204, the size of the remaining capacity of the attachment can be detected, and the user is prompted to continue adding files when there is remaining capacity, and the user can be prompted to delete files when the remaining capacity is insufficient.
[0099] When the user deletes one or more files, the compression level can be adjusted according to the total capacity of the current attachment and the maximum capacity of the attachment, so that the image maintains the maximum image accuracy that can be stored (that is, the size of the image is the largest, and the sum of the size of the image does not exceed attachment maximum capacity); it specifically includes:
[0100] Step 401, when deleting part of the file, delete the corresponding file from the compressed queue and the queue to be enlarged;
[0101] Step 402: Determine whether there are images in the remaining files, and if so, go to Step 403; otherwise, prompt the user to add files.
[0102] Step 403: Determine whether the compression level of the current image is the highest level (ie, zero-level compression); if so, the image is not enlarged, otherwise the image is scaled according to the third compression algorithm. That is, adjust the compression level of the image so that the image maintains the maximum image accuracy that can be stored.
[0103] see Figure 4 , the third compression algorithm is:
[0104] S31. Scan the queue to be compressed, extract all images without a specified compression level, and store them in the image queue.
[0105] S32, determine whether the number of images is greater than 0; if so, execute S33, otherwise end.
[0106] S33. Detect the compression level of the images in the image queue. That is, the current compression level L is detected as zero-level compression, first-level compression or second-level compression.
[0107] S34: Compress the images in the image column to the next compression level, and update the compressed queue with the compression result in the image queue. Even if L=L-1, the previous compression level is selected, and the corresponding image in the compressed queue is updated with the compression result.
[0108] S35, determine whether the total capacity of the attachment is greater than the maximum capacity of the attachment; if so, execute S37, otherwise, execute S36.
[0109] S36: Determine whether the compression level in the image queue is zero-level compression, if so, end, otherwise return to S34.
[0110] S37. Compress the images in the image queue to the next compression level, and update the corresponding images in the compressed queue with the compression result. That is, let L=L+1. Zoom ends.
[0111] It should be understood that when the user deletes one or more files, the total size of the attachment must decrease. At this time, the compression level of the image can be dynamically adjusted to make the size of the image larger or smaller, and the compression results obtained before can be changed to make more full use of the remaining capacity of the attachment, so as to maintain the best image accuracy. The most appropriate compression; avoids the waste of remaining capacity caused by excessive image compression, and solves the problem that the compression coefficient cannot be reasonably adjusted and the remaining space cannot be fully utilized in the prior art.
[0112] During specific implementation, if the user needs to ensure the clarity of a certain image, it is not necessary to compress a certain image, or a certain image needs to be greatly compressed. Then, the image can be directional compressed, that is, in step S200, it further includes: compressing the image selected by the user according to the compression level selected by the user through a fourth compression algorithm. Specifically: when it is judged that the total capacity of the attachment is less than the maximum capacity of the attachment and the number of images is greater than 0, the compressed queue is popped up and all files are displayed. When the user selects a file (an image in this embodiment), a list of compression levels pops up. The list of compression levels shows: zero-level compression (no compression), first-level compression (the size of the compressed image is less than or equal to 0.4 times the maximum capacity of the attachment) and two-level compression (the size of the compressed image is less than or equal to the maximum capacity of the attachment) 0.2 times). After the user selects a certain compression level, a fourth compression algorithm is executed, that is, it is judged whether the selected image satisfies the compression conditions of the compression level, and if so, the image can be scaled by the selected compression level.
[0113] see Figure 5 , the fourth compression algorithm is specifically:
[0114] S41. Scan the queue to be enlarged, extract an image with a specified compression level and store it in the image queue, where the specified compression level is L1; and obtain the compression level of the image in the compressed queue, the compressed queue The compression level obtained in is L2.
[0115] It should be understood that, since the queue to be enlarged is a queue of files without any processing, the compression level of all images stored therein is zero-level compression. The compression level in the compressed queue can be changed. When the user specifies the compression level of an image, only the compression level L1 is marked in the corresponding image, and the compression levels in the queue to be enlarged and the queue to be compressed will not be changed at this time.
[0116] S42, determine whether L1 and L2 are the same, if they are the same, execute S44, otherwise, execute S43.
[0117] Through the above method, it is clear that the compression is performed in the image queue, the compression level in the compressed queue can be changed, and the compression level of the images in the queue to be enlarged remains the zero-level compression. It is judged whether the compression level L2 in the compressed queue is the same as the compression level L1 specified by the user. If it is the same, no compression is required, and if it is not the same, it needs to be changed to the compression level L1 specified by the user.
[0118] S43: Compress the image with the specified compression level taken out of the queue to be enlarged from the zero-level compression directly to the specified compression level L1, and update the corresponding image in the compressed queue with the compression result.
[0119] Since the images in the compressed queue are already compressed, recompressing against this baseline may affect image accuracy. In this embodiment, the compression level of the image extracted from the queue to be enlarged is used as the benchmark, and the compression level is compressed to the compression level specified by the user, which is equivalent to initial compression of the image, and the obtained compression effect is better without affecting the accuracy of the image.
[0120] S44. Determine whether the total capacity of the current attachment is greater than the preset maximum capacity of the attachment: if so, it prompts that the compression of the specified image fails, and compresses the original image to the compression level L2 obtained in the compressed queue; otherwise, it prompts that the specified image is successfully compressed.
[0121] According to the compression level specified by the user, the different needs of the user are more reasonably considered, the size of the specified image can be retained according to the user's needs, and the loss of the accuracy of the specified image is avoided.
[0122] Based on the above-mentioned adaptive image scaling method based on mobile platform information, an embodiment of the present invention also provides an image compression apparatus, such as Image 6 As shown, it includes: a judgment module 10 , a compression module 20 and a prompt module 30 which are connected in sequence. When the judging module 10 is used to open the information editing interface to add a file, it judges whether the current file can be added according to the maximum capacity of the attachment; The maximum capacity of the attachment, to perform scaling processing on all images in the attachment corresponding to the compression level; the prompt module 30 is used to detect the size of the remaining capacity of the attachment, and prompt the user to continue adding attachments when there is remaining capacity, and prompt the user to delete when the remaining capacity is insufficient. document.
[0123] To sum up, the adaptive image scaling method and device for mobile platform information provided by the present invention, combined with the number of images and the total capacity of the attachments, when it is judged that the current total capacity of the attachments exceeds the maximum capacity of the attachments, the selection is made in sequence. The next compression level compresses until the current attachment's total capacity is less than the attachment's maximum capacity or the lowest compression level has been selected in sequence. At the same time, the compressed image can be changed to a higher or lower compression level, the compression result can be adjusted adaptively, and the limited space can be used as much as possible while maintaining the maximum image precision to meet the different compression requirements of users. The adaptive image scaling method can effectively improve the accuracy of the image or increase the storage capacity of the image to a certain extent, and at the same time, it also adds customization and reversible compression, which more humanely meets the changing needs of users.
[0124] It can be understood that for those of ordinary skill in the art, equivalent replacements or changes can be made according to the technical solutions of the present invention and the inventive concept thereof, and all these changes or replacements should belong to the protection scope of the appended claims of the present invention.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.