JP2861106B2 - Shading image generation method and apparatus - Google Patents

Shading image generation method and apparatus

Info

Publication number
JP2861106B2
JP2861106B2 JP23801589A JP23801589A JP2861106B2 JP 2861106 B2 JP2861106 B2 JP 2861106B2 JP 23801589 A JP23801589 A JP 23801589A JP 23801589 A JP23801589 A JP 23801589A JP 2861106 B2 JP2861106 B2 JP 2861106B2
Authority
JP
Japan
Prior art keywords
value
gray
pixel
coordinate
integer
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.)
Expired - Lifetime
Application number
JP23801589A
Other languages
Japanese (ja)
Other versions
JPH0399378A (en
Inventor
卓資 齋藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP23801589A priority Critical patent/JP2861106B2/en
Publication of JPH0399378A publication Critical patent/JPH0399378A/en
Application granted granted Critical
Publication of JP2861106B2 publication Critical patent/JP2861106B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Image Generation (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、例えば、コンピュータグラフィックスの分
野において人工的に画像を生成したり、あるいは印刷用
の画像を計算機を用いて画像処理するための修正用の画
像を生成する方法および装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Industrial Application Field] The present invention relates to, for example, an image processing apparatus for artificially generating an image in the field of computer graphics, or processing an image for printing using a computer. The present invention relates to a method and an apparatus for generating an image for correction.

〔従来の技術〕[Conventional technology]

コンピュータグラフィックスの分野において中心が黒
で周辺部に行くほど明るくなる画像を人工的に生成した
り、あるいは、カメラやTVで入力された画像の一部を修
正する場合において修正した部分の境界をぼかすための
修正用の画像を生成するときに、原点からの距離をその
画素の濃淡値とする画像が要求される。
In the field of computer graphics, artificially generate an image whose center is black and becomes brighter toward the periphery, or when correcting a part of an image input with a camera or TV, the boundary of the corrected part is When an image for correction for blurring is generated, an image is required in which the distance from the origin is the gray value of the pixel.

すなわち、生成すべき濃淡画像を直交x−y座標で表
すと、座標(X,Y)の画素の濃淡値F(X,Y)は、 となる。これを示したのが第2図であり、円錐の側面の
形になっている。
That is, when the grayscale image to be generated is represented by orthogonal xy coordinates, the grayscale value F (X, Y) of the pixel at the coordinates (X, Y) is Becomes This is shown in FIG. 2, which is in the shape of a side of a cone.

黒の中心となる座標を(X0,Y0)とすると、 G(X,Y)=k・F(X−X0,Y−Y0) …(2) によって中心(X0,Y0)が黒で周辺部に行くほど明るく
なる画像G(x,y)が生成できる。(ただし、kは係
数) また、修正した境界がわからないように画像H(x,
y)の一部を修正する場合、たとえば、修正したい画素
の中心座標(X1,Y1)の濃淡値をkとし、座標(X1,Y1)
を中心に半径rの領域を修正する場合、 (x−X1)2+(y−Y1)2<r2 …(3) を満たす座標(x,y)の画素の領域について、 H(x,y)=k+(H(x,y)−k)・F(x−X1,y−Y
1)/r …(4) とすることによって、中心の値はkであるが、中心から
離れるにしたがって修正前の画像の割合が大きくなり、
距離がr以上の領域は修正されないので、スプレイで絵
を修正したのと同様の効果となり、修正した境界がわか
らなくなる。
When the coordinates of a black center with (X 0, Y 0), G (X, Y) = k · F (X-X 0, Y-Y 0) center by ... (2) (X 0, Y 0 ) Is black, and an image G (x, y) that becomes brighter as it goes to the peripheral portion can be generated. (However, k is a coefficient) Also, the image H (x,
When a part of y) is corrected, for example, the gray value of the center coordinate (X1, Y1) of the pixel to be corrected is set to k, and the coordinates (X1, Y1)
When a region having a radius r with respect to is corrected, for a pixel region of coordinates (x, y) satisfying (x−X1) 2 + (y−Y1) 2 <r 2 (3), H (x, y) = k + (H (x, y) -k) .F (x-X1, y-Y
1) / r (4), the value of the center is k, but as the distance from the center increases, the proportion of the image before correction increases,
Since the area whose distance is equal to or more than r is not corrected, the effect is the same as that of correcting the picture by spraying, and the corrected boundary cannot be recognized.

従来、式(1)の画像F(X,Y)を生成するのに、1
画素毎に、2回の乗算と1回の平方根演算を行ってい
た。
Conventionally, to generate the image F (X, Y) of Expression (1), 1
Two multiplications and one square root operation were performed for each pixel.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

ところが、この平方根の計算するために専用の平方根
用の回路を作成したり、数値演算プロセッサを用いると
システムのコストが高価になる問題があった。また、汎
用のマイクロプロセッサを用いると、システムのコスト
は廉価になるが、平方根演算に多くの計算ステップを要
し、画像を生成するのに時間がかかるという問題があっ
た。
However, there is a problem in that if a dedicated circuit for square root is created to calculate the square root, or if a numerical processor is used, the cost of the system becomes high. In addition, when a general-purpose microprocessor is used, the cost of the system is reduced, but there is a problem that the square root operation requires many calculation steps and it takes time to generate an image.

本発明の目的は、コストあるいは時間のかかる平方根
演算を用いることなく式(1)の画像を生成する方法お
よび装置を提供することを目的としている。
It is an object of the present invention to provide a method and apparatus for generating an image of equation (1) without using costly or time-consuming square root operations.

〔課題を解決するための手段〕[Means for solving the problem]

本発明の濃淡画像生成方法は、原点からの距離を四捨
五入し整数化した値をその画素の値とする濃淡画像の生
成において、濃淡画像を直交x−y座標系で表し、ま
ず、y軸上の各画素の濃淡整数値は該画素のY座標の絶
対値とし、該画素の濃淡補助値は0とし、次に、座標
(X,Y)の濃淡整数値および濃淡補助値から該画素と隣
接する座標(X+1,Y)の濃淡整数値および濃淡補助値
を求めるのに、座標(X,Y)の画素のX座標値の2倍と
該画素の濃淡補助値との和から該画素の濃淡整数値を減
じる比較演算の結果、0より大きいあるいは等しいと
き、座標(X,Y)の画素の濃淡整数値に1を加えた値を
座標(X+1,Y)の濃淡整数値とし、座標(X,Y)のX座
標値の2倍と該画素の濃淡補助値との和から該画素の濃
淡整数値の2倍を減じた値を座標(X+1,Y)の画素の
濃淡補助値とし、前記比較演算の結果、0より小さいと
き、座標(X,Y)の画素の濃淡整数値を座標(X+1,Y)
の濃淡整数値とし、座標(X,Y)の画素のX座標値の2
倍と該画素の濃淡補助値との和に1を加えた値を座標
(X+1,Y)の濃淡補助値とし、これを繰り返すことに
よって画像を生成することを特徴としている。更に、本
発明の濃淡画像生成装置は、原点からの距離を四捨五入
し整数化した値をその画素の値をする濃淡画像の生成さ
せる装置において、X軸と平行な走査線上を画素が移動
する毎に同期して主走査クロック信号を発生させる主走
査クロック発生部と、 前記走査線がY軸方向に移動する毎に同期して副走査
クロック信号を発生させる副走査クロック発生部と、 前記主走査クロック信号の入力で値が1ずつ増加し、
前記副走査クロック信号の入力で値が0にクリアされる
X座標カウンタと、 前記副走査クロック信号の入力で値が1ずつ増加する
Y座標カウンタと、 副走査クロック信号の入力時に前記Y座標カウンタの
値が代入され、一つ前に処理した画素の濃淡整数値に比
べて1増加させるか否かを示す条件信号の入力によっ
て、値が1ずつ増加する濃淡整数カウンタと、 副走査クロック信号の入力時に値が0にクリアされる
濃淡補助レジスタと、 前記X座標レジスタの値を2倍した値と前記補助整数
レジスタの値とを加算する加算部と、 前記加算部の値と前記濃淡整数カウンタとの値を大小
比較し、前者の値が大きいあるいは等しい場合、前記条
件信号を発生する比較器と、 前記条件信号が入力された場合、前記加算部の値から
前記濃淡整数カウンタの値の2倍の値を減算した値を前
記濃淡補助レジスタに代入し、前記条件信号が入力され
なかった場合、前記加算部の値に1を加算した値を前記
濃淡補助レジスタに代入する条件付演算部と、 前記X座標カウンタの値をX方向のアドレスとし、前
記Y座標カウンタの値をY方向のアドレスとし、前記濃
淡レジスタの値をその画素の濃淡値として格納する濃淡
画像記憶部とを備えることを特徴としている。
In the method for generating a grayscale image according to the present invention, in generating a grayscale image in which a value obtained by rounding the distance from the origin and converting it to an integer is used as a pixel value, the grayscale image is represented by an orthogonal xy coordinate system. Is the absolute value of the Y coordinate of the pixel, the gray auxiliary value of the pixel is 0, and then the pixel is determined from the gray integer value and the gray auxiliary value of the coordinates (X, Y). To obtain the grayscale integer value and grayscale auxiliary value of the coordinate (X + 1, Y) to be calculated, the grayscale value of the pixel is calculated from the sum of twice the X coordinate value of the pixel at the coordinate (X, Y) and the grayscale auxiliary value of the pixel. When the result of the comparison operation of subtracting the integer value is greater than or equal to 0, the value obtained by adding 1 to the gray value of the pixel at the coordinates (X, Y) is set as the gray value of the coordinates (X + 1, Y), and the coordinates (X , Y), the value obtained by subtracting twice the grayscale integer value of the pixel from the sum of twice the X coordinate value of the pixel and the grayscale auxiliary value of the pixel is represented by the coordinate (X 1, the gray auxiliary values of the pixels of Y), if the result of the comparison operation, less than 0, the coordinates (X, coordinate the gray integer value of the pixel of Y) (X + 1, Y)
Of the pixel at the coordinates (X, Y)
An image is generated by repeating a value obtained by adding 1 to the sum of the double and the density auxiliary value of the pixel as a density (X + 1, Y). Further, the gray-scale image generating apparatus according to the present invention is a device for generating a gray-scale image in which a value obtained by rounding off the distance from the origin and converting it to an integer is used as the value of the pixel, each time a pixel moves on a scanning line parallel to the X axis. A main scanning clock generator that generates a main scanning clock signal in synchronization with the main scanning; a sub-scanning clock generator that generates a sub-scanning clock signal in synchronization with each movement of the scanning line in the Y-axis direction; The value increases by 1 at the input of the clock signal,
An X-coordinate counter whose value is cleared to 0 upon input of the sub-scanning clock signal; a Y-coordinate counter whose value increases by one upon input of the sub-scanning clock signal; and a Y-coordinate counter upon input of the sub-scanning clock signal And a density integer counter whose value is incremented by one in response to the input of a condition signal indicating whether or not to increase by one from the density integer value of the pixel processed immediately before, and a sub-scanning clock signal A gray level auxiliary register whose value is cleared to 0 upon input; an adder for adding a value obtained by doubling the value of the X coordinate register to the value of the auxiliary integer register; a value of the adder and the gray level integer counter And a comparator that generates the condition signal when the former value is larger or equal to the former value. When the condition signal is input, the comparator calculates the density integer count from the value of the adder. A value obtained by subtracting a value twice as large as the above value is assigned to the gray level auxiliary register. If the condition signal is not input, a value obtained by adding 1 to the value of the adding unit is substituted for the gray level auxiliary register. An arithmetic operation unit, a gray-scale image storage unit that stores the value of the X-coordinate counter as an X-direction address, the Y-coordinate counter value as a Y-direction address, and stores the value of the gray-scale register as a gray-scale value of the pixel. It is characterized by having.

〔作用〕[Action]

原点からの距離を四捨五入し整数化した値をその画素
の値とする濃淡画像において、互いに隣接する画素の濃
淡値の差は1以下である性質を利用することによって、
濃淡画像の座標(X,Y)の画素の濃淡値情報から座標
(X+1,Y)の濃淡値情報を求めることが可能となる。
In a grayscale image in which a value obtained by rounding the distance from the origin and converting it to an integer is used as the value of the pixel, by utilizing the property that the difference between the grayscale values of adjacent pixels is 1 or less,
It is possible to obtain the gray value information of the coordinates (X + 1, Y) from the gray value information of the pixel at the coordinates (X, Y) of the gray image.

本発明は、これを繰り返すことによって、計算コスト
のかかる平方根演算を用いることなく、所望の濃淡画像
の生成を可能ならしめる。
The present invention makes it possible to generate a desired grayscale image by repeating this, without using a square root operation that requires computational cost.

〔実施例〕〔Example〕

次に、本発明の実施例について図面を参照して説明す
る。
Next, embodiments of the present invention will be described with reference to the drawings.

第1図は本発明の一実施例を示すブロック図である。
第1図において、本実施例では、主走査クロック信号12
を発生させる主走査クロック発生部1と、副走査クロッ
ク信号13を発生させる副走査クロック発生部2と、濃淡
画像の画素の座標位置を示すX座標カウンタ3およびY
座標カウンタ4と、濃淡情報を格納する濃淡整数カウン
タ5および濃淡補助レジスタ6と、加算部7と、濃淡整
数カウンタ5の値を1だけ増加させる条件信号11を発生
させる比較器8と、濃淡補助レジスタ6に値を出力する
条件付演算部と、X−Yの2次元のアドレスでアクセス
され、濃淡整数値を格納する濃淡画像記憶部10とを備え
ている。
FIG. 1 is a block diagram showing one embodiment of the present invention.
In FIG. 1, in this embodiment, the main scanning clock signal 12 is used.
, A sub-scanning clock generator 2 for generating a sub-scanning clock signal 13, an X-coordinate counter 3 and a Y-coordinate counter 3 for indicating the coordinate positions of the pixels of the grayscale image.
A coordinate counter 4, a gray-scale integer counter 5 for storing gray-scale information and a gray-scale auxiliary register 6, an adder 7, a comparator 8 for generating a condition signal 11 for increasing the value of the gray-scale integer counter 5 by 1, a gray-scale auxiliary The image processing apparatus includes a conditional operation unit that outputs a value to the register 6 and a gray image storage unit 10 that is accessed by a two-dimensional XY address and stores a gray integer value.

主走査クロック信号12は濃淡画像における濃淡値算出
の対象となっている画素のX座標が1ずつ増える毎に主
走査クロック発生部1から出力される。副走査クロック
信号13は濃淡画像における濃淡値算出の対象となってい
る画素のY座標が1ずつ増える毎に副走査クロック発生
部2から出力される。X座標カウンタ3およびY座標カ
ウンタ4は濃淡画像における濃淡値算出の対象となって
いる画素の位置情報を格納し、X座標カウンタ3は副走
査クロック信号13の入力で0にクリアされ、主走査クロ
ック信号12の入力の毎に1,2,3,…と1ずつ増加し、Y座
標カウンタ4は濃淡画像を生成する前の初期値は0であ
り、副走査クロック信号13の入力の毎に1,2,3,…と1ず
つ増加する。濃淡画像カウンタ5は、副走査クロック信
号13の入力でY座標カウンタの値をロードし、条件信号
11の入力の毎に1ずつ増加する。濃淡補助レジスタ6は
副走査クロック信号13の入力で0にクリアされ、また、
条件付演算部の出力を格納する。加算部は濃淡補助レジ
スタの値とX座標カウンタの値の2倍とを加算する。比
較器8は加算部7の出力と濃淡整数カウンタ5の出力と
を大小比較し、前者の値が大きいあるいは等しいとき条
件信号11を出力する。条件演算部9は、条件信号11が入
力された場合、加算部7の値から濃淡整数カウンタ5の
値の2倍した値を減算した値を出力し、条件信号が入力
されなかった場合、加算部7の値に1を加算した値を出
力する。濃淡画像記憶部10は、X座標カウンタ3および
Y座標カウンタ4の各値を2次元のアドレス入力とし、
濃淡整数カウンタ5の値を濃淡値として格納する。
The main-scanning clock signal 12 is output from the main-scanning clock generator 1 every time the X coordinate of a pixel for which a gray-scale value is to be calculated in a gray-scale image increases by one. The sub-scanning clock signal 13 is output from the sub-scanning clock generator 2 every time the Y coordinate of a pixel for which a gray-scale value is to be calculated in a gray-scale image increases by one. The X-coordinate counter 3 and the Y-coordinate counter 4 store the position information of the pixel for which the gradation value is calculated in the gradation image. The X-coordinate counter 3 is cleared to 0 by the input of the sub-scanning clock signal 13, and the main scanning Each time the clock signal 12 is input, the value increases by 1, 2, 3,..., And the initial value of the Y coordinate counter 4 before generating the grayscale image is 0, and each time the sub-scanning clock signal 13 is input. It increases by 1, 2, 3, etc. The grayscale image counter 5 loads the value of the Y coordinate counter in response to the input of the sub-scanning clock signal 13 and
Increment by 1 for every 11 inputs. The gray level auxiliary register 6 is cleared to 0 by the input of the sub-scanning clock signal 13, and
Stores the output of the conditional operation unit. The adder adds the value of the gray level auxiliary register and twice the value of the X coordinate counter. The comparator 8 compares the output of the adder 7 with the output of the grayscale integer counter 5 and outputs a condition signal 11 when the former value is larger or equal. When the condition signal 11 is input, the condition calculation unit 9 outputs a value obtained by subtracting twice the value of the density integer counter 5 from the value of the addition unit 7, and adds the value when no condition signal is input. A value obtained by adding 1 to the value of the unit 7 is output. The grayscale image storage unit 10 uses the values of the X coordinate counter 3 and the Y coordinate counter 4 as two-dimensional address inputs,
The value of the shade integer counter 5 is stored as a shade value.

以下、本発明に係わる濃淡画像の生成の原理を以下に
説明する。
Hereinafter, the principle of the generation of a grayscale image according to the present invention will be described below.

座標(X,Y)の画素において原点からの距離である式
(1)の結果を四捨五入し整数化した濃淡整数値をI
(X,Y)とすると、 I(X,Y)−0.5≦F(X,Y)<I(X,Y)+0.5 …(5) の関係があり、濃淡補助値A(X,Y)を A(X,Y)=F(X,Y)2−I(X,Y)2 =X2+Y2−I(X,Y)2 …(6) としたとき、式(5)より、 −I(X,Y)+0.25≦A(X,Y)<I(X,Y)+0.25 …(7) となるが、式(6)の右辺は整数となるので、A(X,
Y)も整数となり、 −I(X,Y)+1≦A(X,Y)≦I(X,Y) …(8) の関係が成立している。
The result of the expression (1), which is the distance from the origin at the pixel at the coordinates (X, Y), is rounded to an integer, and the gray scale integer value is represented by I
If (X, Y), there is a relationship of I (X, Y) −0.5 ≦ F (X, Y) <I (X, Y) +0.5 (5), and the gray level auxiliary value A (X, Y) ) Is A (X, Y) = F (X, Y) 2 −I (X, Y) 2 = X 2 + Y 2 −I (X, Y) 2 (6) , −I (X, Y) + 0.25 ≦ A (X, Y) <I (X, Y) +0.25 (7), but the right side of Expression (6) is an integer. X,
Y) is also an integer, and the following relationship holds: -I (X, Y) + 1 ≦ A (X, Y) ≦ I (X, Y)

