Embodiment
In order to improve the identifiability of the thumbnail of electronic document, the embodiment of the present invention provides a kind of method generating thumbnail, in this method, after electronic document page is plotted as thumbnail, this thumbnail is reduced, and determine that this thumbnail whether can identification according to the contrast of the thumbnail after reducing, if can not identification, then continue to choose other pages and generate thumbnail.
See Fig. 1, the method for the generation thumbnail that the embodiment of the present invention provides, comprises the following steps:
Step 10: choose a page of electronic document as current page;
Step 11: for current page generates the thumbnail of the first setting size, be depicted as thumbnail by current page;
Step 12: the secondary thumbnail thumbnail of generation being reduced into the second setting size;
Step 13: whether the thumbnail determining current generation according to the contrast of the secondary thumbnail of current generation can identification, if so, then arrives step 14, otherwise, to step 15;
Step 14: preserved by the thumbnail of the thumbnail of current generation as electronic document, flow process terminates;
Step 15: choose other pages of not being selected in electronic document as current page, and return step 11.
Further, in step 12 before the secondary thumbnail thumbnail of current generation being reduced into the second setting size, need to obtain the minimum discernable preset further and know size; This minimum discernable is known size and is represented that human eye is easy to the size of the minimum color lump of identification in raster image; Then, the second setting size S:S=T/L is determined according to following formula; Wherein, T is the first setting size, and L is that minimum discernable knows size; The unit that minimum discernable knows size can be pixel, and the unit of the first setting size can be pixel, and the unit of the second setting size also can be pixel.
Further, after determining the second setting size S, and before the thumbnail of current generation being reduced into the secondary thumbnail of the second setting size, according to setting side-play amount and direction initialization, the position of the thumbnail of current generation can be offset.The unit of setting side-play amount can be pixel.
Such as, at direction initialization for the right and downwards, setting side-play amount is when being L/2 pixel, by the thumbnail of current generation first skew L/2 pixel to the right, then offsets downward L/2 pixel; Direction initialization for the right and upwards, setting side-play amount be L/2 pixel time, the thumbnail of current generation is first offset L/2 pixel to the right, more upwards skew L/2 pixel; At direction initialization for left and downwards, setting side-play amount is when being L/2 pixel, by the thumbnail of current generation first skew L/2 pixel left, then offsets downward L/2 pixel; Direction initialization for left and upwards, setting side-play amount be L/2 pixel time, the thumbnail of current generation is first offset L/2 pixel left, more upwards skew L/2 pixel.
Certainly, skew is carried out in the position of the thumbnail of current generation and is not limited to aforesaid way, any other mode position of thumbnail can being carried out offset is all in protection scope of the present invention.
Whether the thumbnail determining current generation according to the contrast of the secondary thumbnail of current generation in step 13 can identification, and specific implementation can be as follows:
If the contrast of the secondary thumbnail of current generation exceedes default contrast threshold, then determine that the thumbnail of current generation can identification; Otherwise, determine that the thumbnail of current generation can not identification.The contrast of secondary thumbnail is the data representing the maximum brightness value of pixel and the difference of minimum luminance value in this secondary thumbnail.
Wherein, can according to the contrast C of following formulae discovery secondary thumbnail:
C=∑δ(i,j)
2P
δ(i,j)
Wherein, i, j are the gray-scale value of two neighbors in secondary thumbnail, this gray-scale value be more than or equal to 0 numerical value; δ (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 be the pixel distribution probability of δ, this pixel distribution probability is the numerical value between 0 and 1.
In step 10, choose a page of electronic document as current page, specific implementation can be as follows:
First page within the scope of the free Page that presets is chosen, as current page from electronic document.
Accordingly, choose other pages of not being selected in electronic document in step 15 as current page, specific implementation can be as follows:
Determining that whether current page is last page within the scope of the free Page that presets, when being defined as no, choosing the next page of the current page within the scope of this free Page as current page.When being defined as being, when namely current page is last page within the scope of the free Page that presets, existing additive method can be used to generate the thumbnail of electronic document, such as, adopt title, image that author generates is as the thumbnail of electronic document.
Certainly, may not be in step 10 and choose first page within the scope of free Page as current page, such as: can also be choose last page within the scope of free Page as current page in step 10, accordingly, in step 15 when choosing other pages of not being selected in electronic document as current page, first can determine that whether current page is first page within the scope of the free Page that presets, when being defined as no, choose a upper page of the current page within the scope of this free Page as current page; When being defined as being, when namely current page is first page within the scope of the free Page that presets, existing additive method can be used to generate the thumbnail of electronic document, such as, adopt title, image that author generates is as the thumbnail of electronic document.
Again such as: choose any one page within the scope of free Page in step 10 as current page, accordingly, in step 15 when choosing other pages of not being selected in electronic document as current page, first can determine whether each page within the scope of the free Page that presets all was selected, when being defined as no, choose other pages be not selected within the scope of this free Page as current page; When being defined as being, it is out-of-date that each page namely in available Page Range is all selected, and existing additive method can be used to generate the thumbnail of electronic document, such as, adopt title, image that author generates is as the thumbnail of electronic document.
Here, whole pages of electronic document can be comprised in free Page scope, also can comprise the partial page of electronic document; When comprising the partial page of electronic document in free Page scope, can be all pages before the text comprising electronic document, or comprise the page of setting page number.
Below in conjunction with specific embodiment, the present invention will be described:
Embodiment one:
As shown in Figure 2 A, concrete steps are as follows for the electronic document reduced graph generating method that the present embodiment adopts:
Step 201, opens electronic document and chooses first page of electronic document;
Step 202, according to thumbnail size T to be obtained, is plotted as the page chosen the thumbnail that size is T;
Step 203, obtains the minimum discernable preset and knows size L, calculate the size S=T/L of secondary thumbnail, thumbnail is reduced into the first secondary thumbnail that size is S; Or, thumbnail is respectively offset L/2 pixel to the right and downwards, then is reduced into the second subprime thumbnail that size is S;
Wherein, can the unit of identification size L be pixel, represent in raster image, human eye be easy to the size of the minimum color lump of identification;
Step 204, according to the contrast of secondary thumbnail, judges that thumbnail whether can identification, if thumbnail can identification, then performs step 208, otherwise performs step 205;
Judge that the whether cognizable method of thumbnail is: if the contrast of the first secondary thumbnail exceedes predetermined threshold value, or the contrast of second subprime thumbnail exceedes predetermined threshold value, then determine that thumbnail can identification;
Step 205, judges that whether current page is last page within the scope of the free Page that presets, if so, then performs step 207, otherwise perform step 206; This free Page scope can be determined according to the metadata of electronic document, such as using the page before text as free Page scope, also can be will setting page number the page as free Page scope, such as using the page of first 20 pages as free Page scope;
Step 206, chooses the next page in electronic document within the scope of free Page, continues to perform step 202;
Step 207, the page of electronic document is not suitable as thumbnail, uses other existing methods to generate the thumbnail of electronic documents, such as adopt title, image that author generates as the thumbnail of electronic document, to step 209;
Step 208, the thumbnail using step 202 to generate is as the thumbnail of electronic document;
Step 209, is saved in the thumbnail of electronic document in electronic document, or is kept in the memory device of computing machine, for later direct.
Embodiment two:
Step one: in order to generate the thumbnail of 150 × 200 pixels for a electronic document, first first page of electronic document is chosen, and this page is plotted as the thumbnail of 150 × 200, as shown in Fig. 2 B left side, first page forms primarily of less word content;
Step 2: default can identification size be 5 pixels, calculating secondary thumbnail size is 30 × 40 pixels, generated thumbnail is reduced into the secondary thumbnail of 30 × 40, as shown on the right of Fig. 2 B, calculate this secondary thumbnail contrast, and determine that the contrast of this secondary thumbnail is less than default threshold value, the thumbnail not easily identification of first page is described;
Step 3: second page choosing electronic document, and this page is plotted as the thumbnail of 150 × 200, as shown in Fig. 2 C left side, the content of second page is made up of larger figure, word;
Step 4: the thumbnail of second page is reduced into the secondary thumbnail of 30 × 40, as shown on the right of Fig. 2 C, calculate the contrast of this secondary thumbnail, and determine that the contrast of this secondary thumbnail is greater than default threshold value, illustrate that the thumbnail of second page is easy to identification; Use the thumbnail of thumbnail as electronic document of second page, and this thumbnail is kept in electronic document, for later direct.
See Fig. 3, the embodiment of the present invention is wanted to provide a kind of device generating thumbnail, and this device comprises:
The page chooses unit 30, for choosing a page of electronic document as current page;
Thumbnail generation unit 31, for generating the thumbnail of the first setting size for current page;
Thumbnail reducing unit 32, the thumbnail for being generated by described thumbnail generation unit is reduced into the secondary thumbnail of the second setting size;
Identification identifying unit 33, the contrast for the secondary thumbnail generated according to described thumbnail reducing unit determines that described thumbnail whether can identification; If so, then the thumbnail of described thumbnail as described electronic document is preserved; Otherwise, choose other pages of not being selected in electronic document as current page, and trigger described thumbnail generation unit and continue as the thumbnail that current page generates the first setting size.
Further, described thumbnail reducing unit 32 also for:
Before the secondary thumbnail thumbnail of generation being reduced into the second setting size, obtain the minimum discernable preset and know size; Described minimum discernable is known size and is represented that human eye is easy to the size of the minimum color lump of identification in raster image;
The second setting size S:S=T/L is determined according to following formula; Wherein, T is the first setting size, and L is that described minimum discernable knows size.
Further, described thumbnail reducing unit 32 also for:
After determining the second setting size S, and before the thumbnail of generation being reduced into the secondary thumbnail of the second setting 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 to the right and downwards.
Further, described identification identifying unit 33 for: determine that described thumbnail whether can identification as follows:
If the contrast of described secondary thumbnail exceedes default contrast threshold, then determine that described thumbnail can identification; Otherwise, determine that described thumbnail can not identification.
Further, the described page choose unit 30 for:
First page within the scope of the free Page that presets is chosen, as current page from electronic document.
Accordingly, described identification identifying unit 33 for: choose other pages of not being selected in electronic document as follows as current page:
Determining that whether current page is last page within the scope of described free Page, when being defined as no, choosing the next page of the current page within the scope of described free Page as current page.
Further, the free Page comprised in described free Page scope is all pages before the text of described electronic document, or 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 present invention provides, after generating thumbnail according to a page of electronic document, this thumbnail is reduced, and determine that the thumbnail that generates whether can identification according to the contrast of the secondary thumbnail after reducing, if can identification, then the thumbnail of this thumbnail as electronic document be preserved; If can not identification, then choose other pages and generate thumbnail.Visible, determining that the secondary thumbnail of the thumbnail generated according to page can not after identification in this programme, not using the thumbnail of this thumbnail as electronic document, but continue to choose other pages generation thumbnail, with in prior art directly using the thumbnail that generates according to a page compared with the thumbnail of electronic document, the present invention can improve the identifiability of the thumbnail of electronic document.
This programme considers vision identifiability when generating thumbnail, ensures that the thumbnail generated is easy to identification, can reach the object utilizing thumbnail visually to distinguish document fast; And this programme and document format have nothing to do, highly versatile.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.