CN109242750A - Picture signature method, picture match method, apparatus, equipment and storage medium - Google Patents

Picture signature method, picture match method, apparatus, equipment and storage medium Download PDF

Info

Publication number
CN109242750A
CN109242750A CN201810920819.8A CN201810920819A CN109242750A CN 109242750 A CN109242750 A CN 109242750A CN 201810920819 A CN201810920819 A CN 201810920819A CN 109242750 A CN109242750 A CN 109242750A
Authority
CN
China
Prior art keywords
picture
grid block
bright dark
signature
gray average
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810920819.8A
Other languages
Chinese (zh)
Other versions
CN109242750B (en
Inventor
徐乐乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810920819.8A priority Critical patent/CN109242750B/en
Publication of CN109242750A publication Critical patent/CN109242750A/en
Application granted granted Critical
Publication of CN109242750B publication Critical patent/CN109242750B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0061Embedding of the watermark in each block of the image, e.g. segmented watermarking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention discloses a kind of picture signature method, picture match method, apparatus, equipment and storage medium, the picture signature method includes: that picture to be signed is divided into the identical grid block of setting population size;Dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm;Calculate the gray average of each grid block;The bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average;Bright dark contrast between each grid block and grid block adjacent thereto is determined as to the signature of the picture to be signed.By using above-mentioned technical proposal, the characteristics of image being effectively extracted in picture, and described image feature has been subjected to digitized representations, the vectorization for realizing picture indicates.

Description

Picture signature method, picture match method, apparatus, equipment and storage medium
Technical field
The present embodiments relate to picture searching technical field more particularly to a kind of picture signature methods, picture match side Method, device, equipment and storage medium.
Background technique
With the fast development of e commerce transactions, the commodity category in e commerce transactions system is also increasingly wider, according to incomplete system Meter, up to 100,000 kinds of the commodity category in e commerce transactions system, therefore, in e commerce transactions system can be stored with a large amount of point at present The commodity picture of the other class of door.Due to the increase of commodity category, user is difficult to accomplish to identify each commodity category, in general, User possesses commodity picture, does not know the title of corresponding goods but, so as to cause user can not fast search to desired commodity.
Summary of the invention
The embodiment of the present invention provides a kind of picture signature method, picture match method, apparatus, equipment and storage medium, with Target Photo is rapidly searched for by the signature of picture.
To achieve the above object, the embodiment of the present invention adopts the following technical scheme that
In a first aspect, the embodiment of the invention provides a kind of picture signature methods, which comprises
Picture to be signed is divided into the identical grid block of setting population size;
Calculate the gray average of each grid block;
The bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average;
Bright dark contrast between each grid block and grid block adjacent thereto is determined as the picture to be signed Signature.
It is further, described that picture to be signed is divided into before the identical grid block of setting population size, further includes:
The picture to be signed is cut based on preset rules;
It is corresponding, it is described that picture to be signed is divided into the identical grid block of setting population size specifically:
Picture to be signed after cutting is divided into the identical grid block of setting population size;
Wherein, the corresponding coordinate points of each grid block are integers.
Further, before the gray average for calculating each grid block, further includes:
Dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm;
Wherein, the corresponding picture element matrix of the picture to be signed includes that each pixel is logical in three colors of red, green, blue respectively Component on road.
It is further, described that dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm, Include:
Operation is carried out to each pixel according to following formula:
Y=0.2005*R+0.7254*G+0.0741*B
Wherein, Y indicates the characteristic value of single pixel, and R indicates that component of the single pixel on red channel, G indicate single Component of the pixel on green channel, B indicate component of the single pixel on blue channel.
Further, the gray average for calculating each grid block, comprising:
The size of the grid block is calculated based on following formula:
P=max 3 | 0.5+min { n, m }/20 }
The sum of all pixels that each grid block includes is counted according to the size of the grid block;
Using in each grid block pixel value and sum of all pixels calculate the gray average of each grid block;
Wherein, P indicates the size of the grid block, and m and n respectively indicate the horizontal and vertical pixel number of picture to be signed Amount.
Further, it is described determined based on the gray average it is bright between each grid block and grid block adjacent thereto Dark contrast, comprising:
Calculate the difference between the gray average of current grid block and the gray average of each grid block adjacent thereto;
The bright dark comparison threshold value section between current grid block and each grid block adjacent thereto is determined according to the difference;
Each grid block and adjacent thereto is determined according to the relationship between the difference and the bright dark comparison threshold value section Grid block between bright dark contrast.
Further, it is described determined according to the difference it is bright dark between current grid block and each grid block adjacent thereto Comparison threshold value section, comprising:
The first subordinate ordered array is formed using the difference greater than 0;
Calculate the median of first subordinate ordered array;
The section of maximum value and median composition in first subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and first subordinate ordered array is determined as bright dark comparison by dark threshold interval For dark threshold interval;
The second subordinate ordered array is formed using the difference less than 0;
Calculate the median of second subordinate ordered array;
The section of maximum value and median composition in second subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and second subordinate ordered array is determined as bright dark comparison by bright threshold interval For bright threshold interval.
Further, the relationship according to the difference between the bright dark comparison threshold value section determines each grid Bright dark contrast between block and grid block adjacent thereto, comprising:
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the first setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Second setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Third setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the 4th setting value;
If difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is exhausted Preset value is less than to value, it is determined that current grid block is identical as the bright dark degree of the specifiable lattice block, current grid block and institute Stating the bright dark contrast between specifiable lattice block is the 5th setting value.
Further, the bright dark contrast by between each grid block and grid block adjacent thereto is determined as described The signature of picture to be signed, comprising:
By the bright dark contrast between each grid block and grid block adjacent thereto according to default splicing sequential concatenation at One one-dimensional vector;
The one-dimensional vector is determined as to the signature of the picture to be signed.
Second aspect, the embodiment of the invention provides a kind of picture match method, every picture to be matched has according to upper The picture signature of the acquisition of picture signature method described in first aspect is stated, the picture match method includes:
Obtain template picture;
The similarity between the template picture and picture to be matched is calculated based on picture signature;
It is similar with the template picture according to the size relation determination between the similarity and setting similarity threshold Target Photo.
Further, the similarity for calculating picture signature between the template picture and every picture to be matched, packet It includes:
The similarity between the template picture and picture to be matched is calculated based on picture signature according to following formula:
Wherein, d indicates the similarity of the picture signature between template picture and picture to be matched, and u indicates template picture Picture signature, v indicate the picture signature of picture to be matched.
The third aspect, the embodiment of the invention provides a kind of picture signature device, described device includes:
Division module, for picture to be signed to be divided into the identical grid block of setting population size;
Computing module, for calculating the gray average of each grid block;
Determining module, it is bright between each grid block and grid block adjacent thereto for being determined based on the gray average Dark contrast;
Signature blocks, it is described for the bright dark contrast between each grid block and grid block adjacent thereto to be determined as The signature of picture to be signed.
Fourth aspect, the embodiment of the invention provides a kind of picture match device, every picture to be matched has according to upper The picture signature of the acquisition of picture signature method described in first aspect is stated, the picture match device includes:
Module is obtained, for obtaining template picture;
Similarity calculation module, it is similar between the template picture and picture to be matched for being calculated based on picture signature Degree;
Target Photo determining module, for being determined according to the size relation between the similarity and setting similarity threshold Target Photo similar with the template picture.
5th aspect the embodiment of the invention provides a kind of electronic equipment, including memory, processor and is stored in storage On device and the computer program that can run on a processor, the processor realizes such as above-mentioned the when executing the computer program Picture signature method described in one side and the picture match method as described in above-mentioned second aspect.
6th aspect, the embodiment of the invention provides a kind of storage medium comprising computer executable instructions, the meters Calculation machine executable instruction realized when being executed as computer processor picture signature method as described in above-mentioned first aspect and Picture match method as described in above-mentioned second aspect.
A kind of picture signature method provided in an embodiment of the present invention, by the way that picture to be signed is divided into setting population size Identical grid block;Calculate the gray average of each grid block;Based on the gray average determine each grid block and with Bright dark contrast between its adjacent grid block;By the bright dark contrast between each grid block and grid block adjacent thereto It is determined as the technological means of the signature of the picture to be signed, realizes and quickly treat the purpose that signature picture completes signature.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, institute in being described below to the embodiment of the present invention Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the invention Example, for those of ordinary skill in the art, without creative efforts, can also implement according to the present invention The content of example and these attached drawings obtain other attached drawings.
Fig. 1 is a kind of picture signature method flow schematic diagram that the embodiment of the present invention one provides;
Fig. 2 is that a kind of be divided into picture to be signed that the embodiment of the present invention one provides sets the identical grid of population size The schematic diagram of block;
Fig. 3 is a kind of picture signature method flow schematic diagram provided by Embodiment 2 of the present invention;
Fig. 4 is a kind of picture match method flow schematic diagram that the embodiment of the present invention three provides;
Fig. 5 is a kind of picture signature apparatus structure schematic diagram that the embodiment of the present invention four provides;
Fig. 6 is a kind of picture match apparatus structure schematic diagram that the embodiment of the present invention five provides;
Fig. 7 is the structural schematic diagram for a kind of electronic equipment that the embodiment of the present invention six provides.
Specific embodiment
To keep the technical problems solved, the adopted technical scheme and the technical effect achieved by the invention clearer, below It will the technical scheme of the embodiment of the invention will be described in further detail in conjunction with attached drawing, it is clear that described embodiment is only It is a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those skilled in the art exist Every other embodiment obtained under the premise of creative work is not made, shall fall within the protection scope of the present invention.
Embodiment one
Fig. 1 is a kind of picture signature method flow schematic diagram that the embodiment of the present invention one provides, wherein picture signature is specific Refer to and the characteristics of image in picture is subjected to digitized representations, the digitized representations of characteristics of image are the label of corresponding picture in picture Name then can use matching, search etc. that picture signature carries out similar pictures by the way that picture is carried out picture signature.This implementation Picture signature method disclosed in example can be executed by picture signature device, and wherein the device can be implemented by software and/or hardware. Referring specifically to shown in Fig. 1, this method comprises the following steps:
110, picture to be signed is divided into the identical grid block of setting population size.
Wherein, picture to be signed is divided into the identical grid block of setting population size, such as specifically may is that wait sign The lateral equal part of name picture takes 9 points, while taking 9 points in the vertical equal part of picture to be signed, then the picture to be signed is drawn Be divided into the identical grid block of 10*10 size, reference can be made to it is shown in Fig. 2 by picture to be signed be divided into setting population size it is identical Grid block schematic diagram.The setting quantity can be set according to the size and business experience of specific picture to be signed It sets.
120, dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm.
Wherein, the corresponding picture element matrix of the picture to be signed includes that each pixel is logical in three colors of red, green, blue respectively Component on road.
For example, the picture to be signed for being 500*312 for a picture pixel size, corresponding picture element matrix is one The vector of 500*312*3 dimension, calculation amount is very big, in order to reduce calculation amount while not lose the characteristics of image in picture, this implementation Example carries out dimension-reduction treatment to the corresponding picture element matrix of the picture to be signed using following formula:
Y=0.2005*R+0.7254*G+0.0741*B
Wherein, Y indicates the characteristic value of single pixel, and R indicates that component of the single pixel on red channel, G indicate single Component of the pixel on green channel, B indicate component of the single pixel on blue channel;
After above-mentioned calculating, the dimension of the corresponding picture element matrix of above-mentioned picture is reduced to 500*312 from 500*312*3. The smoothing processing for treating signature picture pixels is also achieved by above-mentioned formula simultaneously, is conducive to effectively extract image in picture Characteristic improves the accuracy of picture signature.
130, the gray average of each grid block is calculated.
In general, every picture to be signed is made of red (R), green (G) and blue (B) three color value, color value range is in 0-255 Between, color value 255 represents white, and color value 0 represents black.Assuming that the pixel size of picture to be signed is 500*312, i.e., it is to be signed Picture one shares 500*312 pixel, and each pixel includes tri- sub-pixels of R, G and B again, then the corresponding picture of the picture to be signed Prime matrix is the vector of 500*312*3 dimension.
Wherein, the gray average of single grid block is calculated specifically: all pixels for including by single grid block are summed, so Afterwards using the sum acquired divided by the total number of pixel in the single grid block, gained quotient is that the gray scale of the single grid block is equal Value.
Illustratively, the gray average for calculating each grid block, comprising:
The size of the grid block is calculated based on following formula:
P=max 3 | 0.5+min { n, m }/20 }
The sum of all pixels that each grid block includes is counted according to the size of the grid block;
Using in each grid block pixel value and sum of all pixels calculate the gray average of each grid block;
Wherein, P indicates the size of the grid block, and m and n respectively indicate the horizontal and vertical pixel number of picture to be signed Amount, min { n, m } expression take the smaller value in the two, and max { n, m } indicates to take the larger value in the two.
For example, it is assumed that picture horizontal pixel quantity m=500 to be signed, longitudinal pixel quantity n=312, then describedIn engineering practice, such situation is used and is rounded up Mode round numbers, i.e., the size of each grid block is 16*16, and each grid block includes 16*16 pixel, then by grid block In pixel summation, using the sum acquired divided by 16*16, obtain the gray average of the grid block.
For example, the size of some grid block is 3*3, corresponding 3*3 picture element matrix are as follows: [[1,2,3], [1,2,3], [2,3, 4]], then the gray average avg of the grid block are as follows: avg=1+2+3+1+2+3+2+3+4/3*3=2.333.
140, the bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average.
Illustratively, it is described determined based on the gray average it is bright between each grid block and grid block adjacent thereto Dark contrast, comprising:
141, the difference between the gray average of current grid block and the gray average of each grid block adjacent thereto is calculated;
Wherein, each grid block has 8 neighbours' grid blocks adjacent thereto, and 8 neighbours' grid blocks are located at The upper left of current grid block, upper, upper right, left and right, lower-left, lower and bottom right;For the grid block of edge, if its neighbours' net Lattice block inadequate 8, then 0 is set by the gray average of the grid block of corresponding position, to guarantee each grid block and its neighbour The array length of difference composition between gray average between grid block is consistent.It is adjacent for example, see the grid block A in Fig. 2 Occupy grid block only have disposed thereon, upper right, the right side, bottom right and under five neighbours' grid blocks, in its left side, upper left, lower-left three There is no corresponding neighbours' grid block at position, then by neighbours' grid at three positions in a left side, upper left, lower-left of grid block A The gray average of block is set as 0, that is, guarantees that each grid block all has 8 neighbours' grid blocks adjacent thereto.
142, the bright dark comparison threshold value between current grid block and each grid block adjacent thereto is determined according to the difference Section;
Specifically, 5 grades can be set by the bright dark contrast between current grid block and each grid block adjacent thereto, It is respectively very dark, dark, the same, bright and very bright, the bright dark contrast can by current grid block gray average and and its Difference between the gray average of adjacent each grid block is characterized, and the absolute value of the difference is bigger, indicates two grids Bright dark contrast between block is bigger, i.e. bright dark comparison between two grid blocks becomes apparent from.
For example, the gray average of grid block a is 0.356212, the gray average of grid block b is 0.125455, current grid The gray average of block cur is 0.235453, then the difference of the gray average between current grid block cur and grid block a and grid b block It is respectively as follows: -0.120759,0.109998;- 0.120759 less than 0, indicates that current grid block cur is more darker than grid block a, 0.109998 is greater than 0, indicates that current grid block cur is brighter than grid block b, i.e. grid block b is more darker than current grid block cur.
Illustratively, it is described determined according to the difference it is bright dark between current grid block and each grid block adjacent thereto Comparison threshold value section, comprising:
The first subordinate ordered array is formed using the difference greater than 0;
Calculate the median of first subordinate ordered array;
The section of maximum value and median composition in first subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and first subordinate ordered array is determined as bright dark comparison by dark threshold interval For dark threshold interval;
The second subordinate ordered array is formed using the difference less than 0;
Calculate the median of second subordinate ordered array;
The section of maximum value and median composition in second subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and second subordinate ordered array is determined as bright dark comparison by bright threshold interval For bright threshold interval.
Wherein, median mid=(max-min)/2, wherein mid indicates that the median of the first subordinate ordered array, max indicate Maximum value in first subordinate ordered array, min indicate the minimum value in the first subordinate ordered array.
143, according to the relationship between the difference and the bright dark comparison threshold value section determine each grid block and and its Bright dark contrast between adjacent grid block.
Illustratively, the relationship according to the difference between the bright dark comparison threshold value section determines each grid Bright dark contrast between block and grid block adjacent thereto, comprising:
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the first setting value;First setting value for example can be -2;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Second setting value;Second setting value for example can be -1;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Third setting value;The third setting value for example can be 1;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the 4th setting value;4th setting value for example can be 2;
If difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is exhausted Preset value is less than to value, it is determined that current grid block is identical as the bright dark degree of the specifiable lattice block, current grid block and institute The bright dark contrast stated between specifiable lattice block is the 5th setting value, and the 5th setting value for example can be 0.
150, the bright dark contrast between each grid block and grid block adjacent thereto is determined as the figure to be signed The signature of piece.
Specifically, by the bright dark contrast between each grid block and grid block adjacent thereto according to default splicing sequence It is spliced into an one-dimensional vector;
The one-dimensional vector is determined as to the signature of the picture to be signed;
The default splicing sequence includes: from left to right, from top to bottom.
A kind of picture signature method that embodiment provides, being generated by the bright dark level contrast according to picture each section should The signature of picture, the characteristics of image being effectively extracted in picture, and described image feature has been subjected to digitized representations, it realizes The vectorization of picture indicates.
Embodiment two
Fig. 3 is a kind of picture signature method flow schematic diagram provided by Embodiment 2 of the present invention.In the base of above-described embodiment On plinth, the present embodiment is optimized, and the benefit of optimization is the characteristics of image that can have not only retained in picture, but also can simplify calculating Amount further improves and treats the speed that signature picture is signed.Referring specifically to shown in Fig. 3, this method comprises the following steps:
310, the picture to be signed is cut based on preset rules.
Itself typically for picture, the important content of picture itself is often in the intermediate region of picture, therefore, The preset rules can be the region for retaining the section picture transverse direction 10%-90%, retain the vertical section 10%-90% of picture Region.It is cut by treating signature picture, calculation amount can be further reduced, improve calculating speed.
320, the picture to be signed after cutting is divided into the identical grid block of setting population size.
Wherein, the corresponding coordinate points of each grid block are integers, and every picture can establish coordinate system based on pixel, The corresponding coordinate value of each pixel.Picture to be signed after to cutting is divided into the identical grid block of setting population size Afterwards, it does not ensure that the corresponding coordinate points of each grid block are integers, then the grid block after division can be finely adjusted, so that The corresponding coordinate points of each grid block are integers, for example, picture to be signed to be divided into the grid block of 10*10 for the first time, are The each grid block of guarantee corresponding coordinate points are integers, then picture to be signed can be tailored into the grid block of 9*9, fine tuning Principle is to be directed toward its nearest integer pixel point around each grid block.
330, dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm.
340, the gray average of each grid block is calculated.
350, the bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average.
Assuming that picture to be signed has been partitioned into the grid block of 9*9, since each grid block has 8 neighbours adjacent thereto Grid block is occupied, therefore the bright dark contrast matrix of 9*9*8 dimension, bright dark comparison can be obtained after the calculating for passing through step 350 Spend matrix in each element value range be [- 2, -1,0,1,2], according to grid block position from left to right, from top to bottom Sequence, the vector of each element in bright dark contrast matrix, that is, 9*9*8 dimension is spliced into the vector of 1*648 dimension, and Using the vector as the signature of picture to be signed.
360, the bright dark contrast between each grid block and grid block adjacent thereto is determined as the figure to be signed The signature of piece.
A kind of picture signature method provided in this embodiment, by under the premise of not losing picture feature, according to picture Characteristic cuts picture, effectively reduces calculation amount, real by being handled using empirical equation the pixel in picture The purpose to picture pixels matrix dimensionality reduction is showed, has further reduced calculation amount, improved calculating speed, to realize raising The speed of picture signature.
Embodiment three
Fig. 4 is a kind of picture match method that the embodiment of the present invention three provides.Wherein, every picture to be matched have according to The picture signature that picture signature method described in above-described embodiment obtains.Shown in Figure 4, the picture match method includes such as Lower step:
410, template picture is obtained.
Wherein, the template picture can be the picture of user's input.
420, the similarity between the template picture and picture to be matched is calculated based on picture signature.
Specifically, can be calculated between the template picture and picture to be matched according to following formula based on picture signature Similarity:
Wherein, d indicates the similarity of the picture signature between template picture and picture to be matched, and u indicates template picture Picture signature, v indicate the picture signature of picture to be matched, | | v | | indicate the mould of picture signature.
Such as assume the picture signature u=[0 000100100 0-1-1-1 1-1 of the template picture 0 0 0 1 2 1 0 2 0 0 0 -2 -1 -2 1 1 0 0 0 1 -2 2 2 -1 0 0 0 2 2 2 2 2 0 0 0 -2 -2 -1 2 -1 0 0 0 2 2 2 1 2 0 0 0 -2 0 -2 1 0 0 0 1 0 1 0 -1 1 -1 -1 -1 -1];To Match the picture signature v=[0 000101100 0-1 201200 0-2-2-2-1 10 of picture 0 0 2 -2 2 2 -2 0 0 0 2 -1 2 1 1 0 0 0 1 2 1 1 2 0 0 0 -2 -2 -2 -2 -1 0 0 0 2 1-2 2100 0-1 0 1-1 0 0-1 00101 2-1-1 2-1],
The then similarity between template picture and picture to be matched are as follows:
430, according to the size relation determination and the template picture phase between the similarity and setting similarity threshold As Target Photo.
The setting similarity threshold can rule of thumb or specifically service conditions is configured, when the similarity is big In the setting similarity threshold, it is determined that current matching picture is Target Photo similar with the template picture, otherwise, really Determining current matching picture not is Target Photo similar with the template picture.
Picture match method provided in this embodiment is mentioned by being calculated the similarity between two pictures based on picture signature High picture match speed and accuracy, solve the problems, such as that relying on the mode manually compared searches similar pictures.
Example IV
Fig. 5 is a kind of structural schematic diagram for picture signature device that the embodiment of the present invention four provides, shown in Figure 5, institute Stating device includes: division module 510, computing module 520, determining module 530 and signature blocks 540;
Wherein, division module 510, for picture to be signed to be divided into the identical grid block of setting population size;
Computing module 520, for calculating the gray average of each grid block;
Determining module 530, for being determined between each grid block and grid block adjacent thereto based on the gray average Bright dark contrast;
Signature blocks 540, for the bright dark contrast between each grid block and grid block adjacent thereto to be determined as The signature of the picture to be signed.
Further, described device further includes cutting module, for picture to be signed to be divided into setting population size Before identical grid block, the picture to be signed is cut based on preset rules;
Corresponding, division module 510 is used to for the picture to be signed after cutting to be divided into the identical net of setting population size Lattice block;Wherein, the corresponding coordinate points of each grid block are integers.
Further, described device further includes dimensionality reduction module, for the gray average for calculating each grid block it Before, dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm;
Wherein, the corresponding picture element matrix of the picture to be signed includes that each pixel is logical in three colors of red, green, blue respectively Component on road.
Further, the dimensionality reduction module is specifically used for
Operation is carried out to each pixel according to following formula:
Y=0.2005*R+0.7254*G+0.0741*B
Wherein, Y indicates the characteristic value of single pixel, and R indicates that component of the single pixel on red channel, G indicate single Component of the pixel on green channel, B indicate component of the single pixel on blue channel.
Further, computing module 520 is specifically used for:
The size of the grid block is calculated based on following formula:
P=max 3 | 0.5+min { n, m }/20 }
The sum of all pixels that each grid block includes is counted according to the size of the grid block;
Using in each grid block pixel value and sum of all pixels calculate the gray average of each grid block;
Wherein, P indicates the size of the grid block, and m and n respectively indicate the horizontal and vertical pixel number of picture to be signed Amount.
Further, determining module 530, comprising:
Difference computational unit, for calculate current grid block gray average and each grid block adjacent thereto gray scale it is equal Difference between value;
Threshold interval determination unit, for according to the difference determine current grid block and each grid block adjacent thereto it Between bright dark comparison threshold value section;
Bright dark contrast determination unit, for true according to the relationship between the difference and the bright dark comparison threshold value section Bright dark contrast between fixed each grid block and grid block adjacent thereto.
Further, the threshold interval determination unit is specifically used for:
The first subordinate ordered array is formed using the difference greater than 0;
Calculate the median of first subordinate ordered array;
The section of maximum value and median composition in first subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and first subordinate ordered array is determined as bright dark comparison by dark threshold interval For dark threshold interval;
The second subordinate ordered array is formed using the difference less than 0;
Calculate the median of second subordinate ordered array;
The section of maximum value and median composition in second subordinate ordered array is determined as bright dark comparison as very The section of minimum value composition in the median and second subordinate ordered array is determined as bright dark comparison by bright threshold interval For bright threshold interval.
Further, the bright dark contrast determination unit is specifically used for:
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the first setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Second setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is Third setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is fallen in The bright dark comparison is very bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block For the 4th setting value;
If difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto is exhausted Preset value is less than to value, it is determined that current grid block is identical as the bright dark degree of the specifiable lattice block, current grid block and institute Stating the bright dark contrast between specifiable lattice block is the 5th setting value.
Further, signature blocks 540 include:
Concatenation unit, for by the bright dark contrast between each grid block and grid block adjacent thereto according to default spelling Sequential concatenation is connect into an one-dimensional vector;
Signature unit, for the one-dimensional vector to be determined as to the signature of the picture to be signed.
A kind of picture signature device that embodiment provides, being generated by the bright dark level contrast according to picture each section should The signature of picture, the characteristics of image being effectively extracted in picture, and described image feature has been subjected to digitized representations, it realizes The vectorization of picture indicates.
Embodiment five
Fig. 6 is a kind of structural schematic diagram for picture match device that the embodiment of the present invention five provides, every picture to be matched It is shown in Figure 6 with the picture signature obtained according to picture signature method described in above-described embodiment, the picture match dress Set includes: to obtain module 610, similarity calculation module 620 and Target Photo determining module 630;
Wherein, module 610 is obtained, for obtaining template picture;Similarity calculation module 620, for being based on picture signature Calculate the similarity between the template picture and picture to be matched;Target Photo determining module 630, for according to described similar Size relation between degree and setting similarity threshold determines Target Photo similar with the template picture.
Further, similarity calculation module 620 is specifically used for: according to following formula calculate the template picture with to Similarity with picture signature between picture:
Wherein, d indicates the similarity of the picture signature between template picture and picture to be matched, and u indicates template picture Picture signature, v indicate the picture signature of picture to be matched.
Picture match device provided in this embodiment is mentioned by being calculated the similarity between two pictures based on picture signature High picture match speed and accuracy, solve the problems, such as that relying on the mode manually compared searches similar pictures.
Embodiment six
Fig. 7 is the structural schematic diagram for a kind of electronic equipment that the embodiment of the present invention six provides.As shown in fig. 7, the electronics is set It is standby to include: processor 670, memory 671 and be stored in the computer journey that run on memory 671 and on processor 670 Sequence;Wherein, the quantity of processor 670 can be one or more, in Fig. 7 by taking a processor 670 as an example;Processor 670 is held The picture signature method as described in above-described embodiment one is realized when the row computer program.As shown in figure 5, the electronics is set Standby can also include input unit 672 and output device 673.Processor 670, memory 671, input unit 672 and output dress Setting 673 can be connected by bus or other modes, in Fig. 7 for being connected by bus.
Memory 671 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computer Sequence and module, if picture signature device/module in the embodiment of the present invention or picture match device/module are (for example, picture label Division module 510 in name device or the acquisition module 610 in picture match device etc.).Processor 670 passes through operation storage Software program, instruction and module in memory 671, at the various function application and data of electronic equipment Reason, that is, realize above-mentioned picture signature method.
Memory 671 can mainly include storing program area and storage data area, wherein storing program area can store operation system Application program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.This Outside, memory 671 may include high-speed random access memory, can also include nonvolatile memory, for example, at least one Disk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 671 can be into one Step includes the memory remotely located relative to processor 670, these remote memories can be set by network connection to electronics Standby/storage medium.The example of above-mentioned network include but is not limited to internet, intranet, local area network, mobile radio communication and its Combination.
Input unit 672 can be used for receiving the number or character information of input, and generates and set with the user of electronic equipment It sets and the related key signals of function control inputs.Output device 673 may include that display screen etc. shows equipment.
Embodiment seven
The embodiment of the present invention seven also provides a kind of storage medium comprising computer executable instructions, and the computer can be held Row instruction is used to execute a kind of picture signature method when being executed by computer processor, this method comprises:
Picture to be signed is divided into the identical grid block of setting population size;
Calculate the gray average of each grid block;
The bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average;
Bright dark contrast between each grid block and grid block adjacent thereto is determined as the picture to be signed Signature.
The computer executable instructions are also used to execute when being executed a kind of picture match method by computer processor, This method comprises:
Obtain template picture;
Calculate the similarity of picture signature between the template picture and picture to be matched;
It is similar with the template picture according to the size relation determination between the similarity and setting similarity threshold Target Photo.
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present invention The method operation that executable instruction is not limited to the described above, can also be performed picture signature provided by any embodiment of the invention And the relevant operation of picture match.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present invention It can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is more Good embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior art Part can be embodied in the form of software products, which can store in computer readable storage medium In, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computer Access Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is set Standby (can be personal computer, storage medium or the network equipment etc.) executes described in each embodiment of the present invention.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. a kind of picture signature method characterized by comprising
Picture to be signed is divided into the identical grid block of setting population size;
Dimension-reduction treatment is carried out to the corresponding picture element matrix of the picture to be signed according to preset algorithm;
Calculate the gray average of each grid block;
The bright dark contrast between each grid block and grid block adjacent thereto is determined based on the gray average;
Bright dark contrast between each grid block and grid block adjacent thereto is determined as to the signature of the picture to be signed;
Wherein, the corresponding picture element matrix of the picture to be signed includes each pixel respectively on three Color Channels of red, green, blue Component.
2. the method according to claim 1, wherein described corresponding to the picture to be signed according to preset algorithm Picture element matrix carry out dimension-reduction treatment, comprising:
Operation is carried out to each pixel according to following formula:
Y=0.2005*R+0.7254*G+0.0741*B
Wherein, Y indicates the characteristic value of single pixel, and R indicates that component of the single pixel on red channel, G indicate single pixel Component on green channel, B indicate component of the single pixel on blue channel;
The gray average for calculating each grid block, comprising:
The size of the grid block is calculated based on following formula:
P=max 3 | 0.5+min { n, m }/20 }
The sum of all pixels that each grid block includes is counted according to the size of the grid block;
Using in each grid block pixel value and sum of all pixels calculate the gray average of each grid block;
Wherein, P indicates the size of the grid block, and m and n respectively indicate the horizontal and vertical pixel quantity of picture to be signed.
3. the method according to claim 1, wherein it is described based on the gray average determine each grid block and Bright dark contrast between grid block adjacent thereto, comprising:
Calculate the difference between the gray average of current grid block and the gray average of each grid block adjacent thereto;
The bright dark comparison threshold value section between current grid block and each grid block adjacent thereto is determined according to the difference;
Each grid block and net adjacent thereto are determined according to the relationship between the difference and the bright dark comparison threshold value section Bright dark contrast between lattice block.
4. according to the method described in claim 3, it is characterized in that, it is described according to the difference determine current grid block and and its Bright dark comparison threshold value section between adjacent each grid block, comprising:
The first subordinate ordered array is formed using the difference greater than 0;
Calculate the median of first subordinate ordered array;
It is very dark that the section of maximum value and median composition in first subordinate ordered array, which is determined as bright dark comparison, Threshold interval, it is dark that the section of the minimum value composition in the median and first subordinate ordered array, which is determined as bright dark comparison, Threshold interval;
The second subordinate ordered array is formed using the difference less than 0;
Calculate the median of second subordinate ordered array;
It is very bright that the section of maximum value and median composition in second subordinate ordered array, which is determined as bright dark comparison, Threshold interval, it is bright that the section of the median and the minimum value composition in second subordinate ordered array, which is determined as bright dark compare, Threshold interval.
5. according to the method described in claim 4, it is characterized in that, described according to the difference and Liang An comparison threshold value area Between between relationship determine the bright dark contrast between each grid block and grid block adjacent thereto, comprising:
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto falls in described Bright dark comparison is very dark threshold interval, it is determined that bright dark contrast between current grid block and the specifiable lattice block is the One setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto falls in described Bright dark comparison is dark threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is second Setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto falls in described Bright dark comparison is bright threshold interval, it is determined that the bright dark contrast between current grid block and the specifiable lattice block is third Setting value;
If the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto falls in described Bright dark comparison is very bright threshold interval, it is determined that bright dark contrast between current grid block and the specifiable lattice block is the Four setting values;
If the absolute value of the difference between the gray average of current grid block and the gray average of specifiable lattice block adjacent thereto Less than preset value, it is determined that current grid block is identical as the bright dark degree of the specifiable lattice block, current grid block and the spy Determining the bright dark contrast between grid block is the 5th setting value.
6. method according to claim 1-5, which is characterized in that described by each grid block and adjacent thereto Bright dark contrast between grid block is determined as the signature of the picture to be signed, comprising:
By the bright dark contrast between each grid block and grid block adjacent thereto according to default splicing sequential concatenation at one One-dimensional vector;
The one-dimensional vector is determined as to the signature of the picture to be signed.
7. a kind of picture match method, which is characterized in that every picture to be matched has according to any one of the claims 1-6 The picture signature that the picture signature method obtains, the picture match method include:
Obtain template picture;
The similarity between the template picture and picture to be matched is calculated based on picture signature;
Target similar with the template picture is determined according to the size relation between the similarity and setting similarity threshold Picture.
8. the method according to the description of claim 7 is characterized in that described calculate the template picture and every picture to be matched Between picture signature similarity, comprising:
The similarity between the template picture and picture to be matched is calculated based on picture signature according to following formula:
Wherein, d indicates the similarity of the picture signature between template picture and picture to be matched, and u indicates the picture of template picture Signature, v indicate the picture signature of picture to be matched.
9. a kind of picture signature device characterized by comprising
Division module, for picture to be signed to be divided into the identical grid block of setting population size;
Computing module, for calculating the gray average of each grid block;
Determining module is bright dark right between each grid block and grid block adjacent thereto for being determined based on the gray average Degree of ratio;
Signature blocks, it is described wait sign for the bright dark contrast between each grid block and grid block adjacent thereto to be determined as The signature of name picture.
10. a kind of electronic equipment including memory, processor and stores the calculating that can be run on a memory and on a processor Machine program, which is characterized in that the processor is realized as described in any one of claim 1-6 when executing the computer program Picture signature method and the picture match method as described in any one of claim 7-8.
CN201810920819.8A 2018-08-14 2018-08-14 Picture signature method, picture matching method, device, equipment and storage medium Active CN109242750B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810920819.8A CN109242750B (en) 2018-08-14 2018-08-14 Picture signature method, picture matching method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810920819.8A CN109242750B (en) 2018-08-14 2018-08-14 Picture signature method, picture matching method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109242750A true CN109242750A (en) 2019-01-18
CN109242750B CN109242750B (en) 2023-03-21

Family

ID=65071243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810920819.8A Active CN109242750B (en) 2018-08-14 2018-08-14 Picture signature method, picture matching method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109242750B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110736751A (en) * 2019-11-06 2020-01-31 上海御微半导体技术有限公司 surface defect detection method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070078846A1 (en) * 2005-09-30 2007-04-05 Antonino Gulli Similarity detection and clustering of images
CN101859320A (en) * 2010-05-13 2010-10-13 复旦大学 Massive image retrieval method based on multi-characteristic signature
CN102955784A (en) * 2011-08-19 2013-03-06 北京百度网讯科技有限公司 Equipment and method for judging similarity of various images on basis of digital signatures
CN103116628A (en) * 2013-01-31 2013-05-22 新浪网技术(中国)有限公司 Image file digital signature and judgment method and judgment device of repeated image file
US8644607B1 (en) * 2012-11-01 2014-02-04 DeepMind Technologies Method and apparatus for image processing
US8666152B1 (en) * 2009-12-04 2014-03-04 Zeitera, Llc Digital video content fingerprinting using image pixel intensity and color information

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070078846A1 (en) * 2005-09-30 2007-04-05 Antonino Gulli Similarity detection and clustering of images
US8666152B1 (en) * 2009-12-04 2014-03-04 Zeitera, Llc Digital video content fingerprinting using image pixel intensity and color information
CN101859320A (en) * 2010-05-13 2010-10-13 复旦大学 Massive image retrieval method based on multi-characteristic signature
CN102955784A (en) * 2011-08-19 2013-03-06 北京百度网讯科技有限公司 Equipment and method for judging similarity of various images on basis of digital signatures
US8644607B1 (en) * 2012-11-01 2014-02-04 DeepMind Technologies Method and apparatus for image processing
CN103116628A (en) * 2013-01-31 2013-05-22 新浪网技术(中国)有限公司 Image file digital signature and judgment method and judgment device of repeated image file

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110736751A (en) * 2019-11-06 2020-01-31 上海御微半导体技术有限公司 surface defect detection method and device
CN110736751B (en) * 2019-11-06 2022-04-19 合肥御微半导体技术有限公司 Surface defect detection method and device

