JP6344389B2 - Optical character recognition device - Google Patents

Optical character recognition device Download PDF

Info

Publication number
JP6344389B2
JP6344389B2 JP2015527291A JP2015527291A JP6344389B2 JP 6344389 B2 JP6344389 B2 JP 6344389B2 JP 2015527291 A JP2015527291 A JP 2015527291A JP 2015527291 A JP2015527291 A JP 2015527291A JP 6344389 B2 JP6344389 B2 JP 6344389B2
Authority
JP
Japan
Prior art keywords
character string
candidate
character
container
candidates
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2015527291A
Other languages
Japanese (ja)
Other versions
JPWO2015008732A1 (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.)
Yuyama Manufacturing Co Ltd
Original Assignee
Yuyama Manufacturing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yuyama Manufacturing Co Ltd filed Critical Yuyama Manufacturing Co Ltd
Publication of JPWO2015008732A1 publication Critical patent/JPWO2015008732A1/en
Application granted granted Critical
Publication of JP6344389B2 publication Critical patent/JP6344389B2/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/18Extraction of features or characteristics of the image
    • G06V30/1801Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections
    • G06V30/18019Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections by matching or filtering
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61JCONTAINERS SPECIALLY ADAPTED FOR MEDICAL OR PHARMACEUTICAL PURPOSES; DEVICES OR METHODS SPECIALLY ADAPTED FOR BRINGING PHARMACEUTICAL PRODUCTS INTO PARTICULAR PHYSICAL OR ADMINISTERING FORMS; DEVICES FOR ADMINISTERING FOOD OR MEDICINES ORALLY; BABY COMFORTERS; DEVICES FOR RECEIVING SPITTLE
    • A61J2200/00General characteristics or adaptations
    • A61J2200/70Device provided with specific sensor or indicating means
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61JCONTAINERS SPECIALLY ADAPTED FOR MEDICAL OR PHARMACEUTICAL PURPOSES; DEVICES OR METHODS SPECIALLY ADAPTED FOR BRINGING PHARMACEUTICAL PRODUCTS INTO PARTICULAR PHYSICAL OR ADMINISTERING FORMS; DEVICES FOR ADMINISTERING FOOD OR MEDICINES ORALLY; BABY COMFORTERS; DEVICES FOR RECEIVING SPITTLE
    • A61J2205/00General identification or selection means
    • A61J2205/30Printed labels
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61JCONTAINERS SPECIALLY ADAPTED FOR MEDICAL OR PHARMACEUTICAL PURPOSES; DEVICES OR METHODS SPECIALLY ADAPTED FOR BRINGING PHARMACEUTICAL PRODUCTS INTO PARTICULAR PHYSICAL OR ADMINISTERING FORMS; DEVICES FOR ADMINISTERING FOOD OR MEDICINES ORALLY; BABY COMFORTERS; DEVICES FOR RECEIVING SPITTLE
    • A61J7/00Devices for administering medicines orally, e.g. spoons; Pill counting devices; Arrangements for time indication or reminder for taking medicine
    • A61J7/0015Devices specially adapted for taking medicines
    • A61J7/0046Cups, bottles or bags
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Character Input (AREA)
  • Character Discrimination (AREA)
  • Image Analysis (AREA)
  • Medical Preparation Storing Or Oral Administration Devices (AREA)

Description

本発明は、文字列を光学的に認識する光学文字認識装置に関し、特に、日付を表す文字列を認識する光学文字認識装置に関する。本発明はまた、日付を表す文字列を認識するための光学文字認識方法、コンピュータプログラム、及び記録媒体に関する。   The present invention relates to an optical character recognition device that optically recognizes a character string, and more particularly to an optical character recognition device that recognizes a character string representing a date. The present invention also relates to an optical character recognition method, a computer program, and a recording medium for recognizing a character string representing a date.

薬品の容器に印字されている文字を光学的に認識する装置に対する需要が存在している(特許文献1を参照)。例えば、病棟にいったん運ばれ、結果的に使用されなかった注射薬などの薬品を保管庫に返却する場合、その薬品を次回の使用時に迅速かつ間違いなく取り出せるように、薬品の種類、名称、及び使用期限などに基づいて仕分けをして保管する必要がある。光学文字認識装置を用いて、この仕分けを自動的に行う返戻装置を実現することができれば、作業の効率化及びミスの削減のために効果的である。また、このような返戻装置を用いて薬品を保管する場合、薬品の保管場所が記録されるので、次回の使用の際にも、処方に基づいて適切な薬品を自動的に払い出すことができる。   There is a need for a device that optically recognizes characters printed on a medicine container (see Patent Document 1). For example, if a medicine such as an injection that has been transported to the ward and is not used as a result is returned to the vault, the medicine type, name, and so that the medicine can be quickly and definitely removed at the next use. It is necessary to sort and store based on the expiration date. If a return device that automatically performs this sorting can be realized using an optical character recognition device, it is effective for improving work efficiency and reducing errors. In addition, when storing medicine using such a return device, the storage location of the medicine is recorded, so that the appropriate medicine can be automatically dispensed based on the prescription at the next use. .

特許第4857768号公報。Japanese Patent No. 4857768.

光学文字認識装置により文字列を光学的に認識する場合、文字列の画像に含まれるさまざまなノイズに起因して、誤認識が生じる可能性がある。認識の精度を向上させるためには、画像から予めノイズを除去する必要がある。   When a character string is optically recognized by the optical character recognition device, erroneous recognition may occur due to various noises included in the character string image. In order to improve the recognition accuracy, it is necessary to remove noise from the image in advance.

本発明は、以上の課題を解決し、従来よりも高い精度で日付を表す文字列を認識することができる光学文字認識装置、光学文字認識方法、コンピュータプログラム、及び記録媒体を提供することにある。   An object of the present invention is to provide an optical character recognition device, an optical character recognition method, a computer program, and a recording medium capable of recognizing a character string representing a date with higher accuracy than the conventional one. .

本発明の第1の態様に係る光学文字認識装置によれば、文字列を光学的に認識する光学文字認識装置において、上記光学文字認識装置は、
入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1の処理手段と、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2の処理手段と、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3の処理手段とを備えたことを特徴とする。
According to the optical character recognition device according to the first aspect of the present invention, in the optical character recognition device that optically recognizes a character string, the optical character recognition device includes:
First processing means for extracting a target area including an object to be recognized from an input image;
Second processing means for extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. And third processing means for recognizing column candidates as dates.

本発明の第2の態様に係る光学文字認識装置によれば、第1の態様に係る光学文字認識装置において、
上記第2の処理手段は、
上記目標領域に含まれるオブジェクトの輪郭及びエッジを検出し、
互いに重なり合う輪郭及びエッジを有するオブジェクトを上記候補オブジェクトとして抽出することを特徴とする。
According to the optical character recognition device according to the second aspect of the present invention, in the optical character recognition device according to the first aspect,
The second processing means includes
Detect the contour and edge of the object included in the target area,
An object having contours and edges that overlap each other is extracted as the candidate object.

本発明の第3の態様に係る光学文字認識装置によれば、第2の態様に係る光学文字認識装置において、
上記第2の処理手段は、
上記目標領域にソーベルフィルタを適用して第1のエッジを検出し、
上記第1のエッジの近傍の領域にキャニーフィルタを適用して第2のエッジを検出し、
上記第2のエッジを、上記目標領域に含まれるオブジェクトのエッジとして使用することを特徴とする。
According to the optical character recognition device according to the third aspect of the present invention, in the optical character recognition device according to the second aspect,
The second processing means includes
Applying a Sobel filter to the target area to detect the first edge;
Applying a canny filter to a region in the vicinity of the first edge to detect a second edge;
The second edge is used as an edge of an object included in the target area.

本発明の第4の態様に係る光学文字認識装置によれば、第1〜第3のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
上記文字列候補が延在する方向に平行な幅及び上記文字列候補が延在する方向に直交する高さを有する矩形形状をそれぞれ有し、上記各文字候補をそれぞれ包囲する複数のバウンディングボックスを生成し、
上記各バウンディングボックスを、当該バウンディングボックスの高さが低いほど当該バウンディングボックスの幅を拡大するように変形し、
変形により連結されたバウンディングボックスに含まれる文字候補の組を、新たな文字列候補として抽出することを特徴とする。
According to the optical character recognition device according to the fourth aspect of the present invention, in the optical character recognition device according to any one of the first to third aspects,
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
A plurality of bounding boxes each having a rectangular shape having a width parallel to a direction in which the character string candidates extend and a height orthogonal to the direction in which the character string candidates extend, and surrounding each of the character candidates. Generate and
Each of the bounding boxes is deformed so that the width of the bounding box is increased as the height of the bounding box is lower.
A set of character candidates included in bounding boxes connected by deformation is extracted as a new character string candidate.

本発明の第5の態様に係る光学文字認識装置によれば、第1〜第4のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
10個より多数の文字候補を含む文字列候補を削除することを特徴とする。
According to the optical character recognition device according to the fifth aspect of the present invention, in the optical character recognition device according to any one of the first to fourth aspects,
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
Character string candidates including more than 10 character candidates are deleted.

本発明の第6の態様に係る光学文字認識装置によれば、第1〜第5のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
上記文字列候補が延在する方向に直交する方向において2個以上のオブジェクトを含む文字候補のみを含む文字列候補を削除することを特徴とする。
According to the optical character recognition device according to the sixth aspect of the present invention, in the optical character recognition device according to any one of the first to fifth aspects,
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
Character string candidates including only character candidates including two or more objects in a direction orthogonal to the direction in which the character string candidates extend are deleted.

本発明の第7の態様に係る光学文字認識装置によれば、第1〜第6のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、
上記文字列候補のオブジェクトの輪郭及びエッジを検出し、
上記エッジの画素が上記輪郭の画素に一致する部分が上記エッジの画素の面積の60%以下である文字列候補を削除することを特徴とする。
According to the optical character recognition device according to the seventh aspect of the present invention, in the optical character recognition device according to any one of the first to sixth aspects,
The third processing means includes
Detect the contours and edges of the above character string candidate objects,
Character string candidates whose portion where the edge pixel coincides with the contour pixel are 60% or less of the area of the edge pixel are deleted.

本発明の第8の態様に係る光学文字認識装置によれば、第1〜第7のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、上記文字列候補が明らかに数字と間違えることのない英字を含むとき、上記文字列候補を日付ではないものとして認識することを特徴とする。
According to the optical character recognition device according to the eighth aspect of the present invention, in the optical character recognition device according to any one of the first to seventh aspects,
The third processing means recognizes the character string candidate as not being a date when the character string candidate includes an alphabetic character that is clearly not mistaken for a number.

本発明の第9の態様に係る光学文字認識装置によれば、第1〜第8のいずれか1つの態様に係る光学文字認識装置において、
上記第3の処理手段は、上記文字列候補が、月を表す2つの数字と、上記月を表す2つの数字に後続する少なくとも1つの他の文字とを含むとき、かつ、上記月を表す2つの数字間の距離が、上記月を表す2つの数字と他の文字との距離及び上記他の文字間の距離の平均値より大きいとき、上記月を表す2つの数字の1の位の数字及び上記他の文字を除去することを特徴とする。
According to the optical character recognition device according to the ninth aspect of the present invention, in the optical character recognition device according to any one of the first to eighth aspects,
When the character string candidate includes two numbers representing the month and at least one other character subsequent to the two numbers representing the month, the third processing unit is configured to represent the month. When the distance between two numbers is larger than the average of the distance between the two numbers representing the month and other characters and the average distance between the other characters, the first digit of the two numbers representing the month and The other characters are removed.

本発明の第10の態様に係る光学文字認識装置によれば、第1〜第9のいずれか1つの態様に係る光学文字認識装置において、
上記入力画像は、回転可能に保持された円筒形状の容器の画像であることを特徴とする。
According to the optical character recognition device according to the tenth aspect of the present invention, in the optical character recognition device according to any one of the first to ninth aspects,
The input image is an image of a cylindrical container held rotatably.

本発明の第11の態様に係る光学文字認識装置によれば、第10の態様に係る光学文字認識装置において、
上記第1の処理手段は、上記入力画像から、上記円筒形状の容器の回転軸に実質的に直交する方向に延在するエッジと、予め決められたしきい値よりも高い輝度の部分とを含む領域を、上記目標領域として抽出することを特徴とする。
According to the optical character recognition device in the eleventh aspect of the present invention, in the optical character recognition device in the tenth aspect,
The first processing means includes, from the input image, an edge extending in a direction substantially perpendicular to a rotation axis of the cylindrical container, and a portion having a luminance higher than a predetermined threshold value. A region to be included is extracted as the target region.

本発明の第12の態様に係る光学文字認識装置によれば、第10又は第11の態様に係る光学文字認識装置において、
上記光学文字認識装置は、上記容器を回転させながら撮影された上記容器の異なる角度をそれぞれ表す複数の入力画像を取得し、
上記第3の処理手段は、1つの入力画像に係る文字列候補が月を表す数字として「1」のみを含むとき、他の入力画像に係る文字列候補が月を表す数字として「1」のみを含むか否かを判断することを特徴とする。
According to the optical character recognition device in the twelfth aspect of the present invention, in the optical character recognition device in the tenth or eleventh aspect,
The optical character recognition device acquires a plurality of input images respectively representing different angles of the container photographed while rotating the container,
When the character string candidate related to one input image includes only “1” as the number representing the month, the third processing means only includes “1” as the number representing the month as the character string candidate related to the other input image. It is characterized by determining whether it is included.

本発明の第13の態様に係る光学文字認識装置によれば、第10〜第12のいずれか1つの態様に係る光学文字認識装置において、
上記光学文字認識装置は、
カメラと、
上記円筒形状の容器の回転軸の周りに回転可能であるように上記容器を保持する撮影台と、
少なくとも1つの保管庫と上記撮影台との間で上記容器を移動させる移動装置とを備え、
上記容器には、上記容器中の薬品の使用期限の日付を表す文字列が印字されていることを特徴とする。
According to the optical character recognition device according to the thirteenth aspect of the present invention, in the optical character recognition device according to any one of the tenth to twelfth aspects,
The optical character recognition device is
A camera,
An imaging table for holding the container so as to be rotatable around a rotation axis of the cylindrical container;
A moving device for moving the container between at least one storage and the imaging table;
The container is printed with a character string representing the expiration date of the medicine in the container.

本発明の第14の態様に係る光学文字認識方法によれば、
文字列を光学的に認識する光学文字認識方法において、上記光学文字認識方法は、
入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップとを備えたことを特徴とする。
According to the optical character recognition method of the fourteenth aspect of the present invention,
In the optical character recognition method for optically recognizing a character string, the optical character recognition method includes:
A first step of extracting a target area including an object to be recognized from an input image;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. And a third step of recognizing column candidates as dates.

本発明の第15の態様に係るコンピュータプログラムによれば、
コンピュータによって実行されたときに文字列を光学的に認識するコンピュータプログラムにおいて、上記コンピュータプログラムは、
入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップとを備えたことを特徴とする。
According to a computer program according to the fifteenth aspect of the present invention,
In a computer program that optically recognizes a character string when executed by a computer, the computer program includes:
A first step of extracting a target area including an object to be recognized from an input image;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. And a third step of recognizing column candidates as dates.

本発明の第16の態様に係る記録媒体によれば、
コンピュータによって実行されたときに文字列を光学的に認識するコンピュータプログラムを格納したコンピュータにより読み取り可能な記録媒体において、上記コンピュータプログラムは、
入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップとを備えたことを特徴とする。
According to the recording medium of the sixteenth aspect of the present invention,
In a computer-readable recording medium storing a computer program for optically recognizing a character string when executed by a computer, the computer program includes:
A first step of extracting a target area including an object to be recognized from an input image;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. And a third step of recognizing column candidates as dates.

