Image processing method, system, computer device and readable storage medium

By acquiring and processing image file attribute information in mobile device applications, extracting texture features and processing recognition rules, combining similar image files and replacing images, the problem of excessive file size in mobile device applications is solved, and file deduplication and Reduction in traffic consumption.

CN109543062BInactive Publication Date: 2024-09-17CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201811151264.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-09-29
Publication Date
2024-09-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Due to the need to adapt to different screen sizes in mobile device applications, images of different sizes are set in icon projects, resulting in larger packaged file sizes and increased user network traffic consumption.

Method used

By obtaining attribute information of image files, perform texture feature extraction and recognition rule processing, combine similar image files, retain one image file and replace other image files, update file location information, delete replaced image files, and achieve deduplication and file reduction. size.

Benefits of technology

It effectively reduces the size of application files, reduces user traffic consumption, improves download success rate, and realizes automatic deduplication and file optimization of similar images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109543062B
    Figure CN109543062B
Patent Text Reader

Abstract

The present invention provides an image processing method, system, computer device and readable storage medium. The image processing method comprises: obtaining the attribute information of each image file contained in the source file in the application, wherein the attribute information includes the position information corresponding to the image file; extracting texture features for each image file, and taking two or more image files whose texture feature similarity is greater than a preset value as an image group; performing recognition operations on the image files of the image group according to recognition rules to obtain the retained image and the replaced image corresponding to the image group; updating the position information corresponding to the replaced image file in the image group to the position information corresponding to the retained image. The present invention can perform deduplication operations by identifying the same or similar images of the source files of the application, and can correspondingly update the reference of the source file to the deduplication result, which is beneficial to reducing the size of the application file and reducing the traffic consumption of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to an image processing method, system, computer device and readable storage medium. Background Art

[0002] This section is intended to provide a background or context to embodiments of the invention as set forth in the claims and detailed description. No description herein is admitted to be prior art by inclusion in this section.

[0003] Mobile devices have been widely used. To suit different groups of people, there are many optional screen sizes for mobile devices. Therefore, in project development, an icon needs to be adapted to screens of different sizes, and pictures of different sizes need to be set in the project. However, when pictures of different sizes are set in the project, the size of the packaged project file will be larger, and users will need to spend more network traffic to download it. Summary of the invention

[0004] In view of the above, the present invention provides an image processing method, system, computer device and readable storage medium to help reduce the size of the packaged file.

[0005] An image processing method, comprising:

[0006] Acquire attribute information of each image file included in the source file in the application, wherein the attribute information includes location information corresponding to each image file;

[0007] Extracting texture features from each of the image files, and taking two or more of the image files whose texture features have a similarity greater than a preset value as an image group;

[0008] Performing an identification operation on the image files of the image group according to the identification rule to obtain a retained image and a replaced image corresponding to the image group;

[0009] The position information corresponding to the replaced image file in the image group is updated to the position information corresponding to the retained image.

[0010] Furthermore, in the image processing method, before extracting texture features from each image file, the method includes:

[0011] Remove the preset characters contained in the name information of the image file;

[0012] Determine whether there are two or more image files with the same name information after removing the preset characters;

[0013] If there are two or more image files with the same name information after removing the preset characters, the two or more image files with the same name information after removing the preset characters are used as the image group;

[0014] The extracting of texture features from each of the image files comprises:

[0015] Texture feature extraction is performed on the image files that are not grouped in the image files.

[0016] Furthermore, in the image processing method, performing an identification operation on the image files of the image group according to the identification rule to obtain the retained image and the replaced image corresponding to the image group includes:

[0017] Determining whether the image group contains a vector type image file;

[0018] When the image group includes a vector image file, the vector image file is used as the reserved image, and other image files in the image group except the reserved image are used as the replaced images.

[0019] Furthermore, in the image processing method, performing an identification operation on the image files of the image group according to the identification rule to obtain the retained image and the replaced image corresponding to the image group includes:

[0020] Determine whether there is a reference image in the image group that meets a preset condition; wherein the preset condition is: the clarity of the reference image after being enlarged to other images in the image group is not less than a preset clarity;

[0021] If so, the reference image satisfying the preset condition is used as the retained image, and other images in the image group are used as the replaced images.

[0022] Furthermore, in the image processing method, determining whether there is a reference image satisfying a preset condition in the image group includes:

[0023] It is determined whether the enlargement replacement ratio corresponding to the conversion of the reference image into other images in the image group is within a preset range, wherein the enlargement replacement ratio is calculated based on the size information of the reference image and the converted other images in the image group.

[0024] Furthermore, in the image processing method, whether the corresponding magnification replacement rate when the reference image is converted into other images in the image group is within a preset range includes:

[0025] The image file with the smallest size information in the image group is used as the reference image, and the image files with other size information in the image group are used as the comparison images;

[0026] Determining whether the magnification replacement rate when converting the reference image into a comparison image in the image group is within the preset range;

[0027] When the enlargement replacement ratio is within the preset range, the comparison image is used as the replaced image, and the process of determining whether the enlargement replacement ratio when the reference image is replaced by a comparison image in the image group is within the preset range is returned;

[0028] When the enlargement replacement rate is not within the preset range, the reference image is used as the replaced image, and the process returns to the step of using the image file with the smallest size information in the image group as the reference image, and using the image files with other size information in the image group as comparison images, wherein the reference image and the comparison image are other image files in the image group except the replaced image.

[0029] Furthermore, the image processing method further includes:

[0030] The replaced image file in the image group is deleted.

[0031] An image processing system, comprising:

[0032] An acquisition unit, used to acquire attribute information of each image file included in a source file in an application, wherein the attribute information includes location information corresponding to each image file;

