CN113283441A - Printed character recognition method and device on chip resistor, terminal and medium - Google Patents

Printed character recognition method and device on chip resistor, terminal and medium Download PDF

Info

Publication number
CN113283441A
CN113283441A CN202110644682.XA CN202110644682A CN113283441A CN 113283441 A CN113283441 A CN 113283441A CN 202110644682 A CN202110644682 A CN 202110644682A CN 113283441 A CN113283441 A CN 113283441A
Authority
CN
China
Prior art keywords
image
character
printed
chip resistor
preset
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.)
Withdrawn
Application number
CN202110644682.XA
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN202110644682.XA priority Critical patent/CN113283441A/en
Publication of CN113283441A publication Critical patent/CN113283441A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/32Normalisation of the pattern dimensions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/146Aligning or centring of the image pick-up or image-field
    • G06V30/1475Inclination or skew detection or correction of characters or of image to be recognised
    • G06V30/1478Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

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)
  • Character Input (AREA)

Abstract

The invention discloses a method for identifying printed characters on a chip resistor, which comprises the following steps: acquiring an input image of the chip resistor; intercepting an effective area of the image; carrying out graying processing on the effective area of the image and carrying out contrast stretching processing; carrying out binarization processing on the image according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area; carrying out image segmentation on the printed characters to obtain a plurality of images of single printed characters, and uniformly resetting the size of a preset size; inputting the image of the single printed character into a pre-trained artificial neural network printed character recognition model for detection, thereby automatically recognizing the printed character on the chip resistor; the recognition result of the whole printed character is obtained by recognizing the single printed character, so that the complexity of the image background is reduced, the difficulty of character recognition is reduced, and the accuracy and the efficiency of printed character recognition are improved.

Description

