JP2011128720A - Image processor - Google Patents

Image processor Download PDF

Info

Publication number
JP2011128720A
JP2011128720A JP2009284352A JP2009284352A JP2011128720A JP 2011128720 A JP2011128720 A JP 2011128720A JP 2009284352 A JP2009284352 A JP 2009284352A JP 2009284352 A JP2009284352 A JP 2009284352A JP 2011128720 A JP2011128720 A JP 2011128720A
Authority
JP
Japan
Prior art keywords
image
mask
reduction
pixel
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.)
Pending
Application number
JP2009284352A
Other languages
Japanese (ja)
Inventor
Takahiro Inoue
貴裕 井上
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.)
Shinko Electric Industries Co Ltd
Original Assignee
Shinko Electric Industries Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shinko Electric Industries Co Ltd filed Critical Shinko Electric Industries Co Ltd
Priority to JP2009284352A priority Critical patent/JP2011128720A/en
Publication of JP2011128720A publication Critical patent/JP2011128720A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processor which performs various kinds of the spatial filtering of input image data at high speed. <P>SOLUTION: The image processor 1 which performs the spatial filtering of the input image data includes: a mask 11 for defining pixels extracted to perform the spatial filtering in an image defined by the input image data; an extraction means 12 for extracting the pixels to which the spatial filtering is applied from the image defined by the input image data using the mask 11 to store them in a memory 10; and a computing means 13 for performing computation for the spatial filtering of the pixels stored in the memory 10. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、入力された画像データに対して空間フィルタ処理を実行する画像処理装置に関する。   The present invention relates to an image processing apparatus that performs spatial filter processing on input image data.

画像処理装置においては、画像を各種加工する際に空間フィルタと呼ばれるマスクが用いられる。空間フィルタには、雑音を低減する平均(平滑)化フィルタおよび中間値(メディアン)フィルタ、明るい領域の膨張および暗い領域の収縮を行う最大値フィルタ、明るい領域の収縮および暗い領域の膨張を行う最小値フィルタ、ならびに、エッジを抽出するラプラシアンフィルタ、などがある。平均化フィルタは線形フィルタとも呼ばれ、また、それ以外のフィルタは統計フィルタもしくは非線形フィルタとも呼ばれる。空間フィルタ処理では、画像中のある注目画素とこれに隣接する画素とについて積和演算を実行し、得られた結果を、当該注目画素の輝度として置き換える。   In an image processing apparatus, a mask called a spatial filter is used when various types of images are processed. Spatial filters include average (smoothing) and medium (median) filters that reduce noise, a maximum filter that dilates bright areas and dark areas, and a minimum that dilates bright areas and dark areas. There are a value filter and a Laplacian filter for extracting an edge. The averaging filter is also called a linear filter, and the other filters are also called statistical filters or non-linear filters. In the spatial filter process, a product-sum operation is performed on a certain pixel of interest in the image and a pixel adjacent thereto, and the obtained result is replaced with the luminance of the pixel of interest.

図14は、平均化フィルタ処理の動作原理を説明する図であって、(a)は撮像された配線基板の画像を例示する図であり、(b)は「3×3」のマスクを用いた平均化フィルタ処理を説明する図である。図14(a)に示すような配線基板が撮像された画像Qに対して平均化フィルタを適用する場合について説明する。平均化フィルタ処理においては、図14(b)に示すように平均化フィルタのマスクの大きさを例えば「3×3」とするとき、ある注目画素とこれに隣接する8個の画素に対し、図14(b)に示すマスクを用いて積和演算を実行する。本明細書では、RGBの各要素の明度を、一例として0から255までの256個の数値で表現することにする。図14(b)においては、一例として、注目画素の輝度を「207」とし、この注目画素に隣接する8個の画素の輝度を、「128」、「240」、「202」、「105」、「197」、「150」、「194」および「210」とする。具体的には、マスクに対応する「3×3」の画素領域の輝度が図14(b)に示す数値のように与えられる場合において、注目画素の画像上の座標を(i,j)としたとき、マスクの大きさは上述の通り「3×3」であるので、「1/(3×3)すなわち1/9」を、「3×3」の画素領域内の全ての画素に対し乗算し、これらを全て加算することで結果「181」を得る。すなわち平均化フィルタ処理により、注目画素(i,j)の輝度は「181」が置き換わる。図14(a)に示す画像Q上の全ての画素についてを注目画素に設定した上で、上記処理を実行し、図14(a)に示す画像Q全体にわたって平均化フィルタ処理を実行する。   14A and 14B are diagrams for explaining the operation principle of the averaging filter processing, where FIG. 14A is a diagram illustrating an image of a captured wiring board, and FIG. 14B is a diagram using a “3 × 3” mask. It is a figure explaining the averaged filter process which was written. A case will be described in which an averaging filter is applied to an image Q obtained by imaging a wiring board as shown in FIG. In the averaging filter processing, when the mask size of the averaging filter is set to “3 × 3”, for example, as shown in FIG. 14B, for a certain pixel of interest and eight pixels adjacent thereto, The product-sum operation is executed using the mask shown in FIG. In this specification, the brightness of each element of RGB is expressed by 256 numerical values from 0 to 255 as an example. In FIG. 14B, as an example, the luminance of the pixel of interest is “207”, and the luminance of the eight pixels adjacent to the pixel of interest is “128”, “240”, “202”, “105”. , “197”, “150”, “194”, and “210”. Specifically, when the luminance of the “3 × 3” pixel area corresponding to the mask is given as the numerical value shown in FIG. 14B, the coordinates of the target pixel on the image are (i, j). Since the size of the mask is “3 × 3” as described above, “1 / (3 × 3), that is, 1/9” is set to all the pixels in the pixel region of “3 × 3”. Multiply and add all of them to obtain the result “181”. That is, “181” is replaced with the luminance of the pixel of interest (i, j) by the averaging filter processing. The above processing is executed after setting all the pixels on the image Q shown in FIG. 14A as the target pixel, and the averaging filter processing is executed over the entire image Q shown in FIG.

図15は、画像上の画素のメモリ配列を説明する図であって、(a)は撮像された画像上の画素を例示する図であり、(b)はメモリに保持される画素の配列を説明する図である。図中、P(1,1)〜P(w,w)は画像上における画素の座標を示し、A0〜Aw2−1はメモリ上のアドレス(番地)を示す(ただし、wは整数)。空間フィルタ処理においては、画像上の各画素データは、メモリ上では1次元の配列として保持される。図15(a)に示す画像上においては、まず、最下列の一番左の画素P(1,1)が図中太線の矢印Y0で示される方向に走査(スキャン)され、図15(b)に示すようにメモリに順次保持されていく。最下列の一番右の画素P(1,w)の走査が完了すると、次列の画素P(2,1)について、矢印Y1で示される方向に走査され、メモリ上においては最下列の画素P(1,w)が保持されていたアドレスに続いて保持されていく。以降、順次このような走査が繰り返され、最終的には矢印Ywで示される方向に画素が走査(スキャン)され、メモリに保持される。例えば、図15(a)に示すように画像上に「w×w」個の画素がある場合、図15(a)に示す画素P(1,1)は、図15(b)に示すようにメモリ上においてはアドレス「A0」に保持され、画素P(1,2)は、図15(b)に示すようにメモリ上においてはアドレス「Aw−1」に保持される。また、図15(a)において画素P(1,1)の上側に位置する画素P(2,1)は、図15(b)に示すようにメモリ上においてはアドレス「Aw−1」に続くアドレス「Aw」に保持される。また、図15(a)において画素P(2,1)の上側に位置する画素P(3,1)は、図15(b)に示すようにメモリ上においてはアドレス「A2w−1」に続くアドレス「A2w」に保持される。そして、図15(a)において最上列の一番左の画素P(w,w)は、図15(b)に示すようにメモリ上においてはアドレス「Aw2−1」に保持される。 FIG. 15 is a diagram for explaining a memory array of pixels on an image, (a) is a diagram illustrating pixels on a captured image, and (b) is an array of pixels held in a memory. It is a figure explaining. In the figure, P (1,1) to P (w, w) indicate pixel coordinates on the image, and A0 to Aw 2 −1 indicate addresses (addresses) on the memory (where w is an integer). In the spatial filter processing, each pixel data on the image is held as a one-dimensional array on the memory. On the image shown in FIG. 15A, the leftmost pixel P (1,1) in the bottom row is first scanned in the direction indicated by the thick line arrow Y0 in FIG. As shown in FIG. When the scanning of the rightmost pixel P (1, w) in the bottom row is completed, the pixel P (2, 1) in the next row is scanned in the direction indicated by the arrow Y1, and the bottom row pixel in the memory. It is held following the address where P (1, w) was held. Thereafter, such scanning is sequentially repeated, and finally the pixels are scanned (scanned) in the direction indicated by the arrow Yw and held in the memory. For example, when there are “w × w” pixels on the image as shown in FIG. 15A, the pixel P (1,1) shown in FIG. 15A is as shown in FIG. In the memory, the address “A0” is held, and the pixel P (1,2) is held in the memory at the address “Aw−1” as shown in FIG. 15B. Further, the pixel P (2,1) located above the pixel P (1,1) in FIG. 15A follows the address “Aw−1” on the memory as shown in FIG. 15B. It is held at the address “Aw”. Further, the pixel P (3, 1) located above the pixel P (2, 1) in FIG. 15A follows the address “A2w−1” on the memory as shown in FIG. 15B. It is held at the address “A2w”. In FIG. 15A, the leftmost pixel P (w, w) in the uppermost column is held at the address “Aw 2 −1” on the memory as shown in FIG. 15B.