[0033] An extraction unit, used for extracting texture features from each of the image files, and taking two or more of the image files whose texture features have a similarity greater than a preset value as an image group;

[0034] an identification unit, configured to perform an identification operation on the image files of the image group according to an identification rule, so as to obtain a retained image and a replaced image corresponding to the image group;

[0035] The replacement unit is used to update the position information corresponding to the replaced image file in the image group to the position information corresponding to the retained image.

[0036] A computer device comprises a processor and a memory, wherein the memory stores a plurality of computer programs, and the processor is used to implement the steps of the image processing method when executing the computer programs stored in the memory.

[0037] A readable storage medium stores a computer program, which implements the steps of the image processing method when executed by a processor.

[0038] The above-mentioned image processing method, system, computer device and readable storage medium can perform deduplication operations by identifying the same or similar images in the source files of the application, and can correspondingly update the reference of the source file to the deduplicated result, so that the same and / or similar images can be easily removed without doing additional work, thereby reducing the size of the application file, reducing the user's traffic consumption, and also improving the download success rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 is a flow chart of a preferred embodiment of the image processing method of the present invention;

[0041] Figure 2 is an exemplary structural diagram of a computer device provided by one embodiment of the present invention;

[0042] Figure 3 It is an exemplary block diagram of an image processing system provided by one embodiment of the present invention.

[0043] Main component symbols

[0044] Computer device 40

[0045] Processor 401

[0046] Memory 405

[0047] Input and output interface 407

[0048] Network interface 409

[0049] BUS 411

[0050] Display 403

[0051] Image Processing System 417

[0052] Acquisition unit 410

[0053] Extraction unit 712

[0054] Removal unit 714

[0055] Replacement unit 716

[0056] Filter unit 718 DETAILED DESCRIPTION

[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, and the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0060] Figure 1 is a flowchart of the image processing method of the first embodiment of the present invention. It should be noted that the image processing method of this embodiment is not limited to Figure 1 The steps and order in the flowchart shown. According to different requirements, the steps in the flowchart shown can be added, removed, or the order can be changed.

[0061] A first preferred implementation of the image processing method of this embodiment may include the following steps:

[0062] Step 100: Obtain attribute information of each image file contained in the source file of the application.

[0063] It is understandable that the application can be installed in a terminal (such as a smart phone, etc.) to achieve specific functions, including but not limited to social networking, text messaging, etc. It is understandable that several images may be required in an application to provide a better user interaction interface. Therefore, one or more image files may be included in the source file of the application.

[0064] Preferably, the attribute information of each image file (each image file) includes but is not limited to the name, type, size, location, size and other information of the image file. For example, the name information of the image file may be sample.png, sample@2x.png, sample@3x.png, etc.; the type information of the image file may include vector image or bitmap format, such as svg, jpeg, png, bmp, etc., wherein the type information of the image file can be obtained from the extension included in the name information of the image file, such as the extension corresponding to the image file named sample.png is png, therefore, it can be determined that the type of the image file sample.png is png; the size information of the image file is the image pixel size, such as 30px*30px (pixels), 48px*48px, 200px*200px, etc.; the location information of the image file may be the path of the image in the source file, and the location information may be a relative path or an absolute path; the size information of the image file is the size of the storage space occupied by the image, such as 32KB, 54KB, 1MB, etc.

[0065] Preferably, the attribute information corresponding to each image file can be obtained by traversing the source files included in the entire application. In addition, the attribute information of the image file obtained after traversing the entire application can be stored in the configuration file. In the configuration file, each image file can be set with a different file identifier, so in the configuration file, each file identifier can correspond to the name, type, size, location, size and other information of the image file.

[0066] Step 102: Perform a filtering operation according to the name information of each image file to obtain one or more image groups, wherein each image group contains the same image with different size information.

[0067] In order to adapt the application to different environments or terminal screens, an image file has multiple sizes, and the difference is mainly in the size. Therefore, they are usually distinguished by different names. For example, for a screen size of 1:1, the name of the image file can be: sample.png (1x image); for a screen size of 1:2, the name of the image file can be: sample@2x.png (2x image); for a screen size of 1:3, the name of the image file can be: sample@3x.png (3x image). Therefore, the image file name filtering operation can be performed according to the name information of the image file.

[0068] It can be understood that the name information of several image files can be obtained from the configuration file, and the names of several image files can be matched. If there are image files whose names differ only in specific preset characters (such as the above-mentioned @2x, @3x), then the images whose names differ in the specific characters can be taken as an image group. Specifically, the name information of each image file can be obtained from the configuration file first, and then the preset characters contained in the name information of the image file can be removed, and it can be determined whether there are two or more image files with the same name information after removing the preset characters. If so, the two or more image files with the same name information after removing the preset characters can be taken as an image group, such as the image files with corresponding file identifiers as an image group. For example, the image name information sample.png, sample@2x.png, sample@3x.png and abc@2x.jpg are sample.png, sample.png, sample.png and abc.jpg respectively after removing the preset characters. Among them, sample.png can correspond to the first file identifier, sample@2x.png can correspond to the second file identifier, sample@3x.png can correspond to the third file identifier, and abc@2x.jpg can correspond to the fourth file identifier. Since the name information of the images corresponding to the first to third file identifiers after removing the preset characters are all sample.png, they can be regarded as the same image, and the name information of the image corresponding to the fourth file identifier is abc.jpg. Therefore, the image files corresponding to the first to third file identifiers can be regarded as the first image group.

[0069] For this image group, in order to reduce the size of the packaged image, only one of the images can be retained in the source file of the application to obtain the retained image, and the other image files can be used as replaced images, or the replaced images can be deleted from the source file of the application. For example, the above images sample.png, sample@2x.png, and sample@3x.png can be used as an image group, and any one of the three images can be retained, while the other files used as replaced images can be deleted. Of course, one of them can also be retained according to implementation needs.

