JPH0620044A - Method and device for image processing - Google Patents

Method and device for image processing

Info

Publication number
JPH0620044A
JPH0620044A JP4172267A JP17226792A JPH0620044A JP H0620044 A JPH0620044 A JP H0620044A JP 4172267 A JP4172267 A JP 4172267A JP 17226792 A JP17226792 A JP 17226792A JP H0620044 A JPH0620044 A JP H0620044A
Authority
JP
Japan
Prior art keywords
pixel
image
image processing
value
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.)
Withdrawn
Application number
JP4172267A
Other languages
Japanese (ja)
Inventor
Hiroyuki Kimura
裕行 木村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP4172267A priority Critical patent/JPH0620044A/en
Publication of JPH0620044A publication Critical patent/JPH0620044A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To ensure the execution of the effective image processing over an entire due area by using the value of the effective picture elements in a pre scribed area when the value of each picture element is decided based on the value of those picture elements in the prescribed area including the relevant picture element. CONSTITUTION:The value of the noticed picture element included in a set mask area is decided by the two-dimensional space filtering processing. In this case, a picture element is selected in a rectangular area around the noticed picture element. If the selected picture element is included in the mask area, the value of this picture element is used for the two-dimensional space filtering processing operation. If not, the value of the picture element is not used for the operation. When such processing is carried out to all picture elements included in the rectangular area, even such noticed picture element whose rectangular area overflows the mask area can also effectively processed.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、画像中の各画素の値を
当該画素を含む所定領域の画素の値に基づいて決定する
画像処理を行うための画像処理方法及び装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image processing method and apparatus for performing image processing for determining the value of each pixel in an image based on the value of the pixel in a predetermined area including the pixel.

【0002】[0002]

【従来の技術】従来の画像処理装置におけるデータ処理
の方法として、注目画素の画素値をその周囲の画素値に
基づいて算出する処理方法がある。このような処理方法
では、例えば注目画素により特定される矩形領域に存在
する画素の画素値を用いて所定の演算を行うことにより
注目画素の値を決定しており、実際の例としては2次元
空間フィルタリング処理やスムージング処理等が挙げら
れる。
2. Description of the Related Art As a data processing method in a conventional image processing apparatus, there is a processing method of calculating the pixel value of a target pixel based on the pixel values of its surroundings. In such a processing method, the value of the pixel of interest is determined by performing a predetermined calculation by using the pixel value of the pixel existing in the rectangular area specified by the pixel of interest, for example. Examples include spatial filtering processing and smoothing processing.

【0003】2次元空間フィルタリング処理では、画像
中の注目画素を中心とした所定の大きさの矩形領域を設
定し、この矩形領域内の各画素値と画素毎に指定された
係数との積和演算を行う。そして、これを指定されたス
ケールファクタで割った値を、その注目画素の値とす
る。
In the two-dimensional spatial filtering process, a rectangular area having a predetermined size centered on the pixel of interest in the image is set, and the sum of products of each pixel value in this rectangular area and a coefficient designated for each pixel. Calculate. Then, a value obtained by dividing this by the designated scale factor is set as the value of the pixel of interest.

【0004】2次元空間フィルタリング処理の原理を、
図3を用いて説明する。1はデジタル化された画像であ
り、画像1は数多くの画素2に分割されている。この例
では、画素2は横方向にN個、縦方向にM個、並んでい
る(N,Mは共に1より大きい整数)。画素の順番は、
横方向は左端が0、右端がN−1、縦方向は上端が0、
下端がM−1となるように数え、画素位置まで特定した
画素値を表示する場合は、横方向にx番目、縦方向にy
番目の画素値を、axyと表示することにする。個々の画
素2は、256段階程度の階調を持ち、数字が小さいほ
ど暗い色、数字が大きいほど明るい色を表す。
The principle of the two-dimensional spatial filtering process is
This will be described with reference to FIG. Reference numeral 1 is a digitized image, and image 1 is divided into many pixels 2. In this example, the number of pixels 2 is N in the horizontal direction and M in the vertical direction (N and M are both integers greater than 1). The pixel order is
The left end is 0 in the horizontal direction, N-1 is in the right end, and the upper end is 0 in the vertical direction.
When displaying the pixel value specified up to the pixel position by counting so that the lower end becomes M-1, the horizontal direction is xth and the vertical direction is y.
The pixel value of the th will be displayed as a xy . Each pixel 2 has about 256 gradations, and a smaller number represents a darker color and a larger number represents a brighter color.

【0005】今、図4に示した様に、注目画素22を中
心とし、横方向n画素、縦方向m画素の矩形領域21
で、2次元空間フィルタリング処理を行うことにする
(n,mは共に1より大きい奇数とする。但し、n,m
が両方とも1であってはならない)。ここで、n’,
m’を n’=(n−1)/2 m’=(m−1)/2 と定義する。n’,m’は、それぞれ注目画素から左右
端までの画素数,上下端までの画素数に相当する。そし
て、n画素×m画素の矩形領域の画素毎に指定された係
数をb(-n')(-m'),b(-n'+1)(-m'),…,b
(n')(-m') ,b(-n')(-m'+1),b(-n'+1)(-m'+1),…,
(n')(-m'+1) ,…,b(-n')(m') ,b(-n'+1)(m')
…,b(n')(m')とし、スケールファクタをsとする。
Now, as shown in FIG. 4, a rectangular area 21 having n pixels in the horizontal direction and m pixels in the vertical direction with the pixel of interest 22 at the center.
Then, the two-dimensional spatial filtering process is performed (n and m are both odd numbers larger than 1. However, n and m
Must not both be 1). Where n ',
Define m ′ as n ′ = (n−1) / 2 m ′ = (m−1) / 2. n ′ and m ′ correspond to the number of pixels from the target pixel to the left and right ends and the number of pixels to the upper and lower ends, respectively. Then, the coefficients designated for each pixel in the rectangular area of n pixels × m pixels are b (-n ') (-m') , b (-n '+ 1) (-m') , ..., B
(n ') (-m') , b (-n ') (-m' + 1) , b (-n '+ 1) (-m' + 1) , ...,
b (n ') (-m' + 1) , ..., b (-n ') (m') , b (-n '+ 1) (m') ,
, B (n ') (m') , and the scale factor is s.

【0006】この場合、注目画素(座標値が横方向x,
縦方向y)が、画像の中央領域にあるならば、以下の演
算を行えば、2次元空間フィルタリング処理の値aが得
られる。即ち、 a=(a(x-n')(y-m')×b(-n')(-m')+a(x-n'+1)(y-m')×b(-n'+1)(-m')+ …+a(x+n')(y-m')×b(n')(-m') +a(x-n')(y-m'+1)×b(-n')(-m'+1) +a(x-n'+1)(y-m'+1)×b(-n'+1)(-m'+1) +…+a(x+n')(y-m'+1)×b(n')(-m'+1) +… +a(x-n')(y+m')×b(-n')(m') +a(x-n'+1)(y+m')×b(-n'+1)(m')+ …+a(x+n')(y+m')×b(n')(m'))/s となる。
In this case, the pixel of interest (the coordinate value is x,
If the vertical direction y) is in the central region of the image, the value a of the two-dimensional spatial filtering process can be obtained by performing the following calculation. That is, a = (a (x-n ') (y-m') * b (-n ') (-m') + a (x-n '+ 1) (y-m') * b (-n '+1) (-m') +… + a (x + n ') (y-m') × b (n ') (-m') + a (x-n ') (y-m' + 1) × b (-n ') (-m' + 1) + a (x-n '+ 1) (y-m' + 1) × b (-n '+ 1) (-m' + 1) + ... + a (x + n ') (y-m' + 1) xb (n ') (-m' + 1) + ... + a (x-n ') (y + m') xb (-n ') ( m ') + a (x-n' + 1) (y + m ') xb (-n' + 1) (m ') + ... + a (x + n') (y + m ') xb (n ') (m') ) / s.

【0007】また、スムージング処理では、画像中の注
目画素を中心とした所定の大きさの矩形領域を設定し、
この矩形領域内の各画素値の平均値を算出し、これをそ
の注目画素の値とする。
In the smoothing process, a rectangular area of a predetermined size centered on the pixel of interest in the image is set,
The average value of the pixel values in this rectangular area is calculated, and this is set as the value of the pixel of interest.

【0008】スムージング処理の原理を、上述の2次元
空間フィルタリング処理と同様に図3及び図4を用いて
説明する。今、図4に示した様に、注目画素22を中心
とし、横方向n画素、縦方向m画素の矩形領域21にお
いてスムージング処理を行うものとする(n,mは共に
1より大きい奇数とする。但し、n,mが両方とも1で
あってはならない)。ここで、n’,m’を n’=(n−1)/2 m’=(m−1)/2 と定義する。n’,m’は、それぞれ注目画素から左右
端までの画素数,上下端までの画素数に相当する。
The principle of the smoothing process will be described with reference to FIGS. 3 and 4 similarly to the above-mentioned two-dimensional spatial filtering process. Now, as shown in FIG. 4, smoothing processing is performed in a rectangular region 21 having n pixels in the horizontal direction and m pixels in the vertical direction with the pixel of interest 22 at the center (n and m are both odd numbers larger than 1). However, both n and m must not be 1). Here, n ′ and m ′ are defined as n ′ = (n−1) / 2 m ′ = (m−1) / 2. n ′ and m ′ correspond to the number of pixels from the target pixel to the left and right ends and the number of pixels to the upper and lower ends, respectively.

【0009】このとき、注目画素の座標値が横方向x、
縦方向yならば、以下の演算を行ってスムージング処理
の値aが得られる。
At this time, if the coordinate value of the pixel of interest is x,
In the case of the vertical direction y, the value a for smoothing processing is obtained by performing the following calculation.

【0010】 a=(a(x-n')(y-m')+a(x-n'+1)(y-m')+…+a(x+n')(y-m') +a(x-n')(y-m'+1)+a(x-n'+1)(y-m'+1)+…+a(x+n')(y-m'+1) +… +a(x-n')(y+m')+a(x-n'+1)(y+m')+…+a(x+n')(y+m')) /(n×m) となる。A = (a (x-n ') (y-m') + a (x-n '+ 1) (y-m') + ... + a (x + n ') (y-m') + a (x-n ') (y-m' + 1) + a (x-n '+ 1) (y-m' + 1) + ... + a (x + n ') (y-m' + 1) + ... + A (x-n ') (y + m') + a (x-n '+ 1) (y + m') + ... + a (x + n ') (y + m') ) / (n × m) Becomes

【0011】[0011]

【発明が解決しようとする課題】上記の従来例における
画像処理装置において、例えば、風景写真の主被写体以
外の部分についてのみ上記データ処理を行いたい場合
や、室内写真の窓の外の景色だけに上記データ処理を行
いたい場合等、オリジナル画像の所定領域のみに対して
上記のデータ処理を行う場合は以下の様に行っている。
In the image processing apparatus of the above-mentioned conventional example, for example, when it is desired to perform the data processing only on a portion other than the main subject of a landscape photograph, or only on the scenery outside the window of the indoor photograph. When the above data processing is performed only on a predetermined area of the original image, for example, when the above data processing is desired, the following is performed.

【0012】まず、データ処理を実行したい領域を示す
マスク画像を作成する。次に、オリジナル画像全体に上
記データ処理を実行する。最後に、上記データ処理を行
った画像のマスク領域の部分のみを、オリジナル画像の
上に合成する。
First, a mask image showing an area where data processing is desired to be performed is created. Next, the above data processing is performed on the entire original image. Finally, only the mask area of the image subjected to the above data processing is combined on the original image.

【0013】この方法を用いて、nやmの値を大きくし
て大きな矩形領域で例えば2次元空間フィルタリング処
理或いはスムージング処理等の画像処理を行った場合、
マスク領域の境界部分では、画像処理を行わない領域の
画素の値が用いられてしまう。このため、画像処理の演
算結果として不自然な色が現れるという問題がある。特
にスムージング処理においては、nやmの値を大きくす
ることで「ぼかし」の効果が上がるので、こnやmの値
は大きな値に設定される場合が多い。そして、例えば、
緑色の林の前に白い家がある画像で、背景の林の部分に
2次元空間フィルタリング処理或いはスムージング処理
等を行うと、家と林との境界付近では林の緑と家の白が
混ざりあった色が現れてしまう。
When this method is used to increase the value of n or m and perform image processing such as two-dimensional spatial filtering processing or smoothing processing in a large rectangular area,
At the boundary portion of the mask area, the pixel value of the area where the image processing is not performed is used. Therefore, there is a problem that an unnatural color appears as a result of the image processing calculation. Particularly in smoothing processing, since the effect of "blurring" is enhanced by increasing the value of n or m, the value of n or m is often set to a large value. And, for example,
In an image with a white house in front of a green forest, if the two-dimensional spatial filtering process or smoothing process is performed on the background forest part, the green of the forest and the white of the house are mixed near the boundary between the house and the forest. Colors appear.

【0014】即ち、従来の画像処理装置において、周辺
画素の値により注目画素の値を算出する画像処理を実行
する場合、周辺画素が所定領域外の画素を含んでしまう
と、この影響が現れてしまい、不自然な画像となってし
まう。
That is, in the conventional image processing apparatus, when the image processing for calculating the value of the target pixel by the value of the peripheral pixel is executed, if the peripheral pixel includes the pixel outside the predetermined area, this effect appears. It will result in an unnatural image.

【0015】更に、上記従来の画像処理装置におけるデ
ータ処理では、注目画素が画像の周辺領域にある場合
は、n画素×m画素の矩形領域の一部が、画像1の外側
に出てしまい、演算処理を行うことができないという問
題がある。例えば、図10は注目画素4を中心とする矩
形領域41がオリジナル画像1の外側にはみ出している
様子を表している。このように矩形領域がオリジナル画
像の外側へ出てしまうような注目画素に対処するための
従来の方法としては、 (1)矩形領域が画像1の外側に出てしまう注目画素に
対しては2次元フィルタリング処理を行わず、オリジナ
ル画像の画素値をそのまま使用する. (2)2次元フィルタリング処理を実行した部分のみを
画像1より切り出して使用する. (3)2次元空間フィルタリング処理の際に、画像の左
端が仮想的に画像の右端とつながり、また、画像の上端
が仮想的に画像の下端につながっているとして演算を行
う. がある。
Further, in the data processing in the conventional image processing apparatus described above, when the pixel of interest is in the peripheral area of the image, a part of the rectangular area of n pixels × m pixels appears outside the image 1, There is a problem that arithmetic processing cannot be performed. For example, FIG. 10 shows a state in which a rectangular area 41 centered on the pixel of interest 4 extends outside the original image 1. As a conventional method for dealing with the pixel of interest in which the rectangular area goes out of the original image, (1) 2 is set for the pixel of interest in which the rectangular area goes out of the image 1. The pixel values of the original image are used as they are without performing dimension filtering. (2) Only the part that has been subjected to the two-dimensional filtering process is cut out from image 1 and used. (3) In the two-dimensional spatial filtering process, the left end of the image is virtually connected to the right end of the image, and the upper end of the image is virtually connected to the lower end of the image. There is.

【0016】しかしながら、上記(1)による手法で
は、矩形領域のサイズ(n,m)を大きくし、大きな矩
形領域で処理を行った場合に、処理結果として得られる
画像において、処理を行っている部分と行っていない部
分との差が目立ってしまうという問題がある。また、上
記(2)の手法では、矩形領域サイズを大きくすればす
るほど使用できる画像領域が小さくなってしまうという
問題がある。更に、(3)の手法では、画像の端部に存
在する色が画面の反対側の演算に使用されるため、演算
結果が不自然となるという問題がある。例えば、上面に
空の青色、下部に山の緑色がある画像に2次元空間フィ
ルタリング処理或いはスムージング処理を実行すると、
上端に、空の青色と山の緑色が混ざりあった色が現れて
しまう。
However, in the above method (1), when the size (n, m) of the rectangular area is increased and the processing is performed on the large rectangular area, the processing is performed on the image obtained as the processing result. There is a problem that the difference between the part and the part that is not done becomes noticeable. Further, the method (2) has a problem that the larger the rectangular area size, the smaller the usable image area. Further, the method (3) has a problem in that the color existing at the edge of the image is used for the calculation on the opposite side of the screen, so that the calculation result is unnatural. For example, if two-dimensional spatial filtering processing or smoothing processing is performed on an image with sky blue on the top and green on the bottom,
At the top edge, a mixture of sky blue and mountain green appears.

【0017】本発明は上記の問題点に鑑みてなされたも
のであり、各画素の値を当該画素を含む所定領域内の画
素の値に基づいて決定する際に、前記所定領域内におけ
る有効な画素の値を用いて画像処理を実行することを可
能とし、画像処理を実行すべき全領域に渡り効果的な画
像処理を可能とする画像処理方法及び装置を提供するこ
とを目的とする。
The present invention has been made in view of the above problems, and is effective in determining the value of each pixel on the basis of the value of the pixel in the predetermined area including the pixel. It is an object of the present invention to provide an image processing method and apparatus that enables image processing to be performed using pixel values and that enables effective image processing over the entire area in which image processing is to be performed.

【0018】[0018]

【課題を解決するための手段】上記の目的を達成するた
めの本発明による画像処理装置は以下の構成を備える。
即ち、画像中の各画素の値を当該画素を含む所定領域の
画素の値に基づいて決定する画像処理を行う画像処理装
置であって、前記画像において前記画像処理を実行する
領域を実行領域として設定する設定手段と、前記所定領
域内に存在する画素のうち前記実行領域内に存在する画
素を抽出する抽出手段と、前記実行領域内の各画素に対
して、前記抽出手段により抽出された画素を用いて前記
画像処理を実行する実行手段と、を備える。
An image processing apparatus according to the present invention for achieving the above object has the following configuration.
That is, an image processing apparatus that performs image processing that determines the value of each pixel in an image based on the value of a pixel in a predetermined area that includes the pixel, and the area in which the image processing is performed in the image is the execution area Setting means for setting, extraction means for extracting pixels existing in the execution area among pixels existing in the predetermined area, and pixels extracted by the extraction means for each pixel in the execution area And executing means for executing the image processing by using.

【0019】また、上記の目的を達成するための本発明
による画像処理方法は以下の構成を備える。即ち、画像
中の各画素の値を当該画素を含む所定領域の画素の値に
基づいて決定する画像処理を行う画像処理方法であっ
て、前記画像において前記画像処理を実行する領域を実
行領域として設定する設定工程と、前記所定領域内に存
在する画素のうち前記実行領域内に存在する画素を抽出
する抽出工程と、前記実行領域内の各画素に対して、前
記抽出工程により抽出された画素を用いて前記画像処理
を実行する実行工程と、を備える。
An image processing method according to the present invention for achieving the above object has the following configuration. That is, an image processing method for performing image processing for determining the value of each pixel in an image based on the value of a pixel in a predetermined area including the pixel, wherein the area in which the image processing is executed in the image is set as an execution area. A setting step of setting, an extraction step of extracting pixels existing in the execution area among pixels existing in the predetermined area, and a pixel extracted by the extraction step for each pixel in the execution area And an execution step of executing the image processing by using.

【0020】[0020]

【作用】以上の構成により、各画素の値を所定領域の画
素の値に基づいて決定するという画像処理を実行する際
に、前記所定領域内でかつ設定された実行領域内に存在
する画素のみを用いて前記画像処理を実行することが可
能となり、実行領域内全域に渡り有効な画像処理が実施
される。
With the above configuration, when performing the image processing in which the value of each pixel is determined based on the value of the pixel in the predetermined area, only the pixels existing in the predetermined area and in the set execution area are executed. It is possible to execute the image processing by using, and the effective image processing is performed over the entire execution area.

【0021】[0021]

【実施例】以下、添付の図面を参照して本発明の好適な
実施例を説明する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT A preferred embodiment of the present invention will be described below with reference to the accompanying drawings.

【0022】<実施例1>図1は、本実施例1による画
像処理装置の概略構成を表すブロック図である。同図に
おいて、11は画像入力部である。この画像入力部11
で入力されたオリジナル画像は、デジタル画像データと
して後述する処理部12に送られる。12は処理部であ
り、画像に対する2次元空間フィルタリング処理を行
う。また、処理部12は、前述の画像入力部11や、後
述する記憶部13,表示部14,コマンド入力部15,
画像出力部16,座標入力部17との間で画像データの
転送や、制御データのやりとりを行い、画像処理装置全
体の制御を行っている。
<First Embodiment> FIG. 1 is a block diagram showing the schematic arrangement of an image processing apparatus according to the first embodiment. In the figure, 11 is an image input unit. This image input unit 11
The original image input in (4) is sent to the processing unit 12 described later as digital image data. A processing unit 12 performs a two-dimensional spatial filtering process on the image. Further, the processing unit 12 includes the image input unit 11 described above, a storage unit 13, a display unit 14, a command input unit 15,
Image data is transferred and control data is exchanged between the image output unit 16 and the coordinate input unit 17 to control the entire image processing apparatus.

【0023】13は記憶部であり、画像データや処理プ
ログラムを格納する。処理部12の制御により、画像入
力部11で読み込まれた画像データが、この記憶部13
に格納される。また、処理部12において必要とされる
処理プログラムや画像データ、制御データ等がこの記憶
部13から読み出される。14は表示部であり、画像や
文字を表示する。また、表示部14は、処理部12の指
示に従い、画像の表示を行ったり、後述のコマンド入力
部15からの処理の指示内容を表示したり、現在処理中
の内容を表示したりする。更に、後述の座標入力部17
により指示された座標位置はカーソル位置として常に表
示部14に表示されている。
A storage unit 13 stores image data and processing programs. Under the control of the processing unit 12, the image data read by the image input unit 11 is stored in the storage unit 13.
Stored in. Further, the processing program, image data, control data, etc. required in the processing unit 12 are read from the storage unit 13. A display unit 14 displays images and characters. Further, the display unit 14 displays an image according to an instruction from the processing unit 12, displays a processing instruction content from a command input unit 15 described later, or displays a content currently being processed. Further, a coordinate input unit 17 described later
The coordinate position designated by is always displayed on the display unit 14 as the cursor position.

【0024】15はコマンド入力部であり、キーボード
などを備える。このコマンド入力部15は、コマンド入
力やパラメータ指定に使用される。16は画像出力部で
あり、インクジェットプリンタや、カラーレーザプリン
タ等を備える。この画像出力部16は、処理部12によ
って処理された画像を静止画のプリントとして出力する
為に使用される。また、画像出力部16はフィルムレコ
ーダのようなフィルム出力装置であってもよい。17は
座標入力部であり、マウスやディジタイザの様な入力装
置を備える。この座標入力部17による指示位置は、表
示部14内にカーソル位置として表示されている。そし
て、この座標入力部17は、画像のマスク領域を指定す
る際に使用される。
A command input unit 15 includes a keyboard and the like. The command input section 15 is used for command input and parameter specification. An image output unit 16 includes an inkjet printer, a color laser printer, and the like. The image output unit 16 is used to output the image processed by the processing unit 12 as a still image print. The image output unit 16 may be a film output device such as a film recorder. Reference numeral 17 is a coordinate input unit, which is provided with an input device such as a mouse or a digitizer. The position designated by the coordinate input unit 17 is displayed as a cursor position in the display unit 14. The coordinate input unit 17 is used when designating the mask area of the image.

【0025】次に、上述の構成を備える本画像処理装置
の処理動作について、図2のフローチャートを用いて具
体的に説明する。
Next, the processing operation of the image processing apparatus having the above configuration will be specifically described with reference to the flowchart of FIG.

【0026】まず、ステップS1において画像入力を行
う。ステップS1の処理では、画像入力部11を用いて
オリジナル画像を読み取り、これをディジタル画像デー
タとして入力し、処理部12を経由して記憶部13に格
納する。オリジナル画像として写真や印刷物を使用する
場合は、画像入力部11は公知のフィルムスキャナやフ
ラットベッドスキャナの様に、CCDの様なイメージセ
ンサを使って画像をスキャンしながらアナログ/ディジ
タル変換していく機能を持った装置であれば良い。ここ
でディジタルに変換された画像データは、処理部12を
経由して記憶部13に収納される。
First, in step S1, an image is input. In the process of step S1, the original image is read using the image input unit 11, this is input as digital image data, and stored in the storage unit 13 via the processing unit 12. When a photograph or printed matter is used as the original image, the image input unit 11 performs analog / digital conversion while scanning the image using an image sensor such as a CCD like a known film scanner or flatbed scanner. Any device with a function may be used. The image data converted to digital here is stored in the storage unit 13 via the processing unit 12.

【0027】また、オリジナル画像が立体物の場合は、
前もってこれをカメラで撮影しておき、上述のフィルム
スキャナを使って入力することが出来る。また、ビデオ
カメラを使用する場合は、画像入力部11として公知の
ビデオメモリ装置を使用すればよい。このビデオメモリ
装置は、ビデオ信号の1フィールド、または1フレーム
をアナログ/デジタル変換する装置であり、ビデオの任
意の1画面をデジタル化することが出来る。ここで、デ
ィジタルに変換された画像データは、処理部12を経由
して記憶部13に格納される。
If the original image is a three-dimensional object,
You can take a picture of this with a camera in advance and input it using the film scanner described above. When using a video camera, a known video memory device may be used as the image input unit 11. This video memory device is a device for analog / digital conversion of one field or one frame of a video signal and can digitize any one screen of video. Here, the image data converted to digital is stored in the storage unit 13 via the processing unit 12.

【0028】オリジナル画像が、例えば、コンピュータ
グラフィックスのプログラムで作成された画像の様に既
にデジタル化された画像の場合は、画像入力部11とし
て、公知のMT装置の様なデジタルデータを直接読み込
む装置を用いれば良い。ここで、読み込まれたディジタ
ル画像データは、処理部12を経由して記憶部13に格
納される。
When the original image is an already digitized image such as an image created by a computer graphics program, the image input unit 11 directly reads digital data such as that of a known MT device. A device may be used. Here, the read digital image data is stored in the storage unit 13 via the processing unit 12.

【0029】以上のようにして、ディジタル化されたオ
リジナル画像は記憶部13に格納される。尚、ここでオ
リジナル画像は、図3に示すような横方向N画素,縦方
向M画素の画像1であるとして以下の説明を行う。ま
た、各画素は、0から255までの256階調を有し、
0が黒色、255が白色を表すモノクロ画像であるとす
る。
As described above, the digitized original image is stored in the storage unit 13. The following description will be made assuming that the original image is the image 1 having N pixels in the horizontal direction and M pixels in the vertical direction as shown in FIG. Further, each pixel has 256 gradations from 0 to 255,
It is assumed that 0 is black and 255 is a monochrome image that represents white.

【0030】次に、ステップS2において、コマンド入
力部15によりパラメータの入力を行う。ここではパラ
メータとして、2次元空間フィルタリング処理の矩形領
域サイズ、画素毎の係数、スケールファクタを設定す
る。コマンド入力部15を用いてパラメータを入力する
と、この値が表示部14に表示される。従って、操作者
は表示部14の表示により入力値の認識を行うことがで
きる。ここで入力されたパラメータをそれぞれ以下の通
りとして以下の説明を行う。矩形領域サイズの設定値と
して、横方向のサイズがn、縦方向のサイズがm(nと
mは同時に1ではない、正の奇数)とする。また、各画
素毎の係数を、b(-n')(-m'),b(-n'+1)( -m'),…,b
(n')(-m') ,b(-n')(-m'+1),b(-n'+1)(-m'+1),…,
(n')(-m' +1) ,…,b(-n')(m') ,b(-n'+1)(m')
…,b(n')(m')とし、スケールファクタをsとする(但
し、n’=(n−1)/2,m’=(m−1)/2)。
以上の操作により、図4に示されるような注目画素22
を中心としたn画素×m画素の矩形領域21が指定され
る。尚、図4では矩形領域の1つの具体例として、n=
7,m=5を設定した場合を示している。
Next, in step S2, the command input unit 15 inputs parameters. Here, the rectangular area size of the two-dimensional spatial filtering process, the coefficient for each pixel, and the scale factor are set as parameters. When a parameter is input using the command input unit 15, this value is displayed on the display unit 14. Therefore, the operator can recognize the input value by the display on the display unit 14. The following description will be given assuming that the parameters input here are as follows. As the setting values of the rectangular area size, the size in the horizontal direction is n, and the size in the vertical direction is m (n and m are not 1 at the same time, a positive odd number). Also, the coefficients for each pixel are b (-n ' ) ( -m') , b (-n '+ 1) ( -m') , ..., b
(n ') (-m') , b (-n ') (-m' + 1) , b (-n '+ 1) (-m' + 1) , ...,
b (n ') (-m' +1) , ..., b (-n ') (m') , b (-n '+ 1) (m') ,
, B (n ') (m') , and the scale factor is s (where n '= (n-1) / 2, m' = (m-1) / 2).
By the above operation, the pixel of interest 22 as shown in FIG.
A rectangular area 21 of n pixels × m pixels centered at is designated. In FIG. 4, as one specific example of the rectangular area, n =
7 shows a case where m = 5 is set.

【0031】次に、ステップS3において、マスク画像
作成を行う。ここで、表示部14には、ステップS1で
入力されたオリジナル画像1が、記憶部13から読み出
されて表示されている。操作者は、座標入力部17(マ
ウスやディジタイザのような座標入力装置)を用いて、
表示部14に表示されたオリジナル画像のマスク領域を
なぞるようにカーソルを動かす。このようにしてマスク
領域全体を指示すると、出来上がったマスク画像が記憶
部13に格納される。なお、座標入力部17を用いて画
像の領域(マスク領域)を指定する方法は公知であり、
ここではその詳細な説明は省略する。
Next, in step S3, a mask image is created. Here, the original image 1 input in step S1 is read from the storage unit 13 and displayed on the display unit 14. The operator uses the coordinate input unit 17 (coordinate input device such as a mouse or a digitizer) to
The cursor is moved so as to trace the mask area of the original image displayed on the display unit 14. When the entire mask area is designated in this way, the completed mask image is stored in the storage unit 13. A method of designating an image area (mask area) using the coordinate input unit 17 is known,
The detailed description is omitted here.

【0032】ステップS4では注目画素の指定を行う。
図3のオリジナル画像1の各画素2を順番に注目画素と
して指定する。そして、この注目画素に対する2次元空
間フィルタリングの演算を、以下のステップS5,ステ
ップS6で行う。以下では、注目画素が横方向にx番
目,縦方向にy番目の画素axyであるとして説明を行
う。ステップS5はステップS4で指定した注目画素が
マスク領域であるかどうかを判定し、マスク領域内であ
ればステップS6に進み2次元空間フィルタリング処理
を実行する。また、マスク領域外であれば、2次元フィ
ルタリング演算を行う必要がないので、ステップS7に
進む。
In step S4, the target pixel is designated.
Each pixel 2 of the original image 1 of FIG. 3 is sequentially designated as a pixel of interest. Then, the calculation of the two-dimensional spatial filtering for this pixel of interest is performed in the following steps S5 and S6. In the following description, the pixel of interest is the x-th pixel a xy in the horizontal direction and the y-th pixel in the vertical direction. In step S5, it is determined whether or not the pixel of interest designated in step S4 is a mask area, and if it is within the mask area, the process proceeds to step S6 to execute a two-dimensional spatial filtering process. Further, if it is outside the mask area, it is not necessary to perform the two-dimensional filtering calculation, so that the process proceeds to step S7.

【0033】ステップS6は2次元空間フィルタリング
処理を行う部分である。この部分の処理の詳細を、図5
のフローチャートを参照して説明する。
Step S6 is a part for performing a two-dimensional spatial filtering process. Details of the processing of this part are shown in FIG.
This will be described with reference to the flowchart in FIG.

【0034】ステップS21はデータの初期化であり、
画素値と係数の積の合計を入れる変数sumと、画素毎
の係数の和を入れる変数countを0にする。即ち、
ステップS21では、 sum=0 count=0 という計算式を実行する。
Step S21 is data initialization.
A variable sum for storing the sum of products of pixel values and coefficients and a variable count for storing the sum of coefficients for each pixel are set to 0. That is,
In step S21, the calculation formula sum = 0 count = 0 is executed.

【0035】ステップS22は画素の選定であり、指定
された注目画素を中心とし、ステップS2で設定された
大きさの矩形領域内の画素を順番に指定して、以下のス
テップS23からステップS25までの処理を行う。こ
こで、選定された画素と、図3のステップS4で指定し
た注目画素axyとの相対距離を、横方向にx’,縦方向
にy’とする。従って、選定した画素はa(x+x')(y+y')
である。ステップS23はステップS22で選定された
画素がマスク領域内にあるかどうかを判定する。ステッ
プS22で選定した画素がマスク領域内であればステッ
プS24に進み所定の演算を実行(後述)する。また、
マスク領域外であればステップS24を実行せずにステ
ップS25に進む。
Step S22 is the selection of pixels, in which pixels within a rectangular area having the size set in step S2 are designated in order with the specified pixel of interest as the center, and the following steps S23 to S25 are performed. Process. Here, the relative distance between the selected pixel and the target pixel a xy designated in step S4 of FIG. 3 is x ′ in the horizontal direction and y ′ in the vertical direction. Therefore, the selected pixel is a (x + x ') (y + y')
Is. A step S23 decides whether or not the pixel selected in the step S22 is within the mask area. If the pixel selected in step S22 is within the mask area, the process proceeds to step S24 to execute a predetermined calculation (described later). Also,
If it is outside the mask area, the process proceeds to step S25 without executing step S24.

【0036】ステップS24はステップS22で選定し
た画素がマスク領域内であった場合の演算であり、変数
sumに選定した画素の値a(x+x')(y+y')と当該画素に
対応する係数b(x')(y')との積を加え、変数count
にb(x')(y')を加えていく。即ち、 sum=sum+a(x+x')(y+y')×b(x')(y') count=count+b(x')(y') となる。
Step S24 is an operation when the pixel selected in step S22 is within the mask area, and the value a (x + x ') (y + y') of the pixel selected for the variable sum and The product of the corresponding coefficient b (x ') (y') is added, and the variable count
Add b (x ') (y') to. That is, sum = sum + a (x + x ') (y + y') * b (x ') (y') count = count + b (x ') (y') .

【0037】ステップS25では矩形領域内の全画素に
対して上述の各処理を終了したかどうかの判定を行う。
この判定の結果、まだ処理を行っていない画素がある場
合はステップS22に戻って、次に画素に対する処理を
行う。また、矩形領域内の全画素に対する処理が終了し
た場合はステップS26に進む。ステップS26におけ
る処理は、2次元空間フィルタリングの演算である。ス
テップS21からステップS25の処理で求めた変数s
umと変数countの値を用いて、2次元空間フィル
タリング演算値aを求める。ここで用いられる計算式
は、 a=sum/s’ 但し、s’=s×count/ (b(-n')(-m')+b(-n'+1)(-m')+…+b(n')(-m') +b(-n')(-m'+1)+b(-n'+1)(-m'+1)+…+b(n')(-m'+1) +… +b(-n')(m') +b(-n'+1)(m') +…+b(n')(m')) である。
In step S25, it is determined whether or not the above-mentioned processes have been completed for all the pixels in the rectangular area.
If the result of this determination is that there is a pixel that has not yet been processed, the process returns to step S22 and the next pixel is processed. If the processing for all the pixels in the rectangular area is completed, the process proceeds to step S26. The process in step S26 is a two-dimensional spatial filtering operation. The variable s obtained in the processing of steps S21 to S25
The two-dimensional spatial filtering calculation value a is obtained using um and the value of the variable count. The calculation formula used here is a = sum / s ', where s' = s * count / (b (-n ') (-m') + b (-n '+ 1) (-m') + ... + B (n ') (-m') + b (-n ') (-m' + 1) + b (-n '+ 1) (-m' + 1) + ... + b (n ') (-m' + 1) + ... + b (-n ') (m') + b (-n '+ 1) (m') + ... + b (n ') (m') ).

【0038】以上で、ステップS4で設定した注目画素
xyに対する2次元空間フィルタ演算を終了し、ここで
得られた演算値aをaxyの画像処理後の画素値とする。
As described above, the two-dimensional spatial filter calculation for the target pixel a xy set in step S4 is completed, and the calculated value a obtained here is set as the pixel value after the image processing of a xy .

【0039】以上のようにしてステップS6の2次元空
間フィルタリング処理を完了すると、ステップS7へ進
む。ステップS7では、全画素の処理が完了したかを判
定する。まだ処理を行っていない画素がある場合は、ス
テップS4に戻って、次の注目画素を指定して、上述の
2次元空間フィルタリング演算を繰り返す。また、全て
の画素の処理が完了した場合は、ステップS8に進ん
で、出力処理を行う。ステップS8では、作成した2次
元空間フィルタリング処理画像を図1の画像出力装置1
6を用いて出力する。以上で全ての処理が完了する。
When the two-dimensional spatial filtering process of step S6 is completed as described above, the process proceeds to step S7. In step S7, it is determined whether the processing of all pixels is completed. If there is a pixel that has not been processed, the process returns to step S4, the next target pixel is designated, and the above-described two-dimensional spatial filtering operation is repeated. If the processing for all the pixels is completed, the process proceeds to step S8 to perform the output processing. In step S8, the created two-dimensional spatial filtering processing image is processed by the image output device 1 of FIG.
6 is used for output. With the above, all processing is completed.

【0040】以上説明したように、実施例1の画像処理
装置によれば、マスク領域内に入っている画素だけを用
いて2次元空間フィルタ演算が実行される。また、スケ
ールファクタsの値は、演算に使用された画素の係数の
和と全画素の係数の和との比により設定される。以上の
ような処理を行うことにより、2次元空間フィルタリン
グ処理において、マスク領域外の色が混在してしまうこ
とはなく、全注目画素に対して有効な画像処理結果を得
ることができる。
As described above, according to the image processing apparatus of the first embodiment, the two-dimensional spatial filter calculation is executed using only the pixels included in the mask area. The value of the scale factor s is set by the ratio of the sum of the coefficients of the pixels used for the calculation and the sum of the coefficients of all the pixels. By performing the above-described processing, it is possible to obtain an effective image processing result for all the target pixels without the colors outside the mask area being mixed in the two-dimensional spatial filtering processing.

【0041】<実施例2>実施例2による画像処理装置
は実施例1と同様の構成(図1)を備える。そして、図
2のフローチャートに従って2次元空間フィルタリング
処理を実行するが、ステップS6における2次元空間フ
ィルタリング演算の処理手順において別の手法が用いら
れる。以下に、実施例2における2次元空間フィルタリ
ング演算の処理手順について、図6のフローチャートを
用いて説明する。
<Second Embodiment> An image processing apparatus according to the second embodiment has the same configuration as that of the first embodiment (FIG. 1). Then, the two-dimensional spatial filtering processing is executed according to the flowchart of FIG. 2, but another method is used in the processing procedure of the two-dimensional spatial filtering calculation in step S6. The processing procedure of the two-dimensional spatial filtering calculation in the second embodiment will be described below with reference to the flowchart of FIG.

【0042】ステップS31はデータの初期化であり、
画素値と係数の積の合成を入れる変数sumを0にす
る。即ち、 sum=0 という演算式を実行する。
Step S31 is data initialization.
A variable sum that puts the combination of the product of the pixel value and the coefficient is set to 0. That is, the arithmetic expression sum = 0 is executed.

【0043】ステップS32は画素の選定であり、ステ
ップS4で指定された注目画素を中心とする矩形領域内
の画素を順番に指定して、以下のステップS33からス
テップS36までの処理を行う。ここで選定された画素
と図2のステップS2で指定された注目画素axyとの相
対距離を、横方向x’,縦方向y’とする。従って、選
定した画素の値はa(x+x')(y+y')となる。ステップS3
3では、ステップS32で選定された画素がマスク領域
内であるかどうかを判定する。そして、ステップS32
で選定した画素がマスク領域内であればステップS34
に進み、マスク領域外であればステップS35に進む。
In step S32, the pixels are selected. The pixels in the rectangular area centered on the pixel of interest designated in step S4 are designated in order, and the processes from step S33 to step S36 described below are performed. The relative distance between the pixel selected here and the target pixel a xy designated in step S2 of FIG. 2 is defined as the horizontal direction x ′ and the vertical direction y ′. Therefore, the value of the selected pixel is a (x + x ') (y + y') . Step S3
In 3, it is determined whether the pixel selected in step S32 is within the mask area. Then, step S32
If the pixel selected in step S34 is within the mask area, step S34
If it is outside the mask region, the process proceeds to step S35.

【0044】ステップS34はステップS32で選定し
た画素がマスク領域内であった場合の演算であり、変数
sumに選定した画素の値a(x+x')(y+y')とb(x')(y')
との積を加える。即ち、 sum=sum+a(x+x')(y+y')×b(x')(y') という演算を実行する。
Step S34 is an operation when the pixel selected in step S32 is within the mask area, and the pixel values a (x + x ') (y + y') and b (x are selected for the variable sum. ') (y')
Add the product of and. That is, the calculation of sum = sum + a (x + x ') (y + y') * b (x ') (y') is executed.

【0045】一方、ステップS35,ステップS36は
ステップS32で選定した画素がマスク領域外であった
場合に行う処理である。まず、ステップS35で最短距
離のマスク画素を選定する。最短距離のマスク画素と
は、ステップS32で選定した画素と最も近い距離にあ
るマスク領域内の画素のことである。具体的には、ステ
ップS32で選定した画素と、マスク領域内の全ての画
素との距離を求め、その中で最も距離の近い画素を最短
距離のマスク画素とする。そして、この最短距離のマス
ク画素の画素値(これをa’とする)を求めステップS
36へ進む。
On the other hand, steps S35 and S36 are processes to be performed when the pixel selected in step S32 is outside the mask area. First, in step S35, the shortest distance mask pixel is selected. The shortest-distance mask pixel is a pixel in the mask area that is closest to the pixel selected in step S32. Specifically, the distance between the pixel selected in step S32 and all the pixels in the mask area is calculated, and the pixel having the shortest distance among them is set as the shortest distance mask pixel. Then, the pixel value of the mask pixel at the shortest distance (this is referred to as a ′) is obtained in step S
Proceed to 36.

【0046】ステップS36ではステップS35で求め
た値a’を用いてsumの演算を実行する。即ち、変数
sumに、ステップS35で求めた値a’とb(x')(y')
との積を加える。従って、演算式は、 sum=sum+a’×b(x')(y') となる。
In step S36, the sum calculation is executed using the value a'determined in step S35. That is, for the variable sum, the values a'and b (x ') (y') obtained in step S35
Add the product of and. Therefore, the arithmetic expression is sum = sum + a '* b (x') (y ') .

【0047】ステップS37では矩形領域内の全画素に
対して選定と処理が終了したかを判定する。まだ選定を
行っていない画素がある場合は、ステップS32に戻っ
て、次の画素を選定して演算を行う。また、矩形領域内
の全画素の選定と処理が終了した場合はステップS38
に進む。ステップS38では2次元空間フィルタリング
結果の演算を行う。ここでは、ステップS31からステ
ップS37で求めた変数sumを用いて、2次元空間フ
ィルタリング演算値aを求める。このときの計算式は、 a=sum/s となる。
In step S37, it is determined whether selection and processing have been completed for all pixels in the rectangular area. If there is a pixel that has not been selected yet, the process returns to step S32 and the next pixel is selected and calculation is performed. If all pixels in the rectangular area have been selected and processed, step S38 is performed.
Proceed to. In step S38, the two-dimensional spatial filtering result is calculated. Here, the two-dimensional spatial filtering calculation value a is calculated using the variable sum calculated in steps S31 to S37. The calculation formula at this time is a = sum / s.

【0048】以上のようにして、図2のフローチャート
のステップS4で設定した注目画素axyに対する演算を
終了する。この様に、マスク領域外の画素に対しては、
最も至近距離のマスク領域内の画素の画素値を代用して
いるので、マスク領域外の色が混在してしまうことはな
く、有効な2次元空間フィルタリング結果を得ることが
できる。
As described above, the calculation for the target pixel a xy set in step S4 of the flowchart of FIG. 2 is completed. In this way, for pixels outside the mask area,
Since the pixel value of the pixel in the mask area at the closest distance is used instead, the colors outside the mask area are not mixed and an effective two-dimensional spatial filtering result can be obtained.

【0049】以上説明した様に、実施例1及び2の画像
処理装置によれば、マスク画像で指定された領域だけに
対して2次元空間フィルタリング処理を行う場合でも、
マスク領域外の色が紛れ込むことがなく、全注目画素に
わたり効果的な2次元空間フィルタリング処理結果を得
ることができるようになる。
As described above, according to the image processing apparatuses of the first and second embodiments, even when the two-dimensional spatial filtering process is performed only on the area designated by the mask image,
It is possible to obtain an effective two-dimensional spatial filtering processing result over all the target pixels without the color outside the mask area being mixed in.

【0050】<実施例3>実施例3では、スムージング
処理を行う画像処理装置について説明する。実施例3に
よる画像処理装置の概略構成は実施例1の図1と同様で
ありここではその説明を省略するが、処理部12では入
力されたオリジナル画像に対してスムージング処理が実
行される点が実施例1とは異なる。
<Third Embodiment> In a third embodiment, an image processing apparatus for performing smoothing processing will be described. The schematic configuration of the image processing apparatus according to the third embodiment is the same as that of FIG. 1 of the first embodiment, and the description thereof is omitted here. However, in the processing unit 12, smoothing processing is performed on the input original image. Different from the first embodiment.

【0051】次に、本実施例3の画像処理装置によるス
ムージング処理の手順について、図7のフローチャート
を用いて具体的に説明する。
Next, the procedure of the smoothing processing by the image processing apparatus of the third embodiment will be concretely described with reference to the flowchart of FIG.

【0052】まず、ステップS41において画像の入力
を行う。ステップS41の処理は実施例1のステップS
1と同様でありその詳細な説明は省略する。尚、ここで
オリジナル画像は、図3に示すような横方向N画素,縦
方向M画素の画像1として以下の説明を行う。また、各
画素は、0から255までの256階調を有し、0が黒
色、255が白色を表すモノクロ画像であるとする。
First, in step S41, an image is input. The process of step S41 is the step S of the first embodiment.
Since it is the same as No. 1, detailed description thereof will be omitted. The original image will be described below as an image 1 having N horizontal pixels and M vertical pixels as shown in FIG. In addition, each pixel is assumed to be a monochrome image having 256 gradations from 0 to 255, 0 being black and 255 being white.

【0053】次に、ステップS42において、コマンド
入力部15によりパラメータの入力を行う。ここでパラ
メータとして、スムージング処理の矩形領域サイズを設
定する。コマンド入力部15を用いてパラメータを入力
すると、この値が表示部14に表示される。従って、操
作者は表示部14の表示により入力値の認識を行うこと
ができる。ここで入力されたパラメータ、即ち矩形領域
サイズの設定値を、横方向のサイズがn、縦方向のサイ
ズがm(nとmは同時に1ではない、正の奇数)として
以下の説明を行う。以上の操作により、図4に示される
ようなn×mの矩形領域21が指定される。また、図4
において、n’、m’は、 n’=(n−1)/2 , m’=(m−1)/2 である。
Next, in step S42, the command input unit 15 inputs parameters. Here, the rectangular area size for smoothing processing is set as a parameter. When a parameter is input using the command input unit 15, this value is displayed on the display unit 14. Therefore, the operator can recognize the input value by the display on the display unit 14. The following description will be made assuming that the parameter input here, that is, the setting value of the rectangular area size, has a horizontal size of n and a vertical size of m (n and m are not 1 at the same time, a positive odd number). By the above operation, the n × m rectangular area 21 as shown in FIG. 4 is designated. Also, FIG.
In, n ′ and m ′ are n ′ = (n−1) / 2 and m ′ = (m−1) / 2.

【0054】次に、ステップS43においてマスク画像
作成を行い(実施例1のステップS3と同様の処理)、
続くステップS44で注目画素を指定する(実施例1の
ステップS4と同様の処理)。そして、この注目画素に
対するスムージングの演算を、以下のステップS45,
ステップS46で行う。以下では、注目画素が横方向に
x番目,縦方向にy番目の画素axyであるとして説明を
行う。ステップS45はステップS44で指定した注目
画素がマスク領域であるかどうかを判定し、マスク領域
内であればステップS46に進みスムージング演算を実
行する。また、マスク領域外であれば、スムージング演
算を行う必要がないので、ステップS47に進む。
Next, in step S43, a mask image is created (processing similar to step S3 of the first embodiment),
In the subsequent step S44, the pixel of interest is designated (the same process as step S4 in the first embodiment). Then, the smoothing calculation for the target pixel is performed in the following steps S45,
This is performed in step S46. In the description below, it is assumed that the pixel of interest is the x-th pixel ax y in the horizontal direction and the y-th pixel in the vertical direction. A step S45 decides whether or not the pixel of interest designated in the step S44 is a mask region, and if it is within the mask region, the process advances to a step S46 to execute a smoothing calculation. Further, if it is outside the mask area, it is not necessary to perform the smoothing calculation, so that the process proceeds to step S47.

【0055】ステップS46はスムージング処理を行う
部分である。この部分の処理の詳細を、図8のフローチ
ャートを参照して説明する。
Step S46 is a part for performing smoothing processing. Details of the processing of this part will be described with reference to the flowchart of FIG.

【0056】図8において、ステップS51はデータの
初期化であり、画素値の合計を入れる変数sumと、マ
スク領域内の画素数を数える変数countを0にす
る。即ち、ステップS51では、 sum=0 count=0 という計算式を実行する。
In FIG. 8, step S51 is data initialization, in which a variable sum for storing the total pixel value and a variable count for counting the number of pixels in the mask area are set to 0. That is, in step S51, the calculation formula sum = 0 count = 0 is executed.

【0057】ステップS52は画素の選定であり、指定
された注目画素を中心とし、ステップS42で設定され
た大きさの矩形領域内の画素を順番に指定して、以下の
ステップS53からステップS55までの処理を行う。
ここで、選定された画素と、ステップS44で指定した
注目画素axyとの相対距離を、横方向x’,縦方向y’
とする。従って、選定した画素の値はa(x+x')(y+y')
なる。ステップS53はステップS52で選定された画
素がマスク領域内にあるかどうかを判定する。ステップ
S52で選定された画素がマスク領域内であればステッ
プS54に進み所定の演算を実行(後述)する。また、
マスク領域外であればステップS54を実行せずにステ
ップS55に進む。
Step S52 is the selection of pixels, in which the pixels in the rectangular area having the size set in step S42 are sequentially specified with the specified pixel of interest as the center, and the following steps S53 to S55 are executed. Process.
Here, the relative distance between the selected pixel and the pixel of interest a xy specified in step S44 is calculated as the horizontal direction x ′ and the vertical direction y ′.
And Therefore, the value of the selected pixel is a (x + x ') (y + y') . A step S53 decides whether or not the pixel selected in the step S52 is within the mask area. If the pixel selected in step S52 is within the mask area, the flow advances to step S54 to execute a predetermined calculation (described later). Also,
If it is outside the mask area, the process proceeds to step S55 without executing step S54.

【0058】ステップS54はステップS52で選定し
た画素がマスク領域内であった場合の演算であり、変数
sumに選定した画素の値a(x+x')(y+y')を加え、変数
countを1つ加算する。即ち、 sum=sum+a(x+x')(y+y') count=count+1 という演算式を実行する。
Step S54 is an operation when the pixel selected in step S52 is in the mask area, and the value a (x + x ') (y + y') of the selected pixel is added to the variable sum to obtain a variable. Add one count. That is, the arithmetic expression sum = sum + a (x + x ') (y + y') count = count + 1 is executed.

【0059】ステップS55では矩形領域内の全画素に
対して上述の各処理を終了したかどうかの判定を行う。
この判定の結果、まだ処理を行っていない画素がある場
合はステップS52に戻って、次に画素に対する処理を
行う。また、矩形領域内の全画素に対する処理が終了し
た場合はステップS56に進む。ステップS56におけ
る処理は、スムージング結果の演算である。ステップS
51からステップS55の処理で求めた変数sumと変
数countの値を用いて、スムージング演算値aを求
める。用いられる計算式は、 s=sum/count となる。
In step S55, it is determined whether or not the above-mentioned processes have been completed for all the pixels in the rectangular area.
If the result of this determination is that there is a pixel that has not yet been processed, the process returns to step S52 and the next pixel is processed. If the processing for all the pixels in the rectangular area is completed, the process proceeds to step S56. The process in step S56 is the calculation of the smoothing result. Step S
The smoothing calculation value a is obtained using the values of the variable sum and the variable count obtained in steps 51 to S55. The calculation formula used is s = sum / count.

【0060】以上で、ステップS44で設定した注目画
素に対する2次元空間フィルタ演算を終了する。
Thus, the two-dimensional spatial filter calculation for the pixel of interest set in step S44 is completed.

【0061】再び図7のフローチャートに戻り、ステッ
プS47以降の処理を実行する。ステップS47で、全
画素の処理が完了したかを判定し、未処理の画素がある
場合は、ステップS44に戻り、次の注目画素を指定し
て、スムージング演算を繰り返す。また、全ての画素の
処理が完了した場合は、ステップS48に進む。ステッ
プS48では、画像出力装置16を用いて、作成したス
ムージング処理画像を出力して、全ての処理が完了す
る。
Returning again to the flowchart of FIG. 7, the processing of step S47 and thereafter is executed. In step S47, it is determined whether or not all the pixels have been processed. If there is any unprocessed pixel, the process returns to step S44, the next target pixel is designated, and the smoothing calculation is repeated. If the processing for all pixels is completed, the process proceeds to step S48. In step S48, the image output device 16 is used to output the created smoothing-processed image, and all the processes are completed.

【0062】以上説明したように、本実施例3の画像処
理装置によれば、マスク領域内に入っている画素だけを
用いてその平均値を求める演算を行っているので、マス
ク領域外の色が混在してしまうことはなく、全注目画素
に対して有効なスムージング結果を得ることができる。
As described above, according to the image processing apparatus of the third embodiment, since the calculation for obtaining the average value is performed using only the pixels included in the mask area, the color outside the mask area is calculated. Is not mixed, and an effective smoothing result can be obtained for all the target pixels.

【0063】<実施例4>実施例4による画像処理装置
は実施例3と同様の構成(図1)を備える。そして、ス
ムージング処理も図7のフローチャートに従って実行さ
れるが、ステップS46において実行されるスムージン
グ演算の処理手順において別の手法を用いる。以下に、
実施例4における、スムージング演算の処理手順につい
て図9のフローチャートを用いて説明する。
<Embodiment 4> An image processing apparatus according to Embodiment 4 has the same configuration as that of Embodiment 3 (FIG. 1). Then, the smoothing process is also executed according to the flowchart of FIG. 7, but another method is used in the processing procedure of the smoothing calculation executed in step S46. less than,
The processing procedure of the smoothing calculation in the fourth embodiment will be described with reference to the flowchart of FIG.

【0064】図9において、ステップS61はデータの
初期化であり、画素値の和を入れるための変数sumを
0にする。即ち、 sum=0 という演算式を実行する。
In FIG. 9, step S61 is data initialization, and a variable sum for putting the sum of pixel values is set to zero. That is, the arithmetic expression sum = 0 is executed.

【0065】ステップS62は画素の選定であり、図7
のステップS44で指定された注目画素を中心とする矩
形領域内の画素を順番に指定して、以下のステップS6
3からステップS66までの処理を行う。ここで選定さ
れた画素と図7のステップS44で指定した注目画素a
xyとの相対距離を、横方向x’,縦方向y’とする。従
って、選定した画素の値はa(x+x')(y+y')となる。ステ
ップS63は、ステップS62で選定された画素がマス
ク領域内であるかどうかを判定する。ステップS62で
選定した画素がマスク領域内であればステップS64に
進み、マスク領域外であればステップS65に進む。
Step S62 is the selection of pixels, as shown in FIG.
The pixels in the rectangular area centered on the pixel of interest designated in step S44 are designated in order, and the following step S6 is performed.
The processing from 3 to step S66 is performed. The pixel selected here and the target pixel a designated in step S44 of FIG.
The relative distance to xy is x'in the horizontal direction and y'in the vertical direction. Therefore, the value of the selected pixel is a (x + x ') (y + y') . A step S63 decides whether or not the pixel selected in the step S62 is within the mask area. If the pixel selected in step S62 is within the mask region, the process proceeds to step S64, and if it is outside the mask region, the process proceeds to step S65.

【0066】ステップS64はステップS62で選定し
た画素がマスク領域内であった場合の演算であり、変数
sumに選定した画素の値a(x+x')(y+y')を加える。即
ち、 sum=sum+a(x+x')(y+y') という演算を実行する。
Step S64 is an operation when the pixel selected in step S62 is within the mask area, and the value a (x + x ') (y + y') of the selected pixel is added to the variable sum. That is, the calculation of sum = sum + a (x + x ') (y + y') is executed.

【0067】一方、ステップS65,ステップS66は
ステップS62で選定した画素がマスク領域外であった
場合に行う処理である。まず、ステップS65で最短距
離のマスク画素を選定する。最短距離のマスク画素と
は、ステップS62で選定した画素と最も近い距離にあ
るマスク領域内の画素のことである。具体的には、ステ
ップS62で選定した画素と、マスク領域内の全ての画
素との距離を求め、その中で最も距離の近い画素を最短
距離のマスク画素とする。そして、この最短距離のマス
ク画素の画素値(これをa’とする)を求めステップS
66へ進む。
On the other hand, steps S65 and S66 are processes to be performed when the pixel selected in step S62 is outside the mask area. First, in step S65, the shortest distance mask pixel is selected. The shortest distance mask pixel is the pixel in the mask area that is closest to the pixel selected in step S62. Specifically, the distance between the pixel selected in step S62 and all the pixels in the mask area is obtained, and the pixel having the shortest distance among them is set as the shortest distance mask pixel. Then, the pixel value of the mask pixel at the shortest distance (this is referred to as a ′) is obtained in step S
Proceed to 66.

【0068】ステップS66ではステップS65で求め
た値a’を用いてsumの演算を実行する。即ち、変数
sumに、ステップS65で求めた値a’を加える。従
って、演算式は、 sum=sum+a’ となる。
In step S66, the sum calculation is executed using the value a'determined in step S65. That is, the value a ′ obtained in step S65 is added to the variable sum. Therefore, the arithmetic expression is: sum = sum + a '.

【0069】ステップS67では矩形領域内の全画素に
対して選定と処理が終了したかを判定する。まだ選定を
行っていない画素がある場合は、ステップS62に戻っ
て、次の画素に対する演算を行う。また、矩形領域内の
全画素の選定と処理が終了した場合はステップS68に
進む。ステップS68はスムージング結果の演算であ
り、ステップS61からステップS67で求めた変数s
umを用いて、スムージング演算値aを求める。このと
きの計算式は、 a=sum/(n×m) となる。
In step S67, it is determined whether selection and processing have been completed for all pixels in the rectangular area. If there is a pixel that has not been selected yet, the process returns to step S62 and the calculation for the next pixel is performed. When the selection and processing of all pixels in the rectangular area are completed, the process proceeds to step S68. Step S68 is an operation of the smoothing result, and the variable s obtained in steps S61 to S67
The smoothing calculation value a is obtained using um. The calculation formula at this time is a = sum / (n × m).

【0070】以上のようにして、図7のフローチャート
のステップS44で設定した注目画素に対する演算を終
了する。この様に、マスク領域外の画素に対しては、最
も至近距離のマスク領域内の画素の画素値を代用してい
るので、マスク領域外の色が混在してしまうことはな
く、有効なスムージング結果を得ることができる。
As described above, the calculation for the target pixel set in step S44 of the flowchart of FIG. 7 is completed. As described above, since the pixel value of the pixel in the mask area at the closest distance is substituted for the pixel outside the mask area, the colors outside the mask area are not mixed and the effective smoothing is performed. The result can be obtained.

【0071】以上説明した様に、実施例3及び4の画像
処理装置によれば、マスク画像で指定された領域だけに
対してスムージング処理を行う場合でも、マスク領域外
の色が紛れ込むことがなく、効果的なスムージング処理
結果を得ることができるようになる。
As described above, according to the image processing apparatuses of the third and fourth embodiments, even when the smoothing process is performed only on the area designated by the mask image, the color outside the mask area is not mixed. It becomes possible to obtain an effective smoothing processing result.

【0072】<実施例5>本実施例5では、注目画素が
オリジナル画像の周辺部にあり、矩形領域の一部が画像
の外側へ出てしまうような場合に、この注目画素に対す
る効果的なデータ処理を可能とする画像処理装置につい
て説明する。
<Embodiment 5> In the present embodiment 5, when the pixel of interest is in the peripheral portion of the original image and a part of the rectangular area goes out of the image, it is effective for this pixel of interest. An image processing device that enables data processing will be described.

【0073】本実施例5の画像処理装置では、矩形領域
の1部が画像の外にはみ出してしまうような注目画素に
対しては、矩形領域のうちの画像に含まれる部分の画素
値を用いて演算を行う。以下に実施例5の画像処理装置
について説明する。
In the image processing apparatus according to the fifth embodiment, the pixel value of the portion of the rectangular area included in the image is used for the pixel of interest in which a part of the rectangular area extends out of the image. And calculate. The image processing apparatus according to the fifth embodiment will be described below.

【0074】図11は実施例5の画像処理装置の概略構
成を表すブロック図である。本画像処理装置の構成は実
施例1(図1)と同様であり、その説明は省略するが、
本実施例5においては座標入力部17は不要(マスク画
像を作成しないため)である。
FIG. 11 is a block diagram showing the schematic arrangement of the image processing apparatus of the fifth embodiment. The configuration of the image processing apparatus is the same as that of the first embodiment (FIG. 1), and the description thereof will be omitted.
In the fifth embodiment, the coordinate input unit 17 is unnecessary (since a mask image is not created).

【0075】次に、図12のフローチャートにより実施
例5の画像処理手順を説明する。
Next, the image processing procedure of the fifth embodiment will be described with reference to the flowchart of FIG.

【0076】ステップS71にて、画像の入力を行う。
詳細は実施例1のステップS1と同様でありここでは、
説明を省略する。尚、ここで入力されたオリジナル画像
は図10に示されるようにN画素×M画素で構成される
ものとする。即ち、横方向には0〜(N−1)番目、縦
方向に0〜(M−1)番目までの画素が存在する。
In step S71, an image is input.
The details are the same as step S1 of the first embodiment, and here,
The description is omitted. The original image input here is composed of N pixels × M pixels as shown in FIG. That is, there are 0 to (N-1) th pixels in the horizontal direction and 0 to (M-1) th pixels in the vertical direction.

【0077】次に、ステップS72において、コマンド
入力部15によりパラメータの入力を行う。本ステップ
も実施例1のステップS1と同様であり、詳細な説明は
省略する。尚、ここで入力されたパラメータをそれぞれ
以下の通りとして以下の説明を行う。矩形領域サイズの
設定値として、横方向のサイズがn、縦方向のサイズが
m(nとmは同時に1ではない、正の奇数)とする。ま
た、各画素毎の係数を、b(-n')(-m')
(-n'+1)(-m'),…,b(n')(-m') ,b(-n')(-m'+1)
(-n'+1)(-m'+1),…,b(n')(-m'+1) ,…,b
(-n')(m') ,b(-n'+1)(m') ,…,b(n')(m')とし、ス
ケールファクタをsとする(但し、n’=(n−1)/
2,m’=(m−1)/2)。以上の操作により、各画
素に対して図4に示されるようなn画素×m画素の矩形
領域21が指定される。
Next, in step S72, the command input unit 15 inputs parameters. This step is also the same as step S1 of the first embodiment, and detailed description thereof will be omitted. The following description will be given assuming that the parameters input here are as follows. As the setting values of the rectangular area size, the size in the horizontal direction is n, and the size in the vertical direction is m (n and m are not 1 at the same time, a positive odd number). In addition, the coefficient for each pixel is b (-n ') (-m') ,
b (-n '+ 1) (-m') , ..., b (n ') (-m') , b (-n ') (-m' + 1) ,
b (-n '+ 1) (-m' + 1) , ..., b (n ') (-m' + 1) , ..., b
Let (-n ') (m') , b (-n '+ 1) (m') , ..., b (n ') (m') be the scale factor (note that n '= (n -1) /
2, m '= (m-1) / 2). By the above operation, the rectangular area 21 of n pixels × m pixels as shown in FIG. 4 is designated for each pixel.

【0078】ステップS73は注目画素の指定であり、
図10のオリジナル画像1の各画素2を順番に注目画素
として指定する。そして、この注目画素に対する2次元
空間フィルタリングの演算を、以下のステップS74か
らステップS86で行う。以下では、注目画素が横方向
にx番目,縦方向にy番目の画素axyであるとして説明
を行う。
In step S73, the pixel of interest is designated.
Each pixel 2 of the original image 1 of FIG. 10 is sequentially designated as a pixel of interest. Then, the calculation of the two-dimensional spatial filtering for this target pixel is performed in the following steps S74 to S86. In the following description, the pixel of interest is the x-th pixel a xy in the horizontal direction and the y-th pixel in the vertical direction.

【0079】ステップS74では、注目画素を中心とし
て形成された矩形領域の左端がオリジナル画像1の内部
にあるかどうかを判定する。本判定により、内部にある
場合はステップS76へ、外部にはみ出している場合は
ステップS75へそれぞれ進む。ステップS74におけ
る判断は以下の条件式、 x−n’ < 0 であれば、ステップS75へ進む x−n’ ≧ 0 であれば、ステップS76へ進む により実行される。そして、ステップS75,76では
注目画素から演算に使用する左端画素までの距離を変数
xsに設定する。
In step S74, it is determined whether or not the left end of the rectangular area formed around the pixel of interest is inside the original image 1. According to this determination, the process proceeds to step S76 if inside, and to step S75 if outside. The determination in step S74 is performed by the following conditional expression: if x−n ′ <0, proceed to step S75. If x−n ′ ≧ 0, proceed to step S76. Then, in steps S75 and S76, the distance from the target pixel to the leftmost pixel used for the calculation is set in the variable xs.

【0080】ステップS75は、矩形領域の左端が画像
1よりはみ出した場合の処理であり、変数xsに注目画
素と画像1の左端画素(横方向に0番目の画素a0y)と
の距離を代入する。従って、この処理は、 xs=x (注目画素は横方向にx番目の画素であ
る) という演算式を実行することになる。一方ステップS7
6は、矩形領域の左端が画像1の内部にある場合の処理
であり、注目画素と矩形領域の左端画素との距離をxs
に代入する。従って、この処理は、 xs=n’ という演算式を実行することになる。
Step S75 is a process when the left end of the rectangular area is out of the image 1, and the distance between the pixel of interest and the left end pixel of the image 1 (the 0th pixel a 0y in the horizontal direction) is assigned to the variable xs. To do. Therefore, this process executes the arithmetic expression xs = x (the target pixel is the x-th pixel in the horizontal direction). On the other hand, step S7
6 is a process when the left end of the rectangular area is inside the image 1, and the distance between the pixel of interest and the left end pixel of the rectangular area is xs.
To. Therefore, this process executes the arithmetic expression xs = n '.

【0081】ステップS77では矩形領域の右端が画像
1の内部にあるかどうかを判定する。内部にある場合は
ステップS79へ、外部にはみ出している場合はステッ
プS78へそれぞれ進む。ステップS77における判断
の条件式は、 x+n’>N−1 であれば、ステップS78へ進む x+n’≦N−1 であれば、ステップS79へ進む となる。そして、ステップS78及び79では、注目画
素から演算に使用する右端画素までの距離を示す変数x
eを設定する。
In step S77, it is determined whether the right end of the rectangular area is inside the image 1. If it is inside, it proceeds to step S79, and if it is outside, it proceeds to step S78. If the conditional expression for the determination in step S77 is: x + n '> N-1, go to step S78 If x + n'≤N-1, go to step S79. Then, in steps S78 and 79, a variable x indicating the distance from the pixel of interest to the rightmost pixel used for the calculation
Set e.

【0082】ステップS78は、矩形領域の右端が画像
1よりはみ出した場合の処理であり、注目画素と画像1
の右端画素(横方向にN−1番目の画素a(N-1)y)との
距離をxeに代入する。従ってこの処理は、 xe=N−1−x で表される。一方、ステップS79では、矩形距離の右
端が画像1の内部にある場合の処理であり、注目画素と
矩形領域の右端画素との距離をxeに代入する。従っ
て、 xe=n’ という演算式を実行する。
Step S78 is a process when the right end of the rectangular area extends beyond the image 1, and the pixel of interest and the image 1 are detected.
The distance from the rightmost pixel (the (N-1) th pixel a (N-1) y in the horizontal direction) is substituted for xe. Therefore, this process is represented by xe = N-1-x. On the other hand, in step S79, the processing is performed when the right end of the rectangular distance is inside the image 1, and the distance between the pixel of interest and the right end pixel of the rectangular area is substituted for xe. Therefore, the arithmetic expression xe = n 'is executed.

【0083】次に、ステップS80では、矩形領域の上
端が画像1の内部にあるかどうかを判定する。本判定に
より、内部にある場合はステップS82へ、外部にはみ
出している場合はステップS81へそれぞれ進む。具体
的には、 y−m’<0 であれば、ステップS81に進む、 y−m’≧0 であれば、ステップS82へ進む、 という条件式により判断を行う。そして、ステップS8
1及び82では、注目画素から演算に使用する上端画素
までの距離を変数ysに設定する。
Next, in step S80, it is determined whether the upper end of the rectangular area is inside the image 1. According to this determination, the process proceeds to step S82 if it is inside, and to step S81 if it is outside. Specifically, if y−m ′ <0, the process proceeds to step S81, and if y−m ′ ≧ 0, the process proceeds to step S82. Then, step S8
In 1 and 82, the distance from the pixel of interest to the upper end pixel used for calculation is set in the variable ys.

【0084】ステップS81は、矩形領域の上端が画像
1よりはみ出している場合の処理であり、変数ysに、
注目画素と画像1の上端画素(縦方向に0番目の画素a
x0)との距離を代入する。従って、この処理における演
算式は、 ys=y となる。一方、ステップS82は、矩形領域の上端が画
像1の内部にある場合の処理であり、変数ysに、注目
画素と矩形領域の上端画素との距離を代入する。従っ
て、この処理における演算式は、 ys=m’ となる。
Step S81 is a process when the upper end of the rectangular area extends beyond the image 1, and the variable ys is set to
The pixel of interest and the top pixel of image 1 (the 0th pixel a in the vertical direction
Substitute the distance from x0 ). Therefore, the arithmetic expression in this processing is ys = y. On the other hand, step S82 is processing when the upper end of the rectangular area is inside the image 1, and the distance between the pixel of interest and the upper end pixel of the rectangular area is substituted into the variable ys. Therefore, the arithmetic expression in this processing is ys = m '.

【0085】次に、ステップS83は、矩形領域の下端
が画像1の内部にあるかどうかを判定する。内部にある
場合はステップS85へ、外部にはみ出している場合は
ステップS84へそれぞれ進む。具体的には、 y+m’>M−1 であれば、ステップS84へ進
む、 y+m’≦M−1 であれば、ステップS85へ進
む、 という条件式により処理を行う。そして、ステップS8
4及び85において、注目画素から演算に使用する下端
画素までの距離を変数yeに設定する。
Next, a step S83 decides whether or not the lower end of the rectangular area is inside the image 1. If it is inside, it proceeds to step S85, and if it is outside, it proceeds to step S84. Specifically, if y + m ′> M−1, the process proceeds to step S84, and if y + m ′ ≦ M−1, the process proceeds to step S85. Then, step S8
In 4 and 85, the distance from the target pixel to the lower end pixel used for the calculation is set in the variable ye.

【0086】ステップS84は、矩形領域の下端が画像
1からはみ出した場合の処理であり、変数yeに、注目
画素と画像1の下端画素(縦方向にM−1番目の画素
(px( M-1)))との距離を代入する。従って、この処理
における演算式は、 ye=M−1−y となる。一方、ステップS85は、矩形領域の下端が画
像1の内部にある場合の処理であり、変数yeに、注目
画素と矩形領域の下端画素との距離を代入する。従っ
て、以下の演算式 ye=m’ が実行される。
Step S84 is a process when the lower end of the rectangular area extends from the image 1, and the variable ye is set to the target pixel and the lower end pixel of the image 1 (the (M-1) th pixel in the vertical direction (p x ( M -1) )) Substitute the distance from Therefore, the arithmetic expression in this processing is ye = M-1-y. On the other hand, step S85 is processing when the lower end of the rectangular area is inside the image 1, and the distance between the pixel of interest and the lower end pixel of the rectangular area is substituted into the variable ye. Therefore, the following arithmetic expression ye = m 'is executed.

【0087】以上のステップS74からステップS85
までの処理により、注目画素を中心としたn画素×m画
素の矩形領域のうち、xs,xe,ys,yeにより特
定される領域は、画像1の内部に入っていることが保証
される。詳しくいうと、[注目画素から左にxs番目の
画素]〜[注目画素から右にxe番目の画素]と、[注
目画素から上にys番目の画素]〜[注目画素から下に
ye番目の画素]により形成される領域は必ずオリジナ
ル画像1の内部に入っている。
The above steps S74 to S85
By the processes up to, it is guaranteed that the area specified by xs, xe, ys, and ye within the rectangular area of n pixels × m pixels centering on the target pixel is included in the image 1. Specifically, [xs-th pixel to the left from the pixel of interest] to [xe-th pixel to the right of the pixel of interest] and [ys-th pixel above the pixel of interest]-[ye-th pixel below the pixel of interest] The area formed by [pixels] is always inside the original image 1.

【0088】次にステップS86では、2次元空間フィ
ルタリング処理を、上述のxs,xe,ys,yeによ
り特定される領域に対して実行する。即ち、以下の演算
式が実行される。
Next, in step S86, the two-dimensional spatial filtering process is executed on the area specified by the above-mentioned xs, xe, ys, and ye. That is, the following arithmetic expression is executed.

【0089】 a=(a(x-xs)(y-ys)×b(-xs)(-ys)+a(x-xs+1)(y-ys)×b(-xs+1)(-ys)+ …+a(x+xe)(y-ys)×b(xe)(-ys) +a(x-xs)(y-ys+1)×b(-xs)(-ys+1) +a(x-xs+1)(y-ys+1)×b(-xs+1)(-ys+1) +…+a(x+xe)(y-ys+1)×b(xe)(-ys+1) +… +a(x-xs)(y+ye)×b(-xs)(ye)+a(x-xs+1)(y+ye)×b(-xs+1)(ye)+… +a(x+xe)(y+ye)×b(xe)(ye))/s’ 但し、 s’=s×(b(-xs)(-ys)+b(-xs+1)(-ys)+…+b(xe)(-ys) +b(-xs)(-ys+1)+b(-xs+1)(-ys+1)+…+b(xe)(-ys+1) +… +b(-xs)(ye)+b(-xs+1)(ye)+…+b(xe)(ye))/ (b(-n')(-m')+b(-n'+1)(-m')+…+b(n')(-m') +b(-n')(-m'+1)+b(-n'+1)(-m'+1)+…+b(n')(-m'+1) +… +b(-n')(m')+b(-n'+1)(m')+…+b(n')(m')) である。A = (a (x-xs) (y-ys) × b (-xs) (-ys) + a (x-xs + 1) (y-ys) × b (-xs + 1) (- ys) +… + a (x + xe) (y-ys) × b (xe) (-ys) + a (x-xs) (y-ys + 1) × b (-xs) (-ys + 1) + a (x-xs + 1) (y-ys + 1) xb (-xs + 1) (-ys + 1) + ... + a (x + xe) (y-ys + 1) xb (xe) (- ys + 1) + ... + a (x-xs) (y + ye) xb (-xs) (ye) + a (x-xs + 1) (y + ye) xb (-xs + 1) (ye) + ... + a (x + xe) (y + ye) xb (xe) (ye) ) / s 'However, s' = sx (b (-xs) (-ys) + b (-xs + 1) ( -ys) + ... + b (xe) ( -ys ) + b (-xs) (-ys + 1) + b (-xs + 1) (-ys + 1) + ... + b (xe) (-ys + 1) + … + B (-xs) (ye) + b (-xs + 1) (ye) +… + b (xe) (ye) ) / (b (-n ') (-m') + b (-n '+ 1) (-m ') + ... + b (n') (-m ') + b (-n') (-m '+ 1) + b (-n' + 1) (-m '+ 1) + ... + b (n ') (-m' + 1) + ... + b (-n ') (m') + b (-n '+ 1) (m') + ... + b (n ') (m') ).

【0090】この2次元空間フィルタリング演算値a
を、出力画像の対応する画素の画素値とすることで、こ
の画素に対する演算を完了する。
This two-dimensional spatial filtering calculation value a
Is set to the pixel value of the corresponding pixel of the output image, and the calculation for this pixel is completed.

【0091】ステップS87では、画像1の全画素に対
して上述の各処理が完了したかを判定する。未処理の画
素が存在する場合は、ステップS73に戻り、次の注目
画素を指定して2次元空間フィルタリング演算を繰り返
す。また、全画素に対して処理が完了した場合はステッ
プS88へ進む。ステップS88では、画像出力部16
により、本処理で作成した2次元空間フィルタリング処
理画像を出力する。以上で本処理を終了する。
In step S87, it is determined whether each of the above-described processes has been completed for all the pixels of the image 1. If there is an unprocessed pixel, the process returns to step S73, the next target pixel is designated, and the two-dimensional spatial filtering operation is repeated. If the processing is completed for all pixels, the process proceeds to step S88. In step S88, the image output unit 16
Thus, the two-dimensional spatial filtering processing image created by this processing is output. This is the end of the process.

【0092】以上説明したように本実施例5の画像処理
装置によれば、2次元空間フィルタリング処理の矩形領
域が画像1をはみ出すかどうかを判定し、画像1の内部
領域の画素のみで2次元空間フィルタリング演算を行っ
ている。このため、従来の画像処理装置のように画像の
端部が処理できなかったり、画像の反対側の色が紛れ込
んだりすることがなくなり、画像全体に有効な2次元空
間フィルタリング処理を施すことができる。
As described above, according to the image processing apparatus of the fifth embodiment, it is determined whether or not the rectangular area of the two-dimensional spatial filtering process extends over the image 1, and only the pixels in the internal area of the image 1 are used for the two-dimensional processing. Performs spatial filtering operations. Therefore, unlike the conventional image processing apparatus, it is not possible to process the end portion of the image and the color on the opposite side of the image is not mixed, and effective two-dimensional spatial filtering processing can be performed on the entire image. .

【0093】<実施例6>実施例6は、実施例5と同様
に矩形領域がはみ出す注目画素に対して有効な2次元空
間フィルタリング処理を可能とする画像処理装置の他の
例を示す。
<Embodiment 6> Embodiment 6 shows another example of an image processing apparatus which enables effective two-dimensional spatial filtering processing for a pixel of interest protruding from a rectangular area as in Embodiment 5.

【0094】本実施例6の画像処理装置の概略構成は実
施例5と同様である。以下に、図13のフローチャート
を用いて実施例6の画像処理装置による2次元空間フィ
ルタリング処理について説明する。
The schematic configuration of the image processing apparatus of the sixth embodiment is similar to that of the fifth embodiment. The two-dimensional spatial filtering processing by the image processing apparatus of the sixth embodiment will be described below with reference to the flowchart of FIG.

【0095】ステップS91にいて、オリジナル画像を
入力する。これは、上述の実施例5のステップS71と
同様であり説明を省略する。ステップS92では、パラ
メータを入力する。この処理も、実施例5のステップS
72と同様である。そしてここで設定されたパラメータ
を以下の通りとして説明を行う。矩形領域サイズの設定
値として、横方向のサイズがn、縦方向のサイズがm
(nとmは同時に1ではない、正の奇数)とする。ま
た、各画素毎の係数を、b(-n')(-m')
(-n'+1)( -m'),…,b(n')(-m') ,b(-n')(-m'+1)
(-n'+1)(-m'+1),…,b(n')(-m' +1) ,…,b
(-n')(m') ,b(-n'+1)(m') ,…,b(n')(m')とし、ス
ケールファクタをsとする(但し、n’=(n−1)/
2,m’=(m−1)/2)。以上の操作により、図4
に示されるようなm画素×n画素の矩形領域21が指定
される。
In step S91, an original image is input. This is the same as step S71 of the fifth embodiment described above, and the description thereof is omitted. In step S92, parameters are input. This processing is also the step S of the fifth embodiment.
Similar to 72. The parameters set here will be described below. As the setting value of the rectangular area size, the horizontal size is n and the vertical size is m.
(N and m are not 1 at the same time, a positive odd number). In addition, the coefficient for each pixel is b (-n ') (-m') ,
b (-n '+ 1) ( -m') , ..., b (n ' ) ( -m') , b (-n ') ( -m ' + 1) ,
b (-n '+ 1) (-m' + 1) , ..., b (n ') (-m' + 1) , ..., b
Let (-n ') (m') , b (-n '+ 1) (m') , ..., b (n ') (m') be the scale factor (note that n '= (n -1) /
2, m '= (m-1) / 2). By the above operation, FIG.
A rectangular area 21 of m pixels × n pixels is designated as shown in FIG.

【0096】次にステップS93において、画像の拡張
処理を行う。この画像の拡張について図14を参照して
説明する。本拡張処理においては、オリジナル画像1の
左右方向にn’画素分の領域を拡張し、上下方向にm’
画素分の領域を拡張する。そして、拡張した各画素の値
として、距離的に最も近いオリジナル画像1の画素値を
代入する。従って、領域31の各画素には、オリジナル
画像の左上端の画素値(横方向に0番目、縦方向に0番
目の画素値a00)が代入される。同様に領域33の各画
素にはオリジナル画素の右上端の画素値a(N-1)0が、領
域35の各画素にはオリジナル画像の右下端の画素値a
(N-1)(M-1)が、領域37の各画素にはオリジナル画像の
左下端の画素a0(M-1)がそれぞれ代入される。また、領
域32にはオリジナル画像の上端1列の画素値(a00
(N-1)0)がそれぞれ代入されていく。同様に、領域3
4にはオリジナル画像の右端1列の画素値が、領域36
にはオリジナル画像の下端1列の画素値が、領域38に
はオリジナル画像の左端1列の画素値がそれぞれ代入さ
れる。
Next, in step S93, image expansion processing is performed. The expansion of this image will be described with reference to FIG. In this expansion processing, an area of n'pixels is expanded in the horizontal direction of the original image 1 and m'in the vertical direction.
Expand the pixel area. Then, the pixel value of the original image 1 closest in distance is substituted as the value of each expanded pixel. Therefore, the pixel value at the upper left corner of the original image (0th pixel value in the horizontal direction and 0th pixel value in the vertical direction a 00 ) is assigned to each pixel of the area 31. Similarly, the pixel value a (N-1) 0 at the upper right end of the original pixel is set in each pixel of the area 33, and the pixel value a (N-1) 0 at the lower right end of the original image is set in each pixel of the area 35.
(N-1) (M-1) is assigned to the pixel a 0 (M-1) at the lower left corner of the original image in each pixel of the area 37. Further, in the area 32, the pixel values (a 00 to
a (N-1) 0 ) are respectively substituted. Similarly, area 3
4 shows the pixel value of the rightmost column of the original image in the area 36
Is assigned to the pixel value of the lowermost first column of the original image, and the region 38 is assigned to the pixel value of the first leftmost column of the original image.

【0097】以上の処理により、オリジナル画像中の全
ての注目画素の矩形領域は拡張された画面の内部に納ま
るものとなる。
By the above processing, the rectangular areas of all the target pixels in the original image can be accommodated inside the expanded screen.

【0098】ステップS94では、注目画素の設定を行
う。これは、拡張した画像の内部にあるオリジナル画像
1の各画素を順番に指定していく。以下、注目画素が横
方向にx番目、縦方向にy番目の画素であるとして説明
をおこなう。
In step S94, the target pixel is set. This sequentially specifies each pixel of the original image 1 inside the expanded image. Hereinafter, the pixel of interest will be described as the x-th pixel in the horizontal direction and the y-th pixel in the vertical direction.

【0099】ステップS95では、2次元空間フィルタ
リング処理を実行する。本実施例6では、注目画素を中
心としたn画素×m画素の矩形領域には必ず画素が存在
するので、以下の計算式、 a=(a(x-n')(y-m')×b(-n')(-m')+a(x-n'+1)(y-m')×b(-n'+1)(-m')+ …+a(x+n')(y-m')×b(n')(-m') +a(x-n')(y-m'+1)×b(-n')(-m'+1) +a(x-n'+1)(y-m'+1)×b(-n'+1)(-m'+1) +…+a(x+n')(y-m'+1)×b(n')(-m'+1) +… +a(x-n')(y+m')×b(-n')(m') +a(x-n'+1)(y+m')×b(-n'+1)(m')+ …+a(x+n')(y+m')×b(n')(m'))/s により2次元空間フィルタリングの演算値aを求めるこ
とができる。
In step S95, a two-dimensional spatial filtering process is executed. In the sixth embodiment, pixels always exist in the rectangular area of n pixels × m pixels centering on the pixel of interest, so the following calculation formula: a = (a (x-n ') (y-m') × b (-n ') (-m') + a (x-n '+ 1) (y-m') × b (-n '+ 1) (-m') +… + a (x + n ') (y-m ') xb (n') (-m ') + a (x-n') (y-m '+ 1) xb (-n') (-m '+ 1) + a (x- n '+ 1) (y-m' + 1) xb (-n '+ 1) (-m' + 1) + ... + a (x + n ') (y-m' + 1) xb (n ') (-m' + 1) +… + a (x-n ') (y + m') × b (-n ') (m') + a (x-n '+ 1) (y + m') × b (-n '+ 1) (m') + ... + a (x + n ') (y + m') × b (n ') (m') ) / s The calculated value a of the two-dimensional spatial filtering a Can be asked.

【0100】ステップS96ではオリジナル画像の全画
素について処理が完了したかどうかを判定する。未処理
の画素が残っている場合はステップS94に戻り、次の
注目画素を指定して2次元空間フィルタリング演算を繰
り返す。また、全画素について処理が終了していれば、
ステップS97へ進む。ステップS97では、画像出力
部16より本処理で作成した2次元空間フィルタリング
処理画像を出力する。以上で本処理を終了する。
In step S96, it is determined whether the processing has been completed for all pixels of the original image. If unprocessed pixels remain, the process returns to step S94, the next target pixel is designated, and the two-dimensional spatial filtering operation is repeated. Also, if processing has been completed for all pixels,
It proceeds to step S97. In step S97, the image output unit 16 outputs the two-dimensional spatial filtering processing image created by this processing. This is the end of the process.

【0101】以上説明したように実施例6の画像処理装
置によれば、2次元空間フィルタリングの矩形領域に画
素が必ず存在するように前もって画像領域を拡張する。
このため、注目画素がオリジナル画像の端部であって
も、2次元空間フィルタリングの演算を通常通り実行す
ることが可能となる。そして、この拡張された画像領域
には、距離的に最も近いオリジナル画像の画素値を代入
しているので演算結果に不自然な色が紛れ込むことを防
止する。
As described above, according to the image processing apparatus of the sixth embodiment, the image area is expanded in advance so that the pixels always exist in the rectangular area of the two-dimensional spatial filtering.
Therefore, even if the pixel of interest is at the end of the original image, it is possible to execute the calculation of the two-dimensional spatial filtering as usual. Since the pixel value of the original image closest in distance is assigned to the expanded image area, it is possible to prevent unnatural color from being mixed in the calculation result.

【0102】以上説明したように、実施例5、6の画像
処理装置によれば、大きな矩形サイズで2次元空間フィ
ルタリング処理を実行した場合でも、周辺部まで全ての
画素に対して演算を実行することができる。また、不自
然な色が紛れ込むこともなく効果的な2次元空間フィル
タリング処理の結果を得ることができる。
As described above, according to the image processing devices of the fifth and sixth embodiments, even when the two-dimensional spatial filtering process is executed with a large rectangular size, the calculation is executed for all the pixels up to the peripheral part. be able to. Further, it is possible to obtain an effective result of the two-dimensional spatial filtering process without the unnatural color being mixed in.

【0103】<実施例7>本実施例7では、注目画素が
オリジナル画像の周辺部にあり、矩形領域の一部が画像
の外側へ出てしまうような場合に、この注目画素に対す
る効果的なスムージング処理を可能とする画像処理装置
について説明する。
<Embodiment 7> In the present embodiment 7, when the pixel of interest is in the peripheral portion of the original image and a part of the rectangular area goes out of the image, it is effective for this pixel of interest. An image processing apparatus that enables smoothing processing will be described.

【0104】本実施例7の画像処理装置では、矩形領域
の1部が画像の外にはみ出してしまうような注目画素に
対しては、矩形領域のうちの画像に含まれる部分の画素
値を用いてスムージング演算を行うものである。以下に
実施例7の画像処理装置について説明する。
In the image processing apparatus according to the seventh embodiment, the pixel value of the portion of the rectangular area included in the image is used for the pixel of interest in which a part of the rectangular area extends out of the image. Smoothing calculation. The image processing apparatus according to the seventh embodiment will be described below.

【0105】実施例7の画像処理装置の概略構成は実施
例5と同様でありここではその説明を省略する。
The schematic configuration of the image processing apparatus according to the seventh embodiment is similar to that of the fifth embodiment, and the description thereof is omitted here.

【0106】次に、図15のフローチャートにより実施
例7の画像処理手順を説明する。
Next, the image processing procedure of the seventh embodiment will be described with reference to the flowchart of FIG.

【0107】ステップS101にて、画像の入力を行
う。詳細は実施例5のステップS71と同様でありここ
では、その説明を省略する。尚、ステップS101で入
力されたオリジナル画像は、図10に示されるような横
方向N画素,縦方向M画素のオリジナル画像1であると
して以下の説明を行う。また、各画素は、0から255
までの256階調を有し、0が黒色、255が白色を表
すモノクロ画像であるとする。
In step S101, an image is input. The details are the same as step S71 of the fifth embodiment, and the description thereof is omitted here. The following description will be made assuming that the original image input in step S101 is the original image 1 having N pixels in the horizontal direction and M pixels in the vertical direction as shown in FIG. Also, each pixel is from 0 to 255
It is assumed that the monochrome image has 256 gradations up to 0, 0 is black and 255 is white.

【0108】次に、ステップS102において、コマン
ド入力部15によりパラメータの入力を行う。ステップ
S102の処理も実施例5におけるステップS72と同
様であるが、ここで設定されるパラメータはスムージン
グ処理のための矩形領域サイズである。ここで入力され
たパラメータ、即ち矩形領域サイズを、横方向のサイズ
がn、縦方向のサイズがm(nとmは同時に1ではな
い、正の奇数)として以下の説明を行う。以上の操作に
より、図4に示されるようにn画素×m画素の矩形領域
21が指定される(但し、n’=(n−1)/2,m’
=(m−1)/2)。
Next, in step S102, the command input unit 15 inputs parameters. The process of step S102 is also the same as that of step S72 in the fifth embodiment, but the parameter set here is the rectangular area size for the smoothing process. The following description will be given assuming that the parameter input here, that is, the rectangular area size, has a horizontal size of n and a vertical size of m (n and m are not 1 at the same time, a positive odd number). By the above operation, the rectangular area 21 of n pixels × m pixels is designated as shown in FIG. 4 (where n ′ = (n−1) / 2, m ′).
= (M-1) / 2).

【0109】ステップS103は注目画素の指定であ
り、図10の画像1の各画素2を順番に注目画素として
指定する。そして、この注目画素に対するスムージング
の演算を、以下のステップS104からステップS11
6で行う。以下では、注目画素が横方向にx番目,縦方
向にy番目の画素axyであるとして説明を行う。
Step S103 is the designation of the pixel of interest, and each pixel 2 of the image 1 of FIG. 10 is designated in order as the pixel of interest. Then, the smoothing calculation for the target pixel is performed in the following steps S104 to S11.
Do in 6. In the following description, the pixel of interest is the x-th pixel a xy in the horizontal direction and the y-th pixel in the vertical direction.

【0110】ステップS104からステップS115ま
での処理は前述の実施例5におけるステップS74から
85までの処理と同様でありその説明は省略する。
The processing from step S104 to step S115 is the same as the processing from step S74 to step S85 in the above-described fifth embodiment, and the description thereof is omitted.

【0111】実施例5と同様に、ステップS104から
ステップS115までの処理により、注目画素を中心と
したn画素×m画素の矩形領域のうち、xs,xe,y
s,yeにより特定される領域は、画像1の内部に入っ
ていることが保証される。そして、ステップS116に
おいて、スムージング処理を上述のxs,xe,ys,
yeにより特定される領域に対して実行する。即ち、 a=(a(x-xs)(y-ys)+a(x-xs+1)(y-ys)+ …+a(x+xe)(y-ys) +a(x-xs)(y-ys+1)+a(x-xs+1)(y-ys+1)+…+a(x+xe)(y-ys+1) +… +a(x-xs)(y+ye)+a(x-xs+1)(y+ye)+… +a(x+xe)(y+ye)) /((xs+xe+1)×(ys+ye+1)) という演算式が実行される。
As in the fifth embodiment, by performing the processing from step S104 to step S115, xs, xe, y in the rectangular area of n pixels × m pixels centering on the pixel of interest.
The area specified by s and ye is guaranteed to be inside the image 1. Then, in step S116, the smoothing process is performed by the above-mentioned xs, xe, ys,
Perform on the area specified by yes. That is, a = (a (x-xs) (y-ys) + a (x-xs + 1) (y-ys) + ... + a (x + xe) (y-ys) + a (x-xs) (y -ys + 1) + a (x-xs + 1) (y-ys + 1) + ... + a (x + xe) (y-ys + 1) + ... + a (x-xs) (y + ye) + a ( The arithmetic expression of x-xs + 1) (y + ye) + ... + a (x + xe) (y + ye) ) / ((xs + xe + 1) × (ys + ye + 1)) is executed.

【0112】このスムージング演算値aを、出力画像の
対応する画素axyの画素値とすることで、この画素に対
する演算を完了する。
By setting this smoothing calculation value a as the pixel value of the corresponding pixel a xy of the output image, the calculation for this pixel is completed.

【0113】ステップS117では、画像1の全画素に
対して上述の各処理が完了したかを判定する。未処理の
画素が存在する場合は、ステップS103に戻り、次の
注目画素を指定してスムージング演算を繰り返す。ま
た、全画素に対して処理が完了した場合はステップS1
18へ進む。ステップS118では、画像出力部16に
より、本処理で作成したスムージング処理画像を出力す
る。以上で本処理を終了する。
In step S117, it is determined whether or not each of the above-mentioned processes has been completed for all the pixels of the image 1. If there is an unprocessed pixel, the process returns to step S103, the next pixel of interest is designated, and the smoothing calculation is repeated. If the processing is completed for all pixels, step S1
Proceed to 18. In step S118, the image output unit 16 outputs the smoothing-processed image created in this process. This is the end of the process.

【0114】以上説明したように本実施例7の画像処理
装置によれば、スムージング処理の矩形領域が画像1を
はみ出すかどうかを判定し、画像1の内部領域の画素の
みでスムージング演算を行っている。このため、従来の
画像処理装置のように画像の端部が処理できなかった
り、画像の反対側の色が紛れ込んだりすることがなくな
り、画像全体に有効なスムージング処理を施すことがで
きる。
As described above, according to the image processing apparatus of the seventh embodiment, it is determined whether or not the rectangular area of the smoothing process extends over the image 1, and the smoothing operation is performed only on the pixels in the internal area of the image 1. There is. Therefore, unlike the conventional image processing apparatus, it is possible to prevent the edge portion of the image from being processed and the color on the opposite side of the image to be mixed in, and it is possible to perform effective smoothing processing on the entire image.

【0115】<実施例8>実施例8は、実施例7と同様
に矩形領域がはみ出す注目画素に対して有効なスムージ
ング処理を可能とする画像処理装置の他の例を示す。
<Embodiment 8> Embodiment 8 shows another example of an image processing apparatus capable of performing effective smoothing processing on a target pixel protruding from a rectangular area, as in Embodiment 7.

【0116】本実施例8の画像処理装置の概略構成は実
施例7と同様である。以下に、図16のフローチャート
を用いて実施例8の画像処理装置によるスムージング処
理について説明する。
The schematic configuration of the image processing apparatus of the eighth embodiment is similar to that of the seventh embodiment. The smoothing process performed by the image processing apparatus according to the eighth embodiment will be described below with reference to the flowchart of FIG.

【0117】ステップS121において、オリジナル画
像を入力する。これは、上述の実施例7のステップS1
01と同様であり説明を省略する。ここで、入力された
画像は図10に示すような横方向N画素,縦方向M画素
のオリジナル画像1であるとして以下の説明を行う。ま
た、各画素は、0から255までの256階調を有し、
0が黒色、255が白色を表すモノクロ画像であるとす
る。
In step S121, the original image is input. This is step S1 in the above-described seventh embodiment.
Since it is the same as 01, the description is omitted. Here, the following description will be made assuming that the input image is the original image 1 having N pixels in the horizontal direction and M pixels in the vertical direction as shown in FIG. Further, each pixel has 256 gradations from 0 to 255,
It is assumed that 0 is black and 255 is a monochrome image that represents white.

【0118】ステップS122では、パラメータを入力
する。この処理も、実施例7のステップS102と同様
である。そしてここで設定されたパラメータ、即ち矩形
領域サイズを、横方向のサイズがn、縦方向のサイズが
m(nとmは同時に1ではない、正の奇数)として説明
する。以上の操作により、図4に示されるような矩形領
域21が指定される(但し、n’=(n−1)/2,
m’=(m−1)/2)。
In step S122, parameters are input. This processing is also similar to step S102 of the seventh embodiment. The parameter set here, that is, the rectangular area size, will be described assuming that the horizontal size is n and the vertical size is m (n and m are not 1 at the same time, a positive odd number). By the above operation, the rectangular area 21 as shown in FIG. 4 is designated (however, n ′ = (n−1) / 2,
m '= (m-1) / 2).

【0119】次にステップS123において、画像の拡
張を行う。この画像の拡張処理は、実施例6の図13の
ステップS93と同じ処理であり、ここではその説明は
省略する。この拡張処理により、オリジナル画像中の全
ての注目画素の矩形領域は拡張された画面の内部に納ま
るものとなる。
Next, in step S123, the image is expanded. This image expansion processing is the same processing as step S93 in FIG. 13 of the sixth embodiment, and the description thereof is omitted here. By this expansion processing, the rectangular areas of all the target pixels in the original image are accommodated inside the expanded screen.

【0120】ステップS124では、注目画素の設定を
行う。これは、拡張した画像の内部にあるオリジナル画
像1の各画素を順番に指定していく。以下、注目画素が
横方向にx番目、縦方向にy番目の画素axyであるとし
て説明をおこなう。
In step S124, the target pixel is set. This sequentially specifies each pixel of the original image 1 inside the expanded image. In the following description, the target pixel is the x-th pixel in the horizontal direction and the y-th pixel in the vertical direction, a xy .

【0121】ステップS125では、スムージング処理
を実行する。本実施例4では、注目画素を中心として、
n画素×m画素の矩形領域には必ず画素が存在するので
以下の計算式、 a=(a(x-n')(y-m')+a(x-n'+1)(y-m')+…+a(x+n')(y-m') +a(x-n')(y-m'+1)+a(x-n'+1)(y-m'+1)+…+a(x+n')(y-m'+1) +… +a(x-n')(y+m')+a(x-n'+1)(y+m')+…+a(x+n')(y+m')) /(n×m) によりスムージングの演算値aを求めることができる。
In step S125, smoothing processing is executed. In the fourth embodiment, focusing on the pixel of interest,
Since pixels always exist in a rectangular area of n pixels × m pixels, the following calculation formula is used: a = (a (x-n ') (y-m') + a (x-n '+ 1) (y-m ') +… + a (x + n') (y-m ') + a (x-n') (y-m '+ 1) + a (x-n' + 1) (y-m '+ 1) + … + A (x + n ') (y-m' + 1) +… + a (x-n ') (y + m') + a (x-n '+ 1) (y + m') +… + a ( x + n ′) (y + m ′) ) / (n × m) can be used to obtain the smoothing operation value a.

【0122】ステップS126ではオリジナル画像の全
画素について処理が完了したかどうかを判定する。未処
理の画素が残っている場合はステップS124に戻り、
次の注目画素を指定してスムージング演算を繰り返す。
また、全画素について処理が終了していれば、ステップ
S127へ進む。ステップS127では、画像出力部1
6より本処理で作成したスムージング処理画像を出力す
る。以上で本処理を終了する。
In step S126, it is determined whether the processing has been completed for all the pixels of the original image. If unprocessed pixels remain, the process returns to step S124,
The smoothing calculation is repeated by designating the next target pixel.
If the processing has been completed for all pixels, the process proceeds to step S127. In step S127, the image output unit 1
From 6, the smoothing processed image created by this processing is output. This is the end of the process.

【0123】以上説明したように、実施例8の画像処理
装置によれば、スムージングの矩形領域に画素が必ず存
在するように前もって画像領域を拡張する。このため、
注目画素がオリジナル画像の端部であっても、スムージ
ングの演算を通常通り実行することが可能となる。そし
て、この拡張された画像領域には、距離的に最も近いオ
リジナル画像の画素値を代入しているので演算結果に不
自然な色が紛れ込むことを防止する。
As described above, according to the image processing apparatus of the eighth embodiment, the image area is expanded in advance so that the pixels always exist in the smoothing rectangular area. For this reason,
Even if the pixel of interest is at the edge of the original image, the smoothing operation can be executed normally. Since the pixel value of the original image closest in distance is assigned to the expanded image area, it is possible to prevent unnatural color from being mixed in the calculation result.

【0124】以上の説明より明らかなように、実施例
7、8の画像処理装置によれば、大きな矩形サイズでス
ムージング処理を実行した場合でも、周辺部まで全ての
画素に対して演算を実行することができる。また、不自
然な色が紛れ込むこともなく効果的なスムージング処理
の結果を得ることができる。
As is clear from the above description, according to the image processing devices of the seventh and eighth embodiments, even when the smoothing process is executed with a large rectangular size, the calculation is executed for all the pixels up to the peripheral part. be able to. Further, it is possible to obtain an effective result of the smoothing processing without causing unnatural color to be mixed.

【0125】なお、上述の各実施例では、モノクロ画像
を例に説明したが、カラー画像の場合は、3原色別に同
じ演算を3回繰り返せば、同様の効果を得ることができ
る。
In each of the above embodiments, a monochrome image is described as an example, but in the case of a color image, the same effect can be obtained by repeating the same calculation three times for each of the three primary colors.

【0126】また、上記実施例では、矩形領域として、
横方向も縦方向も奇数の画素数を用いたが、偶数であっ
た場合、注目画素が中央よりややずれる為、左側と右側
の画素数、上側と下側の画素数が異なってくるだけであ
り、同様な処理を行うことが可能である。
In the above embodiment, the rectangular area is
We used an odd number of pixels in both the horizontal and vertical directions, but if the number was even, the pixel of interest would be slightly displaced from the center, so the number of pixels on the left and right sides, and the number of pixels on the upper and lower sides would differ. Yes, it is possible to perform similar processing.

【0127】更に、上記実施例1から4では、マスク画
像を座標入力装置17を使用して、操作者が表示装置1
4を見ながら指定したが、予め作成されたマスク画像が
ある場合は、オリジナル画像と同じように、画像入力装
置11を用いて、入力してもかまわない。
Further, in the above-described first to fourth embodiments, the operator uses the coordinate input device 17 to input the mask image to the display device 1.
Although the designation was made while looking at No. 4, if there is a mask image created in advance, it may be inputted using the image input device 11 in the same manner as the original image.

【0128】尚、本発明は、複数の機器から構成される
システムに適用しても、1つの機器から成る装置に適用
しても良い。また、本発明はシステム或は装置に本発明
により規定される処理を実行するためのプログラムを供
給することによって達成される場合にも適用できること
は言うまでもない。
The present invention may be applied to a system composed of a plurality of devices or an apparatus composed of one device. It goes without saying that the present invention can also be applied to the case where it is achieved by supplying a system or apparatus with a program for executing the processing defined by the present invention.

【0129】[0129]

【発明の効果】以上説明してきたように本発明の画像処
理方法及び装置によれば、各画素の値を当該画素を含む
所定領域内の画素の値に基づいて決定する際に、前記所
定領域内における有効な画素の値を用いて画像処理を実
行することが可能となり、画像処理を実行すべき全領域
に渡り効果的な画像処理を実行できる。
As described above, according to the image processing method and apparatus of the present invention, when the value of each pixel is determined based on the value of the pixel within the predetermined area including the pixel, the predetermined area is determined. It becomes possible to execute the image processing by using the effective pixel value in the image, and the effective image processing can be executed over the entire area where the image processing should be executed.

【0130】[0130]

【図面の簡単な説明】[Brief description of drawings]

【図1】実施例1から4による画像処理装置の概略構成
を示すブロック図である。
FIG. 1 is a block diagram showing a schematic configuration of an image processing device according to first to fourth embodiments.

【図2】実施例1及び2の画像処理装置による2次元空
間フィルタリング処理の手順を表すフローチャートであ
る。
FIG. 2 is a flowchart illustrating a procedure of a two-dimensional spatial filtering process performed by the image processing apparatuses according to the first and second embodiments.

【図3】画像中の注目画素とその矩形領域を説明するた
めの図である。
FIG. 3 is a diagram for explaining a target pixel in an image and its rectangular area.

【図4】矩形領域を表す図である。FIG. 4 is a diagram showing a rectangular area.

【図5】実施例1の2次元空間フィルタリング処理によ
る演算手順を表すフローチャートである。
FIG. 5 is a flowchart showing a calculation procedure by a two-dimensional spatial filtering process according to the first embodiment.

【図6】実施例2の2次元空間フィルタリング処理によ
る演算手順を表すフローチャートである。
FIG. 6 is a flowchart showing a calculation procedure by a two-dimensional spatial filtering process according to the second embodiment.

【図7】実施例3及び4の画像処理装置によるスムージ
ング処理の手順を表すフローチャートである。
FIG. 7 is a flowchart illustrating a procedure of smoothing processing performed by the image processing apparatuses according to the third and fourth embodiments.

【図8】実施例3のスムージング処理による演算手順を
表すフローチャートである。
FIG. 8 is a flowchart illustrating a calculation procedure by smoothing processing according to the third exemplary embodiment.

【図9】実施例4のスムージング処理による演算手順を
表すフローチャートである。
FIG. 9 is a flowchart illustrating a calculation procedure by smoothing processing according to the fourth exemplary embodiment.

【図10】画像中の注目画素とその矩形領域との関係、
及び矩形領域が画像よりはみ出した様子を表す図であ
る。
FIG. 10 shows a relationship between a pixel of interest in an image and its rectangular area,
6A and 6B are diagrams illustrating a state in which a rectangular area extends beyond an image.

【図11】実施例5から8による画像処理装置の概略構
成を表すブロック図である。
FIG. 11 is a block diagram showing a schematic configuration of an image processing apparatus according to Examples 5 to 8.

【図12】実施例5の画像処理装置による2次元空間フ
ィルタリング処理の手順を表すフローチャートである。
FIG. 12 is a flowchart illustrating a procedure of a two-dimensional spatial filtering process performed by the image processing apparatus according to the fifth exemplary embodiment.

【図13】実施例6の画像処理装置による2次元空間フ
ィルタリング処理の手順を表すフローチャートである。
FIG. 13 is a flowchart showing a procedure of two-dimensional spatial filtering processing by the image processing apparatus of the sixth embodiment.

【図14】拡張処理を説明する図である。FIG. 14 is a diagram illustrating an extension process.

【図15】実施例7の画像処理装置による2次元空間フ
ィルタリング処理の手順を表すフローチャートである。
FIG. 15 is a flowchart illustrating a procedure of a two-dimensional spatial filtering process performed by the image processing device according to the seventh embodiment.

【図16】実施例8の画像処理装置による2次元空間フ
ィルタリング処理の手順を表すフローチャートである。
FIG. 16 is a flowchart showing a procedure of two-dimensional spatial filtering processing by the image processing apparatus of the eighth embodiment.

【符号の説明】[Explanation of symbols]

11 画像入力部 12 処理部 13 記憶部 14 表示部 15 コマンド入力部 16 画像出力部 17 座標入力部 11 image input unit 12 processing unit 13 storage unit 14 display unit 15 command input unit 16 image output unit 17 coordinate input unit

Claims (14)

【特許請求の範囲】[Claims] 【請求項1】 画像中の各画素の値を当該画素を含む所
定領域の画素の値に基づいて決定する画像処理を行う画
像処理装置であって、 前記画像において前記画像処理を実行する領域を実行領
域として設定する設定手段と、 前記所定領域内に存在する画素のうち前記実行領域内に
存在する画素を抽出する抽出手段と、 前記実行領域内の各画素に対して、前記抽出手段により
抽出された画素を用いて前記画像処理を実行する実行手
段と、 を備えることを特徴とする画像処理装置。
1. An image processing apparatus for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, wherein an area for executing the image processing in the image is Setting means for setting as an execution area, extraction means for extracting pixels existing in the execution area among pixels existing in the predetermined area, and extraction by the extraction means for each pixel in the execution area An image processing apparatus comprising: an executing unit that executes the image processing using the generated pixels.
【請求項2】 画像中の各画素の値を当該画素を含む所
定領域の画素の値に基づいて決定する画像処理を行う画
像処理装置であって、 前記画像において前記画像処理を実行する領域を実行領
域として設定する設定手段と、 前記所定領域内に存在する画素のうち前記実行領域外に
存在する画素の値を前記実行領域内に存在する画素の値
に基づいて設定しなおす設定手段と、 前記実行領域内の各画素に対して前記所定領域内の全画
素を用いて前記画像処理を実行する実行手段と、 を備えることを特徴とする画像処理装置。
2. An image processing apparatus for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, wherein an area for performing the image processing in the image is Setting means for setting as the execution area, and setting means for resetting the value of the pixel existing outside the execution area among the pixels existing in the predetermined area based on the value of the pixel existing in the execution area, An image processing apparatus comprising: an execution unit that executes the image processing by using all the pixels in the predetermined area for each pixel in the execution area.
【請求項3】 前記設定手段は、前記所定領域内に存在
する画素のうち前記実行領域外に存在する画素の値を、
前記所定領域内でかつ前記実行領域内に存在する当該画
素に最も近い画素の値に基づいて設定しなおすことを特
徴とする請求項2に記載の画像処理装置。
3. The setting means sets the values of pixels existing outside the execution area among pixels existing in the predetermined area,
The image processing apparatus according to claim 2, wherein the image processing apparatus is reset based on a value of a pixel closest to the pixel existing in the predetermined area and in the execution area.
【請求項4】 画像中の各画素の値を当該画素を含む所
定領域の画素の値に基づいて決定する画像処理を行う画
像処理装置であって、 前記所定領域のうち前記画像よりはみ出す部分を除去し
て得られる残りの領域を実行領域として設定する設定手
段と、 前記実行領域内の画素を用いて前記画像処理を実行する
実行手段と、 を備えることを特徴とする画像処理装置。
4. An image processing apparatus for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, the portion of the predetermined area protruding from the image. An image processing apparatus comprising: a setting unit configured to set a remaining region obtained by removal as an execution region; and an execution unit configured to execute the image processing using pixels in the execution region.
【請求項5】 画像中の各画素の値を当該画素を含む所
定領域の画素の値に基づいて決定する画像処理を行う画
像処理装置であって、 前記画像内の全画素に対する前記所定領域が納まる大き
さになるように前記画像の周辺部を拡張する拡張手段
と、 前記所定領域内の画素を用いて前記画像処理を実行する
実行手段と、 を備えることを特徴とする画像処理装置。
5. An image processing apparatus for performing image processing for determining a value of each pixel in an image based on a pixel value of a predetermined area including the pixel, wherein the predetermined area for all pixels in the image is An image processing apparatus comprising: an expansion unit that expands a peripheral portion of the image so as to have a size that can be accommodated; and an execution unit that executes the image processing by using pixels in the predetermined region.
【請求項6】 前記拡張手段は前記画像内の全画素に対
する前記所定領域が納まる大きさになるように前記画像
の周辺部を拡張し、その拡張部分の画素の値として、前
記画像中の画素のうち当該画素と最も近い距離にある画
素の値を用いることを特徴とする請求項5に記載の画像
処理装置。
6. The expansion means expands the peripheral portion of the image so that the predetermined area for all the pixels in the image can be accommodated, and the pixel in the image is set as the value of the pixel of the expanded portion. The image processing apparatus according to claim 5, wherein a value of a pixel located closest to the pixel is used.
【請求項7】 前記画像処理は、2次元空間フィルタリ
ング処理であることを特徴とする請求項1乃至6のいず
れかに記載の画像処理装置。
7. The image processing apparatus according to claim 1, wherein the image processing is a two-dimensional spatial filtering processing.
【請求項8】 前記画像処理は、スムージング処理であ
ることを特徴とする請求項1乃至6のいずれかに記載の
画像処理装置。
8. The image processing apparatus according to claim 1, wherein the image processing is smoothing processing.
【請求項9】 画像中の各画素の値を当該画素を含む所
定領域の画素の値に基づいて決定する画像処理を行う画
像処理方法であって、 前記画像において前記画像処理を実行する領域を実行領
域として設定する設定工程と、 前記所定領域内に存在する画素のうち前記実行領域内に
存在する画素を抽出する抽出工程と、 前記実行領域内の各画素に対して、前記抽出工程により
抽出された画素を用いて前記画像処理を実行する実行工
程と、 を備えることを特徴とする画像処理方法。
9. An image processing method for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, the method comprising: A setting step of setting as an execution area, an extraction step of extracting pixels existing in the execution area among pixels existing in the predetermined area, and an extraction step for each pixel in the execution area An image processing method comprising: performing the image processing by using the generated pixels;
【請求項10】 画像中の各画素の値を当該画素を含む
所定領域の画素の値に基づいて決定する画像処理を行う
画像処理方法であって、 前記画像において前記画像処理を実行する領域を実行領
域として設定する設定工程と、 前記所定領域内に存在する画素のうち前記実行領域外に
存在する画素の値を前記実行領域内に存在する画素の値
に基づいて設定しなおす設定工程と、 前記実行領域内の各画素に対して前記所定領域内の全画
素を用いて前記画像処理を実行する実行工程と、 を備えることを特徴とする画像処理方法。
10. An image processing method for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, wherein an area for performing the image processing in the image is defined. A setting step of setting as an execution area, and a setting step of resetting the value of the pixel existing outside the execution area among the pixels existing in the predetermined area based on the value of the pixel existing in the execution area, An image processing method, comprising: performing the image processing on each pixel in the execution area by using all the pixels in the predetermined area.
【請求項11】 前記設定工程は、前記所定領域内に存
在する画素のうち前記実行領域外に存在する画素の値
を、前記所定領域内でかつ前記実行領域内に存在する当
該画素に最も近い画素の値に基づいて設定しなおすこと
を特徴とする請求項10に記載の画像処理方法。
11. In the setting step, among the pixels existing in the predetermined area, the value of a pixel existing outside the execution area is closest to the pixel existing in the predetermined area and within the execution area. The image processing method according to claim 10, wherein the setting is performed again based on the pixel value.
【請求項12】 画像中の各画素の値を当該画素を含む
所定領域の画素の値に基づいて決定する画像処理を行う
画像処理方法であって、 前記所定領域のうち前記画像よりはみ出す部分を除去し
て得られる残りの領域を実行領域として設定する設定工
程と、 前記実行領域内の画素を用いて前記画像処理を実行する
実行工程と、 を備えることを特徴とする画像処理方法。
12. An image processing method for performing image processing for determining a value of each pixel in an image based on a value of a pixel in a predetermined area including the pixel, wherein a portion of the predetermined area protruding from the image is An image processing method comprising: a setting step of setting the remaining area obtained by removal as an execution area; and an execution step of executing the image processing by using pixels in the execution area.
【請求項13】 画像中の各画素の値を当該画素を含む
所定領域の画素の値に基づいて決定する画像処理を行う
画像処理方法であって、 前記画像内の全画素に対する前記所定領域が納まる大き
さになるように前記画像の周辺部を拡張する拡張工程
と、 前記所定領域内の画素を用いて前記画像処理を実行する
実行工程と、 を備えることを特徴とする画像処理方法。
13. An image processing method for performing image processing for determining a value of each pixel in an image based on a pixel value of a predetermined area including the pixel, wherein the predetermined area for all pixels in the image is An image processing method comprising: an expansion step of expanding the peripheral portion of the image so that the image can be accommodated; and an execution step of executing the image processing by using pixels in the predetermined area.
【請求項14】 前記拡張工程は前記画像内の全画素に
対する前記所定領域が納まる大きさになるように前記画
像の周辺部を拡張し、その拡張部分の画素の値として、
前記画像の中の画素のうち当該画素と最も近い距離にあ
る画素の値を用いることを特徴とする請求項13に記載
の画像処理方法。
14. The expanding step expands a peripheral portion of the image so that the predetermined area for all pixels in the image is accommodated, and as a pixel value of the expanded portion,
The image processing method according to claim 13, wherein a value of a pixel located closest to the pixel among pixels in the image is used.
JP4172267A 1992-06-30 1992-06-30 Method and device for image processing Withdrawn JPH0620044A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4172267A JPH0620044A (en) 1992-06-30 1992-06-30 Method and device for image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4172267A JPH0620044A (en) 1992-06-30 1992-06-30 Method and device for image processing

Publications (1)

Publication Number Publication Date
JPH0620044A true JPH0620044A (en) 1994-01-28

Family

ID=15938735

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4172267A Withdrawn JPH0620044A (en) 1992-06-30 1992-06-30 Method and device for image processing

Country Status (1)

Country Link
JP (1) JPH0620044A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016035636A (en) * 2014-08-01 2016-03-17 キヤノン株式会社 Image processing apparatus, image processing method, and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016035636A (en) * 2014-08-01 2016-03-17 キヤノン株式会社 Image processing apparatus, image processing method, and program

Similar Documents

Publication Publication Date Title
US7916973B2 (en) Image processing apparatus, an image processing method, and a computer readable medium having recorded thereon a processing program for permitting a computer to perform image processing routines
US5021876A (en) Image processing apparatus with real-time texture processing
US4956872A (en) Image processing apparatus capable of random mosaic and/or oil-painting-like processing
JP4747970B2 (en) Image processing device
US20090027732A1 (en) Image processing apparatus, image processing method, and computer program
KR20000052475A (en) Image processing method and apparatus, image processing system, and storage medium
KR100818718B1 (en) Image processing device, and computer-readable recording medium having recorded thereon image processing program
US5684942A (en) Image processing apparatus and method for generating a third image from first and second images
JP7073082B2 (en) Programs, information processing equipment, and information processing methods
JP2006106976A (en) Image processor, image processing method and program
JPH0620044A (en) Method and device for image processing
JP5162552B2 (en) Color adjustment apparatus, color adjustment method, and color adjustment program
JP2002118737A (en) Image converter and image conversion method
JP3647104B2 (en) Image processing method and apparatus
JP2005149439A (en) Image processor and image processing method
JP2713677B2 (en) Color image color change processing method and color image synthesis processing method
JPH1021377A (en) Image processor
US20070230816A1 (en) Image processing device, image processing method, and image processing program product
JP2005196444A (en) Image data processor, image data processing method and its program
JPH07200801A (en) Deformed image producing device
US8879119B2 (en) Image tone conversion apparatus, recording medium, and system
JP3813131B2 (en) Embroidery data creation device
JPH04329487A (en) Method and device for extracting area
JPH0816929B2 (en) Image processing device
JP2023153638A (en) Program, information processing apparatus, and determination method

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19990831