本発明の第17の態様に係る光学文字認識装置によれば、第1〜第13のいずれか1つの態様に係る光学文字認識装置において、
上記光学文字認識装置は、上記容器を回転させながら撮影された上記容器の異なる角度をそれぞれ表す複数の入力画像を取得し、上記複数の入力画像を連結することを特徴とする。
According to the optical character recognition device according to the seventeenth aspect of the present invention, in the optical character recognition device according to any one of the first to thirteenth aspects,
The optical character recognition device is characterized in that it acquires a plurality of input images each representing a different angle of the container taken while rotating the container, and connects the plurality of input images.

本発明の光学文字認識装置、光学文字認識方法、コンピュータプログラム、及び記録媒体は、従来よりも高い精度で日付を表す文字列を認識することができる。   The optical character recognition device, the optical character recognition method, the computer program, and the recording medium of the present invention can recognize a character string representing a date with higher accuracy than before.

本発明の第1の実施形態に係る光学文字認識装置の構成を示すブロック図である。It is a block diagram which shows the structure of the optical character recognition apparatus which concerns on the 1st Embodiment of this invention. 第1の例に係る文字列が印字された容器13aを示す上面図である。It is a top view which shows the container 13a on which the character string which concerns on a 1st example was printed. 第2の例に係る文字列が印字された容器13bを示す上面図である。It is a top view which shows the container 13b on which the character string which concerns on a 2nd example was printed. 第3の例に係る文字列が印字された容器13cを示す上面図である。It is a top view which shows the container 13c on which the character string which concerns on a 3rd example was printed. 第4の例に係る文字列が印字された容器13dを示す上面図である。It is a top view which shows the container 13d on which the character string which concerns on a 4th example was printed. 図1の制御装置1によって実行される日付検出処理を示すフローチャートである。It is a flowchart which shows the date detection process performed by the control apparatus 1 of FIG. 図6のステップS2における目標領域抽出処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the target area | region extraction process in FIG.6 S2. 図6のステップS4における候補オブジェクト抽出処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the candidate object extraction process in step S4 of FIG. 図6のステップS6におけるOCR処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the OCR process in step S6 of FIG. 図9のステップS51,S53,S55,S57におけるOCRサブルーチンの第1の部分を示すフローチャートである。10 is a flowchart showing a first part of an OCR subroutine in steps S51, S53, S55, and S57 of FIG. 図9のステップS51,S53,S55,S57におけるOCRサブルーチンの第2の部分を示すフローチャートである。10 is a flowchart showing a second part of the OCR subroutine in steps S51, S53, S55, and S57 of FIG. 図11のステップS68におけるエッジ強度及び領域輝度判定処理のサブルーチンを示すフローチャートである。12 is a flowchart showing a subroutine of edge strength and area luminance determination processing in step S68 of FIG. 図11のステップS69における平均高さ判定処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the average height determination process in step S69 of FIG. 図11のステップS72,S75における日付パターン判定処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the date pattern determination process in step S72, S75 of FIG. 図7のステップS21において抽出された画像中の輝度が高い部分の例を示す図である。It is a figure which shows the example of the part with high brightness | luminance in the image extracted in step S21 of FIG. 図7のステップS22において抽出された画像中の長い縦エッジの例を示す図である。It is a figure which shows the example of the long vertical edge in the image extracted in step S22 of FIG. 図15の輝度が高い部分及び図16の長い縦エッジを重ね合わせた図である。FIG. 17 is a diagram in which a portion with high luminance in FIG. 15 and a long vertical edge in FIG. 16 are superimposed. 図15の輝度が高い部分及び図16の長い縦エッジを含む目標領域21を示す図である。It is a figure which shows the target area | region 21 containing the high brightness | luminance part of FIG. 15, and the long vertical edge of FIG. 図8のステップS31において抽出された明オブジェクトの例を示す図である。It is a figure which shows the example of the bright object extracted in step S31 of FIG. 図8のステップS33において抽出された暗オブジェクトの例を示す図である。It is a figure which shows the example of the dark object extracted in step S33 of FIG. 図8のステップS31における移動平均フィルタを用いた明オブジェクトの抽出を示す図である。It is a figure which shows extraction of the bright object using the moving average filter in step S31 of FIG. 明オブジェクト及び暗オブジェクトを含む画像を示す図である。It is a figure which shows the image containing a bright object and a dark object. 図22Aの画像からの明オブジェクトの抽出を示す図である。It is a figure which shows extraction of the bright object from the image of FIG. 22A. 図22Aの画像からの暗オブジェクトの抽出を示す図である。It is a figure which shows extraction of the dark object from the image of FIG. 22A. 図8のステップS35においてソーベルフィルタを用いて抽出された画像中のエッジの例を示す図である。It is a figure which shows the example of the edge in the image extracted using the Sobel filter in step S35 of FIG. 図8のステップS36において、ステップS35において抽出されたエッジ以外の領域を削除した後の画像の例を示す図である。It is a figure which shows the example of the image after deleting area | regions other than the edge extracted in step S35 in step S36 of FIG. 図8のステップS37においてしきい値15のキャニーフィルタを用いて抽出された画像中のエッジの例を示す図である。It is a figure which shows the example of the edge in the image extracted using the canny filter of the threshold value 15 in step S37 of FIG. 図8のステップS37においてしきい値4のキャニーフィルタを用いて抽出された画像中のエッジの例を示す図である。It is a figure which shows the example of the edge in the image extracted using the canny filter of the threshold value 4 in step S37 of FIG. 図8のステップS38において抽出された明オブジェクトの候補オブジェクトの例を示す図である。It is a figure which shows the example of the candidate object of the bright object extracted in step S38 of FIG. 図8のステップS39において抽出された暗オブジェクトの候補オブジェクトの例を示す図である。It is a figure which shows the example of the candidate object of the dark object extracted in step S39 of FIG. オブジェクトの例を示す図である。It is a figure which shows the example of an object. 図29Bはしきい値200を用いて抽出された図29Aの2値化画像を示す図である。FIG. 29B is a diagram showing the binarized image of FIG. 29A extracted using the threshold value 200. 図29Bの輪郭を示す図である。It is a figure which shows the outline of FIG. 29B. しきい値50を用いて抽出された図29Aのエッジを示す図である。It is a figure which shows the edge of FIG. 29A extracted using the threshold value 50. FIG. しきい値200を用いて抽出された図29Aのエッジを示す図である。It is a figure which shows the edge of FIG. 29A extracted using the threshold value 200. FIG. 文字の輪郭及びエッジを示す図である。It is a figure which shows the outline and edge of a character. 図10のステップS61において抽出された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate extracted in step S61 of FIG. 図10のステップS61における文字列候補の抽出を示す図である。It is a figure which shows extraction of the character string candidate in step S61 of FIG. 図10のステップS62において抽出された文字候補及び生成されたバウンディングボックスの例を示す図である。It is a figure which shows the example of the character candidate extracted in step S62 of FIG. 10, and the produced | generated bounding box. 図10のステップS61において抽出された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate extracted in step S61 of FIG. 図10のステップS62において抽出された文字候補及び生成されたバウンディングボックス42の例を示す図である。It is a figure which shows the example of the character candidate extracted in step S62 of FIG. 10, and the produced | generated bounding box 42. FIG. 図10のステップS63において変形されたバウンディングボックス43の例を示す図である。It is a figure which shows the example of the bounding box 43 deform | transformed in FIG.10 S63. 図10のステップS64において抽出された新たな文字列候補の例を示す図である。It is a figure which shows the example of the new character string candidate extracted in step S64 of FIG. 図10のステップS61において抽出された文字列候補の他の例を示す図である。It is a figure which shows the other example of the character string candidate extracted in step S61 of FIG. 図10のステップS62において抽出された文字候補及び生成されたバウンディングボックス42の他の例を示す図である。It is a figure which shows the other example of the character candidate extracted in step S62 of FIG. 10, and the generated bounding box 42. FIG. 図10のステップS65,S66,S67において一部の文字列候補を削除した後の文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate after deleting some character string candidates in step S65, S66, S67 of FIG. 図10のステップS64において抽出された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate extracted in step S64 of FIG. 図36Aの文字列候補に含まれる各文字候補の高さ方向におけるオブジェクトの個数を示す図である。It is a figure which shows the number of the objects in the height direction of each character candidate contained in the character string candidate of FIG. 36A. 図10のステップS64において抽出された文字列候補の他の例を示す図である。It is a figure which shows the other example of the character string candidate extracted in step S64 of FIG. 図37Aの文字列候補に含まれる各文字候補の高さ方向におけるオブジェクトの個数を示す図である。It is a figure which shows the number of objects in the height direction of each character candidate contained in the character string candidate of FIG. 37A. 入力画像の例を示す図である。It is a figure which shows the example of an input image. 図38Aの画像から抽出された明オブジェクトの候補オブジェクトを示す図である。It is a figure which shows the candidate object of the bright object extracted from the image of FIG. 38A. 図38Bの候補オブジェクトの輪郭を示す図である。It is a figure which shows the outline of the candidate object of FIG. 38B. 図38Aの画像から抽出されたエッジを示す図である。It is a figure which shows the edge extracted from the image of FIG. 38A. 入力画像の例を示す図である。It is a figure which shows the example of an input image. 図39Aの画像から抽出された暗オブジェクトの候補オブジェクトを示す図である。It is a figure which shows the candidate object of the dark object extracted from the image of FIG. 39A. 図39Bの候補オブジェクトの輪郭を示す図である。It is a figure which shows the outline of the candidate object of FIG. 39B. 図39Aの画像から抽出されたエッジを示す図である。It is a figure which shows the edge extracted from the image of FIG. 39A. 図11のステップS68におけるエッジ強度及び領域輝度判定処理を説明するための入力画像の例を示す図である。It is a figure which shows the example of the input image for demonstrating the edge intensity | strength and area | region brightness | luminance determination processing in FIG.11 S68. 図12のステップS90において選択された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate selected in step S90 of FIG. 図11のステップS68におけるエッジ強度及び領域輝度判定処理によって処理された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate processed by the edge intensity | strength and area | region brightness | luminance determination process in FIG.11 S68. 図13のステップS101において選択された文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate selected in step S101 of FIG. 図13のステップS104において抽出された新たな文字列候補の例を示す図である。It is a figure which shows the example of the new character string candidate extracted in step S104 of FIG. 本発明の第2の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理を示すフローチャートである。It is a flowchart which shows the date detection process performed by the control apparatus 1 of the optical character recognition apparatus which concerns on the 2nd Embodiment of this invention. 本発明の第3の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理を示すフローチャートである。It is a flowchart which shows the date detection process performed by the control apparatus 1 of the optical character recognition apparatus which concerns on the 3rd Embodiment of this invention. 図45のステップS15における連結画像の日付検出処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the date detection process of the connection image in step S15 of FIG. 本発明の第4の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理の日付パターン判定処理のサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine of the date pattern determination process of the date detection process performed by the control apparatus 1 of the optical character recognition apparatus which concerns on the 4th Embodiment of this invention. 日付の文字列及び他の文字を含む文字列候補の例を示す図である。It is a figure which shows the example of the character string candidate containing the character string of a date, and another character.

第1の実施形態.
図1は、本発明の第1の実施形態に係る光学文字認識装置の構成を示すブロック図である。図1の光学文字認識装置は、円筒形状の容器13の表面に印字された日付の文字列を光学的に認識する。
First embodiment.
FIG. 1 is a block diagram showing the configuration of the optical character recognition apparatus according to the first embodiment of the present invention. The optical character recognition device in FIG. 1 optically recognizes a date character string printed on the surface of a cylindrical container 13.

図1の光学文字認識装置は、制御装置1、レール2、移動装置3、カメラ4〜6、照明装置7a,7b、及びローラー8a,8bを備える。少なくとも2つのローラー8a,8bは、互いに平行に設けられ、かつ、制御装置1の制御下で動作する駆動装置を備え、これにより、容器13を回転可能に保持する。光学文字認識装置は、さらに、容器13を収容する少なくとも1つのトレー(又は保管庫)11,12を備える。移動装置3は、制御装置1の制御下で、トレー11,12及びローラー8a,8bの間で容器13を移動させる。カメラ4〜6は、トレー11,12及びローラー8a,8b上にそれぞれ設けられ、容器13がトレー11,12及びローラー8a,8b上にあるときに容器13の画像をそれぞれ取得し、制御装置1に送る。照明装置7a,7bは、ローラー8a,8b上の容器13に照明を当てる。ローラー8a,8b及び照明装置7a,7bは、容器13のための撮影台として機能する。光学文字認識装置は、ローラー8a,8bに代えて、円筒形状の容器13の回転軸の周りに回転可能であるように容器13を保持する他の機構を備えてもよい。制御装置1は、カメラ5から送られた容器13の画像に対して、図6〜図14を参照して後述する日付検出処理を実行し、容器13の表面に印字された日付を認識する。移動装置3に追加のカメラが設けられてもよい。制御装置1は、記録媒体10から読み取られたコンピュータプログラムに従って動作する外部のパーソナルコンピュータ(PC)9に接続されていてもよい。   The optical character recognition device in FIG. 1 includes a control device 1, a rail 2, a moving device 3, cameras 4 to 6, illumination devices 7a and 7b, and rollers 8a and 8b. The at least two rollers 8a and 8b are provided in parallel with each other and are provided with a driving device that operates under the control of the control device 1, thereby holding the container 13 rotatably. The optical character recognition device further includes at least one tray (or storage) 11 and 12 that accommodates the container 13. The moving device 3 moves the container 13 between the trays 11 and 12 and the rollers 8 a and 8 b under the control of the control device 1. The cameras 4 to 6 are provided on the trays 11 and 12 and the rollers 8a and 8b, respectively, and acquire images of the containers 13 when the containers 13 are on the trays 11 and 12 and the rollers 8a and 8b. Send to. The lighting devices 7a and 7b illuminate the container 13 on the rollers 8a and 8b. The rollers 8 a and 8 b and the lighting devices 7 a and 7 b function as a photographing stand for the container 13. The optical character recognition device may include another mechanism that holds the container 13 so as to be rotatable around the rotation axis of the cylindrical container 13 instead of the rollers 8a and 8b. The control device 1 performs date detection processing described later with reference to FIGS. 6 to 14 on the image of the container 13 sent from the camera 5 to recognize the date printed on the surface of the container 13. An additional camera may be provided in the moving device 3. The control device 1 may be connected to an external personal computer (PC) 9 that operates according to a computer program read from the recording medium 10.

容器13は、例えば、薬品の容器(アンプル)であり、容器13には、容器13中の薬品の使用期限の日付を表す文字列が印字されている。例えば、このような容器13が病棟から返却されてトレー11に置かれたとき、光学文字認識装置は、移動装置3を用いて容器13をトレー11からローラー8a,8b上に移動させ、ローラー8a,8b上において、容器13に印字された使用期限の日付を光学的に認識する。次いで、光学文字認識装置は、認識された日付に基づいて、容器を保管するか廃棄するかを決定し、移動装置3を用いて、適切な保管庫又はゴミ箱に関連付けられた他のトレー12に容器13を移動させる。   The container 13 is, for example, a medicine container (ampoule), and a character string representing the expiration date of the medicine in the container 13 is printed on the container 13. For example, when such a container 13 is returned from the ward and placed on the tray 11, the optical character recognition device moves the container 13 from the tray 11 onto the rollers 8 a and 8 b using the moving device 3, and the roller 8 a , 8b, the expiration date printed on the container 13 is optically recognized. The optical character recognition device then determines, based on the recognized date, whether to store or discard the container and uses the transfer device 3 to transfer to another tray 12 associated with the appropriate storage or trash. The container 13 is moved.