[0070] Step 104: extract texture features from each of the image files, and take two or more image files whose texture feature similarity is greater than a preset value as an image group.

[0071] It is understandable that in the source file of the application, some image files may have the same or similar texture features, but their image file names are different. Therefore, after the image file name filtering operation, the source file may still have the same or similar images. The same image can be represented by the same texture features of the image files, and the same or different information such as the size; similar images can be represented by similar texture features of the image files, and the different or different information such as the size.

[0072] It is understandable that in other embodiments, step 102 may be omitted, and texture features may be directly extracted from all image files, and whether multiple image files can be used as an image group may be determined based on the texture features. Of course, since the filtering operation of step 102 can be grouped based on the name information of the image files, under the premise of implementing the filtering operation of step 102, the extraction of texture features may be performed on image files that have not been grouped after the filtering operation, which is conducive to speeding up the processing speed of image grouping.

[0073] It can be understood that the texture feature extraction method may include LBP (Local Binary Pattern), and the steps of LBP texture feature extraction are as follows:

[0074] The image can be divided into n*n (such as 16*16) small areas (cells). For a pixel in each cell, the 8 points in its annular neighborhood (or multiple points in the annular neighborhood) are compared clockwise or counterclockwise. If the central pixel value is larger than the neighboring point, the neighboring point is assigned 1, otherwise it is assigned 0. In this way, each point will obtain an 8-bit binary number (usually convertible to decimal). Then calculate the histogram of each cell, that is, the frequency of occurrence of each number (assuming it is a decimal number) (that is, a binary sequence of statistics on whether each pixel point is larger than the point in the neighborhood), and then normalize the histogram. Finally, the statistical histograms of each cell are connected to obtain the LBP texture features of the entire image, so as to determine whether it is the same or similar image based on the texture features of the image.

[0075] It can be understood that when the similarity of texture features of at least two images is greater than a preset value, these image files can be regarded as an image group.

[0076] For example, when the texture features of the first image group are all arrows with rounded corners, after the texture features of the images are extracted, it can be considered that their texture features are the same, so the images in the first image group can be considered to be the same image. When the texture features of the second image group include arrows with rounded corners and arrows with sharp corners, since the second image group includes arrow texture features, the difference is only the rounded corners or the sharp corners, and in some interfaces, these images can be replaced with each other, so it can be considered that the second group of images contains similar images.

[0077] Step 106: performing an identification operation on the image files of the image group according to the identification rule to obtain the retained image and the replaced image corresponding to the image group.

[0078] Preferably, a retained image and one or more replaced images in the image group may be obtained according to a recognition rule.

[0079] Preferably, the recognition rule may include performing a recognition operation according to a type of the image file or performing a recognition operation according to size information of the image file.

[0080] It can be understood that when performing the recognition operation according to the type of the image file, for the type of the image file, some image types are vector images, and the vector image can maintain the same clarity when it is scaled to different sizes. Therefore, for an image group, if there is an image file whose type information is a vector image in the same or similar image group, then the image whose type information is a vector image can be retained to obtain a retained image, and other non-vector images in the same or similar image group can be replaced with the retained image, so that other non-vector images in the same or similar image group can be used as the replaced image.

[0081] It is understandable that the file of the replaced image can be deleted, and the reference to the replaced image in the source file of the application can be updated. Preferably, the location information of the replaced image file can be obtained from the configuration file, and the location information of the replaced image file can be replaced or updated with the location information corresponding to the image file retained in the image group, so that when the replaced image file is to be displayed or called, it can be displayed by the retained image file, wherein when the retained image file is displayed, the retained image file can be correspondingly enlarged or reduced according to the size information of the replaced image file, and for the enlargement or reduction of the vector image, there is no obvious difference in the display effect for the user.

[0082] It can be understood that, in performing the recognition operation according to the size information of each image file, if all images in the image group are non-vector images, the recognition operation can be performed according to the size information of the image file.

[0083] Preferably, the size information of the image files included in the image group can be obtained. For example, an image group may include three image files, sample.png, sample@2x.png, and sample@3x.png, wherein the size information of the image files sample.png, sample@2x.png, and sample@3x.png may be 30px*30px, 48px*48px, and 200px*200px, respectively.

[0084] It is determined whether there is an image file in the image group whose definition after being enlarged to other images in the image group is not less than a preset definition.

[0085] Preferably, assuming that in the image group, the retained image V1 can be replaced by other replaced images, in this case, the judgment can be made by comparing the size information between the retained image V1 and the other replaced images V2. In addition, when the retained image needs to be reduced to become the replaced image, since the image file reduction has little effect on its clarity, if the retained image needs to be directly reduced to become the replaced image, the replaced image can be directly deleted.

[0086] For example, the size information of the retained image V1 is a1; the size information of the replaced image V2 is a2; the enlargement replacement ratio R is defined as (a2-a1) / a1, where a2 is not less than a1, indicating that the replacement image needs to be enlarged to become the replaced image. When the enlargement replacement ratio R is not within the preset range, it may indicate that the replacement image may cause its clarity to decrease or become inappropriate when it is scaled to the replaced image file style; when the enlargement replacement ratio R is within the preset range (such as 0 to 1), it may indicate that a certain clarity can be guaranteed when the replacement image is scaled to the replaced image file style.

[0087] It can be understood that the process of determining whether there is an image file in the image group that is enlarged to other images through a zoom operation and the image after the zoom operation has a definition not less than a preset definition may also include:

[0088] Determine whether there are image files with the same size information in the image group; when there are image files with the same size information, it means that there are at least two image files with the same or similar images and the same size information in the image group, so one of the at least two image files can be used as a retained image, and the other image files with the same size information can be used as replaced images.

