JP6812731B2 - Image processing device, image processing method, image processing program - Google Patents
Image processing device, image processing method, image processing program Download PDFInfo
- Publication number
- JP6812731B2 JP6812731B2 JP2016196882A JP2016196882A JP6812731B2 JP 6812731 B2 JP6812731 B2 JP 6812731B2 JP 2016196882 A JP2016196882 A JP 2016196882A JP 2016196882 A JP2016196882 A JP 2016196882A JP 6812731 B2 JP6812731 B2 JP 6812731B2
- Authority
- JP
- Japan
- Prior art keywords
- straight line
- edge
- voting
- horizontal
- pixels
- 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
Links
Images
Landscapes
- Image Analysis (AREA)
Description
本発明は、画像に含まれる直線を抽出する画像処理装置、画像処理方法、画像処理プログラムに関する。 The present invention relates to an image processing apparatus, an image processing method, and an image processing program for extracting straight lines included in an image.
例えばトンネル内部の壁面ようなコンクリートの壁面は、経時劣化によってひび割れすることがある。非特許文献1に記載されているように、コンクリートの壁面をカメラで撮影してひび割れの有無を検出することが提案されている。撮影した画像のエッジを抽出することによってひび割れを検出することができる。 For example, a concrete wall surface such as a wall surface inside a tunnel may crack due to deterioration over time. As described in Non-Patent Document 1, it has been proposed to photograph a concrete wall surface with a camera to detect the presence or absence of cracks. Cracks can be detected by extracting the edges of the captured image.
ところが、トンネル内部の壁面を撮影した画像のエッジを抽出すると、非直線状のひび割れを示すエッジの他に、ほぼ直線状のエッジが抽出されることがある。直線状のエッジは、壁面の施工の仕方、壁面の構造等の要因によって発生する。非直線状のひび割れと直線とが混在した画像から直線を抽出することができれば、直線を取り除くことができる。 However, when the edges of the image of the wall surface inside the tunnel are extracted, almost linear edges may be extracted in addition to the edges showing non-linear cracks. The linear edge is generated by factors such as the construction method of the wall surface and the structure of the wall surface. If a straight line can be extracted from an image in which non-linear cracks and straight lines are mixed, the straight line can be removed.
特許文献1及び2、非特許文献1に記載されているように、画像に含まれる直線を抽出するためにハフ変換が多く用いられる。
As described in
直線は水平方向または垂直方向であることが多いが、水平または垂直からわずかに傾いていることがある。直線は断続的に発生することがある。トンネル内部の壁面を撮影した画像には、低コントラストで、水平方向または垂直方向とは限らない複数の直線がフレーム内の全体に発生することがある。 Straight lines are often horizontal or vertical, but may be slightly tilted from horizontal or vertical. Straight lines may occur intermittently. Images taken of the walls inside a tunnel may have multiple straight lines, not necessarily horizontal or vertical, throughout the frame with low contrast.
フレーム内の全体に存在する複数の直線をハフ変換を用いて抽出するには、膨大な計算量が必要となる。ハフ変換を用いながら、少ない計算量で、直線を抽出することができる画像処理装置、画像処理方法、画像処理プログラムが求められる。 A huge amount of calculation is required to extract a plurality of straight lines existing in the entire frame by using the Hough transform. An image processing device, an image processing method, and an image processing program capable of extracting straight lines with a small amount of calculation while using the Hough transform are required.
本発明は、画像に含まれる直線を、ハフ変換を用いながら、少ない計算量で抽出することができる画像処理装置、画像処理方法、画像処理プログラムを提供することを目的とする。 An object of the present invention is to provide an image processing apparatus, an image processing method, and an image processing program capable of extracting a straight line included in an image with a small amount of calculation while using a Hough transform.
本発明は、入力された画像信号に含まれる水平方向と垂直方向とのうちの少なくとも一方のエッジを抽出するエッジ抽出部と、前記エッジ抽出が抽出した前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納するハフ空間格納部と、前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出する傾斜直線フィッティング部と、前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正するハフ空間修正部と、前記ハフ空間修正部によって修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出する直線抽出部とを備えることを特徴とする画像処理装置を提供する。 The present invention includes an edge extraction unit that extracts at least one edge in the horizontal direction and the vertical direction included in the input image signal, and the edge extracted by the edge extraction in a completely horizontal or vertical direction. Considering that it is a straight line, each pixel constituting the edge is Huff-transformed to obtain a first angle indicating a perfect horizontal or vertical direction and a distance from the origin of the frame of the image signal to the straight line. The Huff space storage unit that stores the data represented by the voting value obtained by voting the first number of pixels of the pixels constituting the edge in the Huff space and the actual inclination angle of the edge are calculated. The inclined straight line fitting unit for fitting the edge to the inclined straight line and calculating the number of second pixels of the edge included in the inclined straight line and the distance from the origin to the inclined straight line, and the actual The number of the second pixel is added to the voting value of the second set of the inclination angle of the above and the distance from the origin to the inclined straight line, and the number of the second pixel is calculated from the voting value of the first set. It is characterized by including a huff space correction unit that corrects the huff space by subtraction, and a straight line extraction unit that extracts data of voting values exceeding a predetermined threshold in the huff space corrected by the huff space correction unit as a straight line. To provide an image processing apparatus.
本発明は、画像信号に含まれる水平方向と垂直方向とのうちの少なくとも一方のエッジを抽出し、抽出された前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納し、前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出し、前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正し、修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出することを特徴とする画像処理方法を提供する。 The present invention extracts at least one edge of the horizontal direction and the vertical direction included in the image signal, considers that the extracted edge is a perfect horizontal line or a vertical straight line, and determines the edge. Each of the constituent pixels is Huff-transformed to form the edge with respect to a first set of an angle indicating a perfect horizontal or vertical direction and a distance from the origin of the frame of the image signal to the straight line. Data represented by a voting value obtained by voting for the first number of pixels to be used is stored in the huff space, the actual inclination angle of the edge is calculated, the edge is fitted to an inclined straight line, and the edge is inclined. A second set of the number of second pixels of the edge included in the straight line and the distance from the origin to the inclined straight line is calculated, and the actual inclination angle and the distance from the origin to the inclined straight line are calculated. The number of the second pixels is added to the voting value of the first set, the number of the second pixels is subtracted from the voting values of the first set, the huff space is modified, and a predetermined threshold value in the modified huff space is set. Provided is an image processing method characterized by extracting data of a voting value exceeding a straight line as a straight line.
本発明は、コンピュータに、画像信号に含まれる水平方向と垂直方向とのうちの少なくとも一方のエッジを抽出するステップと、抽出された前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納するステップと、前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出するステップと、前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正するステップと、修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出するステップとを実行させることを特徴とする画像処理プログラムを提供する。 The present invention considers to the computer the step of extracting at least one of the horizontal and vertical edges contained in the image signal, and that the extracted edge is a perfect horizontal or vertical straight line. Then, each pixel constituting the edge is Hough transformed with respect to a first set of an angle indicating a perfect horizontal direction or a vertical direction and a distance from the origin of the frame of the image signal to the straight line. , The step of storing the data represented by the voting value obtained by voting the first number of pixels of the pixels constituting the edge in the Hough space, and calculating the actual inclination angle of the edge to form a straight line in which the edge is inclined. To calculate the number of second pixels of the edge included in the inclined straight line, the distance from the origin to the inclined straight line, the actual inclination angle, and the inclined straight line from the origin. The step of adding the number of the second pixels to the voting value of the second set with the distance to and subtracting the number of the second pixels from the voting value of the first set to correct the Hough space. Provided is an image processing program characterized by executing a step of extracting data of a voting value exceeding a predetermined threshold as a straight line in a modified Hough space.
本発明の画像処理装置、画像処理方法、画像処理プログラムによれば、画像に含まれる直線を、ハフ変換を用いながら、少ない計算量で抽出することができる。 According to the image processing apparatus, image processing method, and image processing program of the present invention, straight lines included in an image can be extracted with a small amount of calculation while using the Hough transform.
以下、一実施形態の画像処理装置、画像処理方法、画像処理プログラムについて、添付図面を参照して説明する。本実施形態においては、トンネル内部の壁面のようなコンクリートの壁面を撮影した画像を、直線状のエッジを含む画像の例とする。直線状のエッジを含む画像はコンクリートの壁面を撮影した画像に限定されない。 Hereinafter, the image processing apparatus, the image processing method, and the image processing program of one embodiment will be described with reference to the accompanying drawings. In the present embodiment, an image of a concrete wall surface such as a wall surface inside a tunnel is taken as an example of an image including a straight edge. Images containing straight edges are not limited to images taken of concrete walls.
<画像処理装置>
まず、図1を用いて、一実施形態の画像処理装置の構成及び動作を説明する。図1において、エッジ抽出部1には、図2に示すような、コンクリートの壁面を撮影した画像信号のフレーム10を構成する画素が順に入力される。エッジ抽出部1に入力される画像信号は例えば静止画の画像信号であり、グレースケールの画像信号でよい。
<Image processing device>
First, the configuration and operation of the image processing apparatus of one embodiment will be described with reference to FIG. In FIG. 1, pixels forming a
画像信号のフレーム10は、壁面に生じているひび割れである非直線状のひび割れ線11と、ほぼ水平方向に伸びる複数の直線12a〜12cと、ほぼ垂直方向に伸びる複数の直線13a〜13iを含む。ほぼ水平方向に伸びる直線12a〜12cを水平直線12と総称し、ほぼ垂直方向に伸びる直線13a〜13iを垂直直線13と総称することとする。
The
水平直線12は水平からわずかに傾いており、垂直直線13は垂直からわずかに傾いている。水平直線12が完全に水平の直線を含んでいてもよいし、垂直直線13が完全に垂直の直線を含んでいてもよい。 The horizontal straight line 12 is slightly tilted from the horizontal, and the vertical straight line 13 is slightly tilted from the vertical. The horizontal straight line 12 may include a completely horizontal straight line, or the vertical straight line 13 may include a completely vertical straight line.
図2において、フレーム10の左上角部を原点である座標(0,0)とし、画素座標を(i,j)とする。フレーム10の幅(水平画素数)をw、高さ(垂直画素数)をhとする。本実施形態においては、水平方向を0°、時計回りに回転した垂直方向を90°とする。
In FIG. 2, the upper left corner of the
エッジ抽出部1は、例えば、注目画素を中心とする水平3画素、垂直3画素の9画素に対して微分フィルタを施すことによって、画像のエッジを抽出する。微分フィルタとしては例えばSobelフィルタが用いられる。エッジ抽出部1は、注目画素は水平方向のエッジ(以下、水平エッジ)である、注目画素は垂直方向のエッジ(以下、垂直エッジ)である、注目画素はエッジではない、の3つに分類分けする。 The edge extraction unit 1 extracts edges of an image by, for example, applying a differential filter to 9 pixels of horizontal 3 pixels and vertical 3 pixels centered on the pixel of interest. As the differential filter, for example, a Sobel filter is used. The edge extraction unit 1 classifies the pixel of interest into three categories: a horizontal edge (hereinafter, horizontal edge), a pixel of interest is a vertical edge (hereinafter, vertical edge), and a pixel of interest is not an edge. Divide.
ハフ空間格納部2は、水平エッジまたは垂直エッジであるとして抽出されたそれぞれの画素をハフ変換して、ハフ変換したデータをハフ空間に格納する。
The Hough
ここで、一般的なハフ変換について説明する。図3に示すように、ハフ変換する前の座標を(x,y)とすると、座標(x,y)を通る直線Lは、ρ=x・cosθ+y・sinθで表される。θは水平線を基準としたときの角度、ρは原点である座標(0,0)から直線Lまでの距離である。座標(x,y)を通る直線の角度θと距離ρの組は無数に存在する。一般的なハフ変換においては、角度θと距離ρの組の候補に投票し、多数決によって1つの角度θと距離ρの組が選択される。このようなハフ変換には膨大な計算量が必要となる。 Here, a general Hough transform will be described. As shown in FIG. 3, assuming that the coordinates before the Hough transform are (x, y), the straight line L passing through the coordinates (x, y) is represented by ρ = x · cos θ + y · sin θ. θ is the angle with respect to the horizon, and ρ is the distance from the coordinate (0,0), which is the origin, to the straight line L. There are innumerable pairs of the angle θ and the distance ρ of the straight line passing through the coordinates (x, y). In a general Hough transform, a candidate for a pair of angle θ and distance ρ is voted, and one pair of angle θ and distance ρ is selected by a majority vote. Such a Hough transform requires a huge amount of calculation.
そこで、本実施形態においては、図2に示す水平直線12及び垂直直線13の角度は完全な水平方向または垂直方向の直線であるとみなして、水平直線12及び垂直直線13を構成するそれぞれ画素をそれぞれ0°と90°に限定してハフ変換を実施することとする。 Therefore, in the present embodiment, the angles of the horizontal straight line 12 and the vertical straight line 13 shown in FIG. 2 are regarded as a perfect horizontal straight line or a vertical straight line, and the pixels constituting the horizontal straight line 12 and the vertical straight line 13 are respectively. The huff conversion is limited to 0 ° and 90 °, respectively.
なお、図3より分かるように、角度θが0°のとき直線Lは垂直の直線となり、角度θが90°のとき直線Lは水平の直線となる。従って、ハフ空間格納部2は、図2で定義した角度0°及び90°を角度90°から減じて、一般的なハフ変換で用いられる角度θに変換してハフ変換を実施する。但し、説明を簡略化するため、図3に示す角度θであると注記しない限り、ハフ空間における角度を図2で定義した角度で説明することとする。
As can be seen from FIG. 3, when the angle θ is 0 °, the straight line L becomes a vertical straight line, and when the angle θ is 90 °, the straight line L becomes a horizontal straight line. Therefore, the Hough
本実施形態においては水平直線12の角度を0°に限定したから、任意の座標(i,j)における水平エッジを含む直線は、図4に破線で示すように、角度が0°、原点からの距離はjで表すことができる。ハフ空間格納部2は、ハフ空間H[0,j]に1を投票する。また、本実施形態においては垂直直線13の角度を90°に限定したから、任意の座標(i,j)における垂直エッジを含む直線は、図5に破線で示すように、角度が90°、原点からの距離はiで表すことができる。ハフ空間格納部2は、ハフ空間H[90,i]に1を投票する。
In the present embodiment, since the angle of the horizontal straight line 12 is limited to 0 °, the straight line including the horizontal edge at arbitrary coordinates (i, j) has an angle of 0 ° from the origin, as shown by a broken line in FIG. The distance of can be represented by j. The huff
ハフ空間格納部2は、フレーム10内で、水平エッジまたは垂直エッジであるとして抽出されたそれぞれの画素において、ハフ空間H[0,j]またはH[90,i]に1を投票する。フレーム10内での投票の結果、図2において水平直線12が位置する垂直位置jのハフ空間H[0,j]と、垂直直線13が位置する水平位置iのハフ空間H[90,i]とが大きな値となる。
The huff
ハフ空間格納部2には、完全な水平方向または垂直方向を示す角度と、フレーム10の原点から直線までの距離との第1の組に対して、エッジを構成する画素の第1の画素数を投票した投票値で表されるデータが格納されることになる。図2に示す画像の場合、第1の組は複数存在する。
The huff
傾斜直線フィッティング部3は、抽出された直線を実際の水平直線12または垂直直線13に一致させるようにフィッティングさせる。傾斜直線フィッティング部3は、水平エッジの画素が水平方向に並んでいるか、または、水平エッジの画素がフレーム10の右側に向かうに従って順に上がっていくか、もしくは下がっていくかによって厳密な水平直線であるか否かを判定する。傾斜直線フィッティング部3は、垂直エッジの画素が垂直方向に並んでいるか、または、垂直エッジの画素がフレーム10の下側に向かうに従って順に右側にずれていくか、もしくは左側にずれていくかによって厳密な垂直直線であるか否かを判定する。
The inclined straight line fitting unit 3 fits the extracted straight line so as to match the actual horizontal straight line 12 or vertical straight line 13. The inclined straight line fitting portion 3 is a strict horizontal straight line depending on whether the pixels of the horizontal edge are arranged in the horizontal direction, or the pixels of the horizontal edge are sequentially increased or decreased as the pixels of the horizontal edge are moved toward the right side of the
図4及び図5を用いて、傾斜直線フィッティング部3の動作を具体的に説明する。図4に示すように、傾斜直線フィッティング部3は、座標(0,j)と座標(w,j+n)とを結ぶ直線上の水平エッジの数をカウントする。ここで、nは例えば±w×0.1である。図4に示す角度範囲は、arctan(0.1)=5.7°より、水平方向に対して約±6°程度の角度範囲となる。この角度範囲内の任意の角度を正または負の角度pとする。 The operation of the inclined straight line fitting portion 3 will be specifically described with reference to FIGS. 4 and 5. As shown in FIG. 4, the inclined straight line fitting unit 3 counts the number of horizontal edges on the straight line connecting the coordinates (0, j) and the coordinates (w, j + n). Here, n is, for example, ± w × 0.1. The angle range shown in FIG. 4 is about ± 6 ° with respect to the horizontal direction from arctan (0.1) = 5.7 °. Let any angle within this angle range be a positive or negative angle p.
水平エッジの最大のカウント値をedhmaxとし、最大のカウント値edhmaxが得られるときの角度pを角度pmax、角度pmaxの直線と座標(0,0)との距離をrhとする。水平エッジの最大のカウント値は画素数で表される。 The maximum count value of the horizontal edge is edhmax, the angle p when the maximum count value edhmax is obtained is the angle pmax, and the distance between the straight line of the angle pmax and the coordinates (0,0) is rh. The maximum count value of the horizontal edge is represented by the number of pixels.
図5に示すように、傾斜直線フィッティング部3は、座標(i,0)と座標(i+m,h)とを結ぶ直線上の垂直エッジの数をカウントする。ここで、mは例えば±h×0.1である。図5に示す角度範囲も、垂直方向に対して約±6°程度の角度範囲となる。この角度範囲内の任意の角度を正または負の角度qとする。 As shown in FIG. 5, the inclined straight line fitting unit 3 counts the number of vertical edges on the straight line connecting the coordinates (i, 0) and the coordinates (i + m, h). Here, m is, for example, ± h × 0.1. The angle range shown in FIG. 5 is also an angle range of about ± 6 ° with respect to the vertical direction. Let any angle within this angle range be a positive or negative angle q.
垂直エッジの最大のカウント値をedvmaxとし、最大のカウント値edvmaxが得られるときの角度qを角度qmax、角度qmaxの直線と座標(0,0)との距離をrvする。垂直エッジの最大のカウント値は画素数で表される。 The maximum count value of the vertical edge is edvmax, the angle q when the maximum count value edvmax is obtained is the angle qmax, and the distance between the straight line of the angle qmax and the coordinates (0,0) is rv. The maximum count value for vertical edges is expressed in pixels.
このように、傾斜直線フィッティング部3は、水平エッジ及び垂直エッジの実際の傾斜角度(pmaxまたはqmax)を算出して、水平エッジ及び垂直エッジを傾斜した直線へとフィッティングさせる。傾斜直線フィッティング部3は、傾斜した直線に含まれる水平エッジまたは垂直エッジの第2の画素数(edhmaxまたはedvmax)と、原点から傾斜した直線までの距離(rhまたはrv)を算出する。 In this way, the inclined straight line fitting unit 3 calculates the actual inclination angle (pmax or qmax) of the horizontal edge and the vertical edge, and fits the horizontal edge and the vertical edge to the inclined straight line. The inclined straight line fitting unit 3 calculates the number of second pixels (edhmax or edvmax) of the horizontal edge or the vertical edge included in the inclined straight line and the distance (rh or rv) from the origin to the inclined straight line.
ハフ空間修正部4は、傾斜直線フィッティング部3において角度pmaxが0°ではなく(実際の角度が0°ではなく)傾斜していると判断された水平直線12と、角度qmaxが90°ではなく(実際の角度が90°ではなく)傾斜していると判断された垂直直線13におけるハフ空間を修正する。 The huff space correction unit 4 has a horizontal straight line 12 determined by the dip straight line fitting unit 3 that the angle pmax is not 0 ° (the actual angle is not 0 °) and the angle qmax is not 90 °. Correct the huff space in the vertical straight line 13 determined to be tilted (instead of the actual angle of 90 °).
ハフ空間修正部4は、ハフ空間H[pmax,rh]の投票値にカウント値edhmaxを加算し、ハフ空間H[90+qmax,rv]の投票値にカウント値edvmaxを加算する。さらに、ハフ空間修正部4は、ハフ空間H[0,j]の投票値よりカウント値edhmaxを減算し、ハフ空間H[90,i]の投票値よりカウント値edvmaxを減算する。 The huff space correction unit 4 adds the count value edhmax to the voting value of the huff space H [pmax, rh], and adds the count value edvmax to the voting value of the huff space H [90 + qmax, rv]. Further, the huff space correction unit 4 subtracts the count value edhmax from the voting value of the huff space H [0, j], and subtracts the count value edvmax from the voting value of the huff space H [90, i].
このように、ハフ空間修正部4は、実際の傾斜角度と原点から傾斜した直線までの距離との第2の組の投票値に第2の画素数を加算し、第1の組の投票値より第2の画素数を減算して、ハフ空間を修正する。これによって、ハフ空間が修正される。 In this way, the huff space correction unit 4 adds the number of pixels of the second set to the vote value of the second set of the actual tilt angle and the distance from the origin to the tilted straight line, and the vote value of the first set. The second pixel count is subtracted to correct the huff space. This modifies the huff space.
直線抽出部5は、ハフ空間の投票値が所定の閾値thrを超えるデータを直線として抽出する。以上によって、本実施形態の画像処理装置によれば、画像に含まれる直線を、ハフ変換を用いながら、少ない計算量で抽出することができる。
The straight
画像修正部6には、画像信号と、直線抽出部5よって抽出された水平直線12及び垂直直線13を示す情報が入力される。水平直線12及び垂直直線13を示す情報は、水平直線12及び垂直直線13それぞれを構成する画素の座標で表すことができる。
The image signal and information indicating the horizontal straight line 12 and the vertical straight line 13 extracted by the straight
画像修正部6は、水平直線12及び垂直直線13を示す情報に基づいて、図2に示す画像より、水平直線12及び垂直直線13を消去したり、水平直線12及び垂直直線13を目立たないように加工したりすることによって、ひび割れ線11が視覚的に目立つように画像を修正する。修正画像信号を図示していないディスプレイに供給して修正画像を表示すれば、検査者は容易にひび割れ線11を認識することができる。
The
図1に示す画像処理装置は、ハードウェアによって構成されていてもよいし、ソフトウェアによって構成されていてもよいし、ハードウェアとソフトウェアとが組み合わされて構成されていてもよい。 The image processing apparatus shown in FIG. 1 may be configured by hardware, may be configured by software, or may be configured by combining hardware and software.
図1に示す画像処理装置は、マイクロコンピュータの中央処理装置(CPU)及びメモリ、または、集積回路で構成されていてもよい。メモリに記憶されたコンピュータプログラム(画像処理プログラム)をCPUによって実行することによって、図1に示す画像処理装置が機能的に実現されていてもよい。 The image processing device shown in FIG. 1 may be composed of a central processing unit (CPU) and a memory of a microcomputer, or an integrated circuit. The image processing apparatus shown in FIG. 1 may be functionally realized by executing a computer program (image processing program) stored in the memory by the CPU.
<画像処理方法及び画像処理プログラム>
次に、図6を用いて、一実施形態の画像処理プログラムで実行される手順を説明する。図6は、一実施形態の画像処理方法による処理も示している。
<Image processing method and image processing program>
Next, the procedure executed by the image processing program of one embodiment will be described with reference to FIG. FIG. 6 also shows processing by the image processing method of one embodiment.
図6において、画像処理プログラムが実行されて処理が開始されると、CPUは、ステップS11にて、画像信号を取り込む。CPUは、ステップS12にて、水平エッジ及び垂直エッジを抽出する。ステップS11及びステップS12は、エッジ抽出部1で実行される処理に相当する。 In FIG. 6, when the image processing program is executed and the processing is started, the CPU captures the image signal in step S11. The CPU extracts the horizontal edge and the vertical edge in step S12. Step S11 and step S12 correspond to the processing executed by the edge extraction unit 1.
CPUは、ステップS21にて、水平直線12それぞれの画素においてハフ空間H[0,j]に1を投票する。ステップS21は、ハフ空間格納部2で実行される処理に相当する。
In step S21, the CPU votes 1 for the huff space H [0, j] in each pixel of the horizontal straight line 12. Step S21 corresponds to the process executed by the huff
CPUは、ステップS22にて、角度(0+p)°の傾きで座標(0,j)を通る直線上の水平エッジの数をカウントする。CPUは、ステップS23にて、最大のカウント値edhmaxが得られるときの角度pを角度pmaxとし、角度pmaxの直線と原点との距離rhを算出する。ステップS22及びS23は、傾斜直線フィッティング部3で実行される処理に相当する。 In step S22, the CPU counts the number of horizontal edges on a straight line passing through the coordinates (0, j) with an inclination of an angle (0 + p) °. In step S23, the CPU sets the angle p when the maximum count value edhmax is obtained as the angle pmax, and calculates the distance rh between the straight line of the angle pmax and the origin. Steps S22 and S23 correspond to the processes executed by the inclined straight line fitting unit 3.
CPUは、ステップS24にて、ハフ空間H[pmax,rh]の投票値にカウント値edhmaxを加算し、ステップS25にて、ハフ空間H[0,j]の投票値よりカウント値edhmaxを減算する。ステップS24及びS25は、ハフ空間修正部4で実行される処理に相当する。 In step S24, the CPU adds the count value edhmax to the voting value of the huff space H [pmax, rh], and in step S25, subtracts the count value edhmax from the voting value of the huff space H [0, j]. .. Steps S24 and S25 correspond to the processes executed by the huff space correction unit 4.
以上のステップS21〜S25と並行して、CPUはステップS31〜S35を実行する。CPUは、ステップS31にて、垂直直線13それぞれの画素においてハフ空間[H90,i]に1を投票する。ステップS31は、ハフ空間格納部2で実行される処理に相当する。
In parallel with the above steps S21 to S25, the CPU executes steps S31 to S35. In step S31, the CPU votes 1 for the huff space [H90, i] in each pixel of the vertical straight line 13. Step S31 corresponds to the process executed by the huff
CPUは、ステップS32にて、角度(90+q)°の傾きで座標(i,0)を通る直線上の垂直エッジの数をカウントする。CPUは、ステップS33にて、最大のカウント値edvmaxが得られるときの角度qを角度qmaxとし、角度qmaxの直線と原点との距離rvを算出する。ステップS32及びS33は、傾斜直線フィッティング部3で実行される処理に相当する。 In step S32, the CPU counts the number of vertical edges on a straight line passing through the coordinates (i, 0) with an inclination of an angle (90 + q) °. In step S33, the CPU sets the angle q when the maximum count value edvmax is obtained as the angle qmax, and calculates the distance rv between the straight line of the angle qmax and the origin. Steps S32 and S33 correspond to the processes executed by the inclined straight line fitting unit 3.
CPUは、ステップS34にて、ハフ空間H[90+qmax,rv]の投票値にカウント値edvmaxを加算し、ステップS35にて、ハフ空間H[90,i]の投票値よりカウント値edvmaxを減算する。ステップS34及びS35は、ハフ空間修正部4で実行される処理に相当する。 In step S34, the CPU adds the count value edvmax to the voting value of the huff space H [90 + qmax, rv], and in step S35, subtracts the count value edvmax from the voting value of the huff space H [90, i]. .. Steps S34 and S35 correspond to the processes executed by the huff space correction unit 4.
CPUは、ステップS41にて、ハフ空間H[θ,ρ]>thrを満たすデータを抽出すべき直線として選択して終了する。これによって、図2の水平直線12及び垂直直線13が抽出される。ステップS41は、直線抽出部5で実行される処理に相当する。ステップS41での角度θと距離ρは、図3で定義した直線の角度と原点から直線までの距離である。
In step S41, the CPU selects data satisfying the huff space H [θ, ρ]> thr as a straight line to be extracted and ends. As a result, the horizontal straight line 12 and the vertical straight line 13 of FIG. 2 are extracted. Step S41 corresponds to the process executed by the
本実施形態の画像処理方法及び画像処理プログラムによれば、上述した本実施形態の画像処理装置による効果と同様の効果を奏する。画像処理プログラムは、非一時的な記憶媒体に記憶されていてもよいし、インターネット等の通信回線で配信されてもよい。 According to the image processing method and the image processing program of the present embodiment, the same effect as the effect of the image processing apparatus of the present embodiment described above is obtained. The image processing program may be stored in a non-temporary storage medium, or may be distributed via a communication line such as the Internet.
<第1の変形例>
画像修正部6における画像信号の修正を容易にするため、図7に示すように構成してもよい。図7においては、ハフ空間格納部2からハフ空間修正部4までの図示を省略している。図7において、2値変換部7は、画像信号を2値化して画像修正部6に供給する。
<First modification>
In order to facilitate the correction of the image signal in the
このようにすると、図2におけるひび割れ線11、水平直線12及び垂直直線13の部分は白で表され、他の部分は黒で表される。画像修正部6は、水平直線12及び垂直直線13を示す情報に基づいて、水平直線12及び垂直直線13の部分を白から黒へと置換することによって、水平直線12及び垂直直線13を容易に消去することができる。
In this way, the portions of the
図7に示す構成によって、修正画像信号を図示していないディスプレイに供給して修正画像を表示すれば、ひび割れ線11のみが白で表示されるので、検査者は容易にひび割れ線11を認識することができる。
According to the configuration shown in FIG. 7, if the corrected image signal is supplied to a display (not shown) to display the corrected image, only the
<第2の変形例>
上述した本実施形態においては、水平直線12は水平からわずかに傾いている直線であり、垂直直線13は垂直からわずかに傾いている直線である場合を例としている。水平方向に伸びる直線が水平から大きく傾き、垂直方向に伸びる直線が垂直から大きく傾く場合には、傾斜直線フィッティング部3における座標(w,j+n)のn、座標(i+m,h)のmを大きな値としなければならず、傾斜直線フィッティング部3での演算量が増大する。
<Second modification>
In the present embodiment described above, the case where the horizontal straight line 12 is a straight line slightly inclined from the horizontal and the vertical straight line 13 is a straight line slightly inclined from the vertical is taken as an example. When the straight line extending in the horizontal direction is greatly inclined from the horizontal and the straight line extending in the vertical direction is greatly inclined from the vertical direction, n of the coordinates (w, j + n) and m of the coordinates (i + m, h) in the inclined straight line fitting portion 3 are increased. It must be a value, and the amount of calculation in the inclined straight line fitting unit 3 increases.
このような場合には、図8に示すように、エッジ抽出部1の前段にアフィン変換部8を設けることが好ましい。アフィン変換部8は、水平から大きく傾く直線を水平に近付ける(または完全に水平とする)よう、垂直から大きく傾く方向の直線を垂直に近付ける(または完全に垂直とする)よう、画像信号を回転させる。エッジ抽出部1以降の動作は図1と同じである。なお、図8においては、画像修正部6の図示を省略している。
In such a case, as shown in FIG. 8, it is preferable to provide the affine transformation unit 8 in front of the edge extraction unit 1. The affine transformation unit 8 rotates the image signal so that the straight line that is greatly tilted from the horizontal is brought closer to the horizontal (or is completely horizontal), and the straight line that is greatly tilted from the vertical is brought closer to the vertical (or is completely vertical). Let me. The operation after the edge extraction unit 1 is the same as that in FIG. Note that in FIG. 8, the
<第3の変形例>
図7に示す第1の変形例と図8に示す第2の変形例とを組み合わせた構成としてもよい。
<Third variant>
The configuration may be a combination of the first modification shown in FIG. 7 and the second modification shown in FIG.
本発明は以上説明した本実施形態に限定されるものではなく、本発明の要旨を逸脱しない範囲において種々変更可能である。本実施形態においては、画像信号が水平直線12及び垂直直線13の双方を含むことを前提としたが、水平直線12と垂直直線13の一方のみが含まれることもある。この場合は、水平直線12と垂直直線13の一方のみを抽出する処理を実行すればよい。画像処理装置に入力される画像信号を静止画の画像信号としたが、動画像信号であってもよい。 The present invention is not limited to the present embodiment described above, and various modifications can be made without departing from the gist of the present invention. In the present embodiment, it is assumed that the image signal includes both the horizontal straight line 12 and the vertical straight line 13, but only one of the horizontal straight line 12 and the vertical straight line 13 may be included. In this case, it is sufficient to execute the process of extracting only one of the horizontal straight line 12 and the vertical straight line 13. Although the image signal input to the image processing device is a still image image signal, it may be a moving image signal.
画像に含まれる直線を抽出することのみを目的とする場合には、画像修正部6は省略可能である。画像を修正する目的以外で画像に含まれる直線を抽出する画像処理装置、画像処理方法、画像処理プログラムが用いられてもよいことは勿論である。
The
1 エッジ抽出部
2 ハフ空間格納部
3 傾斜直線フィッティング部
4 ハフ空間修正部
5 直線抽出部
6 画像修正部
7 2値変換部
8 アフィン変換部
1
Claims (4)
前記エッジ抽出部が抽出した前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納するハフ空間格納部と、
前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出する傾斜直線フィッティング部と、
前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正するハフ空間修正部と、
前記ハフ空間修正部によって修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出する直線抽出部と、
を備えることを特徴とする画像処理装置。 An edge extraction unit that extracts at least one edge in the horizontal direction and the vertical direction included in the input image signal,
The edge extracted by the edge extraction unit is regarded as a straight line in a perfect horizontal direction or a vertical direction, and each pixel constituting the edge is Hough transformed to obtain an angle indicating a perfect horizontal direction or a vertical direction. The data represented by the voting value obtained by voting the first number of pixels of the pixels constituting the edge with respect to the first set of the distance from the origin of the frame of the image signal to the straight line is stored in the Hough space. Hough space storage to store and
The actual inclination angle of the edge is calculated, the edge is fitted to the inclined straight line, and the number of second pixels of the edge included in the inclined straight line and the distance from the origin to the inclined straight line are calculated. Inclined straight line fitting to calculate and
The number of the second pixel is added to the voting value of the second set of the actual tilt angle and the distance from the origin to the tilted straight line, and the second pixel is obtained from the voting value of the first set. The Huff space correction part that corrects the Huff space by subtracting the number,
A straight line extraction unit that extracts data of voting values exceeding a predetermined threshold value in the huff space modified by the huff space correction unit as a straight line, and a straight line extraction unit.
An image processing device characterized by comprising.
前記画像に含まれる前記非直線が視覚的に認識されやすいように、前記直線抽出部によって抽出された直線に基づいて前記画像信号を修正する画像修正部をさらに含む
ことを特徴とする請求項1に記載の画像処理装置。 The image signal is an image signal indicating an image including a non-straight line and a straight line in a horizontal direction or a vertical direction.
Claim 1 is characterized by further including an image correction unit that corrects the image signal based on the straight line extracted by the straight line extraction unit so that the non-straight line included in the image can be easily visually recognized. The image processing apparatus according to.
抽出された前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納し、
前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出し、
前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正し、
修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出する
ことを特徴とする画像処理方法。 Extract at least one of the horizontal and vertical edges contained in the image signal.
The extracted edge is regarded as a straight line in the perfect horizontal or vertical direction, and each pixel constituting the edge is Hough-transformed to indicate an angle indicating the perfect horizontal or vertical direction and the image signal. Data represented by a voting value obtained by voting the first number of pixels of the pixels constituting the edge for the first set of the distance from the origin of the frame to the straight line is stored in the Hough space.
The actual inclination angle of the edge is calculated, the edge is fitted to the inclined straight line, and the number of second pixels of the edge included in the inclined straight line and the distance from the origin to the inclined straight line are calculated. Calculate and
The number of the second pixel is added to the voting value of the second set of the actual tilt angle and the distance from the origin to the tilted straight line, and the second pixel is obtained from the voting value of the first set. Subtract the numbers to fix the huff space,
An image processing method characterized by extracting as a straight line the data of voting values exceeding a predetermined threshold value in the modified huff space.
画像信号に含まれる水平方向と垂直方向とのうちの少なくとも一方のエッジを抽出するステップと、
抽出された前記エッジは完全な水平方向または垂直方向の直線であるとみなして、前記エッジを構成するそれぞれの画素をハフ変換して、完全な水平方向または垂直方向を示す角度と、前記画像信号のフレームの原点から前記直線までの距離との第1の組に対して、前記エッジを構成する画素の第1の画素数を投票した投票値で表されるデータをハフ空間に格納するステップと、
前記エッジの実際の傾斜角度を算出して前記エッジを傾斜した直線へとフィッティングさせ、前記傾斜した直線に含まれる前記エッジの第2の画素数と、前記原点から前記傾斜した直線までの距離を算出するステップと、
前記実際の傾斜角度と前記原点から前記傾斜した直線までの距離との第2の組の投票値に前記第2の画素数を加算し、前記第1の組の投票値より前記第2の画素数を減算して、ハフ空間を修正するステップと、
修正されたハフ空間における所定の閾値を超える投票値のデータを直線として抽出するステップと、
を実行させることを特徴とする画像処理プログラム。 On the computer
A step of extracting at least one edge of the horizontal direction and the vertical direction included in the image signal, and
The extracted edge is regarded as a straight line in the perfect horizontal or vertical direction, and each pixel constituting the edge is Hough-transformed to indicate an angle indicating the perfect horizontal or vertical direction and the image signal. With respect to the first set of the distance from the origin of the frame to the straight line, the step of storing the data represented by the voting value obtained by voting the first number of pixels of the pixels constituting the edge in the Hough space. ,
The actual inclination angle of the edge is calculated, the edge is fitted to the inclined straight line, and the number of second pixels of the edge included in the inclined straight line and the distance from the origin to the inclined straight line are calculated. Steps to calculate and
The number of the second pixel is added to the voting value of the second set of the actual tilt angle and the distance from the origin to the tilted straight line, and the second pixel is obtained from the voting value of the first set. Steps to subtract numbers and modify the huff space,
The step of extracting the data of the voting value exceeding a predetermined threshold in the modified Huff space as a straight line, and
An image processing program characterized by executing.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2016196882A JP6812731B2 (en) | 2016-10-05 | 2016-10-05 | Image processing device, image processing method, image processing program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2016196882A JP6812731B2 (en) | 2016-10-05 | 2016-10-05 | Image processing device, image processing method, image processing program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2018060343A JP2018060343A (en) | 2018-04-12 |
| JP6812731B2 true JP6812731B2 (en) | 2021-01-13 |
Family
ID=61910003
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2016196882A Active JP6812731B2 (en) | 2016-10-05 | 2016-10-05 | Image processing device, image processing method, image processing program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6812731B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113792601B (en) * | 2021-08-10 | 2024-01-12 | 武汉光庭信息技术股份有限公司 | Parking space line fitting method and system based on Hough straight line detection result |
| CN120894532B (en) * | 2025-09-30 | 2026-01-27 | 江西软云科技股份有限公司 | An automatic image correction method and system |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3882891B2 (en) * | 2001-11-05 | 2007-02-21 | 日本電気株式会社 | Electronic component inspection apparatus, method and program thereof |
| JP2007026255A (en) * | 2005-07-20 | 2007-02-01 | East Japan Railway Co | A method for extracting the progress of deformation points in images |
| CN103971081A (en) * | 2013-01-25 | 2014-08-06 | 株式会社理光 | Multi-lane detection method and system |
-
2016
- 2016-10-05 JP JP2016196882A patent/JP6812731B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2018060343A (en) | 2018-04-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3358298B1 (en) | Building height calculation method and apparatus, and storage medium | |
| CN105046657B (en) | A kind of image stretch distortion self-adapting correction method | |
| CN104252705B (en) | Method and device for splicing images | |
| CN109479082B (en) | Image processing method and apparatus | |
| CN114723755B (en) | Fillet defect detection method, device and equipment for glass screen and storage medium | |
| JP6971789B2 (en) | Information processing equipment, programs and information processing methods | |
| CN110136069B (en) | Text image correction method, device and electronic equipment | |
| EP4068151B1 (en) | Linear processing method and apparatus in face image, terminal device, and storage medium | |
| CN108665495A (en) | Image processing method and device, mobile terminal | |
| CN105516579A (en) | Image processing method and device and electronic equipment | |
| JP6812731B2 (en) | Image processing device, image processing method, image processing program | |
| CN106919883B (en) | QR code positioning method and device | |
| US20220198814A1 (en) | Image dewarping with curved document boundaries | |
| JP6709950B2 (en) | License plate recognition device, license plate recognition system, and license plate recognition method | |
| TW201428689A (en) | Optical navigation method and device using same | |
| CN109191516B (en) | Rotation correction method and device of structured light module and readable storage medium | |
| CN108304840B (en) | Image data processing method and device | |
| JP7027043B2 (en) | Information processing equipment, information processing methods and programs | |
| CN107690656A (en) | Detect the method, apparatus and electronic equipment of optics module | |
| CN111142825B (en) | Multi-screen visual field display method, system and electronic device | |
| CN117437122B (en) | A method and system for splicing container panoramic images | |
| CN109600598B (en) | Image processing method, image processing device and computer readable recording medium | |
| JP6171165B2 (en) | Driver's license reading device and driver's license reading method | |
| JP2017027363A (en) | Video processing device, video processing method and program | |
| JP2016134636A (en) | Angle-of-view correction device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190930 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20201112 |
|
| 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: 20201117 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20201130 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 6812731 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |