CN109685861A - Picture compression method, apparatus, equipment and computer readable storage medium - Google Patents

Picture compression method, apparatus, equipment and computer readable storage medium Download PDF

Info

Publication number
CN109685861A
CN109685861A CN201811016766.3A CN201811016766A CN109685861A CN 109685861 A CN109685861 A CN 109685861A CN 201811016766 A CN201811016766 A CN 201811016766A CN 109685861 A CN109685861 A CN 109685861A
Authority
CN
China
Prior art keywords
compressed
picture
cutting
subgraphs
compression method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811016766.3A
Other languages
Chinese (zh)
Other versions
CN109685861B (en
Inventor
许剑勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201811016766.3A priority Critical patent/CN109685861B/en
Priority to PCT/CN2018/122718 priority patent/WO2020042467A1/en
Publication of CN109685861A publication Critical patent/CN109685861A/en
Application granted granted Critical
Publication of CN109685861B publication Critical patent/CN109685861B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention discloses a kind of picture compression methods, comprising: treats compressed picture according to default segmentation rule and carries out cutting, obtains several subgraphs to be compressed;The corresponding optimal compression method of several described subgraphs to be compressed is determined based on default reduced rule;Based on the optimal compression method, several described subgraphs to be compressed are compressed.The invention also discloses a kind of picture compression device, equipment and computer readable storage mediums.The present invention improves the compression ratio of picture.

Description

Picture compression method, apparatus, equipment and computer readable storage medium
Technical field
The present invention relates to image processing technology more particularly to a kind of picture compression method, apparatus, equipment and computer Readable storage medium storing program for executing.
Background technique
It is well known that the size of APP itself is the emphasis that mobile Development persons optimize, and picture just occupies very in APP Big a part of resource, it is relatively simple for compress mode that the big figure in APP uses at present, usually using jpeg, png, The single compresseds mode such as webp or svg, compression ratio are promoted limited.
Summary of the invention
The main purpose of the present invention is to provide a kind of picture compression method, apparatus and computer readable storage medium, purports In the low technical problem of the single caused picture compression rate of the picture compression mode in the prior art that solves.
To achieve the above object, the present invention provides a kind of picture compression method, and the picture compression method includes:
Compressed picture is treated according to default segmentation rule and carries out cutting, obtains several subgraphs to be compressed;
The corresponding optimal compression method of several described subgraphs to be compressed is determined based on default reduced rule;
Based on the optimal compression method, several described subgraphs to be compressed are compressed.
Optionally, described that compressed picture progress cutting is treated according to default segmentation rule, obtain several subgraphs to be compressed The step of include:
The distribution of color of picture to be compressed is obtained, and receives the cutting instruction based on the distribution of color;
The segmentation lines in the picture to be compressed are determined based on cutting instruction, and according to preset algorithm to the cutting Line is adjusted, to be several subgraphs to be compressed by the picture cutting to be compressed.
Optionally, the segmentation lines include cutting horizontal line and cutting vertical line, and described instructed based on the cutting determines institute The segmentation lines in picture to be compressed are stated, and the segmentation lines are adjusted according to preset algorithm, so as to by the figure to be compressed Piece cutting be several subgraphs to be compressed the step of include:
The segmentation lines in the picture to be compressed are determined based on cutting instruction, and according to preset algorithm to the cutting Horizontal line carries out adjustment up and down and/or carries out left and right adjustment to the cutting vertical line, so as to based on the cutting horizontal line and/or described The picture cutting to be compressed is several subgraphs to be compressed by cutting vertical line, wherein the calculation formula of the preset algorithm are as follows:
Δ R=C1, R-C2, R
Δ G=C1, G-C2, G
Δ B=C1, B-C2, B
Wherein, the C1And C2Indicate pixel color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GTable Show the channel G of color 1 and 2, C1B、C2BIndicate the channel B of color 1 and 2.
Optionally, described that compressed picture progress cutting is treated according to default segmentation rule, obtain several subgraphs to be compressed The step of after, further includes:
Record the location information of several subgraphs to be compressed in the picture to be compressed.
Optionally, described that the corresponding optimal compression of several described subgraphs to be compressed is determined based on default reduced rule The step of method includes:
Obtain the characteristic parameter of default reduced rule and several subgraphs to be compressed;
The corresponding reduced rule of several described subgraphs to be compressed is determined based on the characteristic parameter, and according to the compression Rule determines the optimal compression method of several subgraphs to be compressed respectively.
Optionally, the optimal compression method includes compression quality and compressed format, described to be based on the optimal compression side Method, the step of compressing to several described subgraphs to be compressed include:
The corresponding compression algorithm of several described subgraphs to be compressed, and base are determined based on the compression quality and compressed format The subgraph to be compressed is compressed in the compression algorithm.
Optionally, described to be based on the optimal compression method, the step of compression to several described subgraphs to be compressed Later, further includes:
The compressed subgraph to be compressed is saved, and when detecting the displaying instruction based on the picture to be compressed, The compressed subgraph to be compressed is decompressed;
Based on the location information of the record, the subgraph to be compressed after the decompression is combined to obtain described to be compressed Picture, and the picture to be compressed after the combination is shown.
In addition, to achieve the above object, the present invention also provides a kind of picture compression device, the picture compression device packet It includes:
Picture cutting module carries out cutting for treating compressed picture according to default segmentation rule, obtains several and wait pressing Contracting subgraph;
Compression method determining module, for determining that several described subgraphs to be compressed respectively correspond based on default reduced rule Optimal compression method;
Picture compression module compresses several described subgraphs to be compressed for being based on the optimal compression method.
In addition, to achieve the above object, the present invention also provides a kind of picture compression equipment, the picture compression equipment packet It includes: memory, processor and being stored in the picture compression program that can be run on the memory and on the processor, it is described Computer program realizes the step of picture compression method as described above when being executed by the processor.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium Picture compression program is stored on storage medium, the picture compression program realizes picture as described above when being executed by processor The step of compression method.
A kind of picture compression method proposed by the present invention, is primarily based on default segmentation rule and cuts to picture to be compressed Point, it is several different subgraphs to be compressed by its cutting, determines several subgraphs to be compressed respectively further according to default reduced rule Corresponding optimal compression method, and it is compressed based on the optimal compression method.Picture compression method proposed by the present invention, Pass through cutting big figure to be compressed and optimal compression method is taken to each subgraph to be compressed, so that compressed picture size is total With less than the big figure individually compressed using a certain mode, the compression ratio of picture is greatly improved, it is big to reduce APP It is small.
Detailed description of the invention
Fig. 1 is the hardware structural diagram of picture compression equipment involved in the embodiment of the present invention;
Fig. 2 is the flow diagram of picture compression method first embodiment of the present invention;
Fig. 3 is the refinement flow diagram of the step S10 in Fig. 2;
Fig. 4 is the flow diagram of picture compression method second embodiment of the present invention;
Fig. 5 is the flow diagram of picture compression method 3rd embodiment of the present invention;
Fig. 6 is the functional block diagram of picture compression device first embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: treating compressed picture according to default segmentation rule and carry out cutting, obtain To several subgraphs to be compressed;The corresponding optimal compression of several described subgraphs to be compressed is determined based on default reduced rule Method;Based on the optimal compression method, several described subgraphs to be compressed are compressed.Skill through the embodiment of the present invention Art scheme solves the low technical problem of the single caused picture compression rate of picture compression mode in the prior art.
As shown in FIG. 1, FIG. 1 is the hardware structural diagrams of the picture compression equipment involved in the embodiment of the present invention.
The present embodiments relate to picture compression method be mainly used in picture compression equipment, which can To be the equipment with display and processing function such as PC, portable computer, mobile terminal.
As shown in Figure 1, the picture compression equipment may include: processor 1001, such as CPU, communication bus 1002, user Interface 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is for realizing the connection between these components Communication.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user Interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include having for standard Line interface, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable storage Device (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processing The storage device of device 1001.
Optionally, picture compression equipment can also include camera, RF (Radio Frequency, radio frequency) circuit, sensing Device, voicefrequency circuit, Wi-Fi module etc..Wherein, sensor such as optical sensor, motion sensor and other sensors.When So, picture compression equipment can also configure the other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, Details are not described herein.
It will be understood by those skilled in the art that picture compression device structure shown in Fig. 1 is not constituted to picture compression The restriction of equipment may include perhaps combining certain components or different component cloth than illustrating more or fewer components It sets.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe module, Subscriber Interface Module SIM and picture compression program.In Fig. 1, network interface 1004 is mainly used for connecting background service Device carries out data communication with background server;User interface 1003 be mainly used for connect client (user terminal), with client into Row data communication;And processor 1001, memory 1005 can be set in picture compression device, the picture compression device is logical It crosses processor 1001 and calls the picture compression program stored in memory 1005, and execute picture pressure provided in an embodiment of the present invention Contracting method.
Scheme provided in this embodiment is primarily based on default segmentation rule and carries out cutting to picture to be compressed, cut It is divided into several different subgraphs to be compressed, determines the optimal compression of several subgraphs to be compressed respectively further according to default reduced rule Method, and it is compressed based on the optimal compression method.Picture compression method proposed by the present invention, it is to be compressed by cutting It is big to scheme and optimal compression method is taken to each subgraph to be compressed, it is individually used so that compressed picture size summation is less than The big figure that a certain mode is compressed, greatly improves the compression ratio of picture, reduces APP size.
Based on above-mentioned hardware configuration, picture compression embodiment of the method for the present invention is proposed.
It is the flow diagram of picture compression method first embodiment of the present invention, in this embodiment, institute referring to Fig. 2, Fig. 2 The method of stating includes:
Step S10 treats compressed picture according to default segmentation rule and carries out cutting, obtains several subgraphs to be compressed;
Step S20 determines the corresponding optimal compression side of several described subgraphs to be compressed based on default reduced rule Method;
Step S30 is based on the optimal compression method, compresses to several described subgraphs to be compressed.
In order to solve the problems, such as that picture compression rate caused by picture compression mode is single is low, picture compression rate is improved to reduce The size of APP, the invention proposes a kind of picture compression methods, are primarily based on default segmentation rule and carry out to picture to be compressed Its cutting is several different subgraphs to be compressed, determines several sons to be compressed respectively further according to default reduced rule by cutting The optimal compression method of figure, and it is compressed based on the optimal compression method, to realize higher picture compression rate.
In the present embodiment, compressed picture is treated according to default segmentation rule first and carries out cutting, specifically, preset cutting Rule can be based on the color change in picture to be compressed, as shown in figure 3, the step S10 includes:
Step S11 obtains the distribution of color of picture to be compressed, and receives the cutting instruction based on the distribution of color;
Step S12 determines the segmentation lines in the picture to be compressed based on cutting instruction, and according to preset algorithm pair The segmentation lines are adjusted, to be several subgraphs to be compressed by the picture cutting to be compressed.
Specifically, in the present embodiment, it by obtaining the distribution of color in picture to be compressed, and is primarily based on it manually Be greatly classified into several different blocks, the foundation of division be according to the color change in picture to be compressed, i.e., color lump change into Row divides, and is different blocks by the bigger cutting of color lump gap in picture to be compressed.For example, there is one in picture to be compressed Portrait, other parts are scene images, and portrait part and the color lump of other scene image parts change greatly, then by by portrait It is divided with other scene images, two or more subgraphs to be compressed can be obtained.
It is understood that manually treating compressed picture first in addition to above-mentioned described passing through carries out a rough division Except, the distribution of color in picture to be compressed can also be obtained, and based on distribution of color to different face by corresponding program Block where color is divided, and carries out Preliminary division to treat compressed picture.
Further, based on the distribution of color in picture to be compressed, after treating compressed picture progress Preliminary division, the area Zai Dui The division of block is further to be adjusted, specifically realized by calculating color distance.
Specifically, the step S12 includes:
Step a determines the segmentation lines in the picture to be compressed based on cutting instruction, and according to preset algorithm to institute State cutting horizontal line carry out up and down adjustment and/or left and right adjustment is carried out to the cutting vertical line, so as to based on the cutting horizontal line and/ Or the picture cutting to be compressed is several subgraphs to be compressed by the cutting vertical line, wherein the calculating of the preset algorithm Formula are as follows:
Δ R=C1, R-C2, R
Δ G=C1, G-C2, G
Δ B=C1, B-C2, B
Wherein, the C1And C2Indicate pixel color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GTable Show the channel G of color 1 and 2, C1B、C2BIndicate the channel B of color 1 and 2.
Specifically, treating compressed picture and carrying out the segmentation lines of cutting includes cutting horizontal line and cutting vertical line, by treating Compressed picture carries out rough block division, is divided into several blocks comprising different color blocks, passes through setting segmentation lines Initial value can greatly improve the subsequent efficiency being adjusted to segmentation lines.It is understood that treating compressed picture progress The mode of cutting is the cutting in a manner of horizontal line or vertical line, and therefore, each block obtained after cutting is the square blocks of rule. Further, then based on horizontal line or vertical line of the preset algorithm to cutting it is adjusted, so that the division to block is more accurate. The concrete mode that horizontal line or vertical line to cutting are adjusted is as follows:
Color distance refers to the gap between two colors, and usual color distance is bigger, shows that two color differences are got over Greatly;Conversely, two colors are more close.It is calculated by upper and lower or left and right the color distance of horizontal line or vertical line to cutting, Segmentation lines can be adjusted, keep block cutting more accurate.Specifically, when calculating color distance, by using similar The formula for calculating point-to-point transmission Euclidean distance is the same, calculates color distance.In rgb space, the calculating of color distance is public Formula are as follows:
Wherein, C1And C2Indicate color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GIndicate color 1 With 2 the channel G, C1B、C2BIndicate the channel B of color 1 and 2.
But due to rgb space be it is linear and mutually orthogonal, but the vision system of human eye be not it is linear, Therefore rgb space can not reflect perception of the human eye to color, so, corresponding color distance can not reflect two well Whether a color is close.Based on the above issues, improved weighted euclidean distance has been used, specific calculation is as follows:
Δ R=C1, R-C2, R
Δ G=C1, G-C2, G
Δ B=C1, B-C2, B
Similarly, C1And C2Indicate pixel color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GIt indicates The channel G of color 1 and 2, C1B、C2BIndicate the channel B of color 1 and 2.Pass through above-mentioned improved weighted euclidean distance calculating side Method can calculate the gap between two colors.In the present embodiment, the color distance based on segmentation lines two sides, can be right Segmentation lines are adjusted and determine.
In order to make it easy to understand, concrete example is described as follows: centered on the original segmentation lines determined based on distribution of color, If segmentation lines are perpendicular tangent lines, by each mobile n pixel of perpendicular segmentation lines or so, moving step length herein is 1 pixel, then may be used It obtains 2*n root and erects tangent line.The center vertical line of original perpendicular segmentation lines left and right side subgraph is obtained simultaneously, and calculates separately this 2*n Root erects tangent line at a distance from this two roots figure center vertical line, and the color distance of single pixel is by using improved weighting Europe Family name's range formula calculates, and the color distance of two root figure center vertical lines is then the color distance summation of each respective pixel, away from The segmentation lines the smallest from left or right subgraph center vertical line color distance can be identified as finally treating compressed picture progress cutting Cut-off rule.Similarly, similar processing is also done to traverse, so that it may obtain final cut-off rule, and then after obtaining segmentation Subgraph to be compressed.
Further, compressed picture is treated according to the color lump variation in picture to be compressed and carries out cutting, to obtain several After subgraph to be compressed, then obtain default reduced rule, based on default reduced rule be each subgraph to be compressed determine one most Excellent compression method, and each subgraph to be compressed is compressed based on the optimal compression method, to realize subgraph pressure to be compressed The promotion of shrinkage.
In the present embodiment, it is primarily based on default segmentation rule and cutting is carried out to picture to be compressed, be several by its cutting A different subgraph to be compressed, the optimal compression method of several subgraphs to be compressed is determined further according to default reduced rule respectively, And it is compressed based on the optimal compression method.Picture compression method proposed by the present invention passes through cutting big figure to be compressed And optimal compression method is taken to each subgraph to be compressed, so that compressed picture size summation is less than individually using a certain The big figure that kind mode is compressed, greatly improves the compression ratio of picture, reduces APP size.
Further, referring to Fig. 4, based on the above embodiment, picture compression method second embodiment of the present invention is proposed, at this In embodiment, the step S20 includes:
Step S21 obtains the characteristic parameter of default reduced rule and several subgraphs to be compressed;
Step S22 determines several described subgraphs pair to be compressed based on the characteristic parameter and the default reduced rule The reduced rule answered, and according to the optimal compression method of several subgraphs to be compressed described in the reduced rule respectively determination.
Compressed picture is treated according to the color lump variation in picture to be compressed and carries out cutting, to obtain several subgraphs to be compressed Afterwards, then based on default reduced rule, most suitable compression method is taken to compress each subgraph to be compressed, specific method It is as follows: to obtain the characteristic parameter of subgraph to be compressed first, wherein whether characteristic parameter may include: picture size, comprising transparent And color of image number etc., picture size refer to the total pixel number that the subgraph to be compressed after cutting is included, with width direction picture The product representation of element and short transverse pixel;Whether whether it is less than centainly comprising the transparent color of image number for referring to subgraph to be compressed Numerical value, if so, it includes transparent for being considered as subgraph to be compressed;Color of image number refers to the number of color included in image, with It is related that digit used in color is described.
It is understood that can also include other other than the characteristic parameter of above-mentioned cited subgraph to be compressed Characteristic parameter, herein and be not listed one by one.
According to the features described above parameter of subgraph to be compressed, it can determine that several wait pressing based on corresponding default reduced rule The corresponding reduced rule of contracting subgraph, the optimal compression side of each subgraph to be compressed is assured that based on the reduced rule Method, including compression quality and compressed format.Specifically, different compressions can be set for the type of different subgraphs to be compressed Rule, for example, if the picture size of subgraph to be compressed less than the first preset threshold, and in subgraph to be compressed contain transparent and picture When number of colours is less than the first pre-set color number, that is, it can determine that the corresponding reduced rule of the subgraph to be compressed is the first reduced rule, And so on, the reduced rule under different picture sizes, transparency parameter and color parameter can be set.As shown in the table, it is A default reduced rule in the present embodiment:
Picture size Whether comprising transparent Picture color number Compression quality Compressed format
< 2k It can contain transparent <=4 100% SVG
> 20k Without transparent >=256 70% JPEG
> 20K It can contain transparent >=512 70% WEBP
It is understood that above-mentioned default reduced rule and imperfect, can be increased and be adjusted according to actual needs.Base In above-mentioned default reduced rule, according to the corresponding characteristic parameter of subgraph to be compressed of acquisition, that is, the subgraph institute to be compressed can determine Corresponding optimal compression method, to be compressed to it.
Further, described to be based on the optimal compression method, the step compressed to several described subgraphs to be compressed Suddenly include:
Step b determines the corresponding compression calculation of several described subgraphs to be compressed based on the compression quality and compressed format Method, and the subgraph to be compressed is compressed based on the compression algorithm.
Further, based on default reduced rule accordingly, it can determine that several subgraphs to be compressed are corresponding most Excellent compression method, including compression quality and compressed format etc. can determine correspondence according to determining compression quality and compressed format Subgraph to be compressed compression processing algorithm.Specifically, compression quality, compressed format and compression processing algorithm can be preset Between corresponding relationship, wherein compression processing algorithm can be preset logic rules, can also call existing using above-mentioned The tool of compression processing algorithm to carry out compression processing to picture.It is understood that can also be determined using decision Tree algorithms The optimal compression method of fixed subgraph to be compressed.After the optimal compression method for determining subgraph to be compressed, to each subgraph to be compressed into Row compression processing improves the compression ratio of picture.
In the present embodiment, compressed picture is treated to carry out obtaining subgraph to be compressed after cutting obtains several subgraphs to be compressed Characteristic parameter its corresponding optimal compression side is determined based on default reduced rule and according to the characteristic parameter of subgraph to be compressed Method, wherein optimal compression method includes compression quality and compressed format, be based further on compression quality and compressed format determine to The compression algorithm for compressing subgraph, finally compresses corresponding subgraph to be compressed according to the compression algorithm.By for each Subgraph to be compressed takes optimal compression method, reduces shared memory after picture compression, improves picture compression rate.
Further, referring to Fig. 5, based on the above embodiment, picture compression method 3rd embodiment of the present invention is proposed, at this In embodiment, after the step S30 further include:
Step S40 saves the compressed subgraph to be compressed, and is detecting the displaying based on the picture to be compressed When instruction, the compressed subgraph to be compressed is decompressed;
Step S50 is combined to obtain institute based on the location information of the record to the subgraph to be compressed after the decompression Picture to be compressed is stated, and the picture to be compressed after the combination is shown.
In the present embodiment, it after taking optimal compression method to compress respectively to each subgraph to be compressed, will press Subgraph after contracting is saved, when needing to show big figure, by carrying out decompression and group to each compressed subgraph to be compressed It closes, combined mode is to be combined according to the arrangement position before subgraph cutting to be compressed to compressed subgraph, to be spliced into The complete picture of one width, can be completed the decompression for treating compressed picture and displaying.
Specifically, after the step S10, further includes:
Step c records the location information of several subgraphs to be compressed in the picture to be compressed.
Specifically, after treating compressed picture progress cutting to obtain several subgraphs to be compressed, for the ease of subsequent to pressure Subgraph after contracting is combined, several subgraphs to be compressed that should be obtained to cutting are marked, specifically referring to be compressed Position mark of the subgraph in original picture to be compressed.For example, the position of the subgraph to be compressed after preservation cutting can be passed through Parameter information, to determine the position of the subgraph to be compressed in picture to be compressed.
Further, subgraph to be compressed can generate a series of sons to be compressed after the completion of based on the compression of optimal compression method Scheme compressed picture format file and data description file, data description file is mainly the file of each subgraph to be compressed Name, left top coordinate and width are high, wherein left top coordinate and wide height describe subgraph to be compressed in original big figure to be compressed Location information.When detecting the displaying information based on the big figure to be compressed, each compressed subgraph can be decompressed, Subgraph to be compressed is retrieved, further according to the left top coordinate and width height in data description file, to each son to be compressed after decompression Figure is combined, and can splice to obtain original big figure to be compressed again, and big figure to be compressed is shown.
In the present embodiment, cutting is carried out to picture to be compressed based on default segmentation rule, by its cutting be it is several not Same subgraph to be compressed, and location information of several subgraphs to be compressed in original big figure to be compressed is recorded, it is needed to work as When showing big figure to be compressed, the subgraph to be compressed after decompression is spliced again according to the location information of record, obtain to Compressed picture, and the picture to be compressed after combination is shown, reduce the size of APP, improves the usage experience of user.
In addition, the embodiment of the present invention also provides a kind of picture compression device.
It is the functional block diagram of picture compression device first embodiment of the present invention referring to Fig. 6, Fig. 6.
In the present embodiment, the picture compression device includes:
Picture cutting module carries out cutting for treating compressed picture according to default segmentation rule, obtains several and wait pressing Contracting subgraph;
Compression method determining module, for determining that several described subgraphs to be compressed respectively correspond based on default reduced rule Optimal compression method;
Picture compression module compresses several described subgraphs to be compressed for being based on the optimal compression method.
Further, the picture cutting module 10 specifically includes:
Picture cutting unit for obtaining the distribution of color of picture to be compressed, and receives cutting based on the distribution of color Split instruction;
Cutting adjustment unit, for determining the segmentation lines in the picture to be compressed based on cutting instruction, and according to Preset algorithm is adjusted the segmentation lines, to be several subgraphs to be compressed by the picture cutting to be compressed.
Further, the cutting adjustment unit specifically includes:
Segmentation lines adjust subelement, for determining the segmentation lines in the picture to be compressed based on cutting instruction, and Adjustment up and down is carried out to the cutting horizontal line according to preset algorithm and/or left and right adjustment is carried out to the cutting vertical line, so as to base It by the picture cutting to be compressed is several subgraphs to be compressed in the cutting horizontal line and/or the cutting vertical line, wherein institute State the calculation formula of preset algorithm are as follows:
Δ R=C1, R-C2, R
Δ G=C1, G-C2, G
Δ B=C1, B-C2, B
Wherein, the C1And C2Indicate pixel color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GTable Show the channel G of color 1 and 2, C1B、C2BIndicate the channel B of color 1 and 2.
Further, the picture compression device further include:
Position recording unit, for recording position letter of several the described subgraphs to be compressed in the picture to be compressed Breath.
Further, the compression method determining module 20 specifically includes:
Parameter acquiring unit, for obtaining the characteristic parameter of default reduced rule and several subgraphs to be compressed;
Compression method determination unit, for described in being determined based on the characteristic parameter and the default reduced rule several The corresponding reduced rule of subgraph to be compressed, and determine the optimal of several subgraphs to be compressed respectively according to the reduced rule Compression method.
Further, the picture compression module 30 specifically includes:
Compression algorithm determination unit, for determining several described sons to be compressed based on the compression quality and compressed format Scheme corresponding compression algorithm, and the subgraph to be compressed is compressed based on the compression algorithm.
Further, the picture compression device further include:
Subgraph decompression units for saving the compressed subgraph to be compressed, and are being detected based on described to be compressed When the displaying instruction of picture, the compressed subgraph to be compressed is decompressed;
Subgraph assembled unit carries out the subgraph to be compressed after the decompression for the location information based on the record Combination obtains the picture to be compressed, and is shown to the picture to be compressed after the combination.
Wherein, modules are opposite with each step in above-mentioned picture compression embodiment of the method in above-mentioned picture compression device It answers, function and realization process no longer repeat one by one here.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium On be stored with picture compression program, the picture compression program realizes picture compression method as described above when being executed by processor The step of.
Wherein, picture compression program, which is performed realized method, can refer to each reality of picture compression method of the present invention Example is applied, details are not described herein again.
Scheme provided in this embodiment is primarily based on default segmentation rule and carries out cutting to picture to be compressed, cut It is divided into several different subgraphs to be compressed, determines the optimal compression of several subgraphs to be compressed respectively further according to default reduced rule Method, and it is compressed based on the optimal compression method.Picture compression method proposed by the present invention, it is to be compressed by cutting It is big to scheme and optimal compression method is taken to each subgraph to be compressed, it is individually used so that compressed picture size summation is less than The big figure that a certain mode is compressed, greatly improves the compression ratio of picture, reduces APP size.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of picture compression method, which is characterized in that the picture compression method the following steps are included:
Compressed picture is treated according to default segmentation rule and carries out cutting, obtains several subgraphs to be compressed;
The corresponding optimal compression method of several described subgraphs to be compressed is determined based on default reduced rule;
Based on the optimal compression method, several described subgraphs to be compressed are compressed.
2. picture compression method as described in claim 1, which is characterized in that it is described according to default segmentation rule to figure to be compressed Piece carries out cutting, and the step of obtaining several subgraphs to be compressed includes:
The distribution of color of picture to be compressed is obtained, and receives the cutting instruction based on the distribution of color;
Determine the segmentation lines in the picture to be compressed based on cutting instruction, and according to preset algorithm to the segmentation lines into Row adjustment, to be several subgraphs to be compressed by the picture cutting to be compressed.
3. picture compression method as claimed in claim 2, which is characterized in that the segmentation lines include cutting horizontal line and cutting Vertical line, it is described that segmentation lines in the picture to be compressed are determined based on cutting instruction, and cut according to preset algorithm to described Separated time is adjusted, to include: the step of being several subgraphs to be compressed by the picture cutting to be compressed
The segmentation lines in the picture to be compressed are determined based on cutting instruction, and according to preset algorithm to the cutting horizontal line It carries out adjustment up and down and/or left and right adjustment is carried out to the cutting vertical line, to be based on the cutting horizontal line and/or the cutting The picture cutting to be compressed is several subgraphs to be compressed by vertical line, wherein the calculation formula of the preset algorithm are as follows:
Δ R=C1, R-C2, R
Δ G=C1, G-C2, G
Δ B=C1, B-C2, B
Wherein, the C1And C2Indicate pixel color 1 and color 2, C1R、C2RIndicate the channel R of color 1 and 2, C1G、C2GIndicate face The channel G of color 1 and 2, C1B、C2BIndicate the channel B of color 1 and 2.
4. picture compression method as claimed in claim 3, which is characterized in that it is described according to default segmentation rule to figure to be compressed After the step of piece carries out cutting, obtains several subgraphs to be compressed, further includes:
Record the location information of several subgraphs to be compressed in the picture to be compressed.
5. picture compression method as claimed in claim 4, which is characterized in that if described determining described based on default reduced rule The step of dry subgraph to be compressed corresponding optimal compression method includes:
Obtain the characteristic parameter of default reduced rule and several subgraphs to be compressed;
The corresponding reduced rule of several described subgraphs to be compressed is determined based on the characteristic parameter and the default reduced rule, And determine the optimal compression method of several subgraphs to be compressed respectively according to the reduced rule.
6. picture compression method as claimed in claim 5, which is characterized in that the optimal compression method include compression quality and Compressed format, described to be based on the optimal compression method, the step of compressing to several described subgraphs to be compressed, includes:
The corresponding compression algorithm of several described subgraphs to be compressed is determined based on the compression quality and compressed format, and is based on institute Compression algorithm is stated to compress the subgraph to be compressed.
7. picture compression method as claimed in claim 6, which is characterized in that it is described to be based on the optimal compression method, to institute After stating the step of several subgraphs to be compressed are compressed, further includes:
The compressed subgraph to be compressed is saved, and when detecting the displaying instruction based on the picture to be compressed, to institute Compressed subgraph to be compressed is stated to be decompressed;
Based on the location information of the record, the subgraph to be compressed after the decompression is combined to obtain the figure to be compressed Piece, and the picture to be compressed after the combination is shown.
8. a kind of picture compression device, which is characterized in that the picture compression device includes:
Picture cutting module carries out cutting for treating compressed picture according to default segmentation rule, obtains several sons to be compressed Figure;
Compression method determining module, for determining that several described subgraphs to be compressed are corresponding most based on default reduced rule Excellent compression method;
Picture compression module compresses several described subgraphs to be compressed for being based on the optimal compression method.
9. a kind of picture compression equipment, which is characterized in that the picture compression equipment includes: memory, processor and is stored in On the memory and the picture compression program that can run on the processor, the picture compression program is by the processor The step of picture compression method as described in any one of claims 1 to 7 is realized when execution.
10. a kind of computer readable storage medium, which is characterized in that be stored with picture pressure on the computer readable storage medium Contracting program realizes the picture compression as described in any one of claims 1 to 7 when the picture compression program is executed by processor The step of method.
CN201811016766.3A 2018-08-31 2018-08-31 Picture compression method, device and equipment and computer readable storage medium Active CN109685861B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811016766.3A CN109685861B (en) 2018-08-31 2018-08-31 Picture compression method, device and equipment and computer readable storage medium
PCT/CN2018/122718 WO2020042467A1 (en) 2018-08-31 2018-12-21 Image compression method, apparatus and device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811016766.3A CN109685861B (en) 2018-08-31 2018-08-31 Picture compression method, device and equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109685861A true CN109685861A (en) 2019-04-26
CN109685861B CN109685861B (en) 2022-03-15

Family

ID=66184483

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811016766.3A Active CN109685861B (en) 2018-08-31 2018-08-31 Picture compression method, device and equipment and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN109685861B (en)
WO (1) WO2020042467A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110634098A (en) * 2019-06-13 2019-12-31 眸芯科技(上海)有限公司 Lossless sparse image display method, device and system
CN111768459A (en) * 2020-06-28 2020-10-13 百度在线网络技术(北京)有限公司 Image processing method, image processing device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110229027A1 (en) * 2010-03-16 2011-09-22 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer-readable medium
CN102523367A (en) * 2011-12-29 2012-06-27 北京创想空间商务通信服务有限公司 Real-time image compression and reduction method based on plurality of palettes
CN103886623A (en) * 2012-12-19 2014-06-25 华为技术有限公司 Image compression method and equipment, and system
CN108399052A (en) * 2018-02-07 2018-08-14 深圳壹账通智能科技有限公司 Picture compression method, apparatus, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9998739B2 (en) * 2015-03-06 2018-06-12 Qualcomm Incorporated Optimization for encoding video data using non-square partitions
CN108009984B (en) * 2017-11-21 2020-07-07 中国地质大学(武汉) Water environment monitoring-oriented water surface saliency area detection method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110229027A1 (en) * 2010-03-16 2011-09-22 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer-readable medium
CN102523367A (en) * 2011-12-29 2012-06-27 北京创想空间商务通信服务有限公司 Real-time image compression and reduction method based on plurality of palettes
CN103886623A (en) * 2012-12-19 2014-06-25 华为技术有限公司 Image compression method and equipment, and system
CN108399052A (en) * 2018-02-07 2018-08-14 深圳壹账通智能科技有限公司 Picture compression method, apparatus, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MARCUS J. NADENAU 等: "Wavelet-Based Color Image Compression:Exploiting the Contrast Sensitivity Function", 《IEEE TRANSACTIONS ON IMAGE PROCESSING》 *
王晓日 等: "窄信道情况下远程屏幕图像高倍压缩传输方法", 《价值工程》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110634098A (en) * 2019-06-13 2019-12-31 眸芯科技(上海)有限公司 Lossless sparse image display method, device and system
CN111768459A (en) * 2020-06-28 2020-10-13 百度在线网络技术(北京)有限公司 Image processing method, image processing device, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2020042467A1 (en) 2020-03-05
CN109685861B (en) 2022-03-15

Similar Documents

Publication Publication Date Title
CN109618173B (en) Video compression method, device and computer readable storage medium
CN107038715B (en) Image processing method and device
KR101586954B1 (en) Techniques to reduce color artifacts in a digital image
KR101620933B1 (en) Method and apparatus for providing a mechanism for gesture recognition
CN106713689A (en) Picture uploading method and device
CN105979265A (en) Image compression method and apparatus
CN110599554A (en) Method and device for identifying face skin color, storage medium and electronic device
CN107424137B (en) Text enhancement method and device, computer device and readable storage medium
CN105681775A (en) White balance method and device
CN109685861A (en) Picture compression method, apparatus, equipment and computer readable storage medium
CN109727216A (en) Image processing method, device, terminal device and storage medium
CN106961629A (en) A kind of video encoding/decoding method and device
CN106296757A (en) A kind of image processing method and device
CN109685714B (en) Picture compression method, device, equipment and computer readable storage medium
US11902522B2 (en) Character restoration method and apparatus, storage medium, and electronic device
CN114298935A (en) Image enhancement method, device and computer readable storage medium
CN112839167B (en) Image processing method, device, electronic equipment and computer readable medium
US10079981B2 (en) Image dynamic range adjustment method, terminal, and storage medium
US10354125B2 (en) Photograph processing method and system
CN116030114A (en) Manufacturing method, device, equipment and medium of bioelectrical homologous electronic impression
CN109712216B (en) Chart rendering method and device, readable storage medium and electronic equipment
CN105243351A (en) Code scanning method based on mobile terminal
CN113453017A (en) Video processing method, device, equipment and computer program product
CN113345038A (en) Embroidery image processing method and device, electronic equipment and storage medium
CN112887726B (en) Image processing method and apparatus, storage medium, and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant