CN103853800A - Method and device for searching target image - Google Patents
Method and device for searching target image Download PDFInfo
- Publication number
- CN103853800A CN103853800A CN201210551583.8A CN201210551583A CN103853800A CN 103853800 A CN103853800 A CN 103853800A CN 201210551583 A CN201210551583 A CN 201210551583A CN 103853800 A CN103853800 A CN 103853800A
- Authority
- CN
- China
- Prior art keywords
- subimage
- target image
- target
- target subimage
- relative displacement
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 82
- 238000006243 chemical reaction Methods 0.000 claims abstract description 34
- 239000011159 matrix material Substances 0.000 claims abstract description 17
- 238000006073 displacement reaction Methods 0.000 claims description 57
- 230000008878 coupling Effects 0.000 claims description 16
- 238000010168 coupling process Methods 0.000 claims description 16
- 238000005859 coupling reaction Methods 0.000 claims description 16
- 238000012856 packing Methods 0.000 claims description 4
- 230000007547 defect Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 32
- 238000013507 mapping Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000012958 reprocessing Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000013011 mating Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/58—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F16/583—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
- G06F16/5838—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using colour
Landscapes
- Engineering & Computer Science (AREA)
- Library & Information Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method and a device for searching a target image. The method comprises the following steps: collecting a plurality of feature points in a target subimage; converting the target image into a one-dimensional array from a two-dimensional pixel matrix, and adjusting relative offsets among the feature points corresponding to the conversion manner; searching the one-dimensional array by using the adjusted relative offsets. On one hand, the feature points are adopted for searching, thus the defects of a method for contrasting pixels frame by frame in a correlation technique can be avoided, and on the other hand, the one-dimensional array corresponding to the feature points is adopted, thus the calculated quantity in the searching can be reduced further, and the search efficiency is ensured.
Description
Technical field
The present invention relates to image processing field, be specifically related to a kind of target image searching method and device.
Background technology
At present, deepen continuously along with informationalized, people have obtained the digital object image of magnanimity.How in a width target image, to determine whether target subimage exists the vital task that has become software automated testing field.And then, how in this target image, to add up the quantity that this target subimage exists, and how in this target image, to determine that the coordinate position of this target subimage is all software automated testing field task urgently to be resolved hurrily.For example, in the time that embedded system UI carries out control (icon) Detection task, embedded system UI is exactly this target image, control (icon) is exactly this target subimage, and Detection task is exactly in embedded system UI, to find all controls (icon), add up its quantity and determine its coordinate position.
In order to address the above problem, in correlation technique, common employing contrasts the method for pixel frame by frame., in the gamut of this target image, search for this target subimage by traveling through.This method realizes simple.
But, the increase of the pixel comprising along with this target image, the calculated amount exponentially of the above-mentioned method that contrasts frame by frame pixel increases, thereby causes efficiency obviously to reduce.
Summary of the invention
The present invention aims to provide a kind of target image searching method and device, and to solve the increase of the pixel comprising along with target image in correlation technique, the calculated amount exponentially that contrasts frame by frame the method for pixel increases, thus the problem that causes efficiency obviously to reduce.
According to an aspect of the present invention, provide a kind of target image searching method, having comprised: gathered the multiple unique points in target subimage; Target image is converted to one-dimension array by two-dimensional pixel matrix, and adjusts the relative displacement between multiple unique points corresponding to this conversion regime; And use the relative displacement after adjusting to search for one-dimension array.
Preferably, target image is converted to one-dimension array by two-dimensional pixel matrix, and the relative displacement of adjusting between multiple unique points corresponding to this conversion regime comprises: in the situation that target subimage and target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, if two unique points relative displacement N1=X+A1 × Y before adjustment, relative displacement N2=X+A2 × Y after adjusting, wherein N1 is the relative displacement before adjusting, X is the line skew amount of two unique points, Y is the line displacement amount of two unique points, A1 is the columns of target subimage, A2 is the columns of target image.
Preferably, the multiple unique points that gather in target subimage comprise: the fixed position in target subimage, gathers multiple unique points.
Preferably, the multiple unique points that gather in target subimage comprise: the marginal position of the master image in target subimage, gathers multiple unique points.
Preferably, before the multiple unique points that gather in target subimage, also comprise: determine that described target subimage is non-rectangular shape; Coupling is set and ignores pixel list; And ignore pixel list according to described coupling, described target subimage is filled and become corresponding rectangular shape.
Preferably, after the relative displacement search one-dimension array using after adjusting, also comprise: according to Search Results, contrast frame by frame the pixel of target subimage and target image.
According to a further aspect in the invention, provide a kind of target image searcher, having comprised: acquisition module, for gathering multiple unique points of target subimage; Modular converter, for being converted to one-dimension array by target image by two-dimensional pixel matrix; Adjusting module, for adjusting the relative displacement between multiple unique points corresponding to this conversion regime; And search module, for using the relative displacement search one-dimension array after adjustment.
Preferably, adjusting module comprises: adjustment unit, for in the situation that target subimage and target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, relative displacement before the adjustment of two unique points is N1=X+A1 × Y, adjust relative displacement N2=X+A2 × Y, wherein N1 is the relative displacement before adjusting, X is the line skew amount of two unique points, Y is the line displacement amount of two unique points, A1 is the columns of target subimage, and A2 is the columns of target image.
Preferably, acquisition module comprises: the first collecting unit, for the fixed position at target subimage, gathers multiple unique points.
Preferably, acquisition module comprises: the second collecting unit, for the marginal position of the master image at target subimage, gathers multiple unique points.
Preferably, said apparatus also comprises: determination module, for determining that target subimage is non-rectangular shape; Module is set, ignores pixel list for coupling is set; And packing module, for ignore pixel list according to coupling, target subimage is filled and become corresponding rectangular shape.
Preferably, said apparatus also comprises: contrast module, for according to Search Results, contrasts the pixel of target subimage and target image frame by frame.
One aspect of the present invention adopts multiple unique point search, thereby can avoid contrasting frame by frame in correlation technique the shortcoming of the method for pixel, adopt on the other hand the one-dimension array corresponding with the plurality of unique point, thereby can further reduce the calculated amount in search, ensure search efficiency.
Brief description of the drawings
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms the application's a part, and schematic description and description of the present invention is used for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is according to the process flow diagram of the target image searching method of the embodiment of the present invention;
Fig. 2 is process flow diagram according to the preferred embodiment of the invention;
Fig. 3 is the schematic diagram of target subimage one according to the preferred embodiment of the invention;
Fig. 4 is the schematic diagram of target subimage two according to the preferred embodiment of the invention;
Fig. 5 is that the fixed position in target subimage one gathers the schematic diagram of multiple unique points according to the preferred embodiment of the invention;
Fig. 6 is that the fixed position in target subimage two gathers the schematic diagram of multiple unique points according to the preferred embodiment of the invention;
Fig. 7 is the schematic diagram that the marginal position of the master image in target subimage one according to the preferred embodiment of the invention gathers multiple unique points;
Fig. 8 is the schematic diagram that the marginal position of the master image in target subimage two according to the preferred embodiment of the invention gathers multiple unique points;
Fig. 9 is the schematic diagram of the two-dimensional matrix of target subimage according to the preferred embodiment of the invention;
Figure 10 is the schematic diagram of the one-dimension array of target subimage according to the preferred embodiment of the invention;
Figure 11 is the schematic diagram of target image according to the preferred embodiment of the invention;
Figure 12 is the schematic diagram of non-rectangle figure according to the preferred embodiment of the invention;
The schematic diagram that Figure 13 is is rectangle by non-rectangle filling graph according to the preferred embodiment of the invention;
Figure 14 is that non-rectangle figure exists the schematic diagram of error point according to the preferred embodiment of the invention;
Figure 15 be according to the preferred embodiment of the invention the first non-rectangle figure valid pixel surround before schematic diagram;
Figure 16 is the schematic diagram of the first non-rectangle figure in valid pixel encirclement process according to the preferred embodiment of the invention;
Figure 17 be according to the preferred embodiment of the invention the first non-rectangle figure valid pixel surround after schematic diagram;
Figure 18 be according to the preferred embodiment of the invention the second non-rectangle figure valid pixel surround before schematic diagram;
Figure 19 is the schematic diagram of the second non-rectangle figure in valid pixel encirclement process according to the preferred embodiment of the invention;
Figure 20 be according to the preferred embodiment of the invention the second non-rectangle figure valid pixel surround after schematic diagram;
Figure 21 is the process flow diagram of the preferred embodiment according to the present invention;
Figure 22 is according to the structured flowchart of the target image searcher of the embodiment of the present invention;
Figure 23 is the structured flowchart one of target image searcher according to the preferred embodiment of the invention;
Figure 24 is the structured flowchart two of target image searcher according to the preferred embodiment of the invention;
Figure 25 is the structured flowchart three of target image searcher according to the preferred embodiment of the invention;
Figure 26 is the structured flowchart four of target image searcher according to the preferred embodiment of the invention;
Figure 27 is the structured flowchart five of target image searcher according to the preferred embodiment of the invention.
Embodiment
It should be noted that, in the situation that not conflicting, the feature in embodiment and embodiment in the application can combine mutually.Describe below with reference to the accompanying drawings and in conjunction with the embodiments the present invention in detail.
The embodiment of the present invention provides a kind of target image searching method.Fig. 1 is according to the process flow diagram of the target image searching method of the embodiment of the present invention, as shown in Figure 1, comprises that following step S102 is to step S106.
Step S102, gathers the multiple unique points in target subimage.
Step S104, is converted to one-dimension array by target image by two-dimensional pixel matrix, and adjusts the relative displacement between multiple unique points corresponding to this conversion regime.
Step S106, uses the relative displacement search one-dimension array after adjusting.
In correlation technique, the increase of the pixel comprising along with target image, the calculated amount exponentially that contrasts frame by frame the method for pixel increases, thereby causes efficiency obviously to reduce.In the embodiment of the present invention, on the one hand, adopt multiple unique point search, thereby can avoid contrasting frame by frame in correlation technique the shortcoming of the method for pixel; On the other hand, adopt the one-dimension array corresponding with the plurality of unique point, thereby can further reduce the calculated amount in search, ensure search efficiency.
The picture many for pixel, color is complicated, the method that adopts the embodiment of the present invention to provide, can obviously improve unique point hit rate, obviously reduces the picture searching time.Particularly, contrast frame by frame the picture searching time that the method for pixel causes and be exponential increase in correlation technique, the picture searching time that target image searching method of the present invention causes is linear growth.For example, for the search of the target subimage of 1,000 ten thousand pixels, target image searching method of the present invention only needs the time about 1 second just can complete search, just can complete search and adopt the method that contrasts frame by frame pixel in the correlation technique in correlation technique at least to need to reach several hours.
It should be noted that, after the relative displacement search one-dimension array using after adjusting, if search object is only to determine in a width target image whether target subimage exists, and can directly obtain this target subimage and exist or non-existent conclusion in this target image; If search object is to determine the coordinate position of this target subimage in this target image, conventionally need to be according to above-mentioned conversion regime by Search Results reverse conversion to the coordinate position in this target image of its correspondence.That is, according to the difference of search object, those skilled in the art can directly obtain final search conclusion by Search Results, also can be by the reprocessing of Search Results being obtained to final search conclusion, and the present invention is not limited.But, regardless of searching for object, as long as it adopts step S102 to the target image searching method described in step S106, can reduce the calculated amount in search, ensure search efficiency.
Preferably, target image is converted to one-dimension array by two-dimensional pixel matrix, and the relative displacement of adjusting between multiple unique points corresponding to this conversion regime comprises: in the situation that target subimage and target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, if two unique points relative displacement N1=X+A1 × Y before adjustment, relative displacement N2=X+A2 × Y after adjusting, wherein N1 is the relative displacement before adjusting, X is the line skew amount of two unique points, Y is the line displacement amount of two unique points, A1 is the columns of target subimage, A2 is the columns of target image.
This preferred embodiment adopts the conversion regime of changing line by line and changing by column from left to right in every row from the top down, and the method for adjustment of its corresponding relative displacement is provided accordingly.It should be noted that; this conversion regime as an example; it is the conversion regime of a kind of easy calculating realize target picture search; but; protection scope of the present invention is not limited in this; in practical application; thereby any adjustment that can realize relative displacement ensures the conversion regime of target image search; include but not limited to the conversion regime of changing by column from left to right and changing line by line from the top down, the conversion regime of successively changing from outside to inside according to clockwise direction into starting point with the summit in the upper left corner in every row, all should include protection scope of the present invention in.
In addition, target image searching method of the present invention is not limited to target subimage and target image is rectangle, and the method can also be applicable to the search of target subimage non-rectangles such as circle, triangle.In the search procedure of the target subimage of this non-rectangle, only need the target subimage of this non-rectangle to be adjusted into immediate rectangle, ignore pixel value table by setting and valid pixel surrounds, can realize the search of the target subimage of this non-rectangle.
Preferably, the multiple unique points that gather in target subimage comprise: the fixed position in target subimage, gathers multiple unique points.
This preferred embodiment gathers multiple unique points in fixed position, thus the calculated amount can alleviate the relative displacement of adjusting between the plurality of unique point time.Wherein, this fixed position can be uniformly distributed in this target subimage, thereby represents more fully the feature of this target subimage.
Preferably, the multiple unique points that gather in target subimage comprise: the marginal position of the master image in target subimage, gathers multiple unique points.
This preferred embodiment gathers multiple unique points at the marginal position of master image, and the marginal position of master image can fully represent the feature of this target subimage, thereby improves the success ratio of target image search.
Preferably, before the multiple unique points that gather in target subimage, also comprise: determine that described target subimage is non-rectangular shape; Coupling is set and ignores pixel list; And ignore pixel list according to described coupling, described target subimage is filled and become corresponding rectangular shape.This preferred embodiment can be suitable for searching for for the target subimage of non-rectangle.
Preferably, after the relative displacement search one-dimension array using after adjusting, also comprise: according to Search Results, contrast frame by frame the pixel of target subimage and target image.
This preferred embodiment adopts the pixel that contrasts frame by frame target subimage and target image, can be after relative displacement search, again verify that the Search Results of relative displacement search improves the success ratio of target image search.Meanwhile, because checking scope has been limited to the Search Results that relative displacement is searched for, therefore can obviously not increase the calculated amount of target image search.
Below in conjunction with preferred embodiment, the implementation procedure of the embodiment of the present invention is described in detail.
Fig. 2 is process flow diagram according to the preferred embodiment of the invention, and as shown in Figure 2, this example comprises that following step S202 is to step S210.
Step S202, calculates the quantity of multiple unique points.
Step S204, chooses the position of multiple unique points.
Step S206, the side-play amount mapping of picture element matrix depression of order and unique point.
Step S208, the traversal search of the side-play amount of unique point.
Step S210, carries out full figure coupling (i.e. contrast frame by frame) by Search Results possible in target subimage and target image.
Respectively above-mentioned steps S202 is described in detail to step S210 below.
In step S202, the object of multiple unique points is to search for the most accurately target subimage and can reduces search calculated amount.The error of multiple unique points is, may have several different target subimages, and the value of its multiple unique points is just identical, but correct target subimage is one or more.Therefore, as a rule, unique point quantity is more, and the error of target subimage is less.But the increase of unique point quantity can increase search calculated amount.Therefore, make balance at the error rate of the quantity of multiple unique points and target subimage (occurring the probability of the picture with same characteristic features point).
The quantity of the plurality of unique point can adopt following mode to calculate:
Suppose:
A: the quantity of the plurality of unique point is;
B: the color depth of each unique point is integer h, and wherein color depth can be understood as the color that each unique point may occur, unit is bit[1 conventionally], directly transform into integer h here and calculate to simplify;
C: the ranks number of target subimage is respectively x, y;
D: target image ranks number be respectively X, Y;
And the color depth of supposing each unique point is random appearance, and do not consider distortion and the convergent-divergent of image.
:
A: for specific color depth, the probability that each unique point repeats is 1/h, the probability of n unique point repetition is (1/h)
n;
B: the ading up to of position (X-x) × (Y-y) likely appears in target subimage in target image.
Therefore, the computing formula of the repetition rate of target subimage (search error rate) is as shown in following formula 1:
Can find out from formula 1:
A: target image is larger, target subimage is less, and target subimage repetition rate is higher;
B: the color depth of unique point is higher, target subimage repetition rate is lower;
C: the quantity of multiple unique points is more, target subimage repetition rate is low.
Adopt above-mentioned formula 1 to estimate the concrete quantity of multiple unique points below.
First, what in daily life, use is 24bit true color, and it can reach 2
24plant color.But in software development, the actual color using is worth well below this.Conservative estimation, the use number of colours of UI design for 10bit be totally 1024 looks.
Secondly, the ranks number of target image, i.e. the image resolution ratio of target image, for smart mobile phone, normally 800x480 or 960x640; For notebook computer or panel computer, normally 1024x768 or 1280x800; For desktop computer, normally 1440x900 or 1920x1080.Therefore, for stronger explanation beneficial effect of the present invention, the present invention chooses 1920x1080 that image resolution ratio the is the highest image resolution ratio as target image, and meanwhile, the ranks number of hypothetical target subimage is 100x100.
Again, consider that the target subimage repetition rate (error rate) that conventionally can tolerate should be less than 0.1%, therefore the choosing number and should meet following formula 2 of unique point:
(1920-100)×(1080-100)×(1/1024)
n<0.001 ......2
Solve n > 3.07321.
Therefore, as a rule, the quantity of multiple unique points equals 3, can substantially meet the target that search error rate is less than 0.1%.
It should be noted that, step S202 is not essential in each search procedure, and according to actual needs, the quantity that can directly determine multiple unique points equals 3 or be greater than any integer of 3 to those skilled in the art.
In step S204, the position of multiple unique points both can be chosen the fixed position in target subimage, and the marginal position of master image that also can be in target subimage is chosen.Be described in detail below in conjunction with Fig. 3 to Fig. 8.
Fig. 3 is the schematic diagram of target subimage one according to the preferred embodiment of the invention, and Fig. 4 is the schematic diagram of target subimage two according to the preferred embodiment of the invention, as shown in Figure 3 and Figure 4, is diverse by the target subimage of diagonal line hatches representative.
Fig. 5 is that the fixed position in target subimage one gathers the schematic diagram of multiple unique points according to the preferred embodiment of the invention, Fig. 6 is that the fixed position in target subimage two gathers the schematic diagram of multiple unique points according to the preferred embodiment of the invention, as shown in Figure 5 and Figure 6, although be wherein diverse by the target subimage of diagonal line hatches representative, but the collection position by multiple unique points of vertical line shade representative is identical, and the plurality of unique point is fixed position.Gather multiple unique points in fixed position, can alleviate the calculated amount while adjusting the relative displacement between the plurality of unique point in subsequent process.Wherein, this fixed position can be uniformly distributed as shown in Figure 5 and Figure 6 in this target subimage, thereby represents more fully the feature of this target subimage.
Fig. 7 is the schematic diagram that the marginal position of the master image in target subimage one according to the preferred embodiment of the invention gathers multiple unique points, Fig. 8 is the schematic diagram that the marginal position of the master image in target subimage two according to the preferred embodiment of the invention gathers multiple unique points, as shown in Figure 7 and Figure 8, according to the difference of the target subimage by diagonal line hatches representative, correspondingly, collection position by multiple unique points of horizontal line shade representative is also incomplete same, and the collection position of the plurality of unique point is the marginal position that is positioned at target subimage.Because the marginal position of master image can fully represent the feature of this target subimage, therefore can improve the success ratio of target image search.
In step S206, can two-dimensional matrix will be expressed as
target image be one-dimension array [RGB...RGB] by the method representation of depression of order.Be elaborated below in conjunction with Fig. 9 and Figure 10.
Fig. 9 is the schematic diagram of the two-dimensional matrix of target subimage according to the preferred embodiment of the invention, and as shown in Figure 9, ranks number is all that 7 two-dimensional matrix includes three unique points by vertical line shade representative.
Figure 10 is the schematic diagram of the one-dimension array of target subimage according to the preferred embodiment of the invention, as shown in figure 10, by the two-dimensional matrix of Fig. 9 by from the top down line by line conversion and the conversion regime depression of order changed by column from left to right in every row be 7 × 7 one-dimension array into length, wherein this three unique points position in one-dimension array is by horizontal line shade representative.
And then the position of unique point in one-dimension array can adopt with respect to the off-set value of one-dimension array first place and represent, this off-set value is as shown in following formula 3:
f
n=A+w×B+C-1......3
Wherein, n is the subscript of this unique point, and A is the subscript of one-dimension array first place, and B is the line number at this unique point place, and C is the columns at this unique point place.
That is, as target subgraph image width w=7, high h=7, the subscript of one-dimension array first place is 0 o'clock, the subscript of unique point 1 is f
1=0+w × 1+2-1=8, the subscript of unique point 2 is f
2=0+w × 3+5-1=25, the subscript of unique point 3 is f
2=0+w × 5+2-1=36.
It should be noted that; above-mentioned employing carrys out one that the position of representation feature point in one-dimension array be only used to simplify calculated amount for example with respect to the off-set value of one-dimension array first place; in actual search process; adopt with respect to position, one-dimension array end, interposition, even the off-set value of the position at certain place of unique point own to come the position of representation feature point in one-dimension array be all possible implementation, it all should include protection scope of the present invention in.Simultaneously, those skilled in the art can know, it is one-dimension array by the two-dimensional matrix depression of order of target subimage that the embodiment of the present invention does not need reality, and only needs to adopt formula 3 to calculate respectively the off-set value of the relative one-dimension array of each unique point first place.
And then in target image, the relative position of three unique points can calculate by formula 4 to 6:
F
1=X+f1+(W-w)×1 ......4
F
2=X+f2+(W-w)×3 ......5
F
3=X+f3+(W-w)×5 ......6
Wherein, X is the subscript of target subimage first place in target image, and W is the width of target image, F
1, F
2, F
3respectively the subscripts of three unique points in target image.
In step S208, use the first place of target subimage as iterator, compare respectively the value in these three pairs of unique points of F1 and f1, F2 and f2 and F3 and f3, thereby can pass through single ergodic, search all possible position points.For example, if need to be all that in 25 target image, search ranks number is as shown in Figure 9 all 7 target subimage at ranks number as shown in figure 11, the first place of target subimage can be traveled through by column from left to right line by line and in every row from the top down in target image, compare respectively the value in these three pairs of unique points of F1 and f1, F2 and f2 and F3 and f3.Therefore finding possible location point is the 10th row the 10th row and the 12nd row the 13rd row.
In step S210, in the possible position of searching at step S208, take whole target subimage with the X subscript value of this position, target subimage and target image are carried out to full figure coupling (i.e. contrast frame by frame), thereby draw last Search Results.
In addition, adopt method provided by the invention to search for for the target subimage of non-rectangle, specifically describe as follows.
In actual applications, the figure of a lot of figures (as shown in figure 12) non-rectangle, but in fact, the storage mode of this figure or rectangle, only seem at it the region that there is no figure, adopted rgb value 16777215 to show, it can be understood as transparent.
Therefore, the present invention can be the figure (as shown in figure 13, wherein the white space in square is Transparent color region) of a rectangle by non-rectangle filling graph, adopts equally pixel mapping method mentioned above to search for.
But, because when transparent region can not cover base map in the time showing stack, so this method can exist error point, likely there is situation as shown in figure 14.Therefore, the present invention also proposes in the process of Graphic Pattern Matching, to introduce the method for ignoring pixel value, that is, in target subimage, if the value of this pixel is 16777215,, in the time mating with target image, ignore.No matter the pixel value of target image is how many, all mates and passes through.Like this, just can realize for the target subimage of non-rectangle and searching for.
Preferably, can arrange one and ignore pixel value list, as long as in this pixel value of ignoring pixel value list, all mate and pass through.
And then, ignore after pixel value in the setting of target subimage, preferably can carry out one and cut out ignoring space, by minimum valid pixel graphic clipping out, reduce the volume of target subimage, improve matching efficiency.
This is cut out and can use the method that valid pixel is surrounded, as shown in Figure 15 to Figure 20.After valid pixel surrounds, by minimum valid pixel graphic clipping out, the iteration of pixel mapping is the first to be just as the criterion with the first subscript of the target subimage after cutting out.
The present invention also provides a preferred embodiment, for the implementation procedure of above preferred embodiment is described.Figure 21 is the process flow diagram of the preferred embodiment according to the present invention, as shown in figure 21, comprises that following step S2102 is to step S2120.
Step S2102, input target image.
Step S2104, input target subimage.
Step S2106, judges that target subimage is special shape, if so, carries out step S2110, otherwise, carry out step S2112.
Step S2108, arranges coupling and ignores pixel list.
Step S2110, the coupling arranging according to step S2108 is ignored pixel list, carries out the processing of special shape target subimage.
Step S2112, Sub-Image Feature point gathers.
Step S2114, test data depression of order is processed and unique point mapping.
Step S2116, single data traversal and Feature Points Matching.
Step S2118, the subgraph of matching candidate list mates entirely.
Step S2120, returns to test result.
The embodiment of the present invention also provides a kind of target image searcher.Figure 22 is according to the structured flowchart of the target image searcher of the embodiment of the present invention, and as shown in figure 22, acquisition module 222, modular converter 224, adjusting module 226 and search module 228, be described in detail its structure below.
Acquisition module 222, for gathering multiple unique points of target subimage; Modular converter 224, for being converted to one-dimension array by target image by two-dimensional pixel matrix; Adjusting module 226, is connected to acquisition module 222 and modular converter 224, the relative displacement between the multiple unique points that gather for the conversion regime adjustment acquisition module 222 corresponding to this modular converter 224; Search module 228, is connected to modular converter 224 and adjusting module 226, for the relative displacement search one-dimension array after using adjusting module 226 to adjust.
In correlation technique, the increase of the pixel comprising along with target image, the calculated amount exponentially that contrasts frame by frame the method for pixel increases, thereby causes efficiency obviously to reduce.In the embodiment of the present invention, on the one hand, adopt multiple unique point search, thereby can avoid contrasting frame by frame in correlation technique the shortcoming of the method for pixel; On the other hand, adopt the one-dimension array corresponding with the plurality of unique point, thereby can further reduce the calculated amount in search, ensure search efficiency.
The picture many for pixel, color is complicated, the method that adopts the embodiment of the present invention to provide, can obviously improve unique point hit rate, obviously reduces the picture searching time.Particularly, contrast frame by frame the picture searching time that the method for pixel causes and be exponential increase in correlation technique, the picture searching time that target image searching method of the present invention causes is linear growth.For example, for the search of the target subimage of 1,000 ten thousand pixels, target image searching method of the present invention only needs the time about 1 second just can complete search, just can complete search and adopt the method that contrasts frame by frame pixel in the correlation technique in correlation technique at least to need to reach several hours.
It should be noted that, after the relative displacement search one-dimension array using after adjusting, if search object is only to determine in a width target image whether target subimage exists, and can directly obtain this target subimage and exist or non-existent conclusion in this target image; If search object is to determine the coordinate position of this target subimage in this target image, conventionally need to be according to above-mentioned conversion regime by Search Results reverse conversion to the coordinate position in this target image of its correspondence.That is, according to the difference of search object, those skilled in the art can directly obtain final search conclusion by Search Results, also can be by the reprocessing of Search Results being obtained to final search conclusion, and the present invention is not limited.But, regardless of searching for object, as long as it adopts step S102 to the target image searching method described in step S106, can reduce the calculated amount in search, ensure search efficiency.
Figure 23 is the structured flowchart one of target image searcher according to the preferred embodiment of the invention, as shown in figure 23, adjusting module 226 comprises: adjustment unit 2262, for in the situation that target subimage and target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, relative displacement before the adjustment of two unique points is N1=X+A1 × Y, adjust relative displacement N2=X+A2 × Y, wherein N1 is the relative displacement before adjusting, X is the line skew amount of two unique points, Y is the line displacement amount of two unique points, A1 is the columns of target subimage, A2 is the columns of target image.
This preferred embodiment adopts the conversion regime of changing line by line and changing by column from left to right in every row from the top down, and the method for adjustment of its corresponding relative displacement is provided accordingly.It should be noted that, this conversion regime as an example, is the conversion regime of a kind of easy calculating realize target picture search; But protection scope of the present invention is not limited in this.In practical application; thereby any adjustment that can realize relative displacement ensures the conversion regime of target image search; include but not limited to the conversion regime of changing by column from left to right and changing line by line from the top down, the conversion regime of successively changing from outside to inside according to clockwise direction into starting point with the summit in the upper left corner in every row, all should include protection scope of the present invention in.
In addition, target image searching method of the present invention is not limited to target subimage and target image is rectangle, and the method can also be applicable to the search of target subimage non-rectangles such as circle, triangle.In the search procedure of the target subimage of this non-rectangle, only need the target subimage of this non-rectangle to be adjusted into immediate rectangle, ignore pixel value table by setting and valid pixel surrounds, can realize the search of the target subimage of this non-rectangle.
Figure 24 is the structured flowchart two of target image searcher according to the preferred embodiment of the invention, and as shown in figure 24, acquisition module 222 comprises: the first collecting unit 2222, for the fixed position at target subimage, gathers multiple unique points.
This preferred embodiment gathers multiple unique points in fixed position, thus the calculated amount can alleviate the relative displacement of adjusting between the plurality of unique point time.Wherein, this fixed position can be uniformly distributed in this target subimage, thereby represents more fully the feature of this target subimage.
Figure 25 is the structured flowchart three of target image searcher according to the preferred embodiment of the invention, and as shown in figure 25, acquisition module 222 comprises: the second collecting unit 2224, for the marginal position of the master image at target subimage, gathers multiple unique points.
This preferred embodiment gathers multiple unique points at the marginal position of master image, and the marginal position of master image can represent the feature of this target subimage fully, thereby improves the success ratio of target image search.
Figure 26 is the structured flowchart four of target image searcher according to the preferred embodiment of the invention, and as shown in figure 26, said apparatus also comprises: determination module 2210, module 2212 and packing module 2214 are set.Below its structure is described in detail.
Determination module 2210, for determining that target subimage is non-rectangular shape; Module 2212 is set, is connected to determination module 2210, for after determination module 2210 determines that target subimage is non-rectangular shape, coupling is set and ignores pixel list; Packing module 2214, is connected to module 2212 is set, and for ignoring pixel list according to the coupling that module 2212 arranges is set, target subimage is filled and is become corresponding rectangular shape.
Figure 27 is the structured flowchart five of target image searcher according to the preferred embodiment of the invention, and as shown in figure 27, said apparatus also comprises: contrast module 2216, for according to Search Results, contrasts the pixel of target subimage and target image frame by frame.
This preferred embodiment adopts the pixel that contrasts frame by frame target subimage and target image, can be after relative displacement search, again verify that the Search Results of relative displacement search improves the success ratio of target image search.Meanwhile, because checking scope has been limited to the Search Results that relative displacement is searched for, therefore can obviously not increase the calculated amount of target image search.
In sum, according to the abovementioned embodiments of the present invention, a kind of target image searching method and device are provided.One aspect of the present invention adopts multiple unique point search, thereby can avoid contrasting frame by frame in correlation technique the shortcoming of the method for pixel.Adopt on the other hand the one-dimension array corresponding with the plurality of unique point, thereby can further reduce the calculated amount in search, ensure search efficiency.
Obviously, it is apparent to those skilled in the art that above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or are distributed on the network that multiple calculation elements form.Alternatively, they can be realized with the executable program code of calculation element, thereby they can be stored in memory storage and be carried out by calculation element, or they are made into respectively to each integrated circuit modules, or the multiple modules in them or step are made into single integrated circuit module realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.
Claims (10)
1. a target image searching method, is characterized in that comprising:
Gather the multiple unique points in target subimage;
Target image is converted to one-dimension array by two-dimensional pixel matrix, and adjusts the relative displacement between described multiple unique points corresponding to this conversion regime; And
Use the relative displacement after adjusting to search for described one-dimension array.
2. method according to claim 1, it is characterized in that, target image is converted to one-dimension array by two-dimensional pixel matrix, and the relative displacement of adjusting between described multiple unique points corresponding to this conversion regime comprises: in the situation that described target subimage and described target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, if two unique points relative displacement N1=X+A1 × Y before adjustment, relative displacement N2=X+A2 × Y after adjusting, wherein N1 is the relative displacement before adjusting, X is the line skew amount of described two unique points, Y is the line displacement amount of described two unique points, A1 is the columns of described target subimage, A2 is the columns of described target image.
3. method according to claim 1, is characterized in that, gather multiple unique points in target subimage comprise following one of at least:
Fixed position in described target subimage, gathers described multiple unique point;
The marginal position of the master image in described target subimage, gathers described multiple unique point.
4. according to the method in any one of claims 1 to 3, it is characterized in that, before the multiple unique points that gather in target subimage, also comprise:
Determine that described target subimage is non-rectangular shape;
Coupling is set and ignores pixel list; And
Ignore pixel list according to described coupling, described target subimage is filled and become corresponding rectangular shape.
5. according to the method in any one of claims 1 to 3, it is characterized in that, relative displacement after use is adjusted also comprises: according to described Search Results, contrast frame by frame the pixel of described target subimage and described target image after searching for described one-dimension array.
6. a target image searcher, is characterized in that comprising:
Acquisition module, for gathering multiple unique points of target subimage;
Modular converter, for being converted to one-dimension array by target image by two-dimensional pixel matrix;
Adjusting module, for adjusting the relative displacement between described multiple unique points corresponding to this conversion regime; And
Search module, for using the relative displacement after adjustment to search for described one-dimension array.
7. device according to claim 6, it is characterized in that, described adjusting module comprises: adjustment unit, for in the situation that described target subimage and described target image are rectangle, for the conversion regime of changing line by line and changing by column from left to right in every row from the top down, relative displacement before the adjustment of two unique points is N1=X+A1 × Y, adjust relative displacement N2=X+A2 × Y, wherein N1 is the relative displacement before adjusting, X is the line skew amount of described two unique points, Y is the line displacement amount of described two unique points, A1 is the columns of described target subimage, A2 is the columns of described target image.
8. device according to claim 6, is characterized in that, described acquisition module comprises:
The first collecting unit, for the fixed position at described target subimage, gathers described multiple unique point; And
The second collecting unit, for the marginal position of the master image at described target subimage, gathers described multiple unique point.
9. according to the device described in any one in claim 6 to 8, it is characterized in that, also comprise:
Determination module, for determining that described target subimage is non-rectangular shape;
Module is set, ignores pixel list for coupling is set; And
Packing module, for ignoring pixel list according to described coupling, fills described target subimage to become corresponding rectangular shape.
10. according to the device described in any one in claim 6 to 8, it is characterized in that, also comprise: contrast module, for according to described Search Results, contrasts the pixel of described target subimage and described target image frame by frame.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210551583.8A CN103853800B (en) | 2012-11-29 | 2012-11-29 | Target image searching method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210551583.8A CN103853800B (en) | 2012-11-29 | 2012-11-29 | Target image searching method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103853800A true CN103853800A (en) | 2014-06-11 |
CN103853800B CN103853800B (en) | 2019-03-26 |
Family
ID=50861466
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210551583.8A Expired - Fee Related CN103853800B (en) | 2012-11-29 | 2012-11-29 | Target image searching method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103853800B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108242058A (en) * | 2016-12-26 | 2018-07-03 | 深圳怡化电脑股份有限公司 | Image boundary lookup method and device |
CN113313785A (en) * | 2021-08-02 | 2021-08-27 | 杭州安恒信息技术股份有限公司 | Frame generation method, device, equipment and storage medium |
CN115866334A (en) * | 2023-02-27 | 2023-03-28 | 成都华域天府数字科技有限公司 | Data processing method for cutting and associating content in video flow |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101021489A (en) * | 2006-02-15 | 2007-08-22 | 奥林巴斯株式会社 | Visual inspection apparatus |
CN101923718A (en) * | 2009-06-12 | 2010-12-22 | 新奥特(北京)视频技术有限公司 | Optimization method of visual target tracking method based on particle filtering and optical flow vector |
US7877337B2 (en) * | 2006-10-10 | 2011-01-25 | Brainlike, Inc. | Auto-adaptive network for sensor data processing and forecasting |
US20120143046A1 (en) * | 2010-12-03 | 2012-06-07 | Stadler Bethanie J H | Electro-chemical-deposition of galfenol and the uses therof |
CN102799888A (en) * | 2011-05-27 | 2012-11-28 | 株式会社理光 | Eye detection method and eye detection equipment |
-
2012
- 2012-11-29 CN CN201210551583.8A patent/CN103853800B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101021489A (en) * | 2006-02-15 | 2007-08-22 | 奥林巴斯株式会社 | Visual inspection apparatus |
US7877337B2 (en) * | 2006-10-10 | 2011-01-25 | Brainlike, Inc. | Auto-adaptive network for sensor data processing and forecasting |
CN101923718A (en) * | 2009-06-12 | 2010-12-22 | 新奥特(北京)视频技术有限公司 | Optimization method of visual target tracking method based on particle filtering and optical flow vector |
US20120143046A1 (en) * | 2010-12-03 | 2012-06-07 | Stadler Bethanie J H | Electro-chemical-deposition of galfenol and the uses therof |
CN102799888A (en) * | 2011-05-27 | 2012-11-28 | 株式会社理光 | Eye detection method and eye detection equipment |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108242058A (en) * | 2016-12-26 | 2018-07-03 | 深圳怡化电脑股份有限公司 | Image boundary lookup method and device |
CN113313785A (en) * | 2021-08-02 | 2021-08-27 | 杭州安恒信息技术股份有限公司 | Frame generation method, device, equipment and storage medium |
CN115866334A (en) * | 2023-02-27 | 2023-03-28 | 成都华域天府数字科技有限公司 | Data processing method for cutting and associating content in video flow |
Also Published As
Publication number | Publication date |
---|---|
CN103853800B (en) | 2019-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105354022B (en) | A kind of page layout document generating method and device | |
CN101571954B (en) | Subpixel registration | |
CN109074657B (en) | Target tracking method and device, electronic equipment and readable storage medium | |
US20180267703A1 (en) | Thumbnail image display apparatus and control method of thumbnail image display apparatus | |
CN107273000B (en) | Screen multi-resolution adaptation method of intelligent oscilloscope | |
CN102890632A (en) | Screen adaptation method, system and terminal device | |
US20200193563A1 (en) | Image processing apparatus and method, and related circuit | |
CN103699869A (en) | Method and device for recognizing two-dimension codes | |
CN114020756B (en) | Remote sensing image real-time map service publishing method and device | |
CN101668144B (en) | Method for realizing semitransparent effect of image layer on video layer, device and set top box | |
CN1655577A (en) | Method and apparatus for reduced size image | |
US20220027665A1 (en) | Systems, methods, and devices for image processing | |
CN103853800A (en) | Method and device for searching target image | |
CN111915690B (en) | Thermodynamic diagram data shrinkage editing method based on vector tiles | |
CN111882530A (en) | Sub-pixel positioning map generation method, positioning method and device | |
CN103279902A (en) | Electronic menu display method | |
CN101625621A (en) | Method and device for character input on touch screen | |
CN111144081B (en) | Form generation method and device, storage medium and electronic equipment | |
CN110851050B (en) | Method and device for testing clicking of page elements | |
CN106535002B (en) | Desktop starter template layout updating method and device | |
CN108510441B (en) | Image multi-resolution display method based on staggered grids | |
CN103533327B (en) | DIBR (depth image based rendering) system realized on basis of hardware | |
US20080208793A1 (en) | Image file searching method and electronic device | |
CN101800793A (en) | Automatic adaptation method of graphic and text information display position on mobile device | |
CN108875733A (en) | A kind of infrared small target quick extraction system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190326 |