JP6272219B2 - Image processing apparatus, image processing method, and program - Google Patents

Image processing apparatus, image processing method, and program Download PDF

Info

Publication number
JP6272219B2
JP6272219B2 JP2014265573A JP2014265573A JP6272219B2 JP 6272219 B2 JP6272219 B2 JP 6272219B2 JP 2014265573 A JP2014265573 A JP 2014265573A JP 2014265573 A JP2014265573 A JP 2014265573A JP 6272219 B2 JP6272219 B2 JP 6272219B2
Authority
JP
Japan
Prior art keywords
region
line segment
candidate
separation
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2014265573A
Other languages
Japanese (ja)
Other versions
JP2016126446A (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.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2014265573A priority Critical patent/JP6272219B2/en
Publication of JP2016126446A publication Critical patent/JP2016126446A/en
Application granted granted Critical
Publication of JP6272219B2 publication Critical patent/JP6272219B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Description

本発明は、撮像画像から得られた領域候補の中から正しい領域を特定する技術に関する。   The present invention relates to a technique for specifying a correct region from region candidates obtained from a captured image.

カメラ付き携帯電話の普及により、ポスターやホワイトボード、名刺、配布資料など、様々な紙面をカメラによってスキャン(撮像)し、電子文書化する技術が開発されている。しかしながら、撮像された紙面の画像にはカメラと紙面の位置関係に応じて台形状の歪みが生じる。このような歪みを補正し、カメラを従来スキャナの代替として利用する為には、撮像画像における紙面の境界を示す紙面領域を正確に取得する必要がある。   With the widespread use of camera-equipped mobile phones, a technology has been developed that scans (images) various papers such as posters, whiteboards, business cards, and handouts with a camera, and converts them into electronic documents. However, a trapezoidal distortion occurs in the captured image of the paper according to the positional relationship between the camera and the paper. In order to correct such distortion and use the camera as an alternative to the conventional scanner, it is necessary to accurately acquire a paper area indicating the boundary of the paper surface in the captured image.

特許文献1では、画像から原稿の境界を検出するために、領域候補全体の内側と外側の画素値を用いて、領域候補の内側と外側の分離度を求め、分離度の高い領域候補を選択する方法が開示されている。   In Patent Document 1, in order to detect a document boundary from an image, the inner and outer pixel values of the entire area candidate are used to determine the inner and outer separation degrees of the area candidate, and the area candidate having a high degree of separation is selected. A method is disclosed.

特開2013−105276号公報JP 2013-105276 A

しかし、特許文献1の方法では、領域候補全体の内側と外側の画素値を用いて分離度を求めている。環境光などの影響によって領域候補の内側と外側の領域において画素値のバラツキが大きい(分散値が高い)場合や、背景の画素値がそもそも均一ではない場合に領域候補の内側と外側の画素値の分離度が低くなってしまう場合がる。   However, in the method of Patent Document 1, the degree of separation is obtained using pixel values inside and outside the entire region candidate. Pixel values on the inside and outside of the area candidate when the variation in pixel values is large (the variance value is high) in the area inside and outside the area candidate due to the influence of ambient light, etc., or when the background pixel value is not uniform in the first place The degree of separation may be low.

その場合に、領域の境界を正しく示す紙面領域候補であっても、特許文献1の方法で領域候補全体の内側と外側の画素値の分離度を算出すると、低い分離度となってしまい、領域候補を正しく選択できない問題がある。   In that case, even if it is a paper area candidate that correctly indicates the boundary of the area, if the degree of separation between the inner and outer pixel values of the whole area candidate is calculated by the method of Patent Document 1, the degree of separation becomes low. There is a problem that candidates cannot be selected correctly.

本発明はこのような問題点に鑑みなされたもので、背景が均一ではない環境において撮像された領域の画像に対しても、領域の境界を正しく示す紙面領域候補から注目領域を精度良く特定することを目的とする。   The present invention has been made in view of such problems, and for a region imaged in an environment where the background is not uniform, the region of interest is accurately identified from the paper region candidates that correctly indicate the boundary of the region. For the purpose.

上記の課題を解決するために、本発明の画像処理装置は、複数の線分で構成される領域を領域候補として入力する入力手段と、前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の内側と外側の画像特徴量の関係を示す第二情報と、を出力する出力手段と、前記複数の領域のそれぞれに対応する前記第一情報と前記第二情報とを用いて、前記領域候補を注目領域として特定する特定手段と、を有する。 In order to solve the above-described problems, an image processing apparatus according to the present invention includes an input unit that inputs a region composed of a plurality of line segments as a region candidate, and a predetermined size or less in each line segment that forms the region candidate. In the plurality of regions, the first information indicating the relationship between the image feature amounts on both sides with the line segment as a boundary, and images on the inside and outside of the region candidate in a region having a predetermined size or less at each corner of the region candidate The region candidate is identified as a region of interest using output means for outputting second information indicating the relationship between feature amounts, and the first information and the second information corresponding to each of the plurality of regions. And a specifying means.

本発明によれば、背景が均一ではない環境において撮像された領域の画像に対しても、領域の境界を正しく示す紙面領域を精度良く特定することができる。   According to the present invention, it is possible to accurately specify a paper area that correctly indicates the boundary of an area even for an image of an area captured in an environment where the background is not uniform.

画像処理装置の構成を示す図である。It is a figure which shows the structure of an image processing apparatus. 紙面検出処理の概要を示す図である。It is a figure which shows the outline | summary of a paper surface detection process. 紙面検出処理を示すフローチャートである。It is a flowchart which shows a paper surface detection process. エッジ検出処理を行う際の機能構成を示す図である。It is a figure which shows the function structure at the time of performing an edge detection process. エッジ検出処理を示すフローチャートである。It is a flowchart which shows an edge detection process. 第1のノイズ判定処理を説明する図である。It is a figure explaining 1st noise determination processing. 第2のノイズ判定処理を説明する図である。It is a figure explaining the 2nd noise judgment processing. 線分出力処理を示すフローチャートである。It is a flowchart which shows a line segment output process. 線分フィッティング処理を示すフローチャートである。It is a flowchart which shows a line segment fitting process. 線分フィッティングにおける分離度の概念を示す図である。It is a figure which shows the concept of the isolation | separation in line segment fitting. 線分フィッティング処理の具体例を示す図である。It is a figure which shows the specific example of a line segment fitting process. 線分候補選択処理の具体例を示す図である。It is a figure which shows the specific example of a line segment candidate selection process. エッジ画素の追加処理の概要を示す図である。It is a figure which shows the outline | summary of the addition process of an edge pixel. 線分出力処理を行う際の機能構成を示す図である。It is a figure which shows the function structure at the time of performing a line segment output process. 紙面領域特定処理を示すフローチャートである。It is a flowchart which shows a paper surface area | region identification process. 紙面領域特定処理を行う際の機能構成図である。It is a functional block diagram at the time of performing a paper surface area | region specific process. 紙面領域候補の辺近傍領域の分割例を示す図である。It is a figure which shows the example of a division | segmentation of the edge region of a paper surface area candidate. 分割領域のスコア算出処理を示すフローチャートである。It is a flowchart which shows the score calculation process of a division area. 分割領域の評価値の例を示す図である。It is a figure which shows the example of the evaluation value of a division area. 紙面領域候補の分割領域例を示す図である。It is a figure which shows the example of the division area of a paper surface area | region candidate. 分割領域の評価値の例を示す図である。It is a figure which shows the example of the evaluation value of a division area. 紙面領域候補の選択処理の具体例を示す図である。It is a figure which shows the specific example of the selection process of a paper surface area candidate. 第2の実施形態の紙面領域候補の例を示す図である。It is a figure which shows the example of the paper surface area | region candidate of 2nd Embodiment. 第3の実施形態における分割領域のスコア算出処理を示すフローチャートである。It is a flowchart which shows the score calculation process of the division area in 3rd Embodiment. 第3の実施形態の紙面領域候補の例を示す図である。It is a figure which shows the example of the paper surface area | region candidate of 3rd Embodiment.

以下、本発明の実施形態について、図面を参照して説明する。以下では本発明を適用する際の一例を説明するが、本実施の形態で説明される特徴の全てが本発明に必須のものとは限らない。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following, an example when the present invention is applied will be described. However, not all the features described in the present embodiment are necessarily essential to the present invention.

<第1の実施形態>
●装置構成
図1は、本実施形態における画像処理装置の構成を示す図である。本実施形態の画像処理装置は、撮像された画像データの入力を行う画像入力部101と、CPU102、RAM103、記憶部104、を有する。CPU102は画像データに本実施形態の線分出力処理を施す画像処理プログラムを実行する。RAM103は該プログラムを実行する際のワークメモリやデータの一時保存などに利用される。該プログラムやデータは、記憶部104に格納される。
<First Embodiment>
Apparatus Configuration FIG. 1 is a diagram illustrating a configuration of an image processing apparatus according to the present embodiment. The image processing apparatus according to the present embodiment includes an image input unit 101 that inputs captured image data, a CPU 102, a RAM 103, and a storage unit 104. The CPU 102 executes an image processing program for performing line segment output processing of the present embodiment on image data. The RAM 103 is used for temporary storage of work memory and data when executing the program. The program and data are stored in the storage unit 104.

なお、図1に示す画像処理装置の構成は一例であり、ここで示した以外の構成要素を含んでいても良い。また、外部の汎用コンピュータなどを用いて画像処理を実行しても良いし、電子回路上で画像処理を実行しても良い。さらに、画像入力部101に入力する画像データは撮像画像に限らず、人工的に作成された画像でも良い。   The configuration of the image processing apparatus illustrated in FIG. 1 is an example, and may include components other than those illustrated here. Further, image processing may be executed using an external general-purpose computer or the like, or image processing may be executed on an electronic circuit. Furthermore, the image data input to the image input unit 101 is not limited to a captured image, and may be an artificially created image.

●紙面検出処理概要
図2は、本実施形態の画像処理装置による紙面検出処理の概要を示す図である。図2(a)は画像入力部101によって取得する撮像画像データの例であり、複数枚の紙面が配置されている。この撮像画像データに対して本実施形態による紙面検出処理を施すと、図2(b)に示すように各紙面の領域を表す四角形が得られる。以下、このような紙面と背景との境界を表す直線が成す四角形の領域を、紙面領域と称する。また本実施形態では、撮像画像の各画素は輝度値により表現されるものとして説明を行うが、これにより本発明が輝度値による画像データに限定されるものではない。
Outline of Paper Surface Detection Process FIG. 2 is a diagram showing an outline of the paper face detection process by the image processing apparatus of the present embodiment. FIG. 2A is an example of captured image data acquired by the image input unit 101, and a plurality of sheets of paper are arranged. When the paper surface detection process according to the present embodiment is performed on the captured image data, a quadrangle representing the area of each paper surface is obtained as shown in FIG. Hereinafter, a rectangular area formed by a straight line representing the boundary between the paper surface and the background is referred to as a paper surface region. In the present embodiment, each pixel of the captured image is described as being expressed by a luminance value. However, the present invention is not limited to image data by a luminance value.

図3は、本実施形態における紙面検出処理を示すフローチャートである。上述したように本処理は、CPU102がプログラムを実行することによって実現される。   FIG. 3 is a flowchart showing the paper surface detection process in the present embodiment. As described above, this processing is realized by the CPU 102 executing the program.

まず、ステップS301において、画像入力部101で取得された撮像画像データに対してエッジ検出を行う。この処理によって、撮像画像データにおいて輝度勾配の強度が大きい画素がエッジ画素として得られる。エッジ検出処理では、ノイズ相当のエッジを除去する。ここでノイズ相当のエッジとは、文書の辺を構成するエッジではないと推定されるエッジである。   First, in step S301, edge detection is performed on the captured image data acquired by the image input unit 101. By this processing, pixels having a high intensity gradient in the captured image data are obtained as edge pixels. In the edge detection process, an edge corresponding to noise is removed. Here, the edge corresponding to noise is an edge that is estimated not to constitute an edge of the document.

次に、ステップS302において、ステップS301で得たエッジ画素の集合からエッジ画素の点列によって構成される直線を生成する。直線生成は、ハフ変換やラドン変換など公知の方法によって行う。続いて、ステップS303において、ステップS302で生成された直線とエッジ画素の集合に基づき、線分群を取得する。本実施形態では取得された複数の線分から信頼度の高い線分を紙面領域の境界を示す線分として出力する。なお、本実施形態では、直線は端点を持たず、線分は2つの端点を持つとして区別する。   Next, in step S302, a straight line constituted by a sequence of edge pixels is generated from the set of edge pixels obtained in step S301. The straight line is generated by a known method such as Hough transform or Radon transform. Subsequently, in step S303, a line segment group is acquired based on the set of straight lines and edge pixels generated in step S302. In the present embodiment, a highly reliable line segment is output as a line segment indicating the boundary of the paper area from the plurality of acquired line segments. In this embodiment, a straight line has no end points, and a line segment is distinguished as having two end points.

続いて、ステップS304において、各線分の位置関係をもとに線分を4本ずつ選択し、紙面領域の候補となる四角形を生成する。そして、最後にステップS305で、ステップS304で生成した四角形から、紙面領域を示す四角形を特定する。   Subsequently, in step S304, four line segments are selected on the basis of the positional relationship of each line segment, and a quadrilateral that is a candidate for the paper area is generated. Finally, in step S305, a quadrangle indicating a paper area is specified from the quadrangle generated in step S304.

以下、図3に示すフローチャートにおける各処理について、詳細に説明する。   Hereinafter, each process in the flowchart shown in FIG. 3 will be described in detail.

●エッジ検出処理
ステップS301におけるエッジ検出処理について、図4〜7を用いて詳細に説明する。図4は、本実施形態の画像処理装置においてエッジ検出処理を行う際の機能構成を示す図であり、図5は本実施形態のエッジ検出処理を示すフローチャートである。
Edge detection processing The edge detection processing in step S301 will be described in detail with reference to FIGS. FIG. 4 is a diagram illustrating a functional configuration when performing edge detection processing in the image processing apparatus of the present embodiment, and FIG. 5 is a flowchart illustrating edge detection processing of the present embodiment.

まず、ステップS501で撮像画像入力部401が、処理対象画像を入力する。次に、ステップS502でエッジ画像作成部402が、入力画像からエッジ画素を抽出したエッジ画像を作成する。このエッジ画像の作成には、エッジ検出のキャニー法(John F.Canny)等、周知の手法を用いるとする。そして、ステップS503で連結画素ブロック作成部403が、画素と画素が連なっている連結画素ブロックを作成する。ここで連結画素ブロックとは、エッジ画素が8近傍で連結している画素集合のことである。   First, in step S501, the captured image input unit 401 inputs a processing target image. Next, in step S502, the edge image creation unit 402 creates an edge image obtained by extracting edge pixels from the input image. It is assumed that a known method such as an edge detection canny method (John F. Canny) is used to create the edge image. In step S503, the connected pixel block creation unit 403 creates a connected pixel block in which pixels are connected. Here, the connected pixel block is a pixel set in which edge pixels are connected in the vicinity of eight.

そして、ステップS504で外接矩形作成部404が、ステップS503で作成された連結画素ブロックのそれぞれに外接する矩形を作成する。この時点で、例えば図2(a)に示す入力画像であれば、紙面と背景の境界による紙面端エッジと、背景のテクスチャや文書中の文字によるノイズとすべきエッジとの両方が存在している。撮像画像から紙面領域を検出する際には、このノイズとすべきエッジを除去して紙面端エッジのみを抽出することが望ましい。   In step S504, the circumscribed rectangle creating unit 404 creates a rectangle circumscribing each of the connected pixel blocks created in step S503. At this time, for example, in the case of the input image shown in FIG. 2A, there are both the edge of the paper surface due to the boundary between the paper surface and the background, and the edge that should be noise due to the background texture and characters in the document. Yes. When detecting a paper area from a captured image, it is desirable to remove only the edge that should be noise and extract only the edge of the paper.

そこで、本実施形態ではステップS505以降において、外接矩形の特性を示す各種パラメータから、外接矩形が対応する連結画素ブロックがノイズ相当か否かを判定する。ノイズ相当と判定されれば、この連結画素が除去される。これは、一般に紙面の境界領域に相当する紙面端エッジは直線であり、ノイズによるエッジよりも長い、もしくはノイズによるエッジは一直線に伸びるものではない、という性質を利用したものである。   Therefore, in this embodiment, after step S505, it is determined from the various parameters indicating the characteristics of the circumscribed rectangle whether or not the connected pixel block corresponding to the circumscribed rectangle is equivalent to noise. If it is determined that the noise is equivalent, the connected pixel is removed. This is because the edge of the paper surface corresponding to the boundary region of the paper surface is generally a straight line and is longer than the edge due to noise, or the edge due to noise does not extend in a straight line.

以下、本実施形態におけるステップS505〜ステップS509のノイズ除去処理について、詳細に説明する。   Hereinafter, the noise removal processing in steps S505 to S509 in the present embodiment will be described in detail.

まず、ステップS505で外接矩形パラメータ比較部405が、外接矩形の長辺の長さを所定の閾値(第1の閾値)と比較する。第1ノイズ判定部406がこの比較結果から、外接矩形が紙面端エッジを構成する領域(以下、境界領域)の候補であるか否かを判断する。これは、紙面端エッジの外接矩形であれば一方向に長く伸びている可能性が高いという性質を利用している。具体的には、外接矩形の長辺が第1の閾値より短いものは境界領域ではなく、抽出対象外のノイズであると判断してステップS509に進み、第1ノイズ除去部407がこの連結画素ブロックの除去を行う。一方、外接矩形の長辺の長さが第1の閾値以上であれば、境界領域の候補であるとしてこの連結画素ブロックを残したまま、第2のノイズ判定処理であるステップS506に進む。   First, in step S505, the circumscribed rectangle parameter comparison unit 405 compares the length of the long side of the circumscribed rectangle with a predetermined threshold (first threshold). From the comparison result, the first noise determination unit 406 determines whether or not the circumscribed rectangle is a candidate for a region (hereinafter referred to as a boundary region) constituting the edge of the paper surface. This utilizes the property that a rectangle that circumscribes the edge of the paper surface has a high possibility of extending in one direction. Specifically, if the long side of the circumscribed rectangle is shorter than the first threshold value, it is determined that it is not a boundary region but noise that is not to be extracted, and the process proceeds to step S509, where the first noise removal unit 407 Remove block. On the other hand, if the length of the long side of the circumscribed rectangle is equal to or greater than the first threshold value, the process proceeds to step S506, which is the second noise determination process, while leaving this connected pixel block as a boundary region candidate.

ここで図6に、ステップS505によるノイズ判定処理の具体例を示す。この例では、連結画素ブロック601に対する外接矩形602の長辺603の長さについては、その長さが第1の閾値よりも短いため、この外接矩形602を持つ連結画素ブロック601はノイズであると判断され、除去される。一方、連結画素ブロック604に対する外接矩形605の長辺606は第1の閾値よりも長いため、この外接矩形605を持つ連結画素ブロック604は境界領域の候補として残される。   FIG. 6 shows a specific example of the noise determination process in step S505. In this example, since the length of the long side 603 of the circumscribed rectangle 602 with respect to the connected pixel block 601 is shorter than the first threshold, the connected pixel block 601 having the circumscribed rectangle 602 is noise. Judged and removed. On the other hand, since the long side 606 of the circumscribed rectangle 605 for the connected pixel block 604 is longer than the first threshold value, the connected pixel block 604 having the circumscribed rectangle 605 is left as a candidate for the boundary region.

次に、ステップS506で外接矩形パラメータ比較部405が、外接矩形の縦横比(長辺の長さ/短辺の長さ)で所定の閾値(第2の閾値)と比較し、第1ノイズ判定部406がこの比較結果から、外接矩形が境界領域候補であるか否かを判断する。ここで、上記ステップS505の外接矩形の長辺の長さによるノイズでは、背景の大きな模様がある場合等、サイズの大きいノイズでは外接矩形の長辺の長さも長くなり、ノイズと判別されないことがある。これに対しステップS506のノイズ判定では、紙面の境界領域ならば一方向に長く伸びている可能性が高く、外接矩形が長方形に近くなることに対し、ノイズの場合の外接矩形は正方形に近くなるという性質を利用する。   Next, in step S506, the circumscribed rectangle parameter comparison unit 405 compares the circumscribed rectangle with an aspect ratio (long side length / short side length) with a predetermined threshold (second threshold) to determine the first noise. The unit 406 determines from the comparison result whether the circumscribed rectangle is a boundary region candidate. Here, in the noise due to the length of the long side of the circumscribed rectangle in step S505, the length of the long side of the circumscribed rectangle becomes long when the size of the noise is large, such as when there is a large background pattern, and may not be determined as noise. is there. On the other hand, in the noise determination in step S506, it is highly likely that the boundary region of the paper surface is elongated in one direction. The circumscribed rectangle is close to a rectangle, whereas the circumscribed rectangle in the case of noise is close to a square. This property is used.

具体的には、外接矩形の縦横比(長辺の長さ/短辺の長さ)は第2の閾値を超えていれば、境界領域の候補であると判断してステップS507に進み、この連結画素ブロックを残す。一方、外接矩形の縦横比が第2の閾値以下であればノイズの可能性があるとし、ステップS508のノイズ判定に進む。   Specifically, if the aspect ratio of the circumscribed rectangle (long side length / short side length) exceeds the second threshold, it is determined as a boundary region candidate, and the process proceeds to step S507. Leave connected pixel blocks. On the other hand, if the aspect ratio of the circumscribed rectangle is equal to or smaller than the second threshold, it is determined that there is a possibility of noise, and the process proceeds to the noise determination in step S508.

ここで図7に、ステップS506によるノイズ判定処理の具体例を示す。この例では、連結画素ブロック701に対する外接矩形702の縦横比(長辺の長さ/短辺の長さ)は第2の閾値よりも大きくなるため、境界領域の候補であると判断してこの連結画素ブロックを残す。一方、連結画素ブロック703に対する外接矩形704の縦横比は第2の閾値以下となり、ノイズの可能性ありと判定される。ただし、この判定方法では斜め方向に伸びた境界領域の連結画素ブロック705についても、その外接矩形706の縦横比は第2の閾値以下となってしまう。このような斜め方向に伸びた連結画素ブロック705については紙面端エッジである可能性も高いため、ここではまだノイズと判断せず、ステップS508の第3のノイズ判定に進む。   FIG. 7 shows a specific example of the noise determination process in step S506. In this example, since the aspect ratio (long side length / short side length) of the circumscribed rectangle 702 with respect to the connected pixel block 701 is larger than the second threshold, it is determined that this is a candidate for the boundary region. Leave connected pixel blocks. On the other hand, the aspect ratio of the circumscribed rectangle 704 with respect to the connected pixel block 703 is equal to or less than the second threshold value, and it is determined that there is a possibility of noise. However, in this determination method, the aspect ratio of the circumscribed rectangle 706 also becomes the second threshold value or less for the connected pixel block 705 in the boundary region extending in the oblique direction. Since there is a high possibility that the connected pixel block 705 extending in the oblique direction is an edge on the paper, it is not yet determined as noise, and the process proceeds to the third noise determination in step S508.

ステップS508で外接矩形パラメータ比較部405が、外接矩形内の連結画素ブロックの密度を所定の閾値(第3の閾値)と比較し、第1ノイズ判定部406がこの比較結果から、外接矩形が境界領域候補であるか否かの判断を行う。上述したように、斜めに伸びている画素ブロックが紙面端エッジであるかノイズであるかは外接矩形の縦横比では判定できないため、外接矩形内の連結画素ブロックの密度による判定を行う。   In step S508, the circumscribed rectangle parameter comparing unit 405 compares the density of the connected pixel blocks in the circumscribed rectangle with a predetermined threshold (third threshold), and the first noise determining unit 406 determines that the circumscribed rectangle is a boundary from the comparison result. It is determined whether or not it is a region candidate. As described above, whether the pixel block extending diagonally is an edge of the paper or noise cannot be determined by the aspect ratio of the circumscribed rectangle, and therefore, determination is performed based on the density of the connected pixel blocks in the circumscribed rectangle.

これは以下の性質を利用している。すなわち、外接矩形が紙面端エッジに対応する境界領域であれば、該矩形内では対角線上に連結画素ブロックがあるだけであるから、該矩形内での画素密度は低くなる。一方、ノイズであれば矩形内のいたるところ、少なくとも境界領域の場合よりも広く画素が分布するので、画素密度が高くなる。外接矩形内の連結画素ブロックの密度が第3の閾値以上であればノイズと判定してステップS509に進み、この連結画素ブロックの除去を行う。一方、密度が第3の閾値未満であれば境界領域候補と判定してステップS507に進み、この画素ブロックを残す。   This utilizes the following properties: That is, if the circumscribed rectangle is a boundary region corresponding to the edge of the paper surface, there is only a connected pixel block on the diagonal line in the rectangle, so that the pixel density in the rectangle is low. On the other hand, in the case of noise, the pixels are distributed everywhere in the rectangle more widely than at least in the boundary region, so that the pixel density is increased. If the density of the connected pixel block in the circumscribed rectangle is equal to or higher than the third threshold value, it is determined as noise and the process proceeds to step S509, and the connected pixel block is removed. On the other hand, if the density is less than the third threshold, it is determined as a boundary region candidate, and the process proceeds to step S507 to leave this pixel block.

ステップS508によるノイズ判定処理の具体例を、図7に示す。この例では、連結画素ブロック701についてはステップS506で既に境界領域候補として判定されているため、ステップS508での処理対象外である。連結画素ブロック703については、その外接矩形704内に連結画素ブロックが広く分布していることから画素密度が高く、ノイズであると判断されて該画素ブロックが除去される。一方、連結画素ブロック705については、その外接矩形706内での画素ブロックの広がりが対角線上のみであることから画素密度が低く、境界領域候補として判断されてこの画素ブロックが残される。   A specific example of the noise determination process in step S508 is shown in FIG. In this example, since the connected pixel block 701 has already been determined as a boundary region candidate in step S506, it is not subject to processing in step S508. Regarding the connected pixel block 703, since the connected pixel blocks are widely distributed within the circumscribed rectangle 704, the pixel density is high and the pixel block is determined to be noise. On the other hand, the connected pixel block 705 has a low pixel density because the spread of the pixel block within the circumscribed rectangle 706 is only on the diagonal line, and is determined as a boundary region candidate, and this pixel block remains.

以上、図5のフローチャートに示した一連の処理により、処理対象画像からノイズであると判定されたエッジが除去され、境界領域の候補である紙面端エッジが残された画像として出力される。このエッジ検出処理を経た画像であれば、後段の直線・線分出力処理によって境界領域を正しく検出することができる。   As described above, the edge determined to be noise is removed from the processing target image by the series of processing shown in the flowchart of FIG. 5, and the image is output as an image in which the edge of the paper surface that is a candidate for the boundary region remains. In the case of an image that has undergone this edge detection processing, the boundary region can be correctly detected by the subsequent straight line / line segment output processing.

●線分出力処理
ステップS303における線分出力処理について、図8〜14を用いて詳細に説明する。
Line Segment Output Process The line segment output process in step S303 will be described in detail with reference to FIGS.

図14は、本実施形態の画像処理装置において線分出力処理を行う際の機能構成を示す図である。撮像画像入力部1401は、撮像画像入力部401と同様に、処理対象画像を入力する。エッジ画像作成部1402は、ステップS502〜ステップS509の処理を行う。直線生成部1403は、ステップS302の直線を生成する。線分出力部1404は、本実施形態の線分出力処理を行う。また、線分出力部1404を複数のより詳細な機能構成部分に分けることができる。さらに、本実施形態は上述した構成に限定されず、例えば、エッジ画像作成部1402は、図4のエッジ画像作成部402と同様にステップS502のエッジ画像の作成処理だけを行ってもよい。   FIG. 14 is a diagram illustrating a functional configuration when performing line segment output processing in the image processing apparatus of the present embodiment. Similar to the captured image input unit 401, the captured image input unit 1401 inputs a processing target image. The edge image creation unit 1402 performs the processing from step S502 to step S509. The straight line generation unit 1403 generates a straight line in step S302. The line segment output unit 1404 performs line segment output processing according to the present embodiment. Further, the line segment output unit 1404 can be divided into a plurality of more detailed functional components. Furthermore, the present embodiment is not limited to the above-described configuration. For example, the edge image creation unit 1402 may perform only the edge image creation processing in step S502 as in the edge image creation unit 402 in FIG.

次に、本実施形態の詳細な機能構成部分について説明する。図8は、線分出力処理を示すフローチャートである。   Next, detailed functional components of the present embodiment will be described. FIG. 8 is a flowchart showing line segment output processing.

まず、ステップS801において、ステップS302で得た直線群に基づき、ステップS502で得たエッジ画素群からエッジ画素を選択し、ステップS301で得たエッジ画素群にこのエッジ画素を追加する。ステップS301で得られるエッジ画素群(エッジ画像)は、精度良く直線を生成する為にノイズ除去が行われている。しかしながら本実施形態における線分出力処理では、直線近傍にあるエッジ画素をもとに線分を生成するため、直線近傍のエッジ画素はノイズとして除去されないのが望ましい。そこでステップS801では、エッジ画素追加部1405が、ステップS502で得たエッジ画像に対して各直線から所定距離内(N1)にあるエッジ画素を、ステップS301で得たエッジ画像に追加する。得られたエッジ画素群、を以降の処理で用いる。なお、所定距離N1としては、例えば2mmに相当する画素数を用いる。   First, in step S801, an edge pixel is selected from the edge pixel group obtained in step S502 based on the straight line group obtained in step S302, and this edge pixel is added to the edge pixel group obtained in step S301. The edge pixel group (edge image) obtained in step S301 is subjected to noise removal in order to generate a straight line with high accuracy. However, in the line segment output process in the present embodiment, line segments are generated based on edge pixels in the vicinity of the straight line, and therefore it is desirable that the edge pixels in the vicinity of the straight line are not removed as noise. Therefore, in step S801, the edge pixel adding unit 1405 adds edge pixels within a predetermined distance (N1) from each straight line to the edge image obtained in step S502 to the edge image obtained in step S301. The obtained edge pixel group is used in the subsequent processing. For example, the number of pixels corresponding to 2 mm is used as the predetermined distance N1.

エッジ画素追加処理の概略について、図13を用いて説明する。図13(a)は、ステップS502の処理によって作成されたエッジ画像の一例を示す。図13(b)は、ステップS507の処理によって残されたエッジ画素1301および、ステップS509の処理によってノイズとして除去されたエッジ画素1302を示す。このエッジ画素1301だけを含むエッジ画像がステップ301で得られるエッジ画像である。   An outline of the edge pixel addition processing will be described with reference to FIG. FIG. 13A shows an example of an edge image created by the process of step S502. FIG. 13B shows the edge pixel 1301 left by the process of step S507 and the edge pixel 1302 removed as noise by the process of step S509. An edge image including only the edge pixel 1301 is the edge image obtained in step 301.

図13(c)は、ステップS302の処理によって生成された直線1305を示す。直線1305に対して、エッジ画素が存在する部分に線分が存在し、エッジ画素が存在しない部分に線分が存在しないと推定する。直線1305の近傍(直線1305の周囲)において、エッジ画素とエッジ画素の間隔が所定値n以上の場合は、そのエッジ画素を境界に直線1305を線分に分割する。直線1305を分割すると、図13(d)に示すように、短い線分1306が得られる。ここで、エッジ画素追加部1405が、直線1305から所定距離内にあって、ノイズとして除去されたエッジ画素1304をエッジ画素1301のエッジ画像に追加してから、直線1305を線分に分割すると、正しい線分1307が得られる。直線を線分に分割する処理は、後述するステップS802において線分抽出部1406が行う本実施形態の線分出力処理の一部である。   FIG. 13C shows a straight line 1305 generated by the process of step S302. With respect to the straight line 1305, it is estimated that a line segment exists in a portion where an edge pixel exists and a line segment does not exist in a portion where no edge pixel exists. In the vicinity of the straight line 1305 (around the straight line 1305), when the interval between the edge pixels is equal to or greater than a predetermined value n, the straight line 1305 is divided into line segments with the edge pixel as a boundary. When the straight line 1305 is divided, a short line segment 1306 is obtained as shown in FIG. Here, when the edge pixel adding unit 1405 adds the edge pixel 1304 that is within a predetermined distance from the straight line 1305 and removed as noise to the edge image of the edge pixel 1301, and then divides the straight line 1305 into line segments, A correct line segment 1307 is obtained. The process of dividing the straight line into line segments is a part of the line segment output process of the present embodiment performed by the line segment extraction unit 1406 in step S802 described later.

図8を用いて、線分出力処理を説明する。正しい線分を抽出するために、ステップS801では、ステップS302で得られたエッジ画素群に対して、ステップ303で生成された直線の近傍にあって、エッジ画像からノイズとして除去された画素群を加えたエッジ画素群を生成する。次に、ステップS802において、線分抽出部1406が、ステップS302で直線生成部1403によって生成された各直線を複数の線分に分割する。具体的には、まずステップS801で得られたエッジ画素群から、直線から所定距離内(N2)内にエッジ画素を抽出する。そして、抽出されたエッジ画素間の距離が所定値nより小さいのであれば、それらは同一線分の要素であると判定する。エッジ画素間の距離が所定値nより大きいのであれば、それらは異なる線分の要素であると判定する。   The line segment output process will be described with reference to FIG. In order to extract a correct line segment, in step S801, a pixel group that is in the vicinity of the straight line generated in step 303 and is removed as noise from the edge image with respect to the edge pixel group obtained in step S302. An added edge pixel group is generated. Next, in step S802, the line segment extraction unit 1406 divides each straight line generated by the straight line generation unit 1403 in step S302 into a plurality of line segments. Specifically, first, an edge pixel is extracted within a predetermined distance (N2) from the straight line from the edge pixel group obtained in step S801. If the distance between the extracted edge pixels is smaller than the predetermined value n, it is determined that they are elements of the same line segment. If the distance between the edge pixels is greater than the predetermined value n, it is determined that they are different line segment elements.

ここで、距離が所定値nより大きい2点のエッジ画素をそれぞれエッジ画素pi、エッジ画素pjとする。エッジ画素pjとエッジ画素pjは、それぞれ異なる線分の端点であると判定し、エッジ画素pi、pjを直線に正射影してえる座標を端点とする線分を生成する。所定距離N2は、例えばステップS801で定めた所定距離N1と同値とする。また所定値nとしては、例えば図2(a)に示す複数紙面のように、処理対象画像における紙面間の最小間隔以上の値を設定する必要があり、例えば5cmに相当する画素数を設定する。   Here, two edge pixels whose distance is larger than the predetermined value n are defined as an edge pixel pi and an edge pixel pj, respectively. The edge pixel pj and the edge pixel pj are determined to be the end points of different line segments, and a line segment whose end points are coordinates obtained by orthogonally projecting the edge pixels pi and pj into a straight line is generated. The predetermined distance N2 is set to the same value as the predetermined distance N1 determined in step S801, for example. Further, as the predetermined value n, for example, it is necessary to set a value that is equal to or larger than the minimum interval between the paper surfaces in the processing target image, such as a plurality of paper surfaces shown in FIG. .

次に、ステップS803で、ステップS802で得た各線分について線分近傍(線分の周囲)のエッジ画素に対するフィッティングを行う。フィッティング処理は、分割処理で得られた各線分に対して、その近傍のエッジ画素を用いて、さらに線分を生成して、線分を出力する処理である。このフィッティング処理の詳細は、図9〜11を用いて後述する。   Next, in step S803, fitting is performed on edge pixels in the vicinity of the line segment (around the line segment) for each line segment obtained in step S802. The fitting process is a process of generating a line segment for each line segment obtained by the division process and using the edge pixels in the vicinity thereof, and outputting the line segment. Details of the fitting process will be described later with reference to FIGS.

ステップS802及びステップS803の処理を全直線及び全線分について行った後に、ステップS804で線分候補選択部1412が選択処理の対象となる2本の線分から複数の線分候補を生成し、この複数の線分候補から1本の線分を選択する。2本の線分の線分間距離、線分間角度がいずれも閾値以下である場合に、線分候補選択部1412がこの2本の線分を選択処理の対象として判定する。この判定は、ステップS803の線分フィッティング処理で得られた線分の全てに対して行う。ここで、例えば画像中の紙面枚数が1枚であることが既知の場合には、同一直線上にある2本の線分に対して、積極的に選択処理する必要がある。この場合、線分間距離の閾値を大きくすると、閾値以内の距離で並列した2線分も選択処理の対象となり、意図しない結果が得られてしまう。そこで、選択条件として、両線分の中点同士を結んだ線分と、2線分それぞれが成す角度に対して閾値を与えることで、延長線上にある線分のみを選択処理の対象とすることができる。この選択処理の具体例については、図12を用いて後述する。   After performing the processing of step S802 and step S803 for all the straight lines and all the line segments, in step S804, the line segment candidate selecting unit 1412 generates a plurality of line segment candidates from the two line segments to be selected, and the plurality of line segment candidates. One line segment is selected from the line segment candidates. When both the line segment distance and the line segment angle are equal to or less than the threshold value, the line segment candidate selection unit 1412 determines the two line segments as a target of selection processing. This determination is performed for all the line segments obtained by the line segment fitting process in step S803. Here, for example, when it is known that the number of sheets in the image is one, it is necessary to positively select two line segments on the same straight line. In this case, if the threshold of the line segment distance is increased, two line segments arranged in parallel at a distance within the threshold are also subject to selection processing, and an unintended result is obtained. Therefore, as a selection condition, a threshold is given to the line segment connecting the midpoints of both line segments and the angle formed by each of the two line segments, so that only the line segment on the extension line is selected. be able to. A specific example of this selection process will be described later with reference to FIG.

選択処理によって選択された線分は、ステップS805で再度フィッティング処理を行う。これを全線分について行い、線分出力処理を終了する。   The line segment selected by the selection process is subjected to the fitting process again in step S805. This is performed for all line segments, and the line segment output process is terminated.

●線分フィッティング処理
ここで、ステップS803およびステップS805における線分フィッティング処理について、図9のフローチャートを用いて詳細に説明する。
Line Segment Fitting Process Here, the line segment fitting process in steps S803 and S805 will be described in detail with reference to the flowchart of FIG.

まず、ステップS901で、信頼度算出部1408が、処理対象の線分(線分1)の信頼度を、[線分長]×[分離度]/[平均二乗誤差]によって定める計算式を用いて算出する。ここで、[線分長]は、処理対象の線分の長さである。[分離度]は、線分の両面の輝度がどの程度分離しているかを表す指標である。[平均二乗誤差]は、エッジ画素が線分近傍(線分の周囲の所定範囲)に密集している度合い(密集度合い)を表す指標である。ここで、[分離度]は以下の式(1)によって算出される。   First, in step S901, the reliability calculation unit 1408 uses a calculation formula that determines the reliability of the line segment to be processed (line segment 1) by [line segment length] × [separation degree] / [mean square error]. To calculate. Here, [Line segment length] is the length of the line segment to be processed. [Separation degree] is an index representing how much the luminance of both sides of a line segment is separated. [Mean square error] is an index that represents the degree (density degree) of edge pixels being densely adjacent to a line segment (a predetermined range around the line segment). Here, [Separation degree] is calculated by the following equation (1).

Figure 0006272219
Figure 0006272219

ここで、Nは領域1の画素数、Nは領域2の画素数
は領域1の平均輝度値、mは領域2の平均輝度値
mは領域1−領域2の平均輝度値
は画素iの輝度値
式(1)において領域1は、線分を一辺とする幅wの一方の領域とし、領域2は、この線分を一辺とする領域1と重ならない幅wのもう一方の領域とする。また、入力画像データが多値データ(例えば、RGBの3値データ)である場合にも信頼度を算出できる。例えば、多値空間(RGB空間)において、領域1の平均値と領域2の平均値を通る直線に全画素値を射影して得る値を輝度値に置き換えて、式1により分離度などを算出して、信頼度を算出してもよい。
Here, N 1 is the number of pixels in region 1, N 2 is the number of pixels in region 2, m 1 is the average luminance value of region 1, m 2 is the average luminance value of region 2, and m is the average luminance value of region 1 to region 2. s i is the luminance value of the pixel i In the expression (1), the region 1 is one region having a width w having a line segment as one side, and the region 2 has a width w that does not overlap the region 1 having the line segment as a side. The other area. The reliability can also be calculated when the input image data is multivalued data (for example, RGB ternary data). For example, in a multi-value space (RGB space), the value obtained by projecting all pixel values onto a straight line passing through the average value of region 1 and the average value of region 2 is replaced with a luminance value, and the degree of separation is calculated using Equation 1. Then, the reliability may be calculated.

[平均二乗誤差]は、線分と線分から距離D以内にあるエッジ画素の距離を二乗した平均について、さらに平方根を取った値である。本実施形態では、w及びDを、ステップS801のエッジ画素群抽出の際に用いた所定距離N1と同じ値とする。   [Mean square error] is a value obtained by further taking the square root of the average obtained by squaring the distance between edge segments within the distance D from the line segment. In the present embodiment, w and D are set to the same value as the predetermined distance N1 used in the edge pixel group extraction in step S801.

即ち、領域の境界を示す線分としての信頼度は、線分近傍のエッジ画素の分布と、線分を境界とする二つの領域の画像特徴量の関係に基づいて算出する。また、信頼度は、線分近傍のエッジ画素の分布のみ、又は線分を境界とする二つの領域の画像特徴量の関係のみに基づいて算出してもよい。線分近傍のエッジ画素の分布は、例えば、エッジ画素が線分の周囲の所定範囲に密集している度合いである平均二乗誤差を用いて表すことができる。また、線分を境界とする二つの領域の画像特徴量の関係は、例えば、線分の両側の輝度がどの程度分離しているかの指標である分離度を用いて表すことができる。   That is, the reliability as a line segment indicating the boundary of the region is calculated based on the relationship between the distribution of edge pixels near the line segment and the image feature amount of the two regions having the line segment as a boundary. In addition, the reliability may be calculated based only on the distribution of edge pixels in the vicinity of the line segment, or only on the relationship between the image feature amounts of the two regions having the line segment as a boundary. The distribution of edge pixels in the vicinity of a line segment can be expressed by using, for example, a mean square error that is a degree of density of edge pixels in a predetermined range around the line segment. In addition, the relationship between the image feature amounts of two regions having a line segment as a boundary can be expressed by using, for example, a degree of separation that is an index of how much the luminance on both sides of the line segment is separated.

ここで図10に分離度の概念図を示す。図6(a)において、線分1001を境界とする領域1002a、1002bの輝度ヒストグラムが、1003a、1003bである。同様に、図6(b)の各領域から得たヒストグラムを1004a、1004bに示した。この例の場合、図10(b)よりも図10(a)の方は分離度が高い値となる。   FIG. 10 shows a conceptual diagram of the degree of separation. In FIG. 6A, the luminance histograms of the regions 1002a and 1002b having the line segment 1001 as a boundary are 1003a and 1003b. Similarly, histograms obtained from the respective regions in FIG. 6B are shown in 1004a and 1004b. In this example, the degree of separation is higher in FIG. 10 (a) than in FIG. 10 (b).

線分の信頼度は、線分が長く、線分を境界とする両面で輝度の変化が大きく、エッジ画素が線分近傍に密集している場合に大きくなる指標である。該信頼度は式(1)に限らず、その変形又は別の式を用いても良い。例えば、[線分長]を[距離D以内のエッジ画素数]に置き換えられる。また[分離度]を[領域1と領域2の最大輝度差(あるいは平均輝度差)]に置き換えられる。また[平均二乗誤差]を[エッジ画素と線分の距離総和]に置き換えられる。また[平均二乗誤差]を[距離D以内のエッジ画素群の輝度勾配方向の分散]に置き換えられる。また、線分の信頼度に[距離D以内のエッジ画素群の輝度勾配強度の総和]を係数として掛ける、などの変形が可能であり、さらに上述の変形方法に限らない。   The reliability of a line segment is an index that increases when the line segment is long, the luminance changes greatly on both sides with the line segment as a boundary, and the edge pixels are close to the line segment. The reliability is not limited to the equation (1), and a modification thereof or another equation may be used. For example, [line segment length] can be replaced with [number of edge pixels within distance D]. [Separation degree] is replaced with [maximum luminance difference (or average luminance difference) between region 1 and region 2]. [Mean square error] can be replaced with [Total sum of distances between edge pixels and line segments]. In addition, [mean square error] is replaced with [dispersion in luminance gradient direction of edge pixel group within distance D]. Further, it is possible to modify the line segment reliability by multiplying [the sum of luminance gradient intensities of edge pixel groups within the distance D] as a coefficient, and the present invention is not limited to the above-described modification method.

また、信頼度算出部1408を、さらに、線分長算出部、分離度算出部と平均二乗誤差算出部に分けることができる。線分長、分離度と平均二乗誤差のそれぞれに重み付けを行ってもよい。例えば、比較対象となる2本の線分について、線分長、平均二乗誤差の何れも差が小さい場合は、分離度算出部が算出する分離度を信頼度として用いてもよい。   The reliability calculation unit 1408 can be further divided into a line segment length calculation unit, a separation degree calculation unit, and a mean square error calculation unit. Each of the line segment length, the degree of separation, and the mean square error may be weighted. For example, regarding the two line segments to be compared, when the difference between the line segment length and the mean square error is small, the degree of separation calculated by the degree of separation calculation unit may be used as the reliability.

図9に戻り、ステップS902でエッジ画素取得部1409が線分1から所定距離(D)内のエッジ画素群E1を取得する。次に、ステップS903で、線分取得部1410がエッジ画素群E1から新たに線分2を求める。まず、エッジ画素群E1に対して、主成分分析などの処理を適用して、直線を生成する。主成分分析は、点群の分散が最も大きくなる方向を求める方法である。次に、このエッジ画素群E1から生成された直線と、エッジ画素群E1を包含する外接矩形の交点を端点とする線分を線分2として取得する。   Returning to FIG. 9, in step S <b> 902, the edge pixel acquisition unit 1409 acquires the edge pixel group E <b> 1 within a predetermined distance (D) from the line segment 1. Next, in step S903, the line segment acquisition unit 1410 newly obtains a line segment 2 from the edge pixel group E1. First, a straight line is generated by applying processing such as principal component analysis to the edge pixel group E1. Principal component analysis is a method for obtaining a direction in which the variance of a point group is maximized. Next, a line segment whose end point is an intersection of a straight line generated from the edge pixel group E1 and a circumscribed rectangle including the edge pixel group E1 is acquired as a line segment 2.

次に、ステップS904で、ステップS901で求めた線分1の信頼度と同様に線分2の信頼度を求める。そして、ステップS905で、線分選択部1411が線分1の信頼度と線分2の信頼度を比較し、大きい方を線分Aとして選択する。ここで線分Aとして線分1が選択された場合にはステップS906に進み、所定距離DをD以下の値に更新する。例えば、D=D/2とする。線分Aとして線分2が選択された場合には、所定距離Dを小さい値に更新せず、そのままステップS907に進む。   Next, in step S904, the reliability of line 2 is obtained in the same manner as the reliability of line 1 obtained in step S901. In step S905, the line segment selection unit 1411 compares the reliability of the line segment 1 with the reliability of the line segment 2, and selects the larger one as the line segment A. Here, when the line segment 1 is selected as the line segment A, the process proceeds to step S906, and the predetermined distance D is updated to a value equal to or less than D. For example, D = D / 2. When the line segment 2 is selected as the line segment A, the predetermined distance D is not updated to a small value, and the process directly proceeds to step S907.

ステップS907では、線分Aから所定距離D以下のエッジ画素群E2を取得する。線分Aが線分1である場合、エッジ画素群E2はエッジ画素群E1に完全に包含される点群となる。一方、線分Aが線分2である場合、エッジ画素群E2はエッジ画素群E1に重複する点群となる。ステップS907で得たエッジ画素群E2がエッジ画素群E1と等しい場合、処理が収束したとみなし、線分フィッティング処理を終了する。一方、エッジ画素群E2とエッジ画素群E1が異なる場合にはステップS908に進み、エッジ画素群E2を新たなエッジ画素群E1とし、線分Aを新たな線分1としてステップステップS903に戻り、処理を続行する。   In step S907, an edge pixel group E2 having a predetermined distance D or less from the line segment A is acquired. When the line segment A is the line segment 1, the edge pixel group E2 is a point group that is completely included in the edge pixel group E1. On the other hand, when the line segment A is the line segment 2, the edge pixel group E2 becomes a point group overlapping with the edge pixel group E1. If the edge pixel group E2 obtained in step S907 is equal to the edge pixel group E1, it is considered that the process has converged, and the line segment fitting process is terminated. On the other hand, if the edge pixel group E2 and the edge pixel group E1 are different, the process proceeds to step S908, the edge pixel group E2 is set as a new edge pixel group E1, the line segment A is set as a new line segment 1, and the process returns to step S903. continue processing.

以上、図9のフローチャートに示した線分フィッティングの処理は一例に過ぎず、線分フィッティング処理はこの例に限定されない。例えば、ステップS902及びステップS907において、線分1の角度に類似した方向に輝度勾配を持つエッジ画素のみを対象として取得することで、ステップS903の精度が向上できる。   The line segment fitting process shown in the flowchart of FIG. 9 is merely an example, and the line segment fitting process is not limited to this example. For example, in step S902 and step S907, by acquiring only edge pixels having a luminance gradient in a direction similar to the angle of line segment 1, the accuracy of step S903 can be improved.

また、ステップS905で選択した線分Aをそのままフィッティング処理の結果として出力してもよいし、所定のループ回数で強制的に計算を打ち切り、その時点での線分Aを出力してもよい。また、予め所定距離Dの値Diを複数用意し、ステップS902及びステップS903の時点でそれぞれの所定距離Diについてエッジ画素群Ei及び線分iを求め、信頼度が最大となる線分iを選択してもよい。あるいはステップS903で、主成分分析以外の手法を用いてもよい。例えば、外接矩形に接する2点や、距離が最大となる2点を端点としてもよい。また、周知の最小二乗法、ハフ変換、RANSAC等の方法を用いてもよい。さらに、これらを全て同時に使用して複数の線分を求め、いずれかを選択、あるいは信頼度が閾値以上となる線分を全て出力してもよい。   Further, the line segment A selected in step S905 may be output as it is as a result of the fitting process, or the calculation may be forcibly terminated at a predetermined number of loops, and the line segment A at that time may be output. Also, a plurality of values Di of the predetermined distance D are prepared in advance, and the edge pixel group Ei and the line segment i are obtained for each predetermined distance Di at the time of Step S902 and Step S903, and the line segment i having the maximum reliability is selected. May be. Alternatively, a method other than principal component analysis may be used in step S903. For example, two points in contact with the circumscribed rectangle or two points having the maximum distance may be set as the end points. Further, a known method such as the least square method, the Hough transform, or RANSAC may be used. Further, all of these may be used simultaneously to obtain a plurality of line segments, and either one may be selected, or all line segments whose reliability is equal to or greater than a threshold may be output.

ここで図11に、線分フィッティング処理の具体例を示す。図11(a)では、3枚の紙面を撮像した画像から得られたエッジ1101a〜1101cと、線状ノイズであるが、除去できなかった画素1102とから、ステップS302の直線生成処理で直線1103が得られたとする。ここで、エッジ1101cは、紙面Cの上辺に対応する一つのエッジであるが、エッジ1101aとエッジ1101bは、環境光などの影響により、それぞれ紙面Aと紙面Bの上辺に対応する途切れた二本のエッジである。   FIG. 11 shows a specific example of the line segment fitting process. In FIG. 11A, from the edges 1101a to 1101c obtained from images obtained by imaging three sheets of paper and the pixels 1102 that are linear noise but could not be removed, a straight line 1103 is generated by the straight line generation processing in step S302. Is obtained. Here, the edge 1101c is one edge corresponding to the upper side of the paper surface C, but the two edges 1101a and 1101b correspond to the upper side of the paper surface A and the paper surface B, respectively, due to the influence of ambient light or the like. Is the edge.

直線1103を、ステップS802の処理によって、直線1103近傍(線分の周囲の所定範囲)のエッジ画素をもとに分割すると、図11(b)に示す線分1104a〜1104cが得られる。直線1103は複数の紙面のエッジ画素およびノイズ相当のエッジ画素から得られたので、線分1104a〜1104cは単に直線1103を分割した結果であり、いずれも各紙面の上辺から位置、傾き共にズレがある。これらの線分1104a〜1104cに対して、線分フィッティング処理を行う。   When the straight line 1103 is divided based on the edge pixels in the vicinity of the straight line 1103 (a predetermined range around the line segment) by the process of step S802, line segments 1104a to 1104c shown in FIG. 11B are obtained. Since the straight line 1103 is obtained from a plurality of paper edge pixels and edge pixels corresponding to noise, the line segments 1104a to 1104c are simply the result of dividing the straight line 1103, both of which are shifted in position and inclination from the upper side of each paper surface. is there. Line segment fitting processing is performed on these line segments 1104a to 1104c.

図11(c)は、線分1104a〜1104c(線分1)それぞれに対して、ステップS902及びステップS903の処理を施した結果である。エッジ1101bとエッジ1101cとのそれぞれから、紙面Bと紙面Cの上辺に適した線分1105bと線分1105cとが線分2として得られた。一方で、線分1105aは、線状ノイズ画素1102の影響を受けて紙面Aの上辺からズレがある線分(線分2)となっている。ここでステップS905の処理を行い、線分1104aと線分1105a、線分1104bと線分1105b、線分1104cと線分1105cのそれぞれの信頼度を算出して比較する。   FIG. 11C shows the result of applying the processing of step S902 and step S903 to each of the line segments 1104a to 1104c (line segment 1). A line segment 1105b and a line segment 1105c suitable for the upper side of the paper surface B and the paper surface C were obtained as the line segment 2 from the edge 1101b and the edge 1101c, respectively. On the other hand, the line segment 1105a is a line segment (line segment 2) that is displaced from the upper side of the paper surface A due to the influence of the linear noise pixel 1102. Here, the processing of step S905 is performed, and the reliability of each of the line segment 1104a and the line segment 1105a, the line segment 1104b and the line segment 1105b, and the line segment 1104c and the line segment 1105c is calculated and compared.

その結果、線分1104a、線分1105bおよび線分1105cがそれぞれ信頼度の大きい線分として選択される。線分1105bおよび線分1105cは紙面領域の境界を示しているので、処理が収束し、線分フィッティング処理を終了する。一方、線分2として選択された線分1104aは直線1103を分割して得た線分であるため、ステップS906に進んで所定距離Dをより小さな値に更新し、再度エッジ画素群を求める。   As a result, the line segment 1104a, the line segment 1105b, and the line segment 1105c are each selected as a line segment with high reliability. Since the line segment 1105b and the line segment 1105c indicate the boundaries of the paper area, the process converges and the line segment fitting process ends. On the other hand, since the line segment 1104a selected as the line segment 2 is a line segment obtained by dividing the straight line 1103, the process proceeds to step S906, the predetermined distance D is updated to a smaller value, and the edge pixel group is obtained again.

図11(d)に示すように、線分1104aの周囲の更新前の所定範囲は、線分1104aを中心線として、線分1104aから所定距離D内の範囲である。図11(e)は、線分1104aの周囲の更新後の所定範囲を示した図である。所定距離Dに対応する所定範囲1106と、更新後の所定距離D/2に対応するより小さくした所定範囲1107を示した。所定距離をD/2とすることで、線状ノイズ画素1102が除かれて、エッジ1101aのみを含むエッジ画素群が得られる。このエッジ画素群をステップS907におけるエッジ画素群E2として取得して、ステップS908及びステップS903に進み、主成分分析などの処理を行う。そして、図11(f)に示すように、途切れた二本のエッジ1101aを連結して、正しい紙面領域の境界を示す線分1108aが得られる。   As shown in FIG. 11D, the predetermined range before the update around the line segment 1104a is a range within the predetermined distance D from the line segment 1104a with the line segment 1104a as the center line. FIG. 11E is a diagram showing the updated predetermined range around the line segment 1104a. A predetermined range 1106 corresponding to the predetermined distance D and a smaller predetermined range 1107 corresponding to the updated predetermined distance D / 2 are shown. By setting the predetermined distance to D / 2, the linear noise pixels 1102 are removed, and an edge pixel group including only the edge 1101a is obtained. This edge pixel group is acquired as the edge pixel group E2 in step S907, and the process proceeds to step S908 and step S903 to perform processing such as principal component analysis. Then, as shown in FIG. 11F, two segmented edges 1101a are connected to obtain a line segment 1108a indicating the boundary of the correct paper surface area.

図11(e)では、線分1104aの周囲の所定範囲(線分の法線方向の所定範囲)を小さくする方法として、線分1104aを境界に、その両側に線分1104aからの所定距離Dを所定距離D/2に変更する一例を示した。ただし、この方法では、線状ノイズ画素1102が除去できない場合は、線分1108aが正しく得られず、また信頼度の低い線分が得られてしまう可能性がある。   In FIG. 11 (e), as a method of reducing a predetermined range around the line segment 1104a (a predetermined range in the normal direction of the line segment), a predetermined distance D from the line segment 1104a on both sides of the line segment 1104a as a boundary. An example in which is changed to a predetermined distance D / 2 is shown. However, with this method, if the linear noise pixel 1102 cannot be removed, the line segment 1108a may not be obtained correctly, and a line segment with low reliability may be obtained.

そこで、上述した方法によって得られた線分の信頼度が線分1104aより低い場合、大きさを小さくした所定範囲の位置を、線分1104aの法線方向に移動し、移動した所定範囲にあるエッジ画素群を再度取得して、線分を生成する。生成された線分と線分1104aとの信頼度を比較することによって、線状ノイズの除去を行う。なお、大きさを小さくした所定範囲の移動は複数回行って、線分1104aより信頼度の高い線分が見つかるまで処理を繰り返す。   Therefore, when the reliability of the line segment obtained by the above-described method is lower than the line segment 1104a, the position of the predetermined range whose size is reduced is moved in the normal direction of the line segment 1104a, and is in the moved predetermined range. The edge pixel group is acquired again, and a line segment is generated. By comparing the reliability of the generated line segment with the line segment 1104a, linear noise is removed. Note that the movement within a predetermined range with a reduced size is performed a plurality of times, and the process is repeated until a line segment with higher reliability than the line segment 1104a is found.

なお、本実施形態の線分フィッティング処理は、1枚の紙面しかない場合にも適用できる。例えば、図11(g)〜(i)及び図11(d)〜(f)のように、紙面Bと紙面Cはなく、紙面Aしかない場合にも、上述した方法は同様に適用できる。   It should be noted that the line segment fitting process of the present embodiment can also be applied when there is only one sheet. For example, as shown in FIGS. 11 (g) to 11 (i) and FIGS. 11 (d) to 11 (f), the above-described method can be similarly applied even when there is no paper surface B and paper surface C but only paper surface A.

●線分候補の選択
ここで図12を用いて、ステップS804における線分候補の選択処理を説明する。
Selection of Line Segment Candidate Line segment candidate selection processing in step S804 will be described with reference to FIG.

図12(a)には、選択処理を行う前の2本の線分である線分1201と線分1202と、線分1201の端点1201a、1201bと、線分1202の端点1202a、1202bを示す。   FIG. 12A shows two line segments 1201 and 1202, which are two line segments before selection processing, end points 1201a and 1201b of the line segment 1201, and end points 1202a and 1202b of the line segment 1202. .

線分候補の選択処理では、図12(b)〜(e)に示すように、まず端点1201aまたは1202aと、端点1201bまたは1202bを端点とする線分候補1203〜1206を求める。ここでは、線分候補1203と線分候補1204は、もとの線分1202と線分1201と同じである。線分候補1205と線分候補1206は、新たに生成された線分である。次にこれらの候補線分について、ステップS901と同様の信頼度を求め、最も信頼度が高くなる線分候補を選択した結果として出力する。   In the line segment candidate selection process, as shown in FIGS. 12B to 12E, first, line segment candidates 1203 to 1206 having the end point 1201a or 1202a and the end point 1201b or 1202b as end points are obtained. Here, the line segment candidate 1203 and the line segment candidate 1204 are the same as the original line segment 1202 and the line segment 1201. A line segment candidate 1205 and a line segment candidate 1206 are newly generated line segments. Next, the reliability similar to step S901 is calculated | required about these candidate line segments, and it outputs as a result of having selected the line segment candidate with the highest reliability.

ここで出力される線分が線分候補1205または線分候補1206の場合、これらは新たに生成されたので、ステップS805で線分フィッティングが再度行われる。また、線分候補は図12(b)〜(e)に示す線分に限らず、例えば端点1201aと端点1202aの中点と、端点1201bと端点1202bの中点を新たに定め、それらを端点とする線分候補を求めてもよい。   When the line segment output here is the line segment candidate 1205 or the line segment candidate 1206, since these are newly generated, the line segment fitting is performed again in step S <b> 805. Further, the line segment candidates are not limited to the line segments shown in FIGS. 12B to 12E. For example, the midpoints of the end points 1201a and 1202a and the midpoints of the end points 1201b and 1202b are newly determined, and the end points are defined as the end points. Line segment candidates may be obtained.

紙面の僅かな歪みや環境光により生じる紙面の影などにより、同一の紙面領域の境界(同一の辺)から、複数の線分が出力される場合がある。これに対して線分候補の選択処理を行うことで、近接した2本の線分から新たに1本の線分が選択され、正しい紙面領域の境界を示す線分を出力することが可能となる。   A plurality of line segments may be output from the boundary (same side) of the same paper region due to slight distortion of the paper surface or shadow of the paper surface caused by ambient light. On the other hand, by performing line segment candidate selection processing, a new line segment is selected from two adjacent line segments, and a line segment indicating the boundary of the correct paper area can be output. .

●四角形生成処理
ステップS304における四角形生成処理では、ステップS303によって得られた線分群から、四角形の集合を生成する。
Quadrangle Generation Process In the rectangle generation process in step S304, a set of rectangles is generated from the line segment group obtained in step S303.

まず、全ての線分の角度を求め、角度が0度以上45度未満の線分を水平方向の線分(以下、水平線分)に分類し、45度以上90度未満の線分を垂直方向の線分(以下、垂直線分)に分類する。次に、水平線分群から任意の線分を第1の水平線分として選択し、それと距離が一定以上離れた第2の水平線分を選択する。続いて、垂直線分群から、第1の水平線分と略直交(例えば90度±3度)する垂直線分を第1の垂直線分として選択し、それと距離が一定以上離れた第2の垂直線分を選択する。最後に、第1、第2の水平線分と第1、第2の垂直線分をそれぞれ延長して得る4つの交点を頂点とする四角形を出力し、これを全ての線分の組み合わせについて探索することで四角形を生成する。   First, the angles of all line segments are obtained, line segments whose angles are 0 degree or more and less than 45 degrees are classified into horizontal line segments (hereinafter referred to as horizontal line segments), and line segments that are 45 degrees or more and less than 90 degrees are vertically aligned. To the line segment (hereinafter referred to as the vertical line segment). Next, an arbitrary line segment is selected from the horizontal line segment group as a first horizontal line segment, and a second horizontal line segment that is separated by a certain distance or more is selected. Subsequently, a vertical line segment that is substantially orthogonal to the first horizontal line segment (for example, 90 degrees ± 3 degrees) is selected from the vertical line segment group as the first vertical line segment, and the second vertical line that is more than a certain distance away from the vertical line segment is selected. Select a line segment. Finally, a quadrangle whose vertexes are four intersections obtained by extending the first and second horizontal line segments and the first and second vertical line segments is output, and this is searched for a combination of all line segments. This creates a rectangle.

なお、本実施形態では四角形を検出対象として説明したが、これに限定するものではない。例えばN角形(Nは奇数)が検出対象となる場合、線分を90/N度刻みにN分類し、分類された各群から任意の線分を1本ずつ取得し組み合わせることでN角形を生成することが可能である。M角形(Mは偶数)の場合、線分を90/M度刻みにM分類し、分類された各群から任意の線分を2本ずつ取得し組み合わせることでM角形を生成することが可能である。   In the present embodiment, a quadrangle is described as a detection target, but the present invention is not limited to this. For example, when an N-gon (N is an odd number) is an object to be detected, the line segment is classified into N at 90 / N degree increments, and an arbitrary line segment is acquired from each classified group and combined to form the N-gon. It is possible to generate. In the case of M square (M is an even number), it is possible to generate an M square by classifying the line segment into 90 / M degree increments, and obtaining and combining two arbitrary line segments from each classified group. It is.

●紙面領域特定処理
以下、ステップS305における紙面領域特定処理について、図15〜22を用いて詳細に説明する。ここで説明上、四角形の紙面領域候補を例として説明するが、領域候補の形状が四角形に限らず、角と辺から構成される多角形であればよい。また、領域候補は紙面に限らず、プラスチックなどの材料で製作されたシート状のものでもよい。
Paper Area Specifying Process Hereinafter, the paper area specifying process in step S305 will be described in detail with reference to FIGS. Here, for explanation, a quadrilateral paper area candidate is described as an example, but the shape of the area candidate is not limited to a quadrilateral, and may be a polygon composed of corners and sides. Further, the region candidate is not limited to the paper surface, but may be a sheet shape made of a material such as plastic.

図16は、本実施形態の画像処理装置において紙面領域特定処理を行う際の機能構成を示す図である。撮像画像入力部1601は、撮像画像入力部401と同様に、処理対象画像を入力する。紙面領域候補入力部1602は、紙面領域の候補を入力する機能ブロックである。本実施形態の紙面領域候補入力部1602は、エッジ画像作成部1603、直線生成部1604、線分出力部1605と四角形生成部1606によって構成される。   FIG. 16 is a diagram illustrating a functional configuration when performing the paper surface area specifying process in the image processing apparatus of the present embodiment. Similar to the captured image input unit 401, the captured image input unit 1601 inputs a processing target image. The paper area candidate input unit 1602 is a functional block for inputting paper area candidates. The paper area candidate input unit 1602 of this embodiment includes an edge image creation unit 1603, a straight line generation unit 1604, a line segment output unit 1605, and a quadrangle generation unit 1606.

エッジ画像作成部1603は、エッジ画像作成部1402と同様に、ステップS502〜ステップS509の処理を行う。直線生成部1604は、直線生成部1403と同様に、ステップS302の直線を生成する。線分出力部1605は、線分出力部1404と同様に、線分出力処理を行う。四角形生成部1606は、出力された線分を用いて、ステップS304の処理を行い、紙面領域の紙面領域候補となる四角形を生成する。   The edge image creation unit 1603 performs the processing from step S502 to step S509 in the same manner as the edge image creation unit 1402. The straight line generation unit 1604 generates the straight line in step S302 as with the straight line generation unit 1403. Similar to the line segment output unit 1404, the line segment output unit 1605 performs line segment output processing. The quadrangle generation unit 1606 performs the process of step S304 using the output line segment, and generates a quadrilateral that is a paper area candidate for the paper area.

情報出力部1607は、四角形生成部1606で生成された紙面領域候補に関する情報を出力する。領域特定部1608は、紙面領域特定処理を行う。   The information output unit 1607 outputs information regarding the paper area candidate generated by the quadrangle generation unit 1606. An area specifying unit 1608 performs a paper area specifying process.

次に、図15を用いて紙面領域特定処理のフローを説明する。まずステップS1501で、ステップS304で四角形として生成された紙面領域候補O1からOnを順次、処理対象の紙面領域候補Oとして、ステップS1502〜ステップS1507までの処理を繰り返す。それぞれの紙面領域候補Oに対する処理は独立しているため、最終的に得られる結果は処理の順序により変動しない。したがって、それぞれの紙面領域候補Oの処理を並列に行ってもよい。   Next, the flow of the paper area specifying process will be described with reference to FIG. First, in step S1501, the processing from step S1502 to step S1507 is repeated with the paper region candidates O1 to On generated as squares in step S304 sequentially as the paper region candidate O to be processed. Since the processing for each paper area candidate O is independent, the finally obtained result does not vary depending on the processing order. Therefore, the processing of each paper area candidate O may be performed in parallel.

ステップS1502では、紙面領域候補Oの辺近傍をm個に分割して分割領域B1、B2、…、Bmを作成する。ここでは、紙面領域候補Oの辺近傍領域の分割について、図17を用いて説明する。   In step S1502, the vicinity of the side of the paper region candidate O is divided into m pieces to create divided regions B1, B2,. Here, the division of the region near the side of the paper region candidate O will be described with reference to FIG.

図17は、四角形生成部1606によって生成された紙面領域候補Oの辺近傍領域の分割について説明する図である。図17(a)に示すように紙面領域候補は、4つの線分1701、1702、1703、1704から構成される四角形である。   FIG. 17 is a diagram for explaining the division of the region near the side of the paper region candidate O generated by the quadrangle generation unit 1606. As shown in FIG. 17A, the paper surface area candidate is a quadrangle composed of four line segments 1701, 1702, 1703, and 1704.

図17(b)は、図17(a)に示す4つの線分1701、1702、1703、1704を分割した分割点の例を示す。本実施形態では、四角形1601の長辺にあたる線分1701、1703を5等分し、短辺にあたる線分1702、1704を3等分するように、分割点1705〜1716を設定している。さらに、各辺の両端、即ち四角形1601の角の部分にあたる分割点1717、1718、1719、1720を併せて、全16個の分割点を作成した例を示す。なお、図17に示す分割点は一例に過ぎず、各辺で異なる個数への分割を行ってもよいし、全辺同数に分割してもよい。また、辺を等分に分割する方法の他、各辺の端から一定間隔で分割点を決定してもよい。   FIG. 17B shows an example of dividing points obtained by dividing the four line segments 1701, 1702, 1703, and 1704 shown in FIG. In this embodiment, the dividing points 1705 to 1716 are set so that the line segments 1701 and 1703 corresponding to the long side of the quadrangle 1601 are equally divided into five and the line segments 1702 and 1704 corresponding to the short side are equally divided into three equal parts. Further, an example in which a total of 16 division points are created by combining the division points 1717, 1718, 1719, and 1720 corresponding to both ends of each side, that is, the corners of the quadrangle 1601, is shown. Note that the dividing points shown in FIG. 17 are merely examples, and each side may be divided into different numbers, or may be divided into the same number on all sides. In addition to the method of dividing the sides equally, the dividing points may be determined at regular intervals from the ends of the sides.

そして図17(c)に示すように、各分割点を中心とした正方形の分割領域1721〜1736を作成する。各分割領域は、その中心を紙面領域候補である四角形の辺上に持ち、四角形の辺で内部と外部とが区切られることで、四角形の辺の内側と外側の両方の領域が構成される。なお、この分割領域は一例に過ぎず、例えば分割領域の形状については正方形ではなく長方形でもよいし、円形やその他の形であってもよい。また、各分割領域のサイズも一定でなくても良く、所定大きさ以下であればよい。また、後述する分割領域の評価値に応じて、最も評価値の高い所定大きさを求めて、その所定大きさ以下に各分割領域のサイズを変更してもよい。   Then, as shown in FIG. 17C, square divided areas 1721 to 1736 centering on each dividing point are created. Each divided area has its center on a quadrilateral side that is a paper area candidate, and the inside and outside of the quadrangular side are configured by dividing the inside and the outside by the quadrangular side. This divided area is merely an example. For example, the shape of the divided area may be a rectangle instead of a square, or may be a circle or other shapes. Further, the size of each divided region may not be constant, and may be not more than a predetermined size. Further, a predetermined size having the highest evaluation value may be obtained in accordance with an evaluation value of a divided region described later, and the size of each divided region may be changed to the predetermined size or less.

そしてステップS1503では、ステップS1502で作成した分割領域について、紙面領域候補の確からしさ(確度)を得るための評価値を算出する。分割領域ごとの評価値算出方法については、図18を用いて後述する。   In step S1503, an evaluation value for obtaining the certainty (accuracy) of the paper area candidate is calculated for the divided area created in step S1502. The evaluation value calculation method for each divided area will be described later with reference to FIG.

そしてステップS1504では、ステップS1503で算出した分割領域ごとの評価値に基づき、紙面領域候補全体の確からしさ(確度)のスコアを算出し、ステップS1505へ進む。紙面領域候補のスコアは、辺に位置する分割領域の評価値の4辺の辺ごとの平均を求め、それらの平均と、角に位置する分割領域の評価値の平均を加算して求める。   In step S1504, a probability (accuracy) score of the entire paper area candidate is calculated based on the evaluation value for each divided area calculated in step S1503, and the process proceeds to step S1505. The score of the paper region candidate is obtained by calculating the average of the evaluation values of the divided regions located on the sides for each of the four sides and adding the average of the evaluation values of the divided regions located on the corners.

図17に示す分割領域の例では、分割領域1721〜1732が辺に位置し、分割領域1733〜1736が角に位置する。そして辺ごとの評価値の平均とはすなわち、分割領域1721〜1724の平均と、分割領域1725と分割領域1726の平均と、分割領域1727〜1730の平均と、分割領域1731と分割領域1732の平均である。   In the example of the divided area shown in FIG. 17, the divided areas 1721 to 1732 are located on the sides, and the divided areas 1733 to 1736 are located on the corners. The average evaluation value for each side means that the average of the divided areas 1721 to 1724, the average of the divided areas 1725 and 1726, the average of the divided areas 1727 to 1730, and the average of the divided areas 1731 and 1732 It is.

紙面領域候補が正しく紙面領域であれば、紙面領域候補の内部、すなわち紙面と、その外部のそれぞれの色差により、分離度は高い値を示す。ステップS1504で説明した角部と辺部それぞれの平均値を加算する方法は、本実施形態の説明のための一例であり、分割領域の分離度が高いほど紙面領域候補の確度が高くなることが本質であるので、スコアを算出する具体的な方法を変更してもよい。スコアを算出する方法の変更例として、途中の計算結果に重みを付けて算出することができる。例えば、ステップS1504でスコアを算出する際に、角部にある分割領域の分離度に重みを付けてもよい、その平均値に重みを付けてもよい。また、辺部にあるそれぞれの分割領域の分離度に重みを付けてもよい、その平均値に重みを付けてもよい。重みを付ける方法として、所定係数を分離度又は分離度の平均値に掛けることができる。   If the paper area candidate is a correct paper area, the degree of separation shows a high value due to the color difference between the inside of the paper area candidate, that is, the paper surface and the outside thereof. The method of adding the average values of the corners and sides described in step S1504 is an example for describing the present embodiment, and the higher the degree of separation of the divided regions, the higher the accuracy of the paper region candidate. Since it is essential, the specific method for calculating the score may be changed. As an example of a change in the method for calculating the score, a calculation result in the middle can be weighted and calculated. For example, when the score is calculated in step S1504, the degree of separation of the divided areas at the corners may be weighted, or the average value may be weighted. In addition, a weight may be given to the degree of separation of each divided region in the side, or an average value thereof may be weighted. As a weighting method, a predetermined coefficient can be multiplied by the degree of separation or the average value of the degree of separation.

なお、本実施形態の分離度は式(1)によって算出されることができるが、式(1)に限定されない。分割領域1721〜1732の分離度は、辺に対応する線分を境界とする両側の画像特徴量の関係を示す情報として、情報出力部1607により出力される。また、分割領域1733〜1736の分離度は、領域候補の内側と外側の画像特徴量の関係を示す情報として、情報出力部1607により出力される。   Note that the degree of separation according to the present embodiment can be calculated by Expression (1), but is not limited to Expression (1). The degree of separation of the divided regions 1721 to 1732 is output by the information output unit 1607 as information indicating the relationship between the image feature amounts on both sides with the line segment corresponding to the side as a boundary. Further, the degree of separation of the divided regions 1733 to 1736 is output by the information output unit 1607 as information indicating the relationship between the inner and outer image feature amounts of the region candidates.

そしてステップS1505で、対象紙面領域候補Oのスコアが閾値以上か判定し、閾値以上であればステップS1506へ進み、対象紙面領域候補Oを紙面領域として選択してステップS158へ進む。一方、閾値未満であればステップS1507へ進み、対象紙面領域候補Oは紙面領域でないとして、紙面領域候補群から削除してステップS158へ進む。なお、本実施形態ではこの閾値を1.80とするが、この閾値は一例であり、その他の固定値であってもよいし、実際の処理対象の種類に応じて調整可能な値でもよい。   In step S1505, it is determined whether the score of the target paper area candidate O is equal to or greater than the threshold value. If the score is equal to or greater than the threshold value, the process proceeds to step S1506. On the other hand, if it is less than the threshold value, the process advances to step S1507, and the target paper area candidate O is not a paper area, is deleted from the paper area candidate group, and the process advances to step S158. In the present embodiment, this threshold value is 1.80, but this threshold value is only an example, and may be another fixed value or a value that can be adjusted according to the type of the actual processing target.

ステップS1505〜ステップS1507では、閾値を用いて紙面であるか否かの判定を行ったが、入力画像内に一つの紙面領域しか存在しないことが明らかである場合は、スコアが最も高い四角形領域候補のみを残してもよい。   In steps S1505 to S1507, it is determined whether or not it is a paper surface using a threshold value. If it is clear that there is only one paper region in the input image, a rectangular region candidate having the highest score is obtained. You may leave only.

そしてステップS1508で、紙面領域候補の全てに対する処理が終了していれば、図15に示す紙面領域特定処理を終了するが、未処理紙面領域候補が残っていれば、ステップS1501へ戻って、次の紙面領域候補の処理を開始する。   If the processing for all the paper area candidates is completed in step S1508, the paper area specifying process shown in FIG. 15 is ended. If there are unprocessed paper area candidates remaining, the process returns to step S1501, The processing of the paper area candidate is started.

●分割領域評価値の算出処理
以下、上記ステップS1503における分割領域の評価値の算出処理について、図18のフローチャートを用いて説明する。
Division Area Evaluation Value Calculation Processing Hereinafter, the division region evaluation value calculation processing in step S1503 will be described with reference to the flowchart of FIG.

まずステップS1801で、ステップS1502で作成した分割領域B1〜Bmを順次、処理対象の分割領域Bとして、ステップS1802〜ステップS1803の処理を繰り返す。それぞれの分割領域Bに対する処理は独立しているため、最終的に得られる結果は処理の順序により変動しない。したがって、それぞれの分割領域Bの処理を並列に行ってもよい。   First, in step S1801, the divided areas B1 to Bm created in step S1502 are sequentially set as the divided areas B to be processed, and the processes in steps S1802 to S1803 are repeated. Since the processing for each divided region B is independent, the finally obtained result does not vary depending on the processing order. Therefore, the processing of each divided region B may be performed in parallel.

ステップS1802では、分割領域Bの内部領域と外部領域の画素値(例えば輝度値)の分離度を算出する。分離度の算出には上記式(1)を用いればよい。ここで分離度は、線分を境界とする線分の両側の画素値(例えば輝度値)がどれだけ分離しているかを表す指標である。紙面領域候補Oが正しく紙面領域であれば、紙面領域と背面領域(例えば原稿と原稿台)の画素値の差(例えば輝度値の差)により、分離度が高く算出される。そして、ステップS1803で、ステップS1802で求めた分離度を分割領域Bの評価値として設定し、ステップS1804へ進む。   In step S1802, the degree of separation between pixel values (for example, luminance values) in the inner area and the outer area of the divided area B is calculated. The above formula (1) may be used to calculate the degree of separation. Here, the degree of separation is an index indicating how much pixel values (for example, luminance values) on both sides of a line segment with the line segment as a boundary are separated. If the paper area candidate O is a correct paper area, the degree of separation is calculated to be high based on the difference in pixel values (eg, the difference in luminance values) between the paper area and the back area (eg, the original and the original table). In step S1803, the degree of separation obtained in step S1802 is set as the evaluation value of the divided region B, and the process proceeds to step S1804.

従来では、紙面領域候補Oの辺近傍領域の全体で分離度を求めるが、一般に広い領域では環境光などの影響により、輝度のヒストグラムの分布が広くなる。したがって、広い領域内の2領域間における分離度としては、2領域の画素値(輝度値)の差が小さので、2領域のヒストグラムが重なりあってしまい、分離度も小さい値が算出されてしまう。そこで、本実施形態では、背景と紙面の画素値(輝度値)の差が小さい場合にも正しい紙面領域候補を特定できるように、広い領域を小さい領域に分割して分離度を算出することにより、正しい紙面領域候補はより高い分離度を得ることができる。   Conventionally, the degree of separation is obtained for the entire region in the vicinity of the side of the paper region candidate O. Generally, in a wide region, the distribution of the luminance histogram becomes wide due to the influence of ambient light or the like. Therefore, as the degree of separation between the two areas in the wide area, the difference between the pixel values (luminance values) of the two areas is small, so that the histograms of the two areas overlap and a value with a small degree of separation is calculated. . Therefore, in this embodiment, by dividing the wide area into small areas and calculating the degree of separation so that the correct paper area candidate can be specified even when the difference between the pixel value (luminance value) between the background and the paper is small. The correct paper area candidate can obtain a higher degree of separation.

また、分離度をより大きく得るために、分割領域のサイズを変更してもよい。例えば、紙面内の余白が狭い箇所では、分割領域のサイズによっては文字などの余計な画素が入るため、分離度が小さい値をとってしまうことがある。その場合は、分割領域のサイズを変更して、分離度の高い方を評価値として採用すればよい。   Further, the size of the divided area may be changed in order to obtain a higher degree of separation. For example, in a portion where the margin in the paper is narrow, extra pixels such as characters may be included depending on the size of the divided area, and the separation degree may take a small value. In that case, it is only necessary to change the size of the divided area and adopt the higher degree of separation as the evaluation value.

ステップS1804では、全ての分割領域について処理が終了していれば、図18に示す評価値の算出処理を終了するが、未処理の分割領域が残っていればステップS1801へ戻って、次の分割領域の処理を開始する。   In step S1804, if all the divided areas have been processed, the evaluation value calculation process shown in FIG. 18 is ended. If there is an unprocessed divided area, the process returns to step S1801, and the next divided area is determined. Start processing the region.

●評価値の算出例
以下、図19に、図17に示す紙面領域候補に対して、図15のステップS1503により算出した評価値の例示す。ステップS1802、S1803において分割領域1721〜1732の分離度算出した結果を、表1901の評価値の列に記載されている。また、各辺の評価値の平均を計算した結果が、各辺平均として各辺の平均評価値の列に、角部1733〜1736の評価値の平均を計算した結果が、角部の平均評価値の列に記載されている。
Evaluation Value Calculation Example FIG. 19 shows an example of evaluation values calculated in step S1503 in FIG. 15 for the paper area candidate shown in FIG. The result of calculating the degree of separation of the divided regions 1721 to 1732 in steps S1802 and S1803 is described in the evaluation value column of Table 1901. Moreover, the result of calculating the average of the evaluation values of each side is the result of calculating the average of the evaluation values of the corners 1733 to 1736 in the column of the average evaluation value of each side as the average of each side. It is listed in the value column.

図19に示す平均評価値をもとに、ステップS1504でこの紙面領域候補の確度のスコアを計算すると1.82となる。このスコアは情報出力部1607から出力される。そして、ステップS1505でスコアが閾値以上であると判定され、ステップS1506へ進む。ステップS1506で、スコアの判定結果に基づいて、領域特定部1608によって、図17に示す紙面領域候補は紙面領域又は注目領域として特定される。   Based on the average evaluation value shown in FIG. 19, the score of the accuracy of this paper area candidate is calculated to be 1.82 in step S1504. This score is output from the information output unit 1607. In step S1505, it is determined that the score is equal to or greater than the threshold value, and the process advances to step S1506. In step S1506, based on the score determination result, the area specifying unit 1608 specifies the paper area candidate shown in FIG. 17 as the paper area or the attention area.

以下、同じ入力画像に対する、図17に示す紙面領域候補とは異なる紙面領域候補を例にした、評価値算出例を示す。図20(a)に示す紙面領域候補は、紙面上の黒帯部分の上端2001と、紙面の三辺にある線分2002、線分2003と線分2004から構成されており、紙面として選択するのが好ましくない。図20(b)は、上記図15のステップS1502で図20(a)に示す4つの線分2001〜2004を分割した例を示す。同図において、辺部の分割領域2004〜2013、角部の分割領域2014〜2017に分割された。   In the following, an example of evaluation value calculation for the same input image will be shown by taking a paper area candidate different from the paper area candidate shown in FIG. 17 as an example. The paper surface area candidate shown in FIG. 20A is composed of the upper end 2001 of the black belt portion on the paper surface, the line segment 2002 on the three sides of the paper surface, the line segment 2003 and the line segment 2004, and is selected as the paper surface. It is not preferable. FIG. 20B shows an example in which the four line segments 2001 to 2004 shown in FIG. 20A are divided in step S1502 of FIG. In the same figure, it was divided into divided areas 2004-2013 on the side and divided areas 2014-2017 on the corner.

図20(c)は、角部の分割領域2014の外部領域を拡大した図である。分割領域2014の外部領域は、背景2018と紙面2019から構成される。この外部領域についての輝度ヒストグラムを求めると、背景2018と紙面2019を構成する画素群によって発生した二つのピークの幅が広くなるため、外部領域の分散値が高くなり、外部領域と内部領域の分離度が低い値を示す。つまり角部分割領域2014の評価値が小さくなる。分割領域2015についても同様である。   FIG. 20C is an enlarged view of the outer region of the corner divided region 2014. The outer area of the divided area 2014 is composed of a background 2018 and a paper surface 2019. When the luminance histogram for the outer region is obtained, the width of two peaks generated by the pixel group constituting the background 2018 and the paper surface 2019 is widened, so that the variance value of the outer region is increased and the outer region and the inner region are separated. Indicates a low value. That is, the evaluation value of the corner portion divided area 2014 becomes small. The same applies to the divided areas 2015.

図21は、図20の紙面領域候補の分割領域に対して、図15のステップ1502、ステップS1503により算出した評価値の例示す。表2101において、分割領域2014と2015の評価値が低い値を示している。図21に示す処理結果をもとに、ステップS1504でこの紙面領域候補の確度のスコアを計算すると1.72となる。この値は、ステップS1505において閾値を満たさないと判定され、ステップS1507でこの紙面領域候補は正解ではない領域として削除される。   FIG. 21 shows an example of evaluation values calculated in step 1502 and step S1503 in FIG. 15 for the divided areas of the paper area candidate in FIG. In Table 2101, the evaluation values of the divided areas 2014 and 2015 are low. Based on the processing result shown in FIG. 21, the score of the accuracy of this paper area candidate is calculated to be 1.72 in step S1504. This value is determined not to satisfy the threshold value in step S1505, and in step S1507, the paper area candidate is deleted as an area that is not correct.

図22(a)と図22(b)を用いて、紙面領域候補の特定処理の具体例について説明する。図22(a)に示すような、環境光の影響で撮像画像の全体にグラデーションが発生した場合に、前景領域と背景領域全体の分離度を求める方法では、紙面領域候補の内側と外側双方の分散値が環境光により高い値となり、内側と外側の分離度が低い値を示す。本実施形態の構成や方法では、各辺を小領域に分割することで、各小領域における紙面領域候補の内外の分離度が高い値を示す。   A specific example of the paper area candidate specifying process will be described with reference to FIGS. 22A and 22B. When a gradation occurs in the entire captured image due to the influence of ambient light as shown in FIG. 22 (a), the method for obtaining the degree of separation between the foreground area and the entire background area can be performed both inside and outside the paper area candidate. The dispersion value becomes a high value due to ambient light, and the separation degree between the inside and the outside is low. In the configuration and method of the present embodiment, dividing each side into small areas shows a high value of the internal / external separation degree of the paper area candidates in each small area.

図22(b)は、上部に色つき(黒やその他の色)の帯領域2201が存在する紙面領域を撮影した場合である。この場合であっても、正しい紙面領域候補の色つきの帯領域2201部分にある各分割領域の内部と外部の色差が存在するため、各分割領域の内外分離度は高い値を示す。そのため、領域候補は高いスコアが算出される。   FIG. 22B shows a case where a paper area where a colored (black or other color) band area 2201 is present is photographed. Even in this case, since there is a color difference between the inside and outside of each divided area in the colored band area 2201 portion of the correct paper area candidate, the inside / outside separation degree of each divided area shows a high value. Therefore, a high score is calculated for the region candidate.

また、図22(b)に示すように、色つき(黒やその他の色)のブロック2210を含む紙面領域を撮影する場合がある。撮像画像にあるブロック2210から生成された紙面領域候補でも、その内側と外側の分離度が高い値を示す。この場合は、さらに、各紙面領域候補の面積を算出して比較し、その面積が相対的に小さい紙面領域候補は正解ではない領域として削除される。算出された各紙面領域候補の面積を比較する方法として、例えば、最も大きい紙面領域候補に対する面積比を求めて、その面積比が閾値以下の紙面領域候補は削除する対象として判定することができる。   In addition, as shown in FIG. 22B, a paper area including a colored (black or other color) block 2210 may be photographed. Even in the paper area candidate generated from the block 2210 in the captured image, the degree of separation between the inner side and the outer side shows a high value. In this case, the areas of the respective paper area candidates are further calculated and compared, and the paper area candidate having a relatively small area is deleted as a non-correct area. As a method for comparing the calculated areas of the respective paper area candidates, for example, an area ratio with respect to the largest paper area candidate can be obtained, and a paper area candidate whose area ratio is equal to or smaller than a threshold value can be determined as an object to be deleted.

本実施形態によれば、紙面領域候補を構成する各線分の周辺領域を分割した各分割領域において、紙面領域候補の外部及び内部の画素値(例えば輝度値)のヒストグラムの分離度に基づき、紙面の確からしさ(確度)をスコアとして算出する。よって、実際の紙面領域ではない誤った紙面領域候補を選択せず、正しい紙面領域候補を紙面領域又は注目領域として特定できる効果がある。   According to the present embodiment, in each divided region obtained by dividing the peripheral region of each line segment constituting the paper region candidate, based on the degree of separation of the histograms of the pixel values (for example, luminance values) outside and inside the paper region candidate. Is calculated as a score. Therefore, there is an effect that the correct paper area candidate can be specified as the paper area or the attention area without selecting an incorrect paper area candidate that is not an actual paper area.

<第2の実施形態>
第1の実施形態では、紙面領域候補のスコアを算出し、閾値以上か否かを判定することによって紙面領域候補の選択を行ったが、本実施形態では、複数の紙面領域候補のスコアの相対値より紙面領域候補を選択する。たとえば、入力画像中にN個の紙面領域しか含まれないことが予め分かっていれば、閾値を用いずに全紙面領域候補のスコアの上位N個の紙面領域候補を紙面領域又は注目領域として特定する。本実施形態のその他の処理は、第1の実施形態と同じであるので、説明を省略する。
<Second Embodiment>
In the first embodiment, the paper region candidate score is calculated and the paper region candidate is selected by determining whether or not the threshold value is equal to or greater than the threshold value. However, in the present embodiment, the relative scores of the plurality of paper region candidate candidates are selected. A paper area candidate is selected from the value. For example, if it is known in advance that the input image includes only N paper areas, the top N paper area candidates in the scores of all paper area candidates are identified as the paper area or the attention area without using a threshold value. To do. Other processes in the present embodiment are the same as those in the first embodiment, and thus the description thereof is omitted.

また、2枚の紙面が重なっているために、隠れている紙面については選択したくない場合については、領域の重なる二つの紙面領域候補については、スコアの高い方のみを選択してもよい。   In addition, since the two sheets of paper overlap each other, if the user does not want to select the hidden paper, only the one with the higher score may be selected for the two paper region candidates whose areas overlap.

図23は、2枚の紙面領域が重なった例を示す。紙面領域候補2301は、紙面領域候補2302により一部分が隠れている。分割領域2303は、紙面領域候補2301に対し前述第1の実施形態で説明した処理によって設定された分割領域の例である。この分割領域2303においては、紙面領域候補2301の内部領域、外部領域ともに、紙面領域候補2202内の紙面であるため、分離度が低い値となる。また、紙面領域候補2301全体に関しても、その内部領域、外部領域ともに紙面領域2302に隠れているため、画素値が均一ではなくなり分散値がそれぞれ高くなり、紙面領域候補全体の分離度が低い値となる。その結果、紙面領域候補2301のスコアが紙面領域候補2302に比べて低い値となる。この場合、領域特定部1608によって、スコアの最も高い紙面領域候補2302のみが紙面領域又は注目領域として特定される。   FIG. 23 shows an example in which two sheet areas overlap. The paper area candidate 2301 is partially hidden by the paper area candidate 2302. A divided area 2303 is an example of a divided area set by the processing described in the first embodiment with respect to the paper area candidate 2301. In this divided area 2303, since both the inner area and the outer area of the paper area candidate 2301 are the paper face in the paper area candidate 2202, the separation degree is a low value. Also, the entire paper area candidate 2301 is also hidden in the paper area 2302 in both the internal area and the external area, so that the pixel values are not uniform and the variance value is high, and the separation degree of the entire paper area candidate is low. Become. As a result, the score of the paper area candidate 2301 is lower than that of the paper area candidate 2302. In this case, the area specifying unit 1608 specifies only the paper area candidate 2302 having the highest score as the paper area or the attention area.

ユーザの特定したい紙面領域又は注目領域の数が予め分かっている場合は、本実施形態によれば、複数の紙面候補領域のスコア順位に基づいて、所定個数の紙面候補領域を特定する。また、図23のような重なりによって一部が隠れている紙面領域候補を特定しないことができる。   When the number of paper areas or attention areas to be specified by the user is known in advance, according to the present embodiment, a predetermined number of paper candidate areas are specified based on the score ranking of the plurality of paper candidate areas. Further, it is not possible to specify a paper area candidate that is partially hidden by overlapping as shown in FIG.

<第3の実施形態>
第1の実施形態では、各分割領域の紙面候補領域の内側と外側の分離度を元に紙面領域としての確からしさ(確度)のスコアを算出した。本実施形態では、撮像した紙面の背景領域(原稿台など)の画素値が一様である場合、分散値をスコアの指標として用いる。本実施形態のその他の処理は、第1の実施形態と同じであるので、説明を省略する。
<Third Embodiment>
In the first embodiment, a probability (accuracy) score as a paper area is calculated based on the inner and outer separation degrees of the paper area candidate areas of each divided area. In the present embodiment, when the pixel values of the background area (such as the document table) of the imaged paper are uniform, the variance value is used as a score index. Other processes in the present embodiment are the same as those in the first embodiment, and thus the description thereof is omitted.

図24は、本実施形態におけるステップS1503の分割領域の評価値を算出する処理を示すフローチャートである。   FIG. 24 is a flowchart showing the process of calculating the evaluation value of the divided area in step S1503 in this embodiment.

ステップS2401では、分割領域B1からBmをそれぞれ処理対象の分割領域BとしてS2402へ進み、S2406までの処理を繰り返す。   In step S2401, the divided areas B1 to Bm are set as the divided areas B to be processed, the process proceeds to S2402, and the processes up to S2406 are repeated.

分割領域Bの位置によって、その後の処理が決まるので、ステップS2402では、まず分割領域Bが角に位置しているかを判定する。分割領域Bが辺に位置していると判定したら、ステップS2403とステップS2404の処理を行い、分割領域Bが角に位置していると判定したら、ステップS2405とステップS2406の処理を行う。   Since the subsequent processing is determined by the position of the divided area B, in step S2402, it is first determined whether the divided area B is located at a corner. If it is determined that the divided area B is located on the side, the processes in steps S2403 and S2404 are performed. If it is determined that the divided area B is located in the corner, the processes in steps S2405 and S2406 are performed.

ステップS2403とステップS2404との処理はステップS1802とステップS1803との処理と同様であるため、ここで説明を省略する。ステップS2405では、情報出力部1607は、以下の式(2)を用いて角部にある分割領域における紙面候補領域の外部領域の分散値σを算出して出力する。   Since the process of step S2403 and step S2404 is the same as the process of step S1802 and step S1803, description is abbreviate | omitted here. In step S2405, the information output unit 1607 calculates and outputs the variance value σ of the outer area of the paper candidate area in the divided area at the corner using the following equation (2).

Figure 0006272219
Figure 0006272219

ここで、Nは画素数
mは領域の平均輝度値
は画素iの輝度値
式(2)では分散値σの算出に輝度値を用いているが、輝度値に限定しない。入力画像が多値(例えばRGB値)の場合には、多値空間(RGB空間)内で全画素値に対して主成分分析を行い、第一主成分得られる主軸に対して全画素値を射影して得る値を輝度値の替わりに式(2)に適用することで分散値σを算出することもできる。
Here, N is the number of pixels, m is the average luminance value of the region, s i is the luminance value of the pixel i, and the luminance value is used to calculate the variance value σ in Equation (2), but is not limited to the luminance value. When the input image is multi-valued (for example, RGB values), the principal component analysis is performed on all the pixel values in the multi-valued space (RGB space), and all the pixel values are calculated with respect to the main axis obtained from the first principal component. The variance value σ can also be calculated by applying the value obtained by projection to the equation (2) instead of the luminance value.

ステップS2406では、ステップS2405で求めた外部領域の分散値を角部の分割領域Bの評価値とし、ステップS2407へ進む。   In step S2406, the variance value of the outer area obtained in step S2405 is set as the evaluation value of the divided area B at the corner, and the process proceeds to step S2407.

ステップS2407では、全分割領域Bに対して処理が完了していれば終了し、未処理領域が残っていればステップS2401へ戻る。   In step S2407, if the process is completed for all the divided areas B, the process ends. If an unprocessed area remains, the process returns to step S2401.

本実施形態では、情報出力部1607は、ステップS1504のスコア算出処理では、以下の式(3)を用いてスコアを算出して出力する。   In the present embodiment, the information output unit 1607 calculates and outputs a score using the following equation (3) in the score calculation process in step S1504.

Figure 0006272219
Figure 0006272219

ここで、
ηはS1503で求めた分割領域の各辺の内外分離度の平均
σはS1503で求めた分割領域の各角の外部分散の平均
式(3)は、本実施形態のスコア算出処理の一例であり、各辺の分割領域の分離度が高いほど紙面領域候補の確度が高くなり、角部の外部の分散値が低いほど紙面領域候補の確度が高くなることが本質であり、式(3)のスコア算出に別の重みをつけてもよい。また、分離度又は分散値だけでスコアを算出するなど、その他の方法でスコアを求めてもよい。
here,
η m is the average of the inside / outside separation degree of each side of the divided region obtained in S1503 σ m is the average of the external variance of each corner of the divided region obtained in S1503 Equation (3) is an example of the score calculation process of this embodiment It is essential that the accuracy of the paper region candidate increases as the degree of separation of the divided regions on each side increases, and the accuracy of the paper region candidate increases as the variance value outside the corner decreases. ) May be given a different weight. Moreover, you may obtain | require a score by other methods, such as calculating a score only by the degree of separation or a dispersion value.