Also Published As

Publication number Publication date
CN109242750B (en) 2023-03-21

Similar Documents

Publication Publication Date Title
US9483835B2 (en) Depth value restoration method and system
CN109191395B (en) Image contrast enhancement method, device, equipment and storage medium
CN107301402B (en) Method, device, medium and equipment for determining key frame of real scene
US20150016687A1 (en) Method, system and computer storage medium for face detection
CN108805023A (en) A kind of image detecting method, device, computer equipment and storage medium
CN106650615B (en) A kind of image processing method and terminal
KR101570290B1 (en) Image processing apparatus, image processing method, image processing control program and recording medium
US10249029B2 (en) Reconstruction of missing regions of images
CN104574358B (en) From the method and apparatus for focusing heap image progress scene cut
CN110807110B (en) Image searching method and device combining local and global features and electronic equipment
Cui et al. Single image dehazing by latent region‐segmentation based transmission estimation and weighted L1‐norm regularisation
US11615515B2 (en) Superpixel merging
CN114719966A (en) Light source determination method and device, electronic equipment and storage medium
Takeuchi et al. ASCII art generation using the local exhaustive search on the GPU
JP4160050B2 (en) Image search program
CN103955713A (en) Icon recognition method and device
CN109242750A (en) Picture signature method, picture match method, apparatus, equipment and storage medium
EP2966613A1 (en) Method and apparatus for generating a super-resolved image from an input image
CN113052923A (en) Tone mapping method, tone mapping apparatus, electronic device, and storage medium
JP4967045B2 (en) Background discriminating apparatus, method and program
CN104917969B (en) The method and mobile terminal of a kind of image procossing
JP2017134596A (en) Image processing method and process simulation device
Lai et al. Novel mean-shift based histogram equalization using textured regions
CN113487697A (en) Method and device for generating simple strokes, electronic equipment and storage medium
CN114792283A (en) Image processing method, device and equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant