Embodiment
Identifiability for the thumbnail that improves electronic document, the embodiment of the invention provides a kind of method that generates thumbnail, in this method, after a page with electronic document is plotted as thumbnail, this thumbnail is dwindled, but and determine the whether identification of this thumbnail according to the contrast of the thumbnail after dwindling, if can not identification, then continue to choose other pages and generate thumbnail.
Referring to Fig. 1, the method for the generation thumbnail that the embodiment of the invention provides may further comprise the steps:
Step 10: choose a page of electronic document as current page;
Step 11: set big or small thumbnail for current page generates first, be about to current page and be depicted as thumbnail;
Step 12: the thumbnail that generates is reduced into second sets big or small secondary thumbnail;
Step 13: but determine the whether identification of thumbnail of current generation according to the contrast of the secondary thumbnail of current generation, if, then arrive step 14, otherwise, to step 15;
Step 14: the thumbnail of current generation is preserved as the thumbnail of electronic document, and flow process finishes;
Step 15: choose other pages of not being selected in the electronic document as current page, and return step 11.
Further, before the thumbnail with current generation is reduced into the secondary thumbnail of the second setting size, further need obtains predefined minimum discernable and know size in the step 12; This minimum discernable is known size and is illustrated in the size that human eye in the raster image is easy to the minimum color lump of identification; Then, determine that according to following formula second sets big or small S:S=T/L; Wherein, T is the first setting size, and L is that minimum discernable is known size; The unit that minimum discernable is known size can be pixel, and first unit that sets size can be pixel, and second unit that sets size also can be pixel.
Further, determine second set big or small S after, and the thumbnail of current generation be reduced into second set before the secondary thumbnail of size, can be according to setting side-play amount and direction initialization, the position of the thumbnail of current generation is offset.The unit that sets side-play amount can be pixel.
For example, for and downwards, when setting side-play amount and being L/2 pixel, to the right be offset L/2 pixel with the thumbnail of current generation is first at direction initialization to the right, offset downward L/2 pixel again; For and upwards, when setting side-play amount and being L/2 pixel, be offset L/2 pixel to the right with the thumbnail of current generation is first, upwards be offset L/2 pixel at direction initialization more to the right; For and downwards, when setting side-play amount and being L/2 pixel, left be offset L/2 pixel with the thumbnail of current generation is first at direction initialization left, offset downward L/2 pixel again; For and upwards, when setting side-play amount and being L/2 pixel, be offset L/2 pixel left with the thumbnail of current generation is first, upwards be offset L/2 pixel at direction initialization more left.
Certainly, the position of the thumbnail of current generation is offset is not limited to aforesaid way, any other mode that the position of thumbnail can be offset is all in protection scope of the present invention.
But determine the whether identification of thumbnail of current generation in the step 13 according to the contrast of the secondary thumbnail of current generation, specific implementation can be as follows:
If the contrast of the secondary thumbnail of current generation surpasses default contrast threshold, but then determine the thumbnail identification of current generation; Otherwise, determine that the thumbnail of current generation can not identification.The contrast of secondary thumbnail is the data of the difference of the maximum brightness value of pixel and minimum luminance value in this secondary thumbnail of expression.
Wherein, can calculate the contrast C of secondary thumbnail according to following formula:
C=∑δ(i,j)
2P
δ(i,j)
Wherein, i, j are the gray-scale value of two neighbors in the secondary thumbnail, and this gray-scale value is the numerical value more than or equal to 0; δ (i, j)=| i-j| is the gray scale difference between these two neighbors; P
δ(i, j) for the gray scale difference between these two neighbors is the pixel distribution probability of δ, this pixel distribution probability is the numerical value between 0 and 1.
In the step 10, choose a page of electronic document as current page, specific implementation can be as follows:
From electronic document, choose first page in the predefined free Page scope, as current page.
Accordingly, choose other pages of not being selected in the electronic document in the step 15 as current page, specific implementation can be as follows:
Determine that whether current page is last interior page of predefined free Page scope, when being defined as not, chooses the next page of the current page in this free Page scope as current page.When being defined as being, when namely current page is last page in the predefined free Page scope, can use existing additive method to generate the thumbnail of electronic document, for example adopt image that title, author generate as the thumbnail of electronic document.
Certainly, also can not to choose first interior page of free Page scope as current page in the step 10, for example: can also be to choose last interior page of free Page scope as current page in the step 10, accordingly, other pages that were not selected in choosing electronic document in the step 15 are during as current page, can determine at first whether current page is first interior page of predefined free Page scope, when being defined as not, choose a last page of the current page in this free Page scope as current page; When being defined as being, when namely current page is first page in the predefined free Page scope, can use existing additive method to generate the thumbnail of electronic document, for example adopt image that title, author generate as the thumbnail of electronic document.
Again for example: choose any interior page of free Page scope in the step 10 as current page, accordingly, other pages that were not selected in choosing electronic document in the step 15 are during as current page, can determine at first whether each page in the predefined free Page scope all was selected, when being defined as not, choose interior other pages that were not selected of this free Page scope as current page; When being defined as being, namely each page in the available Page Range all is selected out-of-dately, can use existing additive method to generate the thumbnail of electronic document, for example adopts image that title, author generate as the thumbnail of electronic document.
Here, can comprise whole pages of electronic document in the free Page scope, also can comprise the partial page of electronic document; When in the free Page scope, comprising the partial page of electronic document, can be text all pages before that comprise electronic document, or comprise the page of setting page number.
The present invention will be described below in conjunction with specific embodiment:
Embodiment one:
The electronic document reduced graph generating method that present embodiment adopts is shown in Fig. 2 A, and concrete steps are as follows:
Step 201 is opened electronic document and is chosen first page of electronic document;
Step 202 according to thumbnail size T to be obtained, is plotted as size with the page of choosing and is the thumbnail of T;
Step 203 is obtained default minimum discernable and is known big or small L, calculates the big or small S=T/L of secondary thumbnail, thumbnail is reduced into size is first level thumbnail of S; Perhaps, thumbnail respectively is offset the L/2 pixel to the right and downwards, is reduced into size again and is the second subprime thumbnail of S;
Wherein, but the unit of identification size L is pixel, is illustrated in the raster image, and human eye is easy to the size of the minimum color lump of identification;
Step 204 according to the contrast of secondary thumbnail, but is judged whether identification of thumbnail, if but the thumbnail identification, then execution in step 208, otherwise execution in step 205;
Judge whether cognizable method is thumbnail: if the contrast of first level thumbnail surpasses predetermined threshold value, or the contrast of second subprime thumbnail surpasses predetermined threshold value, but then determines the thumbnail identification;
Step 205 judges whether current page is last interior page of predefined free Page scope, if then execution in step 207, otherwise execution in step 206; This free Page scope can determine according to the metadata of electronic document, for example with the page before the text as the free Page scope, also can be will set page number the page as the free Page scope, such as with the preceding 20 pages page as the free Page scope;
Step 206 is chosen the next page in the free Page scope in the electronic document, continues execution in step 202;
Step 207, the page of electronic document is not suitable as thumbnail, uses other existing methods to generate the thumbnail of electronic document, for example adopts the image of title, author's generation as the thumbnail of electronic document, to step 209;
Step 208 uses the thumbnail of step 202 generation as the thumbnail of electronic document;
Step 209 is saved in the thumbnail of electronic document in the electronic document, perhaps is kept in the memory device of computing machine, is provided with the back and directly uses.
Embodiment two:
Step 1: in order to be the thumbnail that a electronic document generates 150 * 200 pixels, at first choose first page of electronic document, and this page is plotted as 150 * 200 thumbnail, shown in Fig. 2 B left side, first page mainly is made up of less word content;
Step 2: but default identification size is 5 pixels, calculating secondary thumbnail size is 30 * 40 pixels, the thumbnail that generates is reduced into 30 * 40 secondary thumbnail, shown in Fig. 2 B the right, calculate this secondary thumbnail contrast, and the contrast of determining this secondary thumbnail illustrates that less than preset threshold value the thumbnail of first page is difficult for identification;
Step 3: choose second page of electronic document, and this page is plotted as 150 * 200 thumbnail, shown in Fig. 2 C left side, the content of second page is made up of bigger figure, literal;
Step 4: the thumbnail of second page is reduced into 30 * 40 secondary thumbnail, shown in Fig. 2 C the right, calculate the contrast of this secondary thumbnail, and the contrast of determining this secondary thumbnail illustrates that greater than preset threshold value the thumbnail of second page is easy to identification; Use the thumbnail of second page as the thumbnail of electronic document, and this thumbnail is kept in the electronic document, be provided with the back and directly use.
Referring to Fig. 3, the embodiment of the invention wants to provide a kind of device that generates thumbnail, and this device comprises:
The page is chosen unit 30, is used for choosing a page of electronic document as current page;
Thumbnail generation unit 31 is used to current page to generate first and sets big or small thumbnail;
Thumbnail dwindles unit 32, is used for that the thumbnail that described thumbnail generation unit generates is reduced into second and sets big or small secondary thumbnail;
Identification identifying unit 33, but be used for determining the whether identification of described thumbnail according to the contrast that described thumbnail dwindles the secondary thumbnail that the unit generates; If then described thumbnail is preserved as the thumbnail of described electronic document; Otherwise, choose other pages of not being selected in the electronic document as current page, and trigger described thumbnail generation unit and continue as current page and generate first thumbnail of setting size.
Further, described thumbnail dwindles unit 32 and also is used for:
Be reduced at the thumbnail that will generate before the secondary thumbnail of the second setting size, obtain predefined minimum discernable and know size; Described minimum discernable is known size and is illustrated in the size that human eye in the raster image is easy to the minimum color lump of identification;
Determine that according to following formula second sets big or small S:S=T/L; Wherein, T is the first setting size, and L is that described minimum discernable is known size.
Further, described thumbnail dwindles unit 32 and also is used for:
Determine second set big or small S after, and the thumbnail that generates be reduced into second set before the secondary thumbnail of size, according to setting side-play amount and direction initialization, the position of described thumbnail is offset.
Described setting side-play amount is L/2 pixel; Described direction initialization is for to the right and downwards.
Further, described identification identifying unit 33 is used for: but determine the whether identification of described thumbnail as follows:
If the contrast of described secondary thumbnail surpasses default contrast threshold, but then determine described thumbnail identification; Otherwise, determine that described thumbnail can not identification.
Further, the described page is chosen unit 30 and is used for:
From electronic document, choose first page in the predefined free Page scope, as current page.
Accordingly, described identification identifying unit 33 is used for: choose other pages that electronic document was not selected as follows as current page:
Determine that whether current page is last interior page of described free Page scope, when being defined as not, chooses the next page of the current page in the described free Page scope as current page.
Further, the free Page that comprises in the described free Page scope is text all pages before of described electronic document, perhaps for setting the page of page number.
To sum up, beneficial effect of the present invention comprises:
In the scheme that the embodiment of the invention provides, after a page according to electronic document generates thumbnail, this thumbnail is dwindled, but and determine the whether identification of the thumbnail that generates according to the contrast of the secondary thumbnail after dwindling, if but identification is then preserved this thumbnail as the thumbnail of electronic document; If can not identification, then choose other pages and generate thumbnail.As seen, in this programme after the secondary thumbnail of the thumbnail of determining to generate according to a page can not identification, not with the thumbnail of this thumbnail as electronic document, generate thumbnail but continue to choose other pages, with directly will compare as the thumbnail of electronic document according to the thumbnail that page generates in the prior art, the present invention can improve the identifiability of the thumbnail of electronic document.
This programme has been considered the vision identifiability when generating thumbnail, guarantee that the thumbnail that generates is easy to identification, can reach and utilize thumbnail from visually distinguishing the purpose of document fast; And this programme and document format are irrelevant, highly versatile.
The present invention is that reference is described according to process flow diagram and/or the block scheme of method, equipment (system) and the computer program of the embodiment of the invention.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or the block scheme and/or square frame and process flow diagram and/or the block scheme and/or the combination of square frame.Can provide these computer program instructions to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, make the instruction of carrying out by the processor of computing machine or other programmable data processing device produce to be used for the device of the function that is implemented in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame appointments.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, make the instruction that is stored in this computer-readable memory produce the manufacture that comprises command device, this command device is implemented in the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame.
These computer program instructions also can be loaded on computing machine or other programmable data processing device, make and carry out the sequence of operations step producing computer implemented processing at computing machine or other programmable devices, thereby be provided for being implemented in the step of the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame in the instruction that computing machine or other programmable devices are carried out.
Although described the preferred embodiments of the present invention, in a single day those skilled in the art get the basic creative concept of cicada, then can make other change and modification to these embodiment.So claims are intended to all changes and the modification that are interpreted as comprising preferred embodiment and fall into the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.