JP5185072B2 - Frame detection method, frame detection apparatus, and frame detection program - Google Patents

Frame detection method, frame detection apparatus, and frame detection program Download PDF

Info

Publication number
JP5185072B2
JP5185072B2 JP2008287749A JP2008287749A JP5185072B2 JP 5185072 B2 JP5185072 B2 JP 5185072B2 JP 2008287749 A JP2008287749 A JP 2008287749A JP 2008287749 A JP2008287749 A JP 2008287749A JP 5185072 B2 JP5185072 B2 JP 5185072B2
Authority
JP
Japan
Prior art keywords
frame
line
target
black
confirmation
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.)
Expired - Fee Related
Application number
JP2008287749A
Other languages
Japanese (ja)
Other versions
JP2010113653A (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.)
Kyodo Printing Co Ltd
Original Assignee
Kyodo Printing 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 Kyodo Printing Co Ltd filed Critical Kyodo Printing Co Ltd
Priority to JP2008287749A priority Critical patent/JP5185072B2/en
Publication of JP2010113653A publication Critical patent/JP2010113653A/en
Application granted granted Critical
Publication of JP5185072B2 publication Critical patent/JP5185072B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)

Description

本発明は、カメラなどが撮影した「枠を含む画像」からその枠を検出するための枠検出方法、枠検出装置及び枠検出プログラムに関する。   The present invention relates to a frame detection method, a frame detection apparatus, and a frame detection program for detecting a frame from an “image including a frame” taken by a camera or the like.

これまでに、画像中から枠領域を選択する手段として以下の方法がある。   Up to now, there are the following methods as means for selecting a frame region from an image.

1つ目の方法は、撮影時にガイドを表示し、対象物をそれに合わせる方法である。   The first method is a method of displaying a guide at the time of shooting and aligning the object with the guide.

2つ目の方法は、撮影対象の枠をユーザが指定する方法である。   The second method is a method in which the user specifies a frame to be imaged.

特許文献1には、車両のナンバープレート文字の抽出に際し、ヒストグラム処理を行うことにより、不要箇所を削除する発明が記載されているが、この方法は、数字の「1」のような直線を持つ文字を不要箇所であると誤判断する可能性がある。
特開2005−352705号公報
Patent Document 1 describes an invention in which unnecessary portions are deleted by performing a histogram process when extracting a license plate character of a vehicle, but this method has a straight line such as the number “1”. There is a possibility of misjudging characters as unnecessary parts.
JP 2005-352705 A

上述した1つめの方法では、ガイドがつけられないデバイスが多く存在するため、対応できない場合がある。また、ユーザは撮影対象物をガイドに合わせなければならないのでユーザに不便を与える。また、上述した2つめの方法でもユーザに不便を与える。   In the first method described above, there are many devices that cannot be guided, and may not be supported. Further, since the user must match the object to be photographed with the guide, it is inconvenient for the user. In addition, the second method described above also inconveniences the user.

そこで、本発明は、撮影対象物がカメラに対して回転していたり、大きさが一定でなくても、撮影画像から自動的に枠を選択することを可能にする枠検出方法、枠検出装置及び枠検出プログラムを提供することを目的とする。   Therefore, the present invention provides a frame detection method and a frame detection device that can automatically select a frame from a captured image even if the object to be imaged is rotated with respect to the camera or the size is not constant. And it aims at providing a frame detection program.

本発明によれば、入力したグレースケール画像を白黒に二値化して二値化画像を得る二値化ステップと、前記二値化画像から、前記二値化画像の中心付近を通る縦方向の第1直線を通る黒点、前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から一方の方向に離れた第2直線を通る黒点又は前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から他方の方向に離れた第3直線を通る黒点があれば、それらの黒点を全て検出する第1黒点検出ステップと、前記二値化画像から、前記二値化画像の中心付近を通る横方向の第4直線を通る黒点、前記第4直線に平行であって検出しようとする枠の縦方向の辺よりも短くなるように定められた距離だけ前記第4の直線から一方の方向に離れた第5直線を通る黒点又は前記第4直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第4の直線から他方の方向に離れた第6直線を通る黒点があれば、それらの黒点を全て検出する第2黒点検出ステップと、前記第1黒点検出ステップで検出した前記第2直線を通る黒点と前記第1黒点検出ステップで検出した前記第3直線を通る黒点との組合せを全て求める第1組合せ生成ステップと、前記第2黒点検出ステップで検出した前記第5直線を通る黒点と前記第2黒点検出ステップで検出した前記第6直線を通る黒点との組合せを全て求める第2組合せ生成ステップと、前記第1組合せ生成ステップで生成した組合せから、組合せをなす2つの黒点の中点に前記第1直線を通る黒点がある組合せのみを選択する第1選択ステップと、前記第2組合せ生成ステップで生成した組合せから、組合せをなす2つの黒点の中点に前記第4直線を通る黒点がある組合せのみを選択する第2選択ステップと、前記第1選択ステップで選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第3選択ステップと、前記第2選択ステップで選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第4選択ステップと、前記第3選択ステップで選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第1直線端点検出ステップと、前記第4選択ステップで選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第2直線端点検出ステップと、前記第3選択ステップで選択した組合せに係る線分の全ての対について線分が長い順に第1枠確定処理を行い、或る線分の対について前記第1枠確定処理により枠が確定したならば、前記或る線分の対について前記第1枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記或る線分の対について前記第1枠確定処理により確定した枠を最終的に検出された枠とする第1枠検出ステップと、前記第4選択ステップで選択した組合せに係る線分の全ての対について線分が長い順に第2枠確定処理を行い、或る線分の対について前記第2枠確定処理により枠が確定したならば、前記或る線分について前記第2枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記第2枠確定処理により確定した枠を最終的に検出された枠とする第2枠検出ステップと、を備えることを特徴とする枠検出方法が提供される。   According to the present invention, a binarization step for binarizing an input grayscale image into black and white to obtain a binarized image, and a vertical direction from the binarized image passing through the vicinity of the center of the binarized image. A black point that passes through the first straight line, a first point that is parallel to the first straight line and that is separated from the first straight line in one direction by a distance that is set to be shorter than a lateral side of the frame to be detected. A third point separated from the first straight line in the other direction by a distance determined so as to be shorter than a black point passing through two straight lines or a horizontal side of the frame to be detected that is parallel to the first straight line. If there are black spots that pass through a straight line, a first black spot detecting step that detects all of the black spots; a black spot that passes from the binarized image through a fourth straight line in the lateral direction passing near the center of the binarized image; The vertical side of the frame to be detected that is parallel to the fourth straight line From a black spot passing through a fifth straight line that is separated from the fourth straight line in one direction by a predetermined distance or a side in the horizontal direction of the frame that is parallel to the fourth straight line and to be detected. If there are black spots that pass through a sixth straight line separated from the fourth straight line in the other direction by a distance determined so as to be shorter, a second black spot detecting step for detecting all the black spots, and the first black spot A first combination generating step for finding all combinations of black spots passing through the second straight line detected in the detecting step and black spots passing through the third straight line detected in the first black spot detecting step; and detecting in the second black spot detecting step. A second combination generation step for obtaining all combinations of the black points passing through the fifth straight line and the black points passing through the sixth straight line detected in the second black point detection step; and the set generated in the first combination generation step. From the combination generated in the first selection step for selecting only the combination having the black point passing through the first straight line at the midpoint between the two black points forming the combination and the combination generated in the second combination generation step, From the second selection step of selecting only a combination having a black point passing through the fourth straight line at the middle point of the black point, and from the combination selected in the first selection step, all pixels between the two black points forming the combination are black. A third selection step for selecting only a combination that forms a line segment, and a combination that selects only a combination in which all pixels between the two black dots forming the combination form a black line segment from the combination selected in the second selection step. A first straight line end point detecting step for obtaining points at both ends of a line segment passing through the two points forming the combination for the combination selected in the fourth selecting step; and the fourth selecting step. For the combinations selected in (2), the second straight line end point detecting step for obtaining points at both ends of the line segment passing through the two points forming the combination, and the line segments for all pairs of the line segments related to the combination selected in the third selection step When the first frame determination process is performed in order from the longest and a frame is determined by the first frame determination process for a certain line segment pair, the frame determined by the first frame determination process for the certain line segment pair is It is checked whether or not the image is near the center of the binary image, and if so, a frame determined by the first frame determination process for the certain line segment pair is set as a finally detected frame. The second frame determination process is performed for all pairs of line segments related to the combination selected in the frame detection step and the fourth selection step in descending order of the line segments, and a pair of line segments is subjected to the second frame determination process. If the frame is fixed, the certain line segment Then, it is checked whether or not the frame determined by the second frame determination process is near the center of the binary image. If so, the frame finally determined by the second frame determination process is detected. And a second frame detection step. A frame detection method is provided.

また、本発明によれば、入力したグレースケール画像を白黒に二値化して二値化画像を得る二値化手段と、前記二値化画像から、前記二値化画像の中心付近を通る縦方向の第1直線を通る黒点、前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から一方の方向に離れた第2直線を通る黒点又は前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から他方の方向に離れた第3直線を通る黒点があれば、それらの黒点を全て検出する第1黒点検出手段と、前記二値化画像から、前記二値化画像の中心付近を通る横方向の第4直線を通る黒点、前記第4直線に平行であって検出しようとする枠の縦方向の辺よりも短くなるように定められた距離だけ前記第4の直線から一方の方向に離れた第5直線を通る黒点又は前記第4直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第4の直線から他方の方向に離れた第6直線を通る黒点があれば、それらの黒点を全て検出する第2黒点検出手段と、前記第1黒点検出手段で検出した前記第2直線を通る黒点と前記第1黒点検出手段で検出した前記第3直線を通る黒点との組合せを全て求める第1組合せ生成手段と、前記第2黒点検出手段で検出した前記第5直線を通る黒点と前記第2黒点検出手段で検出した前記第6直線を通る黒点との組合せを全て求める第2組合せ生成手段と、前記第1組合せ生成手段で生成した組合せから、組合せをなす2つの黒点の中点に前記第1直線を通る黒点がある組合せのみを選択する第1選択手段と、前記第2組合せ生成手段で生成した組合せから、組合せをなす2つの黒点の中点に前記第4直線を通る黒点がある組合せのみを選択する第2選択手段と、前記第1選択手段で選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第3選択手段と、前記第2選択手段で選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第4選択手段と、前記第3選択手段で選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第1直線端点検出手段と、前記第4選択手段で選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第2直線端点検出手段と、前記第3選択手段で選択した組合せに係る線分の全ての対について線分が長い順に第1枠確定処理を行い、或る線分の対について前記第1枠確定処理により枠が確定したならば、前記或る線分の対について前記第1枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記或る線分の対について前記第1枠確定処理により確定した枠を最終的に検出された枠とする第1枠検出手段と、前記第4選択手段で選択した組合せに係る線分の全ての対について線分が長い順に第2枠確定処理を行い、或る線分の対について前記第2枠確定処理により枠が確定したならば、前記或る線分について前記第2枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記第2枠確定処理により確定した枠を最終的に検出された枠とする第2枠検出手段と、を備えることを特徴とする枠検出装置が提供される。   Further, according to the present invention, binarization means for binarizing an input grayscale image into black and white to obtain a binarized image, and a vertical path from the binarized image passing through the vicinity of the center of the binarized image. A black spot that passes through the first straight line in the direction, and is separated from the first straight line in one direction by a distance that is defined to be shorter than the horizontal side of the frame to be detected that is parallel to the first straight line. A distance from the first straight line in the other direction by a predetermined distance so as to be shorter than a black spot passing through the second straight line or a horizontal side of the frame to be detected that is parallel to the first straight line. If there are black spots that pass through the third straight line, first black spot detection means for detecting all of the black spots, and black spots that pass from the binarized image through the fourth straight line in the lateral direction passing through the vicinity of the center of the binarized image. The vertical side of the frame to be detected that is parallel to the fourth straight line Than the black point passing through the fifth straight line separated in one direction from the fourth straight line by a predetermined distance or the horizontal side of the frame to be detected that is parallel to the fourth straight line. If there are black spots that pass through a sixth straight line that is separated from the fourth straight line in the other direction by a predetermined distance, a second black spot detecting means that detects all of the black spots, and the first black spot detection First combination generating means for obtaining all combinations of black spots passing through the second straight line detected by the means and black spots passing through the third straight line detected by the first black spot detecting means, and detected by the second black spot detecting means A second combination generating means for obtaining all combinations of black spots passing through the fifth straight line and black spots passing through the sixth straight line detected by the second black spot detecting means, and combinations generated from the combinations generated by the first combination generating means. Of the two sunspots A first selection means for selecting only a combination having a black point passing through the first straight line at a point, and a combination of the two black points forming the combination through the fourth straight line from the combination generated by the second combination generation means. Second selection means for selecting only a combination with a black dot, and third selection for selecting only a combination in which all pixels between the two black dots forming the combination form a black line segment from the combination selected by the first selection means. A selection unit; a fourth selection unit that selects only a combination in which all pixels between two black dots forming the combination form a black line segment from the combinations selected by the second selection unit; and a third selection unit. For the selected combination, the first straight line end point detecting means for obtaining the points at both ends of the line segment passing through the two points forming the combination, and the both ends of the line segment passing through the two points forming the combination for the combination selected by the fourth selecting means Find the point A first frame determination process is performed for all pairs of line segments related to the combination selected by the second straight line end point detection means and the third selection means in descending order of line segments, and the first frame for a certain line segment pair. If the frame is confirmed by the confirmation process, it is checked whether or not the frame confirmed by the first frame confirmation process for the certain line segment pair is near the center of the binary image. A first frame detection unit that uses the frame determined by the first frame determination process as a frame finally detected for a pair of line segments, and all the line segments related to the combination selected by the fourth selection unit; The second frame determination process is performed in order of the longest line segment for the pair, and if the frame is determined by the second frame determination process for a pair of line segments, the second frame determination process is determined for the certain line segment. Check whether the frame is near the center of the binary image, and If the second frame detection means for the confirmed frame by the second frame confirmation process and finally detected frame, the frame detecting device characterized by comprising a are provided.