図2〜図5に、容器13に印字された文字列の例を示す。図2は、第1の例に係る文字列が印字された容器13aを示す上面図である。図3は、第2の例に係る文字列が印字された容器13bを示す上面図である。図4は、第3の例に係る文字列が印字された容器13cを示す上面図である。図5は、第4の例に係る文字列が印字された容器13dを示す上面図である。文字列は、容器に貼られたラベル上に印字されていてもよく、容器上に直接に印字されていてもよい。また、文字列の向きは、円筒形状の容器13の回転軸に平行であってもよく、容器13の回転軸に直交してもよく、又は、これらの向きの文字列が混在していてもよい。   2 to 5 show examples of character strings printed on the container 13. FIG. 2 is a top view showing the container 13a on which the character string according to the first example is printed. FIG. 3 is a top view showing the container 13b on which the character string according to the second example is printed. FIG. 4 is a top view showing the container 13c on which the character string according to the third example is printed. FIG. 5 is a top view showing a container 13d on which a character string according to the fourth example is printed. The character string may be printed on a label attached to the container, or may be printed directly on the container. Further, the direction of the character string may be parallel to the rotation axis of the cylindrical container 13, may be orthogonal to the rotation axis of the container 13, or the character strings in these directions may be mixed. Good.

制御装置1は、入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1の処理手段として動作する。また、制御装置1は、目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2の処理手段として動作する。また、制御装置1は、候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを文字列候補として抽出し、文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物(punctuation mark)とを含む日付のパターンを有するか否かを判断し、文字列候補が日付のパターンを有するとき、文字列候補を日付として認識する第3の処理手段として動作する。   The control device 1 operates as a first processing unit that extracts a target area including an object to be recognized from an input image. In addition, the control device 1 operates as a second processing unit that extracts candidate objects including at least one character string candidate object from the objects included in the target area. In addition, the control device 1 performs labeling of the candidate objects, extracts a plurality of objects extending in a predetermined direction and close to each other as character string candidates, and the character string candidates are two digits representing the year or Judge whether or not it has a date pattern that includes a 4-digit number, a 1- or 2-digit number representing the month, and a predetermined punctuation mark. Operates as a third processing means for recognizing a character string candidate as a date.

以下、図6〜図14を参照して、図1の制御装置1によって実行される日付検出処理について説明する。   Hereinafter, the date detection process executed by the control device 1 of FIG. 1 will be described with reference to FIGS.

図6は、図1の制御装置1によって実行される日付検出処理を示すフローチャートである。制御装置1は、ローラー8a,8bを用いて容器13を一定角度(例えば15度)ずつ回転させながらカメラ5により容器13を撮影して、容器13の異なる角度をそれぞれ表す複数の画像(入力画像)を取得する。カメラ5としては、容器13に印字された文字列を光学的に認識するために十分な解像度を有するものが使用される。例えば、容器13は直径10〜40mmを有し、例えば、容器13を含む120×90mmにわたる範囲を、画素数3840×2748(約1000万画素)で撮影する白黒のカメラが使用される。この場合、容器13上の1mmは32画素に相当する。図6のステップS1において、制御装置1は、容器13の複数の画像のうちの1つを取得する。ステップS2において、制御装置1は、目標領域抽出処理を実行する。   FIG. 6 is a flowchart showing date detection processing executed by the control device 1 of FIG. The control device 1 takes images of the container 13 with the camera 5 while rotating the container 13 by a certain angle (for example, 15 degrees) using the rollers 8a and 8b, and displays a plurality of images (input images) representing different angles of the container 13 respectively. ) To get. As the camera 5, a camera having sufficient resolution for optically recognizing the character string printed on the container 13 is used. For example, the container 13 has a diameter of 10 to 40 mm. For example, a black and white camera that captures a range of 120 × 90 mm including the container 13 with a pixel number of 3840 × 2748 (about 10 million pixels) is used. In this case, 1 mm on the container 13 corresponds to 32 pixels. In step S <b> 1 of FIG. 6, the control device 1 acquires one of the plurality of images of the container 13. In step S2, the control device 1 executes target area extraction processing.

図7は、図6のステップS2における目標領域抽出処理のサブルーチンを示すフローチャートである。   FIG. 7 is a flowchart showing a subroutine of target area extraction processing in step S2 of FIG.

図7のステップS21において、制御装置1は、ステップS1で取得された画像から、予め決められたしきい値よりも高い輝度の部分(例えば照明の反射を含む部分)を抽出する。制御装置1は、例えば画素の輝度が0〜255にわたって変化するとき、例えば220より高い輝度を有する部分を抽出する。図15は、図7のステップS21において抽出された画像中の輝度が高い部分の例を示す図である。ここで、入力画像は、図5の容器13dの画像である。   In step S21 of FIG. 7, the control device 1 extracts a portion having a luminance higher than a predetermined threshold (for example, a portion including illumination reflection) from the image acquired in step S1. For example, when the luminance of the pixel changes from 0 to 255, the control device 1 extracts a portion having a luminance higher than 220, for example. FIG. 15 is a diagram illustrating an example of a portion having a high luminance in the image extracted in step S21 of FIG. Here, the input image is an image of the container 13d in FIG.

次いで、図7のステップS22において、制御装置1は、ステップS1で取得された画像から、円筒形状の容器13の回転軸に実質的に直交する方向に延在する長いエッジ(縦エッジ)を抽出する。容器13の背景にはローラー8a,8bが存在するが、ローラー8a,8bは、容器13の回転軸に平行に延在するので、縦エッジを抽出することでローラー8a,8bの影響を除去することができる。   Next, in step S22 of FIG. 7, the control device 1 extracts a long edge (longitudinal edge) extending in a direction substantially perpendicular to the rotation axis of the cylindrical container 13 from the image acquired in step S1. To do. Although the rollers 8a and 8b exist in the background of the container 13, since the rollers 8a and 8b extend in parallel with the rotation axis of the container 13, the influence of the rollers 8a and 8b is removed by extracting the vertical edge. be able to.

ステップS22においてエッジを抽出するために、次式のソーベル(Sobel)フィルタが使用される。   In order to extract an edge in step S22, the following Sobel filter is used.

Figure 0006344389
Figure 0006344389

ソーベルフィルタにより抽出されたエッジのうち、短いもの、例えば55画素の長さに満たないものは、ノイズとして削除される。図16は、図7のステップS22において抽出された画像中の長い縦エッジの例を示す図である。図5の容器13dの回転軸は図5のX軸に平行であり、従って、ステップS22では、図5のY軸に実質的に平行な方向に延在するエッジが抽出される。   Among the edges extracted by the Sobel filter, short edges, for example, edges shorter than 55 pixels are deleted as noise. FIG. 16 is a diagram illustrating an example of a long vertical edge in the image extracted in step S22 of FIG. The rotation axis of the container 13d in FIG. 5 is parallel to the X axis in FIG. 5. Therefore, in step S22, an edge extending in a direction substantially parallel to the Y axis in FIG. 5 is extracted.

図7のステップS23において、制御装置1は、輝度が高い部分及び縦エッジを含む矩形領域(幅w1×高さh1)を目標領域として抽出し、目標領域の外部の領域を削除する。図17は、図15の輝度が高い部分及び図16の長い縦エッジを重ね合わせた図である。図18は、図15の輝度が高い部分及び図16の長い縦エッジを含む目標領域21を示す図である。目標領域は、認識対象の文字列のオブジェクトを含むと考えられる領域である。   In step S23 of FIG. 7, the control device 1 extracts a rectangular area (width w1 × height h1) including a portion with high brightness and a vertical edge as a target area, and deletes an area outside the target area. FIG. 17 is a diagram in which the high luminance portion of FIG. 15 and the long vertical edge of FIG. 16 are superimposed. FIG. 18 is a diagram illustrating the target area 21 including the high-luminance portion of FIG. 15 and the long vertical edge of FIG. The target area is an area that is considered to include a character string object to be recognized.

再び図6を参照すると、ステップS2の目標領域抽出処理の実行後、ステップS3において、制御装置1は、目標領域の抽出に成功したか否かを判断し、YESのときはステップS4に進み、NOのときはステップS10に進む。ステップS4において、制御装置1は、候補オブジェクト抽出処理を実行する。   Referring to FIG. 6 again, after executing the target area extraction process in step S2, in step S3, the control device 1 determines whether or not the target area has been successfully extracted. If YES, the process proceeds to step S4. If NO, the process proceeds to step S10. In step S4, the control device 1 executes candidate object extraction processing.

図8は、図6のステップS4における候補オブジェクト抽出処理のサブルーチンを示すフローチャートである。   FIG. 8 is a flowchart showing a subroutine of candidate object extraction processing in step S4 of FIG.

図8のステップS31において、制御装置1は、目標領域の画像に対して移動平均フィルタを適用することにより、周囲よりも明るい明オブジェクトを抽出し、画像を2値化する。黒地に白字の文字列は、明オブジェクトとして抽出される。照明の当たり方にムラがあるので、単純な2値化を行うだけではオブジェクトを検出できない。従って、移動平均フィルタを用いた2値化方法(動的しきい値法)を使用する。図21は、図8のステップS31における移動平均フィルタを用いた明オブジェクトの抽出を示す図である。図21に示す原理によれば、制御装置1は、入力画像(ここでは、目標領域の画像)の輝度から、その局所的な平均輝度を計算し、局所的な平均輝度に所定のオフセットを加算した輝度よりも高い輝度を有するオブジェクト(すなわち、周囲と比べて突出した明るさを有するオブジェクト)を、明オブジェクトとして抽出する。局所的な平均輝度を計算するために参照する局所的な領域のサイズは、目標領域全体のサイズに基づいて決定される。図19は、図8のステップS31において抽出された明オブジェクトの例を示す図である。次いで、ステップS32において、制御装置1は、2値化された明オブジェクトの輪郭を検出する。   In step S31 of FIG. 8, the control device 1 applies a moving average filter to the image of the target area, thereby extracting bright objects brighter than the surroundings and binarizing the image. A white character string on a black background is extracted as a bright object. Since lighting is uneven, it is not possible to detect an object by simply performing binarization. Therefore, a binarization method (dynamic threshold method) using a moving average filter is used. FIG. 21 is a diagram illustrating extraction of a bright object using the moving average filter in step S31 of FIG. According to the principle shown in FIG. 21, the control device 1 calculates the local average luminance from the luminance of the input image (here, the image of the target area), and adds a predetermined offset to the local average luminance. An object having a brightness higher than the brightness (that is, an object having a brightness that protrudes from the surroundings) is extracted as a bright object. The size of the local area that is referred to for calculating the local average luminance is determined based on the size of the entire target area. FIG. 19 is a diagram illustrating an example of the bright object extracted in step S31 of FIG. Next, in step S32, the control device 1 detects the contour of the binarized bright object.

次いで、図8のステップS33〜S34では、ステップS31〜S32で明オブジェクトに対して行った処理と同様の処理を、暗オブジェクトに対して行う。ステップS33において、制御装置1は、目標領域の画像に対して移動平均フィルタを適用することにより、周囲よりも暗い暗オブジェクトを抽出し、画像を2値化する。白地に黒字の文字列は、暗オブジェクトとして抽出される。図20は、図8のステップS33において抽出された暗オブジェクトの例を示す図である。ステップS34において、制御装置1は、2値化された暗オブジェクトの輪郭を検出する。   Next, in steps S33 to S34 of FIG. 8, the same processing as that performed on the bright object in steps S31 to S32 is performed on the dark object. In step S33, the control device 1 applies a moving average filter to the image of the target area, thereby extracting dark objects that are darker than the surroundings and binarizing the image. A black character string on a white background is extracted as a dark object. FIG. 20 is a diagram illustrating an example of the dark object extracted in step S33 of FIG. In step S34, the control device 1 detects the binarized dark object contour.

図22Aは、明オブジェクト及び暗オブジェクトを含む画像を示す図である。図22Bは、図22Aの画像からの明オブジェクトの抽出を示す図である。図22Cは、図22Aの画像からの暗オブジェクトの抽出を示す図である。1つの文字列は、明オブジェクト及び暗オブジェクトの一方であると考えられる。図8のステップS31〜S34において明オブジェクト及び暗オブジェクトの両方を抽出しているので、容器13に印字された日付を確実に検出することができる。   FIG. 22A is a diagram illustrating an image including a bright object and a dark object. FIG. 22B is a diagram showing extraction of a bright object from the image of FIG. 22A. FIG. 22C is a diagram illustrating extraction of a dark object from the image of FIG. 22A. One character string is considered to be one of a bright object and a dark object. Since both the bright object and the dark object are extracted in steps S31 to S34 in FIG. 8, the date printed on the container 13 can be reliably detected.

次いで、図8のステップS35において、制御装置1は、次式のソーベルフィルタを用いて、目標領域の画像中のエッジを抽出する。   Next, in step S35 of FIG. 8, the control device 1 extracts an edge in the image of the target area by using the following Sobel filter.

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

ここで、bは、ある画素に演算子Bを適用した結果を示し、cは、同じ画素に演算子Cを適用した結果を示す。図23は、図8のステップS35においてソーベルフィルタを用いて抽出された画像中のエッジの例を示す図である。   Here, b indicates the result of applying the operator B to a certain pixel, and c indicates the result of applying the operator C to the same pixel. FIG. 23 is a diagram showing an example of edges in the image extracted using the Sobel filter in step S35 of FIG.

次いで、図8のステップS36において、制御装置1は、目標領域の画像から、ステップS35で抽出されたエッジ以外の領域を削除する。図24は、図8のステップS36において、ステップS35において抽出されたエッジ以外の領域を削除した後の画像の例を示す図である。次いで、図8のステップS37において、制御装置1は、ステップS36の削除を行った後の画像に対してキャニー(Canny)フィルタを適用し、画像中のエッジを抽出する。   Next, in step S36 of FIG. 8, the control device 1 deletes an area other than the edge extracted in step S35 from the image of the target area. FIG. 24 is a diagram illustrating an example of an image after deleting a region other than the edge extracted in step S35 in step S36 of FIG. Next, in step S37 in FIG. 8, the control device 1 applies a Canny filter to the image after the deletion in step S36, and extracts an edge in the image.

キャニーのエッジ検出方法は、以下の3つのステップを含む。第1のステップとして、画像について、次式の勾配の大きさg(x,y)及び勾配の向きd(x,y)を計算する。   The Canny edge detection method includes the following three steps. As a first step, the gradient magnitude g (x, y) and gradient direction d (x, y) of the following equation are calculated for the image.

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

ここで、f(x,y)は、標準偏差σを有するガウス関数のx方向に関する一次微分と、画素値関数との畳み込みを示し、f(x,y)は、同じガウス関数のy方向に関する一次微分と、画素値関数との畳み込みを示す。Here, f x (x, y) indicates a convolution of the first-order derivative in the x direction of the Gaussian function having the standard deviation σ and the pixel value function, and f y (x, y) is y of the same Gaussian function. The first derivative with respect to the direction and the convolution of the pixel value function are shown.

キャニーのエッジ検出方法の第2のステップとして、勾配の大きさg(x,y)の最大値を求めることで、エッジを検出する。このとき、注目画素の周囲8画素を用いて勾配の向きd(x,y)に対して補間した勾配の大きさを推定し、それらの推定値と比較することにより、注目画素の勾配の大きさg(x,y)が真の最大値を有しているのかを判断する。   As a second step of the Canny edge detection method, an edge is detected by obtaining the maximum value of the gradient magnitude g (x, y). At this time, the magnitude of the gradient of the pixel of interest is estimated by estimating the magnitude of the gradient interpolated with respect to the gradient direction d (x, y) using 8 pixels around the pixel of interest, and comparing with the estimated value. It is determined whether g (x, y) has a true maximum value.

キャニーのエッジ検出方法の第3のステップとして、高いしきい値Th_H及び低いしきい値Th_Lを設定し、ヒステリシスのあるしきい値判断を行う。勾配の大きさg(x,y)が高いしきい値Th_Hよりも大きいとき、その画素をエッジであると判断する。勾配の大きさg(x,y)が低いしきい値Th_Lよりも小さいとき、その画素はエッジではないと判断する。勾配の大きさg(x,y)が高いしきい値Th_H及び低いしきい値Th_Lの間にあるとき、その画素がエッジとして検出された画素に隣接しているときのみ、エッジであると判断する。   As a third step of the Canny edge detection method, a high threshold value Th_H and a low threshold value Th_L are set, and a threshold value with hysteresis is determined. When the gradient magnitude g (x, y) is greater than the high threshold Th_H, the pixel is determined to be an edge. When the gradient magnitude g (x, y) is smaller than the low threshold Th_L, it is determined that the pixel is not an edge. When the gradient magnitude g (x, y) is between the high threshold Th_H and the low threshold Th_L, it is determined that the pixel is an edge only when the pixel is adjacent to a pixel detected as an edge. To do.

本開示の例では、ステップS37において、ガウス関数の標準偏差σ=1.4、高いしきい値Th_H=10、及び低いしきい値Th_L=5を有するキャニーフィルタを用いた。しきい値の可能な値の範囲は、0〜255である。   In the example of the present disclosure, a canny filter having a Gaussian function standard deviation σ = 1.4, a high threshold Th_H = 10, and a low threshold Th_L = 5 is used in step S37. The range of possible values for the threshold is 0-255.

図8のステップ40では、直後のステップS38,S39と、後述する図10のステップS67との両方で使用するために、2種類のキャニーフィルタを用いて2種類のエッジを抽出する。図25は、図8のステップS37においてしきい値15のキャニーフィルタを用いて抽出された画像中のエッジの例を示す図である。図26は、図8のステップS37においてしきい値4のキャニーフィルタを用いて抽出された画像中のエッジの例を示す図である。本開示の例では、図26のエッジをステップS38,S39で使用し、図25のエッジを図10のステップS67で用いた。   In step 40 of FIG. 8, two types of edges are extracted using two types of canny filters for use in both steps S38 and S39 immediately after that and step S67 of FIG. 10 described later. FIG. 25 is a diagram illustrating an example of edges in the image extracted using the Canny filter having the threshold value 15 in step S37 of FIG. FIG. 26 is a diagram illustrating an example of edges in the image extracted using the Canny filter having the threshold value 4 in step S37 of FIG. In the example of the present disclosure, the edge of FIG. 26 is used in steps S38 and S39, and the edge of FIG. 25 is used in step S67 of FIG.

ソーベルフィルタを用いてエッジを抽出すると、高速だが、抽出されるエッジの幅が太くなる。キャニーフィルタを用いてエッジを抽出すると、低速だが、詳細なエッジを抽出できる。一方、本実施形態では、いったんソーベルフィルタを用いてエッジを抽出し(ステップS35)、抽出されたエッジ以外の領域を削除し(ステップS36)、ソーベルフィルタを用いて抽出されたエッジの近傍の領域のみにキャニーフィルタを適用してエッジを抽出し(ステップS37)、このエッジを、目標領域に含まれるオブジェクトのエッジとして使用する。このように、ソーベルフィルタ及びキャニーフィルタを組み合わせることで、キャニーフィルタのみを用いる場合よりも、エッジの抽出が約10倍速くなる。   Extracting an edge using a Sobel filter is fast, but the width of the extracted edge increases. Extracting edges using the Canny filter can extract detailed edges at a low speed. On the other hand, in this embodiment, edges are extracted once using a Sobel filter (step S35), areas other than the extracted edges are deleted (step S36), and the vicinity of the edges extracted using the Sobel filter is used. An edge is extracted by applying a canny filter only to the area (step S37), and this edge is used as an edge of an object included in the target area. Thus, by combining the Sobel filter and the Canny filter, the edge extraction is about 10 times faster than when only the Canny filter is used.

次いで図8のステップS38において、制御装置1は、輪郭及びエッジを有する明オブジェクトであって、輪郭及びエッジが互いに重なり合い、実質的に一致している明オブジェクトを候補オブジェクトとして抽出する。図27は、図8のステップS38において抽出された明オブジェクトの候補オブジェクトの例を示す図である。次いで図8のステップS39において、制御装置1は、輪郭及びエッジを有する暗オブジェクトであって、輪郭及びエッジが互いに重なり合い、実質的に一致している暗オブジェクトを候補オブジェクトとして抽出する。図28は、図8のステップS39において抽出された暗オブジェクトの候補オブジェクトの例を示す図である。   Next, in step S38 in FIG. 8, the control device 1 extracts a bright object having a contour and an edge, the contour and the edge overlapping each other and substantially matching each other as a candidate object. FIG. 27 is a diagram illustrating an example of a bright object candidate object extracted in step S38 of FIG. Next, in step S39 in FIG. 8, the control device 1 extracts dark objects having contours and edges, the contours and edges overlapping each other and substantially matching each other as candidate objects. FIG. 28 is a diagram illustrating an example of dark object candidate objects extracted in step S39 of FIG.

図29Aはオブジェクトの例を示す図である。図29Bはしきい値200を用いて抽出された図29Aの2値化画像を示す図である。図29Cは図29Bの輪郭を示す図である。図29Dはしきい値50を用いて抽出された図29Aのエッジを示す図である。図29Eはしきい値200を用いて抽出された図29Aのエッジを示す図である。図29Fは文字の輪郭及びエッジを示す図である。図29Aのオブジェクトは、例えば画素の輝度が0〜255にわたって変化するとき、輝度0の部分、輝度128の部分、及び輝度255の部分を含む。図29Aのオブジェクトの輪郭は、その2値化画像(図29B)の輪郭として得られる(図29C)。図29Aのオブジェクトのエッジは、輝度が急に変化する部分として得られ、異なるしきい値を用いることにより異なるエッジが抽出される(図29D、図29E)。図29C〜図29Eに示すように、一般に、オブジェクトの輪郭及びエッジは一致するとは限らない。ただし、文字のオブジェクトは常に閉じたエッジを有し、オブジェクトの輪郭及びエッジは一致すると考えられる。従って、実質的に一致した輪郭及びエッジを有するオブジェクトを抽出することにより、文字のオブジェクトを抽出することができる。エッジと輪郭が一致しないオブジェクトは、ノイズとして削除される。   FIG. 29A shows an example of an object. FIG. 29B is a diagram showing the binarized image of FIG. 29A extracted using the threshold value 200. FIG. 29C is a diagram showing an outline of FIG. 29B. FIG. 29D is a diagram showing the edges of FIG. 29A extracted using the threshold value 50. FIG. 29E is a diagram showing the edges of FIG. 29A extracted using the threshold 200. FIG. 29F is a diagram showing the outline and edges of a character. The object in FIG. 29A includes, for example, when the pixel luminance varies from 0 to 255, a luminance 0 portion, a luminance 128 portion, and a luminance 255 portion. The outline of the object in FIG. 29A is obtained as the outline of the binarized image (FIG. 29B) (FIG. 29C). The edge of the object in FIG. 29A is obtained as a portion where the luminance changes suddenly, and different edges are extracted by using different threshold values (FIGS. 29D and 29E). As shown in FIGS. 29C to 29E, generally, the outline and edge of an object do not always match. However, it is considered that the character object always has a closed edge, and the outline and the edge of the object coincide. Therefore, a character object can be extracted by extracting an object having a substantially matched contour and edge. Objects whose edges and contours do not match are deleted as noise.

次いで図6のステップS5において、制御装置1は、候補オブジェクトの抽出に成功したか否かを判断し、YESのときはステップS6に進み、NOのときはステップS10に進む。ステップS6において、制御装置1はOCR処理を実行する。   Next, in step S5 of FIG. 6, the control device 1 determines whether or not the candidate object has been successfully extracted. If YES, the process proceeds to step S6, and if NO, the process proceeds to step S10. In step S6, the control device 1 executes an OCR process.

図9は、図6のステップS6におけるOCR処理のサブルーチンを示すフローチャートである。認識対象の文字列が明オブジェクトであるのか、それとも暗オブジェクトであるのか未知であり、また、認識対象の文字列が図5のX軸に平行に延在するのか、それともY軸に平行に延在するのか未知であるので、これらすべての組み合わせについて図10及び図11のOCRサブルーチンを実行する。認識装置の文字列が明オブジェクトであると仮定するとき、図8のステップS38で抽出された明オブジェクトの候補オブジェクトを用いる。認識装置の文字列が暗オブジェクトであると仮定するとき、図8のステップS39で抽出された暗オブジェクトの候補オブジェクトを用いる。認識装置の文字列がX軸に平行に延在すると仮定するとき、目標領域の画像をそのまま使用する。認識装置の文字列がY軸に平行に延在すると仮定するとき、目標領域の画像を90度回転して使用する。   FIG. 9 is a flowchart showing a subroutine of OCR processing in step S6 of FIG. It is unknown whether the character string to be recognized is a bright object or a dark object, and whether the character string to be recognized extends parallel to the X axis in FIG. 5 or extends parallel to the Y axis. Since it is unknown whether it exists, the OCR subroutine of FIGS. 10 and 11 is executed for all these combinations. When it is assumed that the character string of the recognition device is a bright object, the bright object candidate object extracted in step S38 in FIG. 8 is used. When it is assumed that the character string of the recognition device is a dark object, the dark object candidate object extracted in step S39 in FIG. 8 is used. When it is assumed that the character string of the recognition device extends parallel to the X axis, the image of the target area is used as it is. When it is assumed that the character string of the recognition device extends parallel to the Y axis, the image of the target area is rotated 90 degrees and used.

図9のステップS51において、制御装置1は、認識装置の文字列がX軸に平行に延在する明オブジェクトであると仮定して、OCRサブルーチンを実行する。ステップS52において、制御装置1は、OCRに成功したか否かを判断し、YESのときは図6のステップS7に進み、NOのときはステップS53に進む。ステップS53において、制御装置1は、認識装置の文字列がY軸に平行に延在する明オブジェクトであると仮定して、OCRサブルーチンを実行する。ステップS54において、制御装置1は、OCRに成功したか否かを判断し、YESのときは図6のステップS7に進み、NOのときはステップS55に進む。ステップS55において、制御装置1は、認識装置の文字列がX軸に平行に延在する暗オブジェクトであると仮定して、OCRサブルーチンを実行する。ステップS56において、制御装置1は、OCRに成功したか否かを判断し、YESのときは図6のステップS7に進み、NOのときはステップS57に進む。ステップS57において、制御装置1は、認識装置の文字列がY軸に平行に延在する暗オブジェクトであると仮定して、OCRサブルーチンを実行し、その後、図6のステップS7に進む。   In step S51 of FIG. 9, the control device 1 executes the OCR subroutine on the assumption that the character string of the recognition device is a bright object extending parallel to the X axis. In step S52, the control device 1 determines whether or not the OCR is successful. If YES, the process proceeds to step S7 in FIG. 6, and if NO, the process proceeds to step S53. In step S53, the control device 1 executes the OCR subroutine on the assumption that the character string of the recognition device is a bright object extending in parallel with the Y axis. In step S54, the control device 1 determines whether or not the OCR is successful. If YES, the process proceeds to step S7 in FIG. 6, and if NO, the process proceeds to step S55. In step S55, the control device 1 executes the OCR subroutine on the assumption that the character string of the recognition device is a dark object extending in parallel with the X axis. In step S56, the control device 1 determines whether or not the OCR is successful. If YES, the process proceeds to step S7 in FIG. 6, and if NO, the process proceeds to step S57. In step S57, the control device 1 executes the OCR subroutine on the assumption that the character string of the recognition device is a dark object extending in parallel to the Y axis, and then proceeds to step S7 of FIG.

図10は、図9のステップS51,S53,S55,S57におけるOCRサブルーチンの第1の部分を示すフローチャートである。図11は、図9のステップS51,S53,S55,S57におけるOCRサブルーチンの第2の部分を示すフローチャートである。   FIG. 10 is a flowchart showing a first part of the OCR subroutine in steps S51, S53, S55, and S57 of FIG. FIG. 11 is a flowchart showing a second part of the OCR subroutine in steps S51, S53, S55, and S57 of FIG.

図10のステップS61において、制御装置1は、候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを文字列候補として抽出する。図30は、図10のステップS61において抽出された文字列候補の例を示す図である。図31は、図10のステップS61における文字列候補の抽出を示す図である。図31において、文字列候補を抽出するための文字列候補マスク31は、例えば、幅w2=75画素、高さh2=3画素を有する。ある位置に配置された文字列候補マスク31が候補オブジェクトの画素を1つでも含むとき、文字列候補マスク31内の領域は、文字列候補の一部であると判断される。文字列候補マスク31を目標領域の全体にわたってスキャンし、個別の連結した文字列候補に対してラベルを付与する。   In step S61 of FIG. 10, the control device 1 performs labeling of candidate objects, and extracts a plurality of objects extending in a predetermined direction and close to each other as character string candidates. FIG. 30 is a diagram showing an example of character string candidates extracted in step S61 of FIG. FIG. 31 is a diagram showing extraction of character string candidates in step S61 of FIG. In FIG. 31, a character string candidate mask 31 for extracting character string candidates has, for example, a width w2 = 75 pixels and a height h2 = 3 pixels. When the character string candidate mask 31 arranged at a certain position includes at least one candidate object pixel, the region in the character string candidate mask 31 is determined to be a part of the character string candidate. The character string candidate mask 31 is scanned over the entire target area, and labels are assigned to the individual connected character string candidates.

ステップS61において候補オブジェクトのラベリングを行って文字列候補を抽出するとき、近接した複数の文字列が1つの文字列候補として抽出される可能性がある。従って、いったん文字列候補を文字候補に分離し、各文字候補の特徴量(幅及び高さ)に基づいて、類似した特徴量を有する文字候補を文字列候補として再結合する。図10のステップS62において、制御装置1は、各文字列候補中のオブジェクトのラベリングを行って当該文字列候補に含まれる複数の文字候補を抽出し、各文字候補のバウンディングボックスを生成する。各バウンディングボックスは、文字列候補が延在する方向に平行な幅及び文字列候補が延在する方向に直交する高さを有する矩形形状をそれぞれ有し、各文字候補をそれぞれ包囲する最小外接矩形である。ステップS63において、制御装置1は、各バウンディングボックスを、その幅及び高さに基づいて、当該バウンディングボックスの高さが低いほど当該バウンディングボックスの幅を拡大するように変形する。ステップS64において、制御装置1は、変形により連結されたバウンディングボックスに含まれる文字候補の組を、新たな文字列候補として抽出する。図32は、図10のステップS62において抽出された文字候補及び生成されたバウンディングボックスの例を示す図である。   When labeling candidate objects and extracting character string candidates in step S61, a plurality of adjacent character strings may be extracted as one character string candidate. Therefore, the character string candidates are once separated into character candidates, and character candidates having similar feature values are recombined as character string candidates based on the feature values (width and height) of each character candidate. In step S62 of FIG. 10, the control device 1 performs labeling of objects in each character string candidate, extracts a plurality of character candidates included in the character string candidate, and generates a bounding box for each character candidate. Each bounding box has a rectangular shape having a width parallel to the direction in which the character string candidates extend and a height orthogonal to the direction in which the character string candidates extend, and encloses each character candidate. It is. In step S63, the control device 1 deforms each bounding box so that the width of the bounding box is increased as the height of the bounding box is lower, based on the width and height. In step S64, the control device 1 extracts a set of character candidates included in the bounding boxes connected by deformation as a new character string candidate. FIG. 32 is a diagram illustrating an example of the character candidates extracted in step S62 of FIG. 10 and the generated bounding box.

図33Aは、図10のステップS61において抽出された文字列候補の例を示す図である。図33Bは、図10のステップS62において抽出された文字候補及び生成されたバウンディングボックス42の例を示す図である。図33Cは、図10のステップS63において変形されたバウンディングボックス43の例を示す図である。図33Dは、図10のステップS64において抽出された新たな文字列候補の例を示す図である。図33Aの文字列候補は、2つの文字列「2012.1」及び「abc」を含んでいるが、1つの文字列候補として抽出されている。図33Aには、説明のために、文字列候補のバウンディングボックス41を示す。次に、図33Bに示すように、図33Aの文字列候補中のオブジェクトのラベリングを行って当該文字列候補に含まれる複数の文字候補を抽出し、各文字候補のバウンディングボックス42を生成する。各文字候補のバウンディングボックス42は、幅w3及び高さh3を有する。次に、図33Cに示すように、各バウンディングボックスを、その幅及び高さに基づいて変形する。変形後のバウンディングボックス43の幅w3’及び高さh3’は、次式によって得られる。   FIG. 33A is a diagram showing an example of character string candidates extracted in step S61 of FIG. FIG. 33B is a diagram showing an example of the character candidates extracted in step S62 of FIG. 10 and the generated bounding box 42. FIG. 33C is a diagram illustrating an example of the bounding box 43 modified in step S63 of FIG. FIG. 33D is a diagram showing an example of a new character string candidate extracted in step S64 of FIG. The character string candidates in FIG. 33A include two character strings “2012. 1” and “abc”, but are extracted as one character string candidate. FIG. 33A shows a bounding box 41 of character string candidates for explanation. Next, as shown in FIG. 33B, the objects in the character string candidates in FIG. 33A are labeled to extract a plurality of character candidates included in the character string candidates, and a bounding box 42 for each character candidate is generated. Each character candidate's bounding box 42 has a width w3 and a height h3. Next, as shown in FIG. 33C, each bounding box is deformed based on its width and height. The width w3 'and the height h3' of the bounding box 43 after deformation are obtained by the following equations.

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

ここで、Wは、各文字候補のバウンディングボックス42の幅の最大値であり、Hは、各文字候補のバウンディングボックス42の高さの最大値である。   Here, W is the maximum value of the width of the bounding box 42 of each character candidate, and H is the maximum value of the height of the bounding box 42 of each character candidate.

図33Cに示すように、各文字候補のバウンディングボックスは、高さh3が低いほど幅w3を拡大するように変形される。従って、「.」及び「1」の距離は「1」及び「a」の距離よりも大きいが、変形後のバウンディングボックス43では、「.」及び「1」が連結され、「1」及び「a」が分離されている。図33Dに示すように、変形により連結されたバウンディングボックスに含まれる文字候補の組を、新たな文字列候補として抽出する。図33Dには、説明のために、新たな文字列候補のバウンディングボックス41a,41bを示す。   As shown in FIG. 33C, the bounding box of each character candidate is deformed so that the width w3 is increased as the height h3 is lower. Therefore, although the distance between “.” And “1” is larger than the distance between “1” and “a”, “.” And “1” are connected in the bounding box 43 after deformation, and “1” and “1” a ”is separated. As shown in FIG. 33D, a set of character candidates included in the bounding boxes connected by deformation is extracted as a new character string candidate. FIG. 33D shows new character string candidate bounding boxes 41a and 41b for explanation.

図34Aは、図10のステップS61において抽出された文字列候補の他の例を示す図である。図34Bは、図10のステップS62において抽出された文字候補及び生成されたバウンディングボックス42の他の例を示す図である。ステップS64において、変形により連結されたバウンディングボックスに含まれる文字候補の組が新たな文字列候補として抽出されないとき、図34Aの文字列候補に含まれていたオブジェクトは、ノイズとして削除される。   FIG. 34A is a diagram showing another example of the character string candidates extracted in step S61 of FIG. FIG. 34B is a diagram showing another example of the character candidates extracted in step S62 of FIG. 10 and the generated bounding box 42. In step S64, when the set of character candidates included in the bounding boxes connected by deformation is not extracted as a new character string candidate, the object included in the character string candidate in FIG. 34A is deleted as noise.

次いで、ステップS65〜S67では、誤認識の防止のために、明らかに日付の文字列ではない文字列候補を削除する。   Next, in steps S65 to S67, character string candidates that are clearly not date character strings are deleted to prevent erroneous recognition.

図10のステップS65において、制御装置1は、10個より多数の文字候補を含む文字列候補を削除する。日付の文字列は、たかだか10個以下の文字を含むと考えられる。従って、10個より多数の文字候補を含む文字列候補は、ノイズとして削除される。   In step S65 of FIG. 10, the control device 1 deletes character string candidates including more than ten character candidates. The date string is considered to contain no more than 10 characters. Accordingly, character string candidates including more than 10 character candidates are deleted as noise.

次いでステップS66において、制御装置1は、高さ方向において2個以上のオブジェクトを含む文字候補のみを含む文字列候補を削除する。ここでは、各文字候補において、当該文字候補に含まれるオブジェクトを高さ方向に連結し、連結後のオブジェクトの個数を数える。数字「0」〜「9」は単一の連結されたオブジェクトである。従って、文字列候補が日付であるならば、当該文字列候補に含まれるすべての文字候補が、高さ方向においてただ1つのオブジェクトを含むはずである。しかしながら、日付の文字列であるにもかかわらずノイズなどに起因して高さ方向において2個以上のオブジェクトを含む文字候補が存在する可能性(余分なオブジェクトが存在する場合、連結したオブジェクトが切断されている場合、など)を考慮して、高さ方向において2個以上のオブジェクトを含む文字候補のみを含む文字列候補を、ノイズとして削除する。図36Aは、図10のステップS64において抽出された文字列候補の例を示す図である。図36Bは、図36Aの文字列候補に含まれる各文字候補の高さ方向におけるオブジェクトの個数を示す図である。図36Bの文字候補51の上に、各文字候補の高さ方向におけるオブジェクトの個数を示す。   Next, in step S66, the control device 1 deletes a character string candidate including only a character candidate including two or more objects in the height direction. Here, in each character candidate, the objects included in the character candidate are connected in the height direction, and the number of connected objects is counted. The numbers “0” to “9” are single connected objects. Therefore, if the character string candidate is a date, all the character candidates included in the character string candidate should include only one object in the height direction. However, there is a possibility that there is a character candidate including two or more objects in the height direction due to noise etc. even though it is a date character string (if there are extra objects, the connected objects will be cut In such a case, character string candidates including only character candidates including two or more objects in the height direction are deleted as noise. FIG. 36A is a diagram showing an example of character string candidates extracted in step S64 of FIG. FIG. 36B is a diagram illustrating the number of objects in the height direction of each character candidate included in the character string candidates in FIG. 36A. The number of objects in the height direction of each character candidate is shown on the character candidate 51 in FIG. 36B.

図37Aは、図10のステップS64において抽出された文字列候補の他の例を示す図である。図37Bは、図37Aの文字列候補に含まれる各文字候補の高さ方向におけるオブジェクトの個数を示す図である。図37A及び図37Bは、文字列が縦に延在するにもかかわらず、誤って横に延在するものとして処理している例である。図37Bに示すように、各文字候補の高さ方向におけるオブジェクトの個数はすべて2個以上であるので、図37A及び図37Bの文字列候補は、ノイズとして削除される。   FIG. 37A is a diagram showing another example of the character string candidates extracted in step S64 of FIG. FIG. 37B is a diagram illustrating the number of objects in the height direction of each character candidate included in the character string candidates in FIG. 37A. FIG. 37A and FIG. 37B are examples in which a character string is processed as being erroneously extended horizontally even though it extends vertically. As shown in FIG. 37B, since the number of objects in the height direction of each character candidate is two or more, the character string candidates in FIGS. 37A and 37B are deleted as noise.

次いでステップS67において、制御装置1は、各オブジェクトにおけるエッジの画素が輪郭の画素に一致する部分がエッジの画素の面積(画素数)の60%以下である文字列候補を削除するある領域から明オブジェクト及び暗オブジェクトの候補オブジェクトを抽出したとき、それらの一方にのみ正しい文字列候補が含まれる。正しく抽出された候補オブジェクトでは、そのエッジの画素が輪郭の画素に実質的に一致すると考えられる。一方、他方の候補オブジェクトから抽出された文字列候補は、ノイズとして削除される。オブジェクトのエッジとして、図8のステップS37で抽出されたエッジを使用する。図38Aは、入力画像の例を示す図である。図38Bは、図38Aの画像から抽出された明オブジェクトの候補オブジェクトを示す図である。図38Cは、図38Bの候補オブジェクトの輪郭を示す図である。図38Dは、図38Aの画像から抽出されたエッジを示す図である。図39Aは、入力画像の例を示す図である。図39Bは、図39Aの画像から抽出された暗オブジェクトの候補オブジェクトを示す図である。図39Cは、図39Bの候補オブジェクトの輪郭を示す図である。図39Dは、図39Aの画像から抽出されたエッジを示す図である。図38A及び図39Aの入力画像は、暗オブジェクトを含む。従って、図39Cの輪郭及び図39Dのエッジは実質的に一致しているが、図38Cの輪郭及び図38Dのは一致しない。   Next, in step S67, the control device 1 clears a character string candidate in which a portion where the edge pixel in each object matches the contour pixel is 60% or less of the edge pixel area (number of pixels) from a certain region. When candidate objects of the object and the dark object are extracted, a correct character string candidate is included in only one of them. In a correctly extracted candidate object, it is considered that the edge pixel substantially matches the contour pixel. On the other hand, the character string candidate extracted from the other candidate object is deleted as noise. The edge extracted in step S37 in FIG. 8 is used as the object edge. FIG. 38A is a diagram illustrating an example of an input image. FIG. 38B is a diagram showing bright object candidate objects extracted from the image of FIG. 38A. FIG. 38C is a diagram showing an outline of the candidate object of FIG. 38B. FIG. 38D is a diagram showing edges extracted from the image of FIG. 38A. FIG. 39A is a diagram illustrating an example of an input image. FIG. 39B is a diagram showing dark object candidate objects extracted from the image of FIG. 39A. FIG. 39C is a diagram showing an outline of the candidate object in FIG. 39B. FIG. 39D is a diagram showing edges extracted from the image of FIG. 39A. The input images in FIGS. 38A and 39A include dark objects. Accordingly, the contour of FIG. 39C and the edge of FIG. 39D substantially match, but the contour of FIG. 38C and FIG. 38D do not match.

図35は、図10のステップS65,S66,S67において一部の文字列候補を削除した後の文字列候補の例を示す図である。図30に比較して、ノイズが削減されていることがわかる。   FIG. 35 is a diagram showing an example of character string candidates after deleting some character string candidates in steps S65, S66, and S67 of FIG. Compared to FIG. 30, it can be seen that noise is reduced.

次いで図11のステップS68において、制御装置1は、エッジ強度及び領域輝度判定処理を実行する。   Next, in step S68 of FIG. 11, the control device 1 executes edge strength and area luminance determination processing.

図12は、図11のステップS68におけるエッジ強度及び領域輝度判定処理のサブルーチンを示すフローチャートである。   FIG. 12 is a flowchart showing a subroutine of the edge strength and area brightness determination processing in step S68 of FIG.

図12のステップS90において、制御装置1は、1つの文字列候補を選択する。ステップS91において、制御装置1は、文字候補の領域の輪郭を抽出して膨張させる。ここで、文字候補の領域の輪郭の画素に1画素を付加することにより膨張させる。ステップS92において、制御装置1は、ステップS91において膨張された輪郭に対してキャニーフィルタを適用し、文字列候補の領域のエッジを検出する。ここでは、ガウス関数の標準偏差σ=1、高いしきい値Th_H=30、及び低いしきい値Th_L=10を有するキャニーフィルタを用いた。   In step S90 of FIG. 12, the control device 1 selects one character string candidate. In step S91, the control device 1 extracts and expands the outline of the character candidate region. Here, the pixel is expanded by adding one pixel to the outline pixel of the character candidate area. In step S92, the control device 1 applies a canny filter to the contour expanded in step S91 to detect the edge of the character string candidate region. Here, a Canny filter having a Gaussian function standard deviation σ = 1, a high threshold Th_H = 30, and a low threshold Th_L = 10 was used.

ステップS93において、制御装置1は、文字列候補の領域のエッジ強度の平均edge_M及び偏差edge_Dを計算する。エッジ強度の平均edge_M及び偏差edge_Dに基づき、次式を用いて、エッジ強度の基準範囲の下限edge_L及び上限edge_Hを計算する。   In step S93, the control device 1 calculates the average edge_M and the deviation edge_D of the edge strength of the character string candidate region. Based on the average edge_M and the deviation edge_D of the edge strength, the lower limit edge_L and the upper limit edge_H of the reference range of the edge strength are calculated using the following equations.

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

次いでステップS94において、制御装置1は、文字列候補の領域の輝度の平均I_M及び偏差I_Dを計算する。輝度の平均I_M及び偏差I_Dに基づき、次式を用いて、輝度の基準範囲の下限I_L及び上限I_Hを計算する。   Next, in step S94, the control device 1 calculates the average luminance I_M and deviation I_D of the character string candidate region. Based on the luminance average I_M and the deviation I_D, the lower limit I_L and the upper limit I_H of the luminance reference range are calculated using the following equations.

Figure 0006344389
Figure 0006344389

Figure 0006344389
Figure 0006344389

ステップS95において、制御装置1は、選択された文字列候補における1つの文字候補を選択する。ステップS96において、制御装置1は、選択された文字候補の領域のエッジ強度の平均を計算する。ステップS97において、制御装置1は、選択された文字候補の領域の輝度の平均を計算する。ステップS98において、制御装置1は、選択された文字候補が、基準範囲外のエッジ強度及び輝度を有する場合には、その文字候補を削除する。詳しくは、下限edge_L未満のエッジ強度又は上限edge_Hより大きなエッジ強度を有する文字候補は、ノイズとして削除される。また、下限I_L未満の輝度又は上限I_Hより大きな輝度を有する文字候補は、ノイズとして削除される。   In step S95, the control device 1 selects one character candidate in the selected character string candidate. In step S96, the control device 1 calculates the average edge strength of the selected character candidate region. In step S97, the control device 1 calculates the average brightness of the selected character candidate area. In step S98, when the selected character candidate has edge strength and brightness outside the reference range, the control device 1 deletes the character candidate. Specifically, a character candidate having an edge strength less than the lower limit edge_L or an edge strength greater than the upper limit edge_H is deleted as noise. In addition, character candidates having a luminance lower than the lower limit I_L or a luminance higher than the upper limit I_H are deleted as noise.

次いでステップS99において、制御装置1は、未処理の文字候補があるか否かを判断し、YESのときはステップS95に進み、NOのときはステップS100に進む。ステップS100において、制御装置1は、未処理の文字列候補があるか否かを判断し、YESのときはステップS90に進み、NOのときは図11のステップS69に進む。   Next, in step S99, the control device 1 determines whether or not there is an unprocessed character candidate. If YES, the process proceeds to step S95, and if NO, the process proceeds to step S100. In step S100, the control device 1 determines whether or not there is an unprocessed character string candidate. If YES, the process proceeds to step S90, and if NO, the process proceeds to step S69 in FIG.

図40は、図11のステップS68におけるエッジ強度及び領域輝度判定処理を説明するための入力画像の例を示す図である。図41は、図12のステップS90において選択された文字列候補の例を示す図である。図42は、図11のステップS68におけるエッジ強度及び領域輝度判定処理によって処理された文字列候補の例を示す図である。図40〜図42によれば、エッジ強度及び領域輝度に基づいてノイズが削減されていることがわかる。   FIG. 40 is a diagram illustrating an example of an input image for explaining the edge strength and region luminance determination processing in step S68 of FIG. FIG. 41 is a diagram showing an example of character string candidates selected in step S90 of FIG. FIG. 42 is a diagram illustrating an example of character string candidates processed by the edge strength and region luminance determination processing in step S68 of FIG. 40 to 42, it can be seen that the noise is reduced based on the edge strength and the region luminance.

図11のステップS69において、制御装置1は平均高さ判定処理を実行する。   In step S69 of FIG. 11, the control device 1 executes an average height determination process.

図13は、図11のステップS69における平均高さ判定処理のサブルーチンを示すフローチャートである。ステップS101において、制御装置1は、1つの文字列候補を選択する。ステップS102において、制御装置1は、各文字候補に含まれるオブジェクトを高さ方向に連結する。オブジェクトを高さ方向に連結するために、高さ方向にクロージング処理を行う(すなわち、領域の拡張処理を行い、次いで収縮処理を行う)。ステップS103において、制御装置1は、各文字候補の高さの平均及び偏差を計算し、高さの基準範囲を決定する。高さの基準範囲を決定するために、平均及び偏差を計算することに代えて、文字列候補中の各オブジェクトの高さの中間値を計算してもよい。この場合、例えば、5画素以上かつ高さの中間値の1.1倍以下の範囲を基準範囲としてもよい。ステップS104において、制御装置1は、規定範囲の高さをもたない文字候補を削除し、元の文字列候補から、文字候補の削除により分離された新たな文字列候補を抽出する。図43Aは、図13のステップS101において選択された文字列候補の例を示す図である。図43Bは、図13のステップS104において抽出された新たな文字列候補の例を示す図である。文字候補42aはノイズとして削除され、新たな文字列候補41c,41dが抽出される。次いで図13のステップS105において、制御装置1は、未処理の文字列候補があるか否かを判断し、YESのときはステップS101に進み、NOのときは図11のステップS70に進む。   FIG. 13 is a flowchart showing a subroutine of average height determination processing in step S69 of FIG. In step S101, the control device 1 selects one character string candidate. In step S102, the control device 1 connects the objects included in each character candidate in the height direction. In order to connect the objects in the height direction, a closing process is performed in the height direction (that is, an area expansion process is performed and then a contraction process is performed). In step S103, the control device 1 calculates an average height and deviation of each character candidate, and determines a reference range for the height. In order to determine the reference range of height, instead of calculating the average and the deviation, an intermediate value of the height of each object in the character string candidate may be calculated. In this case, for example, a range of 5 pixels or more and 1.1 times or less of the intermediate height value may be set as the reference range. In step S <b> 104, the control device 1 deletes a character candidate that does not have the height of the specified range, and extracts a new character string candidate separated by deleting the character candidate from the original character string candidate. FIG. 43A is a diagram illustrating an example of the character string candidates selected in step S101 of FIG. FIG. 43B is a diagram showing an example of a new character string candidate extracted in step S104 of FIG. The character candidate 42a is deleted as noise, and new character string candidates 41c and 41d are extracted. Next, in step S105 in FIG. 13, the control device 1 determines whether or not there is an unprocessed character string candidate. If YES, the process proceeds to step S101, and if NO, the process proceeds to step S70 in FIG.

図11のステップS70において、制御装置1は、文字列候補の個数は0であるか否かを判断し、YESのときは図9のステップS52,S54,S56、又は図6のステップS7に進み、NOのときはステップS71に進む。ステップS71において、制御装置1は、1つの文字列候補を選択する。ステップS72において、制御装置1は、日付パターン判定処理を実行する。   In step S70 of FIG. 11, the control device 1 determines whether or not the number of character string candidates is 0. If YES, the control device 1 proceeds to steps S52, S54, S56 of FIG. 9 or step S7 of FIG. If NO, the process proceeds to step S71. In step S71, the control device 1 selects one character string candidate. In step S72, the control device 1 executes date pattern determination processing.

図14は、図11のステップS72,S75における日付パターン判定処理のサブルーチンを示すフローチャートである。   FIG. 14 is a flowchart showing a subroutine of date pattern determination processing in steps S72 and S75 of FIG.

制御装置1は、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む複数の日付パターンを含むテーブルを内部に保持している。「2012年7月」を例にすると、日付は例えば以下のパターンを有する。   The control device 1 stores therein a table including a plurality of date patterns including a two-digit or four-digit number representing a year, a one-digit or two-digit number representing a month, and a predetermined punctuation mark. ing. Taking “July 2012” as an example, the date has the following pattern, for example.

[表1]
―――――――――――――――――――――――――――――――――
(1)「2012.07」 数字4桁+ピリオド+数字2桁
(2)「2012.7」 数字4桁+ピリオド+数字1桁
(3)「2012−07」 数字4桁+ハイフン+数字2桁
(4)「2012−7」 数字4桁+ハイフン+数字1桁
(5)「’12.07」 アポストロフィ+数字2桁+ピリオド+数字2桁
(6)「’12.7」 アポストロフィ+数字2桁+ピリオド+数字1桁
(7)「2012,07」 (1)のピリオドが汚れている場合の予防措置
(8)「2012,7」 (2)のピリオドが汚れている場合の予防措置
―――――――――――――――――――――――――――――――――
[Table 1]
―――――――――――――――――――――――――――――――――
(1) “2012.07” 4 digits + period + 2 digits (2) “20122.7” 4 digits + period + 1 digit (3) “2012-07” 4 digits + hyphen + number 2 Digit (4) “2012-7” 4 digits + hyphen + 1 digit (5) “'12 .07” Apostrophe + 2 digits + period + 2 digits (6) “'12 .7” Apostrophe + numbers 2 digits + period + 1 digit (7) "201207" Precautions when period (1) is dirty (8) "2012, 7" Precautions when period (2) is dirty ―――――――――――――――――――――――――――――――――

各日付パターンは、数字及び約物がどのように並んでいるのかを特定する。   Each date pattern specifies how numbers and punctuation are arranged.

図14のステップS111において、制御装置1は、文字列候補に対して英数字用OCRを行う。ステップS112において、制御装置1は、内部のテーブルに保持した日付パターンのうち1つの日付パターンを選択する。制御装置1は、以下のステップにおいて、ステップS111で認識された文字列が、ステップS112で選択された日付パターンに一致するか否かを判断する。ステップS113において、制御装置1は、文字列は日付パターンに一致したか否かを判断し、YESのときはステップS114に進み、NOのときはステップS115に進む。ステップS114において、制御装置1は、文字列は「明らかに数字と間違えることのない英字」を含むか否かを判断し、YESのときはステップS115に進み、NOのときはステップS117に進む。「明らかに数字と間違えることのない英字」は、例えば、「O」、「o」、「C」、「c」、「U」、「u」、「Z」、「z」、「n」、「L」、「l」、「I」、「J」、「D」を含む。文字列が「明らかに数字と間違えることのない英字」を含むとき、文字列を日付ではないものとして認識する。ステップS115において、制御装置1は、すべての日付パターンを使用したか否かを判断し、YESのときは図11のステップS73(又はステップS76)に進み、NOのときはステップS112に戻り、他の日付パターンを選択する。ステップS117において、制御装置1は、文字列中の文字の高さは一定であるか否かを判断し、YESのときはステップS116に進み、NOのときはステップS113に戻る。ステップS116において、制御装置1は、文字列は英字を含むか否かを判断し、YESのときはステップS117に進み、NOのときはステップS118に進む。ステップS117において、制御装置1は、文字列候補に対して数字用OCRを行い、文字列候補が英字を含んでいても、それを数字として認識する。   In step S111 of FIG. 14, the control device 1 performs OCR for alphanumeric characters on the character string candidate. In step S112, the control device 1 selects one date pattern from the date patterns held in the internal table. In the following steps, the control device 1 determines whether or not the character string recognized in step S111 matches the date pattern selected in step S112. In step S113, the control device 1 determines whether or not the character string matches the date pattern. If YES, the process proceeds to step S114, and if NO, the process proceeds to step S115. In step S114, the control device 1 determines whether or not the character string includes “alphabetic characters that are clearly not mistaken for numbers”. If YES, the process proceeds to step S115. If NO, the process proceeds to step S117. “A letter that is clearly not mistaken for a number” is, for example, “O”, “o”, “C”, “c”, “U”, “u”, “Z”, “z”, “n”. , “L”, “l”, “I”, “J”, “D”. When the character string includes “alphabetic characters that are clearly not mistaken for numbers”, the character string is recognized as not a date. In step S115, the control device 1 determines whether or not all date patterns have been used. If YES, the control device 1 proceeds to step S73 (or step S76) in FIG. 11, and if NO, the process returns to step S112. Select a date pattern. In step S117, the control device 1 determines whether or not the height of the character in the character string is constant. If YES, the process proceeds to step S116, and if NO, the process returns to step S113. In step S116, the control device 1 determines whether or not the character string includes alphabetic characters. If YES, the process proceeds to step S117, and if NO, the process proceeds to step S118. In step S117, the control device 1 performs OCR for numbers on the character string candidate, and recognizes that the character string candidate includes an alphabetic character as a number.

ステップS117の後で、傾き補正を行ってもよい。傾き補正を行うことにより、「1」を含む文字列を誤りなく認識することができる。   After step S117, tilt correction may be performed. By performing the inclination correction, a character string including “1” can be recognized without error.

図14のステップS118において、制御装置1は、文字列は日付であるか否かを判断し、YESのときは図11のステップS73(又はステップS76)に進み、NOのときはステップS113に戻る。   In step S118 of FIG. 14, the control device 1 determines whether or not the character string is a date. If YES, the process proceeds to step S73 (or step S76) of FIG. 11, and if NO, the process returns to step S113. .

図11のステップS73において、制御装置1は、日付パターンの判定に成功したか否かを判断し、YESのときは図9のステップS52,S54,S56、又は図6のステップS7に進み、NOのときはステップS74に進む。ステップS74において、制御装置1は、文字列候補を180度回転する。ステップS75において、制御装置1は、180度回転された文字列候補に対して、前述のものと同じ日付パターン判定処理を実行する。ステップS76において、制御装置1は、日付パターンの判定に成功したか否かを判断し、YESのときは図9のステップS52,S54,S56、又は図6のステップS7に進み、NOのときはステップS77に進む。ステップS77において、制御装置1は、未処理の文字列候補があるか否かを判断し、YESのときはステップS71に戻り、NOのときは図9のステップS52,S54,S56、又は図6のステップS7にステップSに進む。   In step S73 in FIG. 11, the control device 1 determines whether or not the date pattern has been successfully determined. If YES, the process proceeds to steps S52, S54, S56 in FIG. 9 or step S7 in FIG. If YES, go to step S74. In step S74, the control device 1 rotates the character string candidate by 180 degrees. In step S75, the control device 1 executes the same date pattern determination process as described above for the character string candidate rotated by 180 degrees. In step S76, the control device 1 determines whether or not the date pattern has been successfully determined. If YES, the control device 1 proceeds to steps S52, S54, S56 in FIG. 9 or step S7 in FIG. 6, and if NO, Proceed to step S77. In step S77, the control device 1 determines whether or not there is an unprocessed character string candidate. If YES, the process returns to step S71. If NO, step S52, S54, S56 in FIG. 9 or FIG. The process proceeds to step S7.

図6のステップS7において、制御装置1は、OCRに成功したか否か、すなわち、使用期限の日付を表す文字列の抽出に成功したか否かを判断し、YESのときはステップS8に進み、NOのときはステップS10に進む。月が「1」であると認識した場合、実際には「10」〜「12」であるところ、容器13の角度などに起因して誤って「1」であると認識している可能性がある。以下のステップでは、1つの入力画像に係る文字列候補が月を表す数字として「1」のみを含むとき、他の入力画像に係る文字列候補が月を表す数字として「1」のみを含むか否かを判断する。ステップS8において、制御装置1は、月は「1」であるか否かを判断し、YESのときはステップS9に進み、NOのときはステップS12に進む。ステップS9において、制御装置1は、同じ日付を2回検出したか否かを判断し、YESのときはステップS12に進み、NOのときはステップS10に進む。ステップS10において、制御装置1は、容器13を1周させたか否かを判断し、YESのときはステップS13に進み、NOのときはステップS11に進む。ステップS11において、制御装置1は、容器13を回転させる。例えば、容器13を15度ずつ回転させる場合には、合計で24個の入力画像を取得することができる。また、容器13の直径が異なる場合であっても一定の角度毎に画像を取得するために、容器13を2周にわたって回転させて直径を検出し、一定の時間間隔で容器13の画像を取得しながら、その直径に応じて異なる速度で容器13を回転させてもよい。ステップS12において、制御装置1は、日付を出力する。ステップS13において、制御装置1は、エラーを出力する。   In step S7 of FIG. 6, the control device 1 determines whether or not the OCR has succeeded, that is, whether or not the character string representing the expiration date has been successfully extracted. If YES, the process proceeds to step S8. If NO, the process proceeds to step S10. When the month is recognized as “1”, it is actually “10” to “12”, but may be erroneously recognized as “1” due to the angle of the container 13 or the like. is there. In the following steps, when a character string candidate related to one input image includes only “1” as a number representing the month, does a character string candidate related to another input image include only “1” as a number representing the month? Judge whether or not. In step S8, the control device 1 determines whether or not the month is “1”. If YES, the process proceeds to step S9, and if NO, the process proceeds to step S12. In step S9, the control device 1 determines whether or not the same date has been detected twice. If YES, the process proceeds to step S12. If NO, the process proceeds to step S10. In step S10, the control device 1 determines whether or not the container 13 has made one turn, the process proceeds to step S13 if YES, and the process proceeds to step S11 if NO. In step S <b> 11, the control device 1 rotates the container 13. For example, when the container 13 is rotated by 15 degrees, a total of 24 input images can be acquired. In addition, even when the diameter of the container 13 is different, the diameter of the container 13 is detected by rotating the container 13 over two rounds in order to acquire an image at every fixed angle, and the image of the container 13 is acquired at a constant time interval However, the container 13 may be rotated at different speeds depending on the diameter. In step S12, the control device 1 outputs a date. In step S13, the control device 1 outputs an error.

以上説明したように、本実施形態に係る光学文字認識装置によれば、文字列の画像に含まれるさまざまなノイズを、文字列を光学的に認識する前に予め除去することにより、従来よりも高い精度で日付を表す文字列を認識することができる。   As described above, according to the optical character recognition device according to the present embodiment, various noises included in the image of the character string are removed in advance before optically recognizing the character string. A character string representing a date can be recognized with high accuracy.

入力画像は、円筒形状の容器の画像に限定されず、他の画像であってもよい(平坦な物体の画像、又は任意の画像データ)。   The input image is not limited to an image of a cylindrical container, and may be another image (a flat object image or arbitrary image data).

制御装置1が外部のPC9に接続されているとき、図6〜図14の日付検出処理は、少なくとも部分的にPC9によって実行されてもよい。   When the control device 1 is connected to the external PC 9, the date detection process of FIGS. 6 to 14 may be executed at least partially by the PC 9.

以上説明したように日付を表す文字列を認識する光学文字認識方法を実施してもよい。また、そのような光学文字認識方法は、コンピュータによって実行されたときに文字列を光学的に認識するコンピュータプログラムとして実施されてもよい。また、そのようなコンピュータプログラムは、コンピュータにより読み取り可能な記録媒体に格納されてもよい。例えば、図1の記録媒体10にそのようなコンピュータプログラムを格納し、PC9は、記録媒体10からコンピュータプログラムを読み取ったとき、当該コンピュータプログラムに従って光学文字認識方法を実施する。   As described above, an optical character recognition method for recognizing a character string representing a date may be performed. Such an optical character recognition method may be implemented as a computer program that optically recognizes a character string when executed by a computer. Such a computer program may be stored in a computer-readable recording medium. For example, such a computer program is stored in the recording medium 10 of FIG. 1, and when the PC 9 reads the computer program from the recording medium 10, the optical character recognition method is performed according to the computer program.

第2の実施形態.
第1の実施形態に係る光学文字認識装置は、日付が予め決められた約物を含み、通常の書体を有する文字で印字されていれば、従来よりも高い精度で日付を表す文字列を認識することができる。しかしながら、特殊な約物を含む日付(例えば、「2015/5」、「2015 5」)、特殊な書体(例えば、互いに分離した複数のドットからなるもの)を有する文字で印字された日付、など(以下、特殊パターンという)を認識するためには、図6〜図14の日付検出処理におけるさまざまな判断の条件(しきい値など)を緩和して、多数の文字列候補を抽出する必要がある。日付検出処理における判断の条件を緩和すると、ノイズが増大し、日付検出処理を実行するのに必要な時間が長くなるので、実行時間の増大を抑えながら、特殊パターンの日付を認識できることが望まれる。
Second embodiment.
The optical character recognition device according to the first embodiment recognizes a character string representing a date with higher accuracy than before if the date includes a predetermined punctuation and is printed with characters having a normal typeface. can do. However, dates that include special punctuation (for example, “2015/5”, “2015 5”), dates printed with characters that have special typefaces (for example, a plurality of dots separated from each other), etc. In order to recognize (hereinafter, referred to as a special pattern), it is necessary to extract a large number of character string candidates by relaxing various judgment conditions (threshold values, etc.) in the date detection processing of FIGS. is there. Relaxing the judgment conditions in the date detection process increases noise and increases the time required to execute the date detection process, so it is desirable to be able to recognize the date of the special pattern while suppressing an increase in execution time. .

図44は、本発明の第2の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理を示すフローチャートである。図44のステップS1〜S12は、図6のステップS1〜S12と同様である。図44の日付検出処理は、図1のステップS13に代えて、ステップS14の特殊パターンの日付検出処理を含む。ステップS14の特殊パターンの日付検出処理では、図44のステップS2、S4、及びS6で用いたものよりも緩和した判断の条件(しきい値など)を設定して、図6の日付検出処理を実行する。特殊パターンの日付が印字された容器の種類及び数量は少なく、大部分の容器に印字された日付は、ある程度限定的な条件を設定した日付検出処理を実行することにより認識することができる。   FIG. 44 is a flowchart showing date detection processing executed by the control device 1 of the optical character recognition device according to the second embodiment of the present invention. Steps S1 to S12 in FIG. 44 are the same as steps S1 to S12 in FIG. The date detection process in FIG. 44 includes a special pattern date detection process in step S14 instead of step S13 in FIG. In the date detection process of the special pattern in step S14, the judgment conditions (threshold value, etc.) that are more relaxed than those used in steps S2, S4, and S6 of FIG. 44 are set, and the date detection process of FIG. Run. There are few types and quantities of containers on which the date of the special pattern is printed, and the dates printed on most containers can be recognized by executing a date detection process in which limited conditions are set to some extent.

図44の日付検出処理によれば、図44のステップS1〜S11を実行して日付の文字列を認識できなかったときのみ、ステップS14の特殊パターンの日付検出処理を実行するので、実行時間の増大を抑えながら、特殊パターンの日付を認識することができる。   According to the date detection process of FIG. 44, the date detection process of the special pattern of step S14 is executed only when the character string of the date is not recognized by executing steps S1 to S11 of FIG. The date of the special pattern can be recognized while suppressing the increase.

第3の実施形態.
第1の実施形態に係る光学文字認識装置によれば、容器13の異なる角度をそれぞれ表す複数の画像(入力画像)を取得するので、日付の文字列が円筒形状の容器の回転軸に直交しているとき(図3及び図4)、日付の全体が1つ画像中に入らない可能性がある。日付の文字列が、円筒形状の容器の側面の半周以上にわたっているときは、日付の全体を含む画像を取得することができない。
Third embodiment.
According to the optical character recognition device according to the first embodiment, since a plurality of images (input images) each representing different angles of the container 13 are acquired, the date character string is orthogonal to the rotation axis of the cylindrical container. (FIGS. 3 and 4), there is a possibility that the entire date does not fit in the image. When the date string extends over a half circumference of the side surface of the cylindrical container, an image including the entire date cannot be acquired.

図45は、本発明の第3の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理を示すフローチャートである。図45のステップS1〜S12は、図6のステップS1〜S12と同様である。図45の日付検出処理は、図1のステップS13に代えて、ステップS15の連結画像の日付検出処理を含む。図46は、図45のステップS15における連結画像の日付検出処理のサブルーチンを示すフローチャートである。前述のように、制御装置1は、ローラー8a,8bを用いて容器13を一定角度ずつ回転させながらカメラ5により容器13を撮影して、容器13の異なる角度をそれぞれ表す複数の画像を取得する。図46のステップS1Aにおいて、制御装置1は、容器13の互いに隣接する部分を含む複数の画像を連結して1つの連結画像を生成する。詳しくは、制御装置1は、互いに隣接する2画像において類似のオブジェクトを認識することにより、これらの画像を連結する。連結画像は、容器の側面を展開した平面画像である。制御装置1は、容器13の曲面で湾曲している部分については、容器13の幅を円柱の直径として、射影変換を用いて平面に補正する。図46のステップS2〜S9、S12、及びS13は、図6のステップステップS2〜S9、S12、及びS13と同様である。   FIG. 45 is a flowchart showing date detection processing executed by the control device 1 of the optical character recognition device according to the third embodiment of the present invention. Steps S1 to S12 in FIG. 45 are the same as steps S1 to S12 in FIG. The date detection process in FIG. 45 includes a date detection process for linked images in step S15 instead of step S13 in FIG. FIG. 46 is a flowchart showing a subroutine of date detection processing for linked images in step S15 of FIG. As described above, the control device 1 photographs the container 13 with the camera 5 while rotating the container 13 by a certain angle using the rollers 8a and 8b, and acquires a plurality of images representing different angles of the container 13, respectively. . In step S1A of FIG. 46, the control device 1 connects a plurality of images including portions adjacent to each other of the container 13 to generate one connected image. Specifically, the control device 1 connects these images by recognizing a similar object in two adjacent images. The connected image is a planar image in which the side surface of the container is developed. The control device 1 corrects the curved portion of the container 13 to a plane using projective transformation, with the width of the container 13 as the diameter of the cylinder. Steps S2 to S9, S12, and S13 in FIG. 46 are the same as steps S2 to S9, S12, and S13 in FIG.

連結画像の生成にはある程度の時間がかかるので、制御装置1は、図45のステップS15を実行する前に、連結画像を予め生成しておいてもよい。   Since it takes a certain amount of time to generate a connected image, the control device 1 may generate a connected image in advance before executing step S15 of FIG.

従来、円筒形状の物体の側面の画像を生成するために、ラインカメラが知られている。しかしながら、ラインカメラを用いるためには、ラインカメラ自体のコストがかかることに加えて、物体を高い精度で回転させるための機構を設けることのコストがかかる。薬品の容器はさまざまな形状及びサイズを有するので、ラインカメラによる撮影のために十分な精度で回転させるためのコストは非常に大きくなる。一方、図45の日付検出処理によれば、通常のカメラにより撮影された複数の画像を連結して連結画像を生成することで、コストの増大を抑えることができる。   Conventionally, a line camera is known for generating an image of a side surface of a cylindrical object. However, in order to use a line camera, in addition to the cost of the line camera itself, there is a cost to provide a mechanism for rotating an object with high accuracy. Since the medicine container has various shapes and sizes, the cost for rotating the medicine container with sufficient accuracy for photographing with a line camera becomes very large. On the other hand, according to the date detection process of FIG. 45, it is possible to suppress an increase in cost by connecting a plurality of images captured by a normal camera to generate a connected image.

図45の日付検出処理によれば、図45のステップS1〜S11を実行して日付の文字列を認識できなかったときのみ、ステップS15の連結画像の日付検出処理を実行するので、実行時間の増大を抑えながら、1つ画像中に入らない日付を認識することができる。   According to the date detection process of FIG. 45, the date detection process of the linked image in step S15 is executed only when the character string of the date cannot be recognized by executing steps S1 to S11 of FIG. Dates that do not fall within one image can be recognized while suppressing the increase.

第4の実施形態.
日付の文字列の直後(右側)に他の文字(「O」、「J」、「Z」など)があるとき、他の文字が日付の一部であると誤って認識される可能性がある。従って、このような日付の一部ではない他の文字を文字列候補から除去する必要がある。
Fourth embodiment.
When there are other characters ("O", "J", "Z", etc.) immediately after (right side) the date string, there is a possibility that other characters may be mistakenly recognized as part of the date. is there. Therefore, it is necessary to remove other characters that are not part of the date from the character string candidates.

図47は、本発明の第4の実施形態に係る光学文字認識装置の制御装置1によって実行される日付検出処理の日付パターン判定処理のサブルーチンを示すフローチャートである。図47の日付パターン判定処理は、図11のステップS72及びS75において実行され、図14のステップS113及びS114の間に追加のステップS121及びS122を含む。図47のステップS121において、制御装置1は、日付パターンに一致した文字列の月を表す数字が「10」、「11」、「12」のいずれかであるとき、以下に説明する基準に基づいて、日付の後に他の文字があるか否かを判断し、YESのときはステップS122に進み、NOのときはステップS114に進む。   FIG. 47 is a flowchart showing a subroutine of date pattern determination processing of date detection processing executed by the control device 1 of the optical character recognition device according to the fourth embodiment of the present invention. The date pattern determination process in FIG. 47 is executed in steps S72 and S75 in FIG. 11, and includes additional steps S121 and S122 between steps S113 and S114 in FIG. In step S121 of FIG. 47, when the number representing the month of the character string matching the date pattern is any one of “10”, “11”, and “12”, the control device 1 is based on the criteria described below. Whether or not there are other characters after the date is determined. If YES, the process proceeds to step S122. If NO, the process proceeds to step S114.

図48は、日付の文字列及び他の文字を含む文字列候補の例を示す図である。日付「2016.1」の後に他の文字「CJ932」が存在する。「C」を誤って「0」と認識すると、日付パターンに一致した文字列が誤って「2016.10」と認識される。制御装置1は、日付の文字列「2016.10」を検出したとき、その最後の「0」が実際に日付の一部であるのか否かを判断する。   FIG. 48 is a diagram illustrating an example of a character string candidate including a date character string and other characters. Another character “CJ932” exists after the date “20166.1”. If “C” is mistakenly recognized as “0”, the character string matching the date pattern is mistakenly recognized as “2016.10”. When detecting the date character string “2016.10”, the control device 1 determines whether or not the last “0” is actually a part of the date.

図48の文字間の距離D1〜D10は、画素数を単位として、例えば以下の通りである。   The distances D1 to D10 between characters in FIG. 48 are, for example, as follows, with the number of pixels as a unit.

[表2]
――――――――――――――
D1=50.4231
D2=49.8108
D3=43.7262
D4=44.1873
D5=82.874
D6=82.8974
D7=55.6709
D8=39.335
D9=49.1936
D10=45.8404
――――――――――――――
[Table 2]
――――――――――――――
D1 = 50.4231
D2 = 49.8108
D3 = 43.7262
D4 = 44.1873
D5 = 82.874
D6 = 82.8974
D7 = 55.6709
D8 = 39.335
D9 = 49.1936
D10 = 45.8404
――――――――――――――

「2016.10」の最後の「0」が日付の一部であるか否かを判断するために、まず、日付の文字間の距離D1〜D6を比較する場合を考える。この場合、最後の「1」と「0」との距離(「1」と「C」との距離)D6が、「.」と「1」との距離D5と同程度であるので、「2016.10」の最後の「0」が日付の一部ではないと判断できない。   In order to determine whether or not the last “0” of “2016.10” is a part of the date, first, consider a case where the distances D1 to D6 between the date characters are compared. In this case, the distance between the last “1” and “0” (the distance between “1” and “C”) D6 is approximately the same as the distance D5 between “.” And “1”. .10 ”cannot be determined as the last“ 0 ”is not part of the date.

本実施形態では、「2016.10」の最後の「0」が日付の一部であるか否かを判断するために、距離D6と、「2016.10」の後の文字間の距離D7〜D10の平均値とを比較する。距離D6が距離D7〜D10の平均値よりも大きいとき、制御装置1は、「2016.10」の最後の「0」が日付の一部ではないと判断し、ステップS122において文字「CJ932」を除去する。一方、距離D6が距離D7〜D10の平均値以下であるとき、制御装置1は、「2016.10」の最後の「0」が日付の一部であると判断する。これにより、日付の文字列の直後に他の文字があっても、高い精度で日付を表す文字列を認識することができる。   In the present embodiment, in order to determine whether or not the last “0” of “2016.10” is part of the date, the distance D6 and the distance D7 between characters after “2016.10.” The average value of D10 is compared. When the distance D6 is larger than the average value of the distances D7 to D10, the control device 1 determines that the last “0” of “2016.10” is not part of the date, and in step S122, the character “CJ932” is determined. Remove. On the other hand, when the distance D6 is equal to or less than the average value of the distances D7 to D10, the control device 1 determines that the last “0” of “2016.10” is a part of the date. Thereby, even if there is another character immediately after the date character string, the character string representing the date can be recognized with high accuracy.

以上説明したように、制御装置1は、文字列候補が、月を表す2つの数字と、月を表す2つの数字に後続する少なくとも1つの他の文字とを含むとき、かつ、月を表す2つの数字間の距離が、月を表す2つの数字と他の文字との距離及び他の文字間の距離の平均値より大きいとき(ステップS121)、月を表す2つの数字の1の位の数字及び他の文字を除去する(ステップS122)。   As described above, the control device 1 uses the character string candidate when the character string candidate includes two numbers representing the month and at least one other character following the two numbers representing the month, and 2 representing the month. When the distance between two numbers is greater than the average of the distance between the two numbers representing the month and other characters and the distance between the other characters (step S121), the first digit of the two numbers representing the month And other characters are removed (step S122).

本発明の光学文字認識装置、光学文字認識方法、コンピュータプログラム、及び記録媒体は、従来よりも高い精度で日付を表す文字列を認識することができる。   The optical character recognition device, the optical character recognition method, the computer program, and the recording medium of the present invention can recognize a character string representing a date with higher accuracy than before.

1…制御装置、
2…レール、
3…移動装置、
4〜6…カメラ、
7a,7b…照明装置、
8a,8b…ローラー、
9…パーソナルコンピュータ(PC)、
10…記録媒体、
11,12…トレー、
13,13a〜13d…容器、
21…目標領域、
22…トリミングされた目標領域、
31…文字列候補マスク、
41…文字列候補のバウンディングボックス、
41a,41b…新たな文字列候補のバウンディングボックス、
42,42a…文字候補のバウンディングボックス、
43…変形された文字候補のバウンディングボックス、
51…文字候補。
1 ... Control device,
2 ... Rail,
3 ... mobile device,
4-6 ... Camera,
7a, 7b ... lighting device,
8a, 8b ... rollers,
9 ... Personal computer (PC),
10: Recording medium,
11,12 ... Tray,
13, 13a-13d ... container,
21 ... Target area,
22 ... Trimmed target area,
31 ... Character string candidate mask,
41 ... The bounding box of the character string candidate,
41a, 41b ... bounding boxes for new character string candidates,
42, 42a ... A bounding box of character candidates,
43 ... A bounding box of transformed character candidates,
51 ... Character candidate.

Claims (17)

文字列を光学的に認識する光学文字認識装置において、上記光学文字認識装置は、
容器の画像又は上記容器に貼られたラベルの画像を含む入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1の処理手段と、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2の処理手段と、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3の処理手段と
上記第3の処理手段により認識された日付に基づいて、上記容器を少なくとも1つの保管庫に保管するか否かを判断する第4の処理手段とを備えたことを特徴とする光学文字認識装置。
In an optical character recognition device that optically recognizes a character string, the optical character recognition device includes:
A first processing means for extracting a target area including an object to be recognized from an input image including an image of a container or an image of a label attached to the container ;
Second processing means for extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. Third processing means for recognizing column candidates as dates ;
An optical character recognition device comprising: a fourth processing unit for determining whether or not to store the container in at least one storage, based on the date recognized by the third processing unit. .
上記第2の処理手段は、
上記目標領域に含まれるオブジェクトの輪郭及びエッジを検出し、
互いに重なり合う輪郭及びエッジを有するオブジェクトを上記候補オブジェクトとして抽出することを特徴とする請求項1記載の光学文字認識装置。
The second processing means includes
Detect the contour and edge of the object included in the target area,
2. The optical character recognition apparatus according to claim 1, wherein an object having an outline and an edge that overlap each other is extracted as the candidate object.
上記第2の処理手段は、
上記目標領域にソーベルフィルタを適用して第1のエッジを検出し、
上記第1のエッジの近傍の領域にキャニーフィルタを適用して第2のエッジを検出し、
上記第2のエッジを、上記目標領域に含まれるオブジェクトのエッジとして使用することを特徴とする請求項2記載の光学文字認識装置。
The second processing means includes
Applying a Sobel filter to the target area to detect the first edge;
Applying a canny filter to a region in the vicinity of the first edge to detect a second edge;
The optical character recognition apparatus according to claim 2, wherein the second edge is used as an edge of an object included in the target area.
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
上記文字列候補が延在する方向に平行な幅及び上記文字列候補が延在する方向に直交する高さを有する矩形形状をそれぞれ有し、上記各文字候補をそれぞれ包囲する複数のバウンディングボックスを生成し、
上記各バウンディングボックスを、当該バウンディングボックスの高さが低いほど当該バウンディングボックスの幅を拡大するように変形し、
変形により連結されたバウンディングボックスに含まれる文字候補の組を、新たな文字列候補として抽出することを特徴とする請求項1〜3のうちのいずれか1つに記載の光学文字認識装置。
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
A plurality of bounding boxes each having a rectangular shape having a width parallel to a direction in which the character string candidates extend and a height orthogonal to the direction in which the character string candidates extend, and surrounding each of the character candidates. Generate and
Each of the bounding boxes is deformed so that the width of the bounding box is increased as the height of the bounding box is lower.
The optical character recognition apparatus according to claim 1, wherein a set of character candidates included in bounding boxes connected by deformation is extracted as a new character string candidate.
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
10個より多数の文字候補を含む文字列候補を削除することを特徴とする請求項1〜4のうちのいずれか1つに記載の光学文字認識装置。
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
The optical character recognition apparatus according to claim 1, wherein a character string candidate including more than ten character candidates is deleted.
上記第3の処理手段は、
上記文字列候補のオブジェクトのラベリングを行って複数の文字候補を抽出し、
上記文字列候補が延在する方向に直交する方向において2個以上のオブジェクトを含む文字候補のみを含む文字列候補を削除することを特徴とする請求項1〜5のうちのいずれか1つに記載の光学文字認識装置。
The third processing means includes
Label the above character string candidate objects to extract multiple character candidates,
The character string candidate including only a character candidate including two or more objects in a direction orthogonal to a direction in which the character string candidate extends is deleted. The optical character recognition device described.
上記第3の処理手段は、
上記文字列候補のオブジェクトの輪郭及びエッジを検出し、
上記エッジの画素が上記輪郭の画素に一致する部分が上記エッジの画素の面積の60%以下である文字列候補を削除することを特徴とする請求項1〜6のうちのいずれか1つに記載の光学文字認識装置。
The third processing means includes
Detect the contours and edges of the above character string candidate objects,
7. The character string candidate in which a portion where the edge pixel coincides with the contour pixel is 60% or less of the area of the edge pixel is deleted. The optical character recognition device described.
上記第3の処理手段は、上記文字列候補が明らかに数字と間違えることのない英字を含むとき、上記文字列候補を日付ではないものとして認識することを特徴とする請求項1〜7のうちのいずれか1つに記載の光学文字認識装置。   The third processing means recognizes the character string candidate as not being a date when the character string candidate includes an alphabetic character that is clearly not mistaken for a number. The optical character recognition apparatus as described in any one of these. 上記第3の処理手段は、上記文字列候補が、月を表す2つの数字と、上記月を表す2つの数字に後続する少なくとも1つの他の文字とを含むとき、かつ、上記月を表す2つの数字間の距離が、上記月を表す2つの数字と他の文字との距離及び上記他の文字間の距離の平均値より大きいとき、上記月を表す2つの数字の1の位の数字及び上記他の文字を除去することを特徴とする請求項1〜8のうちのいずれか1つに記載の光学文字認識装置。   When the character string candidate includes two numbers representing the month and at least one other character subsequent to the two numbers representing the month, the third processing unit is configured to represent the month. When the distance between two numbers is larger than the average of the distance between the two numbers representing the month and other characters and the average distance between the other characters, the first digit of the two numbers representing the month and The optical character recognition apparatus according to claim 1, wherein the other character is removed. 上記入力画像は、回転可能に保持された円筒形状の容器の画像であることを特徴とする請求項1〜9のうちのいずれか1つに記載の光学文字認識装置。   The optical character recognition device according to claim 1, wherein the input image is an image of a cylindrical container that is rotatably held. 上記第1の処理手段は、上記入力画像から、上記円筒形状の容器の回転軸に実質的に直交する方向に延在するエッジと、予め決められたしきい値よりも高い輝度の部分とを含む領域を、上記目標領域として抽出することを特徴とする請求項10記載の光学文字認識装置。   The first processing means includes, from the input image, an edge extending in a direction substantially perpendicular to a rotation axis of the cylindrical container, and a portion having a luminance higher than a predetermined threshold value. The optical character recognition apparatus according to claim 10, wherein a region to be included is extracted as the target region. 上記光学文字認識装置は、上記容器を回転させながら撮影された上記容器の異なる角度をそれぞれ表す複数の入力画像を取得し、
上記第3の処理手段は、1つの入力画像に係る文字列候補が月を表す数字として「1」のみを含むとき、他の入力画像に係る文字列候補が月を表す数字として「1」のみを含むか否かを判断することを特徴とする請求項10又は11記載の光学文字認識装置。
The optical character recognition device acquires a plurality of input images respectively representing different angles of the container photographed while rotating the container,
When the character string candidate related to one input image includes only “1” as the number representing the month, the third processing means only includes “1” as the number representing the month as the character string candidate related to the other input image. The optical character recognition device according to claim 10 or 11, wherein it is determined whether or not the character string is included.
上記光学文字認識装置は、
カメラと、
上記円筒形状の容器の回転軸の周りに回転可能であるように上記容器を保持する撮影台と、
少なくとも1つの保管庫と上記撮影台との間で上記容器を移動させる移動装置とを備え、
上記容器には、上記容器中の薬品の使用期限の日付を表す文字列が印字されていることを特徴とする請求項10〜12のうちのいずれか1つに記載の光学文字認識装置。
The optical character recognition device is
A camera,
An imaging table for holding the container so as to be rotatable around a rotation axis of the cylindrical container;
A moving device for moving the container between at least one storage and the imaging table;
The optical character recognition device according to any one of claims 10 to 12, wherein a character string representing a date of expiration date of the medicine in the container is printed on the container.
文字列を光学的に認識する光学文字認識方法において、上記光学文字認識方法は、
容器の画像又は上記容器に貼られたラベルの画像を含む入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップと
上記第3のステップにより認識された日付に基づいて、上記容器を少なくとも1つの保管庫に保管するか否かを判断する第4のステップとを備えたことを特徴とする光学文字認識方法。
In the optical character recognition method for optically recognizing a character string, the optical character recognition method includes:
A first step of extracting a target area including an object to be recognized from an input image including an image of a container or an image of a label attached to the container ;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. A third step of recognizing column candidates as dates ;
An optical character recognition method comprising: a fourth step of determining whether to store the container in at least one storage, based on the date recognized in the third step .
コンピュータによって実行されたときに文字列を光学的に認識するコンピュータプログラムにおいて、上記コンピュータプログラムは、
容器の画像又は上記容器に貼られたラベルの画像を含む入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップと
上記第3のステップにより認識された日付に基づいて、上記容器を少なくとも1つの保管庫に保管するか否かを判断する第4のステップとを備えたことを特徴とするコンピュータプログラム。
In a computer program that optically recognizes a character string when executed by a computer, the computer program includes:
A first step of extracting a target area including an object to be recognized from an input image including an image of a container or an image of a label attached to the container ;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. A third step of recognizing column candidates as dates ;
A computer program comprising: a fourth step of determining whether to store the container in at least one storage, based on the date recognized in the third step .
コンピュータによって実行されたときに文字列を光学的に認識するコンピュータプログラムを格納したコンピュータにより読み取り可能な記録媒体において、上記コンピュータプログラムは、
容器の画像又は上記容器に貼られたラベルの画像を含む入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1のステップと、
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2のステップと、
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が、年を表す2桁又は4桁の数字と、月を表す1桁又は2桁の数字と、予め決められた約物とを含む日付のパターンを有するか否かを判断し、上記文字列候補が上記日付のパターンを有するとき、上記文字列候補を日付として認識する第3のステップと
上記第3のステップにより認識された日付に基づいて、上記容器を少なくとも1つの保管庫に保管するか否かを判断する第4のステップとを備えたことを特徴とする記録媒体。
In a computer-readable recording medium storing a computer program for optically recognizing a character string when executed by a computer, the computer program includes:
A first step of extracting a target area including an object to be recognized from an input image including an image of a container or an image of a label attached to the container ;
A second step of extracting candidate objects including at least one character string candidate object from the objects included in the target area;
By labeling the candidate objects, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and the character string candidates are two-digit or four-digit numbers representing the year. And whether or not the character string candidate has the date pattern, the character string has a date pattern that includes a one- or two-digit number representing the month and a predetermined punctuation mark. A third step of recognizing column candidates as dates ;
A recording medium comprising: a fourth step of determining whether to store the container in at least one storage, based on the date recognized in the third step .
文字列を光学的に認識する光学文字認識装置において、上記光学文字認識装置は、In an optical character recognition device that optically recognizes a character string, the optical character recognition device includes:
入力画像から、認識対象のオブジェクトを含む目標領域を抽出する第1の処理手段と、First processing means for extracting a target area including an object to be recognized from an input image;
上記目標領域に含まれるオブジェクトから、少なくとも1つの文字列候補のオブジェクトを含む候補オブジェクトを抽出する第2の処理手段と、Second processing means for extracting candidate objects including at least one character string candidate object from the objects included in the target area;
上記候補オブジェクトのラベリングを行って、予め決められた方向に延在して互いに近接した複数のオブジェクトを上記文字列候補として抽出し、上記文字列候補が予め決められた日付のパターンを有するとき、上記文字列候補を日付として認識する第3の処理手段とを備え、When the candidate objects are labeled, a plurality of objects extending in a predetermined direction and close to each other are extracted as the character string candidates, and when the character string candidates have a predetermined date pattern, Third processing means for recognizing the character string candidate as a date,
上記入力画像は、回転可能に保持された円筒形状の容器の画像であり、The input image is an image of a cylindrical container held rotatably,
上記第1の処理手段は、上記入力画像から、上記円筒形状の容器の回転軸に実質的に直交する方向に延在するエッジと、予め決められたしきい値よりも高い輝度の部分とを含む領域を、上記目標領域として抽出することを特徴とする光学文字認識装置。The first processing means includes, from the input image, an edge extending in a direction substantially perpendicular to a rotation axis of the cylindrical container, and a portion having a luminance higher than a predetermined threshold value. An optical character recognition apparatus, wherein a region including the target region is extracted as the target region.
JP2015527291A 2013-07-16 2014-07-14 Optical character recognition device Active JP6344389B2 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2013147546 2013-07-16
JP2013147546 2013-07-16
PCT/JP2014/068725 WO2015008732A1 (en) 2013-07-16 2014-07-14 Optical character recognition device

Publications (2)

Publication Number Publication Date
JPWO2015008732A1 JPWO2015008732A1 (en) 2017-03-02
JP6344389B2 true JP6344389B2 (en) 2018-06-20

Family

ID=52346186

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015527291A Active JP6344389B2 (en) 2013-07-16 2014-07-14 Optical character recognition device

Country Status (4)

Country Link
JP (1) JP6344389B2 (en)
CN (1) CN105431866A (en)
TW (1) TWI608422B (en)
WO (1) WO2015008732A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156767A (en) * 2016-03-02 2016-11-23 平安科技(深圳)有限公司 Driving license effect duration extraction method, server and terminal
CN106407976B (en) * 2016-08-30 2019-11-05 百度在线网络技术(北京)有限公司 The generation of image character identification model and perpendicular column character picture recognition methods and device
JP6401806B2 (en) * 2017-02-14 2018-10-10 株式会社Pfu Date identification device, date identification method, and date identification program
JP6480985B2 (en) * 2017-07-03 2019-03-13 ファナック株式会社 NC program converter
JP6949596B2 (en) 2017-07-20 2021-10-13 東芝テック株式会社 Product data processing device and product data processing program
CN110414496B (en) * 2018-04-26 2022-05-27 百度在线网络技术(北京)有限公司 Similar word recognition method and device, computer equipment and storage medium
TWI685796B (en) * 2018-05-31 2020-02-21 國立中興大學 A method for character pattern recognition
CN110490192A (en) * 2019-07-16 2019-11-22 广东工业大学 A kind of commodity production date tag detection method and system
TWI797531B (en) * 2020-12-31 2023-04-01 國立臺北科技大學 Pharmacy management system

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5405015A (en) * 1993-08-11 1995-04-11 Videojet Systems International, Inc. System and method for seeking and presenting an area for reading with a vision system
JP3890840B2 (en) * 1999-12-22 2007-03-07 富士通株式会社 Image processing apparatus, image processing method, and computer-readable recording medium recording image processing program
JP2004178044A (en) * 2002-11-25 2004-06-24 Mitsubishi Electric Corp Attribute extraction method, its device and attribute extraction program
TW200641708A (en) * 2005-05-25 2006-12-01 Systex Corp Fast inquiry system and method for merchandise data
JP2009199102A (en) * 2008-02-19 2009-09-03 Fujitsu Ltd Character recognition program, character recognition device and character recognition method
JP2011521520A (en) * 2008-04-16 2011-07-21 ワイコフ, リチャード ダレル Portable multimedia receiver and transmitter
JP5291387B2 (en) * 2008-06-02 2013-09-18 三菱重工業株式会社 Number recognition apparatus and number recognition method
JP4268218B1 (en) * 2008-11-13 2009-05-27 オオクマ電子株式会社 Information reading device for empty container for injection solution
US8577145B2 (en) * 2009-12-19 2013-11-05 Pcas Patient Care Automation Services Inc. Automated dispensary for identifying embossed characters and package labeling
CN101968865B (en) * 2010-11-17 2013-12-11 上海合合信息科技发展有限公司 Method for adding reminding event in electronic calendar
JP5197729B2 (en) * 2010-12-24 2013-05-15 独立行政法人国立高等専門学校機構 Picking system and picking method
JP5647919B2 (en) * 2011-03-07 2015-01-07 株式会社Nttドコモ Character recognition device, character recognition method, character recognition system, and character recognition program

Also Published As

Publication number Publication date
TWI608422B (en) 2017-12-11
WO2015008732A1 (en) 2015-01-22
JPWO2015008732A1 (en) 2017-03-02
TW201506800A (en) 2015-02-16
CN105431866A (en) 2016-03-23

Similar Documents

Publication Publication Date Title
JP6344389B2 (en) Optical character recognition device
JP7102490B2 (en) Image recognition device
US8300928B2 (en) System and method for locating a target region in an image
JP6354589B2 (en) Object identification device, method and program
JP6143111B2 (en) Object identification device, object identification method, and program
US8971569B2 (en) Marker processing method, marker processing device, marker, object having a marker, and marker processing program
US8538170B2 (en) System and method for document location and recognition
JP6831951B2 (en) Image recognition system
TWI751426B (en) Image processing system, image processing method and program product
TWI725465B (en) Image processing system, image processing method and program product
JPWO2014030400A1 (en) Object identification device, object identification method, and program
CN107403179B (en) Registration method and device for article packaging information
US9652652B2 (en) Method and device for identifying a two-dimensional barcode
JP2023040038A (en) Program, information processing method, and information processing device
JP6628336B2 (en) Information processing system
JP7449505B2 (en) information processing system
JP2017173925A (en) Optical character recognition device
JP5160366B2 (en) Pattern matching method for electronic parts
JP2006330872A (en) Fingerprint collation device, method and program
JP6890849B2 (en) Information processing system
CN113658039A (en) Method for determining splicing sequence of label images of medicine bottles
JP6941331B2 (en) Image recognition system
Ali et al. Modern to Historic Image Matching: ORB/SURF an Effective Matching Technique
JP2006330873A (en) Fingerprint collation device, method and program
Hampapur et al. Key-word Guided Word Spotting In Printed Text

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20170209

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170209

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20180424

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180507

R150 Certificate of patent or registration of utility model

Ref document number: 6344389

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250