[0089] When the size information of each image file in the image group is different, it can be determined whether the magnification replacement ratio corresponding to the conversion of the reference image in the image group into the replaced image is within a preset range; when the magnification replacement ratio is within the preset range, the reference image file in the image group can be retained as a retained file, and other image files can be replaced. In other embodiments, the determination of the same size information may not be performed.

[0090] Preferably, the image file with the smallest size information in the image group can be obtained through the configuration file as a reference image, and the image files with other size information in the image group can be used as comparison images to determine whether the magnification replacement rate when the reference image is replaced by a comparison image in the image group is within a preset range. In other embodiments, when there are at least two smallest image files in the image group, one of the at least two smallest image files can be randomly selected as the reference file.

[0091] When the enlargement replacement rate is within the preset range, it means that the reference image can be replaced by the comparison image. Therefore, the reference image can be used as a retained image, and the comparison image can be used as a replaced image. In this way, image files with smaller size information in the image group can be retained, which is beneficial to reducing the size of the packaged file. Afterwards, the enlargement replacement rate when the reference image is replaced by other comparison images in the image group can be further determined.

[0092] When the enlargement replacement rate is not within the preset range, it means that the clarity of the comparison image may be affected to a certain extent after being enlarged by the reference image. However, since the reference image can be obtained by reducing the comparison image, the reference image can be used as the replaced image, and the process of using the image file with the smallest size information in the image group as the reference image and using the image files with other size information in the image group as the comparison image is returned to be executed, wherein the reference image and the comparison image are other image files in the image group except the replaced image.

[0093] Afterwards, it can be determined whether the number of the comparison files in the image group is 1; when the number is 1, it means that the remaining comparison images in the image group can be used as retained images.

[0094] In other embodiments, the step of determining whether there are image files with the same size information in the image group may also be omitted. For example, when the image group contains two image files with the same size information, the size information of the retained image V1 is a1, and the size information of the replaced image V2 is a2. According to the magnification replacement ratio R=(a2-a1) / a1, R=0. At this time, when the magnification replacement ratio R is within a preset range (such as 0 to 1), it can be said that a certain clarity can be protected when the replacement image is scaled to the style of the replaced image file. Therefore, the replaced image V2 can be obtained, and the position information of the replaced image is replaced with the position information of the retained image.

[0095] In other embodiments, it can be determined whether there is a reference image in the image group whose corresponding magnification replacement rates are not less than a preset definition when the reference image is magnified to all other comparison images. If so, the reference image can be used as the retained image, and the other comparison images can be used as the replaced images. If not, the image file with the largest size information in the image group can be used as the retained image, and the other image files can be used as the replaced images.

[0096] For example, for the first image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) may be 30px*30px, 44px*44px, and 48px*48px, respectively. When retaining the 1x image, since the 2x image and the 1x image can be achieved by scaling and have a certain clarity after scaling, the magnification replacement rate is (44-30) / 30=0.47, which can be considered to be within the preset range (in other embodiments, the magnification replacement rate can also be expressed as (44*44-30*30) / 30*30=1.15, and the preset range at this time needs to be adjusted accordingly); and since the 3x image and the 1x image can also be achieved by scaling and have a certain clarity after scaling (the magnification replacement rate is (48-30) / 30=0.6, which can be considered to be within the preset range, and other magnification replacement rate standards also need to be consistent); therefore, the 1x image can be retained as the retained image, and the 2x image and the 3x image can be used as the replaced images, that is, the 2x image and the 3x image can be replaced by the 1x image.

[0097] For the second image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) can be 30px*30px, 44px*44px, and 77px*77px, respectively. When retaining the 1x image, the 2x image and the 1x image can be obtained by scaling, and have a certain clarity after scaling; and the 3x image has a lower clarity after scaling by the 1x image (its magnification replacement rate is (77-30) / 30=1.57, which can be considered not within the preset range), and when the 2x image is enlarged to the 3x image, it can be achieved by scaling (its magnification replacement rate is (77-44) / 44=0.75, which can be considered within the preset range), and has a certain clarity after scaling; therefore, the 2x image can be retained as the retained image, and the 1x image and the 3x image can be used as the replaced images, and the 1x image can be obtained by shrinking the 2x image, and its clarity is not greatly affected.

[0098] For the third image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) can be 30px*30px, 44px*44px, and 200px*200px, respectively. When retaining the 2x image, since the 1x image can be obtained by scaling the 2x image, and has a certain clarity after scaling, the 2x image can be retained as the retained image, and the 1x image can be used as the replaced image; however, when the 2x image is scaled to the 3x image, the clarity of the scaled 3x image is obviously affected (its magnification replacement ratio is (200-44) / 44=3.54, which can be considered to be not within the preset range), so the 3x image in the image group will also be retained, and the 2x image will be used as the replaced image, that is, the image group at this time contains the 3x image. At this time, the 3x image (with the maximum size information) in the image group can be retained as the retained image, and the 1x image and the 2x image can be used as the replaced images, and can be replaced by the retained image.

[0099] Step 108: Update the location information corresponding to the replaced image file in the image group to the location information corresponding to the retained image.

[0100] For example, in the first image group described above, since the 1x image is retained, the locations of the 2x image and the 3x image referenced in the source file of the application will be updated to the path where the 1x image is located.

[0101] In the above-mentioned second image group, since the 2x image is retained, the location of the 1x image and the 3x image referenced in the source file of the application will be updated to the path where the 1x image is located.

[0102] In the third image group described above, since the 3x image is retained, but the 1x image and the 2x image are used as replaced images, the locations of the 1x image and the 2x image referenced in the source file of the application will be updated to the path of the 3x image.