そして、ステップS1505で情報出力部1607から出力されたスコアの判定が行われ、その判定結果に基づいて、ステップS1506で領域特定部1608は図25に示す紙面領域候補2501を紙面領域又は注目領域として特定する。   In step S1505, the score output from the information output unit 1607 is determined. On the basis of the determination result, in step S1506, the area specifying unit 1608 uses the paper area candidate 2501 shown in FIG. 25 as the paper area or attention area. Identify.

図25(a)は、入力される撮像画像と撮像画像から得られた紙面領域候補の例を示す。紙面領域候補2501は、角部が丸みを帯びた紙面の領域候補である。ステップS304の四角形生成処理では、四辺の候補となる線分を伸長し四角形を生成するため、角部が丸い紙面であっても、この様な四角形が紙面候補として形成される。   FIG. 25A shows an example of an input captured image and a paper area candidate obtained from the captured image. A paper area candidate 2501 is a paper area candidate with rounded corners. In the quadrangle generation processing in step S304, since the line segments that are candidates for the four sides are expanded to generate a quadrangle, such a quadrangle is formed as a paper surface candidate even if the corner has a round paper surface.

分割領域2502は、ステップS1502で生成された、紙面領域候補2601の角部に位置する分割領域である。   The divided area 2502 is a divided area located at the corner of the paper area candidate 2601 generated in step S1502.