Printed character recognition method and device on chip resistor, terminal and medium
[ technical field ] A method for producing a semiconductor device
The invention relates to the technical field of artificial intelligence, in particular to a method, a device, a terminal and a medium for identifying printed characters on a chip resistor.
[ background of the invention ]
Surface Mount Technology (SMT) is a modern electronic assembly Technology, and is widely used in the industries of computers, communications, consumer electronics, and the like. In this technique, an electronic component such as a chip resistor, a chip capacitor, a chip inductor, etc., having no lead or short lead, is attached to a surface of a Printed Circuit Board (PCB), and then the electronic component and the Circuit board are connected by heat soldering using a reflow soldering apparatus. The technology has the advantages of high assembly density, small volume, light weight, easy realization of automation, high production efficiency and the like. Among them, the chip resistor is one of the most important electronic components in SMT.
However, after the chip resistor is mounted on the circuit board, it is necessary to detect the characters on the chip resistor to determine whether the resistor is mounted at the correct position, for example, the character "100" represents that the resistance of the resistor is 10 Ω (as shown in fig. 4-1), "201" represents that the resistance of the resistor is 200 Ω, and "5101" is 5100 Ω. However, the length and width of the chip resistor are usually only a few millimeters, and it is difficult for a person to efficiently recognize characters on the chip resistor without the aid of a detection device. Automatic Optical Inspection (Automated Optical Inspection) equipment is widely applied to industrial Inspection projects, and the equipment takes pictures of an Inspection object by using a high-resolution industrial camera and then judges whether the Inspection object has certain defects by adopting a series of image processing technologies. However, the existing image processing technology cannot efficiently and accurately identify the printed characters on the chip resistor.
In view of the above, it is desirable to provide a method, an apparatus, a terminal and a storage medium for recognizing printed characters on a chip resistor to overcome the above-mentioned drawbacks.
[ summary of the invention ]
The invention aims to provide a method, a device, a terminal and a medium for identifying printed characters on a chip resistor, and aims to solve the problem that the printed characters on the chip resistor cannot be efficiently and accurately identified in the existing image processing technology.
In order to achieve the above object, a first aspect of the present invention provides a method for recognizing printed characters on a chip resistor, comprising the steps of:
acquiring an input image obtained by shooting a chip resistor, adjusting the size of the input image to a preset size and extracting an image effective area;
graying the effective area of the image, and performing contrast stretching processing on the grayed image according to a preset stretching formula;
carrying out binarization processing on the image subjected to stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area;
according to the position coordinate information of the rectangular area, the whole printed character is intercepted from the original input image, then image segmentation is carried out, and a plurality of images which contain single printed characters of sequencing information and uniformly reset the preset size are obtained;
and inputting the image of the single printed character into a pre-trained artificial neural network printed character recognition model for detection, thereby automatically recognizing the printed character on the chip resistor.
In a preferred embodiment, the resizing the input image to a preset size and extracting an image effective area step includes:
judging whether the width of the input image is larger than the height, and if not, rotating the input image by 90 degrees;
resetting the size of the input image with the width larger than the height to a preset size;
and intercepting the input image with a preset size according to a preset segmentation size to obtain an image effective area.
In a preferred embodiment, the step of performing binarization processing on the image after the stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular region of the printed character surrounded by a black region includes:
carrying out binarization processing on the image subjected to contrast stretching processing, and resetting to 255 if the pixel value in the image is greater than a preset binarization threshold value; if the pixel value in the image is smaller than a preset binarization threshold value, resetting to 0;
and obtaining the position coordinate information of a rectangular area of the printing character, which is surrounded by the black area, according to a preset contour function.
In a preferred embodiment, the method further comprises the following steps:
after each binarization processing, calculating the outline area of the obtained region;
and judging whether the area of the outline is larger than a preset area threshold value or not, and if not, carrying out image corrosion processing on the image subjected to binarization processing for a preset number of times until black areas around the printed characters are communicated.
In a preferred embodiment, the step of intercepting the whole printed character from the original input image according to the position coordinate information of the rectangular region, and then performing image segmentation to obtain a plurality of images containing the single printed character of the sorting information and uniformly resetting the preset size comprises the following steps:
according to the position coordinate information of the rectangular area, the rectangular area is divided to obtain a rectangular image containing the printing characters;
graying and contrast stretching are carried out on the rectangular image, and then binarization processing is carried out according to another preset binarization threshold value to obtain a binarized rectangular image; if the pixel value of the image is larger than another preset binarization threshold value, converting the pixel value into 1, otherwise, converting into 0;
calculating the sum of pixel values of each column of the binarized rectangular image; the sum of the pixel values of the foremost preset column number and the rearmost preset column number is uniformly reset to be 0;
dividing the binarized rectangular image from the middle of the area with the continuous pixel values of 0 except the area with the continuous frontmost end and the continuous rearmost end of 0;
calculating the length of a continuous non-0 area in the vector, and if the length is greater than a preset length threshold value, segmenting an image from the middle section of the continuous non-0 area;
an image containing a single number of single printed characters containing the sorting information is output.
In a preferred embodiment, the step of inputting the image of the single printed character into a pre-trained printed character recognition model for detection, so as to automatically recognize the printed character on the chip resistor comprises the following steps:
establishing a training set containing 11 types of images; wherein, the 11 classes comprise 0, 1, 2, 8, 9 and "null", which means that the image has no characters but some interference points are distributed;
building and training a printing character recognition model based on an artificial neural network;
and inputting the image of the single printing character into the trained printing character recognition model to obtain the recognition result of the printing character on the chip resistor.
In a preferred embodiment, the step of inputting the image of the single printed character into the trained printed character recognition model to obtain the recognition result of the printed character on the chip resistor comprises:
sequentially inputting images containing single printing characters into the printing character recognition model for recognition, and outputting character prediction results;
judging whether the character prediction result contains at least one character in the characters 1, 2, 3, 4 and 7, and if not, outputting the printed characters according to a normal sequence; if so, judging whether the first character of the character prediction result is 0 or not;
when the first character of the character prediction result is judged to be 0, outputting the printing characters according to a reverse order, otherwise, solving the sum of pixel values of each column of the image of the single printing character;
judging whether the variation trend of the sum of the pixel values is reduced firstly and then increased, if so, outputting the printing characters according to a normal sequence; if not, outputting the printed characters according to the reverse order.
The invention provides a printed character recognition device on a chip resistor, which comprises:
the image acquisition module is used for acquiring an input image obtained by shooting the chip resistor, adjusting the size of the input image to a preset size and extracting an image effective area;
the image processing module is used for carrying out graying processing on the image effective area and carrying out contrast stretching processing on the grayed image according to a preset stretching formula;
the position acquisition module is used for carrying out binarization processing on the image subjected to stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area;
the image segmentation module is used for intercepting the whole printing character from the original input image according to the position coordinate information of the rectangular area, and then carrying out image segmentation to obtain a plurality of images which contain the single printing character of the sequencing information and uniformly reset the preset size;
and the character recognition module is used for inputting the image of the single printing character into a pre-trained artificial neural network printing character recognition model for detection, so that the printing character on the chip resistor is automatically recognized.
A third aspect of the present invention provides a terminal, which includes a memory, a processor, and a printed character recognition program stored in the memory and executable on the processor, wherein the printed character recognition program on the chip resistor, when executed by the processor, implements the steps of the method for recognizing printed characters on the chip resistor according to any one of the above embodiments.
A fourth aspect of the present invention provides a computer-readable storage medium, which stores a printed character recognition program on a chip resistor, wherein the printed character recognition program on the chip resistor, when executed by a processor, implements the steps of the method for recognizing printed characters on the chip resistor according to any one of the above embodiments.
According to the method for identifying the printed characters on the chip resistor, the effective area of an input image is extracted, then the position information of the rectangular area where the printed characters are located is obtained after the effective area is subjected to graying processing, contrast stretching processing and binarization processing in sequence, the image of the printed characters can be intercepted, then the image of a single printed character is obtained through segmentation, and finally the identification result of the whole printed character is obtained through identification of the single printed character, so that the complexity of the background of the image is reduced, the difficulty of character identification is reduced, and the accuracy and the efficiency of printed character identification are improved.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of a method for identifying printed characters on a chip resistor according to the present invention;
FIG. 2 is a flowchart of the substeps of step S14 of the method for printed character recognition on a chip resistor of FIG. 1;
FIG. 3 is a flowchart illustrating the substeps of step S15 of the method for identifying printed characters on a chip resistor of FIG. 1;
FIG. 4 is an output image of an input image after being processed by each processing step in the printed character recognition method on the chip resistor according to the present invention;
FIG. 5 is a schematic diagram of an output result recognized as an inverted arrangement by the method for recognizing printed characters on a chip resistor according to the present invention;
fig. 6 is a frame diagram of the printed character recognition device on the chip resistor according to the present invention.
[ detailed description ] embodiments
In order to make the objects, technical solutions and advantageous effects of the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and the detailed description. It should be understood that the detailed description and specific examples, while indicating the preferred embodiment of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In an embodiment of the present invention, a first aspect is to provide a method for recognizing printed characters on a chip resistor, which is used to recognize the printed characters identified by the chip resistor on a circuit board, and further determine whether the chip resistor is attached to a correct position, so as to improve the recognition accuracy and efficiency of the printed characters. It should be noted that the method can also be applied to recognition of printed characters on electronic components such as a chip capacitor, and a person skilled in the art can easily obtain a recognition method of printed characters on electronic components such as a chip capacitor by the method without creative labor. Therefore, the recognition of the printed characters on the electronic components such as the chip capacitor is also within the protection scope of the present invention.
As shown in fig. 1, the printed character recognition method on the chip resistor includes the following steps S11-S15.
Step S11: acquiring an input image obtained by shooting the chip resistor, adjusting the size of the input image to a preset size and extracting an image effective area.
In this step, the circuit board may be photographed by a high-resolution industrial camera to obtain an input image of the chip resistor (as shown in fig. 4-1). Meanwhile, when identifying a printed character, it is first necessary to extract the character from the original input image. Specifically, the processing of the input image comprises the following steps:
firstly, judging whether the width of the input image is larger than the height, and if not, rotating the input image by 90 degrees. It should be noted that, the size of the original image is generally not uniform, and some image widths are larger than the height, and some image widths are smaller than the height, so the size of the image needs to be unified, which is beneficial to the subsequent image processing. Thus, if an image has a width less than the height, the image is rotated 90 ° clockwise or counterclockwise, thereby converting an image originally having a height greater than the width into an image having a width greater than the height.
Next, the size of the input image having a width greater than the height is reset to a preset size. Specifically, the sizes of all the images are reset to 240 × 140. Where the two image size values are the average width and height of the patch resistance in the data set collected during the production assembly process.
And finally, intercepting the input image with the preset size according to the preset segmentation size to obtain an image effective area. Specifically, after the width and height dimensions are adjusted, if the image is directly processed, a large amount of work is added to the complex background, and the accuracy of detection is also affected. Therefore, it is necessary to extract a region of interest (ROI) from an image and then perform truncation, thereby reducing a processing area. By statistical analysis of the characteristics of the patch resistances in the data set, it was found that the printed characters were generally located at the center of the patch resistances, and thus the preset size of the ROI was set to 110 × 100, then the regions segmented from the image were [ (120-55): 120+55, (70-50): 70+50) ].
Step S12: and carrying out graying processing on the effective area of the image, and carrying out contrast stretching processing on the grayed image according to a preset stretching formula.
Specifically, after an effective region ROI of an input image is obtained, graying is performed on the effective region ROI, and then contrast stretching is performed on the image according to a preset stretching formula (1). In the formula f (x, y)grayIs the pixel value of the gray scale image, min is the minimum value of all pixel values in the image, max is the maximum value, f (x, y)stretchIs the stretched pixel value. The contrast stretching can enhance the image brightness and the color contrast, and is convenient for subsequent character extraction.
Figure BDA0003109169630000091
Step S13: and carrying out binarization processing on the image subjected to stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area.
Specifically, step S13 includes the following steps:
firstly, performing binarization processing on a stretched image, and resetting the pixel value to 255 if the pixel value in the image is greater than a preset binarization threshold value; and if the pixel value in the image is smaller than the preset binarization threshold value, resetting to 0. Specifically, in the present embodiment, the preset binarization threshold is set to 10. If the pixel value in the image is greater than 10, it is reset to 255, otherwise it is reset to 0. The printed character after the binarization process is surrounded by black, and the entire area around the character is approximately rectangular in shape.
Then, position coordinate information of a rectangular region surrounded by a black region of the print character is obtained based on a preset contour function. Specifically, after the position information is acquired, the print characters are again segmented from the ROI, and the image processing range is further narrowed. The binarization processing is a key step for finding a rectangular outline, and if the binarized image cannot obtain a proper connected region around the character, the function may find an incorrect position and only cut part of the character.
Therefore, to solve this problem, step S13 further includes the steps of:
first, after each binarization process, the outline area of the resulting region is calculated. Then, whether the outline area is larger than a preset area threshold (in this embodiment, the area threshold is 2500, which is obtained by statistics from a chip resistor data set) is judged, if the result is no, it indicates that fragmentation may occur in the area around the printed character, a complete connected area is not formed, and the function may not find the correct position of the character, then image erosion processing is performed on the image after binarization processing for a predetermined number of times until the black area around the printed character is connected. The image erosion operation is to obtain the local minimum pixel value in a certain area, and enlarge the minimum pixel value area, so as to increase the black area in the image. Through two image erosion processes, the black surrounding the printed character is connected, so that the outline function correctly finds the position of the character.
Step S14: and intercepting the whole printing character from the original input image according to the position coordinate information of the rectangular area, and then carrying out image segmentation to obtain a plurality of images which contain the single printing character of the sequencing information and uniformly reset the preset size.
Specifically, as shown in FIG. 2, step S14 includes the following steps S141-S146.
Step S141: and dividing the rectangular area according to the position coordinate information of the rectangular area to obtain a rectangular image containing the printing characters. Specifically, the characters are divided from the original image based on the position coordinate information of the printed characters, and then the sizes of the divided images are collectively reset so that the widths thereof are equal to 72 and the heights thereof are equal to 55, as shown in fig. 4-2, for facilitating the subsequent image processing work.
Step S142: graying and contrast stretching are carried out on the rectangular image, and then binarization processing is carried out according to another preset binarization threshold value to obtain a binarized rectangular image (as shown in figure 4-3), wherein if the pixel value of the image is greater than the other preset binarization threshold value, the pixel value is converted into 1, otherwise, the pixel value is converted into 0, and in the step, the other preset binarization threshold value is 80.
Step S143: calculating the sum of pixel values of each column of the binarized rectangular image; and uniformly resetting the sum of the pixel values of the foremost preset column number and the rearmost preset column number to be 0. In particular, because the characters are generally not too close to the leading and trailing edges of the image. If the sum of the pixel values is larger than 0, the interference white point exists in the first five columns and the last five columns of the image. For example, each column of pixel values and processed vector in fig. 4-3 is [0,0,0,0,0,0, 2,4,6,25,28,28,29,28,26,15,0,0,0,0,0,0,0, 0,23,26,27,29,29,29,15,12,12,12,13,18,29,29,28,28,26,24,23,24,26,28,28,29,29, 13,11,11,13,16,30,30,29,28,27,25,0,0,0,0,0,0,0 ].
Step S144: the binarized rectangular image is divided from the middle of the area where the pixel values are continuously 0, except for the area where the frontmost end and the rearmost end are continuously 0. Specifically, a portion of the vector having 0 s in succession is found and the image is divided from the middle of the portion, but this operation is not performed for a portion having 0 s in succession at the head end and the tail end, for example, in the vector of fig. 4 to 3, a character "1" can be divided from fig. 4 by dividing a portion having 0 s in succession between the pixel values "15" and "23".
Step S145: and calculating the length of the continuous non-0 area in the vector, and if the length is greater than a preset length threshold value, dividing the image from the middle section of the continuous non-0 area. The length of the consecutive non-0 portions in the vector is calculated and if the length is greater than 30, the image is segmented from the middle segment of the consecutive portions because the width of a character does not typically exceed the width of the consecutive 15 columns. According to this rule, fig. 4-3 can be divided into 3 parts as shown in fig. 4-4.
Step S146: an image containing a single number of single printed characters containing the sorting information is output.
Step S15: and inputting the image of the single printed character into a pre-trained artificial neural network printed character recognition model for detection, thereby automatically recognizing the printed character on the chip resistor.
In this step, after a single printed character is cut out of the original image, the character needs to be input into a model for recognition. The invention trains the model by adopting an artificial neural network. First a large training data set of diversity needs to be made. The training data set is very important for training neural network models, and the performance of model recognition generally grows linearly with the magnitude of the training data set. However, collecting a large number of patch resistance images presents certain difficulties. In addition, the segmented character image is binarized, the background is not complex, and the difficulty of identification is reduced. Thus, a lightweight network architecture model can be employed.
In this embodiment, the input size of the neural network is 55 × 55, and the training image needs to be converted to this size. The individual printed character images are non-uniform in size after segmentation (as shown in fig. 4-4), so filling the image with black results in an image size that satisfies 55 x 55. Fig. 4-5 show some examples of single character images having a post-fill size of 55 x 55.
Specifically, as shown in FIG. 3, step S15 includes the following steps S151-S156.
Step S151: establishing a training set containing 11 types of images; wherein, 11 types include 0, 1, 2, 8, 9 and "null", which means that the image has no characters but some interference points are distributed. Specifically, 11 × 600 collected images may be used as a training set, with "11" representing characters 0, 1, 2, 0. Where the "null" image has no characters but is distributed with dots (interference dots) that are not located at the leading or trailing edge of the image and are therefore also separately segmented, as shown in the rightmost images in figures 4-5, so these images should also be collected as separate categories like other characters. Each class has 600 pictures. Of 6600 images, 4610 were used to train the network, the rest to test the output model.
Step S152: and building and training a printed character recognition model based on an artificial neural network. Specifically, the neural network has a structure as shown in table 1, with an input size of 55 × 55 and an output size of 11. The network has three convolutional layers, three max pooling layers, and two complete connection layers. The convolution output is calculated using the function ReLU (equation 2) and the final output is calculated using Softmax (equation 3). When training the model, the number of batches is set to 10 (i.e. 10 images are input in each round), and the total number of iterations is 2000. The final test precision was 99.7%.
TABLE 1 Artificial neural network model Structure
Figure BDA0003109169630000131
f(zi)=max(0,zi)(2)
Figure BDA0003109169630000141
The image of the single printing character is input into the trained printing character recognition model, and the recognition result of the printing character on the chip resistor is obtained.
Specifically, after a trained printed character recognition model is obtained, an image containing a single printed character is input into the model for recognition. However, as shown in fig. 5, some original images are inverted, and a single character segmented by the images is also inverted, and when we train the neural network model, the inverted character and the normal character of the same number are collected as one class. Therefore, the final model can only recognize the character, and cannot recognize whether the character is inverted. Therefore, as shown in fig. 3, step S15 further includes the steps of:
step S153: and sequentially inputting the images containing the single printing characters into a printing character recognition model according to the sequencing information for recognition, and outputting a character prediction result.
Step S154: judging whether the character prediction result contains at least one character in the characters 1, 2, 3, 4 and 7, and if not, outputting the printed characters according to a normal sequence; if yes, judging whether the first character of the character prediction result is 0. Where, for example, the character "4" is reversed in fig. 5, the result of the model predicting it is the same as "4" in the normal state. Therefore, when characters such as "1", "2", "3", "4", "7" are output, it is also necessary to determine whether the printed characters are reversed. If one of the printed characters is inverted, the predicted final data for the entire original image is inverted. If the characters are "0", "1", "2", "3", "4", "7", etc., the numbers on the original image that is finally output may be in reverse order. For example, the image prediction result in fig. 5 is "451", and the actual result is "154".
Step S155: and when the first character of the character prediction result is judged to be 0, outputting the printed characters according to the reverse order, and otherwise, calculating the sum of the pixel values of each column. It should be noted that the first digit in the resistor flag is not necessarily 0, and thus, if the word "0" is in the first bit, it must indicate that the 0 originally in the bit is inverted and shifted to the first bit.
Step S156: judging whether the variation trend of the sum of the pixel values is reduced first or increased, if so, outputting the printing characters according to a normal sequence; if not, outputting the printed characters according to the reverse order.
Specifically, if the prediction results include "1", "2", "3", "4" and "7", the pixel values of each column of the image containing these characters are summed, and the variation trend of the sums is checked, and when the variation trend is increased from small to large, it is determined that the characters are normal, and the output number remains unchanged. Otherwise, the characters are reversed and the predicted numbers should be output in reverse order.
In summary, according to the method for identifying the printed characters on the chip resistor, firstly, the effective area of the input image is extracted, then, the gray processing, the contrast stretching processing and the binarization processing are sequentially performed, so that the position information of the rectangular area where the printed characters are located is obtained, the image of the printed characters can be divided, the image of a single printed character is obtained, and whether the characters are reversed or not is judged according to the variation trend of each row of pixel sum of the image of the single printed character, so that whether the whole printed character is output in a normal sequence or in a reverse sequence is estimated. The method combines the traditional image segmentation and the modern artificial neural network model training and recognition, and finally obtains the recognition result of the whole printed character by recognizing the single printed character, thereby reducing the complexity of the image background, simultaneously reducing the difficulty of character recognition and improving the accuracy and efficiency of the printed character recognition.
The second aspect of the present invention provides a device 100 for recognizing printed characters on a chip resistor, which is used for recognizing printed characters identified by the chip resistor on a circuit board, and further determining whether the chip resistor is attached to a correct position, so as to improve the recognition accuracy and efficiency of the printed characters. It should be noted that the implementation principle and the implementation mode of the printed character recognition apparatus 100 on the chip resistor are consistent with the above-mentioned printed character recognition method on the chip resistor, and therefore, the following description is omitted.
As shown in fig. 6, the printed character recognition apparatus 100 on a chip resistor includes:
an image acquisition module 10, configured to acquire an input image obtained by shooting the chip resistor, adjust the size of the input image to a preset size, and extract an image effective area;
the image processing module 20 is configured to perform graying processing on the image effective area, and perform contrast stretching processing on the grayed image according to a preset stretching formula;
the position acquisition module 30 is configured to perform binarization processing on the image subjected to the stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular region surrounded by a black region of the printed character;
the image segmentation module 40 is used for intercepting the whole printed character from the original input image according to the position coordinate information of the rectangular area, and then performing image segmentation to obtain a plurality of images which contain the single printed character of the sequencing information and uniformly reset the preset size;
and the character recognition module 50 is used for inputting the image of the single printed character into a pre-trained printed character recognition model for detection, so that the printed character on the chip resistor is automatically recognized.
In a further aspect, the present invention provides a terminal (not shown in the drawings), where the terminal includes a memory, a processor, and a printed character recognition program stored in the memory and executable on the processor, and the printed character recognition program on the chip resistor is executed by the processor to implement the steps of the method for recognizing printed characters on the chip resistor according to any one of the above embodiments.
The present invention further provides a computer-readable storage medium (not shown in the drawings), in which a printed character recognition program on a chip resistor is stored, and when being executed by a processor, the printed character recognition program on the chip resistor realizes the steps of the printed character recognition method on the chip resistor according to any one of the above embodiments.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system or apparatus/terminal device and method can be implemented in other ways. For example, the above-described system or apparatus/terminal device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The invention is not limited solely to that described in the specification and embodiments, and additional advantages and modifications will readily occur to those skilled in the art, so that the invention is not limited to the specific details, representative apparatus, and illustrative examples shown and described herein, without departing from the spirit and scope of the general concept as defined by the appended claims and their equivalents.