ところが、式(1)のF(X,Y)をX軸方向に偏微分
すると、 であるから、隣接したF(X,Y)とF(X+1,Y)との差
は1以下である。したがって、それぞれ整数化したI
(X,Y)とI(X+1,Y)との差も1以下になる。よっ
て、 I(X+1,Y)=I(X,Y) …(10) あるいは I(X+1,Y)=I(X,Y)+1 …(11) のいずれか一方が成立する。式(10)が成立するとき、
式(6)より、 A(X+1,Y)=A(X,Y)+2・X+1 …(12) が導き出され、座標(X+1,Y)における式(8)の関
係式を用いると、 A(X,Y)+2・X+1≦I(X,Y) …(13) という条件が成立しなければならない。
However, the partial differentiation of F (X, Y) in equation (1) in the X-axis direction gives Therefore, the difference between adjacent F (X, Y) and F (X + 1, Y) is 1 or less. Therefore, each integer I
The difference between (X, Y) and I (X + 1, Y) also becomes 1 or less. Therefore, one of the following holds: I (X + 1, Y) = I (X, Y) (10) or I (X + 1, Y) = I (X, Y) +1 (11) When equation (10) holds,
From equation (6), A (X + 1, Y) = A (X, Y) + 2 · X + 1 (12) is derived, and using the relational expression of equation (8) at coordinates (X + 1, Y), (X, Y) + 2 · X + 1 ≦ I (X, Y) (13)