図25(b)は、分割領域2502を拡大して表した図である。分割領域2502には紙面領域候補の内部領域2503、外部領域2504が存在している。この様に角に丸みを帯びた紙面の場合、角部の分割領域の内部領域2503に実際の紙面が一部しか入らない場合や、まったく入らない場合がある。その場合、内外領域の画素分散値に差がでないため、分離度が低い値がでてしまい、第1の実施形態で説明した方法では、正しい紙面領域であっても紙面領域候補のスコアが低い値をなってしまう。分散値を用いる方法では、背景の画素値が一様であれば、分散値が低い値となり、紙面領域候補のスコアを高く算出することが可能である。   FIG. 25B is an enlarged view of the divided area 2502. In the divided area 2502, there are an inner area 2503 and an outer area 2504 of paper area candidates. In the case of a paper surface with rounded corners in this way, there may be a case where only a part of the actual paper surface enters the inner region 2503 of the corner divided region, or there is no case. In that case, since there is no difference in the pixel dispersion values in the inner and outer regions, a low separation value is obtained. With the method described in the first embodiment, the score of the paper region candidate is low even in the correct paper region. Become a value. In the method using the variance value, if the background pixel value is uniform, the variance value is low, and the score of the paper area candidate can be calculated high.

以上、本実施形態によれば、背景領域の画素値が均一であることを利用し、紙面領域候補の角部の外部領域の分散値を用いることで、角に丸みを帯びた紙面に対しても紙面領域の検出を精度よく行うことが可能である。   As described above, according to the present embodiment, by using the fact that the pixel values of the background region are uniform and using the variance value of the outer region of the corner of the paper region candidate, the paper surface with rounded corners is used. In addition, it is possible to accurately detect the paper region.

<その他の実施形態>
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
<Other embodiments>
The present invention supplies a program that realizes one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in the computer of the system or apparatus read and execute the program This process can be realized. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

101 画像入力部
102 CPU
103 RAM
104 記憶部
101 Image input unit 102 CPU
103 RAM
104 Storage unit

Claims (17)

複数の線分で構成される領域を領域候補として入力する入力手段と、
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の内側と外側の画像特徴量の関係を示す第二情報と、を出力する出力手段と、
前記複数の領域のそれぞれに対応する前記第一情報と前記第二情報とを用いて、前記領域候補を注目領域として特定する特定手段と、
を有することを特徴とする画像処理装置。
An input means for inputting a region composed of a plurality of line segments as a region candidate;
First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate Output means for outputting the second information indicating the relationship between the image feature amount inside and outside the area candidate in the area below
Using the first information and the second information corresponding to each of the plurality of regions, specifying means for specifying the region candidate as a region of interest;
An image processing apparatus comprising:
前記第一情報は、前記各線分における前記複数の領域のそれぞれの領域内の前記線分を境界とする両側の画素値の第一分離度であることを特徴とする請求項1に記載の画像処理装置。   2. The image according to claim 1, wherein the first information is a first degree of separation of pixel values on both sides with the line segment as a boundary in each of the plurality of regions in each line segment. Processing equipment. 前記特定手段は、前記第一分離度の平均値に基づいて、前記領域候補を注目領域として特定することを特徴とする請求項に記載の画像処理装置。 The image processing apparatus according to claim 2 , wherein the specifying unit specifies the region candidate as a region of interest based on an average value of the first degree of separation. 前記第二情報は、前記各角における前記領域内の前記領域候補の内側と外側の画素値の第二分離度であることを特徴とする請求項に記載の画像処理装置。 The image processing apparatus according to claim 1 , wherein the second information is a second degree of separation of pixel values inside and outside the area candidate in the area at each corner. 前記特定手段は、前記第一情報と前記第二分離度の平均値とに基づいて、前記領域候補を注目領域として特定することを特徴とする請求項に記載の画像処理装置。 The image processing apparatus according to claim 4 , wherein the specifying unit specifies the region candidate as a region of interest based on the first information and the average value of the second degree of separation. 前記第一情報は、前記各線分における前記複数の領域のそれぞれの領域内の前記線分を境界とする両側の画素値の第一分離度であり、前記第二情報は、前記各角における前記領域内の前記領域候補の内側と外側の画素値の第二分離度であって、
前記特定手段は、前記第一分離度の平均値と前記第二分離度の平均値とに基づいて、前記領域候補を注目領域として特定することを特徴とする請求項に記載の画像処理装置。
The first information is a first degree of separation of pixel values on both sides with the line segment as a boundary in each of the plurality of regions in the line segments, and the second information is the first information at the corners. A second degree of separation of pixel values inside and outside the region candidate in a region,
The specifying unit, based on the average value of the second separation and the average value of the first degree of separation, the image processing apparatus according to claim 1, wherein the identifying the area candidate region of interest .
前記特定手段は、前記第二分離度の平均値より重みを付けた前記第一分離度の平均値と、前記第二分離度の平均値とに基づいて、前記領域候補を注目領域として特定することを特徴とする請求項に記載の画像処理装置。 The specifying unit specifies the region candidate as a region of interest based on the average value of the first degree of separation weighted by the average value of the second degree of separation and the average value of the second degree of separation. The image processing apparatus according to claim 6 . 前記特定手段は、前記第一分離度の平均値と、前記第一分離度の平均値より重みを付けた前記第二分離度の平均値とに基づいて、前記領域候補を注目領域として特定することを特徴とする請求項に記載の画像処理装置。 The specifying unit specifies the region candidate as a region of interest based on the average value of the first degree of separation and the average value of the second degree of separation weighted by the average value of the first degree of separation. The image processing apparatus according to claim 6 . 前記特定手段は、前記第一分離度及び前記第二分離度から得られた評価値が閾値以上である前記領域候補を注目領域として特定することを特徴とする請求項乃至の何れか1項に記載の画像処理装置。 The specifying means, any one of the claims 6 to 8, wherein the identifying the region candidate said first separation and evaluation values obtained from the second separation is equal to or higher than the threshold as a region of interest The image processing apparatus according to item. 前記入力手段で入力された領域候補が複数ある場合、前記特定手段は、前記第一分離度及び前記第二分離度から得られた評価値に基づいて、所定個数の前記領域候補を注目領域として特定することを特徴とする請求項乃至の何れか1項に記載の画像処理装置。 When there are a plurality of region candidates input by the input unit, the specifying unit sets a predetermined number of the region candidates as a region of interest based on the evaluation values obtained from the first degree of separation and the second degree of separation. the image processing apparatus according to any one of claims 6 to 8, wherein the identifying. 複数の線分で構成される領域を領域候補として入力する入力手段と、
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の外側の画像特徴量を示す第三情報と、を出力する出力手段と
前記複数の領域のそれぞれに対応する前記第一情報及び前記第三情報を用いて、前記領域候補を注目領域として特定する特定手段と、
を有することを特徴とする画像処理装置。
An input means for inputting a region composed of a plurality of line segments as a region candidate;
First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate and output means for outputting and a third information indicating the image feature amount of the outside of the region candidate in the following areas are,
Using the first information and the third information corresponding to each of the plurality of regions, the specifying means for specifying the region candidate as a region of interest ;
An image processing apparatus comprising:
前記第三情報は、前記各角における前記領域内の前記領域候補の外側の画素値の分散値であることを特徴とする請求項11に記載の画像処理装置。 The image processing apparatus according to claim 11 , wherein the third information is a variance value of pixel values outside the area candidate in the area at each corner. 前記入力手段は、
文書を撮像して得られた撮像画像から抽出したエッジ画素に基づいて、エッジ画像を作成する作成手段と、
前記エッジ画素から直線を生成する直線生成手段と、
前記直線生成手段から生成された前記直線に基づいて、前記文書の境界を示す線分を出力する線分出力手段と、
前記線分出力手段で生成された前記線分から前記領域候補を生成する生成手段と、
をさらに有することを特徴とする請求項1乃至1の何れか1項に記載の画像処理装置。
The input means includes
Creating means for creating an edge image based on edge pixels extracted from a captured image obtained by imaging a document;
Straight line generating means for generating a straight line from the edge pixels;
Line segment output means for outputting a line segment indicating a boundary of the document based on the straight line generated from the straight line generation means;
Generating means for generating the region candidates from the line segments generated by the line segment output means;
The image processing apparatus according to any one of claims 1 to 1 2, characterized in that it further comprises a.
複数の線分で構成される領域を領域候補として入力する入力工程と、
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の内側と外側の画像特徴量の関係を示す第二情報と、を出力する出力工程と、
前記複数の領域のそれぞれに対応する前記第一情報と前記第二情報とを用いて、前記領域候補を注目領域として特定する特定工程と、
を有することを特徴とする画像処理方法。
An input step of inputting a region composed of a plurality of line segments as a region candidate;
First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate An output step for outputting second information indicating the relationship between the inner and outer image feature amounts of the region candidates in the region below
Using the first information and the second information corresponding to each of the plurality of regions, a specifying step of specifying the region candidate as a region of interest;
An image processing method comprising:
複数の線分で構成される領域を領域候補として入力する入力ステップと、
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の内側と外側の画像特徴量の関係を示す第二情報と、を出力する出力ステップと、
前記複数の領域のそれぞれに対応する前記第一情報と前記第二情報とを用いて、前記領域候補を注目領域として特定する特定ステップと、
をコンピュータに実行させることを特徴とするプログラム。
An input step of inputting a region composed of a plurality of line segments as a region candidate;
First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate An output step of outputting second information indicating a relationship between the inner and outer image feature amounts of the region candidates in the region below
Using the first information and the second information corresponding to each of the plurality of regions, a specifying step of specifying the region candidate as a region of interest;
A program that causes a computer to execute.
複数の線分で構成される領域を領域候補として入力する入力工程と、An input step of inputting a region composed of a plurality of line segments as a region candidate;
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の外側の画像特徴量を示す第三情報と、を出力する出力工程と、First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate An output step of outputting third information indicating an image feature amount outside the area candidate in the area below
前記複数の領域のそれぞれに対応する前記第一情報及び前記第三情報を用いて、前記領域候補を注目領域として特定する特定工程と、Using the first information and the third information corresponding to each of the plurality of regions, a specifying step of specifying the region candidate as a region of interest;
を有することを特徴とする画像処理方法。An image processing method comprising:
複数の線分で構成される領域を領域候補として入力する入力ステップと、An input step of inputting a region composed of a plurality of line segments as a region candidate;
前記領域候補を構成する各線分における、所定大きさ以下の複数の領域において、前記線分を境界とする両側の画像特徴量の関係を示す第一情報と、前記領域候補の各角における所定大きさ以下の領域において前記領域候補の外側の画像特徴量を示す第三情報と、を出力する出力ステップと、First information indicating the relationship between image feature amounts on both sides of the line segment as a boundary in a plurality of regions having a predetermined size or less in each line segment constituting the region candidate, and a predetermined size at each corner of the region candidate An output step of outputting third information indicating an image feature amount outside the region candidate in the region below
前記複数の領域のそれぞれに対応する前記第一情報及び前記第三情報を用いて、前記領域候補を注目領域として特定する特定ステップと、Using the first information and the third information corresponding to each of the plurality of regions, a specifying step of specifying the region candidate as a region of interest;
をコンピュータに実行させることを特徴とするプログラム。A program that causes a computer to execute.
JP2014265573A 2014-12-26 2014-12-26 Image processing apparatus, image processing method, and program Active JP6272219B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014265573A JP6272219B2 (en) 2014-12-26 2014-12-26 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014265573A JP6272219B2 (en) 2014-12-26 2014-12-26 Image processing apparatus, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2016126446A JP2016126446A (en) 2016-07-11
JP6272219B2 true JP6272219B2 (en) 2018-01-31

