CN105740860B - Retail shop's label Chinese character region automatic testing method in natural scene - Google Patents
Retail shop's label Chinese character region automatic testing method in natural scene Download PDFInfo
- Publication number
- CN105740860B CN105740860B CN201610059409.XA CN201610059409A CN105740860B CN 105740860 B CN105740860 B CN 105740860B CN 201610059409 A CN201610059409 A CN 201610059409A CN 105740860 B CN105740860 B CN 105740860B
- Authority
- CN
- China
- Prior art keywords
- value
- minimum enclosed
- connected domain
- enclosed rectangle
- binary map
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses retail shop's label Chinese character region automatic testing method in a kind of natural scene, comprise the following steps:A, the vectorial V1 and V2 of reflection sample region image main pixel color are obtained;B, the background profile of original image is determined using vectorial V1 and V2;C, hsv color space is divided into black, white, red, yellow, green, cyan, blueness, pinkish red eight pieces of color spaces;D, colo(u)r breakup is carried out to original image, obtains 8 distribution of color binary maps;E, Chinese character connected domain analysis is carried out to 8 distribution of color binary maps, obtains 8 line of text binary maps;F, the line of text that Chinese-character writing rule is not met in each line of text binary map is filtered, the Chinese character region after being refined;G, the Chinese character region of refining of different colours is merged, obtains the Chinese character region in original image.The present invention can effectively improve the degree of accuracy of Chinese character region detection, significant to the application based on the Chinese Character Recognition under natural scene.
Description
Technical field
The present invention relates to retail shop's label in the technical field of image processing under natural scene, more particularly to a kind of natural scene
Chinese character region automatic testing method.
Background technology
In recent years, as the popularization of smart machine, people can easily shoot various pictures in natural scene.Picture
In word be important information that image includes, thus the word in image is detected and then accurately identified, helped very much
In the understanding to picture material.Although existing OCR character recognition technologies have tended to be ripe, due to the bat under natural scene
Take the photograph there may be uneven illumination, angle not just and it is serious reflective a series of problems, such as, while the picture background shot is complicated, often
Include multiple fonts, font size even deformed letters so that OCR does not reach preferable effect to the text detection under natural scene.
The content of the invention
It is an object of the invention to provide retail shop's label Chinese character region automatic testing method, Neng Gouzhun in a kind of natural scene
The really Chinese character region in detection natural scene on retail shop's label, improves the effect that automatic marking and image understanding are carried out to street view image
Rate.
To achieve the above object, the technical solution adopted by the present invention is:
Retail shop's label Chinese character region automatic testing method, comprises the following steps in natural scene:
A, the retail shop's label scanned in natural scene obtains original image, and the sample region figure of rectangle is intercepted from original image
Picture, and the RGB triple channels of sample region image are deployed, forms the matrix of the row of M*N rows 3, and wherein M is the width of sample region image, N
For the height of sample region image, Kmeans clusters, setting are carried out using every a line of matrix as a point of three dimensions respectively
The classification number of cluster is 2, obtains two cluster centre points, respectively vectorial V1 and V2, subsequently into step B;
B, each pixel of original image is calculated respectively to vectorial V1 and V2 distance, and creates two and original image
Size identical initializes binary map bg1 and bg2, and the pixel value for initializing all pixels point in binary map bg1 and bg2 is 0,
Setpoint distance threshold X, compare each pixel of original image successively to vectorial V1 distance and X magnitude relationship, when original
, will be with the pixel point coordinates identical picture in binary map bg1 is initialized when the pixel of image to vectorial V1 distance are less than X
The pixel value of vegetarian refreshments is set to 1, obtains coarse contour binary map BG1;Compare each pixel of original image successively to vectorial V2's
Distance and X magnitude relationship, when pixel to the vectorial V2 of original image distance are less than X, in binary map bg2 is initialized
Pixel value with the pixel point coordinates identical pixel is set to 1, coarse contour binary map BG2 is obtained, respectively to coarse contour two
Value figure BG1 and BG2 do Morphological scale-space and carry out connected domain analysis, and area maximum is selected from coarse contour binary map BG1 and BG2
Connected domain repaired and filled after be used as background profile, obtain background profile binary map;
C, hsv color space is divided into black, white, red, yellow, green, cyan, blueness, pinkish red eight pieces of colors
Space, the division rule of eight pieces of color spaces are as follows:
Black space, v<0.3or(v<0.5and s<=0.25);
White space, v>=0.5and s<=0.25;
Red space, (h<1/12or h>=11/12) and v>0.3and s>=0.25;
Yellow space, h>=1/12and h<3/12and v>0.3and s>=0.25;
Vert space, h>=3/12and h<5/12and v>0.3and s>=0.25;
Cyan space, h>=5/12and h<7/12and v>0.3and s>=0.25;
Blue color space, h>=7/12and h<9/12and v>0.3and s>=0.25;
Pinkish red space, h>=9/12and h<11/12and v>0.3and s>=0.25;
H represents the tone in hsv color space in formula, and the saturation degree in behalf hsv color space, v represents hsv color
Lightness in space, subsequently into step D;
D, 8 and original image size identical binary map are created, and by the pixel of all pixels point in every binary map
Value is set to 0, and original image is transformed into hsv color space from rgb space, then judges original image in hsv color space
Each pixel belonging to color type, all pixels point for belonging to same color type is mapped to pair of a binary map
Opening position is answered, and the pixel value of the pixel of corresponding position in binary map is set to 1, finally obtains 8 distribution of color two-values
Figure, subsequently into step E;
E, 8 distribution of color binary maps are done with carrying out Morphological scale-space after computing again with background profile binary map respectively,
The tiny gully in 8 distribution of color binary maps and fine rule are filtered out, obtains 8 thin contoured profile binary map, respectively to 8 thin wheel
Exterior feature distribution binary map carries out connected domain scanning, obtains mark figure corresponding to connected graph using eight connectivity labelling method, and calculate each
The attribute of connected domain, then the connected domain that Chinese-character stroke feature is not met in 8 thin contoured profile binary map is filtered, obtained
Binary map is distributed to 8 stroke levels, is distributed the connected domain for meeting Chinese-character stroke feature in binary map to each stroke level respectively
Merge, multiple connected domains after merging are designated as a marked region and determine mark value, for any two mark zone
Domain, if the center-of-mass coordinate of a marked region is located in the minimum enclosed rectangle of another marked region, by the marked region
Mark value be set to the mark value of another marked region, be distributed binary map finally for each stroke level, successively will mark
Value identical marked region is designated as a line of text, 8 line of text binary maps is obtained, subsequently into step F;
F, for any one line of text in 8 line of text binary maps, when the height of the minimum enclosed rectangle of line of text
Less than the minimum enclosed rectangle height of background profile 1/20, the ratio of width to height of the minimum enclosed rectangle of line of text be less than 7/10 or
The area of line of text and the area ratio of its minimum enclosed rectangle are less than 1/10 or during more than 4/5, by this article one's own profession from corresponding text
Deleted in one's own profession binary map, 8 obtained character picture binary map, calculate all texts in each character picture binary map respectively
The area of one's own profession and, when the area being calculated and less than background profile binary map minimum enclosed rectangle area 1/200 when,
Corresponding character picture binary map is deleted, and the minimum for calculating all line of text in remaining character picture binary map respectively is outer
The coordinate of rectangle is connect, subsequently into step G;
G, one and original image size identical blank image are created, successively by institute in remaining character picture binary map
The minimum enclosed rectangle for having line of text is marked in the corresponding position of blank image, primary identification image is obtained, respectively by primary
Known in identification image by the border that two or more minimum enclosed rectangle forms in the isolated area of irregular polygon as one
Other region, for each identification region, the coordinate on each summit is counted, and the minimum value of x coordinate is selected from apex coordinate
It is designated as xmin, the maximum for selecting x coordinate is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, select y-coordinate maximum note
For ymax, with (xmin, ymin), (xmax, ymin), (xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit,
Remaining minimum enclosed rectangle composition in all rectangular areas then obtained from each identification region and primary identification image
Region be Chinese character region in original image.
Described step A comprises the following steps:
Retail shop's label in A1, scanning natural scene obtains original image, and 1/3 length is more than in scan line and is less than 2/3
Appoint to take in the section of length and be a little used as basic point, point builds R*kR rectangularly-sampled area centered on this basic point, and wherein R is
The width in rectangularly-sampled area, R value are more than the 1/7 of original image width, and 1/4, the k less than original image width adopts for rectangle
The ratio of width to height in sample area, k span is 1/4<k<4, rectangularly-sampled area is cut from original image, obtains sample region image,
Subsequently into step A2;
A2, the RGB triple channels expansion by sample region image, the matrix of the row of M*N rows 3 is formed, wherein M is sample region image
Width, N are the height of sample region image, a point using every a line of matrix as three dimensions, are carried out using Euclidean distance
Kmeans is clustered, and is set the classification number of cluster as 2, is obtained two cluster centre points, respectively vectorial V1 and V2.
Described step B comprises the following steps:
B1, each pixel in original image is labeled as 1,2 successively ... ..., n, n are pixel in original image
Number, calculates the pixel x and vectorial V1 and V2 of original image Euclidean distance L1 (x) and L2 (x), wherein x=1, and 2 ... ...,
N, subsequently into step B2;
B2, two and original image size identical initialization binary map bg1 and bg2 are created, and two are initialized by two
The pixel value of all pixels point is set to 0 in value figure bg1 and bg2, setpoint distance threshold X, when pixel x and the vector of original image
During V1 Euclidean distance L1 (x) < X, the pixel value initialized in binary map bg1 with pixel x position identical pixel is put
For 1, coarse contour binary map BG1 is obtained, will be just as the pixel x and vectorial V2 of original image Euclidean distance L2 (x) < X
Pixel value in beginningization binary map bg2 with pixel x position identical pixel is set to 1, obtains coarse contour binary map BG2, so
Enter step B3 afterwards;
B3, Morphological scale-space is done to coarse contour binary map BG1 and BG2 respectively, i.e., thick wheel is removed by erosion operation first
Wide binary map BG1 and BG2 fine rule, the tiny of coarse contour binary map BG1 and BG2 is then removed by dilation operation and closed operation
Gully, connected domain analysis finally is carried out to coarse contour binary map BG1 and BG2, face is selected from coarse contour binary map BG1 and BG2
The maximum connected domain of product is as background profile, subsequently into step B4;
Hole in B4, filling background profile, and the depression on background profile edge is repaired, obtain background profile two-value
Figure.
Described step E comprises the following steps:
E1,8 distribution of color binary maps are done with background profile binary map respectively and computing, obtain 8 coarse contours distributions
Binary map, subsequently into step E2;
E2, Morphological scale-space is done to 8 coarse contour distribution binary maps respectively, i.e., to each coarse contour binary map vertical
Closed operation and opening operation with 7 pixels are done in horizontal both direction, filter out tiny gully and fine rule, obtain 8 thin profile point
Cloth binary map, subsequently into step E3;
E3,8 connected domain scannings are carried out to 8 thin contoured profile binary map respectively, and calculate each thin contoured profile two
It is worth area, center-of-mass coordinate and the minimum enclosed rectangle of each connected domain in figure, subsequently into step E4;
E4, for any one connected domain in each thin contoured profile binary map, when it meets following three filterings
During at least one in condition, the pixel value of all pixels point in this connected domain is set to 0, obtains 8 stroke levels distribution two-values
Figure, subsequently into step E5, wherein three filter conditions are respectively:
A, the area ratio of the area of connected domain and its minimum enclosed rectangle is less than 1/5;
B, the width of the minimum enclosed rectangle of connected domain is less than the 1/200 of original image width or more than original image width
1/2;
C, the ratio of width to height of the minimum enclosed rectangle of connected domain is less than 1/10 or more than 10;
E5, binary map is distributed for 8 obtained stroke levels, each stroke level distribution binary map is located as follows
Reason:
E5-1, by stroke level be distributed binary map in each connected domain be labeled as C successively1, C2... ..., Ci, i is stroke level
The number of connected domain in binary map is distributed, respectively by C1, C2... ..., CiMark value be set to respective subscript value, i.e. C1Mark
Note value is 1, C2Mark value be 2, by that analogy, CiMark value be i, and define independent communication domain set P, independent communication domain
Initial connected domain number is 0 in set P;
E5-2, from C1, C2... ..., CiThe middle minimum enclosed rectangle for choosing any two connected domain is to axis of ordinates upslide
Shadow, two vertical projection line segments are obtained, it is the overlap length between two vertical projection line segments to define disH, and is provided when two perpendicular
DisH values are 0 when straight Projection Line Segment does not have overlapping, from C1, C2... ..., CiThe middle minimum external square for choosing any two connected domain
Shape obtains two floor projection line segments to projecting on axis of abscissas, and it is the most short distance between two floor projection line segments to define dis
From, when two floor projection line segments are adjacent or overlapping, dis values are 0, when two floor projection line segments do not have overlapping, dis values
For left side floor projection line segment right endpoint the distance between to the left end point of right side floor projection line segment;
E5-3, definition avgW are character mean breadth, and avgW initial value is C1Minimum enclosed rectangle width, definition
Sum is character row overall width, and sum initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
Choose C1And C2Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C2Middle all pixels point
Pixel value be set to 0, and by C2Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C2Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C2Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum2Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C2It is put into independent communication domain set P;
Choose C1And C3Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C3Middle all pixels point
Pixel value be set to 0, and by C3Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C3Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C3Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum3Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C3It is put into independent communication domain set P;
By that analogy, until choosing C1And CiObtain to axis of ordinates upslide movie queen two of minimum enclosed rectangle it is vertical
Projection Line Segment, when the overlap length disH between two vertical projection line segments is less than C1Minimum enclosed rectangle height 1/4 when, will
CiThe pixel value of middle all pixels point is set to 0, and by CiMark value be set to 0, the overlap length between two vertical projection line segments
DisH is more than or equal to C1Minimum enclosed rectangle height 1/4 when, choose C1And CiMinimum enclosed rectangle to axis of abscissas upslide
Two floor projection line segments that movie queen obtains, when the beeline dis between two floor projection line segments is less than or equal to the 1.5 of avgW
Times when, by CiMark value be set to C1Mark value 1, while update sum value and add C for sumiMinimum enclosed rectangle width,
Then cnt value is added 1, and the value for updating avgW is sum divided by cnt, as the beeline dis between two floor projection line segments
During more than 1.5 times of avgW, by CiIt is put into independent communication domain set P, subsequently into step E5-4;
Connected domain number in E5-4, statistical iteration connected domain set P, when the connected domain in independent communication domain set P
When number is more than or equal to 2, into step E5-5, when the connected domain number in independent communication domain set P is 0 or 1, into step
E5-7;E5-5, by independent communication domain set P multiple connected domains all take out, set P in independent communication domain is turned into empty set,
Then multiple connected domains of taking-up being arranged in order from small to large according to subscript size, definition avgW is character mean breadth,
AvgW initial value is the width of the minimum enclosed rectangle of first connected domain, and definition sum is character row overall width, and sum's is first
Initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
What the minimum enclosed rectangle of first connected domain of selection and second connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in second connected domain is set to 0, and by the mark of second connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and second connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of second connected domain is set to the mark value of first connected domain, while the value for updating sum adds second for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, second connected domain is put into independent communication domain collection
Close in P;
What the minimum enclosed rectangle of first connected domain of selection and the 3rd connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in the 3rd connected domain is set to 0, and by the mark of the 3rd connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and the 3rd connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of the 3rd connected domain is set to the mark value of first connected domain, while the value for updating sum adds the 3rd for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, the 3rd connected domain is put into independent communication domain collection
Close in P;
By that analogy, until choosing the minimum enclosed rectangle of first connected domain and last connected domain to axis of ordinates
Two vertical projection line segments that upslide movie queen obtains, when the overlap length disH between two vertical projection line segments is less than first company
When leading to the 1/4 of the minimum enclosed rectangle height in domain, the pixel value of all pixels point in last connected domain is set to 0, and will
The mark value of last connected domain is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to first
The minimum enclosed rectangle height of connected domain 1/4 when, choose first connected domain and the minimum external square of last connected domain
Two floor projection line segments that shape obtains to axis of abscissas upslide movie queen, as the beeline dis between two floor projection line segments
During less than or equal to 1.5 times of avgW, the mark value of last connected domain is set to the mark value of first connected domain, while more
New sum value adds the width of the minimum enclosed rectangle of last connected domain for sum, cnt value then is added into 1, and update
AvgW value is sum divided by cnt, will most when the beeline dis between two floor projection line segments is more than 1.5 times of avgW
The latter connected domain is put into independent communication domain set P, subsequently into step E5-6;
E5-6, according to the method in step E5-5 set P in independent communication domain is reprocessed, until independent communication domain
Connected domain number in set P is 0 or 1, subsequently into step E5-7;
E5-7, mark value identical connected domain in stroke level distribution binary map is designated as a marked region successively, and will
Mark value of the mark value of connected domain as the marked region, area, the center-of-mass coordinate of each marked region are then calculated respectively
And minimum enclosed rectangle, subsequently into step E6;
E6, binary map is distributed for 8 obtained stroke levels of step E5, each stroke level distribution binary map is made such as
Lower processing:E6-1, for any two marked region, if the center-of-mass coordinate of a marked region is located at another marked region
In minimum enclosed rectangle, then the mark value of the marked region is set to the mark value of another marked region, subsequently into step
E6-2;
E6-2, mark value identical marked region in stroke level distribution binary map is designated as a line of text successively, then
Width, height, area and the minimum enclosed rectangle of each line of text are calculated, obtains line of text binary map.
Described step F comprises the following steps:
F1,8 line of text binary maps for obtaining, for any one text in each line of text binary map
OK, when it meets at least one in following three filter conditions, the pixel value of all pixels point in this article one's own profession is set to
0,8 candidate image binary maps are obtained, subsequently into step F2, wherein three filter conditions are respectively:
D, the height of line of text is less than the 1/20 of the minimum enclosed rectangle height of background profile;
E, the ratio of width to height of line of text is less than 7/10;
F, the area ratio of the area of line of text and its minimum enclosed rectangle is less than 1/10 or more than 4/5;
F2,8 candidate image binary maps for obtaining, for any one text in each candidate image binary map
One's own profession, when it meets at least one in following two filter conditions, the pixel value of all pixels point in this article one's own profession is put
For 0,8 character picture binary maps are obtained, subsequently into step F3, two of which filter condition is respectively:
G, the minimum enclosed rectangle of line of text is summed by row, obtains a series of row projection value, row projection value exceedes most
70% continuous columns of small boundary rectangle height is more than 0.7 times of minimum enclosed rectangle height;
H, the area of line of text is less than the 1/1000 of the minimum enclosed rectangle area of background profile binary map;
F3,8 character picture binary maps for obtaining, calculate formed in each character picture binary map first successively
The area of all connected domains of each line of text and, when the area being calculated and minimum external less than background profile binary map
Rectangular area 1/200 when, by corresponding character picture binary map delete, then calculate remaining character picture binary map respectively
In all line of text minimum enclosed rectangle coordinate.
Described step G comprises the following steps:
G1, one and original image size identical blank image are created, successively by remaining character picture binary map
The minimum enclosed rectangle of all line of text is marked in the corresponding position of blank image, obtains primary identification image, primary is known
Minimum enclosed rectangle in other image is labeled as R successively1, R2... ..., Rj, j is minimum enclosed rectangle in primary identification image
Number, and the centre coordinate of each minimum enclosed rectangle is calculated, subsequently into step G2;
G2, R is judged successively2, R3... ..., RjCenter and R1Position relationship, from R1, R2... ..., RjMiddle Selection Center
Positioned at R1Internal or borderline all minimum enclosed rectangles, are put into R1Merge in set;
R is judged successively1, R3... ..., RjCenter and R2Position relationship, from R1, R2... ..., RjMiddle Selection Center is located at
R2Internal or borderline all minimum enclosed rectangles, are put into R2Merge in set;
By that analogy, until judging R successively1, R2... ..., Rj-1Center and RjPosition relationship, from R1, R2... ..., Rj
Middle Selection Center is located at RjInternal or borderline all minimum enclosed rectangles, are put into RjMerge in set, subsequently into step
G3;
G3, to R1Merge set, R2Merge set ... ..., RjMerge set carry out condition merging, comprise the following steps:
G3-1, compare R1Merge set and R2Merge set, work as R2Merge set and include R1Merge at least one in set
During minimum enclosed rectangle, to R1Merge set and R2Merge set and seek union, work as R2Merge set and do not include R1Merge in set
During any one minimum enclosed rectangle, by R2Merge set to be put into isolated area set Q;
Compare R1Merge set and R3Merge set, work as R3Merge set and include R1Merge at least one minimum in set
During boundary rectangle, to R1Merge set and R3Merge set and seek union, work as R3Merge set and do not include R1Merge any in set
During one minimum enclosed rectangle, by R3Merge set to be put into isolated area set Q;
By that analogy, until comparing R1Merge set and RjMerge set, work as RjMerge set and include R1Merge in set
During at least one minimum enclosed rectangle, to R1Merge set and RjMerge set and seek union, work as RjMerge set and do not include R1Merge
During any one minimum enclosed rectangle in set, by RjMerge set to be put into isolated area set Q, subsequently into step
G3-2;
Merging set number in G3-2, statistical iteration regional ensemble Q, when the merging set in isolated area set Q
When number is more than or equal to 2, into step G3-3, when the merging set number in isolated area set Q is 0 or 1, by isolated area
Merging set in set Q is as a union, into step G4.
G3-3, by isolated area set Q multiple merging set all take out, isolated area set Q is turned into empty set,
Then multiple merging set to taking-up are arranged in order from small to large according to subscript size, are compared first and are merged set and second
It is individual to merge set, when merging set comprising first at least one minimum enclosed rectangle merged in set for second, to the
One merges set and second merging set and seeks union, and merging set when second does not include appointing during first merging is gathered
During one minimum enclosed rectangle of meaning, second merging set is put into isolated area set Q;
Compare first and merge set and the 3rd merging set, set is merged when the 3rd and includes first merging set
In at least one minimum enclosed rectangle when, to first merge set and the 3rd merge set seek union, when the 3rd conjunction
And when gathering any one minimum enclosed rectangle not included during first merging is gathered, the 3rd merging set is put into independence
In regional ensemble Q;By that analogy, until comparing first merges set and last merging set, when last merging
When set is comprising first at least one minimum enclosed rectangle merged in set, set and last conjunction are merged to first
And gather and seek union, when last merging set does not include first any one minimum enclosed rectangle merged in set
When, last merging set is put into isolated area set Q, subsequently into step G3-4.
G3-4, according to the method in step G3-3 isolated area set Q is reprocessed, until isolated area set
Merging set number in Q is 0 or 1, using the merging set in isolated area set Q as a union, subsequently into step
G4。
G4, each union obtained in step G3 handled as follows, statistics one is simultaneously concentrated all
The apex coordinate of minimum enclosed rectangle, the minimum value that x coordinate is selected from apex coordinate are designated as xmin, select the maximum of x coordinate
It is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, the maximum for selecting y-coordinate is designated as ymax, with (xmin, ymin), (xmax,
ymin), (xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit, then from it is each and concentrate obtain it is all
Rectangular area is the Chinese character region in original image.
The present invention realizes the detection to retail shop's label background profile by scan line sampling and Kmeans clusters, is advantageous to
Retail shop's label is accurately positioned in natural scene, avoids the interference of other complex backgrounds;The present invention is real using the division of hsv color space
Now to the colo(u)r breakup of retail shop's label Chinese character foreground, the Chinese character area of different colours on complete detection retail shop label can be ensured
Domain, reduce the misclassification rate of Chinese character detection;The present invention is filtered by the analysis to each layer of Chinese character foreground, is realized to retail shop's label
The detection of middle a variety of colors Chinese character, eventually through each layer Chinese character region is integrated, realize to label Chinese character area of retail shop in natural scene
The automatic detection in domain.The present invention can effectively improve the degree of accuracy of Chinese character region detection, to being known based on the Chinese character under natural scene
Other application is significant.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the present invention;
Fig. 2 is black and white division schematic diagram in the division of hsv color space of the present invention;
Fig. 3 is the division schematic diagram of other colors in the division of hsv color space of the present invention;
Fig. 4 is the original image scanned in the embodiment of the present invention under natural scene;
Fig. 5 is the area schematic of plate with trademark background profile in the embodiment of the present invention.
Embodiment
As shown in figure 1, retail shop's label Chinese character region automatic testing method in a kind of natural scene of the present invention, including
Following steps:
A, the retail shop's label scanned in natural scene obtains original image, and the sample region figure of rectangle is intercepted from original image
Picture, and the RGB triple channels of sample region image are deployed, forms the matrix of the row of M*N rows 3, and wherein M is the width of sample region image, N
For the height of sample region image, Kmeans clusters, setting are carried out using every a line of matrix as a point of three dimensions respectively
The classification number of cluster is 2, obtains two cluster centre points, respectively vectorial V1 and V2, subsequently into step B.
In order to ensure that vectorial V1 and V2 can reflect the main pixel distribution of sample region image, step A can be divided into following two
Step;
Retail shop's label in A1, scanning natural scene obtains original image, and 1/3 length is more than in scan line and is less than 2/3
Appoint to take in the section of length and be a little used as basic point, point builds R*kR rectangularly-sampled area centered on this basic point, and wherein R is
The width in rectangularly-sampled area, R value are more than the 1/7 of original image width, and 1/4, the k less than original image width adopts for rectangle
The ratio of width to height in sample area, k span is 1/4<k<4, rectangularly-sampled area is cut from original image, obtains sample region image.
Wherein, the restriction to rectangularly-sampled zone position and size can ensure that the main contents of original image are covered in rectangularly-sampled area, keep away
Exempt from the missing inspection to different colours Chinese character region.
A2, the RGB triple channels expansion by sample region image, the matrix of the row of M*N rows 3 is formed, wherein M is sample region image
Width, N are the height of sample region image, a point using every a line of matrix as three dimensions, are carried out using Euclidean distance
Kmeans is clustered, and is set the classification number of cluster as 2, is obtained two cluster centre points, respectively vectorial V1 and V2, vectorial V1 and V2
The main pixel distribution of sample region image is reflected, for the identification to retail shop's label background profile in natural scene.
B, each pixel of original image is calculated respectively to vectorial V1 and V2 distance, and creates two and original image
Size identical initializes binary map bg1 and bg2, and the pixel value for initializing all pixels point in binary map bg1 and bg2 is 0,
Setpoint distance threshold X, compare each pixel of original image successively to vectorial V1 distance and X magnitude relationship, when original
, will be with the pixel point coordinates identical picture in binary map bg1 is initialized when the pixel of image to vectorial V1 distance are less than X
The pixel value of vegetarian refreshments is set to 1, obtains coarse contour binary map BG1;Compare each pixel of original image successively to vectorial V2's
Distance and X magnitude relationship, when pixel to the vectorial V2 of original image distance are less than X, in binary map bg2 is initialized
Pixel value with the pixel point coordinates identical pixel is set to 1, coarse contour binary map BG2 is obtained, respectively to coarse contour two
Value figure BG1 and BG2 carry out connected domain analysis after doing Morphological scale-space, and area maximum is selected from coarse contour binary map BG1 and BG2
Connected domain repaired and filled, obtain background profile binary map.
Step B is the detection to original image background profile, and the background profile binary map to enable to obtain fully reflects
The scope of retail shop's label, following steps can be classified as:
B1, each pixel in original image is labeled as 1,2 successively ... ..., n, n are pixel in original image
Number, calculates the pixel x and vectorial V1 and V2 of original image Euclidean distance L1 (x) and L2 (x), wherein x=1, and 2 ... ...,
n。
B2, two and original image size identical initialization binary map bg1 and bg2 are created, and two are initialized by two
The pixel value of all pixels point is set to 0 in value figure bg1 and bg2, setpoint distance threshold X, X span should combine L1 (x) and
L2 (x) is empirically determined, as the pixel x and vectorial V1 of original image Euclidean distance L1 (x) < X, will initialize two
Pixel value in value figure bg1 with pixel x position identical pixel is set to 1, obtains coarse contour binary map BG1, works as original graph
, will be identical with pixel x position in initialization binary map bg2 when the pixel x and vectorial V2 of picture Euclidean distance L2 (x) < X
The pixel value of pixel be set to 1, obtain coarse contour binary map BG2.
B3, Morphological scale-space is done to coarse contour binary map BG1 and BG2 respectively, i.e., thick wheel is removed by erosion operation first
Wide binary map BG1 and BG2 fine rule, the tiny of coarse contour binary map BG1 and BG2 is then removed by dilation operation and closed operation
Gully, connected domain analysis finally is carried out to coarse contour binary map BG1 and BG2, face is selected from coarse contour binary map BG1 and BG2
The maximum connected domain of product is as background profile.
Hole in B4, filling background profile, and the depression on background profile edge is repaired, obtain background profile two-value
Figure.
C, hsv color space is divided into black, white, red, yellow, green, cyan, blueness, pinkish red eight pieces of colors
Space, the division rule of eight pieces of color spaces are as follows:
Black space, v<0.3or(v<0.5and s<=0.25);
White space, v>=0.5and s<=0.25;
Red space, (h<1/12or h>=11/12) and v>0.3and s>=0.25;
Yellow space, h>=1/12and h<3/12and v>0.3and s>=0.25;
Vert space, h>=3/12and h<5/12and v>0.3and s>=0.25;
Cyan space, h>=5/12and h<7/12and v>0.3and s>=0.25;
Blue color space, h>=7/12and h<9/12and v>0.3and s>=0.25;
Pinkish red space, h>=9/12and h<11/12and v>0.3and s>=0.25;
H represents the tone in hsv color space in formula, and the saturation degree in behalf hsv color space, v represents hsv color
Lightness in space, subsequently into step D.Hsv color space can reflect perception of the human eye to color well, according to above-mentioned
Division rule divides to hsv color space, a variety of colors that can reflect comprehensively in natural scene.Fig. 2 is HSV of the present invention
Black and white division schematic diagram in color space division, Fig. 3 are the division of other colors in the division of hsv color space of the present invention
Schematic diagram.
D, 8 and original image size identical binary map are created, and by the pixel of all pixels point in every binary map
Value is set to 0, and original image is transformed into hsv color space from rgb space, then judges original image in hsv color space
Each pixel belonging to color type, all pixels point for belonging to same color type is mapped to pair of a binary map
Opening position is answered, and the pixel value of the pixel of the corresponding position of binary map is set to 1, finally obtains 8 distribution of color two-values
Figure, subsequently into step E.
E, 8 distribution of color binary maps are done with carrying out Morphological scale-space after computing again with background profile binary map respectively,
The tiny gully in 8 distribution of color binary maps and fine rule are filtered out, obtains 8 thin contoured profile binary map, respectively to 8 thin wheel
Exterior feature distribution binary map carries out connected domain scanning, obtains mark figure corresponding to connected graph using eight connectivity labelling method, and calculate each
The attribute of connected domain, then the connected domain that Chinese-character stroke feature is not met in 8 thin contoured profile binary map is filtered, obtained
Binary map is distributed to 8 stroke levels, is distributed the connected domain for meeting Chinese-character stroke feature in binary map to each stroke level respectively
Merge, multiple connected domains after merging are designated as a marked region and determine mark value, for any two mark zone
Domain, if the center-of-mass coordinate of a marked region is located in the minimum enclosed rectangle of another marked region, by the marked region
Mark value be set to the mark value of another marked region, be distributed binary map finally for each stroke level, successively will mark
Value identical marked region is designated as a line of text, 8 line of text binary maps is obtained, subsequently into step F.
What each connected domain in 8 distribution of color binary maps reflected is each stroke for forming Chinese character, by each
The connected domain that stroke feature is not met in distribution of color binary map is filtered, and the connected domain to meeting stroke feature is closed
And 8 line of text binary maps are obtained, specifically include following steps:
E1,8 distribution of color binary maps are done with background profile binary map respectively and computing, obtain 8 coarse contours distributions
Binary map.
E2, Morphological scale-space is done to 8 coarse contour distribution binary maps respectively, i.e., to each coarse contour binary map vertical
Closed operation and opening operation with 7 pixels are done in horizontal both direction, filter out tiny gully and fine rule, obtain 8 thin profile point
Cloth binary map.
E3,8 connected domain scannings are carried out to 8 thin contoured profile binary map respectively, and calculate each thin contoured profile two
It is worth area, center-of-mass coordinate and the minimum enclosed rectangle of each connected domain in figure.
E4, for any one connected domain in each thin contoured profile binary map, when it meets following three filterings
During at least one in condition, the pixel value of all pixels point in this connected domain is set to 0, obtains 8 stroke levels distribution two-values
Figure, wherein three filter conditions are respectively:
A, the area ratio of the area of connected domain and its minimum enclosed rectangle is less than 1/5;
B, the width of the minimum enclosed rectangle of connected domain is less than the 1/200 of original image width or more than original image width
1/2;
C, the ratio of width to height of the minimum enclosed rectangle of connected domain is less than 1/10 or more than 10.
E5, binary map is distributed for 8 obtained stroke levels of step E4, each stroke level distribution binary map is made such as
Lower processing:
E5-1, by stroke level be distributed binary map in each connected domain be labeled as C successively1, C2... ..., Ci, i is stroke level
The number of connected domain in binary map is distributed, respectively by C1, C2... ..., CiMark value be set to respective subscript value, i.e. C1Mark
Note value is 1, C2Mark value be 2, by that analogy, CiMark value be i, and define independent communication domain set P, independent communication domain
Initial connected domain number is 0 in set P.
E5-2, from C1, C2... ..., CiThe middle minimum enclosed rectangle for choosing any two connected domain is to axis of ordinates upslide
Shadow, two vertical projection line segments are obtained, it is the overlap length between two vertical projection line segments to define disH, and is provided when two perpendicular
DisH values are 0 when straight Projection Line Segment does not have overlapping, from C1, C2... ..., CiThe middle minimum external square for choosing any two connected domain
Shape obtains two floor projection line segments to projecting on axis of abscissas, and it is the most short distance between two floor projection line segments to define dis
From, when two floor projection line segments are adjacent or overlapping, dis values are 0, when two floor projection line segments do not have overlapping, dis values
For left side floor projection line segment right endpoint the distance between to the left end point of right side floor projection line segment.
E5-3, definition avgW are character mean breadth, and avgW initial value is C1Minimum enclosed rectangle width, definition
Sum is character row overall width, and sum initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
Choose C1And C2Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C2Middle all pixels point
Pixel value be set to 0, and by C2Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C2Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C2Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum2Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C2It is put into independent communication domain set P;
Choose C1And C3Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C3Middle all pixels point
Pixel value be set to 0, and by C3Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C3Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C3Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum3Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C3It is put into independent communication domain set P;
By that analogy, until choosing C1And CiObtain to axis of ordinates upslide movie queen two of minimum enclosed rectangle it is vertical
Projection Line Segment, when the overlap length disH between two vertical projection line segments is less than C1Minimum enclosed rectangle height 1/4 when, will
CiThe pixel value of middle all pixels point is set to 0, and by CiMark value be set to 0, the overlap length between two vertical projection line segments
DisH is more than or equal to C1Minimum enclosed rectangle height 1/4 when, choose C1And CiMinimum enclosed rectangle to axis of abscissas upslide
Two floor projection line segments that movie queen obtains, when the beeline dis between two floor projection line segments is less than or equal to the 1.5 of avgW
Times when, by CiMark value be set to C1Mark value 1, while update sum value and add C for sumiMinimum enclosed rectangle width,
Then cnt value is added 1, and the value for updating avgW is sum divided by cnt, as the beeline dis between two floor projection line segments
During more than 1.5 times of avgW, by CiIt is put into independent communication domain set P, subsequently into step E5-4.
Connected domain number in E5-4, statistical iteration connected domain set P, when the connected domain in independent communication domain set P
When number is more than or equal to 2, into step E5-5, when the connected domain number in independent communication domain set P is 0 or 1, into step
E5-7。
E5-5, multiple connected domains in independent communication domain set P are all taken out, set P in independent communication domain is turned into empty
Then multiple connected domains of taking-up are arranged in order by collection from small to large according to subscript size, definition avgW is character mean breadth,
AvgW initial value is the width of the minimum enclosed rectangle of first connected domain, and definition sum is character row overall width, and sum's is first
Initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
What the minimum enclosed rectangle of first connected domain of selection and second connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in second connected domain is set to 0, and by the mark of second connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and second connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of second connected domain is set to the mark value of first connected domain, while the value for updating sum adds second for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, second connected domain is put into independent communication domain collection
Close in P;
What the minimum enclosed rectangle of first connected domain of selection and the 3rd connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in the 3rd connected domain is set to 0, and by the mark of the 3rd connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and the 3rd connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of the 3rd connected domain is set to the mark value of first connected domain, while the value for updating sum adds the 3rd for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, the 3rd connected domain is put into independent communication domain collection
Close in P;
By that analogy, until choosing the minimum enclosed rectangle of first connected domain and last connected domain to axis of ordinates
Two vertical projection line segments that upslide movie queen obtains, when the overlap length disH between two vertical projection line segments is less than first company
When leading to the 1/4 of the minimum enclosed rectangle height in domain, the pixel value of all pixels point in last connected domain is set to 0, and will
The mark value of last connected domain is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to first
The minimum enclosed rectangle height of connected domain 1/4 when, choose first connected domain and the minimum external square of last connected domain
Two floor projection line segments that shape obtains to axis of abscissas upslide movie queen, as the beeline dis between two floor projection line segments
During less than or equal to 1.5 times of avgW, the mark value of last connected domain is set to the mark value of first connected domain, while more
New sum value adds the width of the minimum enclosed rectangle of last connected domain for sum, cnt value then is added into 1, and update
AvgW value is sum divided by cnt, will most when the beeline dis between two floor projection line segments is more than 1.5 times of avgW
The latter connected domain is put into independent communication domain set P, subsequently into step E5-6;
E5-6, according to the method in step E5-5 set P in independent communication domain is reprocessed, until independent communication domain
Connected domain number in set P is 0 or 1, subsequently into step E5-7.
E5-7, mark value identical connected domain in stroke level distribution binary map is designated as a marked region successively, and will
Mark value of the mark value of connected domain as the marked region, area, the center-of-mass coordinate of each marked region are then calculated respectively
And minimum enclosed rectangle, subsequently into step E6.
E6, binary map is distributed for 8 obtained stroke levels of step E5, each stroke level distribution binary map is made such as
Lower processing:E6-1, for any two marked region, if the center-of-mass coordinate of a marked region is located at another marked region
In minimum enclosed rectangle, then the mark value of the marked region is set to the mark value of another marked region, subsequently into step
E6-2。
E6-2, mark value identical marked region in stroke level distribution binary map is designated as a line of text successively, then
Width, height, area and the minimum enclosed rectangle of each line of text are calculated, obtains line of text binary map.
F, for any one line of text in 8 line of text binary maps, when the height of the minimum enclosed rectangle of line of text
Less than the minimum enclosed rectangle height of background profile 1/20, the ratio of width to height of the minimum enclosed rectangle of line of text be less than 7/10 or
The area of line of text and the area ratio of its minimum enclosed rectangle are less than 1/10 or during more than 4/5, by this article one's own profession from corresponding text
Deleted in one's own profession binary map, 8 obtained character picture binary map, calculate all texts in each character picture binary map respectively
The area of one's own profession and, when the area being calculated and less than background profile binary map minimum enclosed rectangle area 1/200 when,
Corresponding character picture binary map is deleted, and the minimum for calculating all line of text in remaining character picture binary map respectively is outer
The coordinate of rectangle is connect, subsequently into step G.
What each line of text in 8 line of text binary maps reflected is the Chinese character region of different colours in retail shop's label, is led to
Cross and the line of text that Chinese-character writing rule is not met in each line of text binary map is filtered, the Chinese character area after being refined
Domain, specifically include following steps:
F1,8 line of text binary maps for obtaining, for any one text in each line of text binary map
OK, when it meets at least one in following three filter conditions, by all pixels point of each connected domain in this article one's own profession
Mark value be set to 0,8 candidate image binary maps are obtained, wherein three filter conditions are respectively:
D, height is less than the 1/20 of the minimum enclosed rectangle height of background profile;
E, the ratio of width to height of one's own profession is less than 7/10;
F, the area ratio of area and its minimum enclosed rectangle is less than 1/10 or more than 4/5.
F2,8 candidate image binary maps for obtaining, for any one text in each candidate image binary map
One's own profession, when it meets at least one in following two filter conditions, by all pixels of each connected domain in this article one's own profession
The mark value of point is set to 0, obtains 8 character picture binary maps, two of which filter condition is respectively:
G, the minimum enclosed rectangle region of line of text is summed by row, obtains a series of row projection value, row projection value surpasses
The continuous columns for crossing the 70% of minimum enclosed rectangle height is more than 0.7 times of minimum enclosed rectangle height;
H, the area of line of text is less than the 1/1000 of the minimum enclosed rectangle area of background profile binary map.
F3,8 character picture binary maps for obtaining, calculate formed in each character picture binary map first successively
The area of all connected domains of each line of text and, when the area being calculated and minimum external less than background profile binary map
Rectangular area 1/200 when, by corresponding character picture binary map delete, then calculate remaining character picture binary map respectively
In all line of text minimum enclosed rectangle coordinate.
G, one and original image size identical blank image are created, successively by institute in remaining character picture binary map
The minimum enclosed rectangle for having line of text is marked in the corresponding position of blank image, primary identification image is obtained, respectively by primary
Known in identification image by the border that two or more minimum enclosed rectangle forms in the isolated area of irregular polygon as one
Other region, for each identification region, the coordinate on each summit is counted, and the minimum value of x coordinate is selected from apex coordinate
It is designated as xmin, the maximum for selecting x coordinate is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, select y-coordinate maximum note
For ymax, with (xmin, ymin), (xmax, ymin), (xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit,
Remaining minimum enclosed rectangle composition in all rectangular areas then obtained from each identification region and primary identification image
Region be Chinese character region in original image.
Line of text in each character picture binary map represents the Chinese character region of refining of different colours respectively, by will not
Merged in Chinese character region of refining with color, you can obtain the Chinese character region in original image, specifically include following steps:
G1, one and original image size identical blank image are created, successively by remaining character picture binary map
The minimum enclosed rectangle of all line of text is marked in the corresponding position of blank image, obtains primary identification image, primary is known
Minimum enclosed rectangle in other image is labeled as R successively1, R2... ..., Rj, j is minimum enclosed rectangle in primary identification image
Number, and the centre coordinate of each minimum enclosed rectangle is calculated, subsequently into step G2.
G2, R is judged successively2, R3... ..., RjCenter and R1Position relationship, from R1, R2... ..., RjMiddle Selection Center
Positioned at R1Internal or borderline all minimum enclosed rectangles, are put into R1Merge in set;
R is judged successively1, R3... ..., RjCenter and R2Position relationship, from R1, R2... ..., RjMiddle Selection Center is located at
R2Internal or borderline all minimum enclosed rectangles, are put into R2Merge in set;
By that analogy, until judging R successively1, R2... ..., Rj-1Center and RjPosition relationship, from R1, R2... ..., Rj
Middle Selection Center is located at RjInternal or borderline all minimum enclosed rectangles, are put into RjMerge in set, subsequently into step
G3。
G3, to R1Merge set, R2Merge set ... ..., RjMerge set carry out condition merging, comprise the following steps:
G3-1, compare R1Merge set and R2Merge set, work as R2Merge set and include R1Merge at least one in set
During minimum enclosed rectangle, to R1Merge set and R2Merge set and seek union, work as R2Merge set and do not include R1Merge in set
During any one minimum enclosed rectangle, by R2Merge set to be put into isolated area set Q;
Compare R1Merge set and R3Merge set, work as R3Merge set and include R1Merge at least one minimum in set
During boundary rectangle, to R1Merge set and R3Merge set and seek union, work as R3Merge set and do not include R1Merge any in set
During one minimum enclosed rectangle, by R3Merge set to be put into isolated area set Q;
By that analogy, until comparing R1Merge set and RjMerge set, work as RjMerge set and include R1Merge in set
During at least one minimum enclosed rectangle, to R1Merge set and RjMerge set and seek union, work as RjMerge set and do not include R1Merge
During any one minimum enclosed rectangle in set, by RjMerge set to be put into isolated area set Q, subsequently into step
G3-2。
Merging set number in G3-2, statistical iteration regional ensemble Q, when the merging set in isolated area set Q
When number is more than or equal to 2, into step G3-3, when the merging set number in isolated area set Q is 0 or 1, by isolated area
Merging set in set Q is as a union, into step G4.
G3-3, by isolated area set Q multiple merging set all take out, isolated area set Q is turned into empty set,
Then multiple merging set to taking-up are arranged in order from small to large according to subscript size, are compared first and are merged set and second
It is individual to merge set, when merging set comprising first at least one minimum enclosed rectangle merged in set for second, to the
One merges set and second merging set and seeks union, and merging set when second does not include appointing during first merging is gathered
During one minimum enclosed rectangle of meaning, second merging set is put into isolated area set Q;
Compare first and merge set and the 3rd merging set, set is merged when the 3rd and includes first merging set
In at least one minimum enclosed rectangle when, to first merge set and the 3rd merge set seek union, when the 3rd conjunction
And when gathering any one minimum enclosed rectangle not included during first merging is gathered, the 3rd merging set is put into independence
In regional ensemble Q;By that analogy, until comparing first merges set and last merging set, when last merging
When set is comprising first at least one minimum enclosed rectangle merged in set, set and last conjunction are merged to first
And gather and seek union, when last merging set does not include first any one minimum enclosed rectangle merged in set
When, last merging set is put into isolated area set Q, subsequently into step G3-4.
G3-4, according to the method in step G3-3 isolated area set Q is reprocessed, until isolated area set
Merging set number in Q is 0 or 1, using the merging set in isolated area set Q as a union, subsequently into step
G4。
G4, each union obtained in step G3 handled as follows, statistics one is simultaneously concentrated all
The apex coordinate of minimum enclosed rectangle, the minimum value that x coordinate is selected from apex coordinate are designated as xmin, select the maximum of x coordinate
It is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, the maximum for selecting y-coordinate is designated as ymax, with (xmin, ymin), (xmax,
ymin), (xmin, ymax), (xmax, ymax) four coordinates form rectangular area as summit, then from it is each and concentrate obtain it is all
Rectangular area is the Chinese character region in original image.
Illustrate retail shop's label Chinese character region automatic detection in natural scene of the present invention with reference to specific embodiment
Method, comprise the following steps:
A, by scan line sampling and Kmeans cluster obtain reflection sample region image main pixel color vectorial V1 and
V2, comprise the following steps:
Retail shop's label in A1, scanning natural scene, obtains original image as shown in Figure 4, the midpoint of scan line is made
For basic point, the rectangularly-sampled area of one R*2R of point structure centered on this basic point, wherein R is the width in rectangularly-sampled area, and R's takes
It is worth for the 1/6 of original image width, rectangularly-sampled area is cut from original image, obtains sample region image.Samples of green inframe
Sample region image contain the color of main word and background in original image.
A2, the RGB triple channels expansion by sample region image, the matrix of the row of M*N rows 3 is formed, wherein M is sample region image
Width, N are the height of sample region image, a point using every a line of matrix as three dimensions, are carried out using Euclidean distance
Kmeans is clustered, and is set the classification number of cluster as 2, is obtained two cluster centre points, respectively vectorial V1 and V2, vectorial V1 and V2
Reflect the main pixel color of sample region image.
B, the background profile of original image is determined using vectorial V1 and V2, is comprised the following steps:
B1, each pixel in original image is labeled as 1,2 successively ... ..., n, n are pixel in original image
Number, calculates the pixel x and vectorial V1 and V2 of original image Euclidean distance L1 (x) and L2 (x), wherein x=1, and 2 ... ...,
n。
B2, two and original image size identical initialization binary map bg1 and bg2 are created, and two are initialized by two
The pixel value of all pixels point is set to 0 in value figure bg1 and bg2, and setpoint distance threshold X is 50, when original image pixel x with
During vectorial V1 Euclidean distance L1 (x) < 50, the picture in binary map bg1 with pixel x position identical pixel will be initialized
Plain value is set to 1, coarse contour binary map BG1 is obtained, as the pixel x and vectorial V2 of original image Euclidean distance L2 (x) < 50
When, the pixel value initialized in binary map bg2 with pixel x position identical pixel is set to 1, obtains coarse contour binary map
BG2。
B3, Morphological scale-space is done to coarse contour binary map BG1 and BG2 respectively, i.e., thick wheel is removed by erosion operation first
Wide binary map BG1 and BG2 fine rule, the tiny of coarse contour binary map BG1 and BG2 is then removed by dilation operation and closed operation
Gully, connected domain analysis finally is carried out to coarse contour binary map BG1 and BG2, face is selected from coarse contour binary map BG1 and BG2
The maximum connected domain of product is as background profile.
Hole in B4, filling background profile, and the depression on background profile edge is repaired, obtain background profile two-value
Figure, as shown in Figure 5.Background profile binary map can accurately reflect the position of retail shop's label in original image, effectively avoid background
Outside interference of the noise to Chinese character region detection.
C, hsv color space is divided into black, white, red, yellow, green, cyan, blueness, pinkish red eight pieces of colors
Space, the division rule of eight pieces of color spaces are as follows:
Black space, v<0.3or(v<0.5and s<=0.25);
White space, v>=0.5and s<=0.25;
Red space, (h<1/12or h>=11/12) and v>0.3and s>=0.25;
Yellow space, h>=1/12and h<3/12and v>0.3and s>=0.25;
Vert space, h>=3/12and h<5/12and v>0.3and s>=0.25;
Cyan space, h>=5/12and h<7/12and v>0.3and s>=0.25;
Blue color space, h>=7/12and h<9/12and v>0.3and s>=0.25;
Pinkish red space, h>=9/12and h<11/12and v>0.3and s>=0.25;
H represents the tone in hsv color space in formula, and the saturation degree in behalf hsv color space, v represents hsv color
Lightness in space, subsequently into step D.Hsv color space can reflect perception of the human eye to color well, according to above-mentioned
Division rule divides to hsv color space, a variety of colors that can reflect comprehensively in natural scene.
D, colo(u)r breakup is carried out to original image, detailed process is:Create 8 and original image size identical two-value
Figure, and the pixel value of all pixels point in every binary map is set to 0, original image is transformed into hsv color sky from rgb space
Between in, then judge the color type belonging to each pixel of original image in hsv color space, same color class will be belonged to
The all pixels point of type is mapped to the corresponding position of a binary map, and by the picture of the pixel of the corresponding position of binary map
Plain value is set to 1,8 distribution of color binary maps is finally obtained, subsequently into step E.
E, Chinese character connected domain analysis is carried out to 8 distribution of color binary maps, specifically includes following steps:
E1,8 distribution of color binary maps are done with background profile binary map respectively and computing, obtain 8 coarse contours distributions
Binary map.
E2, Morphological scale-space is done to 8 coarse contour distribution binary maps respectively, i.e., to each coarse contour binary map vertical
Closed operation and opening operation with 7 pixels are done in horizontal both direction, filter out tiny gully and fine rule, obtain 8 thin profile point
Cloth binary map.
E3,8 connected domain scannings are carried out to 8 thin contoured profile binary map respectively, and calculate each thin contoured profile two
It is worth area, center-of-mass coordinate and the minimum enclosed rectangle of each connected domain in figure.
E4, for any one connected domain in each thin contoured profile binary map, when it meets following three filterings
During at least one in condition, the pixel value of all pixels point in this connected domain is set to 0, obtains 8 stroke levels distribution two-values
Figure, wherein three filter conditions are respectively:
A, the area ratio of the area of connected domain and its minimum enclosed rectangle is less than 1/5;
B, the width of the minimum enclosed rectangle of connected domain is less than the 1/200 of original image width or more than original image width
1/2;
C, the ratio of width to height of the minimum enclosed rectangle of connected domain is less than 1/10 or more than 10.
E5, binary map is distributed for 8 obtained stroke levels, each stroke level distribution binary map is located as follows
Reason:
E5-1, by stroke level be distributed binary map in each connected domain be labeled as C successively1, C2... ..., Ci, i is stroke level
The number of connected domain in binary map is distributed, respectively by C1, C2... ..., CiMark value be set to respective subscript value, i.e. C1Mark
Note value is 1, C2Mark value be 2, by that analogy, CiMark value be i, and define independent communication domain set P, independent communication domain
Initial connected domain number is 0 in set P.
E5-2, from C1, C2... ..., CiThe middle minimum enclosed rectangle for choosing any two connected domain is to axis of ordinates upslide
Shadow, two vertical projection line segments are obtained, it is the overlap length between two vertical projection line segments to define disH, and is provided when two perpendicular
DisH values are 0 when straight Projection Line Segment does not have overlapping, from C1, C2... ..., CiThe middle minimum external square for choosing any two connected domain
Shape obtains two floor projection line segments to projecting on axis of abscissas, and it is the most short distance between two floor projection line segments to define dis
From, when two floor projection line segments are adjacent or overlapping, dis values are 0, when two floor projection line segments do not have overlapping, dis values
For left side floor projection line segment right endpoint the distance between to the left end point of right side floor projection line segment.
E5-3, definition avgW are character mean breadth, and avgW initial value is C1Minimum enclosed rectangle width, definition
Sum is character row overall width, and sum initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
Choose C1And C2Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C2Middle all pixels point
Pixel value be set to 0, and by C2Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C2Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C2Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum2Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C2It is put into independent communication domain set P;
Choose C1And C3Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two
Overlap length disH between bar vertical projection line segment is less than C1Minimum enclosed rectangle height 1/4 when, by C3Middle all pixels point
Pixel value be set to 0, and by C3Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1
Minimum enclosed rectangle height 1/4 when, choose C1And C3Obtained to axis of abscissas upslide movie queen two of minimum enclosed rectangle
Floor projection line segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C3Mark
Note value is set to C1Mark value 1, while update sum value and add C for sum3Minimum enclosed rectangle width, then by cnt value
Add 1, and the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than the 1.5 of avgW
Times when, by C3It is put into independent communication domain set P;
By that analogy, until choosing C1And CiObtain to axis of ordinates upslide movie queen two of minimum enclosed rectangle it is vertical
Projection Line Segment, when the overlap length disH between two vertical projection line segments is less than C1Minimum enclosed rectangle height 1/4 when, will
CiThe pixel value of middle all pixels point is set to 0, and by CiMark value be set to 0, the overlap length between two vertical projection line segments
DisH is more than or equal to C1Minimum enclosed rectangle height 1/4 when, choose C1And CiMinimum enclosed rectangle to axis of abscissas upslide
Two floor projection line segments that movie queen obtains, when the beeline dis between two floor projection line segments is less than or equal to the 1.5 of avgW
Times when, by CiMark value be set to C1Mark value 1, while update sum value and add C for sumiMinimum enclosed rectangle width,
Then cnt value is added 1, and the value for updating avgW is sum divided by cnt, as the beeline dis between two floor projection line segments
During more than 1.5 times of avgW, by CiIt is put into independent communication domain set P, subsequently into step E5-4.
Connected domain number in E5-4, statistical iteration connected domain set P, when the connected domain in independent communication domain set P
When number is more than or equal to 2, into step E5-5, when the connected domain number in independent communication domain set P is 0 or 1, into step
E5-7。
E5-5, multiple connected domains in independent communication domain set P are all taken out, set P in independent communication domain is turned into empty
Then multiple connected domains of taking-up are arranged in order by collection from small to large according to subscript size, definition avgW is character mean breadth,
AvgW initial value is the width of the minimum enclosed rectangle of first connected domain, and definition sum is character row overall width, and sum's is first
Initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
What the minimum enclosed rectangle of first connected domain of selection and second connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in second connected domain is set to 0, and by the mark of second connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and second connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of second connected domain is set to the mark value of first connected domain, while the value for updating sum adds second for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, second connected domain is put into independent communication domain collection
Close in P;
What the minimum enclosed rectangle of first connected domain of selection and the 3rd connected domain obtained to axis of ordinates upslide movie queen
Two vertical projection line segments, when the overlap length disH between two vertical projection line segments is less than the minimum external of first connected domain
Rectangular elevation 1/4 when, the pixel value of all pixels point in the 3rd connected domain is set to 0, and by the mark of the 3rd connected domain
Note value is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to the minimum external square of first connected domain
Shape height 1/4 when, choose the minimum enclosed rectangle of first connected domain and the 3rd connected domain to axis of abscissas upslide movie queen
Two obtained floor projection line segments, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
When, the mark value of the 3rd connected domain is set to the mark value of first connected domain, while the value for updating sum adds the 3rd for sum
The width of the minimum enclosed rectangle of individual connected domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two
When beeline dis between bar floor projection line segment is more than 1.5 times of avgW, the 3rd connected domain is put into independent communication domain collection
Close in P;
By that analogy, until choosing the minimum enclosed rectangle of first connected domain and last connected domain to axis of ordinates
Two vertical projection line segments that upslide movie queen obtains, when the overlap length disH between two vertical projection line segments is less than first company
When leading to the 1/4 of the minimum enclosed rectangle height in domain, the pixel value of all pixels point in last connected domain is set to 0, and will
The mark value of last connected domain is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to first
The minimum enclosed rectangle height of connected domain 1/4 when, choose first connected domain and the minimum external square of last connected domain
Two floor projection line segments that shape obtains to axis of abscissas upslide movie queen, as the beeline dis between two floor projection line segments
During less than or equal to 1.5 times of avgW, the mark value of last connected domain is set to the mark value of first connected domain, while more
New sum value adds the width of the minimum enclosed rectangle of last connected domain for sum, cnt value then is added into 1, and update
AvgW value is sum divided by cnt, will most when the beeline dis between two floor projection line segments is more than 1.5 times of avgW
The latter connected domain is put into independent communication domain set P, subsequently into step E5-6.
E5-6, according to the method in step E5-5 set P in independent communication domain is reprocessed, until independent communication domain
Connected domain number in set P is 0 or 1, subsequently into step E5-7.
E5-7, mark value identical connected domain in stroke level distribution binary map is designated as a marked region successively, and will
Mark value of the mark value of connected domain as the marked region, area, the center-of-mass coordinate of each marked region are then calculated respectively
And minimum enclosed rectangle, subsequently into step E6.
E6, binary map is distributed for 8 obtained stroke levels, each stroke level distribution binary map is located as follows
Reason:
E6-1, for any two marked region, if the center-of-mass coordinate of a marked region is located at another marked region
Minimum enclosed rectangle in, then the mark value of the marked region is set to the mark value of another marked region, subsequently into step
Rapid E6-2.
E6-2, mark value identical marked region in stroke level distribution binary map is designated as a line of text successively, then
Width, height, area and the minimum enclosed rectangle of each line of text are calculated, obtains line of text binary map.
F, what each line of text in 8 line of text binary maps reflected is the Chinese character region of different colours in retail shop's label,
By being filtered to the line of text that Chinese-character writing rule is not met in each line of text binary map, the Chinese character area after being refined
Domain, specifically include following steps:
F1,8 line of text binary maps for obtaining, for any one text in each line of text binary map
OK, when it meets at least one in following three filter conditions, by all pixels point of each connected domain in this article one's own profession
Mark value be set to 0,8 candidate image binary maps are obtained, wherein three filter conditions are respectively:
D, the height of line of text is less than the 1/20 of the minimum enclosed rectangle height of background profile;
E, the ratio of width to height of line of text is less than 7/10;
F, the area ratio of the area of line of text and its minimum enclosed rectangle is less than 1/10 or more than 4/5.
F2,8 candidate image binary maps for obtaining, for any one text in each candidate image binary map
One's own profession, when it meets at least one in following two filter conditions, by all pixels of each connected domain in this article one's own profession
The mark value of point is set to 0, obtains 8 character picture binary maps, two of which filter condition is respectively:
G, the minimum enclosed rectangle region of line of text is summed by row, obtains a series of row projection value, row projection value surpasses
The continuous columns for crossing the 70% of minimum enclosed rectangle height is more than 0.7 times of minimum enclosed rectangle height;
H, the area of line of text is less than the 1/1000 of the minimum enclosed rectangle area of background profile binary map.
F3,8 character picture binary maps for obtaining, calculate formed in each character picture binary map first successively
The area of all connected domains of each line of text and, when the area being calculated and minimum external less than background profile binary map
Rectangular area 1/200 when, by corresponding character picture binary map delete, then calculate remaining character picture binary map respectively
In all line of text minimum enclosed rectangle coordinate.
G, the line of text in 8 character picture binary maps represents the Chinese character region of refining of different colours respectively, by will not
Merged in Chinese character region of refining with color, you can obtain the Chinese character region in original image, specifically include following steps:
G1, one and original image size identical blank image are created, successively by remaining character picture binary map
The minimum enclosed rectangle of all line of text is marked in the corresponding position of blank image, obtains primary identification image, primary is known
Minimum enclosed rectangle in other image is labeled as R successively1, R2... ..., Rj, j is minimum enclosed rectangle in primary identification image
Number, and the centre coordinate of each minimum enclosed rectangle is calculated, subsequently into step G2.
G2, R is judged successively2, R3... ..., RjCenter and R1Position relationship, from R1, R2... ..., RjMiddle Selection Center
Positioned at R1Internal or borderline all minimum enclosed rectangles, are put into R1Merge in set;
R is judged successively1, R3... ..., RjCenter and R2Position relationship, from R1, R2... ..., RjMiddle Selection Center is located at
R2Internal or borderline all minimum enclosed rectangles, are put into R2Merge in set;
By that analogy, until judging R successively1, R2... ..., Rj-1Center and RjPosition relationship, from R1, R2... ..., Rj
Middle Selection Center is located at RjInternal or borderline all minimum enclosed rectangles, are put into RjMerge in set, subsequently into step
G3。
G3, to R1Merge set, R2Merge set ... ..., RjMerge set carry out condition merging, comprise the following steps:
G3-1, compare R1Merge set and R2Merge set, work as R2Merge set and include R1Merge at least one in set
During minimum enclosed rectangle, to R1Merge set and R2Merge set and seek union, work as R2Merge set and do not include R1Merge in set
During any one minimum enclosed rectangle, by R2Merge set to be put into isolated area set Q;
Compare R1Merge set and R3Merge set, work as R3Merge set and include R1Merge at least one minimum in set
During boundary rectangle, to R1Merge set and R3Merge set and seek union, work as R3Merge set and do not include R1Merge any in set
During one minimum enclosed rectangle, by R3Merge set to be put into isolated area set Q;
By that analogy, until comparing R1Merge set and RjMerge set, work as RjMerge set and include R1Merge in set
During at least one minimum enclosed rectangle, to R1Merge set and RjMerge set and seek union, work as RjMerge set and do not include R1Merge
During any one minimum enclosed rectangle in set, by RjMerge set to be put into isolated area set Q, subsequently into step
G3-2。
Merging set number in G3-2, statistical iteration regional ensemble Q, when the merging set in isolated area set Q
When number is more than or equal to 2, into step G3-3, when the merging set number in isolated area set Q is 0 or 1, by isolated area
Merging set in set Q is as a union, into step G4.
G3-3, by isolated area set Q multiple merging set all take out, isolated area set Q is turned into empty set,
Then multiple merging set to taking-up are arranged in order from small to large according to subscript size, are compared first and are merged set and second
It is individual to merge set, when merging set comprising first at least one minimum enclosed rectangle merged in set for second, to the
One merges set and second merging set and seeks union, and merging set when second does not include appointing during first merging is gathered
During one minimum enclosed rectangle of meaning, second merging set is put into isolated area set Q;
Compare first and merge set and the 3rd merging set, set is merged when the 3rd and includes first merging set
In at least one minimum enclosed rectangle when, to first merge set and the 3rd merge set seek union, when the 3rd conjunction
And when gathering any one minimum enclosed rectangle not included during first merging is gathered, the 3rd merging set is put into independence
In regional ensemble Q;By that analogy, until comparing first merges set and last merging set, when last merging
When set is comprising first at least one minimum enclosed rectangle merged in set, set and last conjunction are merged to first
And gather and seek union, when last merging set does not include first any one minimum enclosed rectangle merged in set
When, last merging set is put into isolated area set Q, subsequently into step G3-4.
G3-4, according to the method in step G3-3 isolated area set Q is reprocessed, until isolated area set
Merging set number in Q is 0 or 1, using the merging set in isolated area set Q as a union, subsequently into step
G4。
G4, each union obtained in step G3 handled as follows, statistics one is simultaneously concentrated all
The apex coordinate of minimum enclosed rectangle, the minimum value that x coordinate is selected from apex coordinate are designated as xmin, select the maximum of x coordinate
It is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, the maximum for selecting y-coordinate is designated as ymax, with (xmin, ymin), (xmax,
ymin), (xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit, then from it is each and concentrate obtain it is all
Rectangular area is the Chinese character region in original image.
The present invention realizes the detection to retail shop's label background profile by scan line sampling and Kmeans clusters, is advantageous to
Retail shop's label is accurately positioned in natural scene, avoids the interference of other complex backgrounds;Realized using the division of hsv color space to business
Spread the colo(u)r breakup of label Chinese character foreground and analysis filtering is carried out to each layer of Chinese character foreground, complete detection business can be ensured
The Chinese character region of different colours on label is spread, reduces the misclassification rate of Chinese character detection;Eventually through each layer Chinese character region is integrated, realize
To the automatic detection in retail shop's label Chinese character region in natural scene.The present invention can effectively improve the accurate of Chinese character region detection
Degree, it is significant to the application based on the Chinese Character Recognition under natural scene.
Claims (6)
1. retail shop's label Chinese character region automatic testing method in natural scene, it is characterised in that comprise the following steps:
A, the retail shop's label scanned in natural scene obtains original image, and the sample region image of rectangle is intercepted from original image,
And deploy the RGB triple channels of sample region image, the matrix of the row of M*N rows 3 is formed, wherein M is the width of sample region image, and N is
The height of sample region image, carries out Kmeans clusters using every a line of matrix as a point of three dimensions respectively, and setting is poly-
The classification number of class is 2, obtains two cluster centre points, respectively vectorial V1 and V2, subsequently into step B;
B, each pixel of original image is calculated respectively to vectorial V1 and V2 distance, and creates two and original image size
Identical initializes binary map bg1 and bg2, and the pixel value for initializing all pixels point in binary map bg1 and bg2 is 0, setting
Distance threshold X, compare each pixel of original image successively to vectorial V1 distance and X magnitude relationship, work as original image
Pixel to vectorial V1 distance when being less than X, will be with the pixel point coordinates identical pixel in binary map bg1 is initialized
Pixel value be set to 1, obtain coarse contour binary map BG1;Compare each pixel of original image successively to vectorial V2 distance
, will be with binary map bg2 is initialized when pixel to the vectorial V2 of original image distance are less than X with X magnitude relationship
The pixel value of the pixel point coordinates identical pixel is set to 1, coarse contour binary map BG2 is obtained, respectively to coarse contour binary map
BG1 and BG2 does Morphological scale-space and carries out connected domain analysis, and the maximum company of area is selected from coarse contour binary map BG1 and BG2
Logical domain is used as background profile after being repaired and being filled, and obtains background profile binary map;
C, hsv color space is divided into black, white, red, yellow, green, cyan, blueness, pinkish red eight pieces of color spaces,
The division rule of eight pieces of color spaces is as follows:
Black space, v<0.3 or(v<0.5 and s<=0.25);
White space, v>=0.5 and s<=0.25;
Red space, (h<1/12 or h>=11/12) and v>0.3 and s>=0.25;
Yellow space, h>=1/12 and h<3/12 and v>0.3 and s>=0.25;
Vert space, h>=3/12 and h<5/12 and v>0.3 and s>=0.25;
Cyan space, h>=5/12 and h<7/12 and v>0.3 and s>=0.25;
Blue color space, h>=7/12 and h<9/12 and v>0.3 and s>=0.25;
Pinkish red space, h>=9/12 and h<11/12 and v>0.3 and s>=0.25;
H represents the tone in hsv color space in formula, and the saturation degree in behalf hsv color space, v represents hsv color space
In lightness, subsequently into step D;
D, 8 and original image size identical binary map are created, and the pixel value of all pixels point in every binary map is put
For 0, original image is transformed into hsv color space from rgb space, then judges the every of original image in hsv color space
Color type belonging to individual pixel, all pixels point for belonging to same color type is mapped to the corresponding position of a binary map
Place is put, and the pixel value of the pixel of corresponding position in binary map is set to 1, finally obtains 8 distribution of color binary maps, so
Enter step E afterwards;
E, 8 distribution of color binary maps are done with background profile binary map and carries out Morphological scale-space after computing again respectively, filter out 8
The tiny gully in distribution of color binary map and fine rule are opened, obtains 8 thin contoured profile binary map, respectively to 8 thin profile point
Cloth binary map carries out connected domain scanning, obtains mark figure corresponding to connected graph using eight connectivity labelling method, and calculate each connection
The attribute in domain, then the connected domain that Chinese-character stroke feature is not met in 8 thin contoured profile binary map is filtered, obtains 8
Stroke level distribution binary map is opened, is distributed the connected domain progress for meeting Chinese-character stroke feature in binary map to each stroke level respectively
Merge, multiple connected domains after merging are designated as a marked region and determine mark value, for any two marked region, if
The center-of-mass coordinate of one marked region is located in the minimum enclosed rectangle of another marked region, then by the mark of the marked region
Value is set to the mark value of another marked region, is distributed binary map finally for each stroke level, successively that mark value is identical
Marked region be designated as a line of text, 8 line of text binary maps are obtained, subsequently into step F;
F, for any one line of text in 8 line of text binary maps, when the height of the minimum enclosed rectangle of line of text is less than
The 1/20 of the minimum enclosed rectangle height of background profile, the ratio of width to height of the minimum enclosed rectangle of line of text is less than 7/10 or text
The area ratio of capable area and its minimum enclosed rectangle is less than 1/10 or during more than 4/5, by this article one's own profession from corresponding line of text
Deleted in binary map, 8 obtained character picture binary map, calculate all line of text in each character picture binary map respectively
Area and, when the area being calculated and less than background profile binary map minimum enclosed rectangle area 1/200 when, will be right
The character picture binary map answered is deleted, and calculates the minimum external square of all line of text in remaining character picture binary map respectively
The coordinate of shape, subsequently into step G;
G, one and original image size identical blank image are created, successively by all texts in remaining character picture binary map
The minimum enclosed rectangle of one's own profession is marked in the corresponding position of blank image, is obtained primary identification image, is respectively identified primary
The border being made up of in image two or more minimum enclosed rectangle is in the isolated area of irregular polygon as a cog region
Domain, for each identification region, the coordinate on each summit is counted, and the minimum value for selecting from apex coordinate x coordinate is designated as
xmin, the maximum for selecting x coordinate is designated as xmax, the minimum value for selecting y-coordinate is designated as ymin, the maximum for selecting y-coordinate is designated as
ymax, with (xmin, ymin), (xmax, ymin), (xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit, then
Remaining minimum enclosed rectangle composition in all rectangular areas obtained from each identification region and primary identification image
Region is the Chinese character region in original image.
2. retail shop's label Chinese character region automatic testing method in natural scene as claimed in claim 1, it is characterised in that described
Step A comprise the following steps:
Retail shop's label in A1, scanning natural scene obtains original image, is less than 2/3 length more than 1/3 length in scan line
Section in appoint take a little be used as basic point, centered on this basic point point build a R*kR rectangularly-sampled area, wherein R is rectangle
The width of sample region, R value are more than the 1/7 of original image width, and 1/4, the k less than original image width is rectangularly-sampled area
The ratio of width to height, k span is 1/4<k<4, rectangularly-sampled area is cut from original image, obtains sample region image, then
Into step A2;
A2, the RGB triple channels expansion by sample region image, the matrix of the row of M*N rows 3 is formed, wherein M is the width of sample region image
Degree, N are the height of sample region image, a point using every a line of matrix as three dimensions, are carried out using Euclidean distance
Kmeans is clustered, and is set the classification number of cluster as 2, is obtained two cluster centre points, respectively vectorial V1 and V2.
3. retail shop's label Chinese character region automatic testing method in natural scene as claimed in claim 1, it is characterised in that described
Step B comprise the following steps:
B1, by each pixel in original image successively be labeled as 1,2 ... ..., n, n be original image in pixel
Number, calculates the pixel x and vectorial V1 and V2 of original image Euclidean distance L1 (x) and L2 (x), wherein x=1,2 ... ..., n,
Subsequently into step B2;
B2, two and original image size identical initialization binary map bg1 and bg2 are created, and binary map is initialized by two
The pixel value of all pixels point is set to 0 in bg1 and bg2, setpoint distance threshold X, as the pixel x and vectorial V1 of original image
During Euclidean distance L1 (x) < X, the pixel value initialized in binary map bg1 with pixel x position identical pixel is set to 1,
Coarse contour binary map BG1 is obtained, as the pixel x and vectorial V2 of original image Euclidean distance L2 (x) < X, will be initialized
Pixel value in binary map bg2 with pixel x position identical pixel is set to 1, obtains coarse contour binary map BG2, Ran Houjin
Enter step B3;
B3, Morphological scale-space is done to coarse contour binary map BG1 and BG2 respectively, i.e., coarse contour two is removed by erosion operation first
Value figure BG1 and BG2 fine rule, coarse contour binary map BG1 and BG2 tiny ditch are then removed by dilation operation and closed operation
Gully, connected domain analysis finally is carried out to coarse contour binary map BG1 and BG2, area is selected from coarse contour binary map BG1 and BG2
Maximum connected domain is as background profile, subsequently into step B4;
Hole in B4, filling background profile, and the depression on background profile edge is repaired, obtain background profile binary map.
4. retail shop's label Chinese character region automatic testing method in natural scene as claimed in claim 1, it is characterised in that:It is described
Step E comprise the following steps:
E1,8 distribution of color binary maps are done with background profile binary map respectively and computing, obtain 8 coarse contours distribution two-values
Figure, subsequently into step E2;
E2, Morphological scale-space is done to 8 coarse contour distribution binary maps respectively, i.e., to each coarse contour binary map in vertical and water
Closed operation and the opening operation of 7 pixels are done in flat both direction, tiny gully and fine rule is filtered out, obtains 8 thin contoured profile two
Value figure, subsequently into step E3;
E3,8 connected domain scannings are carried out to 8 thin contoured profile binary map respectively, and calculate each thin contoured profile binary map
In each connected domain area, center-of-mass coordinate and minimum enclosed rectangle, subsequently into step E4;
E4, for any one connected domain in each thin contoured profile binary map, when it meets following three filter conditions
In it is at least one when, the pixel value of all pixels point in this connected domain is set to 0, obtains 8 stroke levels distribution binary maps, so
Enter step E5 afterwards, wherein three filter conditions are respectively:
A, the area ratio of the area of connected domain and its minimum enclosed rectangle is less than 1/5;
B, the width of the minimum enclosed rectangle of connected domain is less than the 1/200 or 1/ more than original image width of original image width
2;
C, the ratio of width to height of the minimum enclosed rectangle of connected domain is less than 1/10 or more than 10;
E5, binary map is distributed for 8 obtained stroke levels, each stroke level distribution binary map is handled as follows:
E5-1, by stroke level be distributed binary map in each connected domain be labeled as C successively1, C2... ..., Ci, i is the distribution of stroke level
The number of connected domain in binary map, respectively by C1, C2... ..., CiMark value be set to respective subscript value, i.e. C1Mark value
For 1, C2Mark value be 2, by that analogy, CiMark value be i, and define independent communication domain set P, independent communication domain set P
In initial connected domain number be 0;
E5-2, from C1, C2... ..., CiThe middle minimum enclosed rectangle for choosing any two connected domain obtains to projecting on axis of ordinates
To two vertical projection line segments, it is the overlap length between two vertical projection line segments to define disH, and provides to throw vertically when two
DisH values are 0 when hachure section does not have overlapping, from C1, C2... ..., CiIt is middle choose any two connected domain minimum enclosed rectangle to
Projected on axis of abscissas, obtain two floor projection line segments, it is the beeline between two floor projection line segments to define dis, when
Dis values are 0 when two floor projection line segments are adjacent or overlapping, and when two floor projection line segments do not have overlapping, dis values are left side
The right endpoint of floor projection line segment is the distance between to the left end point of right side floor projection line segment;
E5-3, definition avgW are character mean breadth, and avgW initial value is C1Minimum enclosed rectangle width, define sum be
Character row overall width, sum initial value is avgW, and definition cnt is counter, and cnt initial value is 1;
Choose C1And C2Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two it is perpendicular
Deliver directly the intersegmental overlap length disH of hachure and be less than C1Minimum enclosed rectangle height 1/4 when, by C2The picture of middle all pixels point
Plain value is set to 0, and by C2Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1Most
Small boundary rectangle height 1/4 when, choose C1And C2Two levels being obtained to axis of abscissas upslide movie queen of minimum enclosed rectangle
Projection Line Segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C2Mark value
It is set to C1Mark value 1, while update sum value and add C for sum2Minimum enclosed rectangle width, cnt value is then added 1,
And the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than 1.5 times of avgW
When, by C2It is put into independent communication domain set P;
Choose C1And C3Two vertical projection line segments being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle, when two it is perpendicular
Deliver directly the intersegmental overlap length disH of hachure and be less than C1Minimum enclosed rectangle height 1/4 when, by C3The picture of middle all pixels point
Plain value is set to 0, and by C3Mark value be set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to C1Most
Small boundary rectangle height 1/4 when, choose C1And C3Two levels being obtained to axis of abscissas upslide movie queen of minimum enclosed rectangle
Projection Line Segment, when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW, by C3Mark value
It is set to C1Mark value 1, while update sum value and add C for sum3Minimum enclosed rectangle width, cnt value is then added 1,
And the value for updating avgW is sum divided by cnt, when the beeline dis between two floor projection line segments is more than 1.5 times of avgW
When, by C3It is put into independent communication domain set P;
By that analogy, until choosing C1And CiTwo vertical projections being obtained to axis of ordinates upslide movie queen of minimum enclosed rectangle
Line segment, when the overlap length disH between two vertical projection line segments is less than C1Minimum enclosed rectangle height 1/4 when, by CiIn
The pixel value of all pixels point is set to 0, and by CiMark value be set to 0, the overlap length between two vertical projection line segments
DisH is more than or equal to C1Minimum enclosed rectangle height 1/4 when, choose C1And CiMinimum enclosed rectangle to axis of abscissas upslide
Two floor projection line segments that movie queen obtains, when the beeline dis between two floor projection line segments is less than or equal to the 1.5 of avgW
Times when, by CiMark value be set to C1Mark value 1, while update sum value and add C for sumiMinimum enclosed rectangle width,
Then cnt value is added 1, and the value for updating avgW is sum divided by cnt, as the beeline dis between two floor projection line segments
During more than 1.5 times of avgW, by CiIt is put into independent communication domain set P, subsequently into step E5-4;
Connected domain number in E5-4, statistical iteration connected domain set P, when the connected domain number in independent communication domain set P is big
When equal to 2, into step E5-5, when the connected domain number in independent communication domain set P is 0 or 1, into step E5-7;
E5-5, by independent communication domain set P multiple connected domains all take out, set P in independent communication domain is turned into empty set, so
Multiple connected domains of taking-up are arranged in order from small to large according to subscript size afterwards, definition avgW is character mean breadth, avgW
Initial value be the width of the minimum enclosed rectangle of first connected domain, definition sum is character row overall width, sum initial value
For avgW, definition cnt is counter, and cnt initial value is 1;
Choose two that the minimum enclosed rectangle of first connected domain and second connected domain obtains to axis of ordinates upslide movie queen
Vertical projection line segment, when the overlap length disH between two vertical projection line segments is less than the minimum enclosed rectangle of first connected domain
Height 1/4 when, the pixel value of all pixels point in second connected domain is set to 0, and by the mark value of second connected domain
0 is set to, the minimum enclosed rectangle that first connected domain is more than or equal to as the overlap length disH between two vertical projection line segments is high
Degree 1/4 when, the minimum enclosed rectangle for choosing first connected domain and second connected domain obtains to axis of abscissas upslide movie queen
Two floor projection line segments, will when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
The mark value of second connected domain is set to the mark value of first connected domain, while the value for updating sum adds second connection for sum
The width of the minimum enclosed rectangle in domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two levels
When beeline dis between Projection Line Segment is more than 1.5 times of avgW, second connected domain is put into independent communication domain set P;
Choose two articles that the minimum enclosed rectangle of first connected domain and the 3rd connected domain obtains to axis of ordinates upslide movie queen
Vertical projection line segment, when the overlap length disH between two vertical projection line segments is less than the minimum enclosed rectangle of first connected domain
Height 1/4 when, the pixel value of all pixels point in the 3rd connected domain is set to 0, and by the mark value of the 3rd connected domain
0 is set to, the minimum enclosed rectangle that first connected domain is more than or equal to as the overlap length disH between two vertical projection line segments is high
Degree 1/4 when, the minimum enclosed rectangle for choosing first connected domain and the 3rd connected domain obtains to axis of abscissas upslide movie queen
Two floor projection line segments, will when the beeline dis between two floor projection line segments is less than or equal to 1.5 times of avgW
The mark value of 3rd connected domain is set to the mark value of first connected domain, while the value for updating sum adds the 3rd connection for sum
The width of the minimum enclosed rectangle in domain, cnt value is then added 1, and the value for updating avgW is sum divided by cnt, when two levels
When beeline dis between Projection Line Segment is more than 1.5 times of avgW, the 3rd connected domain is put into independent communication domain set P;
By that analogy, until choosing the minimum enclosed rectangle of first connected domain and last connected domain to axis of ordinates upslide
Two vertical projection line segments that movie queen obtains, when the overlap length disH between two vertical projection line segments is less than first connected domain
Minimum enclosed rectangle height 1/4 when, the pixel value of all pixels point in last connected domain is set to 0, and will be last
The mark value of one connected domain is set to 0, when the overlap length disH between two vertical projection line segments is more than or equal to first connection
The minimum enclosed rectangle height in domain 1/4 when, choose the minimum enclosed rectangle of first connected domain and last connected domain to
Two floor projection line segments that axis of abscissas upslide movie queen obtains, when the beeline dis between two floor projection line segments is less than
During equal to 1.5 times of avgW, the mark value of last connected domain is set to the mark value of first connected domain, updated simultaneously
Sum value is the width for the minimum enclosed rectangle that sum adds last connected domain, cnt value then is added into 1, and update avgW
Value be sum divided by cnt, when the beeline dis between two floor projection line segments is more than 1.5 times of avgW, by last
Individual connected domain is put into independent communication domain set P, subsequently into step E5-6;
E5-6, according to the method in step E5-5 set P in independent communication domain is reprocessed, until independent communication domain is gathered
Connected domain number in P is 0 or 1, subsequently into step E5-7;
E5-7, mark value identical connected domain in stroke level distribution binary map is designated as a marked region successively, and will connection
Mark value of the mark value in domain as the marked region, the area of each marked region, center-of-mass coordinate and most are then calculated respectively
Small boundary rectangle, subsequently into step E6;
E6, binary map is distributed for 8 obtained stroke levels of step E5, each stroke level distribution binary map is located as follows
Reason:
E6-1, for any two marked region, if the center-of-mass coordinate of a marked region is located at another marked region most
In small boundary rectangle, then the mark value of the marked region is set to the mark value of another marked region, subsequently into step E6-
2;
E6-2, mark value identical marked region in stroke level distribution binary map is designated as a line of text successively, then calculated
Width, height, area and the minimum enclosed rectangle of each line of text, obtain line of text binary map.
5. retail shop's label Chinese character region automatic testing method in natural scene as claimed in claim 1, it is characterised in that:It is described
Step F comprise the following steps:
F1,8 line of text binary maps for obtaining, for any one line of text in each line of text binary map, when
When it meets at least one in following three filter conditions, the pixel value of all pixels point in this article one's own profession is set to 0, obtained
8 candidate image binary maps, subsequently into step F2, wherein three filter conditions are respectively:
D, the height of line of text is less than the 1/20 of the minimum enclosed rectangle height of background profile;
E, the ratio of width to height of line of text is less than 7/10;
F, the area ratio of the area of line of text and its minimum enclosed rectangle is less than 1/10 or more than 4/5;
F2,8 candidate image binary maps for obtaining, for any one text in each candidate image binary map
OK, when it meets at least one in following two filter conditions, the pixel value of all pixels point in this article one's own profession is set to
0,8 character picture binary maps are obtained, subsequently into step F3, two of which filter condition is respectively:
G, the minimum enclosed rectangle of line of text is summed by row, obtains a series of row projection value, row projection value exceedes minimum outer
The continuous columns for connecing the 70% of rectangular elevation is more than 0.7 times of minimum enclosed rectangle height;
H, the area of line of text is less than the 1/1000 of the minimum enclosed rectangle area of background profile binary map;
F3,8 character picture binary maps for obtaining, calculate successively first formed in each character picture binary map it is each
The area of all connected domains of line of text and, when the area being calculated and the minimum enclosed rectangle less than background profile binary map
Area 1/200 when, by corresponding character picture binary map delete, then calculate institute in remaining character picture binary map respectively
There is the coordinate of the minimum enclosed rectangle of line of text.
6. retail shop's label Chinese character region automatic testing method in natural scene as claimed in claim 1, it is characterised in that:It is described
Step G comprise the following steps:
G1, one and original image size identical blank image are created, will owned successively in remaining character picture binary map
The minimum enclosed rectangle of line of text is marked in the corresponding position of blank image, obtains primary identification image, by primary identification figure
Minimum enclosed rectangle as in is labeled as R successively1, R2... ..., Rj, j is the number of minimum enclosed rectangle in primary identification image,
And the centre coordinate of each minimum enclosed rectangle is calculated, subsequently into step G2;
G2, R is judged successively2, R3... ..., RjCenter and R1Position relationship, from R1, R2... ..., RjMiddle Selection Center is located at R1
Internal or borderline all minimum enclosed rectangles, are put into R1Merge in set;
R is judged successively1, R3... ..., RjCenter and R2Position relationship, from R1, R2... ..., RjMiddle Selection Center is located at R2It is interior
Portion or borderline all minimum enclosed rectangles, are put into R2Merge in set;
By that analogy, until judging R successively1, R2... ..., Rj-1Center and RjPosition relationship, from R1, R2... ..., RjMiddle choosing
Take and be centrally located at RjInternal or borderline all minimum enclosed rectangles, are put into RjMerge in set, subsequently into step G3;
G3, to R1Merge set, R2Merge set ... ..., RjMerge set carry out condition merging, comprise the following steps:
G3-1, compare R1Merge set and R2Merge set, work as R2Merge set and include R1Merge at least one minimum in set
During boundary rectangle, to R1Merge set and R2Merge set and seek union, work as R2Merge set and do not include R1Merge any in set
During one minimum enclosed rectangle, by R2Merge set to be put into isolated area set Q;
Compare R1Merge set and R3Merge set, work as R3Merge set and include R1Merge at least one external square of minimum in set
During shape, to R1Merge set and R3Merge set and seek union, work as R3Merge set and do not include R1Merge set in any one most
During small boundary rectangle, by R3Merge set to be put into isolated area set Q;
By that analogy, until comparing R1Merge set and RjMerge set, work as RjMerge set and include R1Merge in set at least
During one minimum enclosed rectangle, to R1Merge set and RjMerge set and seek union, work as RjMerge set and do not include R1Merge set
In any one minimum enclosed rectangle when, by RjMerge set to be put into isolated area set Q, subsequently into step G3-2;
Merging set number in G3-2, statistical iteration regional ensemble Q, when the merging set number in isolated area set Q is big
When equal to 2, into step G3-3, when the merging set number in isolated area set Q is 0 or 1, by isolated area set
Merging set in Q is as a union, into step G4;
G3-3, by isolated area set Q multiple merging set all take out, isolated area set Q is turned into empty set, then
Multiple merging set to taking-up are arranged in order from small to large according to subscript size, are compared first and are merged set and second conjunction
And gather, when merging set comprising first at least one minimum enclosed rectangle merged in set for second, to first
Merge to gather and seek union with second merging set, merge when second any one during set is gathered not comprising first merging
During individual minimum enclosed rectangle, second merging set is put into isolated area set Q;
Compare first merging set and the 3rd merging is gathered, when the 3rd merging set is comprising in first merging set
During at least one minimum enclosed rectangle, set is merged to first and the 3rd merges set and seek union, merges collection when the 3rd
When closing any one minimum enclosed rectangle not included during first merging is gathered, the 3rd merging set is put into isolated area
In set Q;By that analogy, until comparing first merges set and last merging set, when last merging set
During comprising first at least one minimum enclosed rectangle merged in set, set is merged to first and last merging collects
Union is sought in conjunction, will when last merging set does not include first any one minimum enclosed rectangle merged in set
Last merges set and is put into isolated area set Q, subsequently into step G3-4;
G3-4, according to the method in step G3-3 isolated area set Q is reprocessed, until in isolated area set Q
Merging set number be 0 or 1, using the merging set in isolated area set Q as a union, subsequently into step G4;
G4, each union obtained in step G3 handled as follows, statistics one simultaneously concentrates all minimums
The apex coordinate of boundary rectangle, the minimum value that x coordinate is selected from apex coordinate are designated as xmin, the maximum for selecting x coordinate is designated as
xmax, the minimum value for selecting y-coordinate is designated as ymin, the maximum for selecting y-coordinate is designated as ymax, with (xmin, ymin), (xmax, ymin),
(xmin, ymax), (xmax, ymax) four coordinates create rectangular area as summit, then from each and concentrate obtained all rectangles
Region is the Chinese character region in original image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610059409.XA CN105740860B (en) | 2016-01-28 | 2016-01-28 | Retail shop's label Chinese character region automatic testing method in natural scene |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610059409.XA CN105740860B (en) | 2016-01-28 | 2016-01-28 | Retail shop's label Chinese character region automatic testing method in natural scene |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105740860A CN105740860A (en) | 2016-07-06 |
CN105740860B true CN105740860B (en) | 2018-04-06 |
Family
ID=56246822
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610059409.XA Active CN105740860B (en) | 2016-01-28 | 2016-01-28 | Retail shop's label Chinese character region automatic testing method in natural scene |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105740860B (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107784301B (en) | 2016-08-31 | 2021-06-11 | 百度在线网络技术(北京)有限公司 | Method and device for recognizing character area in image |
CN107066933B (en) * | 2017-01-25 | 2020-06-05 | 武汉极目智能技术有限公司 | Road sign identification method and system |
CN108629238B (en) * | 2017-03-21 | 2020-07-10 | 阿里巴巴(中国)有限公司 | Method and device for identifying Chinese character mark |
CN107564015B (en) * | 2017-08-24 | 2018-10-02 | 佛山市国方商标识别科技有限公司 | A kind of segmentation and labeling method and device based on polychrome grade image connectivity domain |
CN110135426B (en) * | 2018-02-09 | 2021-04-30 | 北京世纪好未来教育科技有限公司 | Sample labeling method and computer storage medium |
CN108827181B (en) * | 2018-03-14 | 2021-04-09 | 浙江大学山东工业技术研究院 | Vision-based plate surface detection method |
CN110569835B (en) * | 2018-06-06 | 2024-03-05 | 北京搜狗科技发展有限公司 | Image recognition method and device and electronic equipment |
CN109345551B (en) * | 2018-09-18 | 2020-11-20 | 清华大学 | Method and system for detecting concave envelope in image outer contour and computer storage medium |
CN109558876B (en) * | 2018-11-20 | 2021-11-16 | 浙江口碑网络技术有限公司 | Character recognition processing method and device |
CN110188764A (en) * | 2019-05-31 | 2019-08-30 | 浙江口碑网络技术有限公司 | Character color identifying processing method and device |
CN111104936A (en) * | 2019-11-19 | 2020-05-05 | 泰康保险集团股份有限公司 | Text image recognition method, device, equipment and storage medium |
CN110929664B (en) * | 2019-11-29 | 2023-05-30 | 汉海信息技术(上海)有限公司 | Image recognition method and device |
CN111666824B (en) * | 2020-05-14 | 2023-12-15 | 浙江工业大学 | Indicator light identification method of mobile robot based on color attribute and machine learning |
CN111738250B (en) * | 2020-08-26 | 2020-12-01 | 北京易真学思教育科技有限公司 | Text detection method and device, electronic equipment and computer storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1703444A2 (en) * | 2005-03-17 | 2006-09-20 | Ricoh Company, Ltd. | Detecting an orientation of characters in a document image |
CN101697201A (en) * | 2009-09-25 | 2010-04-21 | 华南理工大学 | Handwritten Chinese character identification method irrelevant to rotation direction |
CN102890783A (en) * | 2011-07-20 | 2013-01-23 | 富士通株式会社 | Method and device for recognizing direction of character in image block |
CN104951741A (en) * | 2014-03-31 | 2015-09-30 | 阿里巴巴集团控股有限公司 | Character recognition method and device thereof |
-
2016
- 2016-01-28 CN CN201610059409.XA patent/CN105740860B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1703444A2 (en) * | 2005-03-17 | 2006-09-20 | Ricoh Company, Ltd. | Detecting an orientation of characters in a document image |
CN101697201A (en) * | 2009-09-25 | 2010-04-21 | 华南理工大学 | Handwritten Chinese character identification method irrelevant to rotation direction |
CN102890783A (en) * | 2011-07-20 | 2013-01-23 | 富士通株式会社 | Method and device for recognizing direction of character in image block |
CN104951741A (en) * | 2014-03-31 | 2015-09-30 | 阿里巴巴集团控股有限公司 | Character recognition method and device thereof |
Non-Patent Citations (3)
Title |
---|
《一种针对汉字特点的场景图像中文文本定位算法》;张伟伟等;《信息工程大学学报》;20141215;第15卷(第6期);729-736 * |
《基于聚类与边缘检测的自然场景文本提取方法》;常莹等;《计算机工程与设计》;20100928;第18卷(第31期);4040-4043 * |
《多尺度_方向笔画结合SVM验证的文字区域定位》;胡正平等;《仪器仪表学报》;20100415;第31卷(第4期);916-922 * |
Also Published As
Publication number | Publication date |
---|---|
CN105740860A (en) | 2016-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105740860B (en) | Retail shop's label Chinese character region automatic testing method in natural scene | |
CN104834898B (en) | A kind of quality classification method of personage's photographs | |
CN102509383B (en) | Feature detection and template matching-based mixed number identification method | |
CN1312625C (en) | Character extracting method from complecate background color image based on run-length adjacent map | |
CN108596166A (en) | A kind of container number identification method based on convolutional neural networks classification | |
CN107784301A (en) | Method and apparatus for identifying character area in image | |
CN104463138B (en) | The text positioning method and system of view-based access control model structure attribute | |
CN106651872A (en) | Prewitt operator-based pavement crack recognition method and system | |
CN106203433A (en) | In a kind of vehicle monitoring image, car plate position automatically extracts and the method for perspective correction | |
CN106228157B (en) | Coloured image word paragraph segmentation and recognition methods based on image recognition technology | |
CN102043950A (en) | Vehicle outline recognition method based on canny operator and marginal point statistic | |
CN106228545A (en) | A kind of automatic division method of figure of buddha class Tangka's concordance damaged area | |
CN106529592A (en) | License plate recognition method based on mixed feature and gray projection | |
CN104809715A (en) | Banknote image inclination correction and region extraction method | |
CN103413130A (en) | Recognition method of protection pressing plate state | |
US20080247649A1 (en) | Methods For Silhouette Extraction | |
CN107180230B (en) | Universal license plate recognition method | |
CN115311310B (en) | Method for extracting printed patterns of textiles through graph cutting | |
EP1579375A2 (en) | Measurement of mitotic activity | |
CN107992864A (en) | A kind of vivo identification method and device based on image texture | |
CN103049756A (en) | Method for automatically extracting and removing words in color image on basis of CEMA (Cellular Message Encryption Algorithm) and texture matching repairing technology | |
CN107122775A (en) | A kind of Android mobile phone identity card character identifying method of feature based matching | |
CN108256467A (en) | A kind of method for traffic sign detection of view-based access control model attention mechanism and geometric properties | |
CN103743750A (en) | Method for generating distribution diagram of surface damage of heavy calibre optical element | |
CN108563976A (en) | Multidirectional vehicle color identification method based on vehicle window position |
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 |