図16は、平均化フィルタ処理におけるメモリアクセスを説明する図であって、(a)は図15(a)に示した画像の一部を例示する図であり、(b)はメモリに保持される画素の配列を説明する図である。図16(a)に示すように、図15(a)に示した画像において座標P(2,2)の画素を注目画素とし、「3×3」のマスクを用いて平均化フィルタ処理を実行する場合、注目画素P(2,2)とこれに隣接する8個の画素P(1,1)、P(1,2)、P(1,3)、P(2,1)、P(2,3)、P(3,1)、P(3,2)およびP(3,3)に対し、積和演算を実行する。この場合、メモリ上において、図16(b)に示すように画素P(1,1)はアドレス「A0」に、画素P(1,2)はアドレス「A1」に、画素P(1,3)はアドレス「A2」に、画素P(2,1)はアドレス「Aw」に、画素P(2,2)はアドレス「Aw+1」に、画素P(2,3)はアドレス「Aw+2」に、画素P(3,1)はアドレス「A2w」に、画素P(3,2)はアドレス「A2w+1」に、画素P(3,3)はアドレス「A2w+2」に、それぞれ保持される。すなわち、例えば画素P(1,1)と画素P(2,1)は画面上では互いに隣接するが、メモリ上では、画素P(1,1)はアドレス「A0」、画素P(2,1)はアドレス「Aw」、といったように、画像の幅に相当する画素数wだけ離れたアドレスに保持されることになる。つまり、平均化フィルタ処理においては、1つの注目画素についての積和演算であっても、上述のようにメモリ上離れたアドレスに何度もメモリアクセスしなければならない。このようないわゆる「飛び飛びのアドレス」に対するメモリアクセスは効率が悪く、演算処理速度を低下させる一因である。特に平均化フィルタのマスクの大きさが大きくなるほど、メモリ上離れたアドレスにメモリアクセスする回数が増加するため、演算処理速度の低下が顕著になる。   16A and 16B are diagrams for explaining memory access in the averaging filter process. FIG. 16A is a diagram illustrating a part of the image shown in FIG. 15A, and FIG. 16B is held in the memory. It is a figure explaining the arrangement | sequence of a pixel. As shown in FIG. 16A, the pixel of the coordinate P (2, 2) is the target pixel in the image shown in FIG. 15A, and the averaging filter process is executed using the “3 × 3” mask. In this case, the target pixel P (2, 2) and the eight pixels P (1, 1), P (1, 2), P (1, 3), P (2, 1), P ( 2,3), P (3,1), P (3,2) and P (3,3) are executed. In this case, in the memory, as shown in FIG. 16B, the pixel P (1,1) is at the address “A0”, the pixel P (1,2) is at the address “A1”, and the pixel P (1,3 ) At address “A2”, pixel P (2,1) at address “Aw”, pixel P (2,2) at address “Aw + 1”, pixel P (2,3) at address “Aw + 2”, The pixel P (3, 1) is held at the address “A2w”, the pixel P (3, 2) is held at the address “A2w + 1”, and the pixel P (3, 3) is held at the address “A2w + 2”. That is, for example, the pixel P (1,1) and the pixel P (2,1) are adjacent to each other on the screen, but on the memory, the pixel P (1,1) has the address “A0” and the pixel P (2,1). ) Is held at addresses separated by the number of pixels w corresponding to the width of the image, such as an address “Aw”. In other words, in the averaging filter process, even in the product-sum operation for one target pixel, the memory access to the addresses separated from each other in the memory as described above is required. Memory access to such so-called “flying addresses” is inefficient and is one factor that reduces the processing speed. In particular, as the mask size of the averaging filter increases, the number of times of memory access to addresses that are far from the memory increases, and the calculation processing speed decreases significantly.

このような演算処理速度の低下を防ぐために、画像を縮小した上で平均化フィルタ処理を実行する方法が提案されている (例えば、特許文献1参照。)。特許文献1に記載された発明によれば、平均化フィルタ処理すべき画像を所定の縮小率で縮小し、この縮小率に応じて平均化フィルタのマスクを作成した上でこれを縮小画像に適用して積和演算し、得られた画像を縮小率の逆数を拡大率として拡大して平均化フィルタ処理後の画像を得る。縮小した画像に対して平均化処理を実行するので、メモリアクセスに要する時間が短縮され、その分、演算処理に要する時間を短縮することができる。   In order to prevent such a decrease in calculation processing speed, a method of executing an averaging filter process after reducing an image has been proposed (see, for example, Patent Document 1). According to the invention described in Patent Document 1, an image to be subjected to the averaging filter process is reduced at a predetermined reduction rate, and an averaging filter mask is created according to the reduction rate, and then applied to the reduced image. Then, the product-sum operation is performed, and the obtained image is enlarged using the reciprocal of the reduction ratio as the enlargement ratio to obtain an image after the averaging filter processing. Since the averaging process is performed on the reduced image, the time required for memory access is shortened, and accordingly, the time required for the arithmetic process can be shortened.

また、演算処理速度の低下を防ぐために、除算処理にビットシフトを用いて平均化フィルタ処理を実行する方法が提案されている (例えば、特許文献2参照。)。特許文献2に記載された発明によれば、例えば、図16(a)に示した画素P(1,1)、P(1,2)、P(1,3)、P(2,1)、P(2,2)、P(2,3)、P(3,1)、P(3,2)およびP(3,3)の輝度がそれぞれa1〜a9である場合、平均化フィルタ処理における積和演算は、式1のように変形することができる。 In order to prevent a reduction in the calculation processing speed, a method of executing an averaging filter process by using a bit shift for a division process has been proposed (for example, see Patent Document 2). According to the invention described in Patent Document 2, for example, the pixels P (1,1), P (1,2), P (1,3), and P (2,1) shown in FIG. , P (2,2), P (2,3), P (3,1), P (3,2) and P (3,3) are averaged when the luminance is a 1 to a 9 , respectively. The product-sum operation in the filter processing can be modified as shown in Equation 1.

式1は、積和の結果「Σ7×ai(ただし、i=1〜9の整数)」」を64すなわち2の6乗で除算すれば、平均化フィルタ処理のおよその計算結果を得ることができることを示している。「2の6乗で除算する」とは、メモリ上においては「6ビット分、左シフトする」ことを意味する。つまり、特許文献2に記載された発明によれば、除算についてはビットシフトで対応することができるので、平均化フィルタ処理において除算に要する時間を短縮することができる。 Equation 1 gives an approximate calculation result of the averaging filter processing by dividing the result of product sum “Σ7 × a i (where i = 1 to 9)” by 64, that is, the sixth power of 2. It shows that you can. “Division by 2 to the sixth power” means “shift left by 6 bits” on the memory. That is, according to the invention described in Patent Document 2, since division can be handled by bit shift, the time required for division in the averaging filter processing can be shortened.

特開2009−054130号公報JP 2009-054130 A 特開2004−147168号公報JP 2004-147168 A

上述のように、空間フィルタ処理においては演算処理速度の向上が求められている。しかしながら、特許文献1(特開2009−054130号公報)に記載された発明によれば、縮小率に応じたマスクを作成しなければならない。また、特許文献1に記載された発明は、平均化フィルタ処理にのみ適用することができるものであり、中間値フィルタ、最大値フィルタ、最小値フィルタおよびラプラシアンフィルタなどのような統計フィルタには適用することができない。   As described above, improvement in calculation processing speed is required in the spatial filter processing. However, according to the invention described in Patent Document 1 (Japanese Patent Laid-Open No. 2009-054130), a mask corresponding to the reduction ratio must be created. The invention described in Patent Document 1 can be applied only to the averaging filter process, and is applied to statistical filters such as an intermediate value filter, a maximum value filter, a minimum value filter, and a Laplacian filter. Can not do it.

また、特許文献2(特開2004−147168号公報)に記載された発明も、平均化フィルタ処理にのみ適用することができるものであり、中間値フィルタ、最大値フィルタ、最小値フィルタおよびラプラシアンフィルタなどのような統計フィルタには適用することができない。また、特許文献2に記載された発明は、特許文献1に記載された発明とは異なり、メモリアクセスに要する時間自体を直接的に短縮するものではないので、平均化フィルタ処理のマスクが大きくなればなるほど、一連の処理に要する時間全体に対してメモリアクセスに要する時間が占める割合が大きくなり、結局のところ、時間短縮効果は望めなくなる。同様に、平均化フィルタ処理のマスクが大きくなればなるほど、式1における乗算処理に要する時間の割合も大きくなり、時間短縮効果は望めなくなる。   Further, the invention described in Patent Document 2 (Japanese Patent Application Laid-Open No. 2004-147168) can also be applied only to the averaging filter process, and includes an intermediate value filter, a maximum value filter, a minimum value filter, and a Laplacian filter. It cannot be applied to statistical filters such as. Further, unlike the invention described in Patent Document 1, the invention described in Patent Document 2 does not directly reduce the time required for memory access, so the mask for averaging filter processing can be increased. The longer the time required for a series of processing, the greater the proportion of time required for memory access, and eventually the time reduction effect cannot be expected. Similarly, the larger the mask for the averaging filter process, the greater the proportion of time required for the multiplication process in Equation 1, and the time reduction effect cannot be expected.

