A method of automatically selecting picture compression quality and compressed picture
Technical field
The present invention relates to electronic technology fields, more particularly relate to one kind and automatically selecting picture compression quality and compressed picture
Method.
Background technology
Compression said herein is the quantity of the size and pixel that do not change picture, changes figure simply by adjustment compression quality
The size of piece file.Compression ratio=(The file size of picture after file size/compression of artwork), compression quality is from 0---100.
Here compression is often referred to the compression of jpeg pictures, can also be applied to the extended formatting picture with jpeg same principles.For
General picture artwork(Source mobile phone camera, digital camera) compression quality be 99, compression quality 97 is artwork file size
1/2, compression quality 94 can be the 1/3 of artwork file size, and compression quality 91 is the 1/4 of artwork file size.Difference figure
The characteristics of piece, is different, and the vision in people is unresolvable, and compression ratio can be different.One common background is landscape
Portrait photo, compression quality can be 94, be compressed into camera and take and come the 1/3 of file size, the vision of people is to be unable to area
Photo before and after partial compression(Come even being punched out).As soon as and the feature of the photo such as face of texture complexity, compression quality
97, compressed file can be the 1/2 of original file.And the portrait photo of a distant view, it is 91 that can select compression quality,
Compressed file can be that the method for 1/4. present setting compression quality of original file is all by artificial settings(Such as
The compression quality of jpeg pictures can be arranged in PhotoShop), need artificially to go to judge the compressible quality of photo, for batch
Picture for, can not achieve personalized setting.
Invention content
The present invention is at least one defect overcome described in the above-mentioned prior art(It is insufficient), one kind is provided and automatically selects picture
The method of compression quality and compressed picture.
In order to solve the above technical problems, technical scheme is as follows:
A method of automatically selecting picture compression quality and compressed picture, which is characterized in that comprise the steps of:
A. picture feature database is established:Picture feature is preserved in the database, wherein each picture feature has
Corresponding compression quality;
B. prepare precompressed picture:Prepare individual or multiple precommpression pictures, extracts and analyze every precommpression picture
Picture feature;
C. compression quality is searched for:Picture feature in the picture feature of every precommpression picture and the database is carried out
Comparison, and search for the immediate picture feature of picture feature with precommpression picture respectively in the database;
D. picture compression:According to the picture feature searched, according to corresponding compression quality to every precompressed contract drawing
Piece is compressed, and is then preserved.
Further, as optimal technical scheme, aforementioned picture is characterized in referring to the color histogram, color moment, face of picture
Color distribution map and/or picture texture complexity degree grade.
Further, as optimal technical scheme, aforementioned compression quality is between 80-98.
Further, as optimal technical scheme, the method for establishing picture feature database in abovementioned steps A include with
Lower step:
A. picture under different scenes is collected;
B. extract and analyze color histogram, color moment, distribution of color figure and/or the picture texture complexity per pictures
Intensity grade;
C. compressed picture is generated between compression quality 80-98, compressed picture is carried out by artificial and original picture
Comparison obtains and the unresolvable compression quality of original picture naked eyes;
D. artwork, the picture feature of extraction and obtained corresponding compression quality are preserved to form database.
Further, as optimal technical scheme, the method for establishing picture feature database in abovementioned steps A further includes
Step e. is fed back according to the case where processing picture, is constantly increasing and optimizes database.
Further, further include step E. artificial treatments as optimal technical scheme:If the quality to picture is dissatisfied,
Manual amendment's compression quality, to obtain the picture for meeting vision requirement.
Further, further include step F. data base optimizations as optimal technical scheme:It will be through manually adjusting compression quality
The artwork of picture, the picture feature of extraction and corresponding compression quality be added in database, with abundant and optimization database.
Compared with prior art, the advantageous effect of technical solution of the present invention is:
1. the present invention's passes through extraction picture feature(Such as color histogram, the texture of color moment, distribution of color figure, picture
Complexity grade)It selects corresponding compression quality in the database of picture feature automatically in the case where meeting vision requirement, reduces
Picture file size.
2. the present invention can realize picture batch processing, artificial participation is reduced, is reduced to needing profession when user setting
The threshold of knowledge and experience, by reducing the file size of picture, reducing the space of storage and reducing the time of transmission.
Specific implementation mode
The following further describes the technical solution of the present invention with reference to the accompanying drawings and examples.
Embodiment 1
A method of automatically selecting picture compression quality and compressed picture, which is characterized in that comprise the steps of:
A. picture feature database is established:Picture feature is preserved in the database, wherein each picture feature has
Corresponding compression quality, wherein the compression quality is between 80-98;Specific method for building up comprises the steps of:
A. picture under different scenes is collected;
B. extract and analyze color histogram, color moment, distribution of color figure and/or the picture texture complexity per pictures
Intensity grade;
C. compressed picture is generated between compression quality 80-98, compressed picture is carried out by artificial and original picture
Comparison obtains and the unresolvable compression quality of original picture naked eyes;
D. artwork, the picture feature of extraction and obtained corresponding compression quality are preserved to form database.
B. prepare precompressed picture:Prepare individual or multiple precommpression pictures, extracts and analyze every precommpression picture
Picture feature, the picture feature refers to that color histogram, color moment, distribution of color figure and/or the picture texture of picture are multiple
Miscellaneous intensity grade;
C. compression quality is searched for:Picture feature in the picture feature of every precommpression picture and the database is carried out
Comparison, and search for the immediate picture feature of picture feature with precommpression picture respectively in the database;
D. picture compression:According to the picture feature searched, according to corresponding compression quality to every precompressed contract drawing
Piece is compressed, and is then preserved.
Embodiment 2
The present embodiment is similar to embodiment 1, further, the method for establishing picture feature database in the step A
Further include that step e. is fed back according to the case where processing picture, is constantly increasing and optimizes database.
Embodiment 3
The present embodiment further includes further step E and step F, wherein step E similar to embodiment 1 or embodiment 2
For artificial treatment:If the quality to picture is dissatisfied, manual amendment's compression quality, to obtain the picture for meeting vision requirement;Its
Middle step F is data base optimization:By the artwork of the picture through manually adjusting compression quality, the picture feature of extraction and corresponding pressure
Contracting quality is added in database, with abundant and optimization database.
Obviously, the above embodiment of the present invention be only to clearly illustrate example of the present invention, and not be pair
The restriction of embodiments of the present invention.For those of ordinary skill in the art, may be used also on the basis of the above description
To make other variations or changes in different ways.There is no necessity and possibility to exhaust all the enbodiments.It is all this
All any modification, equivalent and improvement etc., should be included in the claims in the present invention made by within the spirit and principle of invention
Protection domain within.