CN116129435A - Character defect detection method, device, equipment and storage medium - Google Patents

Character defect detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN116129435A
CN116129435A CN202310395874.0A CN202310395874A CN116129435A CN 116129435 A CN116129435 A CN 116129435A CN 202310395874 A CN202310395874 A CN 202310395874A CN 116129435 A CN116129435 A CN 116129435A
Authority
CN
China
Prior art keywords
character
detected
image
template
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.)
Granted
Application number
CN202310395874.0A
Other languages
Chinese (zh)
Other versions
CN116129435B (en
Inventor
姜龙
吕建涛
刘营军
宋贺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goertek Inc
Original Assignee
Goertek Inc
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 Goertek Inc filed Critical Goertek Inc
Priority to CN202310395874.0A priority Critical patent/CN116129435B/en
Publication of CN116129435A publication Critical patent/CN116129435A/en
Application granted granted Critical
Publication of CN116129435B publication Critical patent/CN116129435B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/12Detection or correction of errors, e.g. by rescanning the pattern
    • 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/16Image preprocessing
    • G06V30/162Quantising the image signal
    • 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/19Recognition using electronic means
    • G06V30/19007Matching; Proximity measures
    • G06V30/19013Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

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

The invention discloses a character defect detection method, a device, equipment and a storage medium, which comprise the steps of obtaining an image to be detected containing characters to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of a template character image; detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image; and comparing character features of the characters to be detected with features of corresponding template characters in the template character image respectively to obtain defect detection results of the characters to be detected. The accuracy and the speed of positioning each character to be detected in the format image to be detected are improved, the automatic detection of character defects is realized, and the accuracy of detecting the defective characters is improved while the detection efficiency is improved.

Description

Character defect detection method, device, equipment and storage medium
Technical Field
The present invention relates to the field of defect detection technologies, and in particular, to a method, an apparatus, a device, and a storage medium for detecting a character defect.
Background
With the rapid development of the consumer electronics industry, TWS headphones, vr\ar wearable devices, gaming equipment, etc. are growing in popularity. The electronic product or the outer package of the product contains marks such as characters and patterns; the product itself is typically laser engraved characters and the outer packaging box is typically printed characters. Limited by the processing technology level and the environmental conditions, the character may have defects, and the current character defect detection generally adopts a manual visual inspection mode, but the manual visual inspection has low efficiency and high false detection rate, so that the accuracy of the character defect detection is low.
Disclosure of Invention
The invention mainly aims to provide a character defect detection method, a device, equipment and a storage medium, and aims to solve the technical problem of low accuracy of character defect detection in the prior art.
In order to achieve the above object, the present invention provides a character defect detection method comprising the steps of:
acquiring an image to be detected containing characters to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character;
detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image;
And comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected.
Optionally, before the obtaining the to-be-detected image including the to-be-detected character and converting the to-be-detected image into the to-be-detected image with the format consistent with the format of the template character image, the method further includes:
performing binarization processing on the template character image to obtain a binarized image;
performing expansion processing on each character in the binarized image, and determining a preset detection area corresponding to each character according to the characters after the expansion processing.
Optionally, the expanding processing is performed on each character in the binarized image, and a preset detection area corresponding to each character is determined according to the characters after the expanding processing, including:
performing expansion processing on each character in the binarized image, wherein each part of the characters is communicated after the expansion processing;
and determining the minimum circumscribed rectangle corresponding to each character after the expansion processing, and taking the minimum circumscribed rectangle corresponding to each character as a preset detection area.
Optionally, determining the minimum bounding rectangle corresponding to each character after the expansion processing, and taking the minimum bounding rectangle corresponding to each character as a preset detection area includes:
Determining the minimum circumscribed rectangle of each character after expansion treatment;
and adjusting the corresponding minimum circumscribed rectangle according to the character information of each template character in the template character image, and taking the adjusted minimum circumscribed rectangle as a preset detection area.
Optionally, the character features include a character skeleton length and a character area;
comparing the character features of the characters to be detected with the features of the corresponding template characters in the template character image to obtain defect detection results of the characters to be detected, wherein the defect detection results comprise:
comparing the character skeleton length and the character area of each character to be detected with the template character skeleton length and the template character area of the corresponding template character in the template character image;
and determining a skeleton length error and an area error of each character to be detected according to the comparison result, and determining a defect detection result of each character to be detected according to the skeleton length error and the area error.
Optionally, the character features further include a number of character holes and a number of connected domains;
comparing the character features of the characters to be detected with the features of the corresponding template characters in the template character image to obtain defect detection results of the characters to be detected, and further comprising:
Comparing the number of the character holes and the number of the connected domains of each character to be detected with the number of the template character holes and the number of the connected domains of the template characters corresponding to the template characters in the template character image;
and determining defect detection results of the characters to be detected according to the comparison results.
Optionally, before the obtaining the to-be-detected image including the to-be-detected character and converting the to-be-detected image into the to-be-detected image with the format consistent with the format of the template character image, the method further includes:
controlling a first light source and a second light source to illuminate a product to be detected, wherein the first light source and the second light source are arranged above the product to be detected and symmetrically arranged on two sides of the product to be detected;
and controlling a target camera to photograph the illuminated product to be detected to obtain an image to be detected containing the character to be detected, wherein the target camera is arranged right above the product to be detected.
In addition, in order to achieve the above object, the present invention also proposes a character defect detecting apparatus, the apparatus comprising:
the acquisition module is used for acquiring an image to be detected containing characters to be detected and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character image;
The detection module is used for detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, and each preset detection area is determined based on each template character after expansion processing in the template character image;
and the comparison module is used for comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image respectively to obtain a defect detection result of each character to be detected.
In addition, in order to achieve the above object, the present invention also proposes a character defect detecting apparatus comprising: a memory, a processor, and a character defect detection program stored on the memory and executable on the processor, the character defect detection program configured to implement the steps of the character defect detection method as described above.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having stored thereon a character defect detection program which, when executed by a processor, implements the steps of the character defect detection method as described above.
The embodiment of the invention provides a character defect detection method, which comprises the steps of obtaining an image to be detected containing characters to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of a template character image; detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image; and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected. According to the embodiment of the invention, each preset detection area is determined based on each template character after expansion processing in the template character image, so that the accuracy and the speed of positioning each character to be detected in the format to-be-detected image are improved, character features of the character to be detected in each preset detection area are compared with the features of the corresponding template character in the template character image, a defect detection result of each character to be detected is obtained, automatic detection of character defects is realized, and the accuracy of detecting the defect characters is improved while the detection efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of a character defect detection apparatus of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of an embodiment of a character defect detection method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a character defect detection method according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a character defect detection method according to another embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a comparison between a character skeleton OK and a character skeleton NG according to an embodiment of a character defect detecting method according to the present invention;
FIG. 6 is a diagram showing a comparison between a character area OK and a character area NG according to an embodiment of a character defect detecting method according to the present invention;
FIG. 7 is a diagram showing a comparison between the number of holes OK and the number of holes NG in an embodiment of a method for detecting defects of characters according to the present invention;
FIG. 8 is a diagram showing a comparison between the number of connected domains OK and the number of connected domains NG in an embodiment of a character defect detecting method according to an embodiment of the present invention;
FIG. 9 is a flowchart of another embodiment of a character defect detection method according to an embodiment of the present invention;
FIG. 10 is a schematic diagram illustrating the setting positions of a first light source, a second light source and a target camera in an embodiment of a character defect detection method according to an embodiment of the present invention;
Fig. 11 is a block diagram illustrating an embodiment of a character defect detecting apparatus according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a character defect detection apparatus of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the character defect detecting apparatus may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (WI-FI) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the structure shown in fig. 1 does not constitute a limitation of the character defect detection apparatus, and may include more or fewer components than shown, or may combine certain components, or may have a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a character defect detection program may be included in the memory 1005 as one type of storage medium.
In the character defect detecting apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001, the memory 1005 may be provided in a character defect detecting apparatus that calls a character defect detecting program stored in the memory 1005 through the processor 1001 and performs the character defect detecting method provided by the embodiment of the present invention.
Referring to fig. 2, fig. 2 shows a flow chart of a character defect detection method according to an embodiment of the present application, where the character defect detection method includes the following steps:
step S10: and acquiring an image to be detected containing the character to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character.
It should be noted that, the execution body of the embodiment may be a computing service device having functions of data processing, network communication and program running, such as a tablet computer, a personal computer, an upper computer, or an electronic device, a character defect detection device, or the like, which can implement the above functions. The present embodiment and the following embodiments will be exemplified by a character defect detecting apparatus.
In the embodiment of the application, a to-be-detected image containing to-be-detected characters is obtained, the to-be-detected image is converted into a format to-be-detected image consistent with the format of a template character image, to-be-detected characters in each preset detection area in the format to-be-detected image are detected, character characteristics of each to-be-detected character are obtained, each preset detection area is determined based on each template character after expansion processing in the template character image, and the character characteristics of each to-be-detected character are compared with the characteristics of the corresponding template character, so that a defect detection result of the to-be-detected character is obtained.
It can be understood that the image to be detected may be an image corresponding to a product to be detected, where the image to be detected includes characters to be detected, and the characters to be detected may be characters that need to be detected by a defect, for example, the product to be detected includes, but is not limited to, VR equipment, AR equipment, headphones, a headphone external packaging box, a game handle external packaging box, or the like; the template character image may be an image of a product to be detected containing non-defective characters, which may also be referred to as template characters; the format of the image to be detected may be an image to be detected that is consistent with the format of the template character image.
As an implementation manner, the present embodiment may use an image to be detected without a character defect as a template character image.
As another implementation manner, the format of the template character image and the format of the image to be detected may be a binary image.
Step S20: detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image.
It can be understood that each character to be detected in the format image to be detected is in a corresponding preset detection area, and the character to be detected in each preset detection area is detected to obtain character characteristics of each character to be detected; character features may be features that are capable of characterizing character attributes; in one example, the corresponding preset detection area may be determined according to the image position of each template character in the template character image, and character attributes include, but are not limited to, character missing, character redundancy, and the like.
As another implementation manner, the character feature of each character to be detected can be obtained by detecting the character to be detected in each preset detection area in the format image to be detected through a preset character detection algorithm, wherein the preset character detection algorithm comprises, but is not limited to, a Skeleton algorithm, a Threshold algorithm, a Halcon algorithm and the like.
As another implementation manner, the determining manner of the preset detection area may be: performing expansion processing on template characters in the template character image, determining areas containing the template characters after the expansion processing, taking the areas containing the template characters after the expansion processing as detection areas corresponding to the template characters, taking the detection areas corresponding to the template characters as preset detection areas, and fixing the preset detection areas; each character to be detected in the format image to be detected falls into a corresponding preset detection area.
It should be noted that, at present, a specific target object in an image may be detected by a target detection algorithm, but for character detection, one character may be formed by a plurality of mutually separated parts (for example, characters: a chinese character, a machine, etc.), when the target detection algorithm detects, a plurality of detection areas may appear in one character, and the overall defect of the character cannot be detected.
Step S30: and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected.
As another implementation manner, comparing the character features of the to-be-detected characters with the features of the corresponding template characters in the template character image, and obtaining the defect detection result of the to-be-detected characters may be implemented in the following manner: determining the characteristics of each template character in the template character image, storing the corresponding characteristics of each template character to obtain a characteristic registry, and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template characters in the characteristic registry to obtain a defect detection result of each character to be detected.
In one example, such as: the characters needing to be subjected to defect detection are characters 'earphone ABC' on the packaging box, the character image of the template contains the characters to be detected without character defects, expansion processing is carried out on the characters 'earphone ABC' in the character image of the template, the areas containing the characters after expansion processing are determined to be preset detection areas corresponding to the characters, and the preset detection areas corresponding to the characters are fixed; when the characters are subjected to defect detection, an image to be detected containing the characters is obtained, the format of the image to be detected is converted into the format consistent with that of a template character image, characters 'earphone ABC' in each preset detection area are detected, the characteristics of each character to be detected are obtained, the characteristics of each character to be detected are compared with the characteristics of the corresponding template character in the template character image, and defect detection results of each character to be detected are obtained, wherein the defect detection results can be that the characters 'ears' are missing, the characters 'C' are missing and the like.
The embodiment of the invention provides a character defect detection method, which comprises the steps of obtaining an image to be detected containing characters to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of a template character image; detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image; and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected. According to the embodiment of the invention, each preset detection area is determined based on each template character after expansion processing in the template character image, so that the accuracy and the speed of positioning each character to be detected in the format to-be-detected image are improved, character features of the character to be detected in each preset detection area are compared with the features of the corresponding template character in the template character image, a defect detection result of each character to be detected is obtained, automatic detection of character defects is realized, and the accuracy of detecting the defect characters is improved while the detection efficiency is improved.
Referring to fig. 3, fig. 3 shows a flowchart of a method for detecting a character defect according to another embodiment of the present application, in this embodiment, before step S10, the method further includes:
step S01: and carrying out binarization processing on the template character image to obtain a binarized image.
In the embodiment of the application, binarization processing is performed on the template character image to obtain a binarized image, expansion processing is performed on each character in the binarized image, and a preset detection area corresponding to each character of the characters subjected to the expansion processing in the binarized image is obtained.
It is understood that the binarized image may be a character image obtained by binarizing a template character image.
Step S02: performing expansion processing on each character in the binarized image, and determining a preset detection area corresponding to each character according to the characters after the expansion processing.
As an implementation manner, determining the preset detection area corresponding to each character according to the character after the expansion processing in this embodiment may be implemented as follows: and determining the minimum external geometric figure of each character after expansion processing, and taking each minimum external geometric figure as a preset detection area corresponding to each character.
In an alternative embodiment, since the character may be composed of a plurality of mutually separated parts, if the character in the binarized image is directly detected to determine the preset detection area corresponding to each character, there may be a case that one character corresponds to a plurality of preset detection areas, if the character is detected according to the preset detection area determined in the above manner, the feature of each part in the character is detected, and the defect detection result finally obtained is the defect detection result of each part composing the character, on the one hand, the defect detection result obtained cannot reflect the defect condition of the whole character, on the other hand, the defect detection efficiency is reduced due to the increase of the detection areas, in order to solve the above problem, the step S02 includes: performing expansion processing on each character in the binarized image, wherein each part of the characters is communicated after the expansion processing; and determining the minimum circumscribed rectangle corresponding to each character after the expansion processing, and taking the minimum circumscribed rectangle corresponding to each character as a preset detection area.
It is to be understood that the respective portions of the character after the expansion processing are mutually communicated may be that the portions of the original character separated from each other are communicated in the character after the expansion processing as compared with the original character.
As another implementation manner, the determining the minimum bounding rectangle corresponding to each character after the expansion processing and using the minimum bounding rectangle corresponding to each character as the preset detection area in this embodiment may be implemented as follows: and performing target detection on each character after expansion processing to determine the minimum circumscribed rectangle corresponding to each character after expansion processing, and taking each minimum circumscribed rectangle as a preset detection area corresponding to each character.
As another implementation manner, since the types of characters required to be subjected to defect detection may be different in different detection scenarios, and the degrees of expansion processing required to be performed for different types of characters are different, in order to adapt the degrees of expansion of the characters to the types of characters, the expansion coefficient may be determined according to the types of characters to be detected, the expansion processing may be performed for each character in the binarized image according to the expansion coefficient, specifically, the expansion coefficient may be determined according to the types of characters, the expansion processing may be performed for each character according to the expansion coefficient of each character, the types of characters with a large ratio may be determined as the types of characters to be detected, the expansion coefficient may be determined according to the types of characters, and the expansion coefficient may be determined in other manners.
It is understood that the coefficient of expansion may be a value that characterizes the degree of expansion of a character, with a greater coefficient of expansion indicating a greater degree of expansion, e.g., the coefficient of expansion may be 1, 2, 3, 5, or other value.
It should be noted that the character types include Chinese characters, numbers, english, korean, etc.; assuming that the character type is Chinese characters, since most Chinese characters are composed of mutually separated different parts, if all parts of the Chinese characters are mutually communicated after expansion treatment, the expansion degree of the characters is larger; if the character type is English or digital, the expansion degree of the character is small because most English or digital is a whole; if the same degree of expansion processing is performed on the characters of different types, the parts of the Chinese character after the expansion processing may still be separated from each other, or the difference between the English or the number and the original character after the expansion processing is larger.
As another implementation manner, the above expansion processing manner includes, but is not limited to, horizontal expansion processing, vertical expansion processing and omnidirectional expansion processing, and since the character structures of the characters requiring defect detection are different, if the characters having different character structures are expanded by using the same expansion processing manner, the parts of the kanji after expansion processing may still be separated from each other, or the difference between the english or the number and the original character after expansion processing is large, in order to solve the above problem, the corresponding expansion processing manner may be determined according to the character structures, and the expansion processing may be performed on the characters according to the determined expansion processing manner.
In one example, if the character structure of the character to be detected is a left-right structure, the expansion processing mode can be determined to be horizontal expansion processing, for example, the character to be detected can be a machine, an eye or the like; if the character structure of the character to be detected is an up-down structure, the expansion processing mode can be determined to be vertical expansion processing, for example, the character to be detected can be 'quantity', 'symbol', and the like; if the character structure of the character to be detected is an up-down structure or a left-right structure, but the elements in the constituent parts are separated from each other, it can be determined that the expansion processing mode is an omnidirectional expansion processing, for example, the character to be detected may be "chinese", "freight" or the like.
In an optional embodiment, in order to match each preset detection area with a corresponding character in size, the determining a minimum bounding rectangle corresponding to each character after the expansion processing, and taking the minimum bounding rectangle corresponding to each character as the preset detection area includes: determining the minimum circumscribed rectangle of each character after expansion treatment; and adjusting the corresponding minimum circumscribed rectangle according to the character information of each template character in the template character image, and taking the adjusted minimum circumscribed rectangle as a preset detection area.
It can be understood that the mode of adjusting the minimum circumscribed rectangle can be automatic adjustment or manual adjustment, and the embodiment is not limited herein; the character information may be pixel information of a character.
As another implementation manner, in order to make the minimum circumscribed rectangle and the corresponding template character match in size, a plurality of edge pixel points of the template character can be determined according to pixel information of the template character, a target edge pixel point is selected from the plurality of edge pixel points, the number of pixel points between corresponding sides of the minimum circumscribed rectangle of the target edge pixel point is determined, the size of the minimum circumscribed rectangle is adjusted according to the number of pixel points, the minimum circumscribed rectangle after the size is adjusted is taken as a preset detection area, specifically, if the minimum circumscribed rectangle is separated from the template character, the side is translated towards the direction close to the template character when the number of pixel points is larger than the preset number of pixel points, so that the number of pixel points is equal to the preset number of pixel points; if the edge of the minimum circumscribed rectangle intersects the template character, the corresponding edge is translated to a direction away from the template character, so that the number of the pixels is equal to the number of the preset pixels.
The embodiment of the application provides a character defect detection method, which is used for obtaining a binarized image by performing binarization processing on a template character image; performing expansion processing on each character in the binarized image, and determining a preset detection area corresponding to each character according to the characters after the expansion processing. By performing expansion processing on each character, each part of the characters is communicated with each other, and a preset detection area is determined by the characters communicated with each other, so that one character corresponds to one detection area, and the detection efficiency of character defects is improved.
Referring to fig. 4, fig. 4 shows a flowchart of a character defect detection method according to another embodiment of the present application, in this embodiment, the step S30 includes:
step S301: and comparing the character skeleton length and the character area of each character to be detected with the template character skeleton length and the template character area of the corresponding template character in the template character image.
It is understood that the character skeleton length may be a pixel length of the character skeleton; the character area may be the area of the character corresponding to the smallest bounding rectangle.
Step S302: and determining a skeleton length error and an area error of each character to be detected according to the comparison result, and determining a defect detection result of each character to be detected according to the skeleton length error and the area error.
As an implementation manner, the embodiment may obtain a skeleton length error by subtracting the template character skeleton length from the character skeleton length, and obtain an area error by subtracting the template character area from the character area; if the skeleton length error is larger than the preset skeleton length error, determining that the character has a missing defect; if the area error is larger than the preset area error, determining that the character has a missing defect.
In one example, referring to fig. 5 and 6 for example, fig. 5 is a schematic diagram of a character skeleton OK versus a character skeleton NG; FIG. 6 is a diagram showing the comparison of the character area OK and the character area NG; assuming that the character to be detected is a schematic diagram corresponding to a character Skeleton OK, extracting Skeleton information of the character through a Skeleton algorithm, calculating a character Skeleton length by taking pixels as a unit, determining that the character to be detected has no defect if the Skeleton length error corresponding to the character Skeleton length is smaller than a preset Skeleton length error, assuming that the character to be detected is a schematic diagram corresponding to a character Skeleton NG, extracting the Skeleton information of the character through the Skeleton algorithm, calculating a character Skeleton length by taking pixels as a unit, and determining that the character to be detected has a defect if the Skeleton length error corresponding to the character Skeleton length is larger than the preset Skeleton length error; the area of the character can be calculated through binarization Threshold, and the area comparison is similar to the framework length comparison and is not described herein.
In an optional embodiment, in order to improve the efficiency of character defect detection, the character features further include the number of character holes and the number of connected domains; comparing the character features of the characters to be detected with the features of the corresponding template characters in the template character image to obtain defect detection results of the characters to be detected, and further comprising: comparing the number of the character holes and the number of the connected domains of each character to be detected with the number of the template character holes and the number of the connected domains of the template characters corresponding to the template characters in the template character image; and determining defect detection results of the characters to be detected according to the comparison results.
In one example, for example, referring to fig. 7 and 8, fig. 7 is a schematic diagram of comparing the number of character holes OK with the number of character holes NG, and fig. 8 is a schematic diagram of comparing the number of connected domains OK with the number of connected domains NG; if the character to be detected is a schematic diagram corresponding to the number of character holes OK, the number of character holes of the character to be detected is 1, the number of template character holes is also 1, the number of the character holes is consistent with the number of the template character holes, the defect of the character to be detected is determined to be absent, if the character to be detected is a schematic diagram corresponding to the number of the character holes NG, the number of the character holes of the character to be detected is 0, and if the number of the character holes of the character to be detected is inconsistent with the number of the template character holes, the defect of the character to be detected is determined to be absent; the number of the connected domains of the corresponding schematic diagram of the connected domain OK is 1, the number of the connected domains of the corresponding schematic diagram of the connected domain NG is 2, and the comparison mode is similar to that of the number of the character holes; wherein the number of the character holes and the number of the communicating areas can be obtained through Halcon; the number of holes of the template characters and the number of connected domains of the template characters can be preset through detection.
The embodiment of the application provides a character defect detection method, which is used for comparing the character skeleton length and the character area of each character to be detected with the template character skeleton length and the template character area of the corresponding template character in the template character image; and determining a skeleton length error and an area error of each character to be detected according to the comparison result, and determining a defect detection result of each character to be detected according to the skeleton length error and the area error. Whether the character to be detected has defects or not can be determined according to the length of the character skeleton and the area of the character, and the accuracy and the detection efficiency of character defect detection are improved.
Referring to fig. 9, fig. 9 shows a flowchart of a method for detecting a character defect according to another embodiment of the present application, in this embodiment, before step S10, the method further includes:
step S1: the first light source and the second light source are controlled to illuminate the product to be detected, and the first light source and the second light source are arranged above the product to be detected and symmetrically arranged on two sides of the product to be detected.
It will be appreciated that the product to be inspected may be one in which defect inspection of the contained characters is required.
Step S2: and controlling a target camera to photograph the illuminated product to be detected to obtain an image to be detected containing the character to be detected, wherein the target camera is arranged right above the product to be detected.
It can be understood that in the process of photographing the product to be detected, the first light source and the second light source are controlled to work simultaneously, so that the product to be detected is illuminated.
In one example, referring to fig. 10 for example, fig. 10 is a schematic view of the arrangement positions of the first light source, the second light source, and the target camera; if the image to be detected needs to be acquired, the first light source A and the second light source B are controlled to illuminate the product C to be detected, and the target camera X is controlled to photograph the illuminated product to obtain the image to be detected containing the character to be detected.
The embodiment of the application provides a character defect detection method, which comprises the steps of controlling a first light source and a second light source to illuminate a product to be detected, wherein the first light source and the second light source are arranged above the product to be detected and are symmetrically arranged on two sides of the product to be detected; and controlling a target camera to photograph the illuminated product to be detected to obtain an image to be detected containing the character to be detected, wherein the target camera is arranged right above the product to be detected. By adopting the double-entry light source imaging scheme, the consistency of the contrast and uniformity of characters at different positions of the product can be ensured, and the image quality of an image to be detected is improved.
In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a character defect detection program, and the character defect detection program realizes the steps of the character defect detection method when being executed by a processor.
Referring to fig. 11, fig. 11 is a block diagram illustrating an embodiment of a character defect detecting apparatus according to an embodiment of the present invention.
As shown in fig. 11, the character defect detecting device according to the embodiment of the present invention includes:
the acquisition module 10 is used for acquiring an image to be detected containing characters to be detected and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character image;
The detection module 20 is configured to detect characters to be detected in each preset detection area in the format to-be-detected image, so as to obtain character features of each character to be detected, where each preset detection area is determined based on each template character after expansion processing in the template character image;
and the comparison module 30 is configured to compare the character features of the to-be-detected characters with the features of the corresponding template characters in the template character image, respectively, to obtain defect detection results of the to-be-detected characters.
The embodiment of the invention provides a character defect detection device, which is used for acquiring an image to be detected containing characters to be detected and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of a template character image; detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image; and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected. According to the embodiment of the invention, each preset detection area is determined based on each template character after expansion processing in the template character image, so that the accuracy and the speed of positioning each character to be detected in the format to-be-detected image are improved, character features of the character to be detected in each preset detection area are compared with the features of the corresponding template character in the template character image, a defect detection result of each character to be detected is obtained, automatic detection of character defects is realized, and the accuracy of detecting the defect characters is improved while the detection efficiency is improved.
Based on one embodiment of the above-described character defect detecting apparatus of the present invention, another embodiment of the character defect detecting apparatus of the present invention is proposed.
In this embodiment, the obtaining module 10 is further configured to perform binarization processing on the template character image to obtain a binarized image; performing expansion processing on each character in the binarized image, and determining a preset detection area corresponding to each character according to the characters after the expansion processing.
The acquiring module 10 is further configured to perform expansion processing on each character in the binarized image, where each part of the characters after the expansion processing is mutually communicated; and determining the minimum circumscribed rectangle corresponding to each character after the expansion processing, and taking the minimum circumscribed rectangle corresponding to each character as a preset detection area.
The acquiring module 10 is further configured to determine a minimum circumscribed rectangle of each character after the expansion processing; and adjusting the corresponding minimum circumscribed rectangle according to the character information of each template character in the template character image, and taking the adjusted minimum circumscribed rectangle as a preset detection area.
The comparison module 30 is further configured to compare the character skeleton length and the character area of each character to be detected with the template character skeleton length and the template character area of the corresponding template character in the template character image; determining a skeleton length error and an area error of each character to be detected according to the comparison result, and determining a defect detection result of each character to be detected according to the skeleton length error and the area error; the character features include a character skeleton length and a character area.
The comparison module 30 is further configured to compare the number of holes and the number of connected domains of the characters to be detected with the number of holes and the number of connected domains of the template character corresponding to the template character in the template character image; determining defect detection results of all characters to be detected according to the comparison results; the character features also include a number of character holes and a number of connected domains.
The acquisition module 10 is further configured to control a first light source and a second light source to illuminate a product to be detected, where the first light source and the second light source are disposed above the product to be detected and symmetrically disposed on two sides of the product to be detected; and controlling a target camera to photograph the illuminated product to be detected to obtain an image to be detected containing the character to be detected, wherein the target camera is arranged right above the product to be detected.
Other embodiments or specific implementation manners of the character defect detection apparatus of the present invention may refer to the above-mentioned method embodiments, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. read-only memory/random-access memory, magnetic disk, optical disk), comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A character defect detection method, the method comprising:
acquiring an image to be detected containing characters to be detected, and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character;
detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, wherein each preset detection area is determined based on each template character after expansion processing in the template character image;
and comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image to obtain a defect detection result of each character to be detected.
2. The method of claim 1, wherein before the capturing the image to be detected including the character to be detected and converting the image to be detected into the format image to be detected in accordance with the format of the template character image, further comprising:
performing binarization processing on the template character image to obtain a binarized image;
performing expansion processing on each character in the binarized image, and determining a preset detection area corresponding to each character according to the characters after the expansion processing.
3. The method according to claim 2, wherein the performing expansion processing on each character in the binarized image, and determining the preset detection area corresponding to each character according to the expanded character, includes:
performing expansion processing on each character in the binarized image, wherein each part of the characters is communicated after the expansion processing;
and determining the minimum circumscribed rectangle corresponding to each character after the expansion processing, and taking the minimum circumscribed rectangle corresponding to each character as a preset detection area.
4. The method of claim 3, wherein determining the minimum bounding rectangle corresponding to each character after the expansion processing, and taking the minimum bounding rectangle corresponding to each character as the preset detection area, comprises:
determining the minimum circumscribed rectangle of each character after expansion treatment;
and adjusting the corresponding minimum circumscribed rectangle according to the character information of each template character in the template character image, and taking the adjusted minimum circumscribed rectangle as a preset detection area.
5. The method of any of claims 1-4, wherein the character features include a character skeleton length and a character area;
Comparing the character features of the characters to be detected with the features of the corresponding template characters in the template character image to obtain defect detection results of the characters to be detected, wherein the defect detection results comprise:
comparing the character skeleton length and the character area of each character to be detected with the template character skeleton length and the template character area of the corresponding template character in the template character image;
and determining a skeleton length error and an area error of each character to be detected according to the comparison result, and determining a defect detection result of each character to be detected according to the skeleton length error and the area error.
6. The method of any one of claims 1-4, wherein the character features further comprise a character hole number and a connected domain number;
comparing the character features of the characters to be detected with the features of the corresponding template characters in the template character image to obtain defect detection results of the characters to be detected, and further comprising:
comparing the number of the character holes and the number of the connected domains of each character to be detected with the number of the template character holes and the number of the connected domains of the template characters corresponding to the template characters in the template character image;
And determining defect detection results of the characters to be detected according to the comparison results.
7. The method according to any one of claims 1 to 4, wherein before the capturing the image to be detected including the character to be detected and converting the image to be detected into the format image to be detected in accordance with the format of the template character image, further comprising:
controlling a first light source and a second light source to illuminate a product to be detected, wherein the first light source and the second light source are arranged above the product to be detected and symmetrically arranged on two sides of the product to be detected;
and controlling a target camera to photograph the illuminated product to be detected to obtain an image to be detected containing the character to be detected, wherein the target camera is arranged right above the product to be detected.
8. A character defect detecting apparatus, characterized by comprising:
the acquisition module is used for acquiring an image to be detected containing characters to be detected and converting the image to be detected into a format image to be detected, wherein the format of the format image to be detected is consistent with that of the template character image;
the detection module is used for detecting the characters to be detected in each preset detection area in the format to-be-detected image to obtain character characteristics of each character to be detected, and each preset detection area is determined based on each template character after expansion processing in the template character image;
And the comparison module is used for comparing the character characteristics of each character to be detected with the characteristics of the corresponding template character in the template character image respectively to obtain a defect detection result of each character to be detected.
9. A character defect detecting apparatus, characterized in that the apparatus comprises: a memory, a processor, and a character defect detection program stored on the memory and executable on the processor, the character defect detection program configured to implement the steps of the character defect detection method of any one of claims 1 to 7.
10. A storage medium having stored thereon a character defect detection program which, when executed by a processor, implements the steps of the character defect detection method according to any one of claims 1 to 7.
CN202310395874.0A 2023-04-14 2023-04-14 Character defect detection method, device, equipment and storage medium Active CN116129435B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310395874.0A CN116129435B (en) 2023-04-14 2023-04-14 Character defect detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310395874.0A CN116129435B (en) 2023-04-14 2023-04-14 Character defect detection method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116129435A true CN116129435A (en) 2023-05-16
CN116129435B CN116129435B (en) 2023-08-08

Family

ID=86297721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310395874.0A Active CN116129435B (en) 2023-04-14 2023-04-14 Character defect detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116129435B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0981683A (en) * 1995-09-08 1997-03-28 Sony Corp Character symbol inspection device and method therefor
CN101916364A (en) * 2010-07-06 2010-12-15 浙江大学 Adaptive dial digital identification device and method
CN109142383A (en) * 2018-08-10 2019-01-04 惠州太初科技有限公司 One kind being based on morphologic character defect inspection method and device
CN110197180A (en) * 2019-05-30 2019-09-03 新华三技术有限公司 Character defect inspection method, device and equipment
CN111060527A (en) * 2019-12-30 2020-04-24 歌尔股份有限公司 Character defect detection method and device
CN111474184A (en) * 2020-04-17 2020-07-31 河海大学常州校区 AOI character defect detection method and device based on industrial machine vision

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0981683A (en) * 1995-09-08 1997-03-28 Sony Corp Character symbol inspection device and method therefor
CN101916364A (en) * 2010-07-06 2010-12-15 浙江大学 Adaptive dial digital identification device and method
CN109142383A (en) * 2018-08-10 2019-01-04 惠州太初科技有限公司 One kind being based on morphologic character defect inspection method and device
CN110197180A (en) * 2019-05-30 2019-09-03 新华三技术有限公司 Character defect inspection method, device and equipment
CN111060527A (en) * 2019-12-30 2020-04-24 歌尔股份有限公司 Character defect detection method and device
CN111474184A (en) * 2020-04-17 2020-07-31 河海大学常州校区 AOI character defect detection method and device based on industrial machine vision

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
韩清涛;张丽娟;: "晶振字符自动检测系统的设计与实现", 东莞理工学院学报, vol. 16, no. 01, pages 60 - 63 *

Also Published As

Publication number Publication date
CN116129435B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
CN111507958A (en) Target detection method, training method of detection model and electronic equipment
CN111598863B (en) Defect detection method, device, equipment and readable storage medium
JP5559619B2 (en) A method for detecting changes in printed documents using image comparison analysis
JP2022539912A (en) Electronic device backplane appearance defect inspection method and apparatus
CN111325717B (en) Mobile phone defect position identification method and equipment
CN112598627A (en) Method, system, electronic device and medium for detecting image defects
CN111461070B (en) Text recognition method, device, electronic equipment and storage medium
KR20200086812A (en) System for inspecting substrate defects by bubbles and Method for inspecting substrate defects by bubbles
CN112819799B (en) Target defect detection method, device, system, electronic equipment and storage medium
CN111598084B (en) Defect segmentation network training method, device, equipment and readable storage medium
JP2022086454A (en) Image inspection device and image inspection program
CN112419207A (en) Image correction method, device and system
CN116129435B (en) Character defect detection method, device, equipment and storage medium
JP4479999B2 (en) Graphic selection support apparatus, graphic selection support method and program for pattern matching
CN116091503B (en) Method, device, equipment and medium for discriminating panel foreign matter defects
CN117007600A (en) Defect detection method, device, equipment and computer readable storage medium
CN111476056A (en) Target object identification method and device, terminal equipment and computer storage medium
CN115311237A (en) Image detection method and device and electronic equipment
CN115546219A (en) Detection board type generation method, board card defect detection method, device and product
CN112529923B (en) Control identification method and device
CN111428707B (en) Method and device for identifying pattern identification code, storage medium and electronic equipment
CN115222653A (en) Test method and device
CN117333762B (en) Image reproduction identification method based on multi-feature fusion
CN110705336A (en) Image processing method, system, electronic device and readable storage medium
CN116452471B (en) Processing method and device for ultra-high definition image, terminal equipment and computer medium

Legal Events

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