[0103] Step 110, the replaced image in the image group is deleted. By identifying similar images of the source file of the application, it is possible to automatically remove duplicates (such as deleting the replaced image), and automatically change the references in the project to the deduplicated results, so that users can easily identify similar images without doing additional work, reduce the size of the application file, reduce the user's traffic consumption, and also improve the download success rate.

[0104] See also Figure 2 , a block diagram of a preferred embodiment of the image processing system 417 of the present invention applied to a computer device 40. The computer device 40 may include a computing device 417, such as a mobile phone, a tablet computer, a computer, a server, or other computer device with data processing functions.

[0105] The computer device 40 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0106] The computer device 40 may be, but is not limited to, any electronic product that can interact with a user via a keyboard, mouse, remote control, touchpad, or voice control device, such as a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, a smart wearable device, etc.

[0107] The network where the computer device 40 is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc. For example, the computer device 40 can access the Internet, a wide area network, a metropolitan area network, a local area network, or a virtual private network through a network interface 409.

[0108] The memory 405 may be different types of storage devices or computer-readable storage media for storing various types of data. For example, it may be the memory of the computer device 40, or a storage card that can be externally connected to the computer device 40, such as a flash memory, a SM card (Smart Media Card), an SD card (Secure Digital Card), etc. The memory 405 is used to store various types of data, for example, information such as information processing applications installed in the computer device 40, data set and obtained by applying the above-mentioned information processing method, and the like.

[0109] The processor 401 is used to execute the computing method and various software installed in the computer device 40, such as an operating system, information processing software, etc. The processor 401 includes but is not limited to a processor (Central Processing Unit, CPU), a microcontroller unit (Micro Controller Unit, MCU) and other devices for interpreting computer instructions and processing data in computer software, and may include one or more microprocessors and digital processors. The display screen 403 may be a touch screen or other device for displaying images.

[0110] The image processing system 417 included in the computer device 40 may include one or more modules, which may be stored in the memory 405 of the computer device 40 and may be configured to be executed by one or more processors (a processor 401 in this embodiment) to implement the present invention. Figure 2 As shown, the computer device 40 includes a memory 405, an input / output interface 407, a display screen 403, and a processor 401 that exchanges data with the memory 405, the input / output interface 407, and the display screen 403 through a bus 411. The input / output interface 407 can be connected to a mouse and / or a keyboard (not shown). The module referred to in the present invention is a program segment that performs a specific function and is more suitable for describing the execution process of software in a processor than a program.

[0111] In this embodiment, the display screen 403 is used to provide convenience for user operations. The memory 405 may store a number of program codes to be executed by the processor 401 to implement the functions of the image processing system 417 .

[0112] Please also read Figure 3 In this implementation, the image processing system 417 may include an acquisition unit 710 , an extraction unit 712 , a recognition unit 714 , a replacement unit 716 , and a filtering unit 718 .

[0113] The acquisition unit 710 is used to acquire the attribute information of each image file included in the source file of the application.

[0114] It is understandable that the application can be installed in a terminal (such as a smart phone, etc.) to achieve specific functions, including but not limited to social networking, text messaging, etc. It is understandable that several images may be required in an application to provide a better user interaction interface. Therefore, one or more image files may be included in the source file of the application.

[0115] Preferably, the attribute information of each image file (each image file) includes but is not limited to the name, type, size, location, size and other information of the image file. For example, the name information of the image file may be sample.png, sample@2x.png, sample@3x.png, etc.; the type information of the image file may include vector image or bitmap format, such as svg, jpeg, png, bmp, etc., wherein the type information of the image file can be obtained from the extension included in the name information of the image file, such as the extension corresponding to the image file named sample.png is png, therefore, it can be determined that the type of the image file sample.png is png; the size information of the image file is the image pixel size, such as 30px*30px (pixels), 48px*48px, 200px*200px, etc.; the location information of the image file may be the path of the image in the source file, and the location information may be a relative path or an absolute path; the size information of the image file is the size of the storage space occupied by the image, such as 32KB, 54KB, 1MB, etc.

[0116] Preferably, the attribute information corresponding to each image file can be obtained by traversing the source files included in the entire application. In addition, the attribute information of the image file obtained after traversing the entire application can be stored in the configuration file. In the configuration file, each image file can be set with a different file identifier, so in the configuration file, each file identifier can correspond to the name, type, size, location, size and other information of the image file.

[0117] The filtering unit 718 is used to perform a filtering operation according to the name information of each image file to obtain one or more image groups, wherein each image group includes the same image with different size information.

[0118] In order to adapt the application to different environments or terminal screens, an image file has multiple sizes, and the difference is mainly in the size. Therefore, they are usually distinguished by different names. For example, for a screen size of 1:1, the name of the image file can be: sample.png (1x image); for a screen size of 1:2, the name of the image file can be: sample@2x.png (2x image); for a screen size of 1:3, the name of the image file can be: sample@3x.png (3x image). Therefore, the image file name filtering operation can be performed according to the name information of the image file.

[0119] It can be understood that the acquisition unit 710 can obtain the name information of several image files from the configuration file, and the filtering unit 718 is used to match the names of several image files. If there are image files whose names differ only in specific preset characters (such as the above-mentioned @2x, @3x), then the images whose names differ in the specific characters can be regarded as an image group. Specifically, the acquisition unit 710 can first obtain the name information of each image file from the configuration file, and then the filtering unit 718 can remove the preset characters contained in the name information of the image file, and determine whether there are two or more image files with the same name information after removing the preset characters. If so, the two or more image files with the same name information after removing the preset characters can be regarded as an image group, such as the image files with corresponding file identifiers as an image group. For example, the image name information sample.png, sample@2x.png, sample@3x.png and abc@2x.jpg are respectively sample.png, sample.png, sample.png and abc.jpg after removing the preset characters. Among them, sample.png may correspond to the first file identifier, sample@2x.png may correspond to the second file identifier, sample@3x.png may correspond to the third file identifier, and abc@2x.jpg may correspond to the fourth file identifier. Since the name information of the images corresponding to the first to third file identifiers after removing the preset characters are all sample.png, they can be regarded as the same image, and the name information of the image corresponding to the fourth file identifier is abc.jpg. Therefore, the filtering unit 718 can regard the image files corresponding to the first to third file identifiers as the first image group.

[0120] For this image group, in order to reduce the size of the packaged image, only one of the images can be retained in the source file of the application to obtain the retained image, and the other image files can be used as replaced images, or the replaced images can be deleted from the source file of the application. For example, the above-mentioned images sample.png, sample@2x.png, and sample@3x.png can be used as an image group, and any one of the three images can be retained, while the other files used as replaced images can be deleted. Of course, in other implementations, one of the image files in the image group can also be retained according to implementation needs.

[0121] The extraction unit 712 is used to extract texture features from each image file, and take two or more image files whose texture feature similarity is greater than a preset value as an image group.

[0122] It is understandable that in the source file of the application, some image files may have the same or similar texture features, but their image file names are different. Therefore, after the image file name filtering operation is performed by the filtering unit 718, the same or similar images may still exist in the source file. The same image can be represented by the same texture features of the image files, and the same or different information such as the size; similar images can be represented by similar texture features of the image files, and the same or different information such as the size.

[0123] It is understandable that in other embodiments, the function performed by the filtering unit 718 is omitted, and the extraction unit 712 can directly extract texture features from all image files, and determine whether multiple image files can be used as an image group based on the texture features. Of course, since the filtering operation of the filtering unit 718 can perform a grouping operation based on the name information of the image file, the processing speed of image grouping can be accelerated under the premise of implementing the filtering operation.

[0124] It can be understood that the texture feature extraction method may include LBP (Local Binary Pattern), and the steps of LBP texture feature extraction are as follows:

[0125] The image can be divided into n*n (such as 16*16) small areas (cells). For a pixel in each cell, the 8 points in its annular neighborhood (or multiple points in the annular neighborhood) are compared clockwise or counterclockwise. If the central pixel value is larger than the neighboring point, the neighboring point is assigned 1, otherwise it is assigned 0. In this way, each point will obtain an 8-bit binary number (usually convertible to decimal). Then calculate the histogram of each cell, that is, the frequency of occurrence of each number (assuming it is a decimal number) (that is, a binary sequence of statistics on whether each pixel point is larger than the point in the neighborhood), and then normalize the histogram. Finally, the statistical histograms of each cell are connected to obtain the LBP texture features of the entire image, so as to determine whether it is the same or similar image based on the texture features of the image.

[0126] It can be understood that when the similarity of texture features of at least two images is greater than a preset value, these image files can be regarded as an image group.

[0127] For example, when the texture features of the first image group are all arrows with rounded corners, the extraction unit 712 can consider the texture features to be the same after extracting the texture features of the images, and therefore, the images in the first image group can be considered to be the same image. When the texture features of the second image group include arrows with rounded corners and arrows with sharp corners, since the second image group includes arrow texture features, the difference is only the rounded corners or the sharp corners, and in some interfaces, these images can be replaced with each other, and therefore, the extraction unit 712 can consider that the second group of images contains similar images.

[0128] The recognition unit 714 is used to perform a recognition operation on the image group according to the recognition rule to obtain a retained image and a replaced image corresponding to the image group.

[0129] Preferably, the recognition unit 714 may perform a recognition operation according to a recognition rule to obtain a retained image and one or more replaced images in the image group.

[0130] Preferably, the recognition rule may include performing a recognition operation according to a type of the image file or performing a recognition operation according to size information of the image file.

[0131] It can be understood that when performing the recognition operation according to the type of the image file, for the type of the image file, some image types are vector images, and the vector image can maintain the same clarity when it is scaled to different sizes. Therefore, for the image group, if there is an image file in the same or similar image group whose type information is a vector image, then the recognition unit 714 can retain the image whose type information is a vector image, and replace other non-vector images in the same or similar image group with the retained image, so that other non-vector images in the same or similar image group can be used as the replaced image.

[0132] It can be understood that the file of the replaced image can be deleted, and the reference to the replaced image in the source file of the application can be updated. Preferably, the location information of the replaced image file can be obtained from the configuration file, and the unit replacement 716 can replace the location information of the replaced image file with the location information corresponding to the image file retained in the image group, and can delete the replaced image in the image group, so that when the replaced image file is to be displayed, it can be displayed by the retained image file, wherein when the retained image file is displayed, the retained image file can be correspondingly enlarged or reduced according to the size information of the replaced image file, and for the enlargement or reduction of the vector image, for the user, there is no obvious difference in the display effect.

[0133] It can be understood that when the recognition unit 714 performs the recognition operation according to the size information of the image file, if all the images in the image group are non-vector images, the recognition operation can be performed according to the size information of the image file.

[0134] Preferably, the acquisition unit 710 may acquire size information of image files included in the image group. For example, an image group may include three image files, sample.png, sample@2x.png, and sample@3x.png, wherein the size information of the image files sample.png, sample@2x.png, and sample@3x.png may be 30px*30px, 48px*48px, and 200px*200px, respectively.

[0135] The identification unit 714 is used to determine whether there is an image file in the image group whose definition after being enlarged to other images in the image group is not less than a preset definition.

[0136] Preferably, assuming that in the image group, the retained image V1 can be replaced by other replaced images, in this case, the judgment can be made by comparing the size information between the retained image V1 and the other replaced images V2. In addition, when the retained image needs to be reduced to become the replaced image, since the image file reduction has little effect on its clarity, if the retained image needs to be directly reduced to become the replaced image, the replaced image can be directly deleted.

[0137] For example, the size information of the retained image V1 is a1, and the size information of the replaced image V2 is a2; the enlargement replacement ratio R is defined as (a2-a1) / a1, where a2 is not less than a1, indicating that the replacement image needs to be enlarged to become the replaced image. When the enlargement replacement ratio R is not within the preset range, it may indicate that the replacement image may cause its clarity to decrease or become inappropriate when it is scaled to the replaced image file style; when the enlargement replacement ratio R is within the preset range (such as 0 to 1), it may indicate that a certain clarity can be guaranteed when the replacement image is scaled to the replaced image file style.

[0138] It can be understood that the identification unit 714 can also determine whether there are image files with the same size information in the image group before determining whether there is an image file in the image group that is enlarged to other images and the image after the enlargement operation has a definition not less than a preset definition.

[0139] When there are image files with the same size information, it means that there are at least two image files with the same or similar images and the same size information in the image group. Therefore, the identification unit 714 can retain one image file of at least two image files as the retained image, and other image files with the same size information can be used as replaced images.

[0140] When the size information of each image file in the image group is different, the identification unit 714 can determine whether the corresponding enlargement replacement rate when the reference image in the image group is converted into the replaced image is within a preset range; when the enlargement replacement rate is within the preset range, the reference image file in the image group can be retained as a retained file, and other image files can be used as replaced images.

[0141] Preferably, the recognition unit 714 can obtain the image file with the smallest size information in the image group as a reference image through the configuration file, and use the image files with other size information in the image group as comparison images to determine whether the magnification replacement rate when the reference image is replaced by a comparison image in the image group is within a preset range. In other embodiments, when there are at least two smallest image files in the image group, the recognition unit 714 can randomly select one of the at least two smallest image files as the reference file.

[0142] When the enlargement replacement rate is within the preset range, the identification unit 714 replaces the reference image with the comparison image. Therefore, the reference image can be used as a retained image, and the comparison image can be used as a replaced image. Afterwards, the replacement unit 716 can delete the replaced image, so that image files with smaller size information in the image group can be retained, which is beneficial to reducing the size of the packaged file; afterward, the enlargement replacement rate when the reference image is replaced by other comparison images in the image group can be further determined.

[0143] When the enlargement replacement rate is not within the preset range, it means that the clarity of the comparison image may be affected to a certain extent after being enlarged by the reference image. However, since the reference image can be obtained by reducing the comparison image, the identification unit 714 can use the reference image as the replaced image and return to execute the image file with the smallest size information in the image group as the reference image, and use the image files with other size information in the image group as the comparison image, wherein the reference image and the comparison image are other image files in the image group except the replaced image.

[0144] Afterwards, it can be determined whether the number of the comparison images in the image group is 1; when the number is 1, it means that the remaining comparison images in the image group can be used as retained images.

[0145] In other embodiments, the identification unit 714 may also be omitted from determining whether there are image files with the same size information in the image group. For example, when the image group contains two image files with the same size information, the size information of the retained image V1 is a1, and the size information of the replaced image V2 is a2. According to the magnification replacement ratio R=(a2-a1) / a1, R=0. At this time, the identification unit 714 determines that the magnification replacement ratio R is within a preset range (such as 0 to 1), which indicates that a certain clarity can be protected when the replacement image is scaled to the style of the replaced image file. Therefore, the identification unit 714 can obtain the replaced image V2 and replace the position information of the replaced image with the position information of the retained image.

[0146] In other embodiments, the identification unit 714 may determine whether there is a reference image in the image group whose corresponding magnification replacement rates are not less than a preset definition when the reference image is magnified to all other comparison images. If so, the identification unit 714 may use the reference image as the retained image and other comparison images as the replaced images. If not, the identification unit 714 uses the image file with the largest size information in the image group as the retained image and other image files as the replaced images.

[0147] For example, for the first image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) may be 30px*30px, 44px*44px, and 48px*48px, respectively. When retaining the 1x image, since the 2x image and the 1x image can be achieved by scaling and have a certain clarity after scaling, the magnification replacement rate is (44-30) / 30=0.47, which can be considered to be within the preset range (in other embodiments, the magnification replacement rate can also be expressed as (44*44-30*30) / 30*30=1.15, and the preset range at this time needs to be adjusted accordingly); and since the 3x image and the 1x image can also be achieved by scaling and have a certain clarity after scaling (the magnification replacement rate is (48-30) / 30=0.6, which can be considered to be within the preset range, and other magnification replacement rate standards also need to be consistent); therefore, the 1x image can be retained, and the 2x image and the 3x image can be used as the replaced images, that is, the 2x image and the 3x image can be replaced by the 1x image.

[0148] For the second image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) can be 30px*30px, 44px*44px, and 77px*77px, respectively. When retaining the 1x image, the 2x image and the 1x image can be obtained by scaling, and have a certain clarity after scaling; and the 3x image has a lower clarity after scaling by the 1x image (its magnification replacement rate is (77-30) / 30=1.57, which can be considered not within the preset range), and when the 2x image is enlarged to the 3x image, it can be achieved by scaling (its magnification replacement rate is (77-44) / 44=0.75, which can be considered within the preset range), and has a certain clarity after scaling; therefore, the 2x image can be retained as the retained image, and the 1x image and the 3x image can be used as the replaced images, and the 1x image can be obtained by shrinking the 2x image, and its clarity is not greatly affected.

[0149] For the third image group, the sizes of sample.png (1x image), sample@2x.png (2x image), and sample@3x.png (3x image) can be 30px*30px, 44px*44px, and 200px*200px, respectively. When retaining the 2x image, since the 1x image can be obtained by scaling the 2x image, and has a certain clarity after scaling, the 2x image can be retained as the retained image, and the 1x image can be used as the replaced image; however, when the 2x image is scaled to the 3x image, the clarity of the scaled 3x image is obviously affected (its magnification replacement ratio is (200-44) / 44=3.54, which can be considered to be not within the preset range), so the 3x image in the image group will also be retained, and the 2x image will be used as the replaced image, that is, the image group at this time contains the 3x image. At this time, the 3x image in the image group can be retained, and the 1x image and the 2x image can be used as the replaced images, and can be replaced by the retained image.

[0150] The replacing unit 716 is used to update the position information of the replaced image file in the image group to the position information corresponding to the replacement image.

[0151] For example, in the first image group described above, since the 1x image is retained, the replacement unit 716 may update the location information of the 2x image and the 3x image referenced in the source file of the application to the path where the 1x image is located.

[0152] In the above-mentioned second image group, since the 2x image is retained, the replacement unit 716 may update the location information of the 1x image and the 3x image referenced in the source file of the application to the path where the 1x image is located.

[0153] In the third image group, since the 3x image is retained but the 1x image and the 2x image are replaced images, the replacement unit 716 may update the location of the 1x image and the 2x image referenced in the source file of the application to the path of the 3x image.

[0154] The above-mentioned image processing system can perform deduplication operations by identifying the same or similar images in the source files of the application, and can update the reference of the source file accordingly to the deduplication result, so that the user can easily identify similar images without doing any additional work, reduce the size of the application file, reduce the user's traffic consumption, and also improve the download success rate.

[0155] It should be noted that, corresponding to each embodiment of the above system control method, the image processing system 417 may include Figure 3The functions of each module will be described in detail below. The same nouns and related nouns and their specific explanations in each embodiment of the above image processing method can also be applied to the following introduction to the functions of each module. In order to save space and avoid repetition, they will not be repeated here.

[0156] If the module integrated in the computer device 40 of the present invention is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the volume control method of each embodiment described above, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps in the volume control method of each embodiment described above can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium can include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.

[0157] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units, modules or devices stated in the claims of the system, device or mobile terminal device may also be implemented by the same unit, module or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0158] The above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention is described in detail with reference to the above preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. An image processing method, characterized in that: The method comprises: Acquire attribute information of each image file included in the source file in the application, wherein the attribute information includes location information corresponding to each image file; Extracting texture features from each of the image files, and taking two or more of the image files whose texture features have a similarity greater than a preset value as an image group; The image files of the image group are identified according to the identification rules to obtain the retained image and the replaced image corresponding to the image group, including: judging whether there is a reference image that meets the preset condition in the image group, wherein the preset condition is that the clarity of the reference image after being enlarged to other images in the image group is not less than the preset clarity; if so, the reference image that meets the preset condition is used as the retained image, and the other images in the image group are used as the replaced images; the judging whether there is a reference image that meets the preset condition in the image group includes: judging whether the corresponding enlargement replacement rate when the reference image is converted into other images in the image group is within a preset range, including: The image file with the smallest size information is used as a reference image, and the image files with other size information in the image group are used as comparison images; determining whether the enlargement replacement rate when the reference image is converted into a comparison image in the image group is within the preset range; when the enlargement replacement rate is not within the preset range, the reference image is used as the replaced image, and the process of using the image file with the smallest size information in the image group as a reference image and the image files with other size information in the image group as comparison images is returned to be executed, wherein the reference image and the comparison image are other image files in the image group except the replaced image; wherein the enlargement replacement rate is calculated based on the size information of the reference image and the size information of the other images converted into the image group; The position information corresponding to the replaced image file in the image group is updated to the position information corresponding to the retained image.

2. The image processing method according to claim 1, characterized in that: The extraction of texture features from each image file includes: Remove the preset characters contained in the name information of the image file; Determine whether there are two or more image files with the same name information after removing the preset characters; If there are two or more image files with the same name information after removing the preset characters, the two or more image files with the same name information after removing the preset characters are used as the image group; The extracting of texture features from each of the image files comprises: Texture feature extraction is performed on the image files that are not grouped in the image files.

3. The image processing method according to claim 1, characterized in that: The performing an identification operation on the image files of the image group according to the identification rule to obtain the retained image and the replaced image corresponding to the image group includes: Determining whether the image group contains a vector type image file; When the image group includes a vector image file, the vector image file is used as the reserved image, and other image files in the image group except the reserved image are used as the replaced images.

4. The image processing method according to claim 1, wherein: The method further comprises: When the enlargement replacement ratio is within the preset range, the comparison image is used as the replaced image, and the process returns to executing the step of determining whether the enlargement replacement ratio when the reference image is replaced by a comparison image in the image group is within the preset range.

5. The image processing method according to any one of claims 1 to 4, characterized in that: The method further comprises: The replaced image file in the image group is deleted.

6. An image processing system for implementing the image processing method according to claim 1, characterized in that: The system comprises: An acquisition unit, used to acquire attribute information of each image file included in a source file in an application, wherein the attribute information includes location information corresponding to each image file; An extraction unit, used for extracting texture features from each of the image files, and taking two or more of the image files whose texture features have a similarity greater than a preset value as an image group; an identification unit, configured to perform an identification operation on the image files of the image group according to an identification rule, so as to obtain a retained image and a replaced image corresponding to the image group; The replacement unit is used to update the position information corresponding to the replaced image file in the image group to the position information corresponding to the retained image.

7. A computer device comprising a processor and a memory, wherein the memory stores a plurality of computer programs, wherein: The processor is used to implement the steps of the image processing method according to any one of claims 1 to 5 when executing the computer program stored in the memory.

8. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 5 are implemented.