Summary of the invention
In order to solve in prior art the low problem of text description can only be used search efficiency that search pictures causes, embodiments provide a kind of image searching method and system.Described technical scheme is as follows:
The embodiment of the present invention proposes a kind of image searching method, comprising:
The picture of the picture of pre-stored, request search is carried out processing the fingerprint index data obtaining described picture;
The fingerprint index data of picture that described request is searched for are mated with the fingerprint index data of the picture of described pre-stored, if there is the picture of coupling, then obtains the picture of described coupling;
Wherein, the described picture by the picture of pre-stored, request search carries out processing the fingerprint index data obtaining described picture, comprising:
Described picture is revised as default resolution, and Edge contrast is carried out to extract described picture prospect to described picture;
Extract the rgb value of described each pixel of picture prospect, respectively R, G, B tri-be worth divided by preset value and get the integer-bit of result;
The coordinate figure of the rgb value after each pixel process described and described pixel place picture is generated the litura information of described pixel;
The fingerprint index data of the picture of described pre-stored, the picture of described request search are generated according to described litura information;
Wherein, the described fingerprint index data generating the picture of described pre-stored, the picture of described request search according to described litura information, comprising:
Litura information according to each pixel described generates finger print information;
The fingerprint index data of the picture of described pre-stored, the picture of described request search are calculated according to the finger print information of each pixel described.
Preferred as technique scheme, the litura information according to each pixel described generates finger print information, comprising:
Obtain the litura information of each pixel of described picture prospect, and generate set using the finger print information as described picture according to the litura information of each pixel described.
Preferred as technique scheme, calculates the fingerprint index data of the picture of described pre-stored, the picture of described request search, comprising according to the finger print information of each pixel described:
Described finger print information is converted to MD5 code using the fingerprint index data as described picture.
The embodiment of the present invention also proposed a kind of image searching system, comprising:
Acquisition module, for carrying out processing by the picture of the picture of pre-stored, request search the fingerprint index data obtaining described picture;
Matching module, mates with the fingerprint index data of the picture of described pre-stored for the fingerprint index data of picture of described request being searched for, if there is the picture of coupling, then obtains the picture of described coupling;
Wherein, described acquisition module comprises:
Amendment unit, for described picture is revised as default resolution, and carries out Edge contrast to extract described picture prospect to described picture;
Fuzzy Processing unit, for extracting the rgb value of described each pixel of picture prospect, being worth R, G, B tri-divided by preset value respectively and getting the integer-bit of result;
Generation unit, for generating the litura information of described pixel by the coordinate figure of the rgb value after each pixel process described and described pixel place picture;
Fingerprint index data generating unit, for generating the fingerprint index data of the picture of described pre-stored, the picture of described request search according to described litura information;
Wherein, described fingerprint index data generating unit at least comprises:
Finger print information subelement, generates finger print information for the litura information according to each pixel described;
Data genaration subelement, for calculating the fingerprint index data of the picture of described pre-stored, the picture of described request search according to the finger print information of each pixel described.
Preferred as technique scheme, finger print information subelement is also for obtaining the litura information of described each pixel of picture prospect; And generate set using the finger print information as described picture according to the litura information of each pixel described.
Preferred as technique scheme, data genaration subelement is also for converting MD5 code to using the fingerprint index data as described picture by described finger print information.
The beneficial effect of the technical scheme that the embodiment of the present invention provides is: in invention the present embodiment, by all carrying out Fuzzy processing to the picture of pre-stored and the picture of request search, so just make search engine can search identical picture or approximate picture, with the search of mating completely picture.This mode is compared and is used the search of text description in prior art, search engine is found meet the Search Results of searchers's intention, improves the efficiency of the search of search engine.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
The mentality of designing of the embodiment of the present invention is: the picture request that the picture of pre-stored in search engine and searchers are submitted to searched for carries out the fingerprint index data processing to obtain picture respectively.And then the fingerprint index data of the picture of request search and the picture of pre-stored are searched for.So just can realize the search with identical picture, approximate picture.
Embodiment 1
First embodiment of the invention proposes a kind of image searching method, and its flow process as shown in Figure 1, comprising:
Step 101, by the picture of pre-stored, request search picture carry out processing the fingerprint index data obtaining described picture;
Step 102, by described request search for the fingerprint index data of picture mate with the fingerprint index data of the picture of pre-stored, if there is the picture of coupling, then obtain the picture of described coupling.
In invention the present embodiment, search engine is in order to meet the specific demand of searchers, when cannot with text description pictorial information or with the result of text description too magnanimity, the picture of pre-stored is processed with asking the picture searched for, search picture can mated completely like this, instead of the mode that traditional use text description carries out picture searching, search engine is found meet the Search Results of searchers's intention, improve the efficiency of search engine search pictures.
Embodiment 2
Second embodiment of the invention improves on the basis of the first embodiment, and its flow process as shown in Figure 2, comprising:
In the present embodiment, can first carry out processing the fingerprint index data obtaining picture to the picture of pre-stored, then carry out processing the fingerprint index data obtaining picture to the picture of request search.Also can process the picture of pre-stored, the picture of request search simultaneously, obtain the fingerprint index data of picture.Or first can process the picture of request search, then carry out the picture of pre-stored processing the fingerprint index data obtaining picture, and then carry out picture searching.
The embodiment of the present invention is only described wherein a kind of mode, and other mode is only that the time slot of process is different, then identical to the mode of picture processing, therefore repeats no more in the present embodiment.
Step 201, by the picture of pre-stored, request search picture carry out processing the fingerprint index data obtaining described picture;
Concrete implementation step is as follows:
Step 2011, from search engine, extract picture;
Concrete, the picture first pre-stored from search engine extracts.Wherein, the picture of pre-stored is search engine by the picture all from the webpage that WWW is downloaded of a program automatically extracting webpage.
Step 2012, the described picture extracted is adjusted to unified resolution;
In search engine, the photo resolution of pre-stored is not monolithic, for the ease of calculating the litura information of all pictures, first needs to carry out unitized process to the resolution of picture.Such as: can be the size of 640*480 the resolution adjustment of all pictures.The picture all resolution being less than to 640*480 carries out expansion process, and the picture all resolution being greater than to 640*480 carries out reducing process, and finally all picture unified resolution are 640*480.
Step 2013, Edge contrast is carried out to the picture of adjustment resolution, and extract picture prospect;
The essence of Edge contrast is the contrast increasing image detail edge, and strengthen the edge of picture, these eyes contributing to us see image detail clearly, thus the distinctness that the edge of target object is become, picture are clear.After sharpening, the edge of picture prospect is given prominence to, and its prospect be separated with background, object removes unessential background information, so that carry out the calculating of picture prospect litura information.Wherein, the method for Edge contrast and extraction picture perspective process is all prior art, does not make restriction in the embodiment of the present invention to this.
Step 2014, calculate described picture prospect litura information;
Concrete, first the rgb value of described each pixel of picture prospect will be extracted, then the rgb value of described pixel is carried out Fuzzy processing, and using the litura information of the coordinate figure of the rgb value after each pixel process described and described pixel place picture as this pixel.Concrete, can will add the position coordinates of described pixel before the rgb value of each pixel after described Fuzzy processing, namely form the litura information of described pixel.
Further, the object of picture being carried out Fuzzy processing causes to prevent the picture be similar to from there is the nuance in color, brightness to omit correct Search Results in search procedure.Such as, picture is when carrying out format conversion, in order to reduce the capacity of picture, need to carry out compression process to picture, lossy compression can make the original image quality of data decline, although naked eyes almost cannot differentiate the decline of picture quality, but the compression process carried out is to the brightness of each pixel of picture, the parameter such as colourity and saturation degree is after coding again calculates, the rgb value of each pixel showed can change to some extent, picture after compression supposedly naked eyes cannot be differentiated, if but do not carry out Fuzzy processing, picture before compression and after compression is after the rgb value carrying out its each pixel of exact matching, can judge that these two figure are different.Therefore can avoid the generation of this kind of situation after Fuzzy processing being carried out to picture as far as possible, improve the efficiency of search pictures.
Therefore step 2014 can be specific as follows:
Step 20141, extract the rgb value of each pixel of described picture prospect;
Concrete, rgb color pattern is the intensity level distributed for the RGB component of each pixel in image within the scope of a 0-255.RGB image only uses three kinds of colors, them just can be made according to the mixing of different ratios, screen reappears 16777216 kinds of colors.
Step 20142, the rgb value of extraction is carried out Fuzzy processing;
Concrete, the rgb value extracted needs to carry out Fuzzy processing.Sometimes two kinds of colors are very close, naked eyes cannot distinguish this two kinds of colors, but the rgb value of these two kinds of colors of extracting directly when computer disposal, can find that these two values are not identical, in fact their similarity is very high, in order to allow the very high color of similarity generate identical colouring information, and then generates identical picture fingerprint, can close Color pair required same value, so need to process rgb value.Algorithm respectively R, G, B tri-is worth divided by 8 round numbers, if the rgb value obtained is identical, so illustrates that its primitive color is very close.The color obtained like this is the color after obfuscation, and it will generate identical colouring information.
Such as: RGB={255, the color that 0,0} represents is red, and the color that RGB={253,0,0} represent also is red.Although rgb value is unequal, these two kinds of colors are very approximate, and naked eyes almost cannot differentiate their difference.In order to make it generate identical colouring information, need to carry out RGB Fuzzy processing, algorithm is that two rgb values drawn are all RGB={16,0,0} to R value divided by 8 round numbers.Rgb value after Fuzzy processing is identical, just can generate same colouring information.
Step 20143, using the litura information of the coordinate figure of the rgb value after each pixel process described and described pixel place picture as this pixel.
Concrete, image is all made up of pixel, each pixel has a unique positional information in described picture, described positional information shows with the form of coordinate, the picture extracted from search engine as escribed above becomes 640*480 through the adjustment of resolution, each pixel of so described picture just can regard each point in the coordinate system be made up of 640 transverse axis coordinates and 480 ordinate of orthogonal axes as, and therefore each pixel just has a coordinate to determine its position in described picture.These group data of rgb value after the positional information of described pixel and described Fuzzy processing can form the litura information of described pixel.
Step 2015, generate the finger print information of described picture;
Concrete, obtain all litura information of described picture prospect, and generate set using the finger print information as described picture according to described all litura information.
Step 2016, generate the fingerprint index data of described picture;
Concrete, described finger print information is converted to MD5 code using the fingerprint index data as described picture, picture can be made like this when individual element Point matching, and the result of coupling is more accurate.And regeneration finger print information after carrying out Fuzzy processing, also can prevent the nuance in the color because picture exists, brightness from causing undetected problem.
Step 2017, by the fingerprint index data of the picture of pre-stored stored in index data base;
Concrete, by the fingerprint index data of the picture of pre-stored, and the chained address corresponding stored of described picture is in the index data base in search engine.
The picture that step 2018, the request of acquisition are searched for;
Concrete, searchers sends the picture of request search to search engine, so that search engine will obtain the fingerprint index data of picture and search in index data base after picture processing.
Step 2019, obtain the fingerprint index data of described picture according to the picture of described request search.
Concrete, the picture of the request search that user interface receives, first need to be carried out technical finesse, its method is identical with step 2012-2016, that is: described picture is revised as default resolution, and Edge contrast is carried out to extract described picture prospect to described picture; Extract the rgb value of described each pixel of picture prospect; And the rgb value of each pixel of the described picture prospect extracted is carried out Fuzzy processing; The method of Fuzzy processing is: respectively R, G, B tri-be worth divided by preset value and get the integer-bit of result; Using the litura information of the coordinate figure of the rgb value after each pixel Fuzzy processing and described pixel place picture as described pixel.
Step 202, by described request search for the fingerprint index data of picture mate with the fingerprint index data of the picture of pre-stored, if there is the picture of coupling, then obtain the picture of described coupling.
Concrete implementation step is as follows:
The fingerprint index data of the picture of step 2021, the search of acquisition described request;
Step 2022, obtain the fingerprint index data of the picture of the pre-stored in described index data base;
Step 2023, by described request search for the fingerprint index data of picture mate with the fingerprint index data of the picture of described pre-stored, if there is the picture of coupling, then obtains the link of described picture and correspondence thereof and show; If no, then step terminates.
Concrete, search for the fingerprint index data of the picture stored in the fingerprint index data of described picture and index data base, the picture matched and its chained address are returned to user interface in order, then the Search Results received is shown to searchers in the form of a web page.
In invention the present embodiment, search engine is in order to meet the specific demand of searchers, when cannot with text description pictorial information or with the result of text description too magnanimity, the picture that the request that the picture of storage and searchers are submitted to is searched for is processed, contrast picture can mated completely like this, instead of the mode that traditional use text description carries out picture searching, search engine is found meet the Search Results of searchers's intention, improve the efficiency of search engine search pictures.
Embodiment 3
The embodiment of the present invention proposes a kind of image searching system, and its structure as shown in Figure 3, comprising:
Acquisition module, for carrying out processing by the picture of the picture of pre-stored, request search the fingerprint index data obtaining described picture;
Matching module, mates with the fingerprint index data of the picture of described pre-stored for the fingerprint index data of picture of described request being searched for, if there is the picture of coupling, then obtains described coupling picture.
In invention the present embodiment, search engine is in order to meet the specific demand of searchers, when cannot with text description pictorial information or with the result of text description too magnanimity, the picture of pre-stored is processed with asking the picture searched for, search picture can mated completely like this, instead of the mode that traditional use text description carries out picture searching, search engine is found meet the Search Results of searchers's intention, improve the efficiency of search engine search pictures.
Embodiment 4
Fourth embodiment of the invention improves on the basis of the 3rd embodiment, and its structure as shown in Figure 4, comprising:
Acquisition module, for carrying out processing by the picture of the picture of pre-stored, request search the fingerprint index data obtaining described picture;
Wherein, acquisition module 1 can specifically comprise:
Amendment unit 11, for described picture is revised as default resolution, and carries out Edge contrast to extract described picture prospect to described picture;
The photo resolution stored in search engine is not monolithic, for the ease of calculating the litura information of all pictures, first needs to carry out unitized process to the resolution of picture.Such as: can be the size of 640*480 the resolution adjustment of all pictures.The picture all resolution being less than to 640*480 carries out expansion process, and the picture all resolution being greater than to 640*480 carries out reducing process, and finally all picture unified resolution are 640*480.
The essence of Edge contrast is the contrast increasing image detail edge, and strengthen the edge of picture, these eyes contributing to us see image detail clearly, thus the distinctness that the edge of target object is become, picture are clear.After sharpening, the edge of picture prospect is given prominence to, and its prospect be separated with background, object removes unessential background information, so that carry out the calculating of picture prospect litura information.Wherein, the method for Edge contrast and extraction picture perspective process is all prior art, does not make restriction in the embodiment of the present invention to this.
Fuzzy Processing unit 12, for extracting the rgb value of described each pixel of picture prospect, being worth R, G, B tri-divided by preset value respectively and getting the integer-bit of result;
Concrete, calculate described picture prospect litura information; That is: first the rgb value of each pixel of described picture prospect will be extracted, then the rgb value of described pixel is carried out Fuzzy processing, and by the position coordinates of the rgb value of each pixel after Fuzzy processing and described pixel, as the litura information of described pixel.Concrete, can will add the position coordinates of described pixel before the rgb value of each pixel after described Fuzzy processing, namely form the litura information of described pixel.
In a specific embodiment of the present invention, the litura information of picture can be calculated in the following manner:
Extract the rgb value of each pixel of described picture prospect;
Concrete, rgb color pattern is the intensity level distributed for the RGB component of each pixel in image within the scope of a 0-255.RGB image only uses three kinds of colors, them just can be made according to the mixing of different ratios, screen reappears 16777216 kinds of colors.
The rgb value of extraction is carried out Fuzzy processing;
Concrete, the rgb value extracted needs to carry out Fuzzy processing.Sometimes two kinds of colors are very close, naked eyes cannot distinguish this two kinds of colors, but the rgb value of these two kinds of colors of extracting directly when computer disposal, can find that these two values are not identical, in fact their similarity is very high, in order to allow the very high color of similarity generate identical colouring information, and then generates identical picture fingerprint, can close Color pair required same value, so need to process rgb value.Algorithm respectively R, G, B tri-is worth divided by 8 round numbers, if the rgb value obtained is identical, so illustrates that its primitive color is very close.The color obtained like this is the color after obfuscation, and it will generate identical colouring information.
Such as: RGB={255, the color that 0,0} represents is red, and the color that RGB={253,0,0} represent also is red.Although rgb value is unequal, these two kinds of colors are very approximate, and naked eyes almost cannot differentiate their difference.In order to make it generate identical colouring information, need to carry out RGB Fuzzy processing, algorithm is that two rgb values drawn are all RGB={16,0,0} to R value divided by 8 round numbers.Rgb value after Fuzzy processing is identical, just can generate same colouring information.
Using the litura information of the coordinate figure of the rgb value after each pixel process described and described pixel place picture as this pixel.
Concrete, image is all made up of pixel, each pixel has a unique positional information in described picture, described positional information shows with the form of coordinate, the picture extracted from search engine as escribed above becomes 640*480 through the adjustment of resolution, each pixel of so described picture just can regard each point in the coordinate system be made up of 640 transverse axis coordinates and 480 ordinate of orthogonal axes as, and therefore each pixel just has a coordinate to determine its position in described picture.These group data of rgb value after the positional information of described pixel and described Fuzzy processing can form the litura information of described pixel.
Generation unit 13, for generating the litura information of this pixel by the coordinate figure of the rgb value after each pixel process described and described pixel place picture;
Fingerprint index data generating unit 14, for generating the fingerprint index data of the picture of pre-stored, the picture of request search according to described litura information.
Concrete, fingerprint index data generating unit 14 can be specially, its structure as shown in Figure 5:
Finger print information subelement 141, generates finger print information for the litura information according to each pixel described;
Concrete, finger print information subelement for obtaining the litura information of described each pixel of picture prospect, and generates set using the finger print information as described picture according to the litura information of each pixel described.
Data genaration subelement 142, for calculating the fingerprint index data of the picture of described pre-stored, the picture of request search according to the finger print information of each pixel described.
Concrete, data genaration subelement is used for converting described finger print information to MD5 code using the fingerprint index data as described picture.
Matching module 2, mates with the fingerprint index data of the picture of described pre-stored for the fingerprint index data of picture of described request being searched for, if there is the picture of coupling, then obtains described coupling picture.
Concrete, the fingerprint index data of picture of request search are mated with the fingerprint index data of the picture of described pre-stored, the picture matched and its chained address are returned to user interface in order, then the Search Results received is shown to searchers in the form of a web page.
The system of the embodiment of the present invention third and fourth embodiment, conceives identical with principle with the method for aforesaid first and second embodiments, therefore repeats no more the part identical with the first and second embodiments in the third and fourth embodiment.
The all or part of of the technique scheme that the embodiment of the present invention provides can have been come by the hardware that programmed instruction is relevant, described program can be stored in the storage medium that can read, and described storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.