JP2004310292A - Document image inspection method and device and program - Google Patents

Document image inspection method and device and program Download PDF

Info

Publication number
JP2004310292A
JP2004310292A JP2003100639A JP2003100639A JP2004310292A JP 2004310292 A JP2004310292 A JP 2004310292A JP 2003100639 A JP2003100639 A JP 2003100639A JP 2003100639 A JP2003100639 A JP 2003100639A JP 2004310292 A JP2004310292 A JP 2004310292A
Authority
JP
Japan
Prior art keywords
pixel value
image
angle
density
distance
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.)
Pending
Application number
JP2003100639A
Other languages
Japanese (ja)
Inventor
Taiichi Saito
泰一 斉藤
Takeshi Masuda
健 増田
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.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
National Institute of Advanced Industrial Science and Technology AIST
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 National Institute of Advanced Industrial Science and Technology AIST filed Critical National Institute of Advanced Industrial Science and Technology AIST
Priority to JP2003100639A priority Critical patent/JP2004310292A/en
Publication of JP2004310292A publication Critical patent/JP2004310292A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To quickly detect the angle of inclination(rotation) of a document image fetched in an inclined(rotated) state whose pixel values are unknown, that is, either concentration or luminance. <P>SOLUTION: A binary threshold is selected for input image data on an x-y plane, and whether the pixel values of the input image data are concentration or luminance is decided from the number of pixels in an upper rank and lower rank with the value as a reference. Also, the background part of an image is decided based on the binary threshold, and an added pixel value is set for pixels corresponding to an object whose background part is removed according as the pixel values are concentration or luminance, and parameter transformation to (angle, distance) coordinates called Radon transformation or Hough transformation is executed from the (x, y) coordinates of each pixel and the set added pixel value, and an angle/distance parameter chart whose linearity is easily extractable is prepared. The angle where straight lines concentrate is detected as the angle of inclination(rotation) of the image from the angle/distance parameter chart. Thus, it is possible to quicken a processing speed without decreasing performance by removing the background part. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、コンピュータに取り込まれた文書画像の、傾き(回転)角度を検出する検査方法、及び、検査装置、並びに、検査プログラムに関する。
【0002】
【従来の技術】
文書をスキャナ(走査装置)で取り込んだとき、文書原稿が傾いた(回転した)状態で入力されたり、文書原稿に書かれている文字列自体が傾いて(回転して)いると、入力された文書は、見苦しいだけでなく、画像を圧縮する場合の圧縮率の低下や、文字認識処理を行うときの誤認識の原因にもなりうる。従って、文字列の並びを、水平、あるいは、垂直にしておくことが必要である。そのために、文字列の並びが、水平、あるいは、垂直から傾いて(回転して)いる角度を検出し、その角度分、文書画像全体を逆に回転させることにより、文字列の並びを水平、あるいは、垂直にすることができる。
【0003】
文書内の画像情報から直線性を検査する方法として、パラメータ変換処理による方法がある。まずは、このパラメータ変換処理の原理を図5、図6で説明する。
図5のx−y画像平面上に、入力画像データg(x,y)があるとする。(x,y)は各画素の位置座標を示し、g(x,y)が入力画像データの(x,y)座標上の画素値を示す。x−y画像平面上にある直線l(エル)は、式(1)で表すことができる。
【0004】
ρ=x・cos(θ)+y・sin(θ) ……(1)
ここで、基準点(ここでは、原点(0,0))から直線lにおろした垂線をv(ヴイ)とすると、ρ(rho ロー)は垂線vの長さ、θ(theta シータ)(単位はradian ラジアン)はx軸とのなす角度となる。この式(1)を使い、パラメータ変換処理を行うことで、図5のx−y画像平面から図6の角度・距離パラメータ平面への対応付けが行われる。このパラメータ変換処理は、次のようにして行う。
【0005】
図5の各点(x,y)に対し、角度θを一定刻みで変化させ、各θとそのθで式(1)を計算したρのペアを求める。θとρのペアは、角度・距離パラメータ表の座標(θ,ρ)に対応する。求められた全てのθ−ρのペアで示される角度・距離パラメータ表S(θ,ρ)に、(x,y)座標上の画素値g(x,y)を加算する。ただし、背景に対し、直線上の画素値は値が大きいものとする。例えば、図5の点p1(x1,y1)について、この処理を行うことにより、S(θ,ρ)の値が大きい点を表示すると、図6の正弦曲線p1になる。これをx−y画像平面上の全変域、あるいは、部分変域内の座標点(x,y)について行うことにより、画像全体、あるいは、部分画像に対する、画素値の累積加算値である、角度・距離パラメータ表S(θ,ρ)が求まる。x−y画像平面上にある入力画像が、図5の直線l上の点p1(x1,y1)、p2(x2,y2)、p3(x3,y3)からなる場合、角度・距離パラメータ平面上では、3本の正弦曲線が現れ、それぞれ、図6の正弦曲線p1、p2、p3に対応し、これら3つの曲線は図6の点lで交差する。図6のこの交差点lの座標値(θ,ρ)は、基準点からの長さがρでx軸に対する角度がθとなる垂線に垂直な、図5の直線lを示しており、図5で直線上にある点が多いほど、図6の座標(θ,ρ)での交差回数が多いため、交差点での累積加算値は大きくなる。従って、累積加算値S(θ,ρ)の値が大きい座標点(θ,ρ)を見つけることにより、角度・距離パラメータ平面上での座標点(θ,ρ)で示される、x−y画像平面上での直線の存在を検出することができる。このパラメータ変換処理は、ラドン(Radon)変換、あるいは、ハフ(Hough)変換と呼ばれている。
【0006】
パラメータ変換処理が以上のような方法であることから、検出される直線は実線だけでなく、つながりが途切れている破線に対してもその直線性を検出することができる。文字が規則正しく並んだ文書を見ると、人間は文字列方向に平行な直線を知覚する。知覚される直線は、各文字を構成する線分が破線状に並んでいるかのように見られる。このことから、文書画像に対しパラメータ変換処理を行うことで、文字が規則正しく並んでいる文書の直線方向を検出することができる。
このパラメータ変換処理を利用し、文書画像の傾き(回転)角度を検出する、従来技術の具体例として、「特願2001−264824」があり、この方法を図4で説明する。
【0007】
画像6を画像入力処理101により入力して、入力画像データg(x,y)102を得る。入力画像データ102の位置座標(x,y)と画素値g(x,y)から、パラメータ変換処理301により、濃度としての角度・距離パラメータ表S(θ,ρ)302とカウンタ表C(θ,ρ)303を作成する。ここでは、前述の式(1)を使用してρを計算する。角度・距離パラメータ表には画素値g(x,y)を加算するのに対し、このカウンタ表には1を加算する。
【0008】
ここで、画像の濃度と輝度の関係を述べておく。画像データは、画面の多くを占める背景があり、その背景の中に対象物が存在すると見られる場合が多い。特に線図形や文字がある画像では、その区別が明確である。対象物と背景との観点から、入力された画像の画素値に対して、次の2種類の意味付けができる。画素値が大きいとき対象物に対応し、画素値が小さいとき背景に対応する場合、このとき、画素値は濃度を示しているとされる。逆に、画素値が小さいとき対象物に対応し、画素値が大きいとき背景に対応する場合、このとき、画素値は輝度を示しているとされる。
【0009】
濃度と輝度とは、このように値が逆の関係にあり、取り得る最大画素値をMとするとg(x,y)を輝度値としたとき、式(2)により、濃度値g’(x,y)を求めることができる。ビット数が8の多値画像では、画素値が0から255であり、M=255となる。ビット数が1の2値画像では、M=1となる。
g’(x,y)=M−g(x,y) ……(2)
【0010】
図4の従来技術においては、入力画像データ102の画素値が、濃度であるか輝度であるか、未知の場合を考えており、パラメータ変換処理301は、画素値が仮に濃度であるとして、濃度としての角度・距離パラメータ表302を作成している。入力画像データの画素値が輝度であった場合も考慮し、式(2)で反転させた画素値に対しても、パラメータ変換処理を行い、輝度としての角度・距離パラメータ表を作成する必要がある。しかし、ここで行うパラメータ変換処理は、処理量が非常に多いため、濃度と輝度について2回、パラメータ変換処理をすることは避けたい。
【0011】
図4において、パラメータ表反転処理304により、濃度としての角度・距離パラメータ表302とカウンタ表303から、輝度としての角度・距離パラメータ表305を作成する。
S(θ,ρ)を濃度としての角度・距離パラメータ表とすると、式(3)により、輝度としての角度・距離パラメータ表T(θ,ρ)が求まり、これは、パラメータ変換処理を1回実行するだけで、濃度と輝度に対する2つの角度・距離パラメータ表を作成する方法を示している。
T(θ,ρ)=M・C(θ,ρ)−S(θ,ρ) ……(3)
【0012】
次に、画素値を濃度として見た場合と輝度として見た場合の角度・距離パラメータ表S(θ,ρ)とT(θ,ρ)から、それぞれについて、最大直線集中度検出処理306により、濃度としての最大直線集中度307と輝度としての最大直線集中度308を検出する。濃度・輝度判定処理309により、濃度としての最大直線集中度307と輝度としての最大直線集中度308から、濃度・輝度判定情報112を得る。最後に、傾き(回転)角度検出処理310により、濃度・輝度判定情報112と、濃度としての角度・距離パラメータ表302、あるいは、輝度としての角度・距離パラメータ表305から、傾き(回転)角度116を検出する。
【0013】
【発明が解決しようとする課題】
図4の従来技術では、カウンタ表を用いることにより、処理量が多いパラメータ変換処理の実行回数を1回で済ませている。しかし、そのパラメータ変換処理の処理量の多さは、「入力画像データの処理画素数」×「角度θの個数」回、式(1)を実行しなければならないことにある。
そこで、本発明は、係る問題点を解決するため、パラメータ変換処理の実行回数である「入力画像データの処理画素数」×「角度θの個数」のうち、「入力画像データの処理画素数」を、傾き(回転)角度検出の性能を落とさずに減らすことにより、実行時間を短くすることを目的としている。
【0014】
【課題を解決するための手段】
パラメータ変換処理の処理時間を短くするためには、入力画像データの処理画素数と角度θの個数を減らせばよい。ただし、角度θの個数を減らすことは、検出すべき傾き(回転)角度の精度を下げることであり、検出性能を悪くすることになる。従って、パラメータ変換処理を実行するときの入力画像データの処理画素数を、検出性能を下げずに、減らすことができればよい。
【0015】
入力画像の処理画素数を減らす方法として、処理する画素を1画素、2画素、あるいは、数画素おきに間引きすることは、よく使われる方法である。x,y方向共1画素おきで1/4、2画素おきで1/9に処理量を減らすことができる。ただし、間引き間隔を大きくし過ぎると、処理に必要な情報まで省いてしまうおそれがある。この方法に加え、更に処理画素数を減らす方法が本発明である。
対象とする文書画像が多値の場合を考える。文書画像の例が図7であり、図8が図7の各画素値(pixel value)の頻度(frequency)をグラフにした画素値ヒストグラムである。図8において、画素値50付近で高い頻度を示す部分が図7の文書の背景部分であり、それより高い画素値を持つ画素が対象物となる文字部分である。この背景部分は、パラメータ変換処理に不要な情報であることから、これを除くことができ、従って、性能を落とさずに処理画素数を減らすことができる。
【0016】
図4の従来技術では、入力画像が濃度か輝度か不明のままパラメータ変換処理301を行い、濃度としての角度・距離パラメータ表302と輝度としての角度・距離パラメータ表305を求め、2つの角度・距離パラメータ表から、濃度か輝度かの判定を行っている。1回のパラメータ変換処理で、2つの角度・距離パラメータ表を作成するためには、入力画像データの全画素数を処理することが必要であり、これが式(3)を成立させるための条件となる。しかし、改良したいことは、処理する画素数を減らすことであり、間引きではない方法で処理画素数を減らす方法では、1回のパラメータ変換処理で2つの角度・距離パラメータ表を作成することが不可能になる。従って、本発明においては、パラメータ変換処理を行う前に、入力画像データの画素値が濃度であるか輝度であるかの判定を行う。
【0017】
まず、入力画像データの2値化しきい値kを選定する。図7の例では、図8で表されているように、しきい値(threshold)は113であった。画像の背景部分は対象物より多くの部分を占めているのが普通であることから、2値化しきい値以下の画素値の頻度nlと2値化しきい値を超える画素値の頻度nuを比較し、nl≦nuのときは濃度、nl>nuのときは輝度であると判定する。図8においては、nl≦nuであることから、濃度と判定される。場合によって、k−α以下の画素値の頻度をnl、k+β以上の画素値の頻度をnuとする濃度・輝度判定方法もある。
【0018】
入力画像データの画素値が濃度であるか輝度であるかが分かれば、濃度の場合は画素値が小さい部分を背景、輝度の場合は画素値が大きい部分を背景として、パラメータ変換処理で背景部分を除いて処理することにより、処理時間を短くすることができる。画素値が濃度を示している場合、背景と対象物を分ける境目に2値化しきい値kそのものを使い、2値化しきい値kより小さい画素値の画素を全て背景部分とすれば、処理量を大きく減らすことができる。しかし、画像によっては2値化しきい値の選定に失敗することがあるため、本発明においては、2値化しきい値選定の失敗に対処できるよう、画素値が濃度の場合は2値化しきい値からある値γ(gamma ガンマ)以下を背景部分に、画素値が輝度の場合は2値化しきい値からある値γ以上を背景部分とする方法を取る。次のように、対象物の下限画素値をkl=k+1−γ、上限画素値をku=k+1+γとして、2値化しきい値kを中心とする画素値の範囲を対象物の画素値として設定する。入力画像データの画素値が濃度を示していれば、上限画素値は無くても構わないが、上限画素値を設けるのは、輝度であった場合に必要となるからでもある。γの値は、固定値とする方法や、画像に応じて変化させる方法がある。画像に応じて変化させる方法では、γとして画素値ヒストグラムの分布の広がりに応じた値を取る方法がある。この方法は、画素値ヒストグラムの分布において、その全分散の平方根である標準偏差をσ(sigma シグマ)とし、そのD倍を取って、γ=D・σとするものである。Dは1倍、0.5倍、2倍などとすることができ、値が小さいほど処理画素数を少なくすることができるが、あまり小さくし過ぎると、情報を失って、傾き(回転)角度検出処理の性能を悪化させてしまうおそれがある。図8の場合、標準偏差が57であり、γを標準偏差の1倍とすると、画素値が113−57=56以下を背景部分と見なすことになる。従って、対象物の下限画素値kl(lower limit)は57(=56+1)となる。この場合、背景部分を除くことで、処理量は約1/3.5になる。
【0019】
パラメータ変換処理を実行する場合に加算する加算画素値pは、濃度の場合、入力画像データの画素値gがkl未満のときはp=0、kl以上のときはp=g−kl+1に、輝度の場合、gがkuを超えるときはp=0、ku以下のときはp=ku−g+1にする。以上の設定に加え、濃度の場合のgがkuを超えるときと、輝度の場合のgがkl未満のときに、加算画素値をp=ku−kl+1にする方法もある。
【0020】
次に、入力画像データが2値の場合を考える。画素値が0の画素数をnl、1の画素数をnuとし、入力画像データが多値の場合と同様に、濃度・輝度の判定を行う。濃度の場合(nl≦nu)は、パラメータ変換処理において、入力画像データの画素値gが1の画素についてのみ処理を行い、そのときの加算画素値を1とする。輝度の場合(nl>nu)は、画素値gが0の画素についてのみ処理を行い、そのときの加算画素値を1とする。2値画像データでは、画素値0は背景、1が対象物とするのが普通であるが、本発明では、処理画素数を減らす目的で、単純に、画素数が多い方を背景、少ない方を対象物とする。
【0021】
入力画像データが多値の場合、2値の場合、どちらも、前述の方法で、濃度・輝度の判定を行い、濃度・輝度の判定情報、及び、下限画素値と上限画素値から、入力画像データの画素値に対して加算画素値を決定し、加算画素値が0である画素を処理対象からはずして、角度・距離パラメータ表に加算画素値を加算する処理を行う。最終的にできた角度・距離パラメータ表から、直線性が高い角度を調査し、入力画像の傾き(回転)角度を検出する方法が本発明である。
【0022】
【発明の実施の形態】
以下で、入力画像が多値の場合の、本発明に基づく、処理画素数を減らした処理方法を図1で例示する。
画像6を画像入力処理101により入力し、入力画像データg(x,y)102を得る。2値化しきい値選定処理103により、入力画像データ102から2値化しきい値(k)104、及び、標準偏差(σ)105を求める。対象物画素値範囲設定処理106により、2値化しきい値(k)104から、下位画素数(k以下の画素数)(nl)107と上位画素数(kを超える画素数)(nu)108、及び、下限画素値(kl)109と上限画素値(ku)110を計算する。下限画素値(kl)109と上限画素値(ku)110は、kl=k+1−D・σ、ku=k+1+D・σとする。ただし、Dは定数。濃度・輝度判定処理111により、下位画素数(nl)107と上位画素数(nu)108から、nl≦nuのときは濃度、nl>nuのときは輝度、という濃度・輝度判定情報112を得る。
【0023】
パラメータ変換処理113により、濃度・輝度判定情報112と下限画素値(kl)109、上限画素値(ku)110、及び、入力画像データg(x,y)102から角度・距離パラメータ表114を作成する。
傾き(回転)角度を検出する場合、垂直付近のみ、水平付近のみ、あるいは、垂直・水平両方を使って、直線性を検査する方法がある。従って、これらに対処できるよう、作成する角度・距離パラメータ表は、垂直付近と水平付近検査用に2つ作成することにする。
【0024】
角度をθ(単位 radian ラジアン)の代わりにai(単位 degree 度)を使い、垂直付近、水平付近の角度・距離パラメータ表を、それぞれ、Sv(ai,ρj)、Sh(ai,ρj)とする。ただし、Naを角度の分割個数とすると、i=0, 1, 2, ... , Na−1 である。
なお、ρjを実数値のまま計算機で処理しようとすると、使用メモリが膨大になるため、量子化しておく必要があり、距離に関して一定範囲の区画を作って量子化し、各区画には番号jを付ける。この距離に関する区画の個数をNrとすると、j=0, 1, 2, ... , Nr−1 である。距離を量子化するのは、実数値のままでは使用メモリが膨大になるのを防ぐためだけではなく、直線性を検出するために累積加算値をある程度大きくする必要があるからでもある。
【0025】
文書の傾き(回転)角度を検出する場合、通常であれば、角度の範囲aiは0.1度(degree)刻みで−5〜5度位あれば充分と考えられる。この場合、Na=101となる。aiからθへの変換は、式(4)で行える。
θ=ai・π/180 ……(4)
【0026】
このパラメータ変換処理では、まず、角度・距離パラメータ表への加算画素値pを計算する。入力画像の画素値gが濃度の場合、g<klのときp=0、g≧klのときp=g−kl+1とし、輝度の場合、g>kuのときp=0、g≦kuのときp=ku−g+1とする。p=0のときは、角度・距離パラメータ表への加算処理は行わず、p>0なるすべてのg(x,y)に対し、座標(x,y)と指定した全ての角度aiについて、式(4)と式(1)を計算して角度aiと距離ρjのペアで示される(ai,ρj)座標を求め、その座標に対する角度・距離パラメータ表Sv(ai,ρj)とSh(ai,ρj)へpの値を加算して行く。
【0027】
最後に、図1の傾き(回転)角度検出処理115によって、パラメータ変換処理113で最終的に作成された角度・距離パラメータ表114から、直線が集中している角度を検出することにより、傾き(回転)角度116を検出する。
この傾き(回転)角度検出処理115では、垂直付近の角度・距離パラメータ表Sv(ai,ρj)と水平付近の角度・距離パラメータ表Sh(ai,ρj)について、直線が集中している角度aiを検査する。このとき、片方だけを使って検査する方法と、両方を使う方法とがあり、両方を使う場合も、垂直と水平の直線性が高い方の角度aiを採用する方法と、垂直と水平の平均の直線性が高い角度aiを採用する方法とがある。以下では、片方だけを使って検査する方法で説明を行うことにし、角度・距離パラメータ表をS(ai,ρj)とする。また、角度aiのみについての角度・距離パラメータ表をSa(j)、Sa(j)を大きい順に並べ変えたものをSs(j)とする。ただし、j=0, 1, ... Nr−1。
傾き(回転)角度検出処理において、まず、各角度aiについて、直線が集中している度合いとして、直線集中度Cを計算する。この直線集中度を計算する方法には、次のようなものがある。また、下記の方法を組み合わせた方法も考えられる。
【0028】
(a)直線集中度を、Ss(j)の上位Nm個の和とする方法。これは、C=Ca=ΣSs(j)で計算され、Caが大きいほど直線性が高いとされる。ただし、j=0, 1, ..., Nm−1。
(b)直線集中度を、Ss(j)の分散とする方法。これは、v(j)={0, 1, −1, 2, −2, ... }とすることにより、C=Cb=ΣSs(j)・{v(j)−μs}**2 で計算され、Cbが小さいほど直線性が高いとされる。ただし、μs=Σv(j)・Ss(j)/Nr、j=0, 1, ..., Nr−1。
(c)直線集中度を、前記Cbを前記Caで割った値とする方法。C=Cc=Cb/Caで計算され、Ccが小さいほど直線性が高いとされる。
(d)直線集中度を、前記Cbを前記Caの2乗で割った値とする方法。C=Cd=Cb/{Ca}**2 で計算され、Cdが小さいほど直線性が高いとされる。
(e)直線集中度を、Sa(j)の隣りとの値の差の総和とする方法。これは、C=Ce=Σ|Sa(j+1)−Sa(j)|で計算され、Ceが大きいほど直線性が高いとされる。ただし、j=1, 2, 3, ... , Nr−1。
【0029】
各角度aiについて、以上のような直線集中度を計算し、直線集中度が最も高い値を取る角度aiを、入力画像データの傾き(回転)角度として出力する。以上が、入力画像データが多値の場合における、本発明による、傾き(回転)角度を検出する方法である。
【0030】
次に、入力画像データが2値の場合を図2で説明する。
画像入力処理101により、画像6を入力して、入力画像データ102を得る。下位・上位画素数計算処理201により、下位画素数(nl)107、上位画素数(nu)108を計算する。入力画像データが2値であるため、2値化しきい値を求める必要はなく、下位画素数は画素値が0の画素数、上位画素数は画素値が1の画素数とすればよい。濃度・輝度判定処理111により、下位画素数107と上位画素数108を比較することによって、濃度・輝度判定情報112を得る。以降は、多値の場合と同様、パラメータ変換処理202、傾き(回転)角度検出処理115によって、傾き(回転)角度116を検出する。
以上の処理を特徴とする方法が本発明である。
【0031】
【実施例】
図3が、傾き(回転)角度検出を行う装置の構成を示すブロック図である。
装置の各部はバス1に接続され、全体の動作は制御部2により制御される。処理の種類を選択する場合は、コンソール3でその指示を与える。処理方法を記述したプログラムは、ハードディスク4からメモリ50に格納され、制御部2がメモリ50内のプログラムに従って処理を制御する。あるいは、メモリ50をROM(リード・オンリー・メモリ)として、プログラムを作り付けにしておいてもよい。
【0032】
まず、最初の処理では、画像6をスキャナ7で入力し、ハードディスク4に格納する。あるいは、画像が他の入力装置、例えば、ネットワーク8を通してハードディスク4に格納される場合もある。ハードディスクに格納された画像は、処理を行うためメモリ51に格納される。この格納された画像が図1の入力画像データ102である。図3のメモリ52は、図1の入力画像データ102から傾き(回転)角度116を検出するまでに、各処理で扱う情報を格納するワークエリアである。図3のメモリ51に格納されている入力画像データを入力とし、図1の2値化しきい値選定処理103により、2値化しきい値104、及び、標準偏差105を求める。対象物画素値範囲設定処理106により、下位画素数107、上位画素数108、下限画素値109、上限画素値110を設定する。濃度・輝度判定処理111により、濃度・輝度判定情報112を得る。パラメータ変換処理113により、濃度・輝度判定情報112と下限画素値109、上限画素値110、及び、入力画像データ102から、角度・距離パラメータ表114を作成する。傾き(回転)角度検出処理115により、傾き(回転)角度116を検出する。これらの情報は、図3のメモリ52に格納される。
【0033】
傾き(回転)角度(a度)が得られれば、図3のメモリ51、あるいは、ハードディスク4に格納されている入力画像データを−a度回転して、傾きを補正した画像をハードディスク4などに格納すればよい。
【0034】
【発明の効果】
本発明による傾き(回転)角度検出処理は、不要な情報を除いて処理しているだけであるため、検出性能の低下を起こさず、ハフ変換(ラドン変換)を使った手法としては、従来技術に比べ、数倍高速に処理することができる。
【図面の簡単な説明】
【図1】本発明である、対象とする画像が多値の場合における、傾き(回転)角度を検出する方法を示すブロック図。
【図2】本発明である、対象とする画像が2値の場合における、傾き(回転)角度を検出する方法を示すブロック図。
【図3】本発明である、傾き(回転)角度検出を行う装置の構成を示すブロック図。
【図4】従来技術の、傾き(回転)角度を検出する方法を示すブロック図。
【図5】パラメータ変換処理の原理を説明するための、x−y画像平面上の直線を示した図。
【図6】パラメータ変換処理の原理を説明するための、角度・距離パラメータ平面上の正弦曲線を示した図。
【図7】入力用文書画像の例。
【図8】図7の文書画像に関する、画素値ヒストグラムを表示した図。
【符号の説明】
1: バス
2: 制御部
3: コンソール
4: ハードディスク
5、50、51、52: メモリ
6: 画像
7: スキャナ
8: ネットワーク
101: 画像入力処理
102: 入力画像データ
103: 2値化しきい値選定処理
104: 2値化しきい値
105: 標準偏差
106: 対象物画素値範囲設定処理
107: 下位画素数
108: 上位画素数
109: 下限画素値
110: 上限画素値
111、309: 濃度・輝度判定処理
112: 濃度・輝度判定情報
113、202、301: パラメータ変換処理
114: 角度・距離パラメータ表
115、310: 傾き(回転)角度検出処理
116: 傾き(回転)角度
201: 下位・上位画素数計算処理
302: 濃度としての角度・距離パラメータ表
303: カウンタ表
304: パラメータ表反転処理
305: 輝度としての角度・距離パラメータ表
306: 最大直線集中度検出処理
307: 濃度としての最大直線集中度
308: 輝度としての最大直線集中度T
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an inspection method, an inspection apparatus, and an inspection program for detecting a tilt (rotation) angle of a document image captured by a computer.
[0002]
[Prior art]
When a document is scanned by a scanner (scanning device), the document is input if the document is tilted (rotated) or if the character string written on the document is tilted (rotated). Such a document is not only unsightly, but can also cause a reduction in the compression ratio when compressing an image and cause erroneous recognition when performing character recognition processing. Therefore, it is necessary to arrange the character strings horizontally or vertically. For this purpose, an angle at which the character string is inclined (rotated) from horizontal or vertical is detected, and by rotating the entire document image by the angle, the character string is arranged horizontally, Alternatively, it can be vertical.
[0003]
As a method of checking linearity from image information in a document, there is a method based on parameter conversion processing. First, the principle of this parameter conversion processing will be described with reference to FIGS.
It is assumed that input image data g (x, y) exists on the xy image plane in FIG. (X, y) indicates the position coordinates of each pixel, and g (x, y) indicates the pixel value on the (x, y) coordinates of the input image data. A straight line 1 (ell) on the xy image plane can be expressed by equation (1).
[0004]
ρ = x · cos (θ) + y · sin (θ) (1)
Here, assuming that a perpendicular drawn from the reference point (here, the origin (0, 0)) to the straight line 1 is v (v), ρ (rho low) is the length of the perpendicular v, θ (theta) theta (unit) Is the radian) is the angle made with the x-axis. By performing the parameter conversion process using the equation (1), the xy image plane in FIG. 5 is associated with the angle / distance parameter plane in FIG. This parameter conversion process is performed as follows.
[0005]
For each point (x, y) in FIG. 5, the angle θ is changed at regular intervals, and a pair of each θ and ρ obtained by calculating the equation (1) with the θ is obtained. The pair of θ and ρ corresponds to the coordinates (θ, ρ) in the angle / distance parameter table. The pixel value g (x, y) on the (x, y) coordinate is added to the angle / distance parameter table S (θ, ρ) indicated by all the obtained θ-ρ pairs. However, the pixel value on a straight line with respect to the background has a large value. For example, when this processing is performed on the point p1 (x1, y1) in FIG. 5 to display a point having a large value of S (θ, ρ), a sine curve p1 in FIG. 6 is obtained. This is performed for the coordinate points (x, y) in the entire domain or the partial domain on the xy image plane, so that the angle, which is the cumulative addition value of pixel values for the entire image or the partial image, is obtained. The distance parameter table S (θ, ρ) is obtained. When the input image on the xy image plane is composed of points p1 (x1, y1), p2 (x2, y2), and p3 (x3, y3) on the straight line l in FIG. In FIG. 6, three sinusoidal curves appear, corresponding respectively to the sinusoidal curves p1, p2, p3 in FIG. 6, which intersect at point l in FIG. The coordinate value (θ, ρ) of the intersection l in FIG. 6 indicates a straight line l in FIG. 5 which is perpendicular to a perpendicular line having a length ρ from the reference point and an angle θ with respect to the x-axis. As the number of points on the straight line increases, the number of intersections at the coordinates (θ, ρ) in FIG. 6 increases, so that the cumulative addition value at the intersection increases. Therefore, by finding a coordinate point (θ, ρ) where the value of the cumulative addition value S (θ, ρ) is large, an xy image represented by the coordinate point (θ, ρ) on the angle / distance parameter plane is obtained. The presence of a straight line on a plane can be detected. This parameter conversion process is called Radon conversion or Hough conversion.
[0006]
Since the parameter conversion processing is a method as described above, it is possible to detect the linearity of not only a solid line but also a broken line with a discontinuous connection. When looking at a document in which characters are regularly arranged, a human perceives a straight line parallel to the character string direction. The perceived straight line appears as if the line segments constituting each character are arranged in a broken line. Therefore, by performing the parameter conversion process on the document image, it is possible to detect the linear direction of the document in which characters are regularly arranged.
As a specific example of the prior art for detecting the inclination (rotation) angle of a document image using this parameter conversion processing, there is “Japanese Patent Application No. 2001-264824”, and this method will be described with reference to FIG.
[0007]
The image 6 is input by the image input processing 101 to obtain input image data g (x, y) 102. From the position coordinates (x, y) and the pixel value g (x, y) of the input image data 102, an angle / distance parameter table S (θ, ρ) 302 as a density and a counter table C (θ) are obtained by parameter conversion processing 301. , Ρ) 303 is created. Here, ρ is calculated using the above-described equation (1). While the pixel value g (x, y) is added to the angle / distance parameter table, 1 is added to this counter table.
[0008]
Here, the relationship between image density and luminance will be described. Image data has a background that occupies most of the screen, and it is often seen that an object exists in the background. In particular, in an image having a line figure or a character, the distinction is clear. From the viewpoint of the object and the background, the following two types of meanings can be given to the pixel values of the input image. When the pixel value is large when the pixel value corresponds to the object, and when the pixel value is small when the pixel value corresponds to the background, the pixel value indicates the density at this time. Conversely, when the pixel value is small, the pixel value corresponds to the object, and when the pixel value is large, the pixel value corresponds to the background. At this time, the pixel value indicates luminance.
[0009]
As described above, the density and the luminance have the opposite relationship. When the maximum pixel value that can be taken is M, and g (x, y) is the luminance value, the density value g ′ ( x, y). In a multi-level image having 8 bits, the pixel value is from 0 to 255, and M = 255. In a binary image having one bit, M = 1.
g ′ (x, y) = M−g (x, y) (2)
[0010]
In the prior art shown in FIG. 4, it is considered that the pixel value of the input image data 102 is unknown, whether it is density or luminance, and the parameter conversion processing 301 determines that the pixel value is density , An angle / distance parameter table 302 is created. In consideration of the case where the pixel value of the input image data is luminance, it is necessary to perform a parameter conversion process on the pixel value inverted by the equation (2) and create an angle / distance parameter table as luminance. is there. However, since the parameter conversion processing performed here has a very large processing amount, it is desirable to avoid performing the parameter conversion processing twice for the density and the luminance.
[0011]
In FIG. 4, an angle / distance parameter table 305 as luminance is created from an angle / distance parameter table 302 as density and a counter table 303 by a parameter table inversion process 304.
Assuming that S (θ, ρ) is an angle / distance parameter table as a density, an angle / distance parameter table as luminance T (θ, ρ) is obtained from Expression (3). It shows a method of creating two angle / distance parameter tables for density and luminance simply by executing.
T (θ, ρ) = M · C (θ, ρ) −S (θ, ρ) (3)
[0012]
Next, from the angle / distance parameter tables S (θ, ρ) and T (θ, ρ) when the pixel value is viewed as the density and when viewed as the luminance, the maximum linear concentration detection process 306 is performed for each of them. The maximum linear concentration 307 as the density and the maximum linear concentration 308 as the luminance are detected. By the density / luminance determination processing 309, the density / luminance determination information 112 is obtained from the maximum linear concentration 307 as the density and the maximum linear concentration 308 as the luminance. Finally, the inclination (rotation) angle 116 is obtained from the density / luminance determination information 112 and the angle / distance parameter table 302 as density or the angle / distance parameter table 305 as luminance by the inclination (rotation) angle detection processing 310. Is detected.
[0013]
[Problems to be solved by the invention]
In the prior art shown in FIG. 4, the number of executions of the parameter conversion processing having a large processing amount is reduced to one by using a counter table. However, the large amount of processing of the parameter conversion processing is that equation (1) must be executed “the number of processed pixels of input image data” × “the number of angles θ” times.
Therefore, the present invention solves the above problem by setting “the number of processed pixels of input image data” in “the number of processed pixels of input image data” × “the number of angles θ” which is the number of times of performing the parameter conversion process. Is intended to reduce the execution time by reducing the performance of tilt (rotation) angle detection without lowering the performance.
[0014]
[Means for Solving the Problems]
In order to shorten the processing time of the parameter conversion processing, the number of processing pixels and the number of angles θ of the input image data may be reduced. However, reducing the number of angles θ means lowering the accuracy of the inclination (rotation) angle to be detected, which deteriorates the detection performance. Therefore, it suffices if the number of processed pixels of the input image data when executing the parameter conversion processing can be reduced without lowering the detection performance.
[0015]
As a method of reducing the number of pixels to be processed of an input image, it is a commonly used method to thin out pixels to be processed every one pixel, every two pixels, or every few pixels. In both the x and y directions, the processing amount can be reduced to 1/4 for every other pixel and 1/9 for every 2 pixels. However, if the thinning interval is too large, there is a possibility that information necessary for processing may be omitted. In addition to this method, a method for further reducing the number of pixels to be processed is the present invention.
Consider the case where the target document image is multi-valued. FIG. 7 shows an example of a document image, and FIG. 8 is a pixel value histogram in which the frequency (frequency) of each pixel value (pixel value) in FIG. 7 is graphed. In FIG. 8, a portion having a high frequency near the pixel value 50 is a background portion of the document in FIG. 7, and a pixel having a higher pixel value is a character portion to be an object. Since this background portion is unnecessary information for the parameter conversion process, it can be removed, and therefore the number of pixels to be processed can be reduced without lowering the performance.
[0016]
In the prior art shown in FIG. 4, the parameter conversion processing 301 is performed without knowing whether the input image is density or luminance, and an angle / distance parameter table 302 as density and an angle / distance parameter table 305 as luminance are obtained. From the distance parameter table, it is determined whether density or luminance. In order to create two angle / distance parameter tables in one parameter conversion process, it is necessary to process the total number of pixels of the input image data, which is a condition for satisfying Expression (3). Become. However, what is desired to be improved is to reduce the number of pixels to be processed. In the method of reducing the number of pixels to be processed by a method other than thinning, it is not possible to create two angle / distance parameter tables in one parameter conversion process. Will be possible. Therefore, in the present invention, before performing the parameter conversion processing, it is determined whether the pixel value of the input image data is density or luminance.
[0017]
First, a binarization threshold k of the input image data is selected. In the example of FIG. 7, the threshold was 113 as shown in FIG. Since the background portion of the image usually occupies a larger portion than the object, the frequency nl of the pixel value below the binarization threshold and the frequency nu of the pixel value above the binarization threshold are compared. Then, when nl ≦ nu, the density is determined, and when nl> nu, the brightness is determined. In FIG. 8, since nl ≦ nu, the density is determined. In some cases, there is a density / luminance determination method in which the frequency of pixel values equal to or less than k−α is nl and the frequency of pixel values equal to or greater than k + β is nu.
[0018]
If it is known whether the pixel value of the input image data is a density or a luminance, the density conversion is performed by setting a portion having a small pixel value as a background, and in the case of luminance, a portion having a large pixel value is set as a background. , The processing time can be shortened. In the case where the pixel value indicates the density, if the binarization threshold k itself is used at the boundary between the background and the object and all pixels having a pixel value smaller than the binarization threshold k are set as the background portion, the processing amount Can be greatly reduced. However, since the selection of the binarization threshold value may fail depending on the image, in the present invention, in order to cope with the failure of the selection of the binarization threshold value, when the pixel value is the density, the binarization threshold value is set. From a certain value γ (gamma gamma) or less as a background portion, and when the pixel value is luminance, a value equal to or more than a certain value γ from the binarization threshold is used as a background portion. As described below, assuming that the lower limit pixel value of the object is kl = k + 1-γ and the upper limit pixel value is ku = k + 1 + γ, a range of pixel values centered on the binarization threshold k is set as the pixel value of the object. . If the pixel value of the input image data indicates the density, there is no need to set an upper limit pixel value, but the reason why the upper limit pixel value is set is that it is necessary in the case of luminance. The value of γ may be a fixed value, or may be changed according to the image. As a method of changing according to the image, there is a method of taking γ as a value according to the spread of the pixel value histogram distribution. In this method, in the distribution of the pixel value histogram, the standard deviation, which is the square root of the total variance, is set to σ (sigma sigma), and D times the standard deviation, and γ = D · σ. D can be 1 time, 0.5 time, 2 times, or the like. The smaller the value, the smaller the number of pixels to be processed. However, if the value is too small, information is lost and the tilt (rotation) angle is reduced. There is a possibility that the performance of the detection processing is deteriorated. In the case of FIG. 8, when the standard deviation is 57 and γ is one time of the standard deviation, a pixel value of 113-57 = 56 or less is regarded as a background portion. Therefore, the lower limit pixel value kl (lower limit) of the object is 57 (= 56 + 1). In this case, the processing amount is reduced to about 1 / 3.5 by removing the background portion.
[0019]
The added pixel value p to be added when executing the parameter conversion processing is: density: p = 0 when the pixel value g of the input image data is less than kl, p = g-kl + 1 when the pixel value g is more than kl, and luminance In the case of, p = 0 when g exceeds ku, and p = ku-g + 1 when g is less than ku. In addition to the above setting, there is a method of setting the added pixel value to p = ku−kl + 1 when g in the case of density exceeds ku and when g in the case of luminance is less than kl.
[0020]
Next, consider the case where the input image data is binary. The number of pixels having a pixel value of 0 is defined as nl, and the number of pixels having a pixel value of 1 is defined as nu. In the case of the density (nl ≦ nu), in the parameter conversion processing, the processing is performed only on the pixel of which the pixel value g of the input image data is 1, and the added pixel value at that time is set to 1. In the case of luminance (nl> nu), processing is performed only on pixels having a pixel value g of 0, and the added pixel value at that time is set to 1. In binary image data, pixel value 0 is usually a background and 1 is an object. However, in the present invention, in order to reduce the number of pixels to be processed, the pixel number 0 is simply set to the background and the pixel number 0 is set to the background. Is the object.
[0021]
In the case where the input image data is multi-valued or binary, the input image data is determined based on the density / luminance determination information and the density / luminance determination information and the lower limit pixel value and the upper limit pixel value. An addition pixel value is determined for the pixel value of the data, a pixel having an addition pixel value of 0 is excluded from the processing target, and a process of adding the addition pixel value to the angle / distance parameter table is performed. The present invention is a method of investigating an angle having high linearity from a finally formed angle / distance parameter table and detecting a tilt (rotation) angle of the input image.
[0022]
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 illustrates a processing method based on the present invention, in which the number of pixels to be processed is reduced, when the input image is multi-valued.
The image 6 is input by the image input processing 101, and input image data g (x, y) 102 is obtained. A binarization threshold value selection process 103 calculates a binarization threshold value (k) 104 and a standard deviation (σ) 105 from the input image data 102. From the binarization threshold (k) 104, the number of lower pixels (number of pixels less than k) (nl) 107 and the number of upper pixels (number of pixels exceeding k) (nu) 108 by the target pixel value range setting processing 106 , And the lower limit pixel value (kl) 109 and the upper limit pixel value (ku) 110 are calculated. The lower limit pixel value (kl) 109 and the upper limit pixel value (ku) 110 are kl = k + 1−D · σ and ku = k + 1 + D · σ. Where D is a constant. By the density / luminance determination processing 111, density / luminance determination information 112 is obtained from the number of lower pixels (nl) 107 and the number of upper pixels (nu) 108: density when nl ≦ nu, and brightness when nl> nu. .
[0023]
Through the parameter conversion processing 113, an angle / distance parameter table 114 is created from the density / luminance determination information 112, the lower limit pixel value (kl) 109, the upper limit pixel value (ku) 110, and the input image data g (x, y) 102. I do.
When detecting the inclination (rotation) angle, there is a method of inspecting the linearity using only the vicinity of the vertical, only the vicinity of the horizontal, or both the vertical and the horizontal. Therefore, in order to cope with these, two angle / distance parameter tables to be created are created for near vertical and near horizontal inspection.
[0024]
The angle is replaced by ai (unit: degree degrees) instead of θ (unit: radian radian), and the angle / distance parameter tables near the vertical and the horizontal are Sv (ai, ρj) and Sh (ai, ρj), respectively. . However, if Na is the number of divisions of the angle, i = 0, 1, 2,. . . , Na-1.
If ρj is to be processed by a computer with real values, the memory used will be enormous, and it will be necessary to quantize it. wear. Assuming that the number of sections related to this distance is Nr, j = 0, 1, 2,. . . , Nr-1. The reason why the distance is quantized is not only to prevent the memory to be used from becoming enormous if the real value is used, but also to increase the accumulated value to some extent in order to detect linearity.
[0025]
When detecting the inclination (rotation) angle of a document, it is generally considered sufficient if the angle range ai is about -5 to 5 degrees in increments of 0.1 degrees. In this case, Na = 101. Conversion from ai to θ can be performed by equation (4).
θ = ai · π / 180 (4)
[0026]
In this parameter conversion process, first, the pixel value p added to the angle / distance parameter table is calculated. When the pixel value g of the input image is the density, p = 0 when g <kl, p = g-kl + 1 when g ≧ kl, and when the luminance is g> ku, p = 0 when g> ku and g ≦ ku Let p = ku−g + 1. When p = 0, addition processing to the angle / distance parameter table is not performed, and for all g (x, y) where p> 0, for all angles ai designated as coordinates (x, y), Equations (4) and (1) are calculated to obtain (ai, ρj) coordinates represented by a pair of an angle ai and a distance ρj, and an angle / distance parameter table Sv (ai, ρj) and Sh (ai) for the coordinates are obtained. , Ρj).
[0027]
Finally, the inclination (rotation) angle detection processing 115 in FIG. 1 detects the angle at which the straight lines are concentrated from the angle / distance parameter table 114 finally created in the parameter conversion processing 113, thereby obtaining the inclination (rotation). (Rotation) Angle 116 is detected.
In the inclination (rotation) angle detection processing 115, the angle ai at which the straight lines are concentrated is obtained from the angle / distance parameter table Sv (ai, ρj) near the vertical and the angle / distance parameter table Sh (ai, ρj) near the horizontal. To inspect. At this time, there is a method of inspecting using only one of them, and a method of using both. In the case of using both, a method of adopting an angle ai having higher vertical and horizontal linearity and an average of vertical and horizontal There is a method of employing an angle ai having high linearity. In the following, description will be made with a method of inspecting using only one of them, and the angle / distance parameter table is set to S (ai, ρj). The angle / distance parameter table for only the angle ai is Sa (j), and S (j) is obtained by rearranging Sa (j) in descending order. Where j = 0, 1,. . . Nr-1.
In the inclination (rotation) angle detection processing, first, for each angle ai, a straight line concentration degree C is calculated as a degree at which straight lines are concentrated. There are the following methods for calculating the degree of linear concentration. A method combining the following methods is also conceivable.
[0028]
(A) A method in which the degree of straight line concentration is the sum of the upper Nm pieces of Ss (j). This is calculated by C = Ca = ΣSs (j), and it is considered that the larger the Ca, the higher the linearity. Where j = 0, 1,. . . , Nm-1.
(B) A method in which the degree of straight line concentration is set to the variance of Ss (j) This is because v (j) = {0, 1, −1, 2, −2,. . . }, C = Cb = {Ss (j) j {v (j) -μs} ** 2, and the smaller the Cb, the higher the linearity. Where μs = {v (j) · Ss (j) / Nr, j = 0, 1,. . . , Nr-1.
(C) A method in which the degree of linear concentration is a value obtained by dividing the Cb by the Ca. It is calculated by C = Cc = Cb / Ca, and it is considered that the smaller the Cc, the higher the linearity.
(D) A method in which the degree of linear concentration is a value obtained by dividing the Cb by the square of the Ca. C = Cd = Cb / {Ca} ** 2, and it is considered that the smaller the Cd, the higher the linearity.
(E) A method in which the degree of straight line concentration is set to the sum of differences between values adjacent to Sa (j). This is calculated by C = Ce = Σ | Sa (j + 1) −Sa (j) |, and it is considered that the larger the Ce, the higher the linearity. Here, j = 1, 2, 3, 3,. . . , Nr-1.
[0029]
For each angle ai, the above-described straight line concentration is calculated, and the angle ai at which the straight line concentration takes the highest value is output as the inclination (rotation) angle of the input image data. The above is the method of detecting a tilt (rotation) angle according to the present invention when input image data is multi-valued.
[0030]
Next, a case where the input image data is binary will be described with reference to FIG.
The image 6 is input by the image input processing 101 to obtain input image data 102. The lower / upper pixel count calculation processing 201 calculates the lower pixel count (nl) 107 and the upper pixel count (nu) 108. Since the input image data is binary, there is no need to determine a binarization threshold, and the number of lower pixels may be the number of pixels having a pixel value of 0, and the number of upper pixels may be the number of pixels having a pixel value of 1. The density / luminance determination information 112 is obtained by comparing the number of lower pixels 107 and the number of upper pixels 108 by the density / luminance determination processing 111. Thereafter, similarly to the case of the multi-value, the inclination (rotation) angle 116 is detected by the parameter conversion processing 202 and the inclination (rotation) angle detection processing 115.
The present invention is a method characterized by the above processing.
[0031]
【Example】
FIG. 3 is a block diagram showing a configuration of an apparatus for detecting a tilt (rotation) angle.
Each part of the device is connected to a bus 1, and the overall operation is controlled by a control unit 2. When selecting the type of processing, the console 3 gives the instruction. The program describing the processing method is stored in the memory 50 from the hard disk 4, and the control unit 2 controls the processing according to the program in the memory 50. Alternatively, the memory 50 may be a ROM (Read Only Memory) and a program may be built in.
[0032]
First, in the first process, the image 6 is input by the scanner 7 and stored in the hard disk 4. Alternatively, the image may be stored on the hard disk 4 via another input device, for example, the network 8. The image stored on the hard disk is stored in the memory 51 for processing. This stored image is the input image data 102 in FIG. The memory 52 in FIG. 3 is a work area for storing information handled in each processing until the inclination (rotation) angle 116 is detected from the input image data 102 in FIG. With the input image data stored in the memory 51 of FIG. 3 as an input, a binarization threshold value 104 and a standard deviation 105 are obtained by a binarization threshold value selection process 103 of FIG. The target pixel value range setting processing 106 sets the number of lower pixels 107, the number of upper pixels 108, the lower pixel value 109, and the upper pixel value 110. The density / luminance determination information 112 is obtained by the density / luminance determination processing 111. The parameter conversion processing 113 creates an angle / distance parameter table 114 from the density / luminance determination information 112, the lower limit pixel value 109, the upper limit pixel value 110, and the input image data 102. The tilt (rotation) angle 116 is detected by the tilt (rotation) angle detection processing 115. These pieces of information are stored in the memory 52 of FIG.
[0033]
If the inclination (rotation) angle (a degree) is obtained, the input image data stored in the memory 51 of FIG. 3 or the hard disk 4 is rotated by −a degree, and the image whose inclination is corrected is stored in the hard disk 4 or the like. Just store it.
[0034]
【The invention's effect】
Since the tilt (rotation) angle detection processing according to the present invention is performed only by removing unnecessary information, the detection performance does not deteriorate, and as a method using the Hough transform (Radon transform), a conventional technique is used. Can be processed several times faster than.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a method of detecting a tilt (rotation) angle when a target image is multi-valued according to the present invention.
FIG. 2 is a block diagram showing a method of detecting a tilt (rotation) angle when a target image is binary according to the present invention.
FIG. 3 is a block diagram showing a configuration of an apparatus for detecting a tilt (rotation) angle according to the present invention.
FIG. 4 is a block diagram showing a method of detecting a tilt (rotation) angle according to the related art.
FIG. 5 is a diagram illustrating straight lines on an xy image plane for explaining the principle of parameter conversion processing.
FIG. 6 is a diagram illustrating a sine curve on an angle / distance parameter plane for explaining the principle of parameter conversion processing.
FIG. 7 is an example of an input document image.
FIG. 8 is a diagram showing a pixel value histogram for the document image of FIG. 7;
[Explanation of symbols]
1: Bus
2: Control unit
3: Console
4: Hard disk
5, 50, 51, 52: Memory
6: Image
7: Scanner
8: Network
101: Image input processing
102: Input image data
103: Binary threshold selection process
104: Binarization threshold
105: Standard deviation
106: Object pixel value range setting processing
107: Lower pixel count
108: Number of upper pixels
109: lower limit pixel value
110: Upper pixel value
111, 309: density / luminance determination processing
112: density / luminance determination information
113, 202, 301: Parameter conversion processing
114: Angle / Distance Parameter Table
115, 310: inclination (rotation) angle detection processing
116: Tilt (rotation) angle
201: Lower / upper pixel count calculation processing
302: Angle / distance parameter table as density
303: Counter table
304: Parameter table inversion processing
305: Angle / distance parameter table as luminance
306: Maximum linear concentration detection processing
307: Maximum linear concentration as density
308: Maximum linear concentration T as luminance

Claims (9)

処理対象である2値、あるいは、多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを備えた、画像検査方法。
It is assumed that a binary or multi-valued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Area, or, from the pixel values on the coordinates in the partial domain, a step of determining whether the pixel value of the image is a density or brightness,
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting a tilt (rotation) angle of the image by finding an angle where straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、2値化しきい値を選定するステップと、
前記2値化しきい値を基準として計算される下位画素数と上位画素数から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを備えた、画像検査方法。
It is assumed that the multivalued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Selecting a binarization threshold from pixel values on coordinates in the domain;
Determining, from the number of lower pixels and the number of upper pixels calculated based on the binarization threshold, whether the pixel value of the image is density or luminance;
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting a tilt (rotation) angle of the image by finding an angle where straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である2値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、画素値が0の画素数と1の画素数から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを備えた、画像検査方法。
It is assumed that the binary image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance, and the entire domain or partial area on the xy image plane Determining, from the pixel values on the coordinates in the domain, whether the pixel value of the image is a density or a luminance from the number of pixels having a pixel value of 0 and the number of pixels having a value of 1;
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting a tilt (rotation) angle of the image by finding an angle where straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である2値、あるいは、多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、当該画像の画素値が濃度であるか輝度であるかを判定する手段と、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算する手段と、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行う手段と、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出する手段とを備えた、画像検査装置。
It is assumed that a binary or multi-valued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Means for determining whether the pixel value of the image is a density or a luminance from a pixel value on coordinates in the area or the partial domain;
Means for calculating an added pixel value for performing addition, obtained by changing the pixel value, depending on whether the pixel value of the image is density or luminance.
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Means for performing parameter conversion processing;
Means for detecting a tilt (rotation) angle of the image by finding an angle at which straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、2値化しきい値を選定する手段と、
前記2値化しきい値を基準として計算される下位画素数と上位画素数から、当該画像の画素値が濃度であるか輝度であるかを判定する手段と、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算する手段と、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行う手段と、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出する手段とを備えた、画像検査装置。
It is assumed that the multivalued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Means for selecting a binarization threshold from pixel values on coordinates in the domain;
Means for determining whether the pixel value of the image is a density or a luminance from the number of lower pixels and the number of upper pixels calculated based on the binarization threshold;
Means for calculating an added pixel value for performing addition, obtained by changing the pixel value, depending on whether the pixel value of the image is density or luminance.
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Means for performing parameter conversion processing;
Means for detecting a tilt (rotation) angle of the image by finding an angle at which straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である2値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、画素値が0の画素数と1の画素数から、当該画像の画素値が濃度であるか輝度であるかを判定する手段と、当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算する手段と、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行う手段と、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出する手段とを備えた、画像検査装置。
It is assumed that the binary image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance, and the entire domain or partial area on the xy image plane Means for determining whether the pixel value of the image is a density or a brightness from the number of pixels having a pixel value of 0 and the number of pixels having a pixel value of 1 from the pixel values on the coordinates in the domain; Means for calculating an added pixel value for performing addition, which is obtained by changing a pixel value, depending on whether it is density or luminance,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Means for performing parameter conversion processing;
Means for detecting a tilt (rotation) angle of the image by finding an angle at which straight lines are concentrated from the finally obtained angle / distance parameter table.
処理対象である2値、あるいは、多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを実行する画像検査プログラム。
It is assumed that a binary or multi-valued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Area, or, from the pixel values on the coordinates in the partial domain, a step of determining whether the pixel value of the image is a density or brightness,
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting the inclination (rotation) angle of the image by finding the angle at which the straight line is concentrated from the finally obtained angle / distance parameter table.
処理対象である多値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、2値化しきい値を選定するステップと、
前記2値化しきい値を基準として計算される下位画素数と上位画素数から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを実行する画像検査プログラム。
It is assumed that the multivalued image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance. Selecting a binarization threshold from pixel values on coordinates in the domain;
Determining, from the number of lower pixels and the number of upper pixels calculated based on the binarization threshold, whether the pixel value of the image is density or luminance;
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting the inclination (rotation) angle of the image by finding the angle at which the straight line is concentrated from the finally obtained angle / distance parameter table.
処理対象である2値の画像がx−y画像平面上にあり、当該画像の画素値が濃度か輝度かが未知であるものとし、前記x−y画像平面上の全変域、あるいは、部分変域内の座標上の画素値から、画素値が0の画素数と1の画素数から、当該画像の画素値が濃度であるか輝度であるかを判定するステップと、
当該画像の画素値が濃度であるか輝度であるかに応じて、画素値を変更して得られる、加算を行うための加算画素値を計算するステップと、
当該画像の背景に当たる部分を除いた部分の座標点(x,y)の各々に対し、一定間隔で取った複数の角度θから、式ρ=x・cos(θ)+y・sin(θ)で距離ρを計算し、得られた複数の(θ,ρ)ペアをパラメータ平面上の(角度,距離)座標とし、前記加算画素値をパラメータ平面上に加算して角度・距離パラメータ表を作成するパラメータ変換処理を行うステップと、
最終的に求められた前記角度・距離パラメータ表から、直線が集中している角度を見つけることにより、当該画像の傾き(回転)角度を検出するステップとを実行する画像検査プログラム。
It is assumed that the binary image to be processed is on the xy image plane, and it is unknown whether the pixel value of the image is density or luminance, and the entire domain or partial area on the xy image plane Determining, from the pixel values on the coordinates in the domain, whether the pixel value of the image is a density or a luminance from the number of pixels having a pixel value of 0 and the number of pixels having a value of 1;
A step of calculating an added pixel value for performing addition, which is obtained by changing the pixel value, depending on whether the pixel value of the image is density or brightness,
For each of the coordinate points (x, y) of the portion excluding the portion corresponding to the background of the image, from a plurality of angles θ taken at regular intervals, an equation ρ = x · cos (θ) + y · sin (θ) The distance ρ is calculated, the obtained (θ, ρ) pairs are used as (angle, distance) coordinates on the parameter plane, and the added pixel value is added on the parameter plane to create an angle / distance parameter table. Performing a parameter conversion process;
Detecting the inclination (rotation) angle of the image by finding the angle at which the straight line is concentrated from the finally obtained angle / distance parameter table.
JP2003100639A 2003-04-03 2003-04-03 Document image inspection method and device and program Pending JP2004310292A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003100639A JP2004310292A (en) 2003-04-03 2003-04-03 Document image inspection method and device and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003100639A JP2004310292A (en) 2003-04-03 2003-04-03 Document image inspection method and device and program

Publications (1)

Publication Number Publication Date
JP2004310292A true JP2004310292A (en) 2004-11-04

Family

ID=33464713

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003100639A Pending JP2004310292A (en) 2003-04-03 2003-04-03 Document image inspection method and device and program

Country Status (1)

Country Link
JP (1) JP2004310292A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011097201A (en) * 2009-10-28 2011-05-12 Kyocera Mita Corp Image processing device
JP2019200155A (en) * 2018-05-17 2019-11-21 学校法人法政大学 Surface property analysis method, surface property comparison method, and surface property measurement system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011097201A (en) * 2009-10-28 2011-05-12 Kyocera Mita Corp Image processing device
JP2019200155A (en) * 2018-05-17 2019-11-21 学校法人法政大学 Surface property analysis method, surface property comparison method, and surface property measurement system
JP7079396B2 (en) 2018-05-17 2022-06-02 学校法人法政大学 Surface texture analysis method, surface texture comparison evaluation method, and surface shape measurement system

Similar Documents

Publication Publication Date Title
WO2020140698A1 (en) Table data acquisition method and apparatus, and server
CN105469027B (en) For the horizontal and vertical lines detection and removal of file and picture
JP4339925B2 (en) Document image processing method, document image processing apparatus, document image processing program, and storage medium
US9087253B2 (en) Method and system for determining edge line in QR code binary image
US8442327B2 (en) Application of classifiers to sub-sampled integral images for detecting faces in images
US8345064B2 (en) Method and system for tile binning using half-plane edge function
JP3346795B2 (en) Image processing method
CN108241859A (en) The bearing calibration of car plate and device
CN112597662B (en) Building model error correction checking method and system
US9916663B2 (en) Image processing method and process simulation apparatus
JP2004310292A (en) Document image inspection method and device and program
JP7195092B2 (en) Identifying hand-drawn tables
CN112036232A (en) Image table structure identification method, system, terminal and storage medium
JP3760225B2 (en) Document image tilt angle detection method and system
US7620248B2 (en) System and method for validating graphical components of images
JP2858530B2 (en) Edge enhancement device
CN108629350B (en) Method and device for identifying similarity relation between pictures
JP2010152457A (en) Image processing device and image processing program
JP2001108411A (en) Device and method for pattern inspection
JP4261922B2 (en) Document image processing method, document image processing apparatus, document image processing program, and storage medium
JP2009225211A (en) Information processing apparatus and method, and program
JP2654294B2 (en) Edge detection method
JP2006018840A (en) Method, device, program and storage medium for detecting line in image, mask used with dro, its use and device for storing it
JP2004334461A (en) Character recognition device and character recognition program
JP2007328652A (en) Image processing device and image processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20041124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070123

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070216

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070508