また、式(12)のほうが成立するとき、同様に A(X+1,Y)=A(X,Y)+2・X−2・I(X,Y) …(14) が導き出され、 A(X,Y)+2・X≧I(X,Y) …(15) という条件が成立しなければならない。 Further, when the equation (12) holds, A (X + 1, Y) = A (X, Y) + 2 · X−2 · I (X, Y) (14) is similarly derived, and A (X , Y) + 2 × X ≧ I (X, Y) (15)

したがって、座標(X,Y)の濃淡情報である濃淡整数
値I(X,Y)と濃淡補助値A(X,Y)から座標(X+1,
Y)の濃淡整数値I(X+1,Y)と濃淡補助値A(X+1,
Y)を求めるには、 式(15)が成立する場合、 I(X+1,Y)=I(X,Y)+1 …(16) A(X+1,Y)=A(X,Y)+2・X−2・I(X,Y) …(17) 式(15)が成立しない場合、 I(X+1,Y)=I(X,Y) …(18) A(X+1,Y)=A(X,Y)+2・X+1 …(19) より、求められる。一方、任意のYについて であるから、 I(0,Y)=Y …(21) となるので、Y=0,1,2,……とすると、 I(0,0),I(0,1),I(0,2),…… のようにY軸上の濃淡値が求められる。
Therefore, the coordinates (X + 1, X + 1) are obtained from the grayscale integer value I (X, Y) and the grayscale auxiliary value A (X, Y), which are grayscale information of the coordinates (X, Y).
Y), the gray value I (X + 1, Y) and the gray value A (X + 1,
To obtain Y), if equation (15) holds, then I (X + 1, Y) = I (X, Y) +1... (16) A (X + 1, Y) = A (X, Y) + 2 · X −2 · I (X, Y) (17) When equation (15) does not hold, I (X + 1, Y) = I (X, Y) (18) A (X + 1, Y) = A (X, Y) Y) + 2 · X + 1 (19) On the other hand, for any Y Therefore, I (0, Y) = Y (21). Therefore, if Y = 0, 1, 2,..., I (0, 0), I (0, 1), I (0) , 2),..., Are obtained on the Y-axis.

次に、任意の整数Yについて式(6)と式(21)からI
(0,Y)が得られると、 A(0,Y)=02+Y2−I(0,Y)2=0 …(22) となるので、式(15)から(19)を繰り返し用いると、 I(0,Y),I(1,Y),I(2,Y),… A(0,Y),A(1,Y),A(2,Y),… が順々に得られ、Yは任意であるので必要な面積の濃淡
整数画像I(X,Y)が求めることができる。
Next, from the equations (6) and (21) for an arbitrary integer Y, I
When (0, Y) is obtained, A (0, Y) = 0 2 + Y 2 −I (0, Y) 2 = 0 (22). Therefore, equations (15) to (19) are repeatedly used. And I (0, Y), I (1, Y), I (2, Y),... A (0, Y), A (1, Y), A (2, Y),. Since Y is arbitrary, a gray scale integer image I (X, Y) having a required area can be obtained.

次に、第1図を参照して説明する。 Next, a description will be given with reference to FIG.

濃淡画像を生成する前の初期設定でX座標カウンタ3,
Y座標カウンタ4,濃淡整数カウンタ5,および濃淡補助レ
ジスタ6はそれぞれ0が代入される。そして、X座標カ
ウンタ3およびY座標カウンタ4の値(0,0)をアドレ
スとして、濃淡整数カウンタの値0が濃淡画像記憶部10
に出力されるとともに、加算部7で濃淡補助レジスタ6
の値とX座標カウンタ3の値を2倍した値との和が出力
され、比較器8は加算部7が出力した値と濃淡整数カウ
ンタ5の値とを大小比較して、前者が後者よりも大きい
あるいは等しいときのみ条件信号11を出力する。条件付
演算部9は、条件信号11が入力されたとき加算部7の出
力値から濃淡整数カウンタ5の値の2倍の値を減じた値
を出力し、条件信号11が入力されなかったとき加算部7
の出力値に1を加算した値を出力する。濃淡整数カウン
タ5は条件信号11が入力されたときのみ1だけ増加し、
濃淡補助レジスタ6は条件付演算部9の出力値が代入さ
れる。
The default setting before generating the grayscale image is the X coordinate counter 3,
0 is assigned to each of the Y coordinate counter 4, the grayscale integer counter 5, and the grayscale auxiliary register 6. The value (0,0) of the X-coordinate counter 3 and the Y-coordinate counter 4 is used as an address, and the value 0 of the gray-scale integer counter is stored in the gray-scale image storage unit 10.
Is output to the adder 7 and the density auxiliary register 6
And the value obtained by doubling the value of the X-coordinate counter 3 is output. The comparator 8 compares the value output by the adder 7 with the value of the gray-scale integer counter 5, and the former is compared with the latter. The condition signal 11 is output only when is larger or equal. The conditional operation unit 9 outputs a value obtained by subtracting twice the value of the grayscale integer counter 5 from the output value of the addition unit 7 when the condition signal 11 is input, and outputs the value when the condition signal 11 is not input. Adder 7
And outputs a value obtained by adding 1 to the output value. The gray-scale integer counter 5 increases by 1 only when the condition signal 11 is input,
The output value of the conditional operation unit 9 is assigned to the gray level auxiliary register 6.

主走査クロック発生部1から主走査クロック信号12が
発生し、X座標カウンタ3の値は1だけ増加する。そし
て、X座標カウンタ3およびY座標カウンタ4の値をア
ドレスとして、濃淡整数カウンタの値0が濃淡画像記憶
部10に出力されるとともに、加算部7で濃淡補助レジス
タ6の値とX座標カウンタ3の値を2倍した値との和が
出力され、比較器8は加算部7が出力した値と濃淡整数
カウンタ5の値とを大小比較して、前者が後者よりも大
きいあるいは等しいときのみ条件信号11を出力する。条
件付演算部9は、条件信号11が入力されたとき加算部7
の出力値から濃淡整数カウンタ5の値の2倍の値を減じ
た値を出力し、条件信号11が入力されなかったとき加算
部7の出力値に1を加算した値を出力する。濃淡整数カ
ウンタ5は条件信号11が入力されたときのみ1だけ増加
し、濃淡補助レジスタ6は条件付演算部9の出力値が代
入される。生成する濃淡画像のX方向の画素の数だけこ
れを繰り返すことによって、濃淡画像のX軸(Y=0)
の濃淡値が生成できる。
The main scanning clock signal 12 is generated from the main scanning clock generator 1, and the value of the X coordinate counter 3 increases by one. Using the values of the X-coordinate counter 3 and the Y-coordinate counter 4 as addresses, the value 0 of the gray-scale integer counter is output to the gray-scale image storage unit 10, and the value of the gray-scale auxiliary register 6 and the X-coordinate counter 3 Is output, and the comparator 8 compares the value output from the adder 7 with the value of the gray-scale integer counter 5 to determine whether the former is greater than or equal to the latter. The signal 11 is output. When the conditional signal 11 is input, the conditional operation unit 9
And outputs a value obtained by subtracting twice the value of the gray-scale integer counter 5 from the output value of, and when the condition signal 11 is not input, a value obtained by adding 1 to the output value of the adding unit 7 is output. The gradation integer counter 5 is incremented by 1 only when the condition signal 11 is input, and the output value of the conditional operation unit 9 is substituted in the gradation auxiliary register 6. By repeating this for the number of pixels in the X direction of the generated gray image, the X axis of the gray image (Y = 0)
Can be generated.

走査線上の最後の画素の濃淡値が得られると次に、副
走査クロック発生部2から走査線が次の走査線上に移動
したことを示す副走査クロック信号13が発生し、X座標
カウンタ3は0にクリアされ、Y座標カウンタ4は1だ
け値が増加する。濃淡整数カウンタ5はY座標カウンタ
4の値が代入され、濃淡補助レジスタ6は0にクリアさ
れる。そして、X座標カウンタ3およびY座標カウンタ
4の値をアドレスとして、濃淡整数カウンタの値が濃淡
画像記憶部10に出力されるとともに、加算部7で濃淡補
助レジスタ6の値とX座標カウンタ3の値を2倍した値
との和が出力され、比較器8は加算部7が出力した値と
濃淡整数カウンタ5の値とを大小比較して、前者が後者
よりも大きいあるいは等しいときのみ条件信号11を出力
する。条件付演算部9は、条件信号11が入力されたとき
加算部7の出力値から濃淡整数カウンタ5の値の2倍の
値を減じた値を出力し、条件信号11が入力されなかった
とき加算部7の出力値に1を加算した値を出力する。濃
淡整数カウンタ5は条件信号11が入力されたときのみ1
だけ増加し、濃淡補助レジスタ6は条件付演算部9の出
力値が代入される。主走査クロック発生部1から主走査
クロック信号12が発生し、X座標カウンタ3の値は1だ
け増加する。そして、X座標カウンタ3およびY座標カ
ウンタ4の値をアドレスとして、濃淡整数カウンタの値
0が濃淡画像記憶部10に出力されるとともに、加算部7
で濃淡補助レジスタ6の値とX座標カウンタ3の値を2
倍した値との和が出力され、比較器8は加算部7が出力
した値と濃淡整数カウンタ5の値とを大小比較して、前
者が後者よりも大きいあるいは等しいときのみ条件信号
11を出力する。条件付演算部9は、条件信号11が入力さ
れたとき加算部7の出力値から濃淡整数カウンタ5の値
の2倍の値を減じた値を出力し、条件信号11が入力され
なかったとき加算部7の出力値に1を加算した値を出力
する。濃淡整数カウンタ5は条件信号11が入力されたと
きのみ1だけ増加し、濃淡補助レジスタ6は条件付演算
部9の出力値が代入される。生成する濃淡画像のX方向
の画素の数だけ主走査クロック信号入力の処理を繰り返
すことによって、濃淡画像の1本の走査線上の全ての画
素の濃淡値が生成できる。
When the gray value of the last pixel on the scanning line is obtained, a sub-scanning clock signal 13 indicating that the scanning line has moved to the next scanning line is generated from the sub-scanning clock generator 2, and the X coordinate counter 3 The value is cleared to 0, and the value of the Y coordinate counter 4 is increased by 1. The value of the Y coordinate counter 4 is substituted into the density integer counter 5, and the density auxiliary register 6 is cleared to zero. Using the values of the X-coordinate counter 3 and the Y-coordinate counter 4 as addresses, the value of the gray-scale integer counter is output to the gray-scale image storage unit 10, and the value of the gray-scale auxiliary register 6 and the X-coordinate counter 3 The sum of the doubled value is output. The comparator 8 compares the value output from the adder 7 with the value of the grayscale integer counter 5 and determines whether the condition signal is larger or equal only when the former is greater than or equal to the latter. Outputs 11. The conditional operation unit 9 outputs a value obtained by subtracting twice the value of the grayscale integer counter 5 from the output value of the addition unit 7 when the condition signal 11 is input, and outputs the value when the condition signal 11 is not input. A value obtained by adding 1 to the output value of the adding unit 7 is output. The grayscale integer counter 5 is 1 only when the condition signal 11 is input.
And the output value of the conditional operation unit 9 is assigned to the gray level auxiliary register 6. The main scanning clock signal 12 is generated from the main scanning clock generator 1, and the value of the X coordinate counter 3 increases by one. Using the values of the X-coordinate counter 3 and the Y-coordinate counter 4 as addresses, the value 0 of the gray-scale integer counter is output to the gray-scale image storage unit 10, and the addition unit 7
Sets the value of the gray level auxiliary register 6 and the value of the X coordinate counter 3 to 2
The sum of the multiplied values is output. The comparator 8 compares the value output by the adder 7 with the value of the grayscale integer counter 5 and determines whether the condition signal is greater than or equal to the former when the latter is greater than or equal to the latter.
Outputs 11. The conditional operation unit 9 outputs a value obtained by subtracting twice the value of the grayscale integer counter 5 from the output value of the addition unit 7 when the condition signal 11 is input, and outputs the value when the condition signal 11 is not input. A value obtained by adding 1 to the output value of the adding unit 7 is output. The gradation integer counter 5 is incremented by 1 only when the condition signal 11 is input, and the output value of the conditional operation unit 9 is substituted in the gradation auxiliary register 6. By repeating the main scanning clock signal input process by the number of pixels in the X direction of the generated gray image, the gray values of all the pixels on one scanning line of the gray image can be generated.

さらに、生成する濃淡画像のY方向の画素の数だけ副
走査クロック信号入力の処理を繰り返すことによって、
必要な面積の濃淡画像の全ての画素の濃淡値が生成でき
る。
Furthermore, by repeating the processing of the sub-scanning clock signal input by the number of pixels in the Y direction of the generated grayscale image,
A gray value of all pixels of a gray image having a required area can be generated.

X座標,Y座標のいずれかがあるいは両方が負の場合に
ついて説明する。
A case will be described in which either the X coordinate or the Y coordinate or both are negative.

生成すべき原点からの距離を濃淡値とする画像F(x,
y)は式(1)で表現されるが、任意のX,Yについて、 が成立するので、濃淡画像の領域を第4図のように、 1)X≧0、かつY≧0 …(24) 2)X<0、かつY≧0 …(25) 3)X<0、かつY<0 …(26) 4)X≧0、かつY<0 …(27) の4つに分割し、図1において0以上の整数X,Yをそれ
ぞれX方向アドレス,Y方向アドレス,濃淡値I(X,Y)
が濃淡画像記憶部に入力されると、 とすれば、X,Yが負の場合にも濃淡値I(X,Y)が得られ
る。
An image F (x,
y) is expressed by equation (1), but for any X and Y, 4) 1) X ≧ 0 and Y ≧ 0 (24) 2) X <0 and Y ≧ 0 (25) 3) X <0 And Y <0 (26) 4) X ≧ 0 and Y <0 (27) In FIG. 1, integers X and Y equal to or greater than 0 in FIG. Gray value I (X, Y)
Is input to the grayscale image storage, Then, even when X and Y are negative, the gray value I (X, Y) can be obtained.

これを第3図で説明すると、濃淡画像を式(24)から
式(27)の4つの領域に分割し、それぞれメモリバンク
36,メモリバンク37,メモリバンク38,メモリバンク39に
対応し、いずれも同じ濃淡値33が入力される。X方向ア
ドレス,Y方向アドレスはインバーター34および35によっ
てそれぞれ正の整数から負の整数に変換される。メモリ
バンク36は正のX方向アドレス,正のY方向アドレスが
入力され、メモリバンク37は負のX方向アドレス,正の
Y方向アドレスが入力され、メモリバンク38は負のX方
向アドレス,負のY方向アドレスが入力され、そしてメ
モリバンク39は正のX方向アドレス,負のY方向アドレ
スが入力される。これによって、濃淡画像記憶部は、X
およびY方向アドレスが負の場合においても濃淡画像を
生成することができる。
This will be described with reference to FIG. 3. The gray image is divided into four regions represented by Expressions (24) to (27), and each region is divided into memory banks.
36, the memory bank 37, the memory bank 38, and the memory bank 39, all of which receive the same gray value 33. The X-direction address and the Y-direction address are converted from a positive integer to a negative integer by inverters 34 and 35, respectively. The memory bank 36 receives a positive X-direction address and a positive Y-direction address, the memory bank 37 receives a negative X-direction address and a positive Y-direction address, and the memory bank 38 receives a negative X-direction address and a negative The Y-direction address is input, and the memory bank 39 receives a positive X-direction address and a negative Y-direction address. Thereby, the grayscale image storage unit stores X
Also, even when the Y-direction address is negative, a grayscale image can be generated.

〔発明の効果〕〔The invention's effect〕

以上説明したように本発明の方法および装置によれ
ば、原点からの距離を四捨五入し整数化した値をその画
素の値とする濃淡画像を生成することができる。
As described above, according to the method and apparatus of the present invention, it is possible to generate a grayscale image in which a value obtained by rounding off the distance from the origin and converting it to an integer is the value of the pixel.

本発明では加算,減算,シフト演算(2倍演算)を用
いるだけなので、生成すべき濃淡画像の1画素毎に平方
根演算する従来法に比べて、計算コストを軽減すること
ができる。
In the present invention, since only addition, subtraction, and shift operations (double operations) are used, the calculation cost can be reduced as compared with the conventional method in which the square root operation is performed for each pixel of the gray image to be generated.

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

第1図は本発明の一実施例を示すブロック図、第2図は
原点からの距離である関数F(X,Y)示した説明図、第
3図は濃淡画像記憶部の内部を示したブロック図、第4
図は濃淡画像の領域をX,Yの正負で4分割したのを示し
た説明図である。 1……主走査クロック発生部、2……副走査クロック発
生部、3……X座標カウンタ、4……Y座標カウンタ、
5……濃淡整数カウンタ、6……濃淡補助レジスタ、7
……加算部、8……比較器、9……条件付演算部、10…
…濃淡画像記憶部。
FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is an explanatory diagram showing a function F (X, Y) which is a distance from an origin, and FIG. 3 shows the inside of a gray image storage unit. Block diagram, 4th
The figure is an explanatory diagram showing that the area of the grayscale image is divided into four parts by positive and negative X and Y. 1, a main scanning clock generating unit, 2, a sub-scanning clock generating unit, 3, an X coordinate counter, a Y coordinate counter,
5: shade integer counter, 6: shade auxiliary register, 7
... Addition unit, 8 Comparator, 9 Conditional operation unit, 10
... A grayscale image storage unit.

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】原点からの距離を四捨五入し整数化した値
をその画素の値とする濃淡画像の生成において、濃淡画
像を直交x−y座標系で表し、まず、y軸上の各画素の
濃淡整数値は該画素のY座標の絶対値とし、該画素の濃
淡補助値は0とし、次に、座標(X,Y)の濃淡整数値お
よび濃淡補助値から該画素と隣接する座標(X+1,Y)
の濃淡整数値および濃淡補助値を求めるのに、座標(X,
Y)の画素のX座標値の2倍と該画素の濃淡補助値との
和から該画素の濃淡整数値を減じる比較演算の結果、0
より大きいあるいは等しいとき、座標(X,Y)の画素の
濃淡整数値に1を加えた値を座標(X+1,Y)の濃淡整
数値とし、座標(X,Y)のX座標値の2倍と該画素の濃
淡補助値との和から該画素の濃淡整数値の2倍を減じた
値を座標(X+1,Y)の画素の濃淡補助値とし、前記比
較演算の結果、0より小さいとき、座標(X,Y)の画素
の濃淡整数値を座標(X+1,Y)の濃淡整数値とし、座
標(X,Y)の画素のX座標値の2倍と該画素の濃淡補助
値との和に1を加えた値を座標(X+1,Y)の濃淡補助
値とし、これを繰り返すことによって画像を生成するこ
とを特徴とする濃淡画像生成方法。
In generating a grayscale image in which a value obtained by rounding a distance from an origin and converting it into an integer is used as a pixel value, the grayscale image is represented by an orthogonal xy coordinate system. The grayscale integer value is the absolute value of the Y coordinate of the pixel, the grayscale auxiliary value of the pixel is 0, and then the coordinate (X + 1) adjacent to the pixel is determined from the grayscale integer value of the coordinates (X, Y) and the grayscale auxiliary value. , Y)
The coordinates (X,
Y) The result of the comparison operation of subtracting the gray value of the pixel from the sum of twice the X coordinate value of the pixel and the gray value of the pixel, 0
If greater or equal, the value obtained by adding 1 to the gray integer value of the pixel at coordinate (X, Y) is taken as the gray integer value of coordinate (X + 1, Y), and twice the X coordinate value of coordinate (X, Y) A value obtained by subtracting twice the gray value of the pixel from the sum of the gray value and the gray value of the pixel is set as the gray value of the pixel at coordinates (X + 1, Y). The grayscale integer value of the pixel at the coordinates (X, Y) is defined as the grayscale integer value of the coordinates (X + 1, Y), and the sum of twice the X coordinate value of the pixel at the coordinates (X, Y) and the grayscale auxiliary value of the pixel A value obtained by adding 1 to a coordinate value (X + 1, Y), and an image is generated by repeating the auxiliary value.
【請求項2】原点からの距離を四捨五入し整数化した値
をその画素の値とする濃淡画像の生成させる装置におい
て、 X軸と平行な走査線上を画素が移動する毎に同期して主
走査クロック信号を発生させる主走査クロック発生部
と、 前記走査線がY軸方向に移動する毎に同期して副走査ク
ロック信号を発生させる副走査クロック発生部と、 前記主走査クロック信号の入力で値が1ずつ増加し、前
記副走査クロック信号の入力で値が0にクリアされるX
座標カウンタと、 前記副走査クロック信号の入力で値が1ずつ増加するY
座標カウンタと、副走査クロック信号の入力時に前記Y
座標カウンタの値が代入され、一つ前に処理した画素の
濃淡整数値に比べて1増加させるか否かを示す条件信号
の入力によって、値が1ずつ増加する濃淡整数カウンタ
と、 副走査クロック信号の入力時に値が0にクリアされる濃
淡補助レジスタと、 前記X座標レジスタの値を2倍した値と前記補助整数レ
ジスタの値とを加算する加算部と、 前記加算部の値と前記濃淡整数カウンタとの値を大小比
較し、前者の値が大きいあるいは等しい場合、前記条件
信号を発生する比較器と、 前記条件信号が入力された場合、前記加算部の値から前
記濃淡整数カウンタの値の2倍の値を減算した値を前記
濃淡補助レジスタに代入し、前記条件信号が入力されな
かった場合、前記加算部の値に1を加算した値を前記濃
淡補助レジスタに代入する条件付演算部と、 前記X座標カウンタの値をX方向のアドレスとし、前記
Y座標カウンタの値をY方向のアドレスとし、前記濃淡
レジスタの値をその画素の濃淡値として格納する濃淡画
像記憶部とを備えることを特徴とする濃淡画像生成装
置。
2. A device for generating a grayscale image in which a value obtained by rounding off a distance from an origin and converting it into an integer, the value of the pixel being provided, wherein a main scan is performed in synchronization with each movement of a pixel on a scanning line parallel to the X axis. A main scanning clock generator that generates a clock signal; a sub-scanning clock generator that generates a sub-scanning clock signal in synchronization with each movement of the scanning line in the Y-axis direction; Increases by one, and the value is cleared to 0 by the input of the sub-scanning clock signal X
A coordinate counter, and Y whose value increases by 1 upon input of the sub-scanning clock signal
A coordinate counter and the Y counter when a sub-scanning clock signal is input.
A gray-scale integer counter whose value is incremented by one by inputting a condition signal indicating whether or not the value of the coordinate counter is substituted and incremented by one from the gray-scale integer value of the pixel processed immediately before; A gray level auxiliary register whose value is cleared to 0 when a signal is input; an adder for adding a value obtained by doubling a value of the X coordinate register to a value of the auxiliary integer register; a value of the adder and the gray level The value of the integer counter is compared with the value of the integer counter. If the former value is larger or equal, the comparator generates the condition signal. A conditional operation of substituting a value obtained by subtracting twice the value of the above into the gray level auxiliary register, and substituting a value obtained by adding 1 to the value of the adder into the gray level auxiliary register when the condition signal is not inputted. Department A gray-scale image storage unit that stores the value of the X-coordinate counter in an X-direction, the value of the Y-coordinate counter in a Y-direction, and stores the value of the gray-scale register as a gray-scale value of the pixel. A gray-scale image generation device characterized by the following.
JP23801589A 1989-09-12 1989-09-12 Shading image generation method and apparatus Expired - Lifetime JP2861106B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23801589A JP2861106B2 (en) 1989-09-12 1989-09-12 Shading image generation method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23801589A JP2861106B2 (en) 1989-09-12 1989-09-12 Shading image generation method and apparatus

Publications (2)

Publication Number Publication Date
JPH0399378A JPH0399378A (en) 1991-04-24
JP2861106B2 true JP2861106B2 (en) 1999-02-24

Family

ID=17023888

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23801589A Expired - Lifetime JP2861106B2 (en) 1989-09-12 1989-09-12 Shading image generation method and apparatus

Country Status (1)

Country Link
JP (1) JP2861106B2 (en)

Also Published As

Publication number Publication date
JPH0399378A (en) 1991-04-24

Similar Documents

Publication Publication Date Title
EP0360155B1 (en) Image transformation method and device
US5136660A (en) Apparatus and method for computing the radon transform of digital images
US4607340A (en) Line smoothing circuit for graphic display units
JP3243894B2 (en) Shading image processing device
JPH0660173A (en) Method and apparatus for reducing picture
US5351315A (en) Apparatus for smoothing outlines of images
JP2861106B2 (en) Shading image generation method and apparatus
JP2634851B2 (en) Image processing device
JP2861097B2 (en) Shading image generation method and apparatus
EP0719034A1 (en) Improved character smoothing in scanners/printers
US5297244A (en) Method and system for double error antialiasing in a computer display system
US5165070A (en) Special effect generator with limited read address calculation region
JP3517982B2 (en) Drawing device
JPH0636039A (en) Texture mapping device
JP2910101B2 (en) Vector font data component point correction device
JPH01241681A (en) Image processor
JPH04333988A (en) Image data access method
EP0410718B1 (en) Video special effects generators
JP3611898B2 (en) Image processing device
JPS6366678A (en) Image processor
JPH07101918B2 (en) Image processing device
JP2000322565A (en) Image data correcting circuit
JPH09282474A (en) Gradational image generating method
JP2977226B2 (en) Nonlinear normalization method for characters
JPS62205482A (en) Segment generating circuit of crt display device