Family

ID=56359346

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014265573A Active JP6272219B2 (en) 2014-12-26 2014-12-26 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP6272219B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6880867B2 (en) * 2017-03-16 2021-06-02 株式会社リコー Image processing equipment, image processing methods and programs
CN116229438B (en) * 2023-05-04 2023-07-21 山东超越纺织有限公司 Spinning quality visual identification system
CN116542976B (en) * 2023-07-06 2023-09-08 深圳市佳合丰科技有限公司 Visual detection system for die-cutting piece defects

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5660275B2 (en) * 2010-01-25 2015-01-28 富士ゼロックス株式会社 Image processing apparatus, image forming apparatus, and image processing program
JP5854774B2 (en) * 2011-11-11 2016-02-09 株式会社Pfu Image processing apparatus, straight line detection method, and computer program
JP2014092899A (en) * 2012-11-02 2014-05-19 Fuji Xerox Co Ltd Image processing apparatus and image processing program

Also Published As

Publication number Publication date
JP2016126446A (en) 2016-07-11

Similar Documents

Publication Publication Date Title
KR101690981B1 (en) Form recognition method and device
US9483835B2 (en) Depth value restoration method and system
JP3740065B2 (en) Object extraction device and method based on region feature value matching of region-divided video
US8805077B2 (en) Subject region detecting apparatus
US20140161359A1 (en) Method for detecting a straight line in a digital image
Dickscheid et al. Coding images with local features
JP5939056B2 (en) Method and apparatus for positioning a text region in an image
US8983205B2 (en) Method for auto-depicting trends in object contours
KR102195826B1 (en) Keypoint identification
JP6543025B2 (en) Image processing apparatus and image processing method
JP6272219B2 (en) Image processing apparatus, image processing method, and program
EP2782065B1 (en) Image-processing device removing encircling lines for identifying sub-regions of image
KR20200104488A (en) System and method for object recognition using local binarization
US8891879B2 (en) Image processing apparatus, image processing method, and program
CN108960247B (en) Image significance detection method and device and electronic equipment
JP5531643B2 (en) Passage detection method, apparatus, and program
JP6754717B2 (en) Object candidate area estimation device, object candidate area estimation method, and object candidate area estimation program
JP6272220B2 (en) Image processing apparatus and image processing method
JP6546385B2 (en) IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, AND PROGRAM
CN115880228A (en) Multi-defect merging method and device, computer equipment and storage medium
JP2011170554A (en) Object recognition device, object recognition method, and object recognition program
KR101166722B1 (en) A method of detecting interest points and finding an image descriptor based on local variation for image retrieval and the recording medium thereof
KR101741761B1 (en) A classification method of feature points required for multi-frame based building recognition
KR102239564B1 (en) System and method for object recognition different by administrative area
CN104156696B (en) Bi-directional-image-based construction method for quick local changeless feature descriptor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160630

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170510

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20170530

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20170726

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20171228

R151 Written notification of patent or utility model registration

Ref document number: 6272219

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151