A kind of automatic selection picture compression quality the method for compressed picture
Technical field
The present invention relates to electronic technology field, relate to a kind of automatic selection picture compression quality more specifically and the method for compressed picture.
Background technology
Here the compression said does not change the size of picture and the quantity of pixel, just changed the size of picture file by adjustment compression quality.Ratio of compression=(file size of the rear picture of file size/compression of former figure), compression quality is from 0---100.Here compression is often referred to the compression of jpeg picture, also can be applied to the extended formatting picture with jpeg same principle.Compression quality for the former figure of general picture (source mobile phone camera, digital camera) is 99, and compression quality 97 is former map file sizes 1/2, and compression quality 94 can be 1/3 of former map file size, and compression quality 91 is 1/4 of former map file size.The feature of different picture is different, and in the unresolvable situation of the vision of people, ratio of compression can have difference.A common background is the portrait photo of landscape, and compression quality can be 94, be compressed into that camera takes file size 1/3, and the vision of people to distinguish the photo (even developing and printing out) before and after compression.And the photo of a texture complexity is as the feature of face, compression quality is with regard to 97, and the file after compression can be 1/2 of original file.And the portrait photo of a distant view, compression quality can be selected to be 91, file after compression can be that 1/4. of original file arranges the method for compression quality now all by artificially setting (as PhotoShop can arrange the compression quality of jpeg picture), people is needed to judge the compressible quality of photo for going, for the picture of batch, personalized setting can not be realized.
Summary of the invention
The present invention, for overcoming at least one defect (deficiency) described in above-mentioned prior art, provides a kind of automatic selection picture compression quality and the method for compressed picture.
For solving the problems of the technologies described above, technical scheme of the present invention is as follows:
Automatic selection picture compression quality a method for compressed picture, is characterized in that, comprise following steps:
A. set up picture feature database: preserve picture feature in described database, wherein each picture feature all has the compression quality corresponding with it;
B. prepare precompressed picture: prepare individual or multiple precompression pictures, extract and analyze the picture feature of often opening precompression picture;
C. compression quality search: the picture feature of often opening precompression picture and the picture feature in described database are contrasted, and the immediate picture feature of picture feature of search and precompression picture respectively in a database;
D. picture compression: according to the picture feature searched, compressing often opening precompression picture according to the compression quality corresponding with it, then preserving.
Further, as optimal technical scheme, aforementioned picture feature refers to the color histogram of picture, color moment, color distribution figure 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 setting up picture feature database in abovementioned steps A comprises the following steps:
A. picture under different scene is collected;
B. extract and analyze the color histogram of every pictures, color moment, color distribution figure and/or picture texture complexity degree grade;
C. between compression quality 80-98, generate compressed picture, the picture after compression is contrasted by artificial and former picture, obtains and the unresolvable compression quality of former picture naked eyes;
D. the picture feature of former figure, extraction and the corresponding compression quality that obtains are preserved to form database.
Further, as optimal technical scheme, the method setting up picture feature database in abovementioned steps A also comprises step e. and feeds back according to the situation of process picture, constantly increases and optimization data storehouse.
Further, as optimal technical scheme, also comprise step e. artificial treatment: if be unsatisfied with the quality of picture, manual amendment's compression quality, to be met the picture of vision requirement.
Further, as optimal technical scheme, also comprise step F. data base optimization: the former figure of picture through manually adjusting compression quality, the picture feature of extraction and corresponding compression quality are added in database, with abundant and optimization data storehouse.
Compared with prior art, the beneficial effect of technical solution of the present invention is:
1. of the present inventionly selecting corresponding compression quality by extracting picture feature (the texture complexity degree grade as color histogram, color moment, color distribution figure, picture) meeting under vision requirement in the database automatically in picture feature, reducing picture file size.
2. the present invention can realize picture batch processing, reduces artificial participation, reduces the threshold needing professional standing and experience when arranging user, by reducing the file size of picture, reduces the space stored and the time reducing transmission.
Embodiment
Below in conjunction with drawings and Examples, technical scheme of the present invention is described further.
Embodiment 1
Automatic selection picture compression quality a method for compressed picture, is characterized in that, comprise following steps:
A. set up picture feature database: preserve picture feature in described database, wherein each picture feature all has the compression quality corresponding with it, and wherein said compression quality is between 80-98; Concrete method for building up comprises following steps:
A. picture under different scene is collected;
B. extract and analyze the color histogram of every pictures, color moment, color distribution figure and/or picture texture complexity degree grade;
C. between compression quality 80-98, generate compressed picture, the picture after compression is contrasted by artificial and former picture, obtains and the unresolvable compression quality of former picture naked eyes;
D. the picture feature of former figure, extraction and the corresponding compression quality that obtains are preserved to form database.
B. prepare precompressed picture: prepare individual or multiple precompression pictures, extract and analyze and often open the picture feature of precompression picture, described picture feature refers to the color histogram of picture, color moment, color distribution figure and/or picture texture complexity degree grade;
C. compression quality search: the picture feature of often opening precompression picture and the picture feature in described database are contrasted, and the immediate picture feature of picture feature of search and precompression picture respectively in a database;
D. picture compression: according to the picture feature searched, compressing often opening precompression picture according to the compression quality corresponding with it, then preserving.
Embodiment 2
The present embodiment is similar to embodiment 1, and further, the method setting up picture feature database in described steps A also comprises step e. and feeds back according to the situation of process picture, constantly increases and optimization data storehouse.
Embodiment 3
The present embodiment is similar to embodiment 1 or embodiment 2, further, also comprises step e and step F, and wherein step e is artificial treatment: if be unsatisfied with the quality of picture, manual amendment's compression quality, to be met the picture of vision requirement; Wherein step F is data base optimization: add in database, with abundant and optimization data storehouse by the former figure of picture through manually adjusting compression quality, the picture feature of extraction and corresponding compression quality.
Obviously, the above embodiment of the present invention is only for example of the present invention is clearly described, and is not the restriction to embodiments of the present invention.For those of ordinary skill in the field, can also make other changes in different forms on the basis of the above description.Here exhaustive without the need to also giving all embodiments.All any amendments done within the spirit and principles in the present invention, equivalent to replace and improvement etc., within the protection domain that all should be included in the claims in the present invention.