Claims (10)

1. A method for recognizing printed characters on a chip resistor is characterized by comprising the following steps:
acquiring an input image obtained by shooting a chip resistor, adjusting the size of the input image to a preset size and extracting an image effective area;
graying the effective area of the image, and performing contrast stretching processing on the grayed image according to a preset stretching formula;
carrying out binarization processing on the image subjected to stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area;
intercepting the whole printed character from an original input image according to the position coordinate information of the rectangular area, and then carrying out image segmentation to obtain a plurality of images of single printed characters and uniformly resetting the size of a preset size;
and inputting the image of the single printed character into a pre-trained artificial neural network recognition model for detection, thereby automatically recognizing the printed character on the chip resistor.
2. The method for recognizing printed characters on a chip resistor according to claim 1, wherein the step of resizing the input image to a preset size and extracting an image effective area comprises:
judging whether the width of the input image is larger than the height, and if not, rotating the input image by 90 degrees;
resetting the size of the input image with the width larger than the height to a preset size;
and intercepting the input image with a preset size according to a preset size to obtain an image effective area.
3. The method for recognizing the printed characters on the chip resistor as claimed in claim 1, wherein the step of binarizing the image after the stretching process according to a preset binarization threshold to obtain the position coordinate information of the rectangular area of the printed characters surrounded by the black area comprises:
carrying out binarization processing on the stretched image, and resetting to 255 if the pixel value in the image is greater than a preset binarization threshold value; if the pixel value in the image is smaller than a preset binarization threshold value, resetting to 0;
and obtaining the position coordinate information of a rectangular area of the printing character, which is surrounded by the black area, according to a preset contour function.
4. The method for recognizing printed characters on a chip resistor according to claim 3, further comprising the steps of:
after each binarization processing, calculating the outline area of the obtained region;
and judging whether the area of the outline is larger than a preset area threshold value or not, and if not, carrying out image corrosion processing on the image subjected to binarization processing for a preset number of times until black areas around the printed characters are communicated.
5. The method for recognizing the printed character on the chip resistor as claimed in claim 1, wherein the step of intercepting the entire printed character from the original input image according to the position coordinate information of the rectangular area, and then performing image segmentation to obtain a plurality of individual printed characters and uniformly reset the image with a preset size comprises the steps of:
intercepting the rectangular area according to the position coordinate information of the rectangular area to obtain a rectangular image containing the printing characters;
graying and contrast stretching are carried out on the rectangular image, and then binarization processing is carried out according to another preset binarization threshold value to obtain a binarized rectangular image; if the pixel value of the image is larger than another preset binarization threshold value, converting the pixel value into 1, otherwise, converting into 0;
calculating the sum of pixel values of each column of the binarized rectangular image; the sum of the pixel values of the foremost preset column number and the rearmost preset column number is uniformly reset to be 0;
dividing the binarized rectangular image from the middle of the pixel value and the continuous 0 area except the continuous 0 area of the frontmost end and the rearmost end;
calculating the length of a continuous non-0 area in the vector, and if the length is greater than a preset length threshold value, segmenting an image from the middle section of the continuous non-0 area;
an image containing a single number of single printed characters containing the sorting information is output.
6. The method for recognizing the printed characters on the chip resistor as claimed in claim 1, wherein the step of inputting the image of the single printed character into a pre-trained artificial neural network printed character recognition model for detection so as to automatically recognize the printed characters on the chip resistor comprises the steps of:
establishing a training set containing 11 types of images; wherein, the 11 classes comprise 0, 1, 2, 8, 9 and "null", which means that the image has no characters but some interference points are distributed;
building and training a printing character recognition model based on an artificial neural network;
and inputting the image of the single printing character into the trained printing character recognition model to obtain the recognition result of the printing character on the chip resistor.
7. The method for recognizing printed characters on a chip resistor according to claim 6, wherein the step of inputting the image of the single printed character into a trained printed character recognition model to obtain the recognition result of the printed character on the chip resistor comprises:
sequentially inputting images containing single printing characters into the printing character recognition model according to the sequencing information for recognition, and outputting character prediction results;
judging whether the character prediction result contains at least one character in the characters 1, 2, 3, 4 and 7, and if not, outputting the printed characters according to a normal sequence; if so, judging whether the first character of the character prediction result is 0 or not;
when the first character of the character prediction result is judged to be 0, outputting the printing characters according to a reverse order, otherwise, solving the sum of the pixel values of each column;
judging whether the variation trend of the sum of the pixel values is reduced firstly and then increased, if so, outputting the printing characters according to a normal sequence; if not, outputting the printed characters according to the reverse order.
8. A device for recognizing printed characters on a chip resistor, comprising:
the image acquisition module is used for acquiring an input image obtained by shooting the chip resistor, adjusting the size of the input image to a preset size and extracting an image effective area;
the image processing module is used for carrying out graying processing on the image effective area and carrying out contrast stretching processing on the grayed image according to a preset stretching formula;
the position acquisition module is used for carrying out binarization processing on the image subjected to stretching processing according to a preset binarization threshold value to obtain position coordinate information of a rectangular area of the printed character surrounded by a black area;
the image segmentation module is used for intercepting the whole printed character from the original input image according to the position coordinate information of the rectangular area, and then carrying out image segmentation to obtain a plurality of images which contain the single printed character of the sequencing information and uniformly reset the preset size;
and the character recognition module is used for inputting the image of the single printing character into a pre-trained artificial neural network printing character recognition model for detection, so that the printing character on the chip resistor is automatically recognized.
9. A terminal, characterized in that the terminal comprises a memory, a processor and a printed character recognition program stored in the memory and executable on the processor, the printed character recognition program on the chip resistor being executed by the processor to implement the steps of the method for recognizing printed characters on the chip resistor according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a printed character recognition program on a chip resistor, and the printed character recognition program on the chip resistor realizes the steps of the method for recognizing printed characters on the chip resistor according to any one of claims 1 to 7 when being executed by a processor.
CN202110644682.XA 2021-06-09 2021-06-09 Printed character recognition method and device on chip resistor, terminal and medium Withdrawn CN113283441A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110644682.XA CN113283441A (en) 2021-06-09 2021-06-09 Printed character recognition method and device on chip resistor, terminal and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110644682.XA CN113283441A (en) 2021-06-09 2021-06-09 Printed character recognition method and device on chip resistor, terminal and medium

Publications (1)

Publication Number Publication Date
CN113283441A true CN113283441A (en) 2021-08-20

Family

ID=77284042

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110644682.XA Withdrawn CN113283441A (en) 2021-06-09 2021-06-09 Printed character recognition method and device on chip resistor, terminal and medium

Country Status (1)

Country Link
CN (1) CN113283441A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114792419A (en) * 2022-03-11 2022-07-26 上海钧正网络科技有限公司 Method for determining device identification of shared device and server
CN117095423A (en) * 2023-10-20 2023-11-21 上海银行股份有限公司 Bank bill character recognition method and device
CN117292381A (en) * 2023-11-24 2023-12-26 杭州速腾电路科技有限公司 Method for reading serial number of printed circuit board

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114792419A (en) * 2022-03-11 2022-07-26 上海钧正网络科技有限公司 Method for determining device identification of shared device and server
CN117095423A (en) * 2023-10-20 2023-11-21 上海银行股份有限公司 Bank bill character recognition method and device
CN117095423B (en) * 2023-10-20 2024-01-05 上海银行股份有限公司 Bank bill character recognition method and device
CN117292381A (en) * 2023-11-24 2023-12-26 杭州速腾电路科技有限公司 Method for reading serial number of printed circuit board
CN117292381B (en) * 2023-11-24 2024-02-27 杭州速腾电路科技有限公司 Method for reading serial number of printed circuit board