更に、本発明によれば、上記の枠検出方法をコンピュータに実行させるための枠検出プログラムが提供される。   Furthermore, according to the present invention, there is provided a frame detection program for causing a computer to execute the above frame detection method.

携帯電話等のカメラでユーザが様々な条件下で撮影したデジタル画像を利用する画像処理システムにおいて、背景などの不要な情報が含む画像から、ユーザの補助なしに、枠のみを認識する。これにより、画像について枠内の領域だけを抜き出すことが可能になる。また、枠の持つ情報(回転角度・拡大縮小率・歪み)より、後工程の画像処理精度を高めることができる。   In an image processing system that uses a digital image taken by a user under various conditions with a camera such as a mobile phone, only a frame is recognized from an image including unnecessary information such as a background without the assistance of the user. As a result, it is possible to extract only the area within the frame of the image. In addition, the image processing accuracy of the post-process can be improved from the information (rotation angle, enlargement / reduction ratio, distortion) of the frame.

以下、図面を参照して本発明を実施するための最良の形態について詳細に説明する。   The best mode for carrying out the present invention will be described below in detail with reference to the drawings.

画像から枠領域だけを選択する方法として、枠が長方形であるため、画像内から平行する二本の直線を見つけることにより、枠領域を選択する。枠以外の背景にも二本の平行線が入る可能性はあるが、これに対して撮影対象がほぼ中心に来ることを利用して、枠を選択するようにする。   As a method for selecting only the frame region from the image, since the frame is rectangular, the frame region is selected by finding two parallel lines from within the image. There is a possibility that two parallel lines may also enter the background other than the frame. On the other hand, the frame is selected by utilizing the fact that the object to be photographed is almost at the center.

具体的な枠の取得方法を説明する。   A specific frame acquisition method will be described.

まず、枠と背景を切り離す二値化を行う。しかし、画像全体に一意な二値化閾値を適用できることは少なく、またこの値を選択することは困難である。   First, binarization that separates the frame from the background is performed. However, it is rare that a unique binarization threshold can be applied to the entire image, and it is difficult to select this value.

この理由は、
・光(照明・外光)の影響が出る
・画像の枠以外の領域がどのような色、形になるかわからない
ためである。撮影環境が光の遮られる状態であったり、撮影対象画像が白黒であったり、枠の場所が一定であったりすれば、一意な二値化閾値を決定するのは難しくない。しかし、携帯電話で室内や、屋外を問わず、対象となる撮影物も雑誌、ポスター、商品パッケージなど、様々な環境を想定すると、前述の通り一意に二値化閾値を決定するのは困難である。
The reason is
This is because there is an influence of light (illumination / external light). It is because it is not known what color and shape the area other than the image frame will be. It is not difficult to determine a unique binarization threshold if the shooting environment is in a state where light is blocked, the shooting target image is black and white, or the location of the frame is constant. However, assuming a variety of environments such as magazines, posters, product packages, etc., regardless of whether the target shooting object is indoors or outdoors with a mobile phone, it is difficult to uniquely determine the binarization threshold as described above is there.

そのため、枠と背景を切り離すための二値化プログラムを作成した。これを以後エリア別二値化と呼ぶ。この二値化画像は、枠を残し、枠を周囲から浮き出させることを主眼においており、枠以外の背景等の情報(ノイズ)が入っていてもかまわない。   Therefore, a binarization program was created to separate the frame from the background. This is hereinafter referred to as area-based binarization. This binarized image is intended to leave a frame and make the frame stand out from the surroundings, and may contain information (noise) such as background other than the frame.

この二値化の手順は、
1.カラー画像をグレースケール画像に変換する。
2.画像を細かなブロックに分割する。
3.ブロック画像ごとに判別分析法等により動的に二値化閾値を決定する。
4.ブロックの周囲の閾値と比較して、自身より大きい閾値がある場合その値に近づける。
5.ブロックごとの閾値を用いて画像を白と黒の二値化データに変換する。
である。
This binarization procedure is
1. Convert a color image to a grayscale image.
2. Divide the image into smaller blocks.
3. A binarization threshold is dynamically determined for each block image by a discriminant analysis method or the like.
4). If there is a threshold value larger than itself compared with the threshold value around the block, it is brought close to that value.
5. The image is converted into binary data of white and black using a threshold value for each block.
It is.

2の分割サイズは小さすぎても、大きすぎても上手くいかない。小さすぎると、ブロック一杯に枠が入り込んでしまい、適切な閾値が求まらない。大きすぎると、ブロックに多くの画素が入るため、ブロックを区切って二値化精度を上げることの意味が薄れる。よって、画像サイズと、撮影対象の枠の大きさにより適切な値を選択する必要がある(図5参照)。   The division size of 2 is too small or too large. If it is too small, the frame fills the block and an appropriate threshold cannot be obtained. If it is too large, many pixels are included in the block, so the meaning of increasing the binarization accuracy by dividing the block is diminished. Therefore, it is necessary to select an appropriate value depending on the image size and the size of the frame to be imaged (see FIG. 5).

4では、ブロックの周囲の情報を用いて、閾値を上げている。これを行う理由は二つある。一つは閾値を周囲のものに近づけることで、二値化した際のブロックの境界が目立たないようにするためである。二つは閾値が大きいほど、枠の領域が多く残るためである。この実施例として、あるブロックの周囲3×3ブロックの閾値と比較して、自身の閾値と、それよりも値が大きいものとの平均を用いている(図6参照)。   In 4, the threshold is raised using information around the block. There are two reasons for doing this. One is to make the boundary of the block inconspicuous when binarized by bringing the threshold close to the surroundings. Second, the larger the threshold, the more frame areas remain. In this embodiment, an average of its own threshold value and a value larger than that is used as compared with the threshold value of 3 × 3 blocks around a certain block (see FIG. 6).

次に、ブロックごとに枠が確実に存在しないブロック画像(ノイズ)を除去する。この処理は、後の処理時間を短くするためと、精度を上げるために行っており、必須ではない。   Next, a block image (noise) in which a frame does not surely exist for each block is removed. This processing is performed in order to shorten the subsequent processing time and increase the accuracy, and is not essential.

枠が確実に存在しないブロックの判別方法を三つ挙げる。一つ目は、ブロック内の画素値の最大と最小の差が一定以下であれば枠がないと判定できる。この理由として、ブロック内にもし枠と背景がそれぞれ存在するならば、最小値に枠の中の一点の画素値、最大値に背景中の一点の画素値が選択され、通常これらの差は大きくなる。よって、差が小さいならブロックに枠が存在しないと判断できる。二つ目は、ブロック内の黒い画素が一定割合以上であれば、枠が存在しないと判別できる。ブロックサイズに対して枠の太さが小さいならば、枠が存在するブロックの全体が黒くなることはありえないためである。これらのブロックは、枠が存在しない、つまり背景部分であるとして、白く塗りつぶす。三つ目は、中心からの距離が大きいブロックは、枠が存在しないといえる。この距離は、中心に枠を配置し、カメラプレビュー画面いっぱいに枠を写した場合に、枠が含まれない距離のブロックを除去する(図7参照)。   Here are three methods for discriminating blocks that do not have a frame. First, it can be determined that there is no frame if the difference between the maximum and minimum pixel values in the block is not more than a certain value. The reason for this is that if a frame and background exist in the block, the pixel value of one point in the frame is selected as the minimum value, and the pixel value of one point in the background is selected as the maximum value. Become. Therefore, if the difference is small, it can be determined that there is no frame in the block. Second, if black pixels in a block are equal to or greater than a certain ratio, it can be determined that there is no frame. This is because if the thickness of the frame is small relative to the block size, the entire block in which the frame exists cannot be black. These blocks are painted white, assuming that there is no frame, that is, a background portion. Third, it can be said that a block having a large distance from the center has no frame. For this distance, when a frame is arranged at the center and the frame is copied to the full camera preview screen, a block of a distance not including the frame is removed (see FIG. 7).

次に、この二値画像から枠の辺の候補となる線を抽出する。   Next, lines that are candidates for the sides of the frame are extracted from the binary image.

画像についての前提として、画像の左上を(0,0)として、右方向がxの正方向、下方向がyの正方向とする。   As the premise of the image, the upper left of the image is (0, 0), the right direction is the positive direction of x, and the lower direction is the positive direction of y.

まず、中心座標を(CX,CY)とし、x=CXをy軸方向に走査する。黒い画素を見つけた場合、この座標を保存する。連続して黒い画素の場合、それら画素の真ん中の点を保存する。同様に、x=CX±A(Aは整数)の走査をそれぞれ行う。このAの値は、枠の短辺の長さよりも十分に小さい値にする。   First, the center coordinates are set to (CX, CY), and x = CX is scanned in the y-axis direction. If a black pixel is found, save this coordinate. In the case of consecutive black pixels, the middle point of those pixels is saved. Similarly, scanning of x = CX ± A (A is an integer) is performed. The value A is sufficiently smaller than the length of the short side of the frame.

x=CX+Aの点と、x=CX−Aの点の全ての組み合わせについて、二点の中点がx=CXでの点に存在する組み合わせをリストアップする。この二点を結んだ線が、枠線の一部である可能性がある。   For all combinations of the point x = CX + A and the point x = CX−A, the combinations in which the midpoint between the two points exist at the point x = CX are listed. There is a possibility that a line connecting these two points is a part of the frame line.

画像のy軸方向に走査したが、次はx軸方向にy=CY,y=CY±B(Bは整数)に対しても同様の操作を行い、点の組み合わせをリストアップする。正位置(画像が回転していない状態)で撮影した場合、撮影対象を中心よりも少し下側にして撮影する場合が多く見られるため、CYの値を中心よりもいくらか下側に修正することも考えられる。   The image is scanned in the y-axis direction. Next, the same operation is performed for y = CY, y = CY ± B (B is an integer) in the x-axis direction, and a combination of points is listed. When shooting in the normal position (when the image is not rotated), it is often the case that shooting is performed with the shooting target slightly below the center, so the CY value should be corrected somewhat below the center. Is also possible.

次に先ほどリストアップした二点の間に、黒い画素の直線が存在するか調べる。この時、線が途切れた場合は除外する。直線となった場合には、さらにこの線がどこまで伸びているか調べる。これらの処理により、直線の端となる点と、その間の長さをリストアップする。   Next, it is checked whether a black pixel line exists between the two points listed above. At this time, if the line is interrupted, it is excluded. If it becomes a straight line, investigate how far this line extends. By these processes, the points that are the ends of the straight line and the lengths between them are listed.

ここまでの処理により、y軸方向と、x軸方向の走査の結果の数本の線分が取得できた。これらの線分は枠の辺であるものもあるが、背景に含まれる関係のない線分も含まれている。また、画像に枠が複数並んでいる場合には、探索対象とする枠以外の枠の辺も含まれている。よって、これらの線分から、枠線となるものを選択する必要がある。   By the processing so far, several line segments as a result of scanning in the y-axis direction and the x-axis direction have been acquired. Some of these line segments are the sides of the frame, but unrelated line segments included in the background are also included. In addition, when a plurality of frames are arranged in the image, the sides of the frames other than the frame to be searched are also included. Therefore, it is necessary to select what becomes a frame line from these line segments.

ここで注意すべきは、上記の候補に枠の四辺全てが含まれていない可能性があるということである。ガイドのない状態で撮影した際に、対象物を中心に据えて撮影することは難しい。特に枠が短い辺を合わせる場合にはなおさらである。ただし、四本全てを取得することが難しくても片方の向かい合う辺の取得はできる。例えば、片側の辺が短くても長い方の辺で中心のXかYの中心軸を捕らえることはでき、また縦で対象物を中心に据えることは難しくても、横で中心を捕らえることは無意識に行われる。よって、普通の撮影画像で、上記の方法により、片方の向かい合う辺を取得できる可能性は高い。図8(a)はx軸は平行線をとれていないが、y軸はきちんととらえている。図8(b)は反対に、y軸は中心が枠をかする程度でx=CX+AのAの値次第で、枠から外れてしまうが、x軸はきちんと枠をとらえている。このように、枠が小さすぎなければ、これまでの方法で4辺は無理でも、一組の向かいあう辺が取得できる可能性が高い。   It should be noted here that the above candidates may not include all four sides of the frame. When shooting without a guide, it is difficult to shoot with the subject at the center. This is especially true when the edges of the frame are aligned. However, even if it is difficult to acquire all four, it is possible to acquire one opposite side. For example, even if one side is short, it is possible to capture the center axis of X or Y at the longer side, and it is difficult to center the object vertically but to capture the center at the side. It is done unconsciously. Therefore, there is a high possibility that one of the opposite sides can be acquired by the above method with a normal captured image. In FIG. 8A, the x-axis is not parallel, but the y-axis is properly captured. On the other hand, in FIG. 8B, the y-axis is out of the frame depending on the value of A of x = CX + A to the extent that the center is framed, but the x-axis captures the frame properly. Thus, if the frame is not too small, there is a high possibility that a pair of opposing sides can be obtained even if the four sides are impossible by the conventional methods.

これからの処理では、先ほどX軸方向と、Y軸方向でリストアップした線分のうち、枠の向かい合う辺のペアとなる線分を探す。   In the processing from now on, a line segment that is a pair of opposite sides of the frame is searched for from the line segments listed in the X-axis direction and the Y-axis direction.

得られた線分について、X軸方向の線分と、Y軸方向の線分とに分け、それぞれについて長い線から二本を組み合わせる。長い線から組み合わせる理由は、短い線分ほど背景や、枠内の文字等のノイズである可能性が高いためである。また、枠中心の「□」(読みでいうと「くち」や「ろ」)のような長方形に近い文字は枠と誤認識される恐れがあるが、長い線が先だと枠の方が先に順番がくるため、先に枠と特定できる。別の線分の組み合わせ順序として、まず長さが等しい線分を選択し、その後長い辺を組み合わせる方法がある。   The obtained line segment is divided into a line segment in the X-axis direction and a line segment in the Y-axis direction, and two long lines are combined for each. The reason for combining from long lines is that the shorter the line segment, the more likely it is noise from the background or characters in the frame. Also, near-rectangular characters such as “□” at the center of the frame (“Kuchi” or “RO” in the reading) may be mistaken for a frame, but if a long line is first, the frame is better. Since the order comes first, the frame can be specified first. As another line segment combination order, there is a method of first selecting line segments having the same length and then combining long sides.

次に、この二本の線分が向かい合わせの辺かどうか調べる。これには、それらの線分が平行であるかどうか調べる。そのために、それぞれの辺の基準線に対する回転角度を調べ、この値が近いかどうか見る。画像からとった線分であるため、角度が完全に一致しないため、ここでは絶対に平行ではないといえるものを省く程度でよい。また、この二つの線分が同一線分でないことを調べる。これは、片方の線分の一点を抽出し、これが他方の線分、もしくはその延長からの距離により判明する。 Next, check whether these two line segments are opposite sides. This is done by checking whether the line segments are parallel . Therefore, the rotation angle of each side with respect to the reference line is examined to see if this value is close. Since it is a line segment taken from the image, the angles do not completely coincide with each other. Therefore, it is sufficient to omit what can be said to be absolutely non-parallel here. Also, it is checked that these two line segments are not the same line segment. This is done by extracting one point from one line segment, which is determined by the distance from the other line segment or its extension.

辺のペアが見つかれば、その二辺と垂直に交わる辺が二本あるかどうかを調べる。見つからない場合は、辺のペアは枠の一部ではないといえる。   If a pair of sides is found, it is checked whether there are two sides that intersect perpendicularly with the two sides. If not found, the pair of edges is not part of the frame.

上記の向かいあう辺を、辺1、辺2と呼ぶ。辺1の端の点を点1、点2と呼び、辺2の端の点を点3、点4と呼ぶ。点1と点3、点2と点4がそれぞれ対応する点(枠線で結ばれる点同士)とする。よって、点1と点4、点2と点3は対角線上の点となる。   The sides facing each other are referred to as sides 1 and 2. The end points of side 1 are called points 1 and 2, and the end points of side 2 are called points 3 and 4. Points 1 and 3 and points 2 and 4 correspond to each other (points connected by a frame line). Therefore, points 1 and 4 and points 2 and 3 are diagonal points.

新たな辺を見つける方法は、下記のようにする。
(1).点1と点3、点2と点4の間に線があるか調べる。
(2).(1)で線が二本とも見つかった場合、その四本により長方形になるか調べる。
(3a).(1)で一本見つかった場合、見つからなかった側の二点について、一方の点から辺の法線方向に線があるか調べる。見つからなかった場合、もう一方の点に対しても同様の処理を行う。
(3b).線が見つかった場合、それら四本により長方形になるか調べ、見つからなかった場合、辺1と、辺2のペアは枠の一部とならないことが確定する。
(4a).(1)で線が見つからなかった場合、点1と、点3のそれぞれに対し、どちらかに辺の法線方向に線があるかどうか調べる。点2と、点4に対しても同様のことを行う。
(4b).上記の結果、どちらとも線が見つかった場合、それらが四本により長方形になるか調べる。そうでなければ、辺1と、辺2のペアが枠の一部とならないことが確定する。
The method for finding a new edge is as follows.
(1). Check if there is a line between point 1 and point 3 and between point 2 and point 4.
(2). If both lines are found in (1), check if the four lines are rectangular.
(3a). If one line is found in (1), it is checked whether there is a line in the normal direction of the side from one of the two points on the side that was not found. If not found, the same processing is performed for the other point.
(3b). If a line is found, it is checked whether the four form a rectangle, and if not found, it is determined that the pair of side 1 and side 2 is not part of the frame.
(4a). If a line is not found in (1), it is checked whether there is a line in the normal direction of either side for each of the points 1 and 3. The same is done for points 2 and 4.
(4b). As a result of the above, if both lines are found, check whether they become rectangular by four. Otherwise, it is determined that the pair of side 1 and side 2 is not part of the frame.

(3)と(4)の処理は、元の二辺の端点がきちんと取得できていれば必要ない。しかし、実際は線の探索中、線が途切れてしまうことがままある。そのため、どちらか片側の端点が正常に取れていれば、辺が見つかるように、(3)、(4)の処理を行う。   The processing of (3) and (4) is not necessary if the end points of the original two sides can be acquired properly. However, in practice, the line may be interrupted during the line search. Therefore, if either one of the end points is taken normally, the processes (3) and (4) are performed so that the side can be found.

これまでの処理の結果得られる枠は、基本的に長方形(もしくは、長方形に近い形状)となるはずである。しかし、念のためこれが長方形になるかどうか調べ、長方形でなければ枠でないとすることができる。長方形の調べ方は、四つの交点についての二つの条件が考えられ、一つ目は、点1、点2の長さと、点3、点4の長さ。点1、点3の長さと、点2、点4の長さがほぼ一致するかどうか調べる。二つ目は、向かいあう二組の辺がほぼ平行になればよい。   The frame obtained as a result of the processing so far should basically be a rectangle (or a shape close to a rectangle). However, just in case, you can check if this is a rectangle, and if it is not a rectangle, it can be a frame. There are two possible conditions for examining the rectangle: four conditions for the four intersections. The first is the length of points 1 and 2, and the length of points 3 and 4. It is examined whether the lengths of the points 1 and 3 are substantially equal to the lengths of the points 2 and 4. Second, it is only necessary that the two pairs of sides facing each other are almost parallel.

次に、この枠が中心にあるかどうか調べる。もし中心でなければ、この枠は撮影時に紛れ込んだ対象物以外の枠や、背景等のノイズである可能性がある。この判別方法は、基本的に撮影対象物は真ん中にあることから、画像中心と枠の中心の距離を求めてそれが一定以下の場合とする方法と、枠の領域内に画像中心が含まれる場合という方法がある。   Next, it is checked whether this frame is in the center. If it is not the center, this frame may be a frame other than the object that was mixed in at the time of shooting, or noise such as the background. In this discrimination method, since the object to be photographed is basically in the middle, the distance between the center of the image and the center of the frame is determined to be less than a certain value, and the center of the image is included in the frame area. There is a case.

もし、中心から外れていた場合、これを枠に最も近い枠候補として、画像中心と枠の中心の距離とともに保存しておく。そして、他の辺の候補を調べていき、もし該当する枠がなければこれを正解とする。また、同様に中心をずれた枠が見つかった場合、これと枠候補の中心からの距離を求め、値が小さいほうを枠候補とする。   If it is off the center, this is stored as a frame candidate closest to the frame together with the distance between the center of the image and the center of the frame. Then, candidates for other sides are examined, and if there is no corresponding frame, this is the correct answer. Similarly, when a frame out of the center is found, the distance from this and the center of the frame candidate is obtained, and the smaller value is set as the frame candidate.

最後に、枠の最も外側の点を取るため補正処理を行う。これは、線が太いため頂点のエリアが広いため、同じ状態の枠を二回撮影したものでも、枠の頂点座標が異なる可能性があるからである。これをほぼ同じ頂点をとるようにするため、枠の最も外側の頂点を取るようにする。   Finally, correction processing is performed to take the outermost point of the frame. This is because the vertex area is wide because the line is thick, and the vertex coordinates of the frame may be different even if the frame in the same state is photographed twice. In order to make this take almost the same vertex, the outermost vertex of the frame is taken.

この方法は、各点について接する二本の辺を見て、ここから頂点の移動方向を決定する。移動方向についての説明は図10も参照。各辺の頂点方向のベクトルを加えたベクトルの方向に向かって枠を広げていくが、これをx,y成分の<+,0,−>のいずれかで表す。その変換は、図9のように、先ほどのベクトル方向をx,y成分の正負の方向で表す。現在の頂点を(X,Y)としたとき、ベクトルがxが+、yが−であれば、x成分について(X+1,Y)が枠かどうか調べ、次にy成分について(X,Y−1)を調べる。いずれかが枠だった場合、頂点座標をその座標に移動する。また、この頂点座標について同様のことを座標が動かなくなるまで行う。これを全ての頂点について行う。   This method looks at the two sides that touch each point, and determines the direction of vertex movement from here. See also FIG. 10 for a description of the direction of movement. The frame is expanded toward the direction of the vector obtained by adding the vectors in the vertex direction of each side, and this is represented by <+, 0, −> of the x and y components. In the conversion, as shown in FIG. 9, the previous vector direction is represented by the positive and negative directions of the x and y components. If the current vertex is (X, Y) and the vector is x + and y is-, it is checked whether (X + 1, Y) is a frame for the x component, and then (X, Y-) for the y component. Check 1). If either is a frame, move the vertex coordinates to that coordinate. The same processing is performed for the vertex coordinates until the coordinates stop moving. Do this for all vertices.

これにより、画像内の枠の4点の頂点座標が特定できる。   Thereby, the vertex coordinates of the four points of the frame in the image can be specified.

次に、図1〜図4に示すフローチャートを参照して本発明の実施形態による枠検出方法について説明をする。   Next, the frame detection method according to the embodiment of the present invention will be described with reference to the flowcharts shown in FIGS.

図1を参照すると、まず、グレースケール画像についてエリア別二値化を行い、二値化画像を得る(ステップS101)。このステップS101の詳細については後述する。   Referring to FIG. 1, first, binarization for each area is performed on a grayscale image to obtain a binarized image (step S101). Details of step S101 will be described later.

次に、x=CXの直線上を通る黒点、x=CX+Aの直線上を通る黒点又はx=CX−Aの直線上を通る黒点があれば、それらを検出する(ステップS103)。ここで、CXは、画像のX方向の中心付近の座標であり、Aは、通常の撮影画像において、枠の短辺よりも短くなるように定められた値である。   Next, if there are black spots that pass on the straight line x = CX, black spots that pass on the straight line x = CX + A, or black spots that pass on the straight line x = CX-A, they are detected (step S103). Here, CX is a coordinate near the center in the X direction of the image, and A is a value determined to be shorter than the short side of the frame in a normal captured image.

次に、y=CYの直線上を通る黒点、y=CY+Bの直線上を通る黒点又はy=CY−Bの直線上を通る黒点があれば、それらを検出する(ステップS105)。ここで、CYは、画像のY方向の中心付近の座標であり、Bは、通常の撮影画像において、枠の短辺よりも短くなるように定められた値である。   Next, if there are black spots that pass on the straight line y = CY, black spots that pass on the straight line y = CY + B, or black spots that pass on the straight line y = CY-B, these are detected (step S105). Here, CY is a coordinate near the center of the image in the Y direction, and B is a value determined so as to be shorter than the short side of the frame in a normal captured image.

次に、ステップS103で検出されたx=CX−Aの直線上を通る黒点とx=CX−Aの直線上を通る黒点との組合せを全て求める(ステップS107)。例えば、x=CX−Aの直線上を通る黒点の数が3であり、x=CX−Aの直線上を通る黒点の数が4であれば、3×4=12通りの組合せを求める。   Next, all combinations of black spots passing through the line x = CX-A detected in step S103 and black spots passing through the line x = CX-A are obtained (step S107). For example, if the number of black spots passing through the straight line x = CX-A is 3, and the number of black spots passing through the straight line x = CX-A is 4, 3 × 4 = 12 combinations are obtained.

次に、ステップS105で検出されたy=CY−Bの直線上を通る黒点とy=CY−Bの直線上を通る黒点との組合せを全て求める(ステップS109)。例えば、y=CY−Bの直線上を通る黒点の数が2であり、y=CY−Bの直線上を通る黒点の数が5であれば、2×5=10通りの組合せを求める。   Next, all combinations of black spots passing through the y = CY-B straight line detected at step S105 and black spots passing through the y = CY-B straight line are obtained (step S109). For example, if the number of black spots passing on the line y = CY-B is 2 and the number of black spots passing on the line y = CY-B is 5, 2 × 5 = 10 combinations are obtained.

次に、ステップS107で求めた全ての組合せのうち、組合せをなす2点の中点のx=CX上の黒点がある組合せのみを選択する(ステップS111)。   Next, of all the combinations obtained in step S107, only the combination having a black point on x = CX at the midpoint of the two points forming the combination is selected (step S111).

次に、ステップS109で求めた全ての組合せのうち、組合せをなす2点の中点のy=CY上の黒点がある組合せのみを選択する(ステップS113)。   Next, out of all the combinations obtained in step S109, only the combination having a black point on y = CY at the midpoint between the two points forming the combination is selected (step S113).

次に、ステップS111で選択した全ての組合せのうち、組合せをなす2点の間の全ての画素が黒い線分をなす組合せのみを選択する(ステップS115)。   Next, of all the combinations selected in step S111, only the combination in which all the pixels between the two points forming the combination form a black line segment is selected (step S115).

次に、ステップS113で選択した全ての組合せのうち、組合せをなす2点の間の全ての画素が黒い線分をなす組合せのみを選択する(ステップS116)。   Next, of all the combinations selected in step S113, only the combination in which all the pixels between the two points forming the combination form a black line segment is selected (step S116).

次に、ステップS115で選択した全ての組合せについて、組合せをなす2点を通る直線の両端の点を求める(ステップS117)。   Next, for all combinations selected in step S115, points at both ends of a straight line passing through the two points forming the combination are obtained (step S117).

次に、ステップS116で選択した全ての組合せについて、組合せをなす2点を通る直線の両端の点を求める(ステップS118)。   Next, for all combinations selected in step S116, points at both ends of a straight line passing through the two points forming the combination are obtained (step S118).

図2を参照すると、次に、ステップS115で選択した組合せに係る線分の全ての組合せについてステップS119SからステップS119Eまでの処理を線分が長い順に繰り返す。   Referring to FIG. 2, next, the processes from step S119S to step S119E are repeated in the order of longer line segments for all combinations of the line segments related to the combination selected in step S115.

各繰り返しの中では、まず、枠確定処理を行う(ステップS121)。枠確定処理の詳細については後述する。   In each repetition, first, a frame determination process is performed (step S121). Details of the frame determination process will be described later.

次に、枠確定処理で枠が確定したか否かを判断して(ステップS123)、確定しなければ、次の繰り返しに進む。確定したならば(ステップS123でYES)、枠が画像の中心付近にあるか否かを判断する(ステップS125)。   Next, it is determined whether or not the frame has been confirmed in the frame confirmation process (step S123). If not confirmed, the process proceeds to the next iteration. If confirmed (YES in step S123), it is determined whether or not the frame is near the center of the image (step S125).

枠が画像の中心付近にあれば(ステップS125でYES)、ステップS139に進む。すなわち、ステップS119SとステップS119Eとの間の繰り返しを抜ける。   If the frame is near the center of the image (YES in step S125), the process proceeds to step S139. In other words, the process repeats between step S119S and step S119E.

枠が画像の中心付近になければ(ステップS125でNO)、ステップS121で確定した枠を枠候補として保存する(ステップS127)。この際、枠の中心と画像の中心との間の距離を測り、この距離も枠候補に関連付けて保存する。ステップS127が終了したならば、次の繰り返しに進む。   If the frame is not near the center of the image (NO in step S125), the frame determined in step S121 is stored as a frame candidate (step S127). At this time, the distance between the center of the frame and the center of the image is measured, and this distance is also stored in association with the frame candidate. When step S127 ends, the process proceeds to the next iteration.

ステップS119SからステップS119Eまでの繰り返しが終了したならば、ステップS116で選択した組合せに係る線分の全ての組合せについてステップS129SからステップS129Eまでの処理を線分が長い順に繰り返す。   When the repetition from step S119S to step S119E is completed, the processing from step S129S to step S129E is repeated in the order of long line segment for all combinations of the line segments related to the combination selected in step S116.

各繰り返しの中では、まず、ステップS121と同様な枠確定処理を行う(ステップS131)。   In each repetition, first, a frame determination process similar to step S121 is performed (step S131).

次に、枠確定処理で枠が確定したか否かを判断して(ステップS133)、確定しなければ、次の繰り返しに進む。確定したならば(ステップS133でYES)、枠が画像の中心付近にあるか否かを判断する(ステップS135)。   Next, it is determined whether or not the frame has been confirmed in the frame confirmation process (step S133). If not confirmed, the process proceeds to the next iteration. If determined (YES in step S133), it is determined whether or not the frame is near the center of the image (step S135).

枠が画像の中心付近にあれば(ステップS135でYES)、ステップS139に進む。すなわち、ステップS129SとステップS129Eとの間の繰り返しを抜ける。   If the frame is near the center of the image (YES in step S135), the process proceeds to step S139. That is, the process repeats between step S129S and step S129E.

枠が画像の中心付近になければ(ステップS135でNO)、ステップS131で確定した枠を枠候補として保存する(ステップS137)。この際、枠の中心と画像の中心との間の距離を測り、この距離も枠候補に関連付けて保存する。ステップS137が終了したならば、次の繰り返しに進む。   If the frame is not near the center of the image (NO in step S135), the frame determined in step S131 is stored as a frame candidate (step S137). At this time, the distance between the center of the frame and the center of the image is measured, and this distance is also stored in association with the frame candidate. When step S137 ends, the process proceeds to the next iteration.

ステップS129SからステップS129Eまでの繰り返しが終了したならば、枠確定処理(ステップS121又はステップS131)で確定した枠があるか否かを調べる(ステップS139)。   If the repetition from step S129S to step S129E is completed, it is checked whether or not there is a frame determined in the frame determination process (step S121 or step S131) (step S139).

確定した枠がなければ(ステップS139でNO)、エラー処理をして(ステップS141)、動作を終了する。   If there is no fixed frame (NO in step S139), error processing is performed (step S141), and the operation is terminated.

確定した枠があれば(ステップS139でYES)、確定した枠のうち、枠の中心と前記二値画像の中心との間の距離が最も短い枠を最終的に検出された枠として(ステップS137)、ステップS139に進む。   If there is a confirmed frame (YES in step S139), among the confirmed frames, the frame having the shortest distance between the center of the frame and the center of the binary image is determined as the finally detected frame (step S137). ), The process proceeds to step S139.

ステップS139では、枠を拡げ、頂点座標を特定する。すなわち、枠の線には幅があるが、枠の最も外側の四隅の座標を特定する。   In step S139, the frame is expanded and the vertex coordinates are specified. That is, although the frame line has a width, the coordinates of the outermost four corners of the frame are specified.

次に、エリア別二値化のステップ(ステップS101)の詳細について、図3を参照して説明する。   Next, details of the binarization step by area (step S101) will be described with reference to FIG.

図3を参照すると、まず、カラー画像をグレースケール変換し、グレースケール画像を得る(ステップS101−1)。   Referring to FIG. 3, first, a color image is subjected to gray scale conversion to obtain a gray scale image (step S101-1).

次に、グレースケール画像を、例えば、横20画素×縦20画素のブロックに分割する(ステップS101−3)。   Next, the grayscale image is divided into, for example, blocks of horizontal 20 pixels × vertical 20 pixels (step S101-3).

次に、ブロック毎に二値化のための暫定の閾値を決定する(ステップS101−5)。ここでは、例えば、大津による閾値選定の方法を用いて、各ブロック毎の閾値を求め、それを暫定の閾値とする。   Next, a temporary threshold for binarization is determined for each block (step S101-5). Here, for example, a threshold value selection method by Otsu is used to obtain a threshold value for each block, which is set as a provisional threshold value.

次に、二値化のための閾値を補正する(ステップS191−7)。ここでは、各ブロックについて周辺の8ブロックの暫定の閾値のうち自ブロックの暫定の閾値よりもレベルの低いものと、自ブロックの暫定の閾値とを合わせた暫定の閾値の平均値を最終的な閾値とする。   Next, the threshold value for binarization is corrected (step S191-7). Here, for each block, the average value of the tentative thresholds, which is the sum of the tentative threshold values of the neighboring blocks and the tentative threshold value of the own block, among the tentative threshold values of the neighboring blocks, The threshold is used.

次に、ステップS101−7で求めた閾値を用いて各ブロック毎にグレースケール画像を二値化画像に変換する(ステップS101−9)。   Next, the grayscale image is converted into a binarized image for each block using the threshold value obtained in step S101-7 (step S101-9).

次に、枠確定処理のステップ(ステップS121、S131)の詳細について、図4を参照して説明する。ここでは、一方の線の左側の端点を点1、右側の端点を点2、他方の線の左側の端点を点3、右側の端点を点4とする。   Next, details of the steps (steps S121 and S131) of the frame determination process will be described with reference to FIG. Here, the left endpoint of one line is point 1, the right endpoint is point 2, the left endpoint of the other line is point 3, and the right endpoint is point 4.

図4を参照すると、まず、点1と点3との間に辺が存在するか否かを調べる(ステップS121−1)。ここで、点1と点3との間の全ての画素が黒であれば、辺が存在すると判断する。   Referring to FIG. 4, first, it is examined whether or not an edge exists between the points 1 and 3 (step S121-1). Here, if all the pixels between the points 1 and 3 are black, it is determined that there is an edge.

次に、点2と点4との間に辺が存在するか否かを調べる(ステップS121−3)。ここで、点2と点4との間の全ての画素が黒であれば、辺が存在すると判断する。   Next, it is examined whether or not an edge exists between the points 2 and 4 (step S121-3). Here, if all the pixels between the points 2 and 4 are black, it is determined that there is an edge.

次に、ステップS121−1及びステップS121−3で辺が見つかったか否かを判断する(ステップS121−5)。ステップS121−5の判断結果が肯定的であれば(辺が2本見つかったならば)、ステップS121−7に進む。   Next, it is determined whether or not an edge has been found in steps S121-1 and S121-3 (step S121-5). If the determination result of step S121-5 is affirmative (if two sides are found), the process proceeds to step S121-7.

ステップS121−5の判断結果が否定的であれば、ステップS121−1及びステップS121−3のうち片方のステップで辺が見つかったか否かを判断する(ステップS121−11)。ステップS121−11での判断結果が肯定的であれば(辺が1本見つかったならば)、ステップS121−13に進む。ステップS121−11での判断結果が否定的であれば(辺が1本も見つからなかったらば)、ステップS121−21に進む。   If the determination result in step S121-5 is negative, it is determined whether an edge is found in one of steps S121-1 and S121-3 (step S121-11). If the determination result in step S121-11 is affirmative (if one edge is found), the process proceeds to step S121-13. If the determination result in step S121-11 is negative (if no edge is found), the process proceeds to step S121-21.

ステップS121−13では、辺が見つからなかった側について、片方の線分の端点を通り、その線の法線方向に伸びる線分があるか否かを調べる。   In step S121-13, it is checked whether or not there is a line segment that passes through the end point of one line segment and extends in the normal direction of the line on the side where no side is found.

次に、ステップS121−13での要件を満たす線分が見つかったか否かを判断し(ステップS121−15)、見つかったならば(ステップS121−15でYES)、ステップS121−7に進む。   Next, it is determined whether or not a line segment satisfying the requirements in step S121-13 has been found (step S121-15). If found (YES in step S121-15), the process proceeds to step S121-7.

見つからなかったならば(ステップS121−15でNO)、辺が見つからなかった側について、他方の線分の端点(ステップS121−13で調べなかった線の端点)を通り、その線の法線方向に伸びる線分があるか否かを調べる(ステップS121−17)。   If not found (NO in step S121-15), the side where no side is found passes through the end point of the other line segment (the end point of the line not checked in step S121-13), and the normal direction of the line It is checked whether or not there is a line segment extending (step S121-17).

次に、ステップS121−17での要件を満たす線分が見つかったか否かを判断し(ステップS121−19)、見つかったならば(ステップS121−19でYES)、ステップS121−7に進む。   Next, it is determined whether or not a line segment satisfying the requirements in step S121-17 has been found (step S121-19). If found (YES in step S121-19), the process proceeds to step S121-7.

見つからなかったならば(ステップS121−19でNO)、ステップS121−37に進む。   If not found (NO in step S121-19), the process proceeds to step S121-37.

ステップS121−21では、4つある端点(点1、点2、点3、点4)のうち1つの端点(例えば、点1)について、その端点を通り、その端点を有する線の法線方向に伸びる線分があるか否かを調べる。   In step S121-21, about one end point (for example, point 1) among the four end points (point 1, point 2, point 3, point 4), the normal direction of the line passing through the end point and having the end point Check to see if there is a line segment that extends.

ステップS121−23では、ステップS121−21での要件を満たす線分が見つかったか否かを判断し、見つかったならば(ステップS121−23でYES)、ステップS121−25に進む。   In step S121-23, it is determined whether or not a line segment satisfying the requirement in step S121-21 is found. If found (YES in step S121-23), the process proceeds to step S121-25.

見つからなかったならば(ステップS121−23でNO)、ステップS121−21で調べた端点と向かい合う端点(例えば点3)を通り、その端点を有する線の法線方向に伸びる線分があるか否かを調べる(ステップS121−27)。   If not found (NO in step S121-23), whether there is a line extending through the end point (for example, point 3) facing the end point examined in step S121-21 and extending in the normal direction of the line having the end point (Step S121-27).

ステップS121−29では、ステップS121−27での要件を満たす線分が見つかったか否かを判断し、見つかったならば(ステップS121−29でYES)、ステップS121−25に進む。   In step S121-29, it is determined whether a line segment satisfying the requirements in step S121-27 has been found. If found (YES in step S121-29), the process proceeds to step S121-25.

見つからなかったならば(ステップS121−29でNO)、ステップS121−37に進む。   If not found (NO in step S121-29), the process proceeds to step S121-37.

ステップS121−25では、ステップS121−21で調べた端点を有する線分の他方の端点(例えば点2)を通り、その端点を有する線の法線方向に伸びる線分があるか否かを調べる。   In step S121-25, it is checked whether there is a line segment that passes through the other end point (eg, point 2) having the end point checked in step S121-21 and extends in the normal direction of the line having the end point. .

ステップS121−31では、ステップS121−25での要件を満たす線分が見つかったか否かを判断し、見つかったならば(ステップS121−31でYES)、ステップS121−7に進む。   In step S121-31, it is determined whether a line segment satisfying the requirement in step S121-25 is found. If found (YES in step S121-31), the process proceeds to step S121-7.

見つからなかったならば(ステップS121−31でNO)、ステップS121−25で調べた端点と向かい合う点(例えば点4)を通り、その端点を有する線の法線方向に伸びる線分があるか否かを調べる(ステップS121−33)。   If not found (NO in step S121-31), whether there is a line segment that passes through a point (for example, point 4) facing the end point examined in step S121-25 and extends in the normal direction of the line having the end point. (Step S121-33).

ステップS121−35では、ステップS121−33の条件を満たす線分が見つかったか否かを判断し、見つかったならば(ステップS121−35でYES)、ステップS121−7に進む。   In step S121-35, it is determined whether a line segment satisfying the condition of step S121-33 has been found. If found (YES in step S121-35), the process proceeds to step S121-7.

見つからなかったならば(ステップS121−35でNO)、ステップS121−37に進む。   If not found (NO in step S121-35), the process proceeds to step S121-37.

ステップS121−7では、見つかった4辺が長方形を構成するか否かを調べる。ここで、線分が結ばれていない場合には、結ばれて辺を構成するまで線分を延ばす。   In step S121-7, it is checked whether or not the four sides found form a rectangle. Here, if the line segment is not connected, the line segment is extended until it is connected to form a side.

見つかった4辺が長方形を構成する場合には(ステップS121−7でYES)、見つかった4辺を枠を構成する4辺として確定する(ステップS121−9)。すなわち、枠が見つかったと確定する。   When the found four sides form a rectangle (YES in step S121-7), the found four sides are determined as the four sides constituting the frame (step S121-9). That is, it is determined that a frame has been found.

見つかった4辺が長方形を構成しない場合には(ステップS121−7でNO)、ステップS121−37に進む。   If the found four sides do not form a rectangle (NO in step S121-7), the process proceeds to step S121-37.

ステップS121−37では、向かい合う線分は枠の一部ではないことを確定する。   In step S121-37, it is determined that the opposing line segment is not part of the frame.

上述した方法は、ハードウェアのみによっても実現することができる。ただし、上述した方法をコンピュータによって実現することもできる。この場合、コンピュータを各ステップを行う機能部として機能させるためのプログラムをコンピュータが読み込んで実行することによって、上述した方法を実現することができる。   The above-described method can be realized only by hardware. However, the method described above can also be realized by a computer. In this case, the above-described method can be realized by causing the computer to read and execute a program for causing the computer to function as a functional unit that performs each step.

図5は、グレースケール画像をブロック化し、その上で、二値化して二値化画像を得る過程において、ブロックサイズによって、二値化画像がどのように変化するのかを示している。   FIG. 5 shows how the binarized image changes depending on the block size in the process of making a grayscale image into blocks and then binarizing it to obtain a binarized image.

(a)〜(e)は、枠の太さが3ポイントであり、撮影された画像が回転していない場合の例を示す。(f)〜(j)は、枠の太さが6ポイントであり、撮影された画像が回転している場合の例を示す。(a)、(f)はブロックサイズが横12画素×縦12画素の場合の二値化画像を示し、(b)、(g)はブロックサイズが横20画素×縦20画素の場合の二値化画像を示し、(c)、(h)はブロックサイズが横32画素×縦32画素の場合の二値化画像を示し、(d)、(i)はブロックサイズが横48画素×縦48画素の場合の二値化画像を示し、(e)、(j)はブロックに分割しない場合の二値化画像を示す。   (A)-(e) shows the example in case the thickness of a frame is 3 points | pieces and the image | photographed image is not rotating. (F)-(j) shows the example in case the thickness of a frame is 6 points | pieces and the image | photographed image is rotating. (A), (f) shows the binarized image when the block size is 12 horizontal pixels × 12 vertical pixels, and (b), (g) are two images when the block size is 20 horizontal pixels × 20 vertical pixels. (C) and (h) show binarized images when the block size is horizontal 32 pixels × vertical 32 pixels, and (d) and (i) show block sizes of horizontal 48 pixels × vertical. The binarized image in the case of 48 pixels is shown, and (e) and (j) show the binarized image when not divided into blocks.

実験では、ブロックサイズが横20画素×縦20画素である場合に、枠を最も検出しやすいという結果が出ている。   Experiments have shown that the frame is most easily detected when the block size is 20 pixels wide × 20 pixels vertical.

図6は、グレースケール画像をブロック化し、その上で、二値化して二値化画像を得る過程において、閾値によって、二値化画像がどのように変化するのかを示している。   FIG. 6 shows how the binarized image changes depending on the threshold value in the process of blocking the grayscale image and binarizing it to obtain the binarized image.

(a)〜(c)は、枠の太さが3ポイントであり、撮影された画像が回転していない場合の例を示す。(d)〜(f)は、枠の太さが6ポイントであり、撮影された画像が回転している場合の例を示す。ブロックサイズは横20画素×縦20画素である。(a)、(d)は実施形態で述べた暫定の閾値をそのまま利用した場合の二値化画像を示し、(b)、(g)は自ブロックの暫定の閾値と上下左右の暫定の閾値の合わせて5つの暫定の閾値の平均値を最終的な閾値として利用した場合の二値化画像を示し、(c)、(f)は自ブロックの暫定の閾値と周囲8ブロックの暫定の閾値のうち自ブロックの暫定の閾値よりレベルが低いものと合わせた暫定の閾値の平均値を最終的な閾値として利用した場合の二値化画像を示す。   (A)-(c) shows the example in case the thickness of a frame is 3 points | pieces and the image | photographed image is not rotating. (D)-(f) shows the example in case the thickness of a frame is 6 points | pieces and the imaged image is rotating. The block size is 20 horizontal pixels × 20 vertical pixels. (A), (d) shows the binarized image when the temporary threshold described in the embodiment is used as it is, and (b), (g) are the temporary threshold of the own block and the upper, lower, left, and right temporary thresholds. (B) shows the binarized image when the average value of the five provisional thresholds is used as the final threshold in combination, (c) and (f) are the provisional threshold of the own block and the provisional threshold of the surrounding eight blocks The binarized image in the case where the average value of the temporary thresholds combined with the lower level than the temporary threshold value of the own block is used as the final threshold value is shown.

実験では、自ブロックの暫定の閾値と周囲8ブロックの暫定の閾値のうちのレベルが低い閾値と合わせた暫定の閾値の平均値を最終的な閾値として利用した場合に、枠を最も検出しやすいという結果が出ている。   In the experiment, the frame is most easily detected when the average value of the temporary thresholds combined with the low threshold value of the temporary threshold value of the own block and the temporary threshold values of the surrounding 8 blocks is used as the final threshold value. The result is out.

図7は、実施形態で述べた暫定の閾値をそのまま利用した場合のノイズ除去後の二値化画像と、実施形態で述べた暫定の閾値を基に、自ブロックの暫定の閾値と周囲8ブロックの暫定の閾値のうち自ブロックの暫定の閾値よりレベルが低いものと合わせた暫定の閾値の平均値を最終的な閾値として利用した場合のノイズ除去後の二値化画像を示す。   FIG. 7 shows a binarized image after noise removal when the provisional threshold described in the embodiment is used as it is, and the provisional threshold of the own block and the surrounding eight blocks based on the provisional threshold described in the embodiment. The binarized image after noise removal in the case where the average value of the temporary thresholds combined with the temporary threshold value of the current block, which is lower than the temporary threshold value of the own block, is used as the final threshold value.

図8(a)は、Y軸方向の3本の線が枠の長い方の線を捉えることができるため、枠の検出をすることができる例を示している。   FIG. 8A shows an example in which a frame can be detected because three lines in the Y-axis direction can catch the longer line.

図8(b)は、X軸方向の3本の線が枠の長い方の線を捉えることができるため、枠の検出をすることができる例を示している。   FIG. 8B shows an example in which a frame can be detected because three lines in the X-axis direction can catch the longer line.

図9は、実施形態のステップS139において、枠を拡げる方向を示す。交わる2つの辺の外角は270度であるが、この半分の角度である135度の方向が枠を拡げる方向である。しかし、画素は格子状に並んでいるため、枠に含まれる少ない画素数では、枠を拡げたい方向に枠を拡げることができない。そこで、図9に示すように、枠を拡げたい方向を8分割し、各分割方向毎に実際に枠を拡げる方向を定める。   FIG. 9 shows a direction in which the frame is expanded in step S139 of the embodiment. The outer angle of the two intersecting sides is 270 degrees, but a direction of 135 degrees, which is a half of this angle, is the direction in which the frame is expanded. However, since the pixels are arranged in a grid, the frame cannot be expanded in the direction in which the frame is to be expanded with a small number of pixels included in the frame. Therefore, as shown in FIG. 9, the direction in which the frame is to be expanded is divided into eight, and the direction in which the frame is actually expanded is determined for each division direction.

例えば、x軸のプラス方向を中心にしてプラスマイナス15度の枠を拡げたい方向の範囲(a)に対しては、実際に枠を拡げる方向をゼロ度に定める。また、y軸のプラス方向を中心にしてプラスマイナス15度の枠を拡げたい方向の範囲(c)に対しては、実際に枠を拡げる方向を−90度に定める。更に、x軸のマイナス方向を中心にしてプラスマイナス15度の枠を拡げたい方向の範囲(e)に対しては、実際に枠を拡げる方向を180度に定める。更に、y軸のマイナス方向を中心にしてプラスマイナス15度の枠を拡げたい方向の範囲(g)に対しては、実際に枠を拡げる方向を90度に定める。更に、範囲(a)と範囲(c)とに挟まれた範囲(b)に対しては、実際に枠を拡げる方向を−45度に定める。更に、範囲(c)と範囲(e)とに挟まれた範囲(d)に対しては、実際に枠を拡げる方向を−135度に定める。更に、範囲(e)と範囲(g)とに挟まれた範囲(f)に対しては、実際に枠を拡げる方向を135度に定める。更に、範囲(a)と範囲(g)とに挟まれた範囲(b)に対しては、実際に枠を拡げる方向を45度に定める。   For example, for the range (a) in the direction in which it is desired to expand the frame of plus or minus 15 degrees around the plus direction of the x axis, the direction in which the frame is actually expanded is set to zero degrees. Further, for the range (c) in the direction in which the frame of +/- 15 degrees is desired to be expanded around the positive direction of the y axis, the direction in which the frame is actually expanded is set to -90 degrees. Furthermore, with respect to the range (e) in the direction in which the frame of +/- 15 degrees is desired to be expanded about the minus direction of the x axis, the direction in which the frame is actually expanded is set to 180 degrees. Further, with respect to the range (g) in the direction in which the frame of +/- 15 degrees is desired to be expanded around the negative direction of the y axis, the direction in which the frame is actually expanded is set to 90 degrees. Further, for the range (b) sandwiched between the range (a) and the range (c), the direction in which the frame is actually expanded is set to −45 degrees. Furthermore, for the range (d) sandwiched between the range (c) and the range (e), the direction in which the frame is actually expanded is set to -135 degrees. Further, for the range (f) sandwiched between the range (e) and the range (g), the direction in which the frame is actually expanded is set to 135 degrees. Further, for the range (b) sandwiched between the range (a) and the range (g), the direction in which the frame is actually expanded is set to 45 degrees.

図10(a)は、枠を拡げたい方向と実際に枠を拡げる方向とが共に135度の方向である例を示している。図10(b)は、枠を拡げたい方向と実際に枠を拡げる方向とが共に90度の方向である例を示している。   FIG. 10A shows an example in which the direction in which the frame is to be expanded and the direction in which the frame is actually expanded are both 135 degrees. FIG. 10B shows an example in which the direction in which the frame is to be expanded and the direction in which the frame is actually expanded are both 90 degrees.

本発明の実施形態による枠検出方法の全体を示すフローチャート(1/2)である。It is a flowchart (1/2) which shows the whole frame detection method by embodiment of this invention. 本発明の実施形態による枠検出方法の全体を示すフローチャート(2/2)である。It is a flowchart (2/2) which shows the whole frame detection method by embodiment of this invention. 図1に示すエリア別二値化の詳細を示すフローチャートである。It is a flowchart which shows the detail of the binarization classified by area shown in FIG. 図2に示す枠確定処理の詳細を示すフローチャートである。It is a flowchart which shows the detail of the frame determination process shown in FIG. グレースケール画像をブロック化し、その上で、二値化して二値化画像を得る過程において、ブロックサイズによって、二値化画像がどのように変化するのかを示す図である。It is a figure which shows how a binarized image changes with block sizes in the process which blocks a grayscale image and binarizes it and obtains a binarized image on it. グレースケール画像をブロック化し、その上で、二値化して二値化画像を得る過程において、閾値によって、二値化画像がどのように変化するのかを示す図である。It is a figure which shows how a binarized image changes with a threshold value in the process which blocks a gray scale image and binarizes and obtains a binarized image on it. (c)は、本発明の実施形態で述べた暫定の閾値をそのまま利用した場合のノイズ除去後の二値化画像を示し、(f)は、本発明の実施形態で述べた暫定の閾値を基に、自ブロックの暫定の閾値と周囲8ブロックの暫定の閾値のうち自ブロックの暫定の閾値よりレベルが低いものと合わせた暫定の閾値の平均値を最終的な閾値として利用した場合のノイズ除去後の二値化画像を示す。(a)、(d)は、原画像を示す。(b)は、本発明の実施形態で述べた暫定の閾値をそのまま利用した場合の二値化した直後の画像を示し、(e)は、本発明の実施形態で述べた暫定の閾値を基に、自ブロックの暫定の閾値と周囲8ブロックの暫定の閾値のうち自ブロックの暫定の閾値よりレベルが低いものと合わせた暫定の閾値の平均値を最終的な閾値として利用した場合の二値化直後の画像を示す。(C) shows the binarized image after noise removal when the provisional threshold described in the embodiment of the present invention is used as it is, and (f) shows the provisional threshold described in the embodiment of the present invention. Based on the provisional threshold of the current block and the provisional threshold of the surrounding eight blocks, the average value of the provisional threshold combined with the lower threshold than the provisional threshold of the own block is used as the final threshold. The binarized image after removal is shown. (A), (d) shows an original image. (B) shows an image immediately after binarization when the provisional threshold described in the embodiment of the present invention is used as it is, and (e) shows the provisional threshold described in the embodiment of the present invention. In addition, when the average value of the tentative thresholds combined with the tentative threshold value of the own block and the tentative threshold values of the surrounding 8 blocks that are lower than the tentative threshold value of the own block is used as the final threshold value, An image immediately after conversion is shown. (a)は、Y軸方向の3本の線が枠の長い方の線を捉えることができるため、枠の検出をすることができる例を示す。(b)は、X軸方向の3本の線が枠の長い方の線を捉えることができるため、枠の検出をすることができる例を示す。(A) shows an example in which a frame can be detected because three lines in the Y-axis direction can capture the longer line. (B) shows an example in which a frame can be detected because three lines in the X-axis direction can catch the longer line. 本発明の実施形態のステップS139において、枠を拡げる方向を示す。In step S139 of the embodiment of the present invention, the direction in which the frame is expanded is shown. (a)は、枠を拡げたい方向と実際に枠を拡げる方向とが共に135度の方向である例を示す。(b)は、枠を拡げたい方向と実際に枠を拡げる方向とが共に90度の方向である例を示す。(A) shows an example in which the direction in which the frame is to be expanded and the direction in which the frame is actually expanded are both 135 degrees. (B) shows an example in which the direction in which the frame is to be expanded and the direction in which the frame is actually expanded are both 90 degrees.

Claims (17)

入力したグレースケール画像を白黒に二値化して二値化画像を得る二値化ステップと、
前記二値化画像から、前記二値化画像の中心付近を通る縦方向の第1直線を通る黒点、前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から一方の方向に離れた第2直線を通る黒点又は前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から他方の方向に離れた第3直線を通る黒点があれば、それらの黒点を全て検出する第1黒点検出ステップと、
前記二値化画像から、前記二値化画像の中心付近を通る横方向の第4直線を通る黒点、前記第4直線に平行であって検出しようとする枠の縦方向の辺よりも短くなるように定められた距離だけ前記第4の直線から一方の方向に離れた第5直線を通る黒点又は前記第4直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第4の直線から他方の方向に離れた第6直線を通る黒点があれば、それらの黒点を全て検出する第2黒点検出ステップと、
前記第1黒点検出ステップで検出した前記第2直線を通る黒点と前記第1黒点検出ステップで検出した前記第3直線を通る黒点との組合せを全て求める第1組合せ生成ステップと、
前記第2黒点検出ステップで検出した前記第5直線を通る黒点と前記第2黒点検出ステップで検出した前記第6直線を通る黒点との組合せを全て求める第2組合せ生成ステップと、
前記第1組合せ生成ステップで生成した組合せから、組合せをなす2つの黒点の中点に前記第1直線を通る黒点がある組合せのみを選択する第1選択ステップと、
前記第2組合せ生成ステップで生成した組合せから、組合せをなす2つの黒点の中点に前記第4直線を通る黒点がある組合せのみを選択する第2選択ステップと、
前記第1選択ステップで選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第3選択ステップと、
前記第2選択ステップで選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第4選択ステップと、
前記第3選択ステップで選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第1直線端点検出ステップと、
前記第4選択ステップで選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第2直線端点検出ステップと、
前記第3選択ステップで選択した組合せに係る線分の全ての対について線分が長い順に第1枠確定処理を行い、或る線分の対について前記第1枠確定処理により枠が確定したならば、前記或る線分の対について前記第1枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記或る線分の対について前記第1枠確定処理により確定した枠を最終的に検出された枠とする第1枠検出ステップと、
前記第4選択ステップで選択した組合せに係る線分の全ての対について線分が長い順に第2枠確定処理を行い、或る線分の対について前記第2枠確定処理により枠が確定したならば、前記或る線分について前記第2枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記第2枠確定処理により確定した枠を最終的に検出された枠とする第2枠検出ステップと、
を備えることを特徴とする枠検出方法。
A binarization step of binarizing the input grayscale image into black and white to obtain a binarized image;
From the binarized image, a black spot that passes through the first straight line in the vertical direction passing near the center of the binarized image, and is shorter than the horizontal side of the frame to be detected that is parallel to the first straight line. In this way, the black point passing through the second straight line separated from the first straight line in one direction by a predetermined distance or parallel to the first straight line is shorter than the lateral side of the frame to be detected. If there are black spots that pass through a third straight line that is separated from the first straight line in the other direction by a distance determined in (1), a first black spot detecting step that detects all of the black spots;
From the binarized image, a black spot that passes through the fourth straight line in the horizontal direction passing near the center of the binarized image, and is shorter than the vertical side of the frame to be detected that is parallel to the fourth straight line. In such a manner, the black point passing through the fifth straight line separated from the fourth straight line in one direction by a predetermined distance or the horizontal side of the frame to be detected that is parallel to the fourth straight line is shorter. If there are black spots that pass through a sixth straight line that is separated from the fourth straight line in the other direction by a distance determined in (2), a second black spot detecting step that detects all of the black spots;
A first combination generating step for obtaining all combinations of black spots passing through the second straight line detected in the first black spot detecting step and black spots passing through the third straight line detected in the first black spot detecting step;
A second combination generating step for obtaining all combinations of black spots passing through the fifth straight line detected in the second black spot detecting step and black spots passing through the sixth straight line detected in the second black spot detecting step;
A first selection step of selecting, from the combinations generated in the first combination generation step, only a combination having a black point passing through the first straight line at a midpoint between two black points forming the combination;
A second selection step of selecting, from the combinations generated in the second combination generation step, only a combination having a black point passing through the fourth straight line at a midpoint between two black points forming the combination;
A third selection step of selecting only a combination in which all pixels between two black dots forming the combination form a black line segment from the combinations selected in the first selection step;
A fourth selection step for selecting, from the combinations selected in the second selection step, only a combination in which all pixels between two black dots forming the combination form a black line segment;
For the combination selected in the third selection step, a first straight line end point detection step for obtaining points at both ends of the line segment passing through the two points forming the combination;
For the combination selected in the fourth selection step, a second straight line end point detecting step for obtaining points at both ends of the line segment passing through the two points forming the combination;
If the first frame determination process is performed for all pairs of line segments related to the combination selected in the third selection step in descending order of the line segments, and the frame is determined by the first frame determination process for a certain line segment pair For example, it is checked whether or not the frame determined by the first frame determination process for the certain line segment pair is near the center of the binary image. A first frame detection step in which the frame determined by the first frame determination process is the frame finally detected;
If the second frame determination process is performed for all pairs of line segments related to the combination selected in the fourth selection step in descending order of the line segments, and the frame is determined by the second frame determination process for a certain line segment pair For example, it is checked whether or not the frame determined by the second frame determination process for the certain line segment is near the center of the binary image. If so, the frame determined by the second frame determination process is determined. A second frame detection step as a finally detected frame;
A frame detection method comprising:
前記第1枠検出ステップにおいて、前記第1枠確定処理により確定した枠が前記二値画像の中心付近にないと判断されたならば、前記第1枠確定処理により確定した枠の中心と前記二値画像の中心との間の距離を測ると共に、前記第1枠確定処理により確定した枠と測った距離とを保存する第1枠候補保存ステップと、
前記第2枠検出ステップにおいて、前記第2枠確定処理により確定した枠が前記二値画像の中心にないと判断されたならば、前記第2枠確定処理により確定した枠の中心と前記二値画像の中心との間の距離を測ると共に、前記第2枠確定処理により確定した枠と測った距離とを保存する第2枠候補保存ステップと、
前記第1枠候補保存ステップで保存された枠と前記第2枠候補保存ステップで保存された枠のうち、枠の中心と前記二値画像の中心との間の距離が最も短い枠を最終的に検出された枠とする第3枠検出ステップと、
を更に備えることを特徴とする請求項1に記載の枠検出方法。
In the first frame detection step, if it is determined that the frame determined by the first frame determination process is not near the center of the binary image, the center of the frame determined by the first frame determination process and the second frame are determined. A first frame candidate storing step of measuring a distance between the center of the value image and storing the frame determined by the first frame determining process and the measured distance;
In the second frame detection step, if it is determined that the frame determined by the second frame determination process is not at the center of the binary image, the center of the frame determined by the second frame determination process and the binary value are determined. A second frame candidate storing step of measuring the distance between the center of the image and storing the frame determined by the second frame determining process and the measured distance;
Of the frames stored in the first frame candidate storage step and the frames stored in the second frame candidate storage step, the frame having the shortest distance between the center of the frame and the center of the binary image is finally determined. A third frame detecting step to detect the detected frame;
The frame detection method according to claim 1, further comprising:
前記枠確定処理は、
対象となっている一方の辺の一方の端点と対象となっている他方の辺の一方の端点との間に辺が存在するか否かを確認する第1結合辺存在確認ステップと、
対象となっている前記一方の辺の他方の端点と対象となっている前記他方の辺の他方の端点との間に辺が存在するか否かを確認する第2結合辺存在確認ステップと、
前記第1結合辺存在確認ステップ及び前記第2結合辺存在確認ステップの双方の確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認ステップで存在することが確認された辺と、前記第2結合辺存在確認ステップで存在することが確認された辺とが長方形を構成するか否かを確認する第1長方形構成確認ステップと、
前記第1長方形構成確認ステップでの確認結果が肯定的であれば、前記対象となっている片方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認ステップで存在することが確認された辺と、前記第2結合辺存在確認ステップで存在することが確認された辺とが枠を構成すると確定する第1確定ステップと、
を備えることを特徴とする請求項1又は2に記載の枠検出方法。
The frame determination process includes
A first combined edge existence confirmation step for confirming whether or not an edge exists between one end point of one of the target sides and one end point of the other side of the target;
A second combined edge existence confirmation step for confirming whether or not there is an edge between the other end point of the one side being the target and the other end point of the other side being the target ;
If the confirmation results of both the first combined edge existence confirmation step and the second combined edge existence confirmation step are affirmative, the one side that is the target and the other side that is the target Confirming whether or not the side confirmed to exist in the first coupled-side existence confirmation step and the side confirmed to exist in the second coupled-side existence confirmation step constitute a rectangle. 1 rectangular configuration confirmation step;
If the confirmation result in the first rectangular configuration confirmation step is affirmative, the one side that is the target, the other side that is the target, and the first combined side presence confirmation step exist A first confirmation step for confirming that the side confirmed to be present and the side confirmed to be present in the second combined edge existence confirmation step constitute a frame;
The frame detection method according to claim 1, further comprising:
前記第1結合辺存在確認ステップ及び前記第2結合辺存在確認ステップの一方の確認結果のみが肯定的であれば、対象となっている一方の辺の、対象となっている他方の辺の端点との間に辺が存在しない端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の端点との間に辺が存在しない端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第1線存在確認ステップと、
前記第1線存在確認ステップの確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認ステップ又は前記第2結合辺存在確認ステップで存在することが確認された辺と、前記第1線存在確認ステップで存在することが確認された線分を拡張した線分とが長方形を構成するか否かを確認する第2長方形構成確認ステップと、
前記第2長方形構成確認ステップでの確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認ステップ又は前記第2結合辺存在確認ステップで存在することが確認された辺と、前記第1線存在確認ステップで存在することが確認された線分を拡張した線分とが長方形を構成すると確定する第2確定ステップと、
を更に備えることを特徴とする請求項3に記載の枠検出方法。
If only one confirmation result of the first coupled edge existence confirmation step and the second coupled edge existence confirmation step is affirmative, the end point of the one side of the target and the other side of the target A line extending in the normal direction of one of the sides passing through an end point where no side exists between or the end point of one side of the target of the other side of the target A first line existence confirmation step for confirming whether or not there is a line extending in the normal direction of the other side of the object through an end point where no side exists between
If the confirmation result of the first line presence confirmation step is affirmative, the one side that is the target, the other side that is the target, and the first combined side presence confirmation step or the first Confirm whether or not the side confirmed to exist in the 2-joint side existence confirmation step and the line segment expanded from the line segment confirmed to exist in the first line existence confirmation step constitute a rectangle. A second rectangular configuration confirmation step,
If the confirmation result in the second rectangular configuration confirmation step is affirmative, the one side that is the target, the other side that is the target, and the first combined side existence confirmation step or the The second determined that the side confirmed to exist in the second connected side existence confirmation step and the line segment expanded from the line segment confirmed to exist in the first line existence confirmation step constitute a rectangle. A confirmation step;
The frame detection method according to claim 3, further comprising:
前記第1結合辺存在確認ステップ及び前記第2結合辺存在確認ステップの双方の確認結果が否定的であれば、対象となっている一方の辺の、対象となっている他方の辺の一方の端点との間に辺が存在しない一方の端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の一方の端点との間に辺が存在しない一方の端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第2線存在確認ステップと、
前記第1結合辺存在確認ステップ及び前記第2結合辺存在確認ステップの双方の確認結果が否定的であれば、対象となっている一方の辺の、対象となっている他方の辺の他方の端点との間に辺が存在しない他方の端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の他方の端点との間に辺が存在しない他方の端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第3線存在確認ステップと、
前記第2線存在確認ステップの確認結果及び前記第3線存在確認ステップの確認結果の双方が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第2線存在確認ステップで存在することが確認された線分を拡張した線分と、前記第3線存在確認ステップで存在することが確認された線分を拡張した線分とが長方形を構成するか否かを確認する第3長方形構成確認ステップと、
前記第3長方形構成確認ステップでの確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第2線存在確認ステップで存在することが確認された線分を拡張した線分と、前記第3線存在確認ステップで存在することが確認された線分を拡張した線分とが長方形を構成すると確定する第3確定ステップと、
を更に備えることを特徴とする請求項3又は4に記載の枠検出方法。
If the confirmation results of both the first combined edge existence confirmation step and the second combined edge existence confirmation step are negative, one of the targeted edges and one of the other targeted edges A line that passes through one end point that does not exist between the end points and extends in the normal direction of the target side, or the target side of the target side A second line existence confirmation step for confirming whether or not there is a line passing through one end point where no side exists between one end point of the side and extending in the normal direction of the other side of interest; ,
If the confirmation results of both the first combined edge existence confirmation step and the second combined edge existence confirmation step are negative, the one side of the target is the other of the other sides of the target A line extending in the normal direction of one side of the target passing through the other end point where no side exists between the end points, or one of the target of the other side of the target A third line existence confirmation step for confirming whether or not there is a line passing through the other end point where no side exists between the other end point of the side and extending in the normal direction of the other side of interest; ,
If both the confirmation result of the second line existence confirmation step and the confirmation result of the third line existence confirmation step are affirmative, the one side that is the target and the other side that is the target A line segment expanded from the line segment confirmed to exist in the second line existence confirmation step, and a line segment expanded from the line segment confirmed to exist in the third line existence confirmation step. A third rectangular composition confirmation step for confirming whether or not to constitute a rectangle;
If the confirmation result in the third rectangular configuration confirmation step is affirmative, the one side that is the target, the other side that is the target, and the second line existence confirmation step exist. A third determination step for determining that the line segment expanded from the line segment confirmed to be present and the line segment expanded from the line segment confirmed to exist in the third line presence confirmation step constitute a rectangle;
The frame detection method according to claim 3 or 4, further comprising:
入力したカラー画像を前記グレースケール画像に変換する変換ステップを更に備えることを特徴とする
請求項1乃至5の何れか1項に記載の枠検出方法。
The frame detection method according to claim 1, further comprising a conversion step of converting the input color image into the grayscale image.
前記二値化ステップでは、入力したグレースケール画像を複数のエリアに分割し、エリア毎にエリア毎の閾値を用いて画像を白黒に二値化することを特徴とする
請求項1乃至6の何れか1項に記載の枠検出方法。
7. The binarizing step divides the input grayscale image into a plurality of areas, and binarizes the image into black and white using a threshold value for each area for each area. The frame detection method according to claim 1.
前記閾値は、自エリアについて求めた仮の閾値と、自エリアの周辺の8エリアの仮の閾値のうち自エリアについて求めた仮の閾値よりもレベルが低いものとの平均値であることを特徴とする
請求項7に記載の枠検出方法。
The threshold value is an average value of a temporary threshold value obtained for the own area and an average value of the temporary threshold values of the eight areas around the own area that are lower than the temporary threshold value obtained for the own area. The frame detection method according to claim 7.
入力したグレースケール画像を白黒に二値化して二値化画像を得る二値化手段と、
前記二値化画像から、前記二値化画像の中心付近を通る縦方向の第1直線を通る黒点、前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から一方の方向に離れた第2直線を通る黒点又は前記第1直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第1の直線から他方の方向に離れた第3直線を通る黒点があれば、それらの黒点を全て検出する第1黒点検出手段と、
前記二値化画像から、前記二値化画像の中心付近を通る横方向の第4直線を通る黒点、前記第4直線に平行であって検出しようとする枠の縦方向の辺よりも短くなるように定められた距離だけ前記第4の直線から一方の方向に離れた第5直線を通る黒点又は前記第4直線に平行であって検出しようとする枠の横方向の辺よりも短くなるように定められた距離だけ前記第4の直線から他方の方向に離れた第6直線を通る黒点があれば、それらの黒点を全て検出する第2黒点検出手段と、
前記第1黒点検出手段で検出した前記第2直線を通る黒点と前記第1黒点検出手段で検出した前記第3直線を通る黒点との組合せを全て求める第1組合せ生成手段と、
前記第2黒点検出手段で検出した前記第5直線を通る黒点と前記第2黒点検出手段で検出した前記第6直線を通る黒点との組合せを全て求める第2組合せ生成手段と、
前記第1組合せ生成手段で生成した組合せから、組合せをなす2つの黒点の中点に前記第1直線を通る黒点がある組合せのみを選択する第1選択手段と、
前記第2組合せ生成手段で生成した組合せから、組合せをなす2つの黒点の中点に前記第4直線を通る黒点がある組合せのみを選択する第2選択手段と、
前記第1選択手段で選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第3選択手段と、
前記第2選択手段で選択した組合せから、組合せをなす2つの黒点の間の全ての画素が黒い線分を成す組合せのみを選択する第4選択手段と、
前記第3選択手段で選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第1直線端点検出手段と、
前記第4選択手段で選択した組み合わせについて、組合せをなす2点を通る線分の両端の点を求める第2直線端点検出手段と、
前記第3選択手段で選択した組合せに係る線分の全ての対について線分が長い順に第1枠確定処理を行い、或る線分の対について前記第1枠確定処理により枠が確定したならば、前記或る線分の対について前記第1枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記或る線分の対について前記第1枠確定処理により確定した枠を最終的に検出された枠とする第1枠検出手段と、
前記第4選択手段で選択した組合せに係る線分の全ての対について線分が長い順に第2枠確定処理を行い、或る線分の対について前記第2枠確定処理により枠が確定したならば、前記或る線分について前記第2枠確定処理により確定した枠が前記二値画像の中心付近にあるか否かを調べ、そうであれば、前記第2枠確定処理により確定した枠を最終的に検出された枠とする第2枠検出手段と、
を備えることを特徴とする枠検出装置。
Binarization means for binarizing the input grayscale image into black and white to obtain a binarized image;
From the binarized image, a black spot that passes through the first straight line in the vertical direction passing near the center of the binarized image, and is shorter than the horizontal side of the frame to be detected that is parallel to the first straight line. In this way, the black point passing through the second straight line separated from the first straight line in one direction by a predetermined distance or parallel to the first straight line is shorter than the lateral side of the frame to be detected. If there are black spots that pass through a third straight line that is separated from the first straight line in the other direction by a distance determined in (1), first black spot detecting means for detecting all of the black spots;
From the binarized image, a black spot that passes through the fourth straight line in the horizontal direction passing near the center of the binarized image, and is shorter than the vertical side of the frame to be detected that is parallel to the fourth straight line. In such a manner, the black point passing through the fifth straight line separated from the fourth straight line in one direction by a predetermined distance or the horizontal side of the frame to be detected that is parallel to the fourth straight line is shorter. If there are black spots that pass through a sixth straight line that is separated from the fourth straight line in the other direction by a distance determined in (2), a second black spot detecting means that detects all the black spots;
First combination generating means for obtaining all combinations of black spots passing through the second straight line detected by the first black spot detecting means and black spots passing through the third straight line detected by the first black spot detecting means;
Second combination generating means for obtaining all combinations of black spots passing through the fifth straight line detected by the second black spot detecting means and black spots passing through the sixth straight line detected by the second black spot detecting means;
First selection means for selecting, from the combinations generated by the first combination generation means, only a combination having a black point passing through the first straight line at a midpoint between two black points forming the combination;
Second selection means for selecting, from the combinations generated by the second combination generation means, only a combination having a black point passing through the fourth straight line at a midpoint between two black points forming the combination;
Third selection means for selecting, from the combinations selected by the first selection means, only a combination in which all pixels between the two black dots forming the combination form a black line segment;
Fourth selection means for selecting only a combination in which all pixels between two black dots forming the combination form a black line segment from the combinations selected by the second selection means;
For the combination selected by the third selection means, first linear end point detection means for obtaining points at both ends of the line segment passing through the two points forming the combination;
For the combination selected by the fourth selection means, second linear end point detection means for obtaining points at both ends of the line segment passing through the two points forming the combination;
If the first frame determination process is performed for all pairs of line segments related to the combination selected by the third selection unit in the order of the longest line segment, and the frame is fixed by the first frame determination process for a certain line segment pair For example, it is checked whether or not the frame determined by the first frame determination process for the certain line segment pair is near the center of the binary image. A first frame detection means that uses the frame determined by the first frame determination process as the finally detected frame;
If the second frame determination process is performed in order of the longest line segment for all pairs of line segments related to the combination selected by the fourth selection means, and the frame is determined by the second frame determination process for a certain line segment pair For example, it is checked whether or not the frame determined by the second frame determination process for the certain line segment is near the center of the binary image. If so, the frame determined by the second frame determination process is determined. A second frame detecting means as a finally detected frame;
A frame detection apparatus comprising:
前記第1枠検出手段において、前記第1枠確定処理により確定した枠が前記二値画像の中心付近にないと判断されたならば、前記第1枠確定処理により確定した枠の中心と前記二値画像の中心との間の距離を測ると共に、前記第1枠確定処理により確定した枠と測った距離とを保存する第1枠候補保存手段と、
前記第2枠検出手段において、前記第2枠確定処理により確定した枠が前記二値画像の中心にないと判断されたならば、前記第2枠確定処理により確定した枠の中心と前記二値画像の中心との間の距離を測ると共に、前記第2枠確定処理により確定した枠と測った距離とを保存する第2枠候補保存手段と、
前記第1枠候補保存手段で保存された枠と前記第2枠候補保存手段で保存された枠のうち、枠の中心と前記二値画像の中心との間の距離が最も短い枠を最終的に検出された枠とする第3枠検出手段と、
を更に備えることを特徴とする請求項9に記載の枠検出装置。
If it is determined by the first frame detection means that the frame determined by the first frame determination process is not near the center of the binary image, the center of the frame determined by the first frame determination process and the second frame are determined. First frame candidate storage means for measuring the distance between the center of the value image and storing the frame determined by the first frame determination process and the measured distance;
If the second frame detection means determines that the frame determined by the second frame determination process is not at the center of the binary image, the center of the frame determined by the second frame determination process and the binary value are determined. Second frame candidate storing means for measuring the distance between the center of the image and storing the frame determined by the second frame determination process and the measured distance;
Of the frames stored by the first frame candidate storage unit and the frames stored by the second frame candidate storage unit, the frame having the shortest distance between the center of the frame and the center of the binary image is finally determined. A third frame detecting means for detecting the detected frame;
The frame detection device according to claim 9, further comprising:
前記枠確定処理を行う手段は、
対象となっている一方の辺の一方の端点と対象となっている他方の辺の一方の端点との間に辺が存在するか否かを確認する第1結合辺存在確認手段と、
対象となっている前記一方の辺の他方の端点と対象となっている前記他方の辺の他方の端点との間に辺が存在するか否かを確認する第2結合辺存在確認手段と、
前記第1結合辺存在確認手段及び前記第2結合辺存在確認手段の双方の確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認手段で存在することが確認された辺と、前記第2結合辺存在確認手段で存在することが確認された辺とが長方形を構成するか否かを確認する第1長方形構成確認手段と、
前記第1長方形構成確認手段での確認結果が肯定的であれば、前記対象となっている片方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認手段で存在することが確認された辺と、前記第2結合辺存在確認手段で存在することが確認された辺とが枠を構成すると確定する第1確定手段と、
を備えることを特徴とする請求項9又は10に記載の枠検出装置。
The means for performing the frame determination process is:
A first combined edge existence confirmation means for confirming whether or not an edge exists between one end point of one of the target sides and one end point of the other side of the target;
A second combined edge existence confirmation means for confirming whether or not an edge exists between the other end point of the one side that is the target and the other end point of the other side that is the target ;
If the confirmation results of both the first combined edge existence confirmation unit and the second combined edge existence confirmation unit are affirmative, the one side that is the target and the other side that is the target First, it is confirmed whether or not the side confirmed by the first coupled-side presence confirmation unit and the side confirmed by the second coupled-side presence verification unit form a rectangle. 1 rectangular configuration confirmation means;
If the confirmation result by the first rectangular configuration confirmation means is affirmative, the one side as the object, the other side as the object, and the first combined edge existence confirmation means exist. First confirmation means for confirming that the side confirmed to be present and the side confirmed to be present by the second combined edge existence confirmation means constitute a frame;
The frame detection device according to claim 9, further comprising:
前記第1結合辺存在確認手段及び前記第2結合辺存在確認手段の一方の確認結果のみが肯定的であれば、対象となっている一方の辺の、対象となっている他方の辺の端点との間に辺が存在しない端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の端点との間に辺が存在しない端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第1線存在確認手段と、
前記第1線存在確認手段の確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認手段又は前記第2結合辺存在確認手段で存在することが確認された辺と、前記第1線存在確認手段で存在することが確認された線分を拡張した線分とが長方形を構成するか否かを確認する第2長方形構成確認手段と、
前記第2長方形構成確認手段での確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第1結合辺存在確認手段又は前記第2結合辺存在確認手段で存在することが確認された辺と、前記第1線存在確認手段で存在することが確認された線分を拡張した線分とが長方形を構成すると確定する第2確定手段と、
を更に備えることを特徴とする請求項11に記載の枠検出装置。
If only one of the confirmation results of the first coupled edge existence confirming means and the second coupled edge existence confirming means is affirmative, the end point of the targeted one edge of the other edge A line extending in the normal direction of one of the sides passing through an end point where no side exists between or the end point of one side of the target of the other side of the target A first line existence confirmation means for confirming whether or not there is a line extending in the normal direction of the other side of the object passing through an end point where no side exists between
If the confirmation result of the first line existence confirmation unit is affirmative, the one side that is the target, the other side that is the target, the first combined side presence confirmation unit, or the first Confirm whether or not the side confirmed by the two-joint side existence confirmation unit and the line segment expanded from the line segment confirmed to exist by the first line existence confirmation unit form a rectangle. Second rectangular configuration confirmation means for
If the confirmation result by the second rectangular configuration confirmation unit is affirmative, the one side that is the target, the other side that is the target, and the first combined side presence confirmation unit or the The second determined that the side confirmed by the second combined side presence checking means and the line segment expanded from the line checked by the first line presence checking means form a rectangle. A confirmation means;
The frame detection device according to claim 11, further comprising:
前記第1結合辺存在確認手段及び前記第2結合辺存在確認手段の双方の確認結果が否定的であれば、対象となっている一方の辺の、対象となっている他方の辺の一方の端点との間に辺が存在しない一方の端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の一方の端点との間に辺が存在しない一方の端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第2線存在確認手段と、
前記第1結合辺存在確認手段及び前記第2結合辺存在確認手段の双方の確認結果が否定的であれば、対象となっている一方の辺の、対象となっている他方の辺の他方の端点との間に辺が存在しない他方の端点を通り、対象となっている一方の辺の法線方向に伸びる線、又は、対象となっている他方の辺の、対象となっている一方の辺の他方の端点との間に辺が存在しない他方の端点を通り、対象となっている他方の辺の法線方向に伸びる線が存在するか否かを確認する第3線存在確認手段と、
前記第2線存在確認手段の確認結果及び前記第3線存在確認手段の確認結果の双方が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第2線存在確認手段で存在することが確認された線分を拡張した線分と、前記第3線存在確認手段で存在することが確認された線分を拡張した線分とが長方形を構成するか否かを確認する第3長方形構成確認手段と、
前記第3長方形構成確認手段での確認結果が肯定的であれば、前記対象となっている一方の辺と、前記対象となっている他方の辺と、前記第2線存在確認手段で存在することが確認された線分を拡張した線分と、前記第3線存在確認手段で存在することが確認された線分を拡張した線分とが長方形を構成すると確定する第3確定手段と、
を更に備えることを特徴とする請求項11又は12に記載の枠検出装置。
If the confirmation result of both the first combined edge existence confirming means and the second combined edge existence confirming means is negative, one of the targeted edges and the other of the targeted edges A line that passes through one end point that does not exist between the end points and extends in the normal direction of the target side, or the target side of the target side Second line existence confirmation means for confirming whether or not there is a line passing through one end point where no side exists between one end point of the side and extending in the normal direction of the other side of interest; ,
If the confirmation result of both the first combined edge existence confirming means and the second combined edge existence confirming means is negative, the one of the targeted edges and the other of the targeted edges A line extending in the normal direction of one side of the target passing through the other end point where no side exists between the end points, or one of the target of the other side of the target Third line existence confirmation means for confirming whether or not there is a line passing through the other end point where no side exists between the other end point of the side and extending in the normal direction of the other side of interest; ,
If both the confirmation result of the second line existence confirmation unit and the confirmation result of the third line existence confirmation unit are affirmative, the one side that is the target and the other side that is the target And a line segment expanded from the line segment confirmed to exist by the second line existence confirmation unit and a line segment expanded from the line segment confirmed to exist by the third line presence confirmation unit Third rectangular configuration confirmation means for confirming whether or not to constitute a rectangle;
If the confirmation result by the third rectangular configuration confirmation unit is affirmative, the one side that is the target, the other side that is the target, and the second line existence confirmation unit exist. A third confirming means for confirming that the line segment expanded from the line segment confirmed to be and the line segment expanded from the line segment confirmed to exist by the third line presence confirming means constitute a rectangle;
The frame detection device according to claim 11, further comprising:
入力したカラー画像を前記グレースケール画像に変換する変換手段を更に備えることを特徴とする
請求項9乃至13の何れか1項に記載の枠検出装置。
The frame detection device according to any one of claims 9 to 13, further comprising conversion means for converting an input color image into the grayscale image.
前記二値化手段では、入力したグレースケール画像を複数のエリアに分割し、エリア毎にエリア毎の閾値を用いて画像を白黒に二値化することを特徴とする
請求項9乃至14の何れか1項に記載の枠検出装置。
15. The binarization unit divides an input grayscale image into a plurality of areas, and binarizes the image into black and white using a threshold value for each area for each area. The frame detection apparatus of Claim 1.
前記閾値は、自エリアについて求めた仮の閾値と、自エリアの周辺の8エリアの仮の閾値のうち自エリアについて求めた仮の閾値よりもレベルが低いものとの閾値の平均値であることを特徴とする
請求項15に記載の枠検出装置。
The threshold value is an average value of a temporary threshold value obtained for the own area and a threshold value that is lower than the temporary threshold value obtained for the own area among the temporary threshold values of the eight areas around the own area. The frame detection device according to claim 15.
請求項1乃至8の何れか1項に記載の枠検出方法をコンピュータに実行させるための枠検出プログラム。   A frame detection program for causing a computer to execute the frame detection method according to claim 1.
JP2008287749A 2008-11-10 2008-11-10 Frame detection method, frame detection apparatus, and frame detection program Expired - Fee Related JP5185072B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008287749A JP5185072B2 (en) 2008-11-10 2008-11-10 Frame detection method, frame detection apparatus, and frame detection program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008287749A JP5185072B2 (en) 2008-11-10 2008-11-10 Frame detection method, frame detection apparatus, and frame detection program

Publications (2)

Publication Number Publication Date
JP2010113653A JP2010113653A (en) 2010-05-20
JP5185072B2 true JP5185072B2 (en) 2013-04-17

Family

ID=42302143

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008287749A Expired - Fee Related JP5185072B2 (en) 2008-11-10 2008-11-10 Frame detection method, frame detection apparatus, and frame detection program

Country Status (1)

Country Link
JP (1) JP5185072B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4712487B2 (en) * 2005-08-25 2011-06-29 株式会社リコー Image processing method and apparatus, digital camera apparatus, and recording medium recording image processing program
JP2007299210A (en) * 2006-04-28 2007-11-15 Sharp Corp Image processing apparatus, image forming apparatus, image reading apparatus, and image processing method
JP4784500B2 (en) * 2006-12-08 2011-10-05 日本電気株式会社 Image tilt correction apparatus and image tilt correction method

Also Published As

Publication number Publication date
JP2010113653A (en) 2010-05-20

Similar Documents

Publication Publication Date Title
JP5699788B2 (en) Screen area detection method and system
EP1909215B1 (en) Image region detection method, recording medium, and device therefor
JP5010207B2 (en) Pattern inspection apparatus and semiconductor inspection system
KR101272448B1 (en) Apparatus and method for detecting region of interest, and the recording media storing the program performing the said method
TW201437925A (en) Object identification device, method, and storage medium
JP2004234423A (en) Stereoscopic image processing method, stereoscopic image processor and stereoscopic image processing program
JP2005316755A (en) Two-dimensional rectangular code symbol reader and two-dimensional rectangular code symbol reading method
WO2014045508A1 (en) Inspection device, inspection method, and inspection program
JP2009259036A (en) Image processing device, image processing method, image processing program, recording medium, and image processing system
CN110569845A (en) test paper image correction method and related device
JP6107372B2 (en) Image processing apparatus, image processing method, and image processing program
JP5111055B2 (en) Image processing apparatus, image processing method, and computer program
JP2004362053A (en) Two-dimensional code reading device
JP3598878B2 (en) Defect inspection method and defect inspection device
JP4182937B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
CN111354038A (en) Anchor object detection method and device, electronic equipment and storage medium
US20200250845A1 (en) Evaluation method and information processing apparatus
JP5160366B2 (en) Pattern matching method for electronic parts
JP2014182637A (en) Image processor, image processing method and image processing program
JP5185072B2 (en) Frame detection method, frame detection apparatus, and frame detection program
JP5708305B2 (en) Image recognition apparatus, image recognition method, and computer program for image recognition
JP4513394B2 (en) Color image processing method and image processing apparatus
JP2007140729A (en) Method and device detecting position and attitude of article
Laureano et al. A topological approach for detection of chessboard patterns for camera calibration
WO2015098810A1 (en) Image processing device and specific graphic detection method

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20110114

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110824

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120907

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120913

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121107

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: 20130109

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130117

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees