This application is based on Japanese Patent Application No. 2014-051090 filed with the Japan Patent Office on Mar. 14, 2014, the entire contents of which are incorporated herein by reference.
The present invention relates to an image processing device, an image processing method, and an image processing program capable of properly performing matching processing on an input image based on one or a plurality of preregistered templates.
In an FA (Factory Automation) field, various kinds of image processing techniques have been applied. For example, by using an input image obtained by capturing an image of a workpiece and the like, there have been executed processing of measuring a size and a position of the workpiece, and processing of searching for a position or a region that matches a preregistered template. According to such an image processing, experience is necessary for registering a template, setting an imaging condition, setting various kinds of parameters, and the like. Therefore, in many cases, a user having little knowledge has difficulty in performing a proper setting. Accordingly, techniques for supporting the user have been proposed, as disclosed in Unexamined Japanese Patent Publication No. 2011-076517, Unexamined Japanese Patent Publication No. 2011-076519, and Unexamined Japanese Patent Publication No. H10-021393.
Unexamined Japanese Patent Publication No. 2011-076517 discloses an optical information reading device having a teaching function, the device in which an imaging condition can be easily set to be flexibly suited for a user usage.
Unexamined Japanese Patent Publication No. 2011-076519 discloses a setting method of an optical information reading device capable of setting an imaging condition using a teaching history being held.
Unexamined Japanese Patent Publication No. H10-021393 discloses an image processing device and the like that adopt what a system can automatically perform in a recognition trial mode. The image processing device minimizes an operator's decision. Despite a plurality of samples having been presented, the image processing device can optimize the recognition by an operation as simple as or simpler than that of a conventional operation.
According to the optical information reading device described in Unexamined Japanese Patent Publication No. 2011-076517, the user selects a teaching table. By changing a certain parameter with priority, an imaging condition is changed. The imaging condition is determined, by performing imaging a plurality of times. Unexamined Japanese Patent Publication No. 2011-076517 does not give clear description about how to change the imaging condition. In order to determine the imaging condition, certain levels of man-hour and experience are considered necessary.
According to the optical information reading device described in Unexamined Japanese Patent Publication No. 2011-076519, the user determines an optimum parameter by setting a new imaging condition by using a plurality of teaching histories. According to the method described in Unexamined Japanese Patent Publication No. 2011-076519, only the parameter is adjusted. However, in reality, it is considered not possible to obtain sufficient accuracy in many cases with the parameter adjustment only.
According to the image processing device described in Unexamined Japanese Patent Publication No. H10-021393, an optimum parameter is determined by recognition strategy adjustment in which re-recognition is performed while adjusting redundancy of data of an image model or updating an image model by detecting a recognition failure or reliability reduction. According to the method of Unexamined Japanese Patent Publication No. H10-021393, it is necessary to properly determine a model and a strategy update rule, and a certain level of experience is considered necessary to determine the rule.
There has been desired an adjusting method by which a user can properly execute matching processing based on a registered template, even when the user has little experience and knowledge.
An image processing device according to a certain aspect of the present invention includes: a matching processing unit that performs matching processing on an input image based on one or a plurality of preregistered templates; an interaction unit that outputs a result indicating a range of each region extracted from the input image assuming that the region matches one of the templates, and that receives from a user an input regarding whether an extraction result of each region is proper; and a control unit that executes optimization processing of a parameter to be used for the matching processing when there has been an input that the extraction result is not proper, and that executes update processing of the template according to success or failure of the matching result of each extracted region when there has been an input that the extraction result is proper.
An image processing method according to other aspect of the present invention includes: a step of performing matching processing on an input image based on one or a plurality of preregistered templates; a step of outputting a result indicating a range of each region extracted from the input image assuming that the region matches one of the templates, and receiving from a user an input regarding whether an extraction result of each region is proper; and a step of executing optimization processing of a parameter to be used for the matching processing when there has been an input that the extraction result is not proper, and executing update processing of the template according to success or failure of the matching result of each extracted region when there has been an input that the extraction result is proper.
An image processing program according to still other aspect of the present invention causes a computer to execute: a step of performing matching processing on an input image based on one or a plurality of preregistered templates; a step of outputting a result indicating a range of each region extracted from the input image assuming that the region matches one of the templates, and receiving from a user an input regarding whether an extraction result of each region is proper; and a step of executing optimization processing of a parameter to be used for the matching processing when there has been an input that the extraction result is not proper, and executing update processing of the template according to success or failure of the matching result of each extracted region when there has been an input that the extraction result is proper.
An image processing device according to a certain aspect of the present invention includes: a matching processing unit that performs matching processing on an input image based on a preregistered template; an interaction unit that indicates a region extracted from the input image assuming that the region matches a template and that receives an input regarding whether the region is proper; and a control unit that executes optimization processing of a parameter to be used for the matching processing when there has been an input that the region is not proper, and that executes update processing of the template when there has been an input that the region is proper.
According to the present invention, even when the user has little experience and knowledge, the user can perform adjustment to properly execute matching processing based on a registered template.
An embodiment of the present invention will be described in detail with reference to the drawings. In the drawings, identical or equivalent portions will be attached with the same signs, and description of these portions will not be repeated.
An image processing device according to the embodiment can be applied to various kinds of applications including matching processing on an input image based on one or a plurality of preregistered templates. In the present specification, the term “template” is used in the meaning including information that serves as a reference of matching processing. That is, the “template” can include an image (hereinafter, also referred to as “model image”) itself that serves as a reference of the matching processing, an image obtained by mapping the model image to a spatial frequency domain, or a feature amount (for example, outline, edge amount, and spatial frequency) which indicates the model image.
Hereinafter, application of character recognition will be described.
The image processing device 100 has a standard template for each recognizable character, and can execute character recognition processing without preregistering a template according to the workpiece W. The standard template is also referred to as an “incorporated dictionary” in the present specification. In the character recognition processing using the standard template, when receiving a character that cannot be properly recognized, a template is added for the character that cannot be properly recognized. The additionally registered template is also referred to as a “user dictionary” in the present specification. Additionally registering the template to a certain character is also referred to as “dictionary registration” or “dictionary customization” in the present specification.
The image processing device 100 includes a display 102, an input unit 104, a processor 110 such as a CPU (Central Processing Unit) and an MPU (Micro-Processing Unit), a main memory 112, a hard disk 114, a camera interface 120, a network interface 122, and a memory card interface 124. These parts are connected to each other so as to be able to perform data communications via an internal bus 106.
The processor 110 reads an image processing program 115 stored in the hard disk 114, develops the image processing program 115 in the main memory 112, and executes an image processing method of the embodiment. The display 102 displays a result output including a recognition result following the execution of the image processing. A part or a whole of the recognition result obtained by executing the image processing may be output to an external server through the network interface 122.
The image processing program 115 is distributed in the state of being stored in a memory card 126, for example. In this case, the image processing program 115 stored in the memory card 126 is read through the memory card interface 124, and is then installed in the hard disk 114. Alternatively, the image processing program 115 may be configured to be distributed from the external server through the network interface 122.
The hard disk 114 stores an incorporated dictionary 116, a user dictionary 117, and a measurement parameter 118, in addition to the image processing program 115.
In the case of using the image processing device 100 having a structure following general-purpose computer architecture, there may be preinstalled an OS (Operating System) for providing a basic function of the computer. In this case, the image processing program 115 may be the one for executing processing by calling a necessary module in a predetermined order and/or in predetermined timing, out of program modules provided as part of the OS. That is, the image processing program 115 may not include all modules necessary for realizing the image processing method of the embodiment, and part of the necessary modules may be provided from the OS. Further, the image processing program 115 of the embodiment may be provided by being built in part of other program.
The camera interface 120 receives the input image obtained by imaging by the imaging unit 8. The imaging unit 8 is representatively configured by including imaging elements such as a CCD (Charge Coupled Device) and a CMOS (Complementary Metal Oxide Semiconductor) sensor, in addition to an optical system such as a lens.
Alternatively, a part or a whole of functions provided by executing the image processing program 115 may be installed as an exclusive hardware circuit.
The image processing executed by the image processing device 100 according to the embodiment includes ordinary recognition processing, and adjustment processing for adjustment prior to the recognition processing. According to the embodiment, in the adjustment processing, there is provided a function capable of performing more proper adjustment and setting in a simpler procedure.
The inventors of the present invention have found that it is possible to guide the user to a proper procedure, by classifying inconvenience of the adjustment processing into the following types of Case 1 to Case 3, and by deciding to which case any inconvenience corresponds. First, the classified Case 1 to Case 3 will be described.
As in the above examples, there are cases where one character has been divided into two characters, and in contrast, two characters have been recognized as one character by connecting the two characters. As causes of the erroneous recognition, it is considered that a measurement parameter is not proper and that an imaging condition for a moving workpiece is not proper.
In the adjustment processing according to the embodiment, first, it is confirmed whether the number of characters set by a correct character string or a character string format matches the number of segmented characters. That is, it is decided whether the segmented result of the character is proper. For deciding whether the segmented result of the character is proper, the decision may be automatically made based on a correct character string or a character string format set in advance. Alternatively, after the segmented result of the character has been presented to the user, the image processing device 100 may ask the user whether the segmented result of the character is proper. For example, in a printed character string of a manufacturing date and the like, when the digit number included in the character string changes (for example, a difference between cases where January and October should be printed as “01” and “10” and where they should be printed as “1” and “10”, respectively), it is preferable that the user visually confirms the character string.
When the segmented result of the character is not proper, the user is guided to execute an additional teaching.
In the present specification, the “additional teaching” means to execute again the “teaching” by referring to the information of a preceding execution result and the like of the “teaching”. The “additional teaching” may be executed during the execution of the adjustment processing, and the “additional teaching” may be executed when an improper recognition result has been output during the execution of ordinary recognition processing.
Representatively, because of a characteristic character font used for printing, there may occur erroneous recognition, and even when the character is successfully recognized, there may occur unstable recognition due to low similarity and low stability of a recognition result.
In the adjustment processing according to the embodiment, when there occurs erroneous recognition or when there is a high possibility of generating erroneous recognition although a rectangle surrounding each character has been properly set from the segmented result of the character, the user is guided to an operation for stabilizing the character recognition processing in the following procedure.
More specifically, when a correct character string has been set in the character string format, it is confirmed whether the correct character string and the recognition result match each other. Whether the correct character string and the recognition result match each other can be decided automatically. Alternatively, after a recognition result has been presented to the user, the image processing device 100 may ask the user whether the recognition result of a character is proper.
In this case, whether character recognition processing has been executed stably may be also decided together. For example, it is decided whether similarity and stability of recognized characters with respect to a template are equal to or lower than respective threshold values. When one of the similarity and stability is equal to or lower than a corresponding threshold value, it is decided that stability of the character recognition processing is low. When sizes (and widths and heights) of rectangles that surround the segmented characters are irregular and when adjacent characters are superposed, it may be decided that stability of the character recognition processing is low.
In any of the above decisions, when it has been decided that the recognition result does not match the correct character string, or when stability of the character recognition processing is low, the user is guided to an operation of dictionary registration in order to stabilize the character recognition processing.
More specifically, an upper limit value of teaching repetition is preset. When the number of teaching repetition has reached the upper limit value, the user is guided to proceed to the imaging of the input image, or the user is guided to proceed to the adjustment of the measurement parameter.
In the adjustment processing according to the embodiment, by assuming at least Case 1 to Case 3, support is provided to the user to enable the user to properly set conditions and measurement parameters necessary to execute the ordinary recognition processing. In summary, in the image processing according to the embodiment, according to a recognition result, which one of optimization of measurement parameters and dictionary registration is proper is presented to the user.
Specifically, in the image processing, teaching is executed by using as an evaluation value, the number of characters included in the recognition result obtained by executing the character recognition processing, and similarity of the recognition result. Further, stability may be included in the evaluation value. Based on a result of the teaching, a cause analysis is performed and causes are classified according to the following policy.
First, it is decided whether the segmented result of the character is proper (Case 1). The decision can be automatically made based on the number of segmented characters and the size of the character rectangle. However, it is preferable to allow the user to visually confirm success/failure of the segmented result. When the segmentation of a character is not proper, it is decided that it is necessary to improve the measurement parameter. Therefore, the user is guided to execute the additional teaching. In the execution of the additional teaching, there are utilized measurement parameters that have been obtained by the teaching executed so far.
On the other hand, whether there is a reading mistake in spite of a proper segmented result of the character is decided (Case 2). At this time, when a value of similarity or stability as the evaluation value is lower than the threshold value, this may be regarded as an erroneous reading. When it has been decided that an erroneous reading has occurred, the corresponding character is considered to be a character that the image processing device 100 cannot easily read. Therefore, the user is guided to perform dictionary registration. However, when the reading is not stabilized even after the teaching has executed exceeding the upper limit number of times (Case 3), the user is urged to capture an image of the input image again or manually adjust the measurement parameter.
The adjustment processing including the above adjustment of the measurement parameter and the dictionary registration may be performed before executing the ordinary recognition processing. However, the adjustment processing is also executed when a certain NG has occurred during the execution of the ordinary recognition processing.
In this case, the situation of the NG of the recognition result is decided based on the evaluation value, and the image processing device 100 performs the cause analysis. By this arrangement, a valid measurement parameter is automatically optimized so that correct character recognition can be performed. The method is presented to the user at the same time. That is, after the cause analysis, which one of the adjustment of the measurement parameter and the dictionary registration is valid for the workpiece is presented to the user based on the result of the teaching. In deciding which one of the adjustment of the measurement parameter and the dictionary registration is to be used, character segmentation, presence or absence of erroneous reading, and values of similarity, stability, and the like are used.
Similarity and stability that are used in the image processing according to the embodiment will be described.
In the present specification, “similarity” means an evaluation value that indicates how much there is resemblance between a partial image (an image in a rectangle which surrounds each character) indicating a character in the input image, and a character model (that is, a template) in a dictionary (the incorporated dictionary and the user dictionary). That is, “similarity” means the evaluation value obtained from a comparison between the dictionary data and the feature of the input character.
“Stability” indicates a difference in similarity between a character model (a first candidate) that has been evaluated as the most similar to a character in the input image and a character model (a second candidate) that has been evaluated as next similar to the character in the input image. That is, “stability” means the difference between the first candidate and the second candidate of a read character.
Similarity between the partial image 20 and each character model is calculated as shown in
A value “83” as a similarity first candidate is similarity, and “9” that a corresponding character model indicates is a recognition result. A difference “15” between the similarity first candidate and the similarity second candidate (83−68 in this example) is stability.
Depending on a shape and a state of a character (a partial image) included in the input image, similarity and stability are low in some cases, even when the character has been correctly recognized. For example, as shown in
When both the similarity and the stability calculated are low, dictionary registration is valid. When similarity is high, from the experience, a possibility of erroneous recognition can be said to be low even when stability is relatively low.
In
Next, the image processing device 100 receives user assignment of a processing region on the input image (Step S102). The processing region means a region to be subjected to matching processing, and the user assigns any region. Next, the image processing device 100 decides whether the user has selected a mode of using a correct character string (Step S104). In the adjustment processing executed by the image processing device 100, the correct character string is not essential. When the mode using the correct character string has been selected, the image processing device 100 executes teaching by using information of the correct character string to be set. On the other hand when a mode not using the correct character string has been selected, the image processing device 100 executes teaching by using an instruction from the user. When the mode using the correct character string has been selected (YES in Step S104), the pieces of processing in and after Step S110 are executed. When the mode using the correct character string has not been selected (NO in Step S104), the pieces of processing in and after Step S140 are executed.
In Step S110, the image processing device 100 receives at least one of the correct character string and the character string format (Step S110). For the correct character string, a concrete character string (“ABC”, for example) printed in the workpiece W included as a photographic subject in the input image is assigned. The character string format is information (“A##”, for example, where “#” denotes any numeral) assigned by a character type and the number of characters of a character string to be printed in the workpiece W included as a photographic subject in the input image. By using the correct character string or the character string format, a result of the character recognition processing executed by the image processing device 100 can be evaluated. Based on the evaluation result, the template and the measurement parameter can be optimized.
Next, the image processing device 100 executes the character recognition processing on the input image, by using a standard template (the incorporated dictionary 116 shown in
At this time, the image processing device 100 also optimizes the measurement parameter. That is, the image processing device 100 determines the measurement parameter and the like by executing teaching.
The measurement parameter includes various kinds of setting values necessary for the character recognition processing. For example, the measurement parameter includes a font type of a character to be recognized (whether seal or dot printing), a font thickness, a dot interval (in the case of dot printing), a maximum width of a character string, a maximum value/a minimum value of height of a character string, an aspect ratio of a character string (a character aspect ratio), height of a hyphen in a character string, and the like.
Next, the image processing device 100 displays a segmented result of each character segmented from the input image by the character recognition processing in Step S112, and asks the user whether the segmented result of the character is proper (Step S114). That is, the image processing device 100 outputs a result of a range of each region extracted from the input image assuming that the region matches one of the templates. The image processing device 100 also receives from the user the input about whether the extraction result of each region is proper. That is, the image processing device 100 shows the region extracted from the input image on the basis that the region matches one of the templates, and also receives the input about whether the region is proper.
When the user has assigned that the segmented result of the character is not proper (No in Step S114), the pieces of processing in Steps S116 to S122 are executed. When the user has assigned that the segmented result of the character is proper (YES in Step S114), the pieces of processing in Steps S130 and S132 are executed. That is, when there has been an input that the extraction result of each region is not proper, the image processing device 100 executes the optimization processing of a measurement parameter to be used in the matching processing (Steps S116 to S122). When there has been an input that the extraction result is proper, the image processing device 100 executes the update processing of the template, according to success or failure of the matching result of each extracted region (Steps S130 and S132).
In Step S118, the image processing device 100 executes the additional teaching (Step S118). In the additional teaching, the measurement parameter is re-adjusted based on similarity and the like of the recognition result. In the additional teaching, a result of already executed teaching is utilized. That is, when there has been an input that the extraction result is not proper, the image processing device 100 optimizes again a parameter by utilizing a result of precedingly executed optimization processing of the parameter. That is, when there has been an input that the extracted region is not proper, the image processing device 100 executes the optimization processing of a parameter to be used in the matching processing.
Based on the measurement parameter re-adjusted by the additional teaching, the image processing device 100 executes the character recognition processing on the input image (Step S120), and executes again the pieces of processing in and after Step S114.
Before executing Step S118, the image processing device 100 decides whether the number of teaching repetition has reached the predetermined upper limit value (Step S116). When the number of teaching repetition has not reached the predetermined upper limit value (NO in Step S116), the processing Step S118 is executed.
On the other hand, when the number of teaching repetition has reached the predetermined upper limit value (YES in Step S116), the image processing device 100 notifies the user to capture an image of the input image again or to perform manual adjustment of the measurement parameter (Step S122), and stops the adjustment processing. That is, when a proper extraction result is not obtained even after the optimization processing of the parameter is repeated to the predetermined upper limit value, the image processing device 100 urges the user to perform at least one of the manual adjustment of the parameter and the change of the input image.
In Step S130, the image processing device 100 decides whether the recognition result is adapted to the correct character string and the character string format set in Step S110 (Step S130). More specifically, the image processing device 100 decides whether the set correct character string and the recognized character string completely match each other. That is, the image processing device 100 receives a correct character string of a character included in the input image. The image processing device 100 decides success or failure of the matching result by comparing a correct character string of the character and a recognition result of a character in each region.
When the correct character string and the recognized character string completely match each other, the image processing device 100 decides that the recognition result is adapted. Further, the image processing device 100 decides whether one of or both of the similarity and the stability of recognized characters with respect to the template exceed a predetermined threshold value. When the similarity or the stability exceeds the predetermined threshold value, the image processing device 100 decides that the recognition result is adapted.
When it has been decided that the recognition result is not adapted to the correct character string and the character string format (NO in Step S130), the image processing device 100 registers in the user dictionary the character which has been decided to be not adapted, by associating the character with a partial image corresponding to the character and with a correct character of the character (Step S132). That is, the image processing device 100 adds as the template a partial image corresponding to a character which does not match a correct character string of the character out of a recognition result of the character. That is, when there has been an input that the extracted region is proper, the image processing device 100 executes the update processing of the template.
When it has been decided that the recognition result is adapted to the correct character string and the character string format (YES in Step S130), or after executing Step S132, the image processing device 100 ends the execution of the adjustment processing.
In Step S140, the image processing device 100 executes the character recognition processing on the input image, by using the standard template (the incorporated dictionary 116 shown in
Next, the image processing device 100 displays the segmented result of each character segmented from the input image by the character recognition processing in Step S140, and also asks the user whether the recognition result of the character is proper (Step S142). When the user has assigned that the recognition result of the character is proper (YES in Step S142), the image processing device 100 ends the execution of the adjustment processing.
On the other hand, when the user has assigned that the recognition result of the character is not proper (NO in Step S142), the image processing device 100 asks the user whether the segmented result of the character is proper (Step S144). When the user has assigned that the segmented result of the character is not proper (NO in Step S144), the pieces of processing in and after Step S110 are executed. On the other hand, when the user has assigned that the segmented result of the character is proper (YES in Step S144), the image processing device 100 urges the user to correct the character string format and also receives correction to the character string format from the user (Step S146). Then, the image processing device 100 ends the execution of the adjustment.
In the flowchart shown in
Operation/display examples of the adjustment in the image processing device 100 according to the embodiment will be described in relation to the corresponding step of the flowchart in
In the operation display screen 200 in
Accordingly, in the operation display screen 200 of
After the assignment of the processing region has been completed, the operation display screen 200 in
In the area 220, there are arranged a button 226 for starting teaching, and a button 228 for setting in more detail the measurement parameter. Further, teaching and the number of teaching repetition 227 may be displayed.
In the area 230, there can be set a format of a character string included in the input image. In the example of
When the user has selected the button 226 of the operation display screen 200 in
When the check box 246 has been checked, it is regarded that a mode that does not use the correct character string has been selected (corresponding to NO in Step S104 in
On the other hand, when the check box 246 has not been checked (corresponding to YES in Step S104 in
That is the user executes the character recognition processing by performing a prior setting of the assignment of the processing region 212 and the setting of the correct character string. Accordingly, the first teaching is executed.
As shown in
As shown in
On the other hand, when the segmented result of the character is not proper, the user selects a button 254 of “cancel” of the dialog 250 (corresponding to NO in Step S114 in
The image processing device 100 first asks the user to confirm whether each character has been segmented as intended. Although the example shows a case where the user is asked for a decision, the image processing device 100 may automatically decide.
The rectangle 214 that surrounds each character corresponds to a frame indicating a range of each extracted region, and is displayed in superposition with the input image. It is preferable that the rectangle 214 is displayed in a mode different from that of the input image in brightness and chroma. Further, a flicker display and the like may be used. In place of the rectangle 214, or in addition to the rectangle 214, coordinate values indicating a rage of each extracted region may be displayed.
That is, in the matching processing of the image processing device 100, there is calculated similarity as a matching degree between a partial image included in each extracted region and one or a plurality of templates. Then, the image processing device 100 outputs a value of highest similarity of each extracted region, by associating the value with each region, and also outputs a value of stability as a difference between the value of highest similarity and a value of next high similarity, by associating the value of stability with each region.
However, a display item and a display position are not limited to the mode shown in
Further, for each of the similarity and the stability, a display mode may be also differentiated based on a size relationship with a corresponding threshold value. For example, regarding the similarity and the stability, a value exceeding a preset threshold value may be displayed in a “green color”, and that the character recognition processing is stable may be notified to the user. On the other hand, regarding the similarity and the stability, a value that is equal to or lower than the preset threshold value may be displayed in a “red color”, and that the character recognition processing is unstable may be notified to the user. Alternatively, there may be performed gradation display of differentiating colors according to the level of the similarity or the stability.
In
When the user has selected a button 262 of “OK” of the dialog 260, the image processing device 100 registers in the user dictionary the partial image corresponding to the character “N” and the correct character of the character while associated with each other (Step S132 in
The adjustment processing is completed by the above procedure. By using the measurement parameter optimized by the above adjustment processing and the user dictionary, ordinary recognition processing is executed. During the execution of the ordinary recognition processing, when an error has occurred in the recognition result of a certain workpiece W, or when stability of the recognition result has become lower than the predetermined threshold value, the additional teaching is executed.
Further, as shown in
The recognition processing is continued, by using a measurement parameter after the measurement parameter has been adjusted by the re-teaching.
In the column of the number of repetition 227 in the area 220 in
A result of the teaching (the character recognition processing) may be displayed after binarizing the result.
A concrete processing example of the above teaching will be described.
In
Specifically, in the first teaching, first, (1) parameter candidates are extracted. Specifically, character recognition is repeated by varying all measurement parameters. There is set as a candidate a set of high-order parameters which increases an average value of similarity and the number of correct characters or numbers as evaluation values. At this time, the all measurement parameters include a character height, a character aspect ratio, a dot interval (lateral), a dot interval (vertical), a thickness level, a character width, and the like.
Next, (2) for the set of high-order parameters extracted in the processing (1), specific measurement parameters are varied again, and the most robust measurement parameter is searched for. As the specific parameters, parameters having a relatively large influence to stability of the character recognition, such as a character height, a dot interval (lateral), and a dot interval (vertical) are varied.
By the above pieces of processing (1) and (2), an optimized measurement parameter is determined. Based on the result of the character recognition processing by the determined measurement parameter, when it has been decided that the measurement parameters further need to be adjusted, the additional teaching is executed.
By the additional teaching, (3) while the values of the specific parameters finally determined in the first teaching are taken over, a value with which the character recognition is more stabilized is selected for the rest of measurement parameters. That is, the values of the measurement parameters such as a character height, a dot interval (lateral), and a dot interval (vertical) determined by the processing (2) are taken over, and teaching by using a separate input image is performed. A measurement parameter which is the most robust is selected again by varying again the rest of measurement parameters such as a character thickness and a character aspect ratio.
The additional teaching is suitably repeated according to necessary timing.
In order to support adjustment of measurement parameters, it is preferable to visualize the content of the measurement parameters, in addition to displaying the measurement parameters by numerical values. The visualizing supports the user to adjust measurement parameters.
When a proper segmented result of the character cannot be obtained even after repeating the teaching as described above, the user is guided to manually adjust the measurement parameter. The measurement parameters are set in more detail. In order to support the adjustment of the measurement parameters, the following visualization may be performed.
In order to enable the user to grasp at a glance a correspondence relationship between the detailed parameter and the actual recognition result, a processing region 211 set on the input image 210 displays support display related to the detailed parameter, in addition to display of the recognition result. That is, it is preferable to provide a display function capable of artificially visualizing internal processing, not displaying only a numerical value of a detailed parameter concerning the character recognition.
In the processing region 211 shown in
Further, in superposition with each recognized binarized character, an image 2112 of a gray scale is displayed. The image 2112 shows a value of a thickness level set in the input box 272, a value of a dot interval (lateral) set in the input box 273, and a value of a dot interval (vertical) set in the input box 274. That is, the image 2112 shows a range prescribed by a value of a thickness level, a dot interval (lateral) and a dot interval (vertical).
When the rectangle 2111 and the image 2112 have been displayed in superposition with the recognition result, the user can grasp at a glance validity and stability of the detailed parameter that is being set at present.
The dot interval (lateral) and the dot interval (vertical) require adjustment in connecting black pixels in the lateral direction and the vertical direction into one character.
As shown in
In manually adjusting a measurement parameter, depending on the condition of the input image, it is difficult to decide in some cases which measurement parameter should be adjusted. As a function of the setting assistance of a measurement parameter, by comparing the recognized character and the value of each measurement parameter, it may be advised to the user about which measurement parameter is valid for adjustment.
For example, by comparing the rectangle that surrounds each recognized character and the rectangle 2111 of which parameters are recognized that surrounds each measurement character as shown in
In the example shown in
By detecting a condition that a character is broken or a character is too thick, it is possible to advise the user to adjust any measurement parameter out of “thickness level”, “dot interval (lateral)”, and “dot interval (vertical)”. At the same time, it is preferable that, by holding a character that serves as the template, the broken portion or the too thick portion is displayed in colors, by matching the held character and the recognized character.
Further, an optimum value obtained by differentially varying a measurement parameter set at present may be displayed to the measurement parameter.
As described above, a measurement parameter can be optimized by teaching, and at the same time, a result of character recognition executed following the optimized measurement parameter can be display by visualization.
By the visualization, the user can grasp at a glance the portion which is decided better to be connected or divided as a character. That is, when a portion that should be connected as a character is divided, the display mode of this place is differentiated to call attention of the user. In contrast, when a portion that should be divided as a character is connected, the display mode of this place is differentiated to call attention of the user.
At the same time, for the connection in the character, there may be presented to the user about which measurement parameter should be adjusted. For example, in the example shown in
In
First, the operation of each unit of the ordinary recognition processing will be described.
The image input unit 150 receives the input image from the imaging unit 8 (
The character recognizing unit 170 refers to the incorporated dictionary 116 and the user dictionary 117, and recognizes the character in each region specified by the character segmenting unit 168. That is, the character recognizing unit 170 corresponds to a matching processing unit that performs matching processing on the input image based on one or a plurality of preregistered templates.
The format matching unit 172 decides whether the character string recognized by the character recognizing unit 170 matches the preset character string format 164. When the character string recognized by the character recognizing unit 170 matches the preset character string format 164, the format matching unit 172 outputs the recognized character string to the result output unit 174. When the character string recognized by the character recognizing unit 170 does not match the preset character string format 164, the format matching unit 172 outputs reading NG to the result output unit 174. The result output unit 174 outputs an operation display screen including a result output, to the display 102, by using the output from the format matching unit 172.
Next, the operation of each unit in the adjustment processing will be described.
The image input unit 150 receives the input image that is used for the teaching.
The processing region extracting unit 152 receives the assignment of the processing region from the user. The correct answer receiving unit 154 receives the correct character string and the character string format from the user. In some cases, the correct answer receiving unit 154 receives only one of the correct character string and the character string format from the user. The character string format set by the user is stored as the character string format 164 of the variable storage unit 160. The parameter optimizing unit 156 optimizes the measurement parameter, following the processing described with reference to
The teaching controller 158 controls optimization of a measurement parameter by the parameter optimizing unit 156, and the processing of dictionary registration. That is, the teaching controller 158 corresponds to a controller that executes the optimization processing of a parameter to be used in the matching processing when there has been the input that the extraction result is not proper, and that executes the update processing of the template according to success or failure of the matching result of each extracted region when there has been the input that the extraction result is proper.
In the above embodiment, the character recognition processing has been described as an example of the matching processing based on one or a plurality of preregistered templates. However, the matching processing can be also applied to pattern matching processing, not only to the character recognition processing.
For example, the matching processing can be applied to the pattern matching processing of, on the input image obtained by capturing images of a plurality of workpieces, specifying regions in which the workpieces exist and the number of workpieces. As the teaching in this case, a measurement parameter is optimized by using a template concerned, by using the number of workpieces that exist in the input image as a correct character string. When the measurement parameter can be optimized by the teaching, the result is used as a final result. When an optimum measurement parameter cannot be determined even after the teaching is repeated to the upper limit value, the user is guided to prepare the template again, capture an image of the input image again (or change the imaging condition), or manually adjust the measurement parameter.
As described above, it is self-evident that the basic technical idea relating to the present invention can be applied to various kinds of matching processing.
According to the image processing device 100 of the embodiment, even the user having little experience and knowledge can perform adjustment to properly execute matching processing based on a registered template.
As a more detailed example, in the character reading test using the character recognition processing as described above, it is necessary to perform the initial setting (teaching) before the processing, and start the test by using the adjusted measurement parameter. During the operation of the character reading test, when reading NG has occurred in a certain workpiece, it is necessary to analyze the cause, and readjust the measurement parameter. The adjustment of the measurement parameter necessitates many man-hours. This is a large burden to the user having no or little experience. On the other hand, the image processing device 100 according to the embodiment automatically analyzes the cause of the reading NG having occurred during the execution of reading. The image processing device 100 guides the user to take a proper measure according to the cause, that is, a more proper measure out of re-teaching of the measurement parameter and dictionary registration.
Accordingly, because the user is informed of how to solve the inconvenience when reading NG has occurred during the execution of reading, the user can take necessary action without a worry, and can reduce man-hour relating to the adjustment and setting. Also, even when the user has little experience and knowledge, the user can perform proper adjustment and setting.
By introducing the supporting function, it becomes possible to improve operability of adjustment necessary for the character recognition processing, and decrease setting man-hour at the line structuring time.
Further, in the embodiment, for additionally implementing tuning, the result of already executed tuning is utilized. Therefore, a more proper measurement parameter can be determined. In the experiments by the inventors of the present invention, in the actual character reading test, by introducing the additional teaching according to the embodiment, the reading performance of 70% obtained by only the first teaching was improved to 90%.
For the user having little experience and knowledge, it is difficult to decide whether a measurement parameter is good for the actual processing, from only a numerical value of the measurement parameter. On the other hand, the image processing device according to the embodiment presents to the user a visualized state of the measurement parameter. Therefore, even when the user has little experience and knowledge, the user can grasp at a glance whether the measurement parameter is good and to which direction adjustment is to be made.
It should be considered that the embodiment disclosed herein is an exemplification in all aspects and is not restrictive. The range of the present invention is expressed in claims and not in the above description, and is intended to include all alterations in the meaning and the range equivalent to the claims.
Number | Date | Country | Kind |
---|---|---|---|
2014-051090 | Mar 2014 | JP | national |