WO2018086233A1 - 一种字符分割方法和装置、及元件检测方法和装置 - Google Patents

一种字符分割方法和装置、及元件检测方法和装置 Download PDF

Info

Publication number
WO2018086233A1
WO2018086233A1 PCT/CN2016/113632 CN2016113632W WO2018086233A1 WO 2018086233 A1 WO2018086233 A1 WO 2018086233A1 CN 2016113632 W CN2016113632 W CN 2016113632W WO 2018086233 A1 WO2018086233 A1 WO 2018086233A1
Authority
WO
WIPO (PCT)
Prior art keywords
character
image
line
pixels
characters
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.)
Ceased
Application number
PCT/CN2016/113632
Other languages
English (en)
French (fr)
Inventor
李红匣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Publication of WO2018086233A1 publication Critical patent/WO2018086233A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/158Segmentation of character regions using character size, text spacings or pitch estimation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/09Recognition of logos
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Definitions

  • the present invention relates to the field of character recognition technology, and in particular, to a character segmentation method and apparatus, and a component detection method and apparatus.
  • each circuit board usually includes a variety of components, and each component, such as resistors, capacitors, etc., can have many different models.
  • each component such as resistors, capacitors, etc.
  • different types of components of the same type can be distinguished by the appearance characteristics of the components, such as shape, color, size, and the like.
  • it is difficult to distinguish the different models of components by just the appearance information.
  • the factory prints component information on the surface of the component to distinguish between different models. Therefore, the component can be detected by the character recognition system.
  • the character recognition system generally includes three parts: character extraction, character segmentation, and character recognition.
  • Character segmentation is an important step in the character recognition system.
  • the effect of character segmentation directly affects the accuracy of character recognition and is related to the feasibility of the entire character recognition system.
  • the commonly used character segmentation methods follow image segmentation methods, such as threshold-based segmentation algorithms, edge-based segmentation methods, region-based segmentation methods, and the like.
  • the noise removal effect is poor, that is, many of the divided character regions do not actually contain characters
  • the purpose of the embodiment of the present invention is to provide a character segmentation method, which can realize effective segmentation of characters when input character images, and the calculation is simple.
  • an embodiment of the present invention provides a character segmentation method, including
  • Each of the single characters is divided based on the number of pixels in the column of each of the character line images in which the gray value is within a preset range, thereby obtaining the divided single character regions.
  • a character segmentation method disclosed in the present invention separates the number of pixels in the preset range based on each row of pixels and each column of pixels in the image.
  • Character line and single-character technical solution this method is based on the characteristics of the character itself, using the characteristics of the character area in the character image that are different from the gray values of other areas, segmenting the line character image, and The single character is divided on the basis of the line character image, and the pair of characters can be effectively segmented; the algorithm for calculating the number of pixels is simple, and the problem of complicated calculation and low partitioning efficiency in the prior art is solved.
  • the character segmentation method further includes:
  • the obtained sticky characters existing in each of the single-character regions are detected, and the sticky characters are divided to obtain a final single-character region.
  • the character segmentation method further includes detecting and segmenting the sticky characters, reducing the influence of noise, and improving the segmentation accuracy.
  • segmentation of each line of characters based on the number of pixels in the grayscale value of each row of pixels in the character image in the preset range, thereby obtaining the segmented character line images includes:
  • Each line of characters is divided based on the position of each line of characters, thereby obtaining a plurality of divided line image lines.
  • the acquired input character image usually contains a part of noise.
  • the gray value in each line of pixels in the character image is obtained within a preset range.
  • the improvement can effectively avoid the influence of noise, the algorithm is simple, and the segmentation accuracy is high.
  • the segmentation is performed by dividing each single character based on the number of pixels in each column of each character line image in which the gray value is within a preset range, thereby obtaining the divided single characters.
  • the area includes:
  • the column distribution histogram curve is sequentially scanned according to a preset order, and each of the characters is divided by a pixel dot column whose number of pixels is zero in a preset range, thereby obtaining a plurality of divided characters.
  • the single character area is sequentially scanned according to a preset order, and each of the characters is divided by a pixel dot column whose number of pixels is zero in a preset range, thereby obtaining a plurality of divided characters.
  • the position can be regarded as a character division point, and the division efficiency is high.
  • the method of dividing the glued characters is a drip algorithm.
  • the dripping algorithm simulates the process of water droplets dropping from a high point to a low point, and the trajectory of the water droplets constitutes a segmentation path of characters, and the segmentation effect of the drip algorithm is good, and the noise effect is effectively removed.
  • the acquired character image is a binarized image
  • the pixel value whose gray value is within a preset range is a gray value of 225. Pixels.
  • the number of character lines included in the character image may be input in advance.
  • the present invention provides a character segmentation apparatus, including:
  • a character image obtaining unit configured to acquire a character image
  • a character line dividing unit configured to divide each line of characters based on the number of pixels of the gray level value in each row of pixel points in the character image, thereby obtaining the divided character line images
  • a character dividing unit configured to divide each single character based on the number of pixels in the column of each of the character line images in the preset grayscale value, thereby obtaining the divided Several single-character areas.
  • a character segmentation apparatus disclosed by the present invention first calculates, by a character line segmentation unit, the number of pixel points in the pixel range of the input character image in the preset range. According to the characteristic structure of the character line, the segmentation obtains the character line image; and the character segmentation unit is used to calculate the number of the gray value in the column pixel of the character line image in the preset range of pixels, based on the characteristic structure of each single character, Segmentation acquires each single character; the device is simple to calculate and has high segmentation efficiency.
  • the character segmentation device further includes:
  • the glue character segmentation unit is configured to detect the stuck characters existing in the acquired plurality of single character regions, and divide the glue characters to obtain a final single character region.
  • the character line segmentation unit includes:
  • a first calculating module configured to perform horizontal projection on the character image, respectively calculate a number of pixel points in the pixel range of each row of pixels in a preset range, and obtain the gray value in a preset a line distribution histogram curve of the pixel points in the range; fitting the line distribution histogram curve by a Gaussian function to determine the position of each line character;
  • the character line segmentation module divides each line of characters based on the position of each line of characters to obtain a plurality of character line images.
  • the character segmentation unit includes:
  • a second calculating module configured to vertically project the character line graph, and calculate a number of pixel points in the column of each column of pixels in a preset range, and obtain the gray value in the pre-predetermined range a column distribution histogram curve of the pixel points in the range; sequentially scanning a column distribution histogram curve of the pixel points whose gray value is within a preset range according to a preset order, thereby obtaining the gray value in a preset range a pixel dot column with zero pixel counts;
  • the single-character segmentation module is configured to divide each single character based on the obtained pixel point sequence in which the gray value is zero in the preset range, thereby obtaining the divided single-character regions.
  • the present invention further provides a component detection method, including:
  • Acquiring an image of the component to be detected wherein the image of the component to be detected includes a character image of a printed character of the component to be detected;
  • Character recognition is performed on the character image based on the acquired single character regions, thereby acquiring information of the printed characters of the component to be detected.
  • a component detecting method disclosed by the present invention identifies a component based on printed character information on the component, including three steps of character extraction, character segmentation and character recognition; wherein, a method disclosed by the present invention is adopted.
  • the character segmentation method improves the segmentation efficiency and accuracy of the printed characters on the components in component detection, and improves the accuracy of character recognition due to effective segmentation; ultimately, the efficiency and accuracy of component detection in the present technical solution are improved as a whole.
  • the invention also provides a component detecting device, comprising:
  • the image to be detected image acquiring unit is configured to acquire an image of the component to be detected, wherein the image of the component to be detected includes a character image of a printed character of the component to be detected;
  • a character image obtaining unit configured to acquire a character image
  • a character line dividing unit configured to divide each line of characters based on the number of pixels of the gray level value in each row of pixel points in the character image, thereby obtaining the divided character line images
  • a character dividing unit configured to divide each single character based on the number of pixels in the column of each of the character line images in the preset grayscale value, thereby obtaining the divided And a plurality of single-character regions;
  • the component to be detected information acquiring unit is configured to perform character recognition on the printed character image based on the acquired plurality of the single-character regions, thereby acquiring information of the printed characters of the component to be detected.
  • a component detecting device disclosed in the present invention acquires an image of a component to be detected by an image acquiring unit to be detected, and then acquires a character image in an image of the component to be detected through a character image acquiring unit, and then The character segmentation unit and the character segmentation unit are sequentially segmented and single-characterized to obtain a plurality of single-character regions, and finally, the component information acquisition unit performs component information identification based on the acquired single-character regions, wherein Since the character segmentation method can effectively segment the characters, the segmentation efficiency and accuracy of the printed characters on the components in the component detection are improved, and the accuracy of the character recognition is improved by the effective segmentation; Technical solution component efficiency and accuracy.
  • Embodiment 1 is a schematic flow chart of Embodiment 1 of a character segmentation method according to the present invention
  • step S12 of Embodiment 1 of the character segmentation method provided by the present invention is a schematic flowchart of step S12 of Embodiment 1 of the character segmentation method provided by the present invention
  • step S13 of Embodiment 1 of the character segmentation method provided by the present invention is a schematic flowchart of step S13 of Embodiment 1 of the character segmentation method provided by the present invention
  • Embodiment 4 is a schematic flow chart of Embodiment 2 of a character segmentation method according to the present invention.
  • step S22 of Embodiment 2 of the character segmentation method provided by the present invention is a schematic flowchart of step S22 of Embodiment 2 of the character segmentation method provided by the present invention.
  • FIG. 6 is a schematic flowchart of step S23 of Embodiment 2 of the character segmentation method provided by the present invention.
  • Figure 8 is a horizontal projection view of an exemplary image of the character image of Figure 7;
  • FIG. 9 is a schematic diagram of fitting a line distribution histogram curve obtained by horizontal projection in FIG. 8 by using a Gaussian function
  • Figure 10 is a vertical projection view of an example of a character line image obtained from the character image diagram of Figure 7;
  • FIG. 11 is a schematic diagram of single character division of an example of a character line image in FIG. 10;
  • Figure 12 is a diagram showing an example of the presence of glue characters in a divided single-character area
  • FIG. 13(a) is a diagram showing an example of a number of pixel positions of water droplets in a dripping algorithm used in step S24 of the second embodiment of the present invention
  • FIG. 13(b) is a schematic diagram showing the rule of the drop position of the water drop in the dripping algorithm used in step S24 of the second embodiment provided by the character segmentation method of the present invention
  • Figure 14 is a block diagram showing the structure of an embodiment of a character segmentation apparatus according to the present invention.
  • Figure 15 is a flow chart showing an embodiment of a component detecting method according to the present invention.
  • Figure 16 is a block diagram showing the construction of an embodiment of a component detecting device of the present invention.
  • FIG. 1 is a schematic flowchart of a first embodiment of a character segmentation method according to the present invention.
  • the first embodiment includes the following steps:
  • FIG. 7 is an exemplary diagram of acquired character images
  • the number of pixels in the grayscale value in the preset range in the step S12/step S13 is the number of pixels corresponding to the character region in each row/column of pixels, and the specific implementation time is
  • the preset range of the set gradation value is specifically set according to the gradation value range of the pixel point representing the character in the character image.
  • FIG. 2 is a schematic flowchart of step S12 of the first embodiment, and step S12 includes:
  • FIG. 8 is a horizontal projection view of the acquired character image. Step S121 is described in detail with reference to FIG. 8.
  • the character image in FIG. 8 contains a part of noise.
  • the input is first required.
  • the character image is horizontally projected, and the number of pixels in which the gray value in each row of pixels is within a preset range is calculated, thereby obtaining a line distribution histogram.
  • the character image contains two character lines, and the horizontally projected line distribution histogram corresponding to the obtained line distribution histogram presents two peaks with larger peak values, and is similar to the Gaussian function.
  • the histogram curve can be fitted by a Gaussian function; see Fig. 9, which is obtained by horizontal projection in Fig. 8 using a Gaussian function.
  • the line distribution histogram curve is fitted to the schematic diagram; the position of each line of the character image is determined according to the fitting result.
  • FIG. 3 is a schematic flowchart of step S13 in the first embodiment, and step S13 includes:
  • S132 Scan the column distribution histogram curve in sequence according to a preset order to obtain a pixel point column in which the number of pixels of the gray value in the preset range is zero;
  • FIG. 10 is a vertical projection view of an example of a character line image obtained from the character image example of FIG. 7. It can be seen from FIG. 10 that the boundary position between every two single characters is on the column distribution histogram curve.
  • the number of pixels in which the gray value obtained at the corresponding position is within the preset range is zero. That is to say, when a column in the character line image does not have a pixel whose gray value is within a preset range, the column position can be considered as a single-character split column. Scanning the column distribution histogram curve in the preset order to scan the obtained pixel point column whose number of pixels in the preset range is zero;
  • each single character is divided according to the acquired pixel columns, thereby acquiring a plurality of single character regions.
  • the histogram curve is firstly distributed by the line value of the pixel value of the character image in the preset range, and the position of the character line is determined by fitting with the Gaussian function, and the character image is segmented, thereby obtaining each a character line image; then, the histogram curve is distributed in a column of the number of pixels in the preset range by the gray value of each character line image, and the number of pixels in the preset range is zero.
  • the pixel column performs a one-character split for each character line image.
  • the character line and the single character are sequentially divided, and the pair of characters can be effectively segmented; the algorithm for calculating the number of pixels is simple, and the calculation of the prior art is complicated, and the segmentation efficiency is low. The problem.
  • the second embodiment includes the following steps:
  • FIG. 7 is an exemplary diagram of the acquired character image
  • the input character image is obtained as a character image subjected to binarization processing.
  • the gray point value of the pixel in the extracted character region is 225, that is, the black pixel point
  • the gray value of the pixel in the remaining region is 0; in the second embodiment, the number of black pixel points is used.
  • the character area is recognized as an example.
  • the input image is taken as a binarized image as an example.
  • step S22/step S23 the number of black pixel points in each row/column of pixels is obtained to obtain corresponding rows/ The number of pixels representing the character area in each column of pixels.
  • FIG. 5 is a schematic flowchart of step S22 of the second embodiment, where step S22 includes:
  • S221 Perform horizontal projection on the character image, respectively calculate the number of pixels in each row of pixels with the gray value within a preset range, and obtain a line distribution histogram curve of the pixel points whose gray value is within the preset range;
  • FIG. 8 is a horizontal projection view of the acquired character image, and step S221 is described in detail with reference to FIG. 8.
  • the character image in FIG. 8 includes a part of noise.
  • the input character image needs to be horizontally projected, and the number of black pixel points in each row of pixels is calculated, thereby obtaining a line distribution histogram.
  • the character image contains two character lines, and the horizontally projected line distribution histogram corresponding to the obtained line distribution histogram presents two peaks with larger peak values, and is similar to the Gaussian function.
  • the histogram curve can be fitted by a Gaussian function; see Fig. 9, which is obtained by horizontal projection in Fig. 8 using a Gaussian function.
  • the line distribution histogram curve is fitted to the schematic diagram; the position of each line of the character image is determined according to the fitting result.
  • FIG. 6 is a schematic flowchart of step S23 of the first embodiment, where step S23 includes:
  • FIG. 10 is a vertical projection view of an example of a character line image obtained from the character image example of FIG. 7. It can be seen from FIG. 10 that the boundary position between every two single characters is on the column distribution histogram curve. Black pixels acquired at corresponding positions The number of points is zero. That is to say, when there is no black pixel in a column in the character line image, the column position can be considered as a single-character split column. Scanning the column distribution histogram curve in the preset order to scan the obtained pixel point column whose number of pixels in the preset range is zero;
  • each single character is divided according to the acquired pixel columns, thereby acquiring a plurality of single character regions.
  • the character image acquired in step S21 in the second embodiment may be a character image processed by a character extraction algorithm;
  • the character extraction algorithm refers to an algorithm for extracting a character region, such as template matching, stroke width transformation (SWT), and MSER And other methods.
  • SWT stroke width transformation
  • MSER And other methods such as template matching, stroke width transformation (SWT), and MSER And other methods.
  • the non-character area is removed from the character image processed by the character extraction algorithm, and the character area is reserved.
  • step S24 detects and segments the possible sticky characters.
  • the drip algorithm is used to obtain the segmentation path between the glued characters, and the glued characters are segmented based on the segmentation path.
  • the drip algorithm divides the glue characters by simulating the process of water droplets dropping from a high point to a low point: when the water droplets from the top of the character due to gravity, they will descend downward or horizontally along the outline of the character; When the water droplets are trapped in the concave portion of the character outline, they will penetrate into the stroke of the character and continue to be low; the trajectory through which the water droplet passes constitutes the segmentation path of the character.
  • FIG. 13(a) is a numbering example diagram of the pixel position of the dripping algorithm of the dripping algorithm, assuming that the position of the pixel where the water droplet is currently located is represented by n 0 , and the position of the pixel where the water drop is dropped next time is The five droplets around the pixel are determined.
  • Fig. 13(b) lists six cases in which five pixel points around the water drop may occur and the position where the water drop is next; wherein w represents a white pixel point, b represents a black pixel point, and * indicates that it may be white Pixels may also be black pixels, and arrows indicate the trajectory of water droplets. For example, when the neighboring five pixel points of the current pixel position of the water drop are all white dots or all black dots, the water drops downward.
  • the dripping path of the water droplets can be obtained by the following calculation process:
  • the gravitational potential energy W i is calculated by the following formula:
  • the glued characters are divided according to the obtained water drop dripping path, thereby obtaining the final several single character regions.
  • the histogram curve is distributed through the line of the black pixel points of the character image, the position of the character line is determined at the fitting with the Gaussian function, and the character image is segmented to obtain the image of each character line; a histogram curve of a column of black pixel points of each character line image, and a single character segmentation of each character line image with a pixel column whose gray value is zero in a preset range of pixels Each single character region is obtained; and further, the glue character is used to divide the glue characters in the single character region to obtain the final single character region.
  • the character lines and the single characters are sequentially divided, and the pair of characters can be effectively segmented; and the glue characters are divided by the drip algorithm; the algorithm for calculating the number of pixels is simple, and the present solution is solved.
  • the character line is obtained by fitting the Gaussian function, and the glue characters are divided by the dripping algorithm, the noise interference is greatly reduced, and the accuracy of the segmented characters is improved.
  • FIG. 14 is a schematic structural diagram of an embodiment of a character segmentation apparatus according to the present invention.
  • the apparatus of the embodiment includes a character image acquisition unit 11 and a character line division unit 12. And the character dividing unit 13, specifically:
  • a character image obtaining unit 11 configured to acquire a character image
  • the character line dividing unit 12 is configured to divide each line of characters based on the number of pixels in the preset range of the gray value in each line of the pixel image, thereby obtaining the divided character line images;
  • the character dividing unit 13 is configured to divide each single character based on the number of pixels in each column of each character row image in which the gray value is within a preset range, thereby obtaining the divided single characters. region.
  • the character line dividing unit 12 includes a first calculating module 121 and a character line dividing module 122, specifically:
  • the first calculation module 121 is configured to perform horizontal projection on the character image, respectively calculate the number of pixel points in the pixel range of each row of pixels in the preset range, and obtain the pixel points whose gray value is within the preset range.
  • the line distribution histogram curve; the Gaussian function is used to fit the line distribution histogram curve to determine the position of each line of characters;
  • the character line segmentation module 122 divides each line of characters based on the position of each line of characters, thereby acquiring a plurality of character line images.
  • the character dividing unit 13 includes a second calculating module 131 and a single character dividing module 132, specifically:
  • the second calculating module 131 is configured to vertically project the character line graph, and calculate the gray value in each column of pixels respectively in the preset range.
  • the number of pixels surrounding the circle obtains a histogram curve of the column distribution of the pixel points whose gray value is within the preset range; sequentially scans the column distribution histogram curve of the pixel points whose gray value is within the preset range according to the preset order , thereby obtaining a pixel point column in which the number of pixels of the gray value in the preset range is zero;
  • the single-character segmentation module 132 is configured to divide each single character according to the obtained pixel point sequence in which the acquired gray value is zero in the preset range, thereby obtaining the divided single-character regions.
  • the number of pixels in the grayscale value set in the character segmentation device in the preset range is the number of pixels representing the character region in each row/column of pixels in the image
  • the preset range of the gradation value is set according to the gradation value range indicating the character pixel point.
  • the process of acquiring the character image by the character image acquiring unit 11 in the present embodiment preferably includes obtaining the character image by the process of the character extraction algorithm and the image binarization, and the gray value of the pixel in the character region on the character image is 225, that is, When the black pixel is used, the character dividing device sets the pixel whose gray value is within the preset range as a black pixel.
  • the embodiment of the character segmentation apparatus provided by the present invention further includes an adhesion character segmentation unit 14 for detecting the adhesion characters existing in the acquired single character regions and dividing the adhesion characters to obtain the final single character region. .
  • the method for obtaining the segmentation path between the spliced characters is performed by using the drips algorithm.
  • the specific calculation process may refer to the specific process of step S24 of the second embodiment provided by the character segmentation method of the present invention. Do not repeat them.
  • the character image acquiring unit 11 first acquires the input character image; then, the first calculating module 121 in the character line dividing unit 12 calculates the gray value in each row of the input character image in the preset range. The number of pixels within the line is obtained, the line distribution histogram curve is obtained, the line distribution histogram curve is curve-fitted, the character line position is determined, and the character line segmentation module 122 performs character line segmentation to obtain the character line image; then, the character segmentation
  • the second calculating module 131 in the unit 13 calculates the number of pixels in the column pixel of the character line image in the preset range to determine that the number of pixels in the preset range is zero.
  • the pixel sequence column; the single character segmentation module 132 obtains each single character according to the pixel column division; finally, the glue character segmentation unit 14 divides the glue characters in the single character region by the drip algorithm to obtain the final single character region.
  • the character segmentation device of the embodiment has a simple algorithm, does not require high hardware, and is beneficial to reduce cost; at the same time, the calculation is fast, and the segmentation efficiency is improved; and the segmentation accuracy is high, which is beneficial to the character recognition system when the character is recognized. Identify the effect.
  • the present invention further provides an embodiment of the component detecting method: obtaining the printed character information of the component by identifying the printed character on the component, including the component Information such as model and parameters to achieve the purpose of detecting the component.
  • FIG. 15 is a schematic flowchart of the embodiment, which specifically includes the following steps:
  • the character image acquired in step S32 may refer to the character image example diagram shown in FIG. 7;
  • the process of extracting the character image acquired from the image of the component to be detected in step S32 includes extracting characters, which may be processed by using a following character extraction algorithm: template matching, stroke width conversion (SWT), MSER, and the like.
  • the non-character area is removed on the printed character image processed by the character extraction algorithm, and the printed character area on the component to be detected is retained;
  • step S32 in the process of acquiring the character image of the printed character of the image of the component to be detected, a binarization processing step of the image is further included, and the finally obtained character image is a binarized image.
  • the process of segmenting the character image in the step S33 and the step S34 to obtain a plurality of single-character regions may refer to the specific implementation process of the first embodiment/second embodiment of the character segmentation method of the present invention, and details are not described herein.
  • each single-character region can be correspondingly identified, thereby reading the meaning of the character corresponding to the single character, thereby acquiring the printed character information of the component to be detected, thereby implementing the component.
  • the image of the to-be-detected component including the printed characters on the component to be detected is acquired, and the character image of the printed character is obtained therefrom; the character image is sequentially segmented and single-divided to obtain a plurality of single-character regions; and based on the acquisition Several single-character areas identify printed characters and acquire component information for component detection.
  • the embodiment of the component detecting method provided by the present invention recognizes that the detecting accuracy of the component is higher based on the printed character information on the component than detecting the identifying component from information such as the size, color, and appearance of the component; In the detection, the segmentation efficiency and accuracy of the printed characters on the component are improved, and the accuracy of the character recognition is improved due to the effective segmentation; finally, the efficiency and accuracy of the component detection in the embodiment are improved as a whole.
  • FIG. 16 is a schematic structural diagram of the embodiment.
  • the image to be detected image acquisition unit 10 is configured to acquire an image of the component to be detected, wherein the image of the component to be detected includes a character image of the printed character of the component to be detected;
  • a character image obtaining unit 11 configured to acquire a character image
  • the character line dividing unit 12 is configured to divide each line character based on the number of pixels in the pixel value of each line of the character image in the preset range, thereby obtaining the divided character line images. ;
  • a character dividing unit 13 configured to calculate, according to a pixel point in a preset range, a gray value in each column of pixels in each character line image In the case of a number of cases, each single character is divided to obtain a plurality of single character regions after division;
  • the to-be-detected component information acquiring unit 15 is configured to perform character recognition on the printed character image based on the acquired plurality of single-character regions, thereby acquiring information of the printed characters of the to-be-detected component.
  • the image of the component to be detected is acquired by the image to be detected by the image to be detected 10; then, the image of the component to be detected is extracted by the printed character image extracting unit 11; then, the character row dividing unit 12 and the character dividing unit are sequentially passed through 13 to obtain a plurality of single-character regions; finally, the component information acquisition unit 15 performs component information identification based on the acquired plurality of single-character regions, thereby implementing detection of the component to be detected.
  • the embodiment improves the segmentation efficiency and accuracy of the printed characters on the component in the component detection, and improves the accuracy of the character recognition due to the effective segmentation; finally, the efficiency and accuracy of the component detection in the embodiment are improved as a whole.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Character Input (AREA)

Abstract

一种字符分割方法,包括:获取字符图像(S11);基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到若干字符行图像(S12);基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到若干单字符区域(S13)。所述字符分割方法算法简便,分割效率和准确率高。一种字符分割装置,用于分割获取单字符区域。以及一种元件检测方法和装置,在基于元件表面的印刷字符检测元件时,采用所述字符分割方法对字符进行分割,以实现对印刷字符识别;所述元件检测方法检测效率高。

Description

一种字符分割方法和装置、及元件检测方法和装置 技术领域
本发明涉及字符识别技术领域,尤其涉及一种字符分割方法和装置,及一种元件检测方法和装置。
背景技术
在实际生产过程中,每一种电路板上通常包括多种元件,而每一种元件,如电阻、电容等,会有多种不同的型号。有时候,可以通过元件的外观特征,如形状、颜色、大小等信息区分同种元件的不同型号。然而,有时候,仅仅通过外观信息是很难分辨元件的不同型号的。通常情况下,工厂会将元件的信息印刷在元件的表面,从而区分不同的型号。因此,可以通过字符识别系统来对元件进行错件检测。
字符识别系统一般包括3个部分:字符提取、字符分割和字符识别。字符分割是字符识别系统中一个重要的步骤,字符分割的效果直接影响到字符识别的准确率,关系到整个字符识别系统的可行性。
目前,常用的字符分割方法沿用图像分割方法,例如:基于阈值的分割算法,基于边缘的分割方法,基于区域的分割方法等等。
但是,现有的字符分割方法存在以下缺陷:
1、去噪声效果差,即分割出的字符区域中很多实际上并不包含字符;
2、计算方法复杂,字符分割效率低。
发明内容
本发明实施例的目的是提供一种字符分割方法,对输入的字符图像能实现有效分割字符的同时,计算简便。
为实现上述目的,本发明实施例提供了一种字符分割方法,包括
获取字符图像;
基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
与现有技术相比,本发明公开的一种字符分割方法,基于图像中每一行像素点和每一列像素点的所述灰度值在预设范围内的像素点的个数情况,分别分割字符行和单字符的技术方案;该方法基于字符本身特性,利用字符图像中字符区域中的与其他区域的灰度值不同的特点,分割行字符图像,并在 行字符图像的基础上分割单字符,能够有效分割对字符;通过计算像素点个数算法简单,解决了现有技术计算复杂,分割效率低的问题。
在运用于元件错件检测时,能迅速有效地对元件上的印刷文字进行分割,提高检测的效率和准确性。
进一步地,所述字符分割方法还包括:
检测获得的每一所述单字符区域中存在的粘连字符,并分割所述粘连字符,从而得到最终的单字符区域。
作为上述方案的改进,所述字符分割方法还包括对粘连字符进行检测和分割,减少噪声的影响,提高分割准确率。
进一步地,所述基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像包括:
对所述字符图像进行水平投影,分别计算每一行像素点中所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的行分布直方图曲线;
利用高斯函数对所述行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
基于每一行字符的位置,分割每一行字符,从而得到分割后的若干字符行图像。
作为上述方案的改进,获取的输入的字符图像通常会包含一部分噪声,为了初步定为字符行的大致位置,先通过获取字符图像中每一行像素点中所述灰度值在预设范围内的像素点的个数的行分布直方图曲线,再利用行分布直方图中每一单字符行所在区域的曲线与高斯函数类似的特性,用高斯函数对行分布直方图进行曲线拟合,进而获得字符行的位。该改进能有效避免噪声的影响,算法简单,且分割准确率高。
进一步地,所述基于每一所述字符行图像中每一列像素点中的灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域包括:
对所述字符行图像进行垂直投影,分别计算每一列像素点中的所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的列分布直方图曲线;
按照预置顺序依次扫描所述列分布直方图曲线,并以所述灰度值在预设范围内的像素点个数为零的像素点列分割每一所述字符,从而得到分割后的若干所述单字符区域。
作为上述方案的改进,当图像的某一列不存在所述灰度值在预设范围内的像素点时,则可以认为此位置为字符分割点,该方案分割效率高。
进一步地,所述分割所述粘连字符的方法为滴水算法。
作为上述方案的改进,滴水算法通过模拟水滴从高处向低处滴落的过程,水滴所经过的轨迹就构成了字符的分割路径,滴水算法的分割效果好,有效去除噪声影响。
进一步地,获取的所述字符图像为二值化图像,所述灰度值在预设范围内的像素点为灰度值为225 的像素点。
作为上述方案的改进,为了提高行分割的准确率,可以预先输入该字符图像包含的字符行数。
为实现本发明的目的,相应地,本发明提供一种字符分割装置,包括:
字符图像获取单元,用于获取字符图像;
字符行分割单元,用于基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
字符分割单元,用于基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
与现有技术相比,本发明公开的一种字符分割装置,先通过字符行分割单元计算输入的字符图像的每一行像素点中所述灰度值在预设范围内的像素点的个数,基于字符行的特性结构,分割获取字符行图像;再通过字符分割单元,计算字符行图像的列像素点中灰度值在预设范围像素点的数,基于每一单字符的特性结构,分割获取每一单字符;该装置计算简单,分割效率高。
进一步地,所述字符分割装置还包括:
粘连字符分割单元,用于检测获取的所述若干单字符区域中存在的粘连字符,并分割所述粘连字符,从而得到最终的单字符区域。
进一步地,所述字符行分割单元包括:
第一计算模块,用于对所述字符图像进行水平投影,分别计算每一行像素点中的所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的行分布直方图曲线;利用高斯函数对所述行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
字符行分割模块,基于每一行字符的位置,分割每一行字符,从而获取若干字符行图像。
进一步地,所述字符分割单元包括:
第二计算模块,用于对所述字符行图进行垂直投影,分别计算每一列像素点中的所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的列分布直方图曲线;按照预置顺序依次扫描所述灰度值在预设范围内的像素点的列分布直方图曲线,从而得到所述灰度值在预设范围内的像素点个数为零的像素点列;
单字符分割模块,用于基于获取的所述灰度值在预设范围内的像素点个数为零的像素点列分割每一单字符,从而得到分割后的若干单字符区域。
基于本发明所公开的一种字符分割方法,本发明还提供一种元件检测方法,包括:
获取待检测元件图像,其中,所述待检测元件图像包括待检测元件的印刷字符的字符图像;
获取所述字符图像;
基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域;
基于获取的若干单字符区域,对所述字符图像进行字符识别,从而获取所述待检测元件的印刷字符的信息。
与现有技术相比,本发明公开的一种元件检测方法,基于元件上的印刷字符信息来识别元件,包括字符提取、字符分割和字符识别三个步骤;其中,采用本发明公开的一种字符分割方法,提高了元件检测中对元件上的印刷字符的分割效率和准确率,且由于有效分割提高了字符识别的准确率;最终整体提高了本技术方案元件检测时效率和准确度。
本发明还提供一种元件检测装置,包括:
待检测元件图像获取单元,用于获取待检测元件图像,其中,所述待检测元件图像包括待检测元件的印刷字符的字符图像;
字符图像获取单元,用于获取字符图像;
字符行分割单元,用于基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
字符分割单元,用于基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域;待检测元件信息获取单元,用于基于获取的若干所述单字符区域,对所述印刷字符图像进行字符识别,从而获取所述待检测元件的印刷字符的信息。
与现有技术相比,本发明公开的一种元件检测装置,通过设有的待检测元件图像获取单元获取待检测元件图像,然后通过字符图像获取单元获取待检测元件图像中的字符图像,接着依次通过字符行分割单元和字符分割单元对印刷字符图像进行分割和单字符分割以获取若干单字符区域,最后通过待检测元件信息获取单元基于获取的若干单字符区域来进行元件信息识别,其中,由于对采用的字符分割方法能实现对字符的有效分割,提高了元件检测中对元件上的印刷字符的分割效率和准确率,且由于有效分割提高了字符识别的准确率;最终整体提高了本技术方案元件检测时效率和准确度。
附图说明
图1是本发明一种字符分割方法提供的实施例一的流程示意图;
图2是本发明一种字符分割方法提供的实施例一的步骤S12的流程示意图;
图3是本发明一种字符分割方法提供的实施例一的步骤S13的流程示意图;
图4是本发明一种字符分割方法提供的实施例二的流程示意图;
图5是本发明一种字符分割方法提供的实施例二的步骤S22的流程示意图;
图6是本发明一种字符分割方法提供的实施例二的步骤S23的流程示意图;
图7是获取的字符图像的示例图;
图8是图7中的字符图像示例图的水平投影示意图;
图9是利用高斯函数对图8中经过水平投影获取的行分布直方图曲线进行拟合示意图;
图10是从图7字符图像示例图中得到的一字符行图像示例的垂直投影示意图;
图11是图10中的一字符行图像示例的单字符分割示意图;
图12是分割的单字符区域中存在粘连字符的示例图;
图13(a)本发明一种字符分割方法提供的实施例二的步骤S24采用的滴水算法中水滴滴落的像素点位置的一种编号示例图;
图13(b)本发明一种字符分割方法提供的实施例二的步骤S24采用的滴水算法中水滴下一刻低落位置的规则示意图;
图14是本发明一种字符分割装置提供的实施例的结构示意图;
图15是本发明一种元件检测方法提供的实施例的流程示意图;
图16是本发明一种元件检测装置提供的实施例的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
参见图1,是本发明一种字符分割方法提供的实施例一流程示意图,本实施例一包括步骤:
S11、获取字符图像;
参见图7,图7为获取的字符图像的示例图;
S12、基于字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
S13、基于每一字符行图像中每一列像素点中的灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
其中,步骤S12/步骤S13中的灰度值在预设范围内的像素点的个数情况为对应每行/每列像素点中表示字符区域的像素点的个数情况,则具体实施时所设定的灰度值的预设范围为根据字符图像中表示字符的像素点的灰度值范围进行具体的设定。
参见图2,图2为本实施例一的步骤S12的流程示意图,步骤S12包括:
S121、对字符图像进行水平投影,分别计算每一行像素点中灰度值在预设范围内的像素点的个数,获取灰度值在预设范围内的像素点的行分布直方图曲线;
参见图8,图8是获取的字符图像的水平投影图,结合图8对步骤S121进行详细说明:图8中的字符图像包含一部分噪声,为了初步定位字符行图像的大致位置,首先需要对输入的字符图像进行水平投影,计算每一行像素点中灰度值在预设范围内的像素点的个数,从而获得行分布直方图。该字符图像包含两字符行,水平投影后对应获取的行分布直方图呈现两个峰值较大的波峰,且与高斯函数类似。
S122、利用高斯函数对行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
由于直方图中,每一字符行所对应的曲线与高斯函数类似;因此,可以用高斯函数对直方图曲线进行拟合;参见图9,图9为利用高斯函数对图8中经过水平投影获取的行分布直方图曲线进行拟合示意图;依据拟合结果确定字符图像每一行文字的位置。
S123、基于每一行字符的位置,分割每一行字符,从而得到分割后的若干字符行图像。
参见图3,图3为本实施例一的步骤S13的流程示意图,步骤S13包括:
S131、对字符行图像进行垂直投影,分别计算每一列像素点中的灰度值在预设范围内的像素点的个数,获取灰度值在预设范围内的像素点的列分布直方图曲线;
S132、按照预置顺序依次扫描列分布直方图曲线,以获取灰度值在预设范围内的像素点个数为零的像素点列;
参见图10,图10是从图7字符图像示例图中得到的一字符行图像示例的垂直投影示意图;从图10中可以看出每两单字符间的分界位置在该列分布直方图曲线上相对应的位置处所获取的灰度值在预设范围内的像素点的个数为零。即认为,当字符行图像中某一列不存在灰度值在预设范围内的像素点时,则可以认为此列位置为单字符分割列。按照预置顺序依次扫描列分布直方图曲线,以扫描获取的灰度值在预设范围内的像素点个数为零的像素点列;
S133、以灰度值在预设范围内的像素点个数为零的像素点列分割每一字符,从而得到分割后的若干单字符区域。
参见图11,根据获取的这些像素列分割每一单字符,从而获取若干单字符区域。
具体实施时,首先通过字符图像的灰度值在预设范围内的像素点个数的行分布直方图曲线,与高斯函数拟合处确定字符行位置,对字符图像进行行分割,从而获取每一字符行图像;然后在通过每一字符行图像的灰度值在预设范围内的像素点个数的列分布直方图曲线,以灰度值在预设范围内的像素点个数为零的像素列对每一字符行图像进行单字符的分割。
本实施例基于字符图像中表示字符的像素点个数特征,依次分割字符行和单字符,能够有效分割对字符;通过计算像素点个数算法简单,解决了现有技术计算复杂,分割效率低的问题。
参见图4,是本发明一种字符分割方法提供的实施例二步骤流程图,本实施例二包括步骤:
S21、获取字符图像;
同样地,参见图7,图7为获取的字符图像的示例图;
优选地,在本实施例二中,获取输入的字符图像为经过二值化处理的字符图像。经过二值化处理后若提取的字符区域中像素点灰度值为225,即黑色像素点,则其余区域中像素点灰度值为0;本实施例二以黑色像素点个数为特征来识别字符区域为例进行说明。
S22、基于字符图像中每一行像素点中的黑色像素点个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
S23、基于每一字符行图像中每一列像素点中的黑色像素点个数情况,分割每一单字符,从而得到分割后的若干单字符区域;
由于本实施例二以输入的图像为二值化图像为例进行说明,其中,步骤S22/步骤S23中通过获取每行/每列像素点中的黑色像素点个数情况从而获取对应每行/每列像素点中表示字符区域的像素点的个数情况。
S24、检测获得的每一单字符区域中存在的粘连字符,并分割粘连字符,从而得到最终的单字符区域。
参见图5,图5为本实施例二的步骤S22的流程示意图,步骤S22包括:
S221、对字符图像进行水平投影,分别计算每一行像素点中灰度值在预设范围内的像素点的个数,获取灰度值在预设范围内的像素点的行分布直方图曲线;
同样地,参见图8,图8是获取的字符图像的水平投影图,结合图8对步骤S221进行详细说明:图8中的字符图像包含一部分噪声,为了初步定位字符行图像的大致位置,首先需要对输入的字符图像进行水平投影,计算每一行像素点中黑色像素点的个数,从而获得行分布直方图。该字符图像包含两字符行,水平投影后对应获取的行分布直方图呈现两个峰值较大的波峰,且与高斯函数类似。
S222、利用高斯函数对行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
由于直方图中,每一字符行所对应的曲线与高斯函数类似;因此,可以用高斯函数对直方图曲线进行拟合;参见图9,图9为利用高斯函数对图8中经过水平投影获取的行分布直方图曲线进行拟合示意图;依据拟合结果确定字符图像每一行文字的位置。
S223、基于每一行字符的位置,分割每一行字符,从而得到分割后的若干字符行图像。
参见图6,图6为本实施例一的步骤S23的流程示意图,步骤S23包括:
S231、对字符行图像进行垂直投影,分别计算每一列像素点中黑色像素点的个数,获取灰度值在预设范围内的像素点的列分布直方图曲线;
S232、按照预置顺序依次扫描列分布直方图曲线,以获取黑色像素点个数为零的像素点列;
参见图10,图10是从图7字符图像示例图中得到的一字符行图像示例的垂直投影示意图;从图10中可以看出每两单字符间的分界位置在该列分布直方图曲线上相对应的位置处所获取的黑色像素 点的个数为零。即认为,当字符行图像中某一列不存黑色像素点时,则可以认为此列位置为单字符分割列。按照预置顺序依次扫描列分布直方图曲线,以扫描获取的灰度值在预设范围内的像素点个数为零的像素点列;
S233、以黑色像素点个数为零的像素点列分割每一字符,从而得到分割后的若干单字符区域;
参见图11,根据获取的这些像素列分割每一单字符,从而获取若干单字符区域。
优选地,本实施例二中的步骤S21中获取输入的字符图像可以为字符提取算法处理的字符图像;字符提取算法是指提取字符区域的算法,如模板匹配、笔画宽度变换(SWT)、MSER等方法。经过字符提取算法处理后的字符图像上会去除非字符区域,保留字符区域。
此外,由于噪声的存在,两单字符间有的时候会存在粘连,使得步骤S23中得到的单字符区域中可能存在两个字符,参见图12,图12是分割的单字符区域中存在粘连字符的示例图,字符“J”和字符“X”由于噪声存在,在通过步骤S23的分割后仍粘连在一起,同在一个单字符区域中;粘连字符的存在影响了本实施例的分割有效性。为实现有效分割,步骤S24检测并分割可能出现的粘连字符,优选地,本实施例二采用滴水算法来获取粘连字符间的分割路径,基于该分割路径分割粘连字符。
具体地,滴水算法通过模拟水滴从高处向低处滴落的过程,从而对粘连字符进行分割:当水滴从字符顶部由于重力的作用,会沿着字符的轮廓向下低落或水平滚动;当水滴陷在字符轮廓的凹处时,将穿透到字符的笔划后继续低落;水滴所经过的轨迹就构成了字符的分割路径。
参见图13,图13(a)滴水算法的水滴滴落的像素点位置的一种编号示例图,假设水滴当前所在的像素点位置用n0表示,水滴下一刻滴落的像素点位置由其周围的五个水滴像素点决定。图13(b)列举了水滴周围五个像素点可能出现的情况及水滴下一刻低落的位置的六种情况;其中,w表示白色像素点,b表示黑色像素点,*表示既有可能是白色像素点也有可能是黑色像素点,箭头则表示水滴低落的轨迹。例如,水滴当前所在像素点位置的邻近五个像素点全是白点或全是黑点时,水滴向下低落。通过下述计算过程可获取水滴的滴落路径:
对于待分割的粘连字符图像,水滴当前所在像素点位置坐标表示为(xi,yi),水滴的滴落路径为T,则T(xi+1,yi+1)=f(xi,yi,Wi),i=0,1,...;其中(xi+1,yi+1)表示水滴下一步滴落像素点位置的坐标,Wi表示水滴在当前位置上的重力势能,通过下述公式计算重力势能Wi
Figure PCTCN2016113632-appb-000001
其中,
Figure PCTCN2016113632-appb-000002
zj表示nj点的像素值,具体地,若nj点为黑色像素点,则zj=0,若nj点为白色像素点,则zj=1;ωj表示nj点被选为水滴下一步的滴落点的权重大小,且ωj=6-j。那么,水滴下一点滴落的位置为:
Figure PCTCN2016113632-appb-000003
根据获取的水滴滴落路径分割粘连字符,从而获得最终的若干单字符区域。
具体实施时,首先通过字符图像的黑色像素点个数的行分布直方图曲线,与高斯函数拟合处确定字符行位置,对字符图像进行行分割,从而获取每一字符行图像;然后在通过每一字符行图像的黑色像素点个数的列分布直方图曲线,以灰度值在预设范围内的像素点个数为零的像素列对每一字符行图像进行单字符的分割,从而获得每一单字符区域;并进一步地,采用滴水算法分割单字符区域中的粘连字符,从而获得最终的单字符区域。
本实施例基于字符图像中表示字符的像素点个数特征,依次分割字符行和单字符,能够有效分割对字符;并采用滴水算法分割粘连字符;通过计算像素点个数算法简单,解决了现有技术计算复杂,分割效率低的问题;且通过高斯函数进行拟合的方式获取字符行,以及通过滴水算法分割粘连字符,大大减少噪声的干扰,提高的分割字符的准确率。
本发明一种字符分割装置提供的实施例,参见图14,图14是本发明一种字符分割装置提供的实施例的结构示意图;本实施例装置包括字符图像获取单元11、字符行分割单元12和字符分割单元13,具体地:
字符图像获取单元11,用于获取字符图像;
字符行分割单元12,用于基于字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
字符分割单元13,用于基于每一字符行图像中每一列像素点中的灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
字符行分割单元12包括第一计算模块121和字符行分割模块122,具体地:
第一计算模块121,用于对字符图像进行水平投影,分别计算每一行像素点中的灰度值在预设范围内的像素点的个数,获取灰度值在预设范围内的像素点的行分布直方图曲线;利用高斯函数对行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
字符行分割模块122,基于每一行字符的位置,分割每一行字符,从而获取若干字符行图像。
字符分割单元13包括第二计算模块131和单字符分割模块132,具体地:
第二计算模块131,用于对字符行图进行垂直投影,分别计算每一列像素点中的灰度值在预设范 围的像素点的个数,获取灰度值在预设范围内的像素点的列分布直方图曲线;按照预置顺序依次扫描灰度值在预设范围内的像素点的列分布直方图曲线,从而得到灰度值在预设范围内的像素点个数为零的像素点列;
单字符分割模块132,用于基于获取的灰度值在预设范围内的像素点个数为零的像素点列分割每一单字符,从而得到分割后的若干单字符区域。
其中,在该字符分割装置中设定的灰度值在预设范围内的像素点的个数情况为对应图像中每行/每列像素点中表示字符区域的像素点的个数情况,则具体实施时灰度值的预设范围为根据表示字符像素点的灰度值范围进行设定。当本实施例中字符图像获取单元11获取字符图像的过程优选包括经过字符提取算法和图像二值化的处理获取字符图像,且,字符图像上的字符区域中像素点灰度值为225,即黑色像素点时,本字符分割装置将灰度值在预设范围的像素点设定为黑色像素点。
本发明提供的字符分割装置的实施例还包括粘连字符分割单元14,粘连字符分割单元14用于检测获取的若干单字符区域中存在的粘连字符,并分割粘连字符,从而得到最终的单字符区域。
其中,粘连字符单元14分割粘连字符时,采用滴水算法获取粘连字符之间的分割路径,具体的计算过程可以参照本发明一种字符分割方法提供的实施例二的步骤S24的具体过程,此处不做赘述。
具体实施时,首先,字符图像获取单元11先获取输入的字符图像;然后,字符行分割单元12中的第一计算模块121计算输入的字符图像的每一行像素点中灰度值在预设范围内的像素点的个数,得到行分布直方图曲线,对行分布直方图曲线进行曲线拟合,确定字符行位置,字符行分割模块122进行字符行分割以获取字符行图像;接着,字符分割单元13中的第二计算模块131,计算字符行图像的列像素点中灰度值在预设范围内的像素点个数,以确定灰度值在预设范围内的像素点个数为零的像素点列;单字符分割模块132根据这些像素列分割获取每一单字符;最后,由粘连字符分割单元14采用滴水算法分割单字符区域中的粘连字符,从而获得最终的单字符区域。
本实施例的字符分割装置内设算法简单,无需较高的硬件,有利于降低成本;同时计算快速,有利于提高分割效率;且分割准确率高,有利于运用于字符识别系统时,提高字符识别效果。
基于本发明一种字符分割方法提供的实施例一/实施例二,本发明还提供一种元件检测方法的实施例:通过识别元件上的印刷字符,获取该元件的印刷字符信息,包括该元件的型号和参数等信息,从而达到检测该元件的目的。参见图15,图15是本实施例的流程示意图,具体包括以下步骤:
S31、获取待检测元件图像,其中,待检测元件图像包括待检测元件的印刷字符的字符图像;
S32、获取字符图像;
S33、基于字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
S34、基于每一字符行图像中每一列像素点中的灰度值在预设范围内的像素点的个数情况,分割 每一单字符,从而得到分割后的若干单字符区域;
S35、基于获取的若干单字符区域,对印刷字符图像进行字符识别,从而获取待检测元件的印刷字符的信息。
其中,步骤S32中所获取的字符图像可以参照图7所示的字符图像示例图;
优选地,步骤S32中从待检测元件图像中所获取的字符图像的过程包括对字符提取,可以采用以下几种字符提取算法进行处理:模板匹配、笔画宽度变换(SWT)、MSER等方法。经过字符提取算法处理后的印刷字符图像上会去除非字符区域,保留待检测元件上的印刷字符区域;
优选地,步骤S32中,在获取待检测元件图像的印刷字符的字符图像的过程中,还包括对图像的二值化处理步骤,最终获取的字符图像为二值化图像。
具体地,步骤S33、步骤S34中字符图像进行分割,获取若干单字符区域的具体过程可以参照本发明一种字符分割方法的实施例一/实施例二的具体实施过程,此处不做赘述。
具体地,步骤S35中基于获取的若干单字符区域,可以对每一单字符区域进行对应的识别,从而读取该单字符对应的字符含义,进而获取待检测元件的印刷字符信息,从而实现元件检测;或,步骤S35中基于获取的若干单字符区域,进行模板文字对应匹配,进而获取待检测元件匹配的印刷字符信息,从而实现元件检测。
具体实施时,先获取包括有待检测元件上的印刷字符的待检测元件图像,并从中获取印刷字符的字符图像;依次对字符图像进行行分割和单字符分割,获取若干单字符区域;并基于获取的若干单字符区域,识别印刷字符,获取元件信息进行元件检测。
相比于从元件的大小、颜色和外观等信息来检测识别元件,本发明提供的一种元件检测方法的实施例基于元件上的印刷字符信息来识别元件的检测准确率更高;提高了元件检测中对元件上的印刷字符的分割效率和准确率,且由于有效分割提高了字符识别的准确率;最终整体提高了本实施例元件检测时效率和准确度。
相应地,本发明还提供一种元件检测装置的实施例,参见图16,图16是本实施例的结构示意图,本实施例具体包括:
待检测元件图像获取单元10,用于获取待检测元件图像,其中,待检测元件图像包括待检测元件的印刷字符的字符图像;
字符图像获取单元11;用于获取字符图像;
字符行分割单元12,用于基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
字符分割单元13,用于基于每一字符行图像中每一列像素点中的灰度值在预设范围内的像素点的 个数情况,分割每一单字符,从而得到分割后的若干单字符区域;
待检测元件信息获取单元15,用于基于获取的若干所述单字符区域,对所述印刷字符图像进行字符识别,从而获取所述待检测元件的印刷字符的信息。
具体实施时,首先,通过待检测元件图像获取单元10来获取待检测元件图像;然后,通过印刷字符图像提取单元11来提取待检测元件图像;接着,依次通过字符行分割单元12和字符分割单元13来获取若干单字符区域;最后通过待检测元件信息获取单元15基于获取的若干单字符区域来进行元件信息识别,从而实现对待检测元件的检测。
本实施例提高了元件检测中对元件上的印刷字符的分割效率和准确率,且由于有效分割提高了字符识别的准确率;最终整体提高了本实施例元件检测时效率和准确度。
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。

Claims (12)

  1. 一种字符分割方法,其特征在于,包括:
    获取字符图像;
    基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
    基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
  2. 如权利要求1所述的一种字符分割方法,其特征在于,所述字符分割方法还包括:
    检测获得的每一所述单字符区域中存在的粘连字符,并分割所述粘连字符,从而得到最终的单字符区域。
  3. 如权利要求1所述的一种字符分割方法,其特征在于,所述基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像包括:
    对所述字符图像进行水平投影,分别计算每一行像素点中所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的行分布直方图曲线;
    利用高斯函数对所述行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
    基于每一行字符的位置,分割每一行字符,从而得到分割后的若干字符行图像。
  4. 如权利要求1所述的一种字符分割方法,其特征在于,所述基于每一所述字符行图像中每一列像素点中的灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域包括:
    对所述字符行图像进行垂直投影,分别计算每一列像素点中的灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的列分布直方图曲线;
    按照预置顺序依次扫描所述列分布直方图曲线,并以所述灰度值在预设范围内的像素点个数为零的像素点列分割每一所述字符,从而得到分割后的若干所述单字符区域。
  5. 如权利要求2所述的一种字符分割方法,其特征在于,所述分割所述粘连字符的方法为滴水 算法。
  6. 如权利要求1所述的一种字符分割方法,其特征在于,获取的所述字符图像为二值化图像,所述灰度值在预设范围内的像素点为灰度值为225的像素点。
  7. 一种字符分割装置,其特征在于,包括:
    字符图像获取单元,用于获取字符图像;
    字符行分割单元,用于基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
    字符分割单元,用于基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域。
  8. 如权利要求7所述的一种字符分割装置,其特征在于,所述字符分割装置还包括:
    粘连字符分割单元,用于检测获取的所述若干单字符区域中存在的粘连字符,并分割所述粘连字符,从而得到最终的单字符区域。
  9. 如权利要求7所述的一种字符分割装置,其特征在于,所述字符行分割单元包括:
    第一计算模块,用于对所述字符图像进行水平投影,分别计算每一行像素点中的所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的行分布直方图曲线;利用高斯函数对所述行分布直方图曲线进行拟合处理,从而确定每一行字符的位置;
    字符行分割模块,基于每一行字符的位置,分割每一行字符,从而获取若干字符行图像。
  10. 如权利要求7所述的一种字符分割装置,其特征在于,所述字符分割单元包括:
    第二计算模块,用于对所述字符行图进行垂直投影,分别计算每一列像素点中的所述灰度值在预设范围内的像素点的个数,获取所述灰度值在预设范围内的像素点的列分布直方图曲线;按照预置顺序依次扫描所述灰度值在预设范围内的像素点的列分布直方图曲线,从而得到所述灰度值在预设范围内的像素点个数为零的像素点列;
    单字符分割模块,用于基于获取的所述灰度值在预设范围内的像素点个数为零的像素点列分割每一单字符,从而得到分割后的若干单字符区域。
  11. 一种元件检测方法,其特征在于,包括:
    获取待检测元件图像,其中,所述待检测元件图像包括待检测元件的印刷字符的字符图像;
    获取所述字符图像;
    基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
    基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域;
    基于获取的若干单字符区域,对所述字符图像进行字符识别,从而获取所述待检测元件的印刷字符的信息。
  12. 一种元件检测装置,其特征在于,包括:
    待检测元件图像获取单元,用于获取待检测元件图像,其中,所述待检测元件图像包括待检测元件的印刷字符的字符图像;
    字符图像获取单元,用于获取字符图像;
    字符行分割单元,用于基于所述字符图像中每一行像素点中的灰度值在预设范围内的像素点的个数情况,分割每一行字符,从而得到分割后的若干字符行图像;
    字符分割单元,用于基于每一所述字符行图像中每一列像素点中的所述灰度值在预设范围内的像素点的个数情况,分割每一单字符,从而得到分割后的若干单字符区域;
    待检测元件信息获取单元,用于基于获取的若干所述单字符区域,对所述印刷字符图像进行字符识别,从而获取所述待检测元件的印刷字符的信息。
PCT/CN2016/113632 2016-11-08 2016-12-30 一种字符分割方法和装置、及元件检测方法和装置 Ceased WO2018086233A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610991144.7A CN106599896A (zh) 2016-11-08 2016-11-08 一种字符分割方法和装置、及元件检测方法和装置
CN201610991144.7 2016-11-08

Publications (1)

Publication Number Publication Date
WO2018086233A1 true WO2018086233A1 (zh) 2018-05-17

Family

ID=58590277

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113632 Ceased WO2018086233A1 (zh) 2016-11-08 2016-12-30 一种字符分割方法和装置、及元件检测方法和装置

Country Status (2)

Country Link
CN (1) CN106599896A (zh)
WO (1) WO2018086233A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726722A (zh) * 2018-12-20 2019-05-07 上海众源网络有限公司 一种字符分割方法及装置
CN111027544A (zh) * 2019-11-29 2020-04-17 武汉虹信技术服务有限责任公司 一种基于视觉显著性检测的mser车牌定位方法及系统
CN112364871A (zh) * 2020-10-27 2021-02-12 重庆大学 基于改进投影算法的零件喷码字符分割方法
CN112699890A (zh) * 2021-01-07 2021-04-23 北京美斯齐文化科技有限公司 一种图片文字切割系统
CN116309296A (zh) * 2022-12-31 2023-06-23 中山市天柏包装制品有限公司 一种包装箱缺陷的智能检测方法及检测系统
CN118071740A (zh) * 2024-04-18 2024-05-24 山东中泰药业有限公司 一种视觉辅助下药品铝箔包装质量检测方法
CN119851286A (zh) * 2025-01-08 2025-04-18 武汉凌琅科技有限公司 基于数字彩图像的内容识别方法及系统

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108304863B (zh) * 2018-01-12 2020-11-20 西北大学 一种利用学习不变特征变换的兵马俑图像匹配方法
CN107958253A (zh) * 2018-01-18 2018-04-24 浙江中控技术股份有限公司 一种图像识别的方法和装置
CN109325492B (zh) * 2018-08-17 2023-12-19 平安科技(深圳)有限公司 字符切割方法、装置、计算机设备及存储介质
CN109299718B (zh) * 2018-09-21 2021-09-24 新华三信息安全技术有限公司 一种字符识别方法及装置
CN109948620A (zh) * 2019-03-19 2019-06-28 厦门商集网络科技有限责任公司 一种字符分割方法及终端
CN112668372B (zh) * 2019-10-16 2025-10-21 株式会社日立制作所 字符识别方法和字符识别装置
CN112435222A (zh) * 2020-11-11 2021-03-02 深圳技术大学 一种电路板检测方法、装置及计算机可读存储介质
CN113971803B (zh) * 2021-10-25 2025-11-11 上海大学(浙江·嘉兴)新兴产业研究院 一种图像中粘连字符的分割方法及相关设备
CN116266405A (zh) * 2021-12-15 2023-06-20 广州视源电子科技股份有限公司 单字符检测模型训练方法、装置及非易失性存储介质
CN115311278B (zh) * 2022-10-11 2023-12-22 南通欧惠纺织科技有限公司 一种对于纱线检测的纱线分割方法
CN116503871A (zh) * 2023-03-29 2023-07-28 安徽省配天机器人集团有限公司 字符分割的预处理方法、终端设备和计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567042A (zh) * 2009-05-25 2009-10-28 公安部交通管理科学研究所 武警汽车号牌图像的字符识别方法
CN101567041A (zh) * 2009-05-25 2009-10-28 公安部交通管理科学研究所 基于三维投影的机动车号牌图像的字符识别方法
CN104463209A (zh) * 2014-12-08 2015-03-25 厦门理工学院 一种基于bp神经网络的pcb板上数字代码识别方法
CN105528601A (zh) * 2016-02-25 2016-04-27 华中科技大学 基于接触式传感器的身份证图像采集、识别系统及采集识别方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567042A (zh) * 2009-05-25 2009-10-28 公安部交通管理科学研究所 武警汽车号牌图像的字符识别方法
CN101567041A (zh) * 2009-05-25 2009-10-28 公安部交通管理科学研究所 基于三维投影的机动车号牌图像的字符识别方法
CN104463209A (zh) * 2014-12-08 2015-03-25 厦门理工学院 一种基于bp神经网络的pcb板上数字代码识别方法
CN105528601A (zh) * 2016-02-25 2016-04-27 华中科技大学 基于接触式传感器的身份证图像采集、识别系统及采集识别方法

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726722A (zh) * 2018-12-20 2019-05-07 上海众源网络有限公司 一种字符分割方法及装置
CN111027544A (zh) * 2019-11-29 2020-04-17 武汉虹信技术服务有限责任公司 一种基于视觉显著性检测的mser车牌定位方法及系统
CN111027544B (zh) * 2019-11-29 2023-09-29 武汉虹信技术服务有限责任公司 一种基于视觉显著性检测的mser车牌定位方法及系统
CN112364871A (zh) * 2020-10-27 2021-02-12 重庆大学 基于改进投影算法的零件喷码字符分割方法
CN112699890A (zh) * 2021-01-07 2021-04-23 北京美斯齐文化科技有限公司 一种图片文字切割系统
CN116309296A (zh) * 2022-12-31 2023-06-23 中山市天柏包装制品有限公司 一种包装箱缺陷的智能检测方法及检测系统
CN118071740A (zh) * 2024-04-18 2024-05-24 山东中泰药业有限公司 一种视觉辅助下药品铝箔包装质量检测方法
CN119851286A (zh) * 2025-01-08 2025-04-18 武汉凌琅科技有限公司 基于数字彩图像的内容识别方法及系统

Also Published As

Publication number Publication date
CN106599896A (zh) 2017-04-26

Similar Documents

Publication Publication Date Title
WO2018086233A1 (zh) 一种字符分割方法和装置、及元件检测方法和装置
US11282185B2 (en) Information processing device, information processing method, and storage medium
CN108364010B (zh) 一种车牌识别方法、装置、设备及计算机可读存储介质
US8340420B2 (en) Method for recognizing objects in images
CN109377485B (zh) 一种方便面包装缺陷机器视觉检测方法
CN107545239B (zh) 一种基于车牌识别与车辆特征匹配的套牌检测方法
WO2019169532A1 (zh) 车牌识别方法及云系统
CN103310211B (zh) 一种基于图像处理的填注标记识别方法
CN106650553A (zh) 车牌识别方法及系统
WO2018018788A1 (zh) 一种基于图像识别的计量表抄表装置及其方法
CN109886978B (zh) 一种基于深度学习的端到端告警信息识别方法
CN107067006A (zh) 一种服务于数据采集的验证码识别方法及系统
CN110598566A (zh) 图像处理方法、装置、终端和计算机可读存储介质
CN106446894A (zh) 一种基于轮廓识别球型目标物位置的方法
CN108830133A (zh) 合同影像图片的识别方法、电子装置及可读存储介质
CN110097510B (zh) 一种纯色花朵识别方法、装置及存储介质
CN104915642B (zh) 前方车辆测距方法及装置
CN114119695B (zh) 一种图像标注方法、装置及电子设备
CN112288372B (zh) 一种可同时识别一维条码和三段码字符的快递单识别方法
CN109961063B (zh) 文本检测方法及装置、计算机设备和存储介质
CN104463134A (zh) 一种车牌检测方法和系统
CN113421301A (zh) 一种田间作物中心区域定位方法及系统
CN111814576A (zh) 一种基于深度学习的购物小票图片识别方法
CN114926635B (zh) 与深度学习方法相结合的多焦图像中目标分割方法
CN117437625A (zh) 车牌识别方法及相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16921409

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 04/10/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16921409

Country of ref document: EP

Kind code of ref document: A1