Similar Documents

Publication Publication Date Title
CN110070536B (en) Deep learning-based PCB component detection method
CN110060237B (en) Fault detection method, device, equipment and system
CN110060238B (en) PCB label printing quality detection method based on deep learning
CN113283441A (en) Printed character recognition method and device on chip resistor, terminal and medium
US10817741B2 (en) Word segmentation system, method and device
CN109740606B (en) Image identification method and device
CN107944450B (en) License plate recognition method and device
CN106980856B (en) Formula identification method and system and symbolic reasoning calculation method and system
CN109859164B (en) Method for visual inspection of PCBA (printed circuit board assembly) through rapid convolutional neural network
CN111680690B (en) Character recognition method and device
CN109740617A (en) A kind of image detecting method and device
CN113592923B (en) Batch image registration method based on depth local feature matching
CN112036292A (en) Character recognition method and device based on neural network and readable storage medium
CN113221869B (en) Medical invoice structured information extraction method, device equipment and storage medium
CN109886978B (en) End-to-end alarm information identification method based on deep learning
CN109190625B (en) Large-angle perspective deformation container number identification method
CN108108753A (en) A kind of recognition methods of check box selection state based on support vector machines and device
CN115775246A (en) Method for detecting defects of PCB (printed circuit board) components
CN110738216A (en) Medicine identification method based on improved SURF algorithm
CN108615401B (en) Deep learning-based indoor non-uniform light parking space condition identification method
CN110659637A (en) Electric energy meter number and label automatic identification method combining deep neural network and SIFT features
CN113780492A (en) Two-dimensional code binarization method, device and equipment and readable storage medium
CN111882547A (en) PCB missing part detection method based on neural network
CN115719326A (en) PCB defect detection method and device
CN108268868B (en) Method and device for acquiring inclination value of identity card image, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20210820

WW01 Invention patent application withdrawn after publication