従って本発明の目的は、上記問題に鑑み、入力された画像データに対して、多様な種類の空間フィルタ処理を高速に実行することができる画像処理装置を提供することにある。   Accordingly, in view of the above problems, an object of the present invention is to provide an image processing apparatus capable of executing various types of spatial filter processing on input image data at high speed.

上記目的を実現するために、本発明においては、入力された画像データに対して空間フィルタ処理を実行する画像処理装置は、入力された画像データに規定された画像において空間フィルタ処理されるために抽出されるべき画素が規定されるマスクと、マスクを用いて、入力された画像データに規定された画像から空間フィルタ処理されるべき画素を抽出し、これをメモリに格納する抽出手段と、メモリに格納された画素に対して空間フィルタ処理の計算を実行する計算手段と、を備える。   In order to achieve the above object, in the present invention, an image processing apparatus that performs spatial filtering on input image data is subjected to spatial filtering on an image defined in the input image data. A mask in which pixels to be extracted are defined, an extraction unit that extracts pixels to be spatially filtered from an image defined in the input image data using the mask, and stores the extracted pixels in a memory; and a memory Calculating means for executing calculation of spatial filter processing on the pixels stored in.

また、本発明による画像処理装置は、画像データに規定された画像を、画像縮小率で縮小する画像縮小手段と、上記マスクをマスク縮小率で縮小するマスク縮小手段と、を備える。ここで、抽出手段は、マスク縮小手段により縮小されたマスクを用いて、画像縮小手段によって縮小された画像から空間フィルタ処理されるべき画素を抽出し、これをメモリに格納する。計算手段は、このメモリに格納された画素に対して空間フィルタ処理の計算を実行する。マスクにおいて規定される、空間フィルタ処理されるために抽出されるべき画素の配置は、任意に設定可能である。   In addition, an image processing apparatus according to the present invention includes image reduction means for reducing an image defined in image data with an image reduction ratio, and mask reduction means for reducing the mask with a mask reduction ratio. Here, the extraction means extracts the pixel to be subjected to the spatial filter processing from the image reduced by the image reduction means using the mask reduced by the mask reduction means, and stores this in the memory. The calculation means executes a spatial filter process calculation for the pixels stored in the memory. The arrangement of pixels to be extracted to be spatially filtered as defined in the mask can be arbitrarily set.

また、本発明による画像処理装置は、縮小された画像の全領域にわたって計算手段が空間フィルタ処理を実行することにより得られた結果画像を、入力された画像データに規定された画像の大きさとなるように拡大する画像拡大手段を備える。   In the image processing apparatus according to the present invention, the result image obtained by the calculation means performing the spatial filtering process over the entire area of the reduced image has the size of the image defined in the input image data. Image enlarging means for enlarging is provided.

また、本発明による画像処理装置は、マスクを画像縮小率で縮小して得られる仮縮小マスクの幅を1ピクセル幅の奇数倍になる値に近似した値を、マスクの幅の画素数で除算することで得られた値を、マスク縮小率として設定する縮小率設定手段を備える。画像縮小率は、当該縮小率で画像を縮小して得られた縮小画像を再度拡大した場合に、縮小前の画像を再現することができる値に設定される。   Also, the image processing apparatus according to the present invention divides a value approximating the width of the temporary reduction mask obtained by reducing the mask with the image reduction ratio by an odd multiple of 1 pixel width by the number of pixels of the mask width. There is provided a reduction rate setting means for setting a value obtained by doing as a mask reduction rate. The image reduction rate is set to a value that can reproduce the image before reduction when the reduced image obtained by reducing the image at the reduction rate is enlarged again.

なお、画像処理装置におけるマスクおよび上記各手段は、コンピュータ等の演算処理装置が実行することができるコンピュータプログラムの形式で実現できる。以上の処理を実施する装置や、以上の処理をコンピュータに実行させるコンピュータプログラムを作成することは、以下の説明を理解した当業者には容易に実施できる事項である。また、以上の処理をコンピュータにより実行させるコンピュータプログラムを記録媒体に格納するという事項も当業者には自明である。   The mask in the image processing apparatus and each of the above means can be realized in the form of a computer program that can be executed by an arithmetic processing apparatus such as a computer. Creating an apparatus for performing the above processing and a computer program for causing a computer to execute the above processing can be easily implemented by those skilled in the art who understand the following description. Further, it is obvious to those skilled in the art that a computer program that causes a computer to execute the above processing is stored in a recording medium.

本発明によれば、入力された画像データに対する空間フィルタ処理を高速に実行することができる。   According to the present invention, it is possible to execute spatial filter processing on input image data at high speed.

本発明においては、入力された画像データに規定された画像において空間フィルタ処理されるために抽出されるべき画素が規定されるマスクを設定する。本発明によれば、このマスクを用いて入力された画像データに規定された画像から空間フィルタ処理されるべき画素を抽出した上で、これら画素に対して空間フィルタ処理本体の計算を実行するので、空間フィルタ処理の積和演算に係る計算式を適宜設定するだけで、多様な種類の空間フィルタ処理に容易に適用することが可能である。例えば、本発明は、平均化フィルタ処理のような線形フィルタ、ならびに、中間値フィルタ、最大値フィルタ、最小値フィルタおよびラプラシアンフィルタなどのような統計フィルタ、にも適用することができる。   In the present invention, a mask that defines pixels to be extracted for spatial filtering in an image defined in the input image data is set. According to the present invention, the pixels to be subjected to the spatial filter processing are extracted from the image defined in the input image data using this mask, and the calculation of the spatial filter processing main body is executed for these pixels. The present invention can be easily applied to various types of spatial filter processing simply by appropriately setting a calculation formula related to the product-sum operation of the spatial filter processing. For example, the present invention can be applied to linear filters such as averaging filter processing, and statistical filters such as intermediate value filters, maximum value filters, minimum value filters, and Laplacian filters.

また、本発明によれば、上記マスクにおいて規定される、空間フィルタ処理されるために抽出されるべき画素の配置は、任意に設定可能であるので、入力される画像データで規定される画像の内容に制限されることなくあらゆる空間フィルタ処理を実行することができる。すなわち、入力される画像データで規定される画像の内容に応じて空間フィルタ処理を柔軟に実行することができるので、当該空間フィルタ処理により得られた画像の精度を高めることができる。   Further, according to the present invention, the arrangement of pixels to be extracted for spatial filtering, which is defined in the mask, can be arbitrarily set, so that the image defined by the input image data can be set. Any spatial filtering process can be performed without being limited by the content. That is, since the spatial filter process can be flexibly executed according to the content of the image defined by the input image data, the accuracy of the image obtained by the spatial filter process can be increased.

本発明の実施例による画像処理装置の基本ブロック図である。1 is a basic block diagram of an image processing apparatus according to an embodiment of the present invention. 本発明の実施例による画像処理装置の動作フローを示すフローチャートである。It is a flowchart which shows the operation | movement flow of the image processing apparatus by the Example of this invention. 本発明の実施例における画像縮小率について説明する図である。It is a figure explaining the image reduction rate in the Example of this invention. 本発明の実施例におけるマスクについて説明する図である。It is a figure explaining the mask in the Example of this invention. 本発明の実施例におけるマスク縮小率を設定する縮小率設定手段の動作フローを示すフローチャートである。It is a flowchart which shows the operation | movement flow of the reduction ratio setting means which sets the mask reduction ratio in the Example of this invention. 本発明の実施例におけるマスクの縮小の一例を示す図である。It is a figure which shows an example of reduction of the mask in the Example of this invention. 本発明の実施例における縮小マスクを用いた画素の抽出を例示する図である。It is a figure which illustrates extraction of the pixel using the reduction mask in the Example of this invention. 本発明の実施例による画像処理装置を平均化フィルタとして適用した場合の実際の演算処理結果を示す図である。It is a figure which shows the actual calculation process result at the time of applying the image processing apparatus by the Example of this invention as an averaging filter. 本発明の実施例による画像処理装置を最大値フィルタとして適用した場合の実際の演算処理結果を示す図である。It is a figure which shows the actual arithmetic processing result at the time of applying the image processing apparatus by the Example of this invention as a maximum value filter. マスク内の画素の設定の効果の演算処理結果を例示する図である。It is a figure which illustrates the calculation processing result of the effect of the setting of the pixel in a mask. 図4(b)に示すマスクの縮小を示す図である。It is a figure which shows reduction of the mask shown in FIG.4 (b). (b)に示すマスクを用いて、本発明の実施例による画像処理装置を最大値フィルタとして適用した場合の実際の演算処理結果を示す図である。It is a figure which shows the actual arithmetic processing result at the time of applying the image processing apparatus by the Example of this invention as a maximum value filter using the mask shown to (b). 記録媒体に格納されたコンピュータプログラムにより動作する本発明の実施例の画像処理装置の構成を示すブロック図である。It is a block diagram which shows the structure of the image processing apparatus of the Example of this invention which operate | moves with the computer program stored in the recording medium. 平均化フィルタ処理の動作原理を説明する図であって、(a)は撮像された配線基板の画像を例示する図であり、(b)は「3×3」のマスクを用いた平均化フィルタ処理を説明する図である。It is a figure explaining the operation | movement principle of an averaging filter process, Comprising: (a) is a figure which illustrates the image of the imaged wiring board, (b) is an averaging filter using a "3x3" mask It is a figure explaining a process. 画像上の画素のメモリ配列を説明する図であって、(a)は撮像された画像上の画素を例示する図であり、(b)はメモリに保持される画素の配列を説明する図である。2A and 2B are diagrams illustrating a memory array of pixels on an image, where FIG. 2A illustrates a pixel on a captured image, and FIG. 2B illustrates a pixel array held in a memory. is there. 平均化フィルタ処理におけるメモリアクセスを説明する図であって、(a)は図15(a)に示した画像の一部を例示する図であり、(b)はメモリに保持される画素の配列を説明する図である。It is a figure explaining the memory access in an averaging filter process, Comprising: (a) is a figure which illustrates a part of image shown to Fig.15 (a), (b) is the arrangement | sequence of the pixel hold | maintained at memory FIG.

図1は、本発明の実施例による画像処理装置の基本ブロック図である。入力された画像データに対して空間フィルタ処理を実行する画像処理装置1は、マスク11と、抽出手段12と、計算手段13と、画像縮小手段14と、マスク縮小手段15と、画像拡大手段16と、縮小率設定手段17と、メモリ10と、を備える。画像処理装置1におけるマスク11および各手段12〜17は、コンピュータが実行することができるコンピュータプログラムの形式で実現され、したがって、画像処理装置1は、当該コンピュータプログラムがインストールされたコンピュータとして構成される。また、メモリ10は、コンピュータが一般的に有する演算処理のための作業メモリ、またはデータ記憶用のハードディスクもしくはソリッドステートドライブで実現される。なお、このコンピュータプログラムは、記録媒体に格納されてまたはインターネットなどの通信回線を介して市場に流通され得る。   FIG. 1 is a basic block diagram of an image processing apparatus according to an embodiment of the present invention. An image processing apparatus 1 that performs spatial filtering on input image data includes a mask 11, an extraction unit 12, a calculation unit 13, an image reduction unit 14, a mask reduction unit 15, and an image enlargement unit 16. A reduction rate setting means 17 and a memory 10. The mask 11 and the units 12 to 17 in the image processing apparatus 1 are realized in the form of a computer program that can be executed by a computer. Therefore, the image processing apparatus 1 is configured as a computer in which the computer program is installed. . In addition, the memory 10 is realized by a working memory for arithmetic processing that a computer generally has, a hard disk or a solid state drive for data storage. The computer program can be stored in a recording medium or distributed to the market via a communication line such as the Internet.

図2は、本発明の実施例による画像処理装置の動作フローを示すフローチャートである。以下、画像処理装置1におけるマスク11および各手段12〜17の動作原理について、図1および2を参照しながら説明する。   FIG. 2 is a flowchart showing an operation flow of the image processing apparatus according to the embodiment of the present invention. Hereinafter, the operation principle of the mask 11 and the units 12 to 17 in the image processing apparatus 1 will be described with reference to FIGS.

まず、ステップS201において、本発明による画像処理についてのコンピュータプログラムがインストールされたコンピュータである画像処理装置1に、画像データが入力される。   First, in step S201, image data is input to the image processing apparatus 1, which is a computer in which a computer program for image processing according to the present invention is installed.

ステップS101において、画像処理装置1内の画像縮小手段14は、画像データに規定された画像を、ある画像縮小率で縮小する。画像の縮小方法としては、例えば、ニアレストネイバー法、バイリニア法、バイキュービック法、あるいは平均画素法などを用いればよい。   In step S101, the image reduction unit 14 in the image processing apparatus 1 reduces the image defined in the image data at a certain image reduction rate. As an image reduction method, for example, a nearest neighbor method, a bilinear method, a bicubic method, or an average pixel method may be used.

ここで、画像縮小率については、当該縮小率で画像を縮小して得られた縮小画像を再度拡大した場合に、縮小前の画像を再現することができる値に設定する。例えば、ユーザがキーボードやマウスなどを用いて、画像処理装置1を構成するコンピュータに画像縮小率を入力し、設定する。設定された画像縮小率は画像処理装置1を構成するコンピュータ内のメモリに記憶される。図3は、本発明の実施例における画像縮小率について説明する図である。例えば、図3(a)に示すように、入力された画像データに規定される画像Qが、プリント基板を撮像したものである場合を考える。図中、白抜きの箇所はプリント基板上の配線を表し、それ以外の黒い箇所は、配線が敷設されていないプリント基板部分を表わす。例えば、図3(a)に示すように、プリント基板上の配線の幅が4ピクセル分である場合に、画像Qを縮小率「r=0.6」で縮小すると、縮小画像Rにおいては、当該配線の幅は2.4ピクセルとなる。しかしながら、図3(b)に示すように、同じくプリント基板上の配線の幅が4ピクセル分である場合に、画像Qを縮小率「r’=0.2」で縮小すると、縮小画像Rにおいては、当該配線の幅は1ピクセル未満となり、すなわちこの部分の配線が消失してしまうことになる。このように消失した線もしくは点は、再度拡大しても、縮小前の画像Qのときの配線(もしくは配線の幅)を再現することはできない。つまり、画像Qの過度の縮小は、精度の問題上適さない。したがって、本発明の実施例においては、入力された画像データに規定される画像の縮小に用いられる画像縮小率を、当該画像縮小率で画像を縮小して得られた縮小画像を再度拡大した場合に、縮小前の画像を再現することができるような値に設定する。   Here, the image reduction rate is set to a value that can reproduce the image before reduction when the reduced image obtained by reducing the image at the reduction rate is enlarged again. For example, the user inputs and sets the image reduction ratio to a computer constituting the image processing apparatus 1 using a keyboard or a mouse. The set image reduction ratio is stored in a memory in a computer constituting the image processing apparatus 1. FIG. 3 is a diagram for explaining the image reduction ratio in the embodiment of the present invention. For example, as shown in FIG. 3A, consider a case where an image Q defined by input image data is an image of a printed circuit board. In the figure, white portions represent wiring on the printed circuit board, and black portions other than that represent printed circuit board portions where wiring is not laid. For example, as shown in FIG. 3A, when the width of the wiring on the printed circuit board is 4 pixels, when the image Q is reduced at the reduction ratio “r = 0.6”, in the reduced image R, The width of the wiring is 2.4 pixels. However, as shown in FIG. 3B, when the width of the wiring on the printed circuit board is equivalent to 4 pixels and the image Q is reduced at the reduction ratio “r ′ = 0.2”, the reduced image R The width of the wiring is less than 1 pixel, that is, the wiring of this portion is lost. Even if the disappearing line or point is enlarged again, the wiring (or the width of the wiring) in the image Q before the reduction cannot be reproduced. That is, excessive reduction of the image Q is not suitable in terms of accuracy. Therefore, in the embodiment of the present invention, the image reduction ratio used for the reduction of the image defined in the input image data is the same as when the reduced image obtained by reducing the image at the image reduction ratio is enlarged again. In addition, the value is set such that the image before reduction can be reproduced.

一方、ステップS202において、マスク11を設定する。マスク11は、画素の取捨選択をすることを目的とするものであり、いわば「要素抽出マスク」である。マスク11には、画像処理装置1に入力された画像データに規定された画像において空間フィルタ処理されるために抽出されるべき画素が規定される。   On the other hand, in step S202, the mask 11 is set. The mask 11 is for the purpose of selecting pixels and is a so-called “element extraction mask”. The mask 11 defines pixels to be extracted in order to perform spatial filter processing on an image defined in the image data input to the image processing apparatus 1.

ここで、マスク11において規定される、空間フィルタ処理されるために抽出されるべき画素の配置は、任意に設定可能である。例えば、ユーザがキーボードやマウスなどを用いて、画像処理装置1を構成するコンピュータにマスク11の定義を入力し、設定する。設定されたマスク11は画像処理装置1を構成するコンピュータ内のメモリに記憶される。図4は、本発明の実施例におけるマスクについて説明する図である。例えば、マスク11の大きさを「21×21」とするとき、図中、空間フィルタ処理されるために抽出されるべき画素を「1」で表わし、抽出しない画素を「0」で表わす。図中、太線で囲まれた画素「1」は、空間フィルタ処理の計算の際の注目画素を表わす。図4(a)に示す例では、マスク11内の全画素が抽出されるようにマスク11が定義されており、図4(b)に示す例では、全体として略菱形を構成することになる複数の画素が抽出されるようにマスク11が定義されている。このようにマスク11を任意に設定可能とする利点については後述する。   Here, the arrangement of the pixels to be extracted to be subjected to the spatial filter processing defined in the mask 11 can be arbitrarily set. For example, the user inputs and sets the definition of the mask 11 to the computer constituting the image processing apparatus 1 using a keyboard, a mouse, or the like. The set mask 11 is stored in a memory in a computer constituting the image processing apparatus 1. FIG. 4 is a diagram for explaining a mask in an embodiment of the present invention. For example, when the size of the mask 11 is “21 × 21”, a pixel to be extracted for spatial filtering is represented by “1” and a pixel not to be extracted is represented by “0” in the figure. In the figure, a pixel “1” surrounded by a thick line represents a pixel of interest when performing spatial filter processing. In the example shown in FIG. 4A, the mask 11 is defined so that all the pixels in the mask 11 are extracted. In the example shown in FIG. 4B, a substantially rhombus is formed as a whole. A mask 11 is defined so that a plurality of pixels are extracted. The advantage that the mask 11 can be arbitrarily set will be described later.

図2のステップS102では、画像処理装置1内のマスク縮小手段15は、マスク11をマスク縮小率r’で縮小する。マスク11の縮小方法としては、例えば、ニアレストネイバー法、バイリニア法、バイキュービック法、あるいは平均画素法などを用いればよい。   In step S102 of FIG. 2, the mask reduction unit 15 in the image processing apparatus 1 reduces the mask 11 at the mask reduction rate r '. As a reduction method of the mask 11, for example, a nearest neighbor method, a bilinear method, a bicubic method, an average pixel method, or the like may be used.

ここで、マスク縮小率r’は、画像処理装置1内の縮小率設定手段17によって設定される。縮小率設定手段17は、マスク11を画像縮小率で縮小して得られる仮縮小マスクの幅を1ピクセル幅の奇数倍になる値に近似した値を、マスク11の幅の画素数で除算し、これにより得られた値を、マスク縮小率r’として設定する。すなわち、縮小率設定手段17は、マスク11の縮小に用いられるマスク縮小率r’は、マスク11をマスク縮小率r’で縮小したときの縮小マスクの幅の画素数が奇数になるように設定する。本発明において、このように縮小マスクの幅の画素数が奇数となるように設定するのは、縮小マスクの中心に注目画素を置いた上で空間フィルタ処理を実行するためである。   Here, the mask reduction ratio r ′ is set by the reduction ratio setting means 17 in the image processing apparatus 1. The reduction ratio setting means 17 divides a value approximating the width of the temporary reduction mask obtained by reducing the mask 11 with the image reduction ratio by an odd multiple of one pixel width by the number of pixels of the width of the mask 11. The value thus obtained is set as the mask reduction ratio r ′. That is, the reduction ratio setting means 17 sets the mask reduction ratio r ′ used for reduction of the mask 11 so that the number of pixels of the reduction mask width when the mask 11 is reduced at the mask reduction ratio r ′ becomes an odd number. To do. In the present invention, the reason why the number of pixels of the width of the reduction mask is set to an odd number is to execute the spatial filter process after placing the pixel of interest at the center of the reduction mask.

マスク縮小率r’は図5に示すフローチャートに基づいて生成される。図5は、本発明の実施例におけるマスク縮小率を設定する縮小率設定手段の動作フローを示すフローチャートである。マスクの幅(の画素数)をw、画像縮小率をrとしたとき、画像処理装置1内の縮小率設定手段17は、ステップS301において、マスク11の幅wに画像縮小率rを乗算して上記「仮縮小マスクの幅」に相当する値を算出し、さらに、この「仮縮小マスクの幅」の整数部分を算出する。この結果得られた値をw’とする。   The mask reduction ratio r 'is generated based on the flowchart shown in FIG. FIG. 5 is a flowchart showing an operation flow of the reduction ratio setting means for setting the mask reduction ratio in the embodiment of the present invention. When the mask width (number of pixels) is w and the image reduction ratio is r, the reduction ratio setting means 17 in the image processing apparatus 1 multiplies the width w of the mask 11 by the image reduction ratio r in step S301. Then, a value corresponding to the “temporary reduction mask width” is calculated, and an integer part of the “temporary reduction mask width” is calculated. The value obtained as a result is set as w '.

次いで、ステップS302において、縮小率設定手段17は、w’を2で除算したときの余りが1であるか否かを判定する。ステップS302において余りが1であると判定された場合はステップS304へ進み、余りが1でない(すなわち余りが無い)と判定された場合はステップS303へ進む。   Next, in step S <b> 302, the reduction rate setting unit 17 determines whether or not the remainder when w ′ is divided by 2 is 1. If it is determined in step S302 that the remainder is 1, the process proceeds to step S304. If it is determined that the remainder is not 1 (that is, there is no remainder), the process proceeds to step S303.

ステップS303において、縮小率設定手段17は、w’に1を加算して得られる値を、新たなるw’として設定する。   In step S303, the reduction ratio setting unit 17 sets a value obtained by adding 1 to w ′ as a new w ′.

ステップS304では、縮小率設定手段17は、w’をマスク11の幅wで除算することで得られた値を、マスク縮小率r’として設定する。   In step S <b> 304, the reduction rate setting unit 17 sets a value obtained by dividing w ′ by the width w of the mask 11 as the mask reduction rate r ′.

図6は、本発明の実施例におけるマスクの縮小の一例を示す図である。ここでは、画像縮小率rが0.6としたときにおいて、図6に示すようにマスク11の大きさが「21×21」である(すなわちマスク11の幅の画素数が21である)場合について説明する。図5のステップS301において、縮小率設定手段17は、マスク11の幅の画素数w=21に画像縮小率r=0.6を乗算して上記「仮縮小マスクの幅」に相当する値12.6を算出し、さらに、この「仮縮小マスクの幅」の整数部分としてw’=12を算出する。次いで、ステップS302において、縮小率設定手段17は、w’=12を2で除算したときの余りが1でない(すなわち余りが無い)と判定し、ステップS303へ進む。ステップS303では、縮小率設定手段17は、w’=12に1を加算して得られる値「13」を、新たなるw’として設定する。次いでステップS304では、縮小率設定手段17は、w’=13をマスク11の幅21で除算することで得られた値約0.62を、マスク縮小率r’として設定する。この結果、縮小マスク11’の大きさは「13×13」(すなわちマスク11の幅の画素数が13)となる。   FIG. 6 is a diagram showing an example of mask reduction in the embodiment of the present invention. Here, when the image reduction ratio r is 0.6, the size of the mask 11 is “21 × 21” as shown in FIG. 6 (that is, the number of pixels of the width of the mask 11 is 21). Will be described. In step S301 in FIG. 5, the reduction ratio setting unit 17 multiplies the number of pixels w = 21 of the width of the mask 11 by the image reduction ratio r = 0.6, and a value 12 corresponding to the “temporary reduction mask width”. .6, and w ′ = 12 is calculated as an integer part of the “temporary reduction mask width”. Next, in step S302, the reduction ratio setting unit 17 determines that the remainder when w '= 12 is divided by 2 is not 1 (that is, there is no remainder), and proceeds to step S303. In step S303, the reduction ratio setting unit 17 sets a value “13” obtained by adding 1 to w ′ = 12 as a new w ′. Next, in step S304, the reduction ratio setting unit 17 sets a value of about 0.62 obtained by dividing w '= 13 by the width 21 of the mask 11 as the mask reduction ratio r'. As a result, the size of the reduction mask 11 ′ is “13 × 13” (that is, the number of pixels of the width of the mask 11 is 13).

図2のステップS102では、画像処理装置1内のマスク縮小手段15は、マスク11をマスク縮小率r’で縮小し、縮小マスク11’を生成する。マスク11の縮小方法としては、例えば、ニアレストネイバー法、バイリニア法、バイキュービック法、あるいは平均画素法などがあるが、このうち、バイリニア法、バイキュービック法あるいは平均画素法を用いると、縮小した結果が、空間フィルタ処理されるために抽出されるべき画素「1」および抽出しない画素「0」以外の数値、すなわち「0」から「1」の間に収まる数値となる箇所が生じる。この「0」から「1」の間に収まる数値は、当該箇所が境界線付近にあることを意味するが、このような場合には、閾値として例えば「0.5」を設定し、縮小した結果が、閾値「0.5」より大きい場合は、空間フィルタ処理されるために抽出されるべき画素「1」とし、閾値「0.5」より大きい場合は、抽出しない画素「0」として振り分けることで対応すればよい。   In step S102 of FIG. 2, the mask reducing unit 15 in the image processing apparatus 1 reduces the mask 11 at the mask reduction rate r 'to generate a reduced mask 11'. As a reduction method of the mask 11, for example, there are a nearest neighbor method, a bilinear method, a bicubic method, or an average pixel method. Among these, the bilinear method, the bicubic method, or the average pixel method is used to reduce the size. There are places where the result is a numerical value other than the pixel “1” to be extracted for spatial filtering and the pixel “0” not to be extracted, that is, a numerical value falling between “0” and “1”. The numerical value that falls within the range from “0” to “1” means that the corresponding part is near the boundary line. In such a case, for example, “0.5” is set as the threshold value, and the reduction is performed. If the result is larger than the threshold value “0.5”, the pixel “1” to be extracted for spatial filtering is assigned, and if the result is larger than the threshold value “0.5”, the pixel “0” not to be extracted is assigned. You can do that.

次いで、ステップS103において、画像処理装置1内の抽出手段12は、マスク縮小手段15により生成された縮小マスク11’を用いて、画像縮小手段14によって縮小された画像から空間フィルタ処理されるべき画素を抽出し、これをメモリ10に格納する。図7は、本発明の実施例における縮小マスクを用いた画素の抽出を例示する図である。ここでは、縮小画像Rがプリント基板を撮像したものであり、縮小マスク11’が「13×13」(すなわちマスク11の幅の画素数が13)の大きさを有するものである場合を考える。縮小画像R中の白抜きの箇所はプリント基板上の配線を表し、それ以外の黒い箇所は、配線が敷設されていないプリント基板部分を表わす。図7(a)に示すように、抽出手段12は、縮小画像R上の、縮小マスク11’の大きさである「13×13」画素分に対応する箇所を抜き出し、これを処理対象画像Tとする。そして、図7(b)に示すように、抽出手段12は、処理対象画像Tに縮小マスク11’を掛け合わせ、空間フィルタ処理されるために抽出されるべき画素「1」を抽出し、抽出された画素にアドレスを割り振ってメモリ10に記憶させる。上述したように、空間フィルタ処理においては、画像上の各画素データは、メモリ10上では1次元の配列として保持される。図7(b)に示す一例では、抽出手段12は、抽出された169個の画素にアドレス「A1」〜「A169」を割り振ってメモリ10に格納する。   Next, in step S103, the extracting unit 12 in the image processing apparatus 1 uses the reduced mask 11 ′ generated by the mask reducing unit 15 to perform pixel filtering on the image reduced by the image reducing unit 14. Is extracted and stored in the memory 10. FIG. 7 is a diagram illustrating pixel extraction using the reduction mask in the embodiment of the present invention. Here, a case is considered in which the reduced image R is an image of the printed circuit board, and the reduced mask 11 ′ has a size of “13 × 13” (that is, the number of pixels of the width of the mask 11 is 13). A white spot in the reduced image R represents a wiring on the printed board, and a black spot other than that represents a printed board portion where no wiring is laid. As shown in FIG. 7A, the extracting unit 12 extracts a portion corresponding to “13 × 13” pixels, which is the size of the reduced mask 11 ′, on the reduced image R, and extracts the portion corresponding to the processing target image T. And Then, as shown in FIG. 7B, the extraction unit 12 multiplies the processing target image T by the reduction mask 11 ′, extracts the pixel “1” to be extracted for spatial filtering, and extracts An address is assigned to the selected pixel and stored in the memory 10. As described above, in the spatial filter processing, each pixel data on the image is held as a one-dimensional array on the memory 10. In the example illustrated in FIG. 7B, the extraction unit 12 assigns addresses “A1” to “A169” to the extracted 169 pixels and stores them in the memory 10.

図2のステップS104において、画像処理装置1の計算手段13は、メモリ10に格納された画素に対して空間フィルタ処理の計算を実行する。計算手段13が計算すべき計算式は、空間処理フィルタの種類に応じて適宜設定すればよい。   In step S <b> 104 of FIG. 2, the calculation unit 13 of the image processing apparatus 1 performs a spatial filter process calculation on the pixels stored in the memory 10. What is necessary is just to set suitably the calculation formula which the calculation means 13 should calculate according to the kind of spatial processing filter.

例えば、図7(b)に示された抽出された169個の画素に対して平均化フィルタ処理を実行する場合、計算手段13は、抽出された169個の画素の輝度を用いて式2の計算を実行する。なお、式2においては、説明を簡明にするために、図7(b)に示された画素のアドレス「Ai」(ただし、iは1以上169以下の整数)をそのまま、当該アドレスにおける画素の輝度の値を表わすものとして用いている。   For example, when the averaging filter process is performed on the extracted 169 pixels illustrated in FIG. 7B, the calculation unit 13 uses the luminance of the extracted 169 pixels to calculate the equation (2). Perform the calculation. In Equation 2, for the sake of simplicity, the pixel address “Ai” (where i is an integer from 1 to 169) shown in FIG. It is used to represent the luminance value.

また例えば、図7(b)に示された抽出された169個の画素に最大値フィルタ処理を実行する場合、計算手段13は、抽出された169個の画素の輝度を用いて式3の計算を実行する。なお、式3においては、説明を簡明にするために、図7(b)に示された画素のアドレスAi(ただし、iは1以上169以下の整数)をそのまま、当該アドレスにおける画素の輝度の値を表わすものとして用いている。   Further, for example, when the maximum value filtering process is executed on the extracted 169 pixels shown in FIG. 7B, the calculation unit 13 calculates Equation 3 using the luminance of the extracted 169 pixels. Execute. In Formula 3, for the sake of simplicity, the pixel address Ai (where i is an integer from 1 to 169) shown in FIG. It is used to represent a value.

本発明の実施例によれば、計算手段13は、空間フィルタ処理における積和演算を、1次元の配列としてメモリ10上に記憶された画素に対して実行するので、従来例のようにメモリ上離れたアドレスに何度もメモリアクセスするといったようなことはない。したがって、本発明の実施例によれば、入力された画像データに対する空間フィルタ処理を高速に実行することができる。また、本発明の実施例によれば、このマスクを用いて入力された画像データに規定された画像から空間フィルタ処理されるべき画素を抽出した上で、これら画素に対して空間フィルタ処理本体の計算を実行するので、多様な種類の空間フィルタ処理に適用することが可能である。例えば、本発明は、平均化フィルタ処理のような線形フィルタ、ならびに、中間値フィルタ、最大値フィルタ、最小値フィルタおよびラプラシアンフィルタなどのような統計フィルタ、にも適用することができる。   According to the embodiment of the present invention, the calculating means 13 performs the product-sum operation in the spatial filter processing on the pixels stored in the memory 10 as a one-dimensional array. There is no such thing as accessing a distant address over and over again. Therefore, according to the embodiment of the present invention, it is possible to execute the spatial filtering process on the input image data at high speed. Further, according to the embodiment of the present invention, after extracting pixels to be subjected to the spatial filter processing from the image defined in the input image data using the mask, the spatial filtering main body of these pixels is extracted. Since the calculation is performed, it can be applied to various types of spatial filter processing. For example, the present invention can be applied to linear filters such as averaging filter processing, and statistical filters such as intermediate value filters, maximum value filters, minimum value filters, and Laplacian filters.

図2のステップS105では、画像処理装置1は、縮小画像の全体にわたって、上記ステップS103およびS104の処理が終了したか否かを判定する。例えば、図7(a)を参照した縮小画像R上の全ての画素について注目画素に設定されたが否かが判定される。縮小画像R上の全ての画素が注目画素として設定されるまで、上記ステップS103およびS104の処理が繰り返し実行される。   In step S105 in FIG. 2, the image processing apparatus 1 determines whether or not the processing in steps S103 and S104 has been completed over the entire reduced image. For example, it is determined whether or not all the pixels on the reduced image R with reference to FIG. Until all the pixels on the reduced image R are set as the target pixel, the processes in steps S103 and S104 are repeated.

図2のステップS106において、画像処理装置1の画像拡大手段16は、縮小画像Rの全領域にわたって計算手段13が空間フィルタ処理を実行することにより得られた結果画像を、入力された画像データに規定された画像と同じ大きさになるように拡大する。例えば、入力された画像データに規定された画像Qの幅の画素数が256である場合に画像縮小率を0.6として縮小した場合、縮小画像Rの幅の画素数は153となるが、この縮小画像Rが、再び幅が256の画像に戻るように、縮小画像Rを256/153(≒1.673)倍の拡大率で拡大する。   In step S106 of FIG. 2, the image enlarging unit 16 of the image processing apparatus 1 converts the result image obtained by the calculation unit 13 executing the spatial filter process over the entire area of the reduced image R into the input image data. Enlarge to be the same size as the specified image. For example, when the number of pixels of the width of the image Q defined in the input image data is 256, and the image reduction ratio is reduced to 0.6, the number of pixels of the width of the reduced image R is 153. The reduced image R is enlarged at an enlargement ratio of 256/153 (≈1.673) times so that the reduced image R returns to an image having a width of 256 again.

そして、図2のステップS107において、画像処理装置1は、ステップS107において拡大された画像データを、処理後のデータとして出力する。   In step S107 in FIG. 2, the image processing apparatus 1 outputs the image data enlarged in step S107 as processed data.

図8は、本発明の実施例による画像処理装置を平均化フィルタとして適用した場合の実際の演算処理結果を示す図である。ここでは、入力された画像データに規定された画像Qの幅の画素数を256とし、画像縮小率0.6で縮小する場合を考える。「21×21」の大きさのマスクは、マスク縮小率0.62で縮小されて「13×13」の大きさのマスクとなり、このマスクを用いて縮小画像Rについて、平均化フィルタ処理される画素を抽出し、積和演算を実行すると、画像S’が得られる。この画像S’を、拡大率256/153(≒1.673)倍で拡大して処理後の画像Sを得る。なお、従来の方法では同じ原画像Qについて平均化フィルタ処理を実行した場合、およそ183.71ミリ秒を要したが、本発明の実施例によれば、35.79ミリ秒で処理が完了した。   FIG. 8 is a diagram showing an actual calculation processing result when the image processing apparatus according to the embodiment of the present invention is applied as an averaging filter. Here, it is assumed that the number of pixels of the width of the image Q defined in the input image data is 256, and the image is reduced at an image reduction rate of 0.6. The mask having the size of “21 × 21” is reduced by the mask reduction ratio of 0.62 to be the mask having the size of “13 × 13”, and the reduced image R is averaged using the mask. When a pixel is extracted and a product-sum operation is executed, an image S ′ is obtained. The image S ′ is enlarged at an enlargement ratio of 256/153 (≈1.673) to obtain a processed image S. In the conventional method, when the averaging filter process is executed for the same original image Q, approximately 183.71 milliseconds are required. However, according to the embodiment of the present invention, the process is completed in 35.79 milliseconds. .

図9は、本発明の実施例による画像処理装置を最大値フィルタとして適用した場合の実際の演算処理結果を示す図である。ここでは、入力された画像データに規定された画像Rの幅の画素数を256とし、画像縮小率0.6で縮小する場合を考える。「21×21」の大きさのマスクは、マスク縮小率0.62で縮小されて「13×13」の大きさのマスクとなり、このマスクを用いて縮小画像Rについて、最大値フィルタ処理される画素を抽出し、積和演算を実行すると、画像S’が得られる。この画像S’を、拡大率256/153(≒1.673)倍で拡大して処理後の画像Sを得る。   FIG. 9 is a diagram showing an actual calculation processing result when the image processing apparatus according to the embodiment of the present invention is applied as the maximum value filter. Here, it is assumed that the number of pixels of the width of the image R defined in the input image data is 256, and the image is reduced at an image reduction rate of 0.6. The mask having the size of “21 × 21” is reduced by the mask reduction ratio of 0.62 to become the mask having the size of “13 × 13”, and the maximum value filtering process is performed on the reduced image R using this mask. When a pixel is extracted and a product-sum operation is executed, an image S ′ is obtained. The image S ′ is enlarged at an enlargement ratio of 256/153 (≈1.673) to obtain a processed image S.

上述のように、本発明によれば、上記マスクにおいて規定される、空間フィルタ処理されるために抽出されるべき画素の配置は、任意に設定可能である。例えば、入力された画像データに規定された画像の内容によっては、マスク内の全画素を抽出するとする設定が適さない場合がある。図10は、マスク内の画素の設定の効果の演算処理結果を例示する図である。例えば、図10(a)に示す原画像に対してマスク内の全画素を抽出するマスク(すなわち、図4(a)に示すマスク)を用いて最大値フィルタ処理を実行した場合、図10(b)に示すように、白い図形の角がつぶれてしまい、図形本来の特徴が消失している。このような場合には、画像の図形に類似した形に、空間フィルタ処理されるために抽出されるべき画素の配置を設定すればよい。図10(a)に示す原画像に対しては、図4(b)に示すような、全体として略菱形を構成することになる複数の画素が抽出されるようなマスクを用いればよい。図11は、図4(b)に示すマスクの縮小を示す図である。また、図12は、図4(b)に示すマスクを用いて、本発明の実施例による画像処理装置を最大値フィルタとして適用した場合の実際の演算処理結果を示す図である。ここでは、入力された画像データに規定された画像Qの幅の画素数を256とし、画像縮小率0.6で縮小する場合を考える。「21×21」の大きさのマスクは、マスク縮小率0.62で縮小されて「13×13」の大きさのマスクとなり、このマスクを用いて縮小画像Rについて、最大値フィルタ処理される画素を抽出し、積和演算を実行すると、画像S’が得られる。この画像S’を、拡大率256/153(≒1.673)倍で拡大して処理後の画像Sを得る。このように、マスクの設定を、原画像Qの内容に応じて設定することにより、図形本来の特徴を消失することなく、処理後の画像Sを得ることができていることがわかる。すなわち、本発明の実施例によれば、入力される画像データで規定される画像の内容に応じて空間フィルタ処理を柔軟に実行することができるので、当該空間フィルタ処理により得られた画像の精度を高めることができる。   As described above, according to the present invention, the arrangement of pixels to be extracted for spatial filtering, which is defined in the mask, can be arbitrarily set. For example, depending on the content of the image defined in the input image data, the setting for extracting all the pixels in the mask may not be suitable. FIG. 10 is a diagram exemplifying the calculation processing result of the effect of setting the pixels in the mask. For example, when the maximum value filtering process is executed on the original image shown in FIG. 10A using a mask for extracting all pixels in the mask (that is, the mask shown in FIG. 4A), FIG. As shown in b), the corners of the white graphic are crushed and the original characteristics of the graphic are lost. In such a case, the arrangement of the pixels to be extracted for the spatial filter processing may be set in a shape similar to the graphic of the image. For the original image shown in FIG. 10A, a mask as shown in FIG. 4B, from which a plurality of pixels that form a substantially rhombus as a whole may be used. FIG. 11 is a diagram showing the reduction of the mask shown in FIG. FIG. 12 is a diagram showing an actual calculation processing result when the image processing apparatus according to the embodiment of the present invention is applied as a maximum value filter using the mask shown in FIG. 4B. Here, it is assumed that the number of pixels of the width of the image Q defined in the input image data is 256, and the image is reduced at an image reduction rate of 0.6. The mask having the size of “21 × 21” is reduced by the mask reduction ratio of 0.62 to become the mask having the size of “13 × 13”, and the maximum value filtering process is performed on the reduced image R using this mask. When a pixel is extracted and a product-sum operation is executed, an image S ′ is obtained. The image S ′ is enlarged at an enlargement ratio of 256/153 (≈1.673) to obtain a processed image S. Thus, it can be seen that by setting the mask according to the contents of the original image Q, the processed image S can be obtained without losing the original features of the figure. That is, according to the embodiment of the present invention, since the spatial filter processing can be executed flexibly according to the content of the image defined by the input image data, the accuracy of the image obtained by the spatial filter processing Can be increased.

上述した本発明の実施例による画像処理装置における各手段およびマスクは、コンピュータなどの演算処理装置が実行することができるコンピュータプログラムの形式で実現される。図13は、記録媒体に格納されたコンピュータプログラムにより動作する本発明の実施例の画像処理装置の構成を示すブロック図である。   Each means and mask in the above-described image processing apparatus according to the embodiment of the present invention are realized in the form of a computer program that can be executed by an arithmetic processing apparatus such as a computer. FIG. 13 is a block diagram showing a configuration of an image processing apparatus according to an embodiment of the present invention that operates according to a computer program stored in a recording medium.

本発明による画像処理をコンピュータに実行させるコンピュータプログラムは、図13に示すように、記憶媒体(フレキシブルディスク、CD−ROM等の外部記憶媒体)110に格納されており、例えば、次に説明するような構成によるコンピュータにインストールされて画像処理装置1として動作する。   A computer program for causing a computer to execute image processing according to the present invention is stored in a storage medium (external storage medium such as a flexible disk or a CD-ROM) 110 as shown in FIG. It is installed in a computer having a simple configuration and operates as the image processing apparatus 1.

CPU111は、画像処理装置1全体を制御する。このCPU111に、バス112を介してROM113、RAM114、HD(ハードディスク装置)115、マウスやキーボード等の入力装置116、外部記憶媒体ドライブ装置117およびLCD、CRT、プラズマディスプレイ、有機EL等の表示装置118が接続されている。CPU111の制御プログラムはROM113に格納されている。   The CPU 111 controls the entire image processing apparatus 1. The CPU 111 is connected to a ROM 113, a RAM 114, an HD (hard disk device) 115, an input device 116 such as a mouse and a keyboard, an external storage medium drive device 117, and a display device 118 such as an LCD, CRT, plasma display, and organic EL via a bus 112. Is connected. A control program for the CPU 111 is stored in the ROM 113.

本発明による画像処理を実行するコンピュータプログラム(画像処理プログラム)は、記憶媒体110からHD115にインストール(記憶)される。また、RAM114には、画像処理をCPU111が実行する際の作業領域や、画像処理を実行するプログラムの一部が記憶される領域が確保されている。また、HD115には、入力データ、最終データ、さらにOS(オペレーティングシステム)等が予め記憶される。   A computer program (image processing program) for executing image processing according to the present invention is installed (stored) in the HD 115 from the storage medium 110. The RAM 114 has a work area when the CPU 111 executes image processing and an area for storing a part of a program for executing image processing. The HD 115 stores input data, final data, OS (operating system), and the like in advance.

まず、コンピュータの電源を投入すると、CPU111がROM110から制御プログラムを読み出し、さらにHD115からOSを読み込み、OSを起動させる。これによりコンピュータは画像処理プログラムを記憶媒体110からインストール可能な状態となる。   First, when the computer is turned on, the CPU 111 reads a control program from the ROM 110, further reads an OS from the HD 115, and starts the OS. As a result, the computer is ready to install the image processing program from the storage medium 110.

次に、記憶媒体110を外部記憶媒体ドライブ装置117に装着し、入力装置116から制御コマンドをCPU111に入力し、記憶媒体110に格納された画像処理プログラムを読み取ってHD115等に記憶する。つまり画像処理プログラムがコンピュータにインストールされる。   Next, the storage medium 110 is loaded into the external storage medium drive device 117, a control command is input from the input device 116 to the CPU 111, and an image processing program stored in the storage medium 110 is read and stored in the HD 115 or the like. That is, the image processing program is installed in the computer.

その後は、画像処理プログラムを起動させると、コンピュータは画像処理装置1として動作する。オペレータは、表示装置118に表示される対話形式による作業内容と手順に従って、入力装置116を操作することで、上述した画像処理を実行することができる。処理の結果得られた「処理後の画像に関するデータ」は、例えば、HD115に記憶しておいて後日利用できるようにしたり、あるいは、処理結果を表示装置118に視覚的に表示するのに用いてもよい。   Thereafter, when the image processing program is activated, the computer operates as the image processing apparatus 1. The operator can execute the above-described image processing by operating the input device 116 in accordance with the interactive work content and procedure displayed on the display device 118. The “data regarding the processed image” obtained as a result of the processing is stored in, for example, the HD 115 so that it can be used later, or the processing result is visually displayed on the display device 118. Also good.

なお、図13のコンピュータでは、記憶媒体110に記憶されたプログラムをHD115にインストールするようにしたが、これに限らず、LAN等の情報伝送媒体を介して、コンピュータにインストールされてもよいし、コンピュータに内蔵のHD115に予めインストールされておいてもよい。   In the computer shown in FIG. 13, the program stored in the storage medium 110 is installed in the HD 115. However, the present invention is not limited to this, and the program may be installed in the computer via an information transmission medium such as a LAN. It may be installed in advance in the HD 115 built in the computer.

本発明は、画像を各種加工する際に用いられる空間フィルタに適用することができる。本発明は、平均化フィルタ処理のような線形フィルタ、ならびに、中間値フィルタ、最大値フィルタ、最小値フィルタおよびラプラシアンフィルタなどのような統計フィルタ、にも適用することができる。例えば、最大値フィルタや最小値フィルタは、配線基板の欠陥を検出する欠陥検査装置における画像処理に用いられるものであり、また、平均化フィルタは、撮像した配線基板の画像の光ムラを除去するのにも用いられる。   The present invention can be applied to a spatial filter used when various kinds of images are processed. The present invention can also be applied to linear filters such as averaging filter processing and statistical filters such as intermediate value filters, maximum value filters, minimum value filters, and Laplacian filters. For example, the maximum value filter and the minimum value filter are used for image processing in a defect inspection apparatus that detects a defect in a wiring board, and the averaging filter removes light unevenness in an image of the taken wiring board. Also used for

1 画像処理装置
10 メモリ
11 マスク
11’ 縮小マスク
12 抽出手段
13 計算手段
14 画像縮小手段
15 マスク縮小手段
16 画像拡大手段
17 縮小率設定手段
110 記録媒体
111 CPU
112 バス
113 ROM
114 RAM
115 ハードディスク装置
116 入力装置
117 外部記憶媒体ドライブ装置
118 表示装置
DESCRIPTION OF SYMBOLS 1 Image processing apparatus 10 Memory 11 Mask 11 'Reduction mask 12 Extraction means 13 Calculation means 14 Image reduction means 15 Mask reduction means 16 Image enlargement means 17 Reduction rate setting means 110 Recording medium 111 CPU
112 bus 113 ROM
114 RAM
115 Hard Disk Device 116 Input Device 117 External Storage Medium Drive Device 118 Display Device

Claims (6)

入力された画像データに対して空間フィルタ処理を実行する画像処理装置であって、
入力された画像データに規定された画像において空間フィルタ処理されるために抽出されるべき画素が規定されるマスクと、
前記マスクを用いて、入力された画像データに規定された画像から前記空間フィルタ処理されるべき画素を抽出し、これをメモリに格納する抽出手段と、
前記メモリに格納された画素に対して空間フィルタ処理の計算を実行する計算手段と、
を備えることを特徴とする画像処理装置。
An image processing apparatus that performs spatial filtering on input image data,
A mask defining pixels to be extracted for spatial filtering in the image defined in the input image data;
Extraction means for extracting the pixel to be subjected to the spatial filter processing from the image defined in the input image data using the mask, and storing the pixel in a memory;
Calculation means for performing calculation of spatial filtering on the pixels stored in the memory;
An image processing apparatus comprising:
前記画像データに規定された画像を、画像縮小率で縮小する画像縮小手段と、
前記マスクを、マスク縮小率で縮小するマスク縮小手段と、
をさらに備え、
前記抽出手段は、前記マスク縮小手段により縮小されたマスクを用いて、前記画像縮小手段によって縮小された画像から前記空間フィルタ処理されるべき画素を抽出し、これを前記メモリに格納する請求項1に記載の画像処理装置。
Image reduction means for reducing the image defined in the image data at an image reduction rate;
Mask reduction means for reducing the mask at a mask reduction rate;
Further comprising
2. The extraction means extracts a pixel to be subjected to the spatial filter processing from the image reduced by the image reduction means using the mask reduced by the mask reduction means, and stores it in the memory. An image processing apparatus according to 1.
前記縮小された画像の全領域にわたって前記計算手段が空間フィルタ処理を実行することにより得られた結果画像を、前記入力された画像データに規定された画像と同じ大きさになるように拡大する画像拡大手段をさらに備える請求項2に記載の画像処理装置。   An image for enlarging a result image obtained by the spatial filter processing performed by the calculation means over the entire area of the reduced image so as to have the same size as the image defined in the input image data The image processing apparatus according to claim 2, further comprising an enlarging unit. 前記マスクを前記画像縮小率で縮小して得られる仮縮小マスクの幅を1ピクセル幅の奇数倍になる値に近似した値を、前記マスクの幅の画素数で除算し、これにより得られた値を、前記マスク縮小率として設定する縮小率設定手段をさらに備える請求項2に記載の画像処理装置。   A value obtained by dividing the width of the temporary reduction mask obtained by reducing the mask at the image reduction ratio to a value that is an odd multiple of the width of one pixel is divided by the number of pixels of the width of the mask. The image processing apparatus according to claim 2, further comprising a reduction ratio setting unit that sets a value as the mask reduction ratio. 前記マスクにおいて規定される、空間フィルタ処理されるために抽出されるべき画素の配置は、任意に設定可能である請求項1に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein an arrangement of pixels to be extracted for spatial filtering defined in the mask can be arbitrarily set. 前記画像縮小率は、当該画像縮小率で前記画像を縮小して得られた縮小画像を再度拡大した場合に、縮小前の前記画像を再現することができる値に設定される請求項2に記載の画像処理装置。   3. The image reduction rate is set to a value that can reproduce the image before reduction when the reduced image obtained by reducing the image at the image reduction rate is enlarged again. Image processing apparatus.
JP2009284352A 2009-12-15 2009-12-15 Image processor Pending JP2011128720A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009284352A JP2011128720A (en) 2009-12-15 2009-12-15 Image processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009284352A JP2011128720A (en) 2009-12-15 2009-12-15 Image processor

Publications (1)

Publication Number Publication Date
JP2011128720A true JP2011128720A (en) 2011-06-30

Family

ID=44291284

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009284352A Pending JP2011128720A (en) 2009-12-15 2009-12-15 Image processor

Country Status (1)

Country Link
JP (1) JP2011128720A (en)

Similar Documents

Publication Publication Date Title
JP4030519B2 (en) Image processing apparatus and image processing system
US7613363B2 (en) Image superresolution through edge extraction and contrast enhancement
US8625932B2 (en) Seam carving using seam energy re-computation in seam neighborhood
CN112868045A (en) Frame handling for ML-based magnification
US9495757B2 (en) Image processing apparatus and image processing method
JPWO2008139551A1 (en) Information presenting apparatus and information presenting method
JP4686624B2 (en) Information processing apparatus, image processing method, and program
JP2016197377A (en) Computer program for image correction, image correction device, and image correction method
JP2015043543A (en) Image magnification device and image magnification method
JP2011128720A (en) Image processor
JP2005346639A (en) Image processing apparatus and image processing method
JP2010134654A (en) Image rendering processing apparatus
JP2009081791A (en) Image processing apparatus, and image processing program
KR102470242B1 (en) Image processing device, image processing method and program
US6882444B1 (en) Image drawing apparatus, image drawing method, and computer-readable recording medium recorded with program for making computer execute image drawing method
JP4325812B2 (en) Vector image drawing circuit and vector image drawing method
JP2008021219A (en) Image processing apparatus and method
JP2020087104A (en) Computer program, image processing method and image processing apparatus
JP2005322959A (en) Image processor, mobile terminal, image processing program, and image processing method
US9269031B2 (en) Method of detecting regions in an edge-based representation
US9615046B2 (en) Image conversion apparatus and method reducing number of pixel counts processing
EP2988269B1 (en) A system and method for scaling and copying graphics
JP2012205190A (en) Image processing apparatus and program
JP4200864B2 (en) Image processing device
JP2018133772A (en) Image processing device and image processing method