JP6122322B2 - Image processing apparatus, program, and integrated circuit - Google Patents

Image processing apparatus, program, and integrated circuit Download PDF

Info

Publication number
JP6122322B2
JP6122322B2 JP2013062952A JP2013062952A JP6122322B2 JP 6122322 B2 JP6122322 B2 JP 6122322B2 JP 2013062952 A JP2013062952 A JP 2013062952A JP 2013062952 A JP2013062952 A JP 2013062952A JP 6122322 B2 JP6122322 B2 JP 6122322B2
Authority
JP
Japan
Prior art keywords
evaluation value
pixel
line segment
point
density
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 - Fee Related
Application number
JP2013062952A
Other languages
Japanese (ja)
Other versions
JP2014186682A (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.)
MegaChips Corp
Original Assignee
MegaChips Corp
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 MegaChips Corp filed Critical MegaChips Corp
Priority to JP2013062952A priority Critical patent/JP6122322B2/en
Publication of JP2014186682A publication Critical patent/JP2014186682A/en
Application granted granted Critical
Publication of JP6122322B2 publication Critical patent/JP6122322B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Generation (AREA)

Description

本発明は、画像処理技術に関し、特に、線分描画時に生じるエイリアシングを低減するための技術に関する。   The present invention relates to an image processing technique, and more particularly to a technique for reducing aliasing that occurs during line segment drawing.

線分描画のアルゴリズムとして、ブレゼンハムアルゴリズムがある。このブレゼンハムアルゴリズムは、与えられた始点と終点の間に連続した点を置き、近似的な直線を引くためのアルゴリズムである。ブレゼンハムアルゴリズムでは、乗除算を行うことなく加減算のみで処理できるため、少ない演算量で線分描画を行うことができる。   There is a Bresenham algorithm as a line drawing algorithm. The Bresenham algorithm is an algorithm for placing an approximate straight line by placing continuous points between a given start point and end point. In the Bresenham algorithm, processing can be performed only by addition and subtraction without performing multiplication and division, so that a line segment can be drawn with a small amount of calculation.

しかしながら、ブレゼンハムアルゴリズムでは、例えば、斜めの直線を階段状に配置された画素により表示するため、表示画面上にジャギーと呼ばれるギザギザが発生する。   However, in the Bresenham algorithm, for example, since an oblique straight line is displayed by pixels arranged in a staircase pattern, jaggedness called jaggy occurs on the display screen.

このジャギーを目立たないようにするために、多様なアンチエイリアス手法が提案されている。アンチエイリアス手法の1つにパワーサンプリング手法がある。このパワーサンプリング手法では、まず、実際の解像度よりも高解像度で線分描画を行う。そして、その線分描画結果を実際の解像度に戻すときに、実際の解像度での各画素において、高解像度で線分描画したときの線分を含む割合に基づいて、各画素の画素値を設定する。これにより、パワーサンプリング手法では、エイリアス成分を抑制することができ、ジャギーを目立たないようにすることができる。   Various anti-aliasing methods have been proposed to make this jaggy inconspicuous. One of anti-aliasing methods is a power sampling method. In this power sampling method, first, a line segment is drawn at a higher resolution than the actual resolution. And when returning the line segment drawing result to the actual resolution, the pixel value of each pixel is set based on the ratio including the line segment when the line segment is drawn at a high resolution in each pixel at the actual resolution. To do. Thereby, in a power sampling method, an alias component can be suppressed and jaggy can be made not conspicuous.

また、斜めの直線を描画するときに、エイリアス成分を抑制し、ジャギーを目立たないようにするために、線分とその背景との境界に位置する画素(境界画素)における斜線部分の面積を計算し、その結果に基づいて、当該画素の画素値を設定する方法や、境界画素の色の濃度を算出し、算出した色の濃度に基づいて、境界画素の画素値を設定する方法がある(例えば、特許文献1)。   In addition, when drawing an oblique line, the area of the hatched portion of the pixel (boundary pixel) located at the boundary between the line segment and its background is calculated in order to suppress alias components and make the jaggy inconspicuous. Then, there are a method for setting the pixel value of the pixel based on the result, and a method for calculating the color density of the boundary pixel and setting the pixel value of the boundary pixel based on the calculated color density ( For example, Patent Document 1).

特許第4749868号公報Japanese Patent No. 4749868

しかしながら、上記パワーサンプリング手法では、実際より高解像度で線分描画を行う必要があり、必要なメモリ量が多くなる。また、上記従来技術では、境界画素の面積の算出や、境界画素の色の濃度の算出といった複雑な計算を行う必要がある。   However, in the power sampling method, it is necessary to perform line segment drawing at a higher resolution than actual, and the amount of memory required increases. Further, in the above-described prior art, it is necessary to perform complicated calculations such as calculation of the area of the boundary pixel and calculation of the density of the color of the boundary pixel.

そこで、本発明は、上記問題点に鑑み、大容量のメモリや複雑な演算処理を必要とせず、線分描画時に生じるエイリアシングを効果的に低減する画像処理装置およびプログラムを実現することを目的とする。   SUMMARY OF THE INVENTION In view of the above problems, the present invention has an object to realize an image processing apparatus and a program that effectively reduce aliasing that occurs during line segment drawing without requiring a large-capacity memory or complicated arithmetic processing. To do.

上記課題を解決するために、第1の発明は、画像上において、線分を描画するための線分描画情報を取得するための画像処理装置であって、入力部と、線分描画情報取得部と、を備える。   In order to solve the above-mentioned problem, a first invention is an image processing apparatus for acquiring line segment drawing information for drawing a line segment on an image, comprising an input unit and line segment drawing information acquisition A section.

入力部は、線分を描画するための情報を入力するための機能部である。   The input unit is a functional unit for inputting information for drawing a line segment.

線分描画情報取得部は、線分を描画するための描画情報を取得する。   The line segment drawing information acquisition unit acquires drawing information for drawing a line segment.

線分描画情報取得部は、評価値取得部と、閾値設定部と、描画情報決定部とを備える。   The line segment drawing information acquisition unit includes an evaluation value acquisition unit, a threshold setting unit, and a drawing information determination unit.

評価値取得部は、描画対象画素である画素P(xa,ya)と、線分の始点と終点とを通る直線と、の位置関係を示す評価値Dを取得する。   The evaluation value acquisition unit acquires an evaluation value D indicating the positional relationship between the pixel P (xa, ya) that is the drawing target pixel and a straight line that passes through the start point and end point of the line segment.

閾値設定部は、線分の始点から終点までのx方向の差分量dxと、線分の始点から終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する。   The threshold setting unit calculates at least three threshold values Th1, Th2, and Th3 based on the difference amount dx in the x direction from the start point to the end point of the line segment and the difference amount dy in the y direction from the start point to the end point of the line segment. Set.

描画情報決定部は、評価値Dと閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する。   The drawing information determination unit, based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa of the drawing target pixel in the y-axis positive direction). , Ya + 1) is determined.

そして、評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たし、
閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たす。
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: satisfies a positive real number,
The thresholds Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
Meet.

評価値取得部は、評価値Dを差分量dyに基づいて更新し、更新した評価値Dが1.5×dx×k以上である場合、更新した評価値Dをさらに差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定する。また、評価値取得部は、更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する。   The evaluation value acquisition unit updates the evaluation value D based on the difference amount dy. When the updated evaluation value D is 1.5 × dx × k or more, the evaluation value D is further updated based on the difference amount dx. In addition to updating, the next drawing target pixel is determined to be P (xa + 1, ya + 1). In addition, when the updated evaluation value D is less than 1.5 × dx × k, the evaluation value acquisition unit determines the next drawing target pixel as P (xa + 1, ya).

この画像処理装置では、評価値Dが−0.5×dx×k≦D≦1.5×dx×kを満たす、つまり、評価値Dのループ区間が−0.5×dx×k〜1.5×dx×kに設定され、少なくとも3つの閾値Th1、Th2、Th3により、上記ループ区間を少なくとも4つの区間に分け、評価値Dがどの区間の値であるかによって、描画対象画素P(xa,ya)の描画色の濃度と描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とが決定される。   In this image processing apparatus, the evaluation value D satisfies −0.5 × dx × k ≦ D ≦ 1.5 × dx × k, that is, the loop section of the evaluation value D is −0.5 × dx × k to 1. .5 × dx × k, the loop section is divided into at least four sections by at least three threshold values Th1, Th2, Th3, and the drawing target pixel P ( The density of the drawing color of xa, ya) and the density of the drawing color of the adjacent pixel P (xa, ya + 1) in the positive y-axis direction of the drawing target pixel are determined.

つまり、この画像処理装置では、評価値Dに基づく場合分けによって、描画対象画素P(xa,ya)とその隣接画素P(xa,ya+1)との描画色の濃度(画素値)を、中間調を表現するように決定できるので、線分描画時に生じるエイリアシングを効果的に低減することができる。さらに、この画像処理装置では、評価値Dに基づく場合分けによって、描画処理を実行できるので、パワーサンプリング手法のように解像度を上げる処理を行う必要がない。その結果、この画像処理装置では、大容量のメモリ等は不要であり、また、解像度変換や、1つの画素中において線分が占める面積の計算等の複雑な演算処理も不要である。   That is, in this image processing apparatus, the density (pixel value) of the drawing color of the drawing target pixel P (xa, ya) and its adjacent pixel P (xa, ya + 1) is divided into halftones based on the case classification based on the evaluation value D. Therefore, aliasing that occurs during line segment drawing can be effectively reduced. Furthermore, in this image processing apparatus, since the drawing process can be executed according to the case classification based on the evaluation value D, it is not necessary to perform the process of increasing the resolution unlike the power sampling method. As a result, this image processing apparatus does not require a large-capacity memory or the like, and does not require complicated arithmetic processing such as resolution conversion and calculation of the area occupied by a line segment in one pixel.

第2の発明は、第1の発明であって、評価値Dの初期値は、「0」である。   2nd invention is 1st invention, Comprising: The initial value of the evaluation value D is "0".

描画情報決定部は、
(1)評価値Dが−0.5×dx×k≦D<Th1を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DAとし、
(2)評価値DがTh1≦D<Th2を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DB1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DB2とし、
(3)評価値DがTh2≦D<Th3を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DC1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DC2とし、
(4)評価値DがTh3≦D<1.5×dx×kを満たす場合、画素P(xa,ya)の描画色の濃度を濃度DD1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DD2とする。
The drawing information determination unit
(1) When the evaluation value D satisfies −0.5 × dx × k ≦ D <Th1, the density of the drawing color of the pixel P (xa, ya) is the density DA,
(2) When the evaluation value D satisfies Th1 ≦ D <Th2, the density of the drawing color of the pixel P (xa, ya) is set to the density DB1, and the density of the drawing color of the pixel P (xa, ya + 1) is set to the density DB2. age,
(3) When the evaluation value D satisfies Th2 ≦ D <Th3, the density of the drawing color of the pixel P (xa, ya) is set to the density DC1, and the density of the drawing color of the pixel P (xa, ya + 1) is set to the density DC2. age,
(4) When the evaluation value D satisfies Th3 ≦ D <1.5 × dx × k, the density of the drawing color of the pixel P (xa, ya) is set to the density DD1, and the drawing of the pixel P (xa, ya + 1) is performed. The color density is set to density DD2.

そして、描画色の濃度の値が大きい程、描画色の濃度が濃くなるように設定した場合、濃度DA、DB1、DB2、DC1、DC2、DD1、および、DD2は、
DA≧DB1≧DC1≧DD1
DB2≦DC2≦DD2
を満たす。
When the drawing color density is set to be higher as the drawing color density value is larger, the densities DA, DB1, DB2, DC1, DC2, DD1, and DD2 are:
DA ≧ DB1 ≧ DC1 ≧ DD1
DB2 ≦ DC2 ≦ DD2
Meet.

これにより、この画像処理装置では、同列に位置する描画画素(x座標位置が同一の描画画素)の重心位置が、線分の始点と終点とを通る直線と近くなるように、評価値Dに基づいて、描画画素およびその画素値(描画色の濃度)を決定することができる。   Thereby, in this image processing apparatus, the evaluation value D is set so that the gravity center position of the drawing pixels located in the same row (drawing pixels having the same x coordinate position) is close to the straight line passing through the start point and the end point of the line segment. Based on this, the drawing pixel and its pixel value (drawing color density) can be determined.

つまり、この画像処理装置では、横方向(x軸方向)および縦方向(y軸方向)に解像度を2倍にした場合にどのように描画位置がずれるかを考慮し、評価値Dのループ区間を分ける閾値Th1〜Th3を決定し、評価値Dが分割したループ区間のどの範囲に含まれるかによって、描画画素とその画素値(描画色の濃度)を決定するので、パワーサンプリング手法(オーバーサンプリング手法)と同様に、エイリアス成分を抑制することができる。その結果、この画像処理装置により描画した線分では、ジャギー(エイリアス成分)が目立たない。   That is, in this image processing apparatus, the loop section of the evaluation value D is considered in consideration of how the drawing position is shifted when the resolution is doubled in the horizontal direction (x-axis direction) and the vertical direction (y-axis direction). Threshold values Th1 to Th3 are determined, and the drawing pixel and its pixel value (drawing color density) are determined depending on which range of the divided loop section the evaluation value D is included. As with the method, alias components can be suppressed. As a result, jaggy (alias component) is not noticeable in the line segment drawn by the image processing apparatus.

そして、この画像処理装置では、場合分けによって、描画処理を実行することができ、実際に解像度を上げる処理等を行う必要がないので、パワーサンプリング手法(オーバーサンプリング手法)とは異なり、大容量のメモリは不要である。   In this image processing apparatus, drawing processing can be executed depending on the case, and it is not necessary to actually perform processing for increasing the resolution. Therefore, unlike the power sampling method (oversampling method), the image processing apparatus has a large capacity. No memory is required.

したがって、この画像処理装置では、大容量のメモリや複雑な演算処理を必要とせず、線分描画時に生じるエイリアシングを効果的に低減することができる。   Therefore, this image processing apparatus does not require a large-capacity memory or complicated arithmetic processing, and can effectively reduce aliasing that occurs during line segment drawing.

なお、(上記とは逆に)描画色の濃度の値が小さい程、描画色の濃度が濃くなるように設定した場合、前記濃度DA、DB1、DB2、DC1、DC2、DD1、および、DD2は、
DA≦DB1≦DC1≦DD1
DB2≧DC2≧DD2
を満たすようにすればよい。
When the density of the drawing color is set to be higher as the drawing color density value is smaller (as opposed to the above), the density DA, DB1, DB2, DC1, DC2, DD1, and DD2 are ,
DA ≦ DB1 ≦ DC1 ≦ DD1
DB2 ≧ DC2 ≧ DD2
It only has to satisfy.

第3の発明は、第1または第2の発明であって、評価値取得部は、
D=D+2×dy×k
により、評価値Dを更新する。
3rd invention is 1st or 2nd invention, Comprising: Evaluation value acquisition part,
D = D + 2 × dy × k
Thus, the evaluation value D is updated.

そして、更新した評価値Dが1.5×dx×k以上である場合、更新した評価値Dをさらに、
D=D−2×dx×k
により更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定する。
If the updated evaluation value D is 1.5 × dx × k or more, the updated evaluation value D is further
D = D−2 × dx × k
And the next drawing target pixel is determined to be P (xa + 1, ya + 1).

これにより、ブレゼンハムアルゴリズムと同様に、描画対象画素を適切に特定することができる。   Thereby, similarly to the Bresenham algorithm, it is possible to appropriately specify the drawing target pixel.

第4の発明は、第1から第3のいずれかの発明であって、座標変換部と、座標逆変換部と、さらに備える。   A fourth invention is any one of the first to third inventions, and further includes a coordinate conversion unit and a coordinate reverse conversion unit.

座標変換部は、第1点と第2点とを結ぶ直線の傾きが0以上1以下でない場合、第3点と第4点とを結ぶ直線の傾きが0以上1以下となるように、第1点を第3点に座標変換し、第2点を第4点に座標変換する座標変換処理を行う。   When the slope of the straight line connecting the first point and the second point is not 0 or more and 1 or less, the coordinate conversion unit is configured so that the slope of the straight line connecting the third point and the fourth point is 0 or more and 1 or less. A coordinate conversion process is performed in which one point is converted into a third point and the second point is converted into a fourth point.

座標逆変換部は、座標変換処理の座標逆変換処理を行う。   The coordinate reverse conversion unit performs a coordinate reverse conversion process of the coordinate conversion process.

そして、線分描画情報取得部は、第3点を線分の始点とし、第4点を線分の終点として、第3点と第4点とを結ぶ線分を描画するための描画情報を取得する。   Then, the line segment drawing information acquisition unit uses the third point as the start point of the line segment, the fourth point as the end point of the line segment, and the drawing information for drawing the line segment connecting the third point and the fourth point. get.

座標逆変換部は、線分描画情報取得部により取得された第3点と第4点とを結ぶ線分を描画するための描画情報に含まれる座標位置情報に対して、座標逆変換処理を行う。   The coordinate reverse conversion unit performs a coordinate reverse conversion process on the coordinate position information included in the drawing information for drawing the line segment connecting the third point and the fourth point acquired by the line segment drawing information acquisition unit. Do.

この画像処理装置では、座標変換して、第1から第3のいずれかの発明と同様の描画処理を実行し、その後、座標逆変換することで、任意の線分(任意の傾きの線分)の描画処理が実行される。したがって、この画像処理装置では、線分の傾きごとに、別々の場合分けをすることなく、第1から第3のいずれかの発明と同様の処理のみを用いて、描画処理を実行することができる。その結果、この画像処理装置では、大容量のメモリや複雑な演算処理を必要とせず、線分描画時に生じるエイリアシングを効果的に低減することができる。   In this image processing apparatus, coordinate conversion is performed, drawing processing similar to that of any one of the first to third inventions is performed, and then, by performing reverse coordinate conversion, any line segment (line segment having an arbitrary inclination) is performed. ) Is executed. Therefore, in this image processing apparatus, it is possible to execute the drawing process using only the same process as in any one of the first to third inventions without dividing the case for each inclination of the line segment. it can. As a result, this image processing apparatus does not require a large-capacity memory or complicated arithmetic processing, and can effectively reduce aliasing that occurs during line drawing.

第5の発明は、第1から第4のいずれかの発明であって、係数kは、
k=2×n(nは自然数)
である。
The fifth invention is the invention of any one of the first to fourth, wherein the coefficient k is:
k = 2 × n (n is a natural number)
It is.

この画像処理装置では、係数kが2の倍数となるため、描画処理(評価値Dと閾値との比較処理や、評価値Dの更新処理等)を整数演算のみで実現することができる。   In this image processing apparatus, since the coefficient k is a multiple of 2, rendering processing (e.g., comparison processing between the evaluation value D and the threshold value, update processing of the evaluation value D) can be realized only by integer arithmetic.

第6の発明は、画像上において、線分を描画するための線分描画情報を取得するための画像処理方法をコンピュータに実行させるためのプログラムである。   A sixth invention is a program for causing a computer to execute an image processing method for acquiring line segment drawing information for drawing a line segment on an image.

画像処理方法は、入力ステップと、線分描画情報取得ステップと、を備える。   The image processing method includes an input step and a line segment drawing information acquisition step.

入力ステップは、線分を描画するための情報を入力するためのステップである。   The input step is a step for inputting information for drawing a line segment.

線分描画情報取得ステップは、線分を描画するための描画情報を取得する。   The line segment drawing information acquisition step acquires drawing information for drawing a line segment.

線分描画情報取得ステップは、評価値取得ステップと、閾値設定ステップと、描画情報決定ステップとを備える。   The line segment drawing information acquisition step includes an evaluation value acquisition step, a threshold setting step, and a drawing information determination step.

評価値取得ステップは、描画対象画素である画素P(xa,ya)と、線分の始点および線分の終点とを通る直線と、の位置関係を示す評価値Dを取得する。   The evaluation value acquisition step acquires an evaluation value D indicating a positional relationship between the pixel P (xa, ya) that is the drawing target pixel and a straight line passing through the start point and the end point of the line segment.

閾値設定ステップは、線分の始点から終点までのx方向の差分量dxと、線分の始点から終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する。   In the threshold setting step, at least three threshold values Th1, Th2, and Th3 are set based on the difference amount dx in the x direction from the start point to the end point of the line segment and the difference amount dy in the y direction from the start point to the end point of the line segment. Set.

描画情報決定ステップは、評価値Dと閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する。   In the drawing information determination step, based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa in the y-axis positive direction of the drawing target pixel) , Ya + 1) is determined.

そして、評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たす。
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: a positive real number is satisfied.

閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たす。
The thresholds Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
Meet.

評価値取得ステップは、評価値Dを差分量dyに基づいて更新し、更新した評価値Dが1.5×dx×k以上である場合、更新した評価値Dをさらに差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定する。また、評価値取得ステップは、更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する。   The evaluation value acquisition step updates the evaluation value D based on the difference amount dy. When the updated evaluation value D is 1.5 × dx × k or more, the evaluation value D is further updated based on the difference amount dx. In addition to updating, the next drawing target pixel is determined to be P (xa + 1, ya + 1). In the evaluation value acquisition step, when the updated evaluation value D is less than 1.5 × dx × k, the next drawing target pixel is determined to be P (xa + 1, ya).

これにより、第1の発明と同様の効果を奏するプログラムを実現することができる。   As a result, it is possible to realize a program that exhibits the same effects as those of the first invention.

第7の発明は、画像上において、線分を描画するための線分描画情報を取得するための画像処理用の集積回路であって、入力部と、線分描画情報取得部と、を備える。   A seventh invention is an integrated circuit for image processing for acquiring line segment drawing information for drawing a line segment on an image, and includes an input unit and a line segment drawing information acquisition unit .

入力部は、線分を描画するための情報を入力するための機能部である。   The input unit is a functional unit for inputting information for drawing a line segment.

線分描画情報取得部は、線分を描画するための描画情報を取得する。   The line segment drawing information acquisition unit acquires drawing information for drawing a line segment.

線分描画情報取得部は、評価値取得部と、閾値設定部と、描画情報決定部とを備える。   The line segment drawing information acquisition unit includes an evaluation value acquisition unit, a threshold setting unit, and a drawing information determination unit.

評価値取得部は、描画対象画素である画素P(xa,ya)と、線分の始点と終点とを通る直線と、の位置関係を示す評価値Dを取得する。   The evaluation value acquisition unit acquires an evaluation value D indicating the positional relationship between the pixel P (xa, ya) that is the drawing target pixel and a straight line that passes through the start point and end point of the line segment.

閾値設定部は、線分の始点から終点までのx方向の差分量dxと、線分の始点から終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する。   The threshold setting unit calculates at least three threshold values Th1, Th2, and Th3 based on the difference amount dx in the x direction from the start point to the end point of the line segment and the difference amount dy in the y direction from the start point to the end point of the line segment. Set.

描画情報決定部は、評価値Dと閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する。   The drawing information determination unit, based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa of the drawing target pixel in the y-axis positive direction). , Ya + 1) is determined.

そして、評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たし、
閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たす。
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: satisfies a positive real number,
The thresholds Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
Meet.

評価値取得部は、評価値Dを差分量dyに基づいて更新し、更新した評価値Dが1.5×dx×k以上である場合、更新した評価値Dをさらに差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定する。また、評価値取得部は、更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する。   The evaluation value acquisition unit updates the evaluation value D based on the difference amount dy. When the updated evaluation value D is 1.5 × dx × k or more, the evaluation value D is further updated based on the difference amount dx. In addition to updating, the next drawing target pixel is determined to be P (xa + 1, ya + 1). In addition, when the updated evaluation value D is less than 1.5 × dx × k, the evaluation value acquisition unit determines the next drawing target pixel as P (xa + 1, ya).

これにより、第1の発明と同様の効果を奏する集積回路を実現することができる。   Thus, an integrated circuit that exhibits the same effect as that of the first invention can be realized.

なお、集積回路は、レンダリングモジュール等を含む概念である。   The integrated circuit is a concept including a rendering module and the like.

本発明によれば、大容量のメモリや複雑な演算処理を必要とせず、線分描画時に生じるエイリアシングを効果的に低減する画像処理装置およびプログラムを実現することができる。   According to the present invention, it is possible to realize an image processing apparatus and program that can effectively reduce aliasing that occurs during line segment drawing without requiring a large-capacity memory or complicated arithmetic processing.

第1実施形態に係る画像処理システム1000の概略構成図。1 is a schematic configuration diagram of an image processing system 1000 according to a first embodiment. 第1実施形態に係る画像処理システム1000の処理フローチャート。5 is a process flowchart of the image processing system 1000 according to the first embodiment. 第1実施形態に係る画像処理システム1000による線分描画処理の結果(一例)を示す図。The figure which shows the result (an example) of the line segment drawing process by the image processing system 1000 concerning 1st Embodiment. 第1実施形態に係る画像処理システム1000による線分描画処理の結果(一例)を示す図。The figure which shows the result (an example) of the line segment drawing process by the image processing system 1000 concerning 1st Embodiment. 第1実施形態に係る画像処理システム1000による線分描画処理の結果(一例)とブレゼンハムアルゴリズムによる線分描画処理結果とを示す図。The figure which shows the result (an example) of the line drawing process by the image processing system 1000 which concerns on 1st Embodiment, and the line drawing process result by a Bresenham algorithm. 従来のブレゼンハムアルゴリズムによる線分描画処理について説明するための図。The figure for demonstrating the line segment drawing process by the conventional Bresenham algorithm. 解像度を縦方向(y軸方向)に2倍にした場合の評価値Dのループ区間と、画素のずれ量との関係を模式的に示す図。The figure which shows typically the relationship between the loop area of the evaluation value D at the time of doubling the resolution in the vertical direction (y-axis direction) and the amount of pixel shift. 解像度を横方向(x軸方向)に2倍にした場合の評価値Dのループ区間と、画素のずれ量との関係を模式的に示す図。The figure which shows typically the relationship between the loop area of the evaluation value D at the time of doubling the resolution in the horizontal direction (x-axis direction), and the pixel shift amount. dy≦0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図。The figure which shows typically the correspondence of the evaluation value D in the case of dy <= 0.5xdx, a drawing object pixel, and a pixel value. dy>0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図。The figure which shows typically the correspondence of the evaluation value D in the case of dy> 0.5xdx, a drawing object pixel, and a pixel value. dy≦0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図。The figure which shows typically the correspondence of the evaluation value D in the case of dy <= 0.5xdx, a drawing object pixel, and a pixel value. dy>0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図。The figure which shows typically the correspondence of the evaluation value D in the case of dy> 0.5xdx, a drawing object pixel, and a pixel value. 第1実施形態に係る画像処理システム1000の処理を一般化した場合のフローチャート。6 is a flowchart when the processing of the image processing system 1000 according to the first embodiment is generalized. 第1実施形態の第1変形例に係る画像処理システム1000Aの概略構成図。The schematic block diagram of 1000 A of image processing systems which concern on the 1st modification of 1st Embodiment. 座標変換を説明するための図。The figure for demonstrating coordinate transformation.

[第1実施形態]
第1実施形態について、図面を参照しながら、以下、説明する。
[First Embodiment]
The first embodiment will be described below with reference to the drawings.

<1.1:画像処理システムの構成>
図1は、第1実施形態に係る画像処理システム1000の概略構成図である。
<1.1: Configuration of Image Processing System>
FIG. 1 is a schematic configuration diagram of an image processing system 1000 according to the first embodiment.

画像処理システム1000は、図1に示すように、画像処理装置1と、表示用メモリ2と、表示部3と、を備える。   As shown in FIG. 1, the image processing system 1000 includes an image processing device 1, a display memory 2, and a display unit 3.

画像処理装置1は、図1に示すように、入力部11と、閾値設定部12と、評価値取得部13と、描画情報決定部14とを備える。   As illustrated in FIG. 1, the image processing apparatus 1 includes an input unit 11, a threshold setting unit 12, an evaluation value acquisition unit 13, and a drawing information determination unit 14.

入力部11は、描画する線分についての情報(以下、「線分情報」という。)を入力するための機能部である。例えば、表示部3の表示画面に表示される画像上において、始点(x1,y1)から終点(x2,y2)に線分を描画する場合、入力部1には、線分の始点の情報、終点の情報、線分の太さ、線分の色、線分の色の濃度等の線分情報が入力される。入力部11は、線分情報を、閾値設定部12と、評価値取得部13と、描画情報決定部14とに出力する。   The input unit 11 is a functional unit for inputting information about a line segment to be drawn (hereinafter referred to as “line segment information”). For example, when drawing a line segment from the start point (x1, y1) to the end point (x2, y2) on the image displayed on the display screen of the display unit 3, the input unit 1 includes information on the start point of the line segment, Line segment information such as end point information, line segment thickness, line segment color, and line segment color density is input. The input unit 11 outputs the line segment information to the threshold value setting unit 12, the evaluation value acquisition unit 13, and the drawing information determination unit 14.

閾値設定部12は、入力部11から出力される線分情報を入力し、線分情報から描画対象画素P(xa,ya)の色濃度(例えば、画素値)と、描画対象画素P(xa,ya)のy軸正方向の隣接画素P(xa,ya+1)の色濃度(例えば、画素値)とを決定するための閾値を少なくとも3つ設定する。なお、この閾値をTh1、Th2、および、Th3とする。そして、閾値設定部12は、設定した閾値の情報を描画情報決定部14に出力する。   The threshold setting unit 12 receives the line segment information output from the input unit 11, and from the line segment information, the color density (for example, pixel value) of the drawing target pixel P (xa, ya) and the drawing target pixel P (xa , Ya) is set to at least three threshold values for determining the color density (for example, pixel value) of the adjacent pixel P (xa, ya + 1) in the y-axis positive direction. The threshold values are Th1, Th2, and Th3. Then, the threshold setting unit 12 outputs the set threshold information to the drawing information determination unit 14.

評価値取得部13は、入力部11から出力される線分情報を入力し、線分情報から描画対象画素である画素P(xa,ya)と、前記始点(x1,y1)および前記終点(x2,y2)を通る直線と、の位置関係を示す評価値Dを取得する。そして、評価値取得部13は、取得した評価値Dに関する情報を描画情報決定部14に出力する。   The evaluation value acquisition unit 13 receives the line segment information output from the input unit 11, and from the line segment information, the pixel P (xa, ya) that is the drawing target pixel, the start point (x1, y1), and the end point ( An evaluation value D indicating the positional relationship with the straight line passing through x2, y2) is acquired. Then, the evaluation value acquisition unit 13 outputs information about the acquired evaluation value D to the drawing information determination unit 14.

描画情報決定部14は、入力部11から出力される線分情報と、閾値設定部12から出力される閾値の情報と、評価値取得部13から出力される評価値Dに関する情報を入力する。描画情報決定部14は、線分情報と、閾値設定部12により設定された閾値Th1、Th2、Th3と、評価値Dとに基づいて、描画対象画素P(xa,ya)の描画色の濃度(例えば、画素値)と前記描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度(例えば、画素値)とを決定する。そして、描画情報決定部14は、描画対象画素P(xa,ya)の描画色の濃度が決定した値となるように、表示用メモリ2の描画対象画素P(xa,ya)に対応するアドレスにデータを書き込む。また、描画情報決定部14は、隣接画素P(xa,ya+1)の描画色の濃度が決定した値となるように、表示用メモリ2の描画対象画素P(xa,ya+1)に対応するアドレスにデータを書き込む。   The drawing information determination unit 14 inputs line segment information output from the input unit 11, threshold information output from the threshold setting unit 12, and information related to the evaluation value D output from the evaluation value acquisition unit 13. The drawing information determination unit 14 determines the density of the drawing color of the drawing target pixel P (xa, ya) based on the line segment information, the threshold values Th1, Th2, Th3 set by the threshold setting unit 12, and the evaluation value D. (For example, pixel value) and the density (for example, pixel value) of the drawing color of the adjacent pixel P (xa, ya + 1) in the positive y-axis direction of the drawing target pixel are determined. The drawing information determination unit 14 then addresses corresponding to the drawing target pixel P (xa, ya) in the display memory 2 so that the drawing color density of the drawing target pixel P (xa, ya) becomes the determined value. Write data to. Further, the drawing information determination unit 14 sets an address corresponding to the drawing target pixel P (xa, ya + 1) in the display memory 2 so that the density of the drawing color of the adjacent pixel P (xa, ya + 1) becomes the determined value. Write data.

表示用メモリ2は、表示部3の表示画面に画像を表示するためのメモリである。表示用メモリ2の所定のアドレスにデータを書き込むことにより、当該アドレスに対応する画素(表示部3の表示画面に表示される画像の画素)の画素値が、書き込まれたデータに対応する画素値となり、表示部3の表示画面に表示される。表示用メモリ2として、例えば、ビデオバッファ、レンダリングバッファ、フレームメモリ、あるいは、VRAMが用いられる。   The display memory 2 is a memory for displaying an image on the display screen of the display unit 3. By writing data to a predetermined address of the display memory 2, the pixel value of the pixel corresponding to the address (the pixel of the image displayed on the display screen of the display unit 3) is the pixel value corresponding to the written data. And displayed on the display screen of the display unit 3. For example, a video buffer, a rendering buffer, a frame memory, or a VRAM is used as the display memory 2.

表示部3は、画像を表示することができる表示画面を有しており、表示用メモリ2に書き込まれたデータに従い、表示画面に画像を表示する。   The display unit 3 has a display screen that can display an image, and displays the image on the display screen according to the data written in the display memory 2.

<1.2:画像処理システムの動作>
以上のように構成された画像処理システム1000の動作について、図面を参照しながら、説明する。
<1.2: Operation of the image processing system>
The operation of the image processing system 1000 configured as described above will be described with reference to the drawings.

図2は、画像処理システム1000の処理フローチャートである。   FIG. 2 is a process flowchart of the image processing system 1000.

なお、以下では、説明便宜のため、線分の始点の座標が(x1,y1)であり、線分の終点の座標が(x2,y2)、線の太さが「1」(1画素分の太さ)であり、黒地の背景に白色の線を引く(描画する)場合について、説明する。   In the following, for convenience of explanation, the coordinates of the start point of the line segment are (x1, y1), the coordinates of the end point of the line segment are (x2, y2), and the line thickness is “1” (for one pixel). A case where a white line is drawn (drawn) on a black background will be described.

また、説明便宜のため、線分を描画する画像は、輝度画像(Y画像)であり、画素値は8ビットであり、0〜255の値(画素値「255」が「白」(W100%)であるとする。)をとるものとする。
(S1):
入力部11では、線分の始点の座標(x1,y1)、線分の終点の座標(x2,y2)、線の太さ「1」(1画素分の太さ)、線分の画素値「255」(白)を示す線分情報が入力される。つまり、最初の描画対象画素が画素P(x1,y1)に設定される。描画対象画素Pのx座標をxとし、y座標をyとすると、描画対象画素が画素P(x1,y1)のとき、
x=x1
y=y1
である。
For convenience of explanation, an image for drawing a line segment is a luminance image (Y image), a pixel value is 8 bits, and a value from 0 to 255 (a pixel value “255” is “white” (W100%). )))).
(S1):
In the input unit 11, the coordinates of the start point of the line segment (x1, y1), the coordinates of the end point of the line segment (x2, y2), the line thickness “1” (thickness of one pixel), and the pixel value of the line segment Line segment information indicating “255” (white) is input. That is, the first drawing target pixel is set to the pixel P (x1, y1). When the x coordinate of the drawing target pixel P is x and the y coordinate is y, when the drawing target pixel is the pixel P (x1, y1),
x = x1
y = y1
It is.

また、評価値取得部13は、評価値Dを初期値「0」に設定する。
(S2):
閾値設定部12は、線分情報から線分の始点と終点とのx軸方向の差分量dxおよびy軸方向の差分量dyを、
dx=x2−x1
dy=y2−y1
により算出する。
In addition, the evaluation value acquisition unit 13 sets the evaluation value D to the initial value “0”.
(S2):
The threshold setting unit 12 calculates the difference amount dx in the x-axis direction and the difference amount dy in the y-axis direction between the start point and end point of the line segment from the line segment information.
dx = x2-x1
dy = y2-y1
Calculated by

そして、閾値設定部12は、閾値Th1、Th2、および、Th3を、
Th1=dx−2×dy
Th2=dx
Th3=3×dx−2×dy
により算出した値に設定する。
(S3):
最初の描画対象画素P(x1,y1)からxを1ずつインクリメントし、xが線分の終点のx座標であるx2になるまで、ステップS4〜S13の処理が繰り返し実行される。
(S4、S7):
描画情報決定部14は、評価値Dと閾値Th1とを比較し、D<Th1である場合、描画対象画素P(x,y)の画素値を「255」に決定する。
Then, the threshold setting unit 12 sets thresholds Th1, Th2, and Th3 as
Th1 = dx−2 × dy
Th2 = dx
Th3 = 3 × dx−2 × dy
Set to the value calculated by.
(S3):
X is incremented by 1 from the first drawing target pixel P (x1, y1), and the processes of steps S4 to S13 are repeatedly executed until x becomes x2, which is the x coordinate of the end point of the line segment.
(S4, S7):
The drawing information determination unit 14 compares the evaluation value D with the threshold value Th1, and determines that the pixel value of the drawing target pixel P (x, y) is “255” when D <Th1.

そして、描画情報決定部14は、画素P(x,y)に対応する表示用メモリ2のアドレスに、画素値「255」のデータを書き込む。   Then, the drawing information determination unit 14 writes the data of the pixel value “255” to the address of the display memory 2 corresponding to the pixel P (x, y).

これにより、表示部3の表示画面において、画素P(x,y)に対応する座標位置の画素の画素値が「255」(W100%)となる。
(S4、S5、S8):
描画情報決定部14は、評価値Dと閾値Th1〜Th2とを比較し、Th1≦D<Th2である場合、描画対象画素P(x,y)の画素値を「192」に決定し、描画対象画素のy軸正方向の隣接画素P(x,y+1)の画素値を「64」に決定する。
Thereby, in the display screen of the display unit 3, the pixel value of the pixel at the coordinate position corresponding to the pixel P (x, y) is “255” (W100%).
(S4, S5, S8):
The drawing information determination unit 14 compares the evaluation value D with the threshold values Th1 and Th2, and when Th1 ≦ D <Th2, determines the pixel value of the drawing target pixel P (x, y) to “192” and draws the drawing. The pixel value of the adjacent pixel P (x, y + 1) in the positive y-axis direction of the target pixel is determined to be “64”.

そして、描画情報決定部14は、画素P(x,y)に対応する表示用メモリ2のアドレスに、画素値「192」に相当するデータを書き込む。また、描画情報決定部14は、画素P(x,y+1)に対応する表示用メモリ2のアドレスに、画素値「64」に相当するデータを書き込む。   Then, the drawing information determination unit 14 writes data corresponding to the pixel value “192” at the address of the display memory 2 corresponding to the pixel P (x, y). In addition, the drawing information determination unit 14 writes data corresponding to the pixel value “64” at the address of the display memory 2 corresponding to the pixel P (x, y + 1).

これにより、表示部3の表示画面において、画素P(x,y)に対応する座標位置の画素の画素値が「192」(W75%)となり、画素P(x,y+1)に対応する座標位置の画素の画素値が「64」(W25%)となる。
(S4〜S6、S9):
描画情報決定部14は、評価値Dと閾値Th2〜Th3とを比較し、Th2≦D<Th3である場合、描画対象画素P(x,y)の画素値を「128」に決定し、描画対象画素のy軸正方向の隣接画素P(x,y+1)の画素値を「128」に決定する。
Thereby, on the display screen of the display unit 3, the pixel value of the pixel at the coordinate position corresponding to the pixel P (x, y) becomes “192” (W75%), and the coordinate position corresponding to the pixel P (x, y + 1). The pixel value of this pixel is “64” (W25%).
(S4 to S6, S9):
The drawing information determination unit 14 compares the evaluation value D with the threshold values Th2 to Th3, and when Th2 ≦ D <Th3, determines the pixel value of the drawing target pixel P (x, y) to “128” and draws The pixel value of the adjacent pixel P (x, y + 1) in the positive y-axis direction of the target pixel is determined to be “128”.

そして、描画情報決定部14は、画素P(x,y)に対応する表示用メモリ2のアドレスに、画素値「128」に相当するデータを書き込む。また、描画情報決定部14は、画素P(x,y+1)に対応する表示用メモリ2のアドレスに、画素値「128」に相当するデータを書き込む。   Then, the drawing information determination unit 14 writes data corresponding to the pixel value “128” to the address of the display memory 2 corresponding to the pixel P (x, y). Further, the drawing information determination unit 14 writes data corresponding to the pixel value “128” at the address of the display memory 2 corresponding to the pixel P (x, y + 1).

これにより、表示部3の表示画面において、画素P(x,y)に対応する座標位置の画素の画素値が「128」(W50%)となり、画素P(x,y+1)に対応する座標位置の画素の画素値が「128」(W50%)となる。
(S4〜S6、S10):
描画情報決定部14は、評価値Dと閾値Th3とを比較し、D≧Th3である場合、描画対象画素P(x,y)の画素値を「64」に決定し、描画対象画素のy軸正方向の隣接画素P(x,y+1)の画素値を「192」に決定する。
Thereby, on the display screen of the display unit 3, the pixel value of the pixel at the coordinate position corresponding to the pixel P (x, y) becomes “128” (W50%), and the coordinate position corresponding to the pixel P (x, y + 1). The pixel value of this pixel is “128” (W50%).
(S4 to S6, S10):
The drawing information determination unit 14 compares the evaluation value D with the threshold value Th3. When D ≧ Th3, the drawing information determination unit 14 determines the pixel value of the drawing target pixel P (x, y) to be “64” and sets the y of the drawing target pixel. The pixel value of the adjacent pixel P (x, y + 1) in the axial positive direction is determined to be “192”.

そして、描画情報決定部14は、画素P(x,y)に対応する表示用メモリ2のアドレスに、画素値「64」に相当するデータを書き込む。また、描画情報決定部14は、画素P(x,y+1)に対応する表示用メモリ2のアドレスに、画素値「192」に相当するデータを書き込む。   Then, the drawing information determination unit 14 writes data corresponding to the pixel value “64” to the address of the display memory 2 corresponding to the pixel P (x, y). Further, the drawing information determination unit 14 writes data corresponding to the pixel value “192” at the address of the display memory 2 corresponding to the pixel P (x, y + 1).

これにより、表示部3の表示画面において、画素P(x,y)に対応する座標位置の画素の画素値が「64」(W25%)となり、画素P(x,y+1)に対応する座標位置の画素の画素値が「192」(W75%)となる。
(S11):
評価値取得部13は、評価値Dを、
D=D+4×dy
により更新する。
(S12、S13):
評価値取得部13は、ステップS11で更新した評価値Dと3×dxとを比較し、D≧3×dxである場合、評価値Dを
D=D−4×dx
によりさらに更新するとともに、
y=y+1
により、yの座標の値を1だけインクリメントする。つまり、次の描画対象画素のy座標の値を現在の描画対象画素のy座標の値よりも1だけ大きい値にする。
Thereby, on the display screen of the display unit 3, the pixel value of the pixel at the coordinate position corresponding to the pixel P (x, y) becomes “64” (W25%), and the coordinate position corresponding to the pixel P (x, y + 1). The pixel value of this pixel is “192” (W75%).
(S11):
The evaluation value acquisition unit 13 determines the evaluation value D as
D = D + 4 × dy
Update with
(S12, S13):
The evaluation value acquisition unit 13 compares the evaluation value D updated in step S11 with 3 × dx. If D ≧ 3 × dx, the evaluation value D is D = D−4 × dx.
With further updates,
y = y + 1
The value of the y coordinate is incremented by 1. That is, the value of the y coordinate of the next drawing target pixel is set to a value larger by 1 than the value of the y coordinate of the current drawing target pixel.

その後、処理がステップS3に戻り、ステップS3〜S13の処理が、xの値が線分の終点のx座標であるx2になるまで繰り返し実行される。   Thereafter, the process returns to step S3, and the processes of steps S3 to S13 are repeatedly executed until the value of x becomes x2, which is the x coordinate of the end point of the line segment.

ここで、上記処理による線分描画の一例について、図3を用いて、説明する。   Here, an example of line segment drawing by the above processing will be described with reference to FIG.

図3は、始点(0,0)から終点(7,3)に線分を描画する場合の処理について説明するための図である。   FIG. 3 is a diagram for explaining processing when a line segment is drawn from the start point (0, 0) to the end point (7, 3).

始点(0,0)から終点(7,3)に線分を描画する場合、閾値設定部12は、
dx=x2−x1=7−0=7
dy=y2−y1=3−0=3
により、dx、dyを算出する。
When drawing a line segment from the start point (0, 0) to the end point (7, 3), the threshold setting unit 12
dx = x2-x1 = 7-0 = 7
dy = y2-y1 = 3-0 = 3
To calculate dx and dy.

また、閾値設定部12は、
Th1=dx−2×dy=7−2×3=1
Th2=dx=7
Th3=3×dx−2×dy=3×7−2×3=15
により、Th1〜Th3を算出する。
In addition, the threshold setting unit 12
Th1 = dx−2 × dy = 7−2 × 3 = 1
Th2 = dx = 7
Th3 = 3 * dx-2 * dy = 3 * 7-2 * 3 = 15
Thus, Th1 to Th3 are calculated.

≪1回目の処理(描画対象画素:P(0,0))≫
まず、始点(0,0)の画素P(0,0)が描画対象画素に設定される。
<< First Process (Drawing Target Pixel: P (0,0)) >>
First, the pixel P (0, 0) at the start point (0, 0) is set as the drawing target pixel.

また、評価値取得部13により評価値Dは、初期値「0」に設定されている。   Further, the evaluation value D is set to the initial value “0” by the evaluation value acquisition unit 13.

D<Th1(=1)であるので、ステップS7の処理が実行される。つまり、
P(0,0)=255
と決定される。なお、画素P(x,y)について、P(x,y)=Aという表記は、座標位置(x,y)の画素Pの画素値が「A」であることを表すものとする。
Since D <Th1 (= 1), the process of step S7 is executed. That means
P (0,0) = 255
Is determined. For the pixel P (x, y), the notation P (x, y) = A represents that the pixel value of the pixel P at the coordinate position (x, y) is “A”.

そして、ステップS11の処理において、
D=D+4×dy=0+4×3=12
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 0 + 4 × 3 = 12.
Thus, the evaluation value D is updated.

更新された評価値D(=12)は、3×dx(=21)より小さいので(ステップS12)、次の描画対象画素が、画素P(1,0)に決定され、次の処理(2回目の処理)が実行される。   Since the updated evaluation value D (= 12) is smaller than 3 × dx (= 21) (step S12), the next drawing target pixel is determined as the pixel P (1, 0), and the next processing (2 The second process is executed.

≪2回目の処理(描画対象画素:P(1,0))≫
2回目の処理では、描画対象画素が画素P(1,0)であり、評価値Dが「12」である。
<< Second Process (Drawing Target Pixel: P (1,0)) >>
In the second process, the drawing target pixel is the pixel P (1, 0), and the evaluation value D is “12”.

Th2≦D<Th3(D=12、Th2=7、Th3=15)であるので、ステップS9の処理が実行される。つまり、画素P(1,0)および画素P(1,1)の画素値は、
P(1,0)=128
P(1,1)=128
と決定される。
Since Th2 ≦ D <Th3 (D = 12, Th2 = 7, Th3 = 15), the process of step S9 is executed. That is, the pixel values of the pixel P (1, 0) and the pixel P (1, 1) are
P (1,0) = 128
P (1,1) = 128
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=12+4×3=24
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 12 + 4 × 3 = 24
Thus, the evaluation value D is updated.

更新された評価値D(=24)は、3×dx(=21)より大きいので(ステップS12)、ステップS13の処理が実行される。つまり、
D=D−4×dx=24−4×7=−4
y=y+1=0+1=1
となる。これにより、次の描画対象画素が、画素P(2,1)に決定される。
Since the updated evaluation value D (= 24) is larger than 3 × dx (= 21) (step S12), the process of step S13 is executed. That means
D = D-4 * dx = 24-4 * 7 = -4
y = y + 1 = 0 + 1 = 1
It becomes. As a result, the next pixel to be drawn is determined as the pixel P (2, 1).

≪3回目の処理(描画対象画素:P(2,1))≫
3回目の処理では、描画対象画素が画素P(2,1)であり、評価値Dが「−4」である。
<< Third Process (Drawing Target Pixel: P (2,1)) >>
In the third process, the drawing target pixel is the pixel P (2, 1), and the evaluation value D is “−4”.

D<Th1(D=−4、Th1=1)であるので、ステップS7の処理が実行される。つまり、画素P(2,1)の画素値は、
P(2,1)=255
と決定される。
Since D <Th1 (D = −4, Th1 = 1), the process of step S7 is executed. That is, the pixel value of the pixel P (2,1) is
P (2,1) = 255
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=−4+4×3=8
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = −4 + 4 × 3 = 8
Thus, the evaluation value D is updated.

更新された評価値D(=8)は、3×dx(=21)より小さいので(ステップS12)、ステップS13の処理は実行されず、次の描画対象画素が、画素P(3,1)に決定される。   Since the updated evaluation value D (= 8) is smaller than 3 × dx (= 21) (step S12), the process of step S13 is not executed, and the next drawing target pixel is the pixel P (3, 1). To be determined.

≪4回目の処理(描画対象画素:P(3,1))≫
4回目の処理では、描画対象画素が画素P(3,1)であり、評価値Dが「8」である。
<< Fourth Process (Drawing Target Pixel: P (3,1)) >>
In the fourth process, the drawing target pixel is the pixel P (3, 1), and the evaluation value D is “8”.

Th2≦D<Th3(D=8、Th2=7、Th3=15)であるので、ステップS9の処理が実行される。つまり、画素P(3,1)および画素P(3,2)の画素値は、
P(3,1)=128
P(3,2)=128
と決定される。
Since Th2 ≦ D <Th3 (D = 8, Th2 = 7, Th3 = 15), the process of step S9 is executed. That is, the pixel values of the pixel P (3, 1) and the pixel P (3, 2) are
P (3,1) = 128
P (3,2) = 128
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=8+4×3=20
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 8 + 4 × 3 = 20
Thus, the evaluation value D is updated.

更新された評価値D(=20)は、3×dx(=21)より小さいので(ステップS12)、ステップS13の処理は実行されず、次の描画対象画素が、画素P(4,1)に決定される。   Since the updated evaluation value D (= 20) is smaller than 3 × dx (= 21) (step S12), the process of step S13 is not executed, and the next drawing target pixel is the pixel P (4, 1). To be determined.

≪5回目の処理(描画対象画素:P(4,1))≫
5回目の処理では、描画対象画素が画素P(4,1)であり、評価値Dが「20」である。
<< Fifth Process (Drawing Target Pixel: P (4,1)) >>
In the fifth process, the drawing target pixel is the pixel P (4, 1), and the evaluation value D is “20”.

Th3<D(D=20、Th3=15)であるので、ステップS10の処理が実行される。つまり、画素P(4,1)および画素P(4,2)の画素値は、
P(4,1)=64
P(4,2)=192
と決定される。
Since Th3 <D (D = 20, Th3 = 15), the process of step S10 is executed. That is, the pixel values of the pixel P (4, 1) and the pixel P (4, 2) are
P (4,1) = 64
P (4,2) = 192
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=20+4×3=32
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 20 + 4 × 3 = 32
Thus, the evaluation value D is updated.

更新された評価値D(=32)は、3×dx(=21)より大きいので(ステップS12)、ステップS13の処理が実行される。つまり、
D=D−4×dx=32−4×7=4
y=y+1=1+1=2
となる。これにより、次の描画対象画素が、画素P(5,2)に決定される。
Since the updated evaluation value D (= 32) is larger than 3 × dx (= 21) (step S12), the process of step S13 is executed. That means
D = D-4 * dx = 32-4 * 7 = 4
y = y + 1 = 1 + 1 = 2
It becomes. As a result, the next drawing target pixel is determined to be the pixel P (5, 2).

≪6回目の処理(描画対象画素:P(5,2))≫
6回目の処理では、描画対象画素が画素P(5,2)であり、評価値Dが「4」である。
<< Sixth Process (Drawing Target Pixel: P (5,2)) >>
In the sixth process, the drawing target pixel is the pixel P (5, 2), and the evaluation value D is “4”.

Th1<D≦Th2(D=4、Th1=1、Th2=7)であるので、ステップS8の処理が実行される。つまり、画素P(5,2)および画素P(5,3)の画素値は、
P(5,2)=192
P(4,2)=64
と決定される。
Since Th1 <D ≦ Th2 (D = 4, Th1 = 1, Th2 = 7), the process of step S8 is executed. That is, the pixel values of the pixel P (5, 2) and the pixel P (5, 3) are
P (5,2) = 192
P (4,2) = 64
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=4+4×3=16
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 4 + 4 × 3 = 16
Thus, the evaluation value D is updated.

更新された評価値D(=16)は、3×dx(=21)より小さいので(ステップS12)、ステップS13の処理は実行されず、次の描画対象画素が、画素P(6,2)に決定される。   Since the updated evaluation value D (= 16) is smaller than 3 × dx (= 21) (step S12), the process of step S13 is not executed, and the next drawing target pixel is the pixel P (6, 2). To be determined.

≪7回目の処理(描画対象画素:P(6,2))≫
7回目の処理では、描画対象画素が画素P(6,2)であり、評価値Dが「16」である。
<< Seventh Process (Drawing Target Pixel: P (6,2)) >>
In the seventh processing, the drawing target pixel is the pixel P (6, 2), and the evaluation value D is “16”.

Th3<D(D=16、Th3=15)であるので、ステップS10の処理が実行される。つまり、画素P(6,2)および画素P(6,3)の画素値は、
P(6,2)=64
P(6,2)=192
と決定される。
Since Th3 <D (D = 16, Th3 = 15), the process of step S10 is executed. That is, the pixel values of the pixel P (6, 2) and the pixel P (6, 3) are
P (6,2) = 64
P (6,2) = 192
Is determined.

そして、ステップS11の処理において、
D=D+4×dy=16+4×3=28
により、評価値Dが更新される。
And in the process of step S11,
D = D + 4 × dy = 16 + 4 × 3 = 28
Thus, the evaluation value D is updated.

更新された評価値D(=28)は、3×dx(=21)より大きいので(ステップS12)、ステップS13の処理が実行される。つまり、
D=D−4×dx=28−4×7=0
y=y+1=2+1=3
となる。これにより、次の描画対象画素が、画素P(7,3)に決定される。
Since the updated evaluation value D (= 28) is larger than 3 × dx (= 21) (step S12), the process of step S13 is executed. That means
D = D-4 * dx = 28-4 * 7 = 0
y = y + 1 = 2 + 1 = 3
It becomes. As a result, the next drawing target pixel is determined to be the pixel P (7, 3).

≪8回目の処理(描画対象画素:P(7,3))≫
8回目の処理では、描画対象画素が画素P(7,3)であり、評価値Dが「0」である。
<< Eighth Process (Drawing Target Pixel: P (7,3)) >>
In the eighth process, the drawing target pixel is the pixel P (7, 3), and the evaluation value D is “0”.

D<Th1(D=0、Th1=1)であるので、ステップS7の処理が実行される。つまり、画素P(7,3)画素値は、
P(7,3)=255
と決定される。
Since D <Th1 (D = 0, Th1 = 1), the process of step S7 is executed. That is, the pixel value P (7,3) is
P (7,3) = 255
Is determined.

xの値が線分の終点のxの値(=7)と一致しているので、8回目の処理を実行した後、線分描画処理が終了する。   Since the value of x matches the value of x at the end point of the line segment (= 7), the line drawing process ends after the eighth process is executed.

以上の処理により、図3に示すように、始点(0,0)から終点(7,3)に線分が描画される。また、図4は、図3に、始点(0,0)と終点(7,3)とを結ぶ線分L1およびx座標の値が同じ描画画素(画素値が「0」でないの画素)の重心の位置を丸印で追加した図である。なお、図4に示した重心の位置は、(1)x座標の値が同じ描画画素が1つである場合は、当該描画画素の座標位置であり、(2)x座標の値が同じ描画画素が画素PA(x0,y0)、画素PB(x0,y0+1)の2つであり、画素PAの画素値がk1であり、画素PBの画素値がk2である場合、重心位置の座標(xc,yc)は、
xc=x0
yc=y0+k2/(k1+k2)
である。
With the above processing, a line segment is drawn from the start point (0, 0) to the end point (7, 3) as shown in FIG. 4 is a drawing pixel (a pixel whose pixel value is not “0”) having the same line segment L1 connecting the start point (0,0) and the end point (7,3) and the value of the x coordinate in FIG. It is the figure which added the position of the center of gravity with a circle. Note that the position of the center of gravity shown in FIG. 4 is (1) when there is one drawing pixel with the same x-coordinate value, and is the coordinate position of the drawing pixel, and (2) drawing with the same x-coordinate value. When there are two pixels, pixel PA (x0, y0) and pixel PB (x0, y0 + 1), the pixel value of the pixel PA is k1, and the pixel value of the pixel PB is k2, the coordinates (xc) of the barycentric position , Yc)
xc = x0
yc = y0 + k2 / (k1 + k2)
It is.

図3、図4から分かるように、画像処理システム1000により、上記処理を実行することで、始点(0,0)から終点(7,3)への線分を、中間調を有する画素により表現することができる。また、図4から分かるように、同列に位置する描画画素(x座標位置が同一の描画画素)の重心位置と、始点(0,0)および終点(7,3)を通る直線L1とのずれが少ない。つまり、画像処理システム1000により、上記処理を実行することで、適切に線分を描画することができる。   As can be seen from FIGS. 3 and 4, the line segment from the start point (0, 0) to the end point (7, 3) is expressed by pixels having halftones by executing the above processing by the image processing system 1000. can do. Further, as can be seen from FIG. 4, the shift between the center of gravity of the drawing pixels (drawing pixels having the same x coordinate position) located in the same column and the straight line L1 passing through the start point (0, 0) and the end point (7, 3) Less is. That is, the image processing system 1000 can appropriately draw a line segment by executing the above processing.

また、図5に、ブレゼンハムアルゴリズムにより線分描画した線分LH1および線分LH1の一部を拡大して表示した線分LH2と、画像処理システム1000による線分描画した線分LA1および線分LA1の一部を拡大して表示した線分LA2と、を示す。   FIG. 5 shows a line segment LH1 and a line segment LH2 obtained by enlarging a part of the line segment LH1 drawn by the Bresenham algorithm, and a line segment LA1 and line segment LA1 drawn by the image processing system 1000. Shows a line segment LA2 in which a part of the line is enlarged.

図5から分かるように、ブレゼンハムアルゴリズムにより描画した線分ではジャギー(エイリアス成分)が目立つが、画像処理システム1000により描画した線分では、ジャギーが目立たず、エイリアス成分が適切に抑制されていることが分かる。   As can be seen from FIG. 5, jaggy (alias component) is noticeable in the line segment drawn by the Bresenham algorithm, but in the line segment drawn by the image processing system 1000, the jaggy is not noticeable and the alias component is appropriately suppressed. I understand.

ここで、画像処理システム1000による描画処理の原理について説明する。   Here, the principle of the drawing process by the image processing system 1000 will be described.

まず、図6を参照しながら、従来のブレゼンハムアルゴリズムによる線分描画処理について、説明する。なお、図6に示すように、始点P(0,0)から終点P(7,3)に線分を引く場合について説明する。   First, with reference to FIG. 6, the line drawing process by the conventional Bresenham algorithm will be described. In addition, as shown in FIG. 6, the case where a line segment is drawn from the start point P (0, 0) to the end point P (7, 3) will be described.

ブレゼンハムアルゴリズムによる描画処理では、まず、始点P(0,0)を描画画素として、所定の画素値に設定する(図6では、黒く塗りつぶした状態)。なお、説明便宜のため、描画画素の画素値を「1」として、以下、説明する。   In the drawing process by the Bresenham algorithm, first, the starting point P (0, 0) is set as a drawing pixel to a predetermined pixel value (in FIG. 6, it is painted black). For convenience of explanation, the pixel value of the drawing pixel will be described as “1” below.

次に、描画画素の候補は、画素P(1,0)と、画素P(1,1)となる。そして、この2つの画素の中点(図6に白丸で示した点)と、始点P(0,0)および終点P(7,3)を通る直線との位置関係(上下関係)を判定する。図6から分かるように、直線L1は、画素P(1,0)と画素P(1,1)との中点(1,0.5)よりも上側に位置しているので、x=1のときの描画画素は、直線L1により近い画素P(1,0)となる。   Next, the drawing pixel candidates are the pixel P (1, 0) and the pixel P (1, 1). Then, the positional relationship (vertical relationship) between the midpoint of these two pixels (points indicated by white circles in FIG. 6) and a straight line passing through the start point P (0, 0) and the end point P (7, 3) is determined. . As can be seen from FIG. 6, since the straight line L1 is located above the midpoint (1, 0.5) of the pixel P (1, 0) and the pixel P (1, 1), x = 1. In this case, the drawing pixel is a pixel P (1, 0) closer to the straight line L1.

このような処理を終点(7,3)まで繰り返すことで、始点P(0,0)から終点P(7,3)へ線分描画することができる(直線L1を近似して表示することができる)。   By repeating such processing until the end point (7, 3), a line segment can be drawn from the start point P (0, 0) to the end point P (7, 3) (the straight line L1 can be approximated and displayed). it can).

上記処理は、評価値Dと、始点P(0,0)と終点P(7,3)とのx軸方向の差分量dx、y軸方向の差分量dyとを用いて、以下のように表現することができる。   The above process uses the evaluation value D, the difference amount dx in the x-axis direction between the start point P (0, 0) and the end point P (7, 3), and the difference amount dy in the y-axis direction as follows. Can be expressed.

評価値Dは、初期値「0」で、x軸方向正方向に+1する度に、2×dyが加算される。その加算結果がdxを超えた場合、y方向に+1進むように、描画画素を選択する。そして、y方向に+1進んだ場合、評価値Dの値から2×dxを減算する。これを繰り返すことで、始点から終点まで線分描画することができる。   The evaluation value D is an initial value “0”, and 2 × dy is added every time it is incremented by 1 in the positive x-axis direction. When the addition result exceeds dx, the drawing pixel is selected so as to advance by +1 in the y direction. And when it advances +1 in the y direction, 2 × dx is subtracted from the value of the evaluation value D. By repeating this, a line segment can be drawn from the start point to the end point.

図6の場合、以下のようになる。
(1)1回目の処理
D=D+2×dy=0+2×3=6
D<dx(D=6、dx=7)なので、次の描画画素は、P(1,0)に決定される。
(2)2回目の処理
D=D+2×dy=6+2×3=12
D>dx(D=12、dx=7)なので、次の描画画素は、P(2,1)に決定される。
In the case of FIG.
(1) First processing D = D + 2 × dy = 0 + 2 × 3 = 6
Since D <dx (D = 6, dx = 7), the next drawing pixel is determined to be P (1, 0).
(2) Second processing D = D + 2 × dy = 6 + 2 × 3 = 12.
Since D> dx (D = 12, dx = 7), the next drawing pixel is determined to be P (2, 1).

また、評価値Dから2×dxが減算される。つまり、
D=D−2×dx=12−2×7=−2
となる。
(3)3回目の処理
D=D+2×dy=−2+2×3=4
D<dx(D=4、dx=7)なので、次の描画画素は、P(3,1)に決定される。
(4)4回目の処理
D=D+2×dy=4+2×3=10
D>dx(D=10、dx=7)なので、次の描画画素は、P(4,2)に決定される。
Further, 2 × dx is subtracted from the evaluation value D. That means
D = D-2 * dx = 12-2 * 7 = -2
It becomes.
(3) Third processing D = D + 2 × dy = −2 + 2 × 3 = 4
Since D <dx (D = 4, dx = 7), the next drawing pixel is determined to be P (3, 1).
(4) Fourth processing D = D + 2 × dy = 4 + 2 × 3 = 10
Since D> dx (D = 10, dx = 7), the next drawing pixel is determined to be P (4, 2).

また、評価値Dから2×dxが減算される。つまり、
D=D−2×dx=10−2×7=−4
となる。
(5)5回目の処理
D=D+2×dy=−4+2×3=2
D<dx(D=2、dx=7)なので、次の描画画素は、P(5,2)に決定される。
(6)6回目の処理
D=D+2×dy=2+2×3=8
D>dx(D=8、dx=7)なので、次の描画画素は、P(6,3)に決定される。
Further, 2 × dx is subtracted from the evaluation value D. That means
D = D−2 × dx = 10−2 × 7 = −4
It becomes.
(5) Fifth processing D = D + 2 × dy = −4 + 2 × 3 = 2
Since D <dx (D = 2, dx = 7), the next drawing pixel is determined to be P (5, 2).
(6) Sixth processing D = D + 2 × dy = 2 + 2 × 3 = 8
Since D> dx (D = 8, dx = 7), the next drawing pixel is determined to be P (6, 3).

また、評価値Dから2×dxが減算される。つまり、
D=D−2×dx=8−2×7=−6
となる。
(7)7回目の処理
D=D+2×dy=−6+2×3=0
D<dx(D=0、dx=7)なので、次の描画画素は、P(7,3)に決定される。
Further, 2 × dx is subtracted from the evaluation value D. That means
D = D−2 × dx = 8−2 × 7 = −6
It becomes.
(7) Seventh processing D = D + 2 × dy = −6 + 2 × 3 = 0
Since D <dx (D = 0, dx = 7), the next drawing pixel is determined to be P (7, 3).

以上の処理により、図6に示すように、始点P(0,0)から終点P(7,3)へブレゼンハムアルゴリズムにより線分描画される。   Through the above processing, as shown in FIG. 6, a line segment is drawn from the start point P (0, 0) to the end point P (7, 3) by the Bresenham algorithm.

上記の処理から分かるように、ブレゼンハムアルゴリズムでは、評価値Dは、0から2×dyずつ増加し、−dxとdxの間をループする。   As can be seen from the above processing, in the Bresenham algorithm, the evaluation value D increases from 0 by 2 × dy and loops between −dx and dx.

画像処理システム1000では、ブレゼンハムアルゴリズムにおいて、―dxからdxであった評価値Dのループ区間を、−0.5×dxから1.5×dxの区間に変更し、さらに、当該区間を3つの閾値Th1、Th2、Th3で区切り、描画処理を実行する。これにより、画像処理システム1000では、場合分けのみで、線分描画時に生じるエイリアシングを効果的に低減することができる。これについて、以下、説明する。   In the image processing system 1000, in the Bresenham algorithm, the loop section of the evaluation value D that was -dx to dx is changed from -0.5 * dx to 1.5 * dx, and the section is further divided into three sections. Drawing processing is executed by dividing the threshold values by Th1, Th2, and Th3. Thereby, in the image processing system 1000, aliasing that occurs during line segment drawing can be effectively reduced only by case classification. This will be described below.

解像度を縦方向(y軸方向)に2倍にした場合と、横方向(x軸方向)に2倍にした場合を考える。   Consider a case where the resolution is doubled in the vertical direction (y-axis direction) and a case where the resolution is doubled in the horizontal direction (x-axis direction).

まず、解像度を縦方向(y軸方向)に2倍にした場合を考える。   First, consider a case where the resolution is doubled in the vertical direction (y-axis direction).

図7は、解像度を縦方向(y軸方向)に2倍にした場合の評価値Dのループ区間と、画素のずれ量との関係を模式的に示す図である。   FIG. 7 is a diagram schematically showing the relationship between the loop section of the evaluation value D and the pixel shift amount when the resolution is doubled in the vertical direction (y-axis direction).

図7に示すように、解像度を縦方向(y軸方向)に2倍にしてブレゼンハムアルゴリズムにより、線分描画すると、解像度を上げないでブレゼンハムアルゴリズムにより線分描画した場合に比べて、(1)評価値Dが−dx〜−0.5×dxの区間の値である場合、1画素分上にずれる可能性があり、(2)評価値Dが0.5×dx〜dxの区間の値である場合、1画素分下にずれる可能性がある。   As shown in FIG. 7, when the line is drawn by the Bresenham algorithm with the resolution doubled in the vertical direction (y-axis direction), the line is drawn by the Bresenham algorithm without increasing the resolution (1) When the evaluation value D is a value in a section of −dx to −0.5 × dx, there is a possibility that the evaluation value D is shifted by one pixel, and (2) a value of a section in which the evaluation value D is 0.5 × dx to dx In such a case, there is a possibility of shifting down by one pixel.

なお、評価値Dが−0.5×dx〜0.5×dxの区間の値である場合は、画素ずれは発生しない。   Note that when the evaluation value D is a value in the interval of −0.5 × dx to 0.5 × dx, no pixel shift occurs.

次に、解像度を横方向(x軸方向)に2倍にした場合を考える。   Next, consider a case where the resolution is doubled in the horizontal direction (x-axis direction).

図8は、解像度を横方向(x軸方向)に2倍にした場合の評価値Dのループ区間と、画素のずれ量との関係を模式的に示す図である。   FIG. 8 is a diagram schematically showing the relationship between the loop section of the evaluation value D and the pixel shift amount when the resolution is doubled in the horizontal direction (x-axis direction).

図8に示すように、解像度を横方向(x軸方向)に2倍にしてブレゼンハムアルゴリズムにより、線分描画すると、解像度を上げないでブレゼンハムアルゴリズムにより線分描画した場合に比べて、評価値Dがdx−dy〜dxの区間の値である場合、1画素分斜め方向にずれる可能性がある。   As shown in FIG. 8, when the line is drawn by the Bresenham algorithm with the resolution doubled in the horizontal direction (x-axis direction), the evaluation value D is higher than when the line is drawn by the Bresenham algorithm without increasing the resolution. Is a value in the interval from dx-dy to dx, there is a possibility that the pixel is shifted in an oblique direction.

なお、評価値Dが−dx〜dx−dyの区間の値である場合は、画素ずれは発生しない。   Note that when the evaluation value D is a value in the interval from -dx to dx-dy, no pixel shift occurs.

したがって、上記を考慮し、―0.5×dxと0.5×dxと、それらからdyを減算した値−0.5×dx―dyと0.5×dx−dyとを閾値とし、評価値Dのループ区間を分け、評価値Dがどの区間の値であるかにより、画素値を中間調とすることで、エイリアス成分を抑制して線分描画することができる。なお、dy>0.5×dxの場合は、−0.5×dx−dyは、―dx〜dxの範囲に入らないので、代わりに、1.5×dx―dyを閾値とする。   Therefore, in consideration of the above, -0.5 × dx, 0.5 × dx, and values obtained by subtracting dy from them—0.5 × dx-dy and 0.5 × dx-dy are used as threshold values, and evaluation is performed. By dividing the loop section of the value D and making the pixel value a halftone depending on which section the evaluation value D is, line drawing can be performed while suppressing the alias component. If dy> 0.5 × dx, −0.5 × dx-dy does not fall within the range of −dx to dx, and instead, 1.5 × dx-dy is used as the threshold value.

具体的には、図9、図10に示すように、場合分けを行う。   Specifically, as shown in FIG. 9 and FIG.

図9は、dy≦0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図である。   FIG. 9 is a diagram schematically illustrating a correspondence relationship between the evaluation value D, the drawing target pixel, and the pixel value when dy ≦ 0.5 × dx.

図9に示すように、dy≦0.5×dxの場合、描画対象画素をP(x,y)とし、画素値が0〜1の値をとるとして、以下の(1)〜(5)により場合分けし、画素値を決定すればよい。
(1)−dx≦D<−0.5×dx―dyの場合、
P(x,y−1)=0.5
P(x,y)=0.5
(2)−0.5×dx―dy≦D<−0.5×dxの場合、
P(x,y−1)=0.25
P(x,y)=0.75
(3)−0.5×dx≦D<0.5×dx−dyの場合、
P(x,y)=1
(4)0.5×dx−dy≦D<0.5×dxの場合、
P(x,y)=0.75
P(x,y+1)=0.25
(5)0.5×dx≦D<dxの場合、
P(x,y)=0.50
P(x,y+1)=0.50
図10は、dy>0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図である。
As shown in FIG. 9, when dy ≦ 0.5 × dx, assuming that the drawing target pixel is P (x, y) and the pixel value is 0 to 1, the following (1) to (5) Depending on the case, the pixel value may be determined.
(1) When −dx ≦ D <−0.5 × dx−dy,
P (x, y-1) = 0.5
P (x, y) = 0.5
(2) When −0.5 × dx−dy ≦ D <−0.5 × dx,
P (x, y-1) = 0.25
P (x, y) = 0.75
(3) In the case of −0.5 × dx ≦ D <0.5 × dx−dy,
P (x, y) = 1
(4) In the case of 0.5 × dx−dy ≦ D <0.5 × dx,
P (x, y) = 0.75
P (x, y + 1) = 0.25
(5) When 0.5 × dx ≦ D <dx,
P (x, y) = 0.50
P (x, y + 1) = 0.50
FIG. 10 is a diagram schematically illustrating a correspondence relationship between the evaluation value D, the drawing target pixel, and the pixel value when dy> 0.5 × dx.

図10に示すように、dy>0.5×dxの場合、描画対象画素をP(x,y)とし、画素値が0〜1の値をとるとして、以下の(1)〜(5)により場合分けし、画素値を決定すればよい。
(1)−dx≦D<−0.5×dxの場合、
P(x,y−1)=0.25
P(x,y)=0.75
(2)−0.5×dx≦D<0.5×dx−dyの場合、
P(x,y)=1
(3)0.5×dx−dy≦D<0.5×dxの場合、
P(x,y)=0.75
P(x,y+1)=0.25
(4)0.5×dx≦D<1.5×dx−dyの場合、
P(x,y)=0.5
P(x,y+1)=0.5
(5)1.5×dx−dy≦D<dxの場合、
P(x,y)=0.25
P(x,y+1)=0.75
上記の場合分けは、評価値Dのループ区間を−dx〜dxとしているため、複雑になっている。そこで、評価値Dのループ区間を−0.5×dx〜1.5×dxにすることで場合分けの数を少なくすることができる。これについて、図11、図12を用いて、説明する。
As shown in FIG. 10, when dy> 0.5 × dx, assuming that the drawing target pixel is P (x, y) and the pixel value is 0 to 1, the following (1) to (5) Depending on the case, the pixel value may be determined.
(1) When −dx ≦ D <−0.5 × dx,
P (x, y-1) = 0.25
P (x, y) = 0.75
(2) In the case of −0.5 × dx ≦ D <0.5 × dx−dy,
P (x, y) = 1
(3) In the case of 0.5 × dx−dy ≦ D <0.5 × dx,
P (x, y) = 0.75
P (x, y + 1) = 0.25
(4) In the case of 0.5 × dx ≦ D <1.5 × dx−dy,
P (x, y) = 0.5
P (x, y + 1) = 0.5
(5) When 1.5 × dx−dy ≦ D <dx,
P (x, y) = 0.25
P (x, y + 1) = 0.75
The above case classification is complicated because the loop section of the evaluation value D is set to −dx to dx. Therefore, the number of cases can be reduced by setting the loop section of the evaluation value D to −0.5 × dx to 1.5 × dx. This will be described with reference to FIGS.

図11は、図9と同様に、dy≦0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図である。   FIG. 11 is a diagram schematically illustrating a correspondence relationship between the evaluation value D, the drawing target pixel, and the pixel value when dy ≦ 0.5 × dx, as in FIG. 9.

図12は、図10と同様に、dy>0.5×dxの場合の評価値D、描画対象画素、および、画素値の対応関係を模式的に示す図である。   FIG. 12 is a diagram schematically illustrating a correspondence relationship between the evaluation value D, the drawing target pixel, and the pixel value when dy> 0.5 × dx, as in FIG. 10.

図11に示すように、評価値Dのループ区間を−dx〜dx(図11中の区間T1)とした場合の区間Ta1(−dx≦D<−0.5×dx―dy)は、評価値Dのループ区間を−0.5×dx〜1.5×dx(図11中の区間T2)とした場合の区間Tb1(dx≦D<0.5×dx―dy)と同じ処理が実行されることを意味する。つまり、ブレゼンハムアルゴリズムでは、評価値Dがdxを超えるとy方向に+1進んだ画素を描画画素とするので、区間Ta1の描画画素の上隣の画素(図11の画素Pa1)は、区間Tb1の描画画素(図11の画素Pb1)と同じと考えることができる。   As shown in FIG. 11, a section Ta1 (−dx ≦ D <−0.5 × dx−dy) when the loop section of the evaluation value D is −dx to dx (section T1 in FIG. 11) is evaluated. The same processing as the section Tb1 (dx ≦ D <0.5 × dx−dy) is executed when the loop section of the value D is −0.5 × dx to 1.5 × dx (section T2 in FIG. 11). Means that That is, in the Bresenham algorithm, when the evaluation value D exceeds dx, the pixel advanced by +1 in the y direction is used as the drawing pixel. Therefore, the pixel adjacent to the drawing pixel in the section Ta1 (pixel Pa1 in FIG. 11) is in the section Tb1. It can be considered the same as the drawing pixel (pixel Pb1 in FIG. 11).

また、同様に、評価値Dのループ区間を−dx〜dxとした場合の区間Ta2(−0.5×dx≦D<−0.5×dx)は、評価値Dのループ区間を−0.5×dx〜1.5×dxとした場合の区間Tb2(−0.5×dx−dy≦D<1.5)と同じ処理が実行されることを意味する。つまり、ブレゼンハムアルゴリズムでは、評価値Dがdxを超えるとy方向に+1進んだ画素を描画画素とするので、区間Ta2の描画画素の上隣の画素(図11の画素Pa2)は、区間Tb2の描画画素(図11の画素Pb2)と同じと考えることができる。   Similarly, the interval Ta2 (−0.5 × dx ≦ D <−0.5 × dx) when the loop interval of the evaluation value D is set to −dx to dx is −0. It means that the same processing as that in the section Tb2 (−0.5 × dx−dy ≦ D <1.5) in the case of .5 × dx to 1.5 × dx is executed. In other words, in the Bresenham algorithm, when the evaluation value D exceeds dx, the pixel advanced by +1 in the y direction is used as the drawing pixel. Therefore, the pixel adjacent to the drawing pixel in the section Ta2 (pixel Pa2 in FIG. 11) is in the section Tb2. It can be considered the same as the drawing pixel (pixel Pb2 in FIG. 11).

また、図12に示すように、評価値Dのループ区間を−dx〜dx(図12中の区間T1)とした場合の区間Tc1(−dx≦D<−0.5×dx)は、評価値Dのループ区間を−0.5×dx〜1.5×dx(図12中の区間T2)とした場合の区間Td1(dx≦D<1.5×dx)と同じ処理が実行されることを意味する。つまり、ブレゼンハムアルゴリズムでは、評価値Dがdxを超えるとy方向に+1進んだ画素を描画画素とするので、区間Tc1の描画画素の上隣の画素(図12の画素Pc1)は、区間Td1の描画画素(図12の画素Pd1)と同じと考えることができる。   Also, as shown in FIG. 12, the section Tc1 (−dx ≦ D <−0.5 × dx) when the loop section of the evaluation value D is −dx to dx (section T1 in FIG. 12) is evaluated. The same processing as that of the section Td1 (dx ≦ D <1.5 × dx) when the loop section of the value D is −0.5 × dx to 1.5 × dx (section T2 in FIG. 12) is executed. Means that. That is, in the Bresenham algorithm, when the evaluation value D exceeds dx, the pixel advanced by +1 in the y direction is used as the drawing pixel. Therefore, the pixel adjacent to the drawing pixel in the section Tc1 (pixel Pc1 in FIG. 12) It can be considered the same as the drawing pixel (pixel Pd1 in FIG. 12).

また、図11の場合(dy≦0.5×dxの場合)、評価値Dのループ区間を−0.5×dx〜1.5×dxとしたとき、
(1)−0.5×dx≦D<0.5×dx―dyの場合、
P(x,y)=1
(2)0.5×dx−dy≦D<0.5×dxの場合、
P(x,y)=0.75
P(x,y+1)=0.25
(3)0.5×dx≦D<1.5×dx−dyの場合、
P(x,y)=0.5
P(x,y+1)=0.5
(4)1.5×dx−dy≦D<1.5×dxの場合、
P(x,y)=0.25
P(x,y+1)=0.75
となる。
In the case of FIG. 11 (when dy ≦ 0.5 × dx), when the loop section of the evaluation value D is −0.5 × dx to 1.5 × dx,
(1) In the case of −0.5 × dx ≦ D <0.5 × dx−dy,
P (x, y) = 1
(2) In the case of 0.5 × dx−dy ≦ D <0.5 × dx,
P (x, y) = 0.75
P (x, y + 1) = 0.25
(3) In the case of 0.5 × dx ≦ D <1.5 × dx−dy,
P (x, y) = 0.5
P (x, y + 1) = 0.5
(4) When 1.5 × dx−dy ≦ D <1.5 × dx,
P (x, y) = 0.25
P (x, y + 1) = 0.75
It becomes.

また、図12の場合(dy>0.5×dxの場合)、評価値Dのループ区間を−0.5×dx〜1.5×dxとしたとき、
(1)−0.5×dx≦D<0.5×dx―dyの場合、
P(x,y)=1
(2)0.5×dx−dy≦D<0.5×dxの場合、
P(x,y)=0.75
P(x,y+1)=0.25
(3)0.5×dx≦D<1.5×dx−dyの場合、
P(x,y)=0.5
P(x,y+1)=0.5
(4)1.5×dx−dy≦D<1.5×dxの場合、
P(x,y)=0.25
P(x,y+1)=0.75
となる。
In the case of FIG. 12 (when dy> 0.5 × dx), when the loop section of the evaluation value D is −0.5 × dx to 1.5 × dx,
(1) In the case of −0.5 × dx ≦ D <0.5 × dx−dy,
P (x, y) = 1
(2) In the case of 0.5 × dx−dy ≦ D <0.5 × dx,
P (x, y) = 0.75
P (x, y + 1) = 0.25
(3) In the case of 0.5 × dx ≦ D <1.5 × dx−dy,
P (x, y) = 0.5
P (x, y + 1) = 0.5
(4) When 1.5 × dx−dy ≦ D <1.5 × dx,
P (x, y) = 0.25
P (x, y + 1) = 0.75
It becomes.

上記から分かるように、図11の場合(dy≦0.5×dxの場合)も、図12の場合(dy>0.5×dxの場合)も、同じ場合分けによる同じ処理となる。   As can be seen from the above, the same processing by the same case is performed in both the case of FIG. 11 (when dy ≦ 0.5 × dx) and the case of FIG. 12 (when dy> 0.5 × dx).

つまり、評価値Dのループ区間を−0.5×dx〜1.5×dxとし、3つの閾値Th1、Th2、Th3を、
Th1=0.5×dx−dy
Th2=0.5×dx
Th3=1.5×dx―dy
とし、評価値Dのループ区間を4つ区間に分けて描画処理を行えばよい。
That is, the loop section of the evaluation value D is −0.5 × dx to 1.5 × dx, and the three threshold values Th1, Th2, and Th3 are set as follows:
Th1 = 0.5 × dx−dy
Th2 = 0.5 × dx
Th3 = 1.5 × dx−dy
The drawing process may be performed by dividing the loop section of the evaluation value D into four sections.

さらに、画像処理システム1000での描画処理は、ブレゼンハムアルゴリズムによる描画処理と同様、N回目の処理での描画対象画素を画素P(xn,yn)とすると、N+1回目の処理での描画対象画素は、画素P(xn+1,yn)または画素P(xn+1,yn+1)であるため、
dy/dx≦1
dy≦dx
が成り立つ。
Further, the drawing processing in the image processing system 1000 is similar to the drawing processing by the Bresenham algorithm. If the pixel to be drawn in the N-th processing is the pixel P (xn, yn), the drawing target pixel in the N + 1-th processing is , Pixel P (xn + 1, yn) or pixel P (xn + 1, yn + 1),
dy / dx ≦ 1
dy ≦ dx
Holds.

したがって、
−0.5×dx≦0.5×dx−dy≦0.5×dx≦1.5×dx―dy≦1.5×dx
が成り立つ。
Therefore,
−0.5 × dx ≦ 0.5 × dx−dy ≦ 0.5 × dx ≦ 1.5 × dx−dy ≦ 1.5 × dx
Holds.

つまり、
−0.5×dx≦Th1≦Th2≦Th3≦1.5×dx
が成り立つので、図11の場合(dy≦0.5×dxの場合)も、図12の場合(dy>0.5×dxの場合)も、−0.5dx、Th1〜Th3、1.5×dxの大小関係は同じである。
That means
−0.5 × dx ≦ Th1 ≦ Th2 ≦ Th3 ≦ 1.5 × dx
Therefore, in the case of FIG. 11 (when dy ≦ 0.5 × dx) and the case of FIG. 12 (when dy> 0.5 × dx), −0.5 dx, Th1 to Th3, 1.5 The size relationship of xdx is the same.

したがって、図11の場合(dy≦0.5×dxの場合)も、図12の場合(dy>0.5×dxの場合)も、同じ場合分けによる同じ処理を実行すればよいことになる。   Accordingly, in the case of FIG. 11 (in the case of dy ≦ 0.5 × dx) and in the case of FIG. 12 (in the case of dy> 0.5 × dx), it is only necessary to execute the same processing by the same case classification. .

このように、評価値Dのループ区間を−0.5×dx〜1.5×dxにすることで、評価値Dのループ区間を−dx〜dxとする場合に比べて、場合分けの数を少なくすることができる。   In this way, by setting the loop section of the evaluation value D to be −0.5 × dx to 1.5 × dx, the number of cases is different from the case of setting the loop section of the evaluation value D to be −dx to dx. Can be reduced.

画像処理システム1000では、評価値Dのループ区間を−0.5×dx〜1.5×dxに設定し、上記のように設定した3つの閾値Th1、Th2、Th3により、上記ループ区間を4つの区間に分け、評価値Dがどの区間の値であるかによって、描画画素およびその画素値(描画色の濃度)を決定する。そして、画像処理システム1000では、同列に位置する描画画素(x座標位置が同一の描画画素)の重心位置が、線分の始点と終点とを通る直線と近くなるように、評価値Dに基づいて、描画画素およびその画素値(描画色の濃度)が決定される。   In the image processing system 1000, the loop section of the evaluation value D is set to −0.5 × dx to 1.5 × dx, and the loop section is set to 4 by the three threshold values Th1, Th2, and Th3 set as described above. A drawing pixel and its pixel value (drawing color density) are determined according to which section the evaluation value D is divided into two sections. In the image processing system 1000, based on the evaluation value D, the gravity center position of the drawing pixels (drawing pixels having the same x coordinate position) located in the same column is close to the straight line passing through the start point and the end point of the line segment. Thus, the drawing pixel and its pixel value (drawing color density) are determined.

つまり、画像処理システム1000では、横方向(x軸方向)および縦方向(y軸方向)に解像度を2倍にした場合にどのように描画位置がずれるかを考慮し、上記のように、評価値Dのループ区間を分ける閾値Th1〜Th3を決定し、評価値Dが分割したループ区間のどの範囲に含まれるかによって、描画画素とその画素値(描画色の濃度)を決定するので、パワーサンプリング手法(オーバーサンプリング手法)と同様に、エイリアス成分を抑制することができる。その結果、画像処理システム1000により描画した線分では、ジャギー(エイリアス成分)が目立たない。   In other words, the image processing system 1000 considers how the drawing position shifts when the resolution is doubled in the horizontal direction (x-axis direction) and the vertical direction (y-axis direction), and evaluates as described above. The threshold values Th1 to Th3 for dividing the loop section of the value D are determined, and the drawing pixel and its pixel value (the density of the drawing color) are determined depending on which range of the divided loop section the evaluation value D is included. Similar to the sampling method (oversampling method), alias components can be suppressed. As a result, the jaggy (alias component) is not noticeable in the line segment drawn by the image processing system 1000.

なお、画像処理システム1000では、場合分けによって、描画処理を実行することができ、実際に解像度を上げる処理等を行う必要がないので、パワーサンプリング手法(オーバーサンプリング手法)とは異なり、大容量のメモリは不要である。   In the image processing system 1000, drawing processing can be executed depending on the case, and it is not necessary to actually perform processing for increasing the resolution. Therefore, unlike the power sampling method (oversampling method), the image processing system 1000 has a large capacity. No memory is required.

以上の通り、画像処理システム1000では、大容量のメモリや複雑な演算処理を必要とせず、低コストで、線分描画時に生じるエイリアシングを効果的に低減することができる。   As described above, the image processing system 1000 does not require a large-capacity memory and complicated arithmetic processing, and can effectively reduce aliasing that occurs during line segment drawing at low cost.

なお、図2のフローチャートを用いて説明した画像処理システム1000の処理では、整数演算のみで処理が実行できるように閾値Th1〜Th3、評価値Dの更新処理等を変更している。画像処理システム1000の処理では、評価値Dと、評価値Dのループ区間を決定する、−0.5×dx、1.5×dxと、閾値Th1〜Th3との大小関係が分かれば処理が実行できるので、整数演算のみで処理が実行できるように閾値Th1〜Th3、評価値Dの更新処理等を調整することができる。   In the process of the image processing system 1000 described with reference to the flowchart of FIG. 2, the threshold value Th1 to Th3, the update process of the evaluation value D, and the like are changed so that the process can be executed only by integer arithmetic. In the processing of the image processing system 1000, if the magnitude relationship between the evaluation value D, the loop section of the evaluation value D, -0.5 × dx, 1.5 × dx, and the threshold values Th1 to Th3 is known, the processing is performed. Since it can be executed, the threshold value Th1 to Th3, the update process of the evaluation value D, and the like can be adjusted so that the process can be executed only by integer arithmetic.

図13に、画像処理システム1000の処理を一般化した場合のフローチャートを示す。   FIG. 13 shows a flowchart when the processing of the image processing system 1000 is generalized.

図13のフローチャートは、図2のフローチャートにおいて、ステップS2をステップS2’に置換し、ステップS11をステップS11’に置換し、ステップS12をステップS12’に置換し、ステップS13をステップS13’に置換したものである。それ以外については、図13のフローチャートは、図2のフローチャートと同じである。   The flowchart of FIG. 13 replaces step S2 with step S2 ′, replaces step S11 with step S11 ′, replaces step S12 with step S12 ′, and replaces step S13 with step S13 ′ in the flowchart of FIG. It is a thing. Otherwise, the flowchart of FIG. 13 is the same as the flowchart of FIG.

図13のフローチャートにおいて、kは、正の実数である。   In the flowchart of FIG. 13, k is a positive real number.

k=1とした場合が、上記で説明した場合となる。つまり、k=1とした場合、
評価値Dのループ区間:−0.5×dx〜1.5×dx
Th1=0.5×dx−dy
Th2=0.5×dx
Th3=1.5×dx―dy
となる。
The case where k = 1 is the case described above. That is, if k = 1,
Loop section of evaluation value D: −0.5 × dx to 1.5 × dx
Th1 = 0.5 × dx−dy
Th2 = 0.5 × dx
Th3 = 1.5 × dx−dy
It becomes.

また、図2のフローチャートは、k=2の場合である。つまり、k=2とした場合、
評価値Dのループ区間:−dx〜3×dx
Th1=dx−2×dy
Th2=dx
Th3=3×dx―2×dy
となる。
The flowchart in FIG. 2 is for k = 2. That is, if k = 2,
Loop section of evaluation value D: −dx to 3 × dx
Th1 = dx−2 × dy
Th2 = dx
Th3 = 3 × dx-2 × dy
It becomes.

この場合、整数演算のみで、描画処理を実行することができる。   In this case, the drawing process can be executed only by integer arithmetic.

また、上記では、dy/dx≦1を前提とする描画処理、つまり、傾きが0以上1以下の線分の描画処理について説明したが、これに限定されることはない。線分の傾きが1以上、あるいは、0未満の線分の描画処理についても、上記と同様の考え方により、場合分けすることで、描画処理を実行するようにしてもよい。   In the above description, the drawing process on the premise of dy / dx ≦ 1, that is, the drawing process of a line segment having an inclination of 0 or more and 1 or less is described, but the present invention is not limited to this. With respect to the drawing process of a line segment having a line segment inclination of 1 or more or less than 0, the drawing process may be executed by dividing into cases according to the same concept as described above.

≪第1変形例≫
次に、第1実施形態の第1変形例について、説明する。
≪First modification≫
Next, a first modification of the first embodiment will be described.

図14は、本変形例に係る画像処理システム1000Aの概略構成図である。   FIG. 14 is a schematic configuration diagram of an image processing system 1000A according to the present modification.

本変形例の画像処理システム1000Aは、第1実施形態の画像処理システム1000において、画像処理装置1を画像処理装置1Aに置換した構成を有する。   An image processing system 1000A according to this modification has a configuration in which the image processing apparatus 1 is replaced with the image processing apparatus 1A in the image processing system 1000 according to the first embodiment.

画像処理装置1Aは、画像処理装置1において、座標変換部15と座標逆変換部16とを追加した構成を有する。   The image processing apparatus 1 </ b> A has a configuration in which a coordinate conversion unit 15 and a coordinate reverse conversion unit 16 are added to the image processing apparatus 1.

それ以外については、本変形例の画像処理システム1000Aは、第1実施形態の画像処理システム1000と同様である。   Other than that, the image processing system 1000A of the present modification is the same as the image processing system 1000 of the first embodiment.

以下では、本変形例に特有の部分について説明する。また、本変形例において、上記実施形態と同様の部分については、同一符号を付し、詳細な説明を省略する。   Below, the part peculiar to this modification is demonstrated. Moreover, in this modification, about the part similar to the said embodiment, the same code | symbol is attached | subjected and detailed description is abbreviate | omitted.

座標変換部15は、入力部11から出力される線分情報を入力し、線分の始点の座標(x1,y1)と終点の座標(x2,y2)を座標変換する。この座標変換について、図15を用いて説明する。   The coordinate conversion unit 15 receives the line segment information output from the input unit 11, and performs coordinate conversion of the start point coordinates (x1, y1) and the end point coordinates (x2, y2). This coordinate conversion will be described with reference to FIG.

図15は、座標変換を説明するための図である。   FIG. 15 is a diagram for explaining the coordinate conversion.

座標変換部15は、図15に示すように、x軸、y軸を設定し、x軸、y軸、y=xの直線、および、y=−xの直線により分割される8つの領域を、領域1〜領域8として設定する。   As shown in FIG. 15, the coordinate conversion unit 15 sets the x-axis and the y-axis, and the eight regions divided by the x-axis, the y-axis, the y = x straight line, and the y = −x straight line. , Region 1 to region 8 are set.

座標変換部15は、線分の始点(x1,y1)が、図15で示した座標の原点(0,0)となるように座標変換を行う。これにより、線分の終点の座標は、(x2−x1,y2−y1)に座標変換される。
(1)変換された点(x2−x1,y2−y1)が、図15の領域1に存在する場合、
xa=x2−x1
ya=y2−y1
として、第1実施形態と同様の処理により、描画処理が実行される。
(2)変換された点(x2−x1,y2−y1)が、図15の領域2に存在する場合、x座標の値とy座標の値を入れ替える。つまり、
ya=x2−x1
xa=y2−y1
とする。
The coordinate conversion unit 15 performs coordinate conversion so that the starting point (x1, y1) of the line segment becomes the origin (0, 0) of the coordinates shown in FIG. Thereby, the coordinates of the end point of the line segment are converted to (x2-x1, y2-y1).
(1) When the converted point (x2-x1, y2-y1) exists in the region 1 in FIG.
xa = x2-x1
ya = y2-y1
As described above, the drawing process is executed by the same process as in the first embodiment.
(2) When the converted point (x2-x1, y2-y1) exists in the area 2 of FIG. 15, the value of the x coordinate and the value of the y coordinate are switched. That means
ya = x2-x1
xa = y2-y1
And

これにより、点(0,0)から点(xa,ya)への線分描画処理を、第1実施形態と同様の処理を行うことができる。つまり、原点から領域2に含まれる点への線分を、原点から領域1に含まれる点への線分に変換して、第1実施形態と同様を適用する。
(3)変換された点(x2−x1,y2−y1)が、図15の領域3〜8に存在する場合も、上記と同様に、原点から領域3〜8のいずれかに含まれる点への線分を、原点から領域1に含まれる点への線分に変換して、第1実施形態と同様を適用する。
Thereby, the line segment drawing process from the point (0, 0) to the point (xa, ya) can be performed in the same manner as in the first embodiment. That is, the line segment from the origin to the point included in the area 2 is converted into the line segment from the origin to the point included in the area 1 and the same as in the first embodiment is applied.
(3) Even when the converted point (x2-x1, y2-y1) is present in the regions 3 to 8 in FIG. 15, as described above, from the origin to a point included in any of the regions 3 to 8 Is converted into a line segment from the origin to a point included in the region 1, and the same as in the first embodiment is applied.

そして、座標変換部15は、上記のように座標変換し、線分の始点(0,0)、線分の終点(xa,ya)を、線分情報に含める。また、座標変換部15は、座標変換に関する情報、すなわち、座標変換前の線分の始点(x1,y1)についての情報、線分の終点が領域1に含まれるようにするために実行した変換方法についての情報(例えば、領域8から領域1へ変換した場合、x座標値はそのままで、y座標値の符号を反転(−1を乗算)したことを示す情報)を、線分情報に含める。   Then, the coordinate conversion unit 15 converts the coordinates as described above, and includes the start point (0, 0) of the line segment and the end point (xa, ya) of the line segment in the line segment information. In addition, the coordinate conversion unit 15 performs information for coordinate conversion, that is, information about the start point (x1, y1) of the line segment before the coordinate conversion, and conversion performed so that the end point of the line segment is included in the region 1 Information about the method (for example, when converting from region 8 to region 1, information indicating that the x coordinate value remains unchanged and the sign of the y coordinate value is inverted (multiplied by −1)) is included in the line segment information. .

そして、座標変換部15は、上記のようにして更新した線分情報を、閾値設定部12と、評価値取得部13と、描画情報決定部14と、座標逆変換部16とに出力する。   Then, the coordinate conversion unit 15 outputs the line segment information updated as described above to the threshold setting unit 12, the evaluation value acquisition unit 13, the drawing information determination unit 14, and the coordinate reverse conversion unit 16.

閾値設定部12、評価値取得部13、および、描画情報決定部14では、第1実施形態と同様の処理が実行される。   In the threshold setting unit 12, the evaluation value acquisition unit 13, and the drawing information determination unit 14, processing similar to that in the first embodiment is executed.

座標逆変換部16は、描画情報決定部14から出力される描画画素とその画素値(描画色の濃度)に関する情報と、座標変換部15から出力される線分情報とを入力する。   The coordinate inverse conversion unit 16 inputs the drawing pixel output from the drawing information determination unit 14 and information regarding the pixel value (drawing color density) and the line segment information output from the coordinate conversion unit 15.

そして、座標逆変換部16は、座標変換部15で実行された変換と逆の変換を実行し、描画画素の位置を決定する。   Then, the coordinate inverse conversion unit 16 performs a conversion opposite to the conversion performed by the coordinate conversion unit 15 and determines the position of the drawing pixel.

例えば、座標変換部15で実行された変換が領域8から領域1へ変換する処理である場合、座標逆変換部は、描画情報決定部14から出力される描画画素P(xb,yb)を、画素P(xb,−yb)へ座標変換し、さらに、線分の始点(x1,y1)から、図15の座標の原点への移動分を元に戻す座標変換を行う。つまり、座標逆変換部は、描画情報決定部14から出力される描画画素P(xb,yb)を、画素P(xb+x1,−yb+y1)へ座標変換する。   For example, when the conversion executed by the coordinate conversion unit 15 is a process of converting from the region 8 to the region 1, the coordinate reverse conversion unit converts the drawing pixel P (xb, yb) output from the drawing information determination unit 14 to Coordinate conversion is performed to the pixel P (xb, -yb), and further, coordinate conversion is performed to restore the movement from the start point (x1, y1) of the line segment to the origin of the coordinates in FIG. That is, the coordinate reverse conversion unit converts the drawing pixel P (xb, yb) output from the drawing information determination unit 14 into the pixel P (xb + x1, −yb + y1).

そして、座標逆変換部は、画素P(xb+x1,−yb+y1)に相当する画素が、描画情報決定部14から出力された画素値(描画画素P(xb,yb)の画素値として出力された画素値)となるように、表示用メモリ2のアドレスにデータ(当該画素値に相当するデータ)を書き込む。   Then, the coordinate inverse transform unit outputs the pixel corresponding to the pixel P (xb + x1, −yb + y1) as the pixel value output from the drawing information determination unit 14 (the pixel value of the drawing pixel P (xb, yb)). Value), data (data corresponding to the pixel value) is written at the address of the display memory 2.

以上のように、本変形例に係る画像処理システム1000Aでは、座標変換して、第1実施形態と同様の描画処理を実行し、その後、座標逆変換することで、任意の線分(任意の傾きの線分)の描画処理が実行される。したがって、本変形例に係る画像処理システム1000Aでは、線分の傾きごとに、別々の場合分けをすることなく、第1実施形態で示した処理のみを用いて、描画処理を実行することができる。その結果、本変形例に係る画像処理システム1000Aでは、大容量のメモリや複雑な演算処理を必要とせず、線分描画時に生じるエイリアシングを効果的に低減することができる。   As described above, in the image processing system 1000A according to the present modification, the coordinate conversion is performed, the drawing process similar to that of the first embodiment is performed, and then the coordinate reverse conversion is performed, so that an arbitrary line segment (the arbitrary line (Slope line segment) is drawn. Therefore, in the image processing system 1000A according to the present modification, the drawing process can be executed using only the process shown in the first embodiment without dividing the case for each inclination of the line segment. . As a result, the image processing system 1000A according to the present modification does not require a large-capacity memory or complicated arithmetic processing, and can effectively reduce aliasing that occurs during line segment drawing.

[他の実施形態]
上記実施形態および変形例では、線分の線の太さが1画素分である場合を例に説明したが、これに限定されることはなく、線分の太さは、他の太さであってもよい。線分の太さが2画素分以上である場合、画像上において、当該線分と背景との境界領域に位置する領域(当該線分の上端または下端の領域)において、上記実施形態の描画処理と同様の処理を適用すればよい。これにより、当該線分と背景との境界領域において、エイリアス成分を適切に抑制した描画処理を実行することができる。
[Other Embodiments]
In the above embodiment and the modification, the case where the line thickness is one pixel has been described as an example, but the present invention is not limited to this, and the thickness of the line segment may be another thickness. There may be. When the thickness of the line segment is equal to or greater than 2 pixels, the rendering process of the above embodiment is performed in an area (the upper end or lower end area of the line segment) located in the boundary area between the line segment and the background on the image. The same processing as that described above may be applied. Thereby, it is possible to execute a drawing process in which alias components are appropriately suppressed in the boundary region between the line segment and the background.

また、上記実施形態および変形例では、図2および図13のステップS7〜S10において、設定される画素値が、「255」、「192」、「128」、「64」としたが、これに限定されることはなく、同列に位置する描画画素(x座標位置が同一の描画画素)の重心位置が、線分の始点と終点とを通る直線と近くなるように、他の値に設定するようにしてもよい。   In the embodiment and the modification, the pixel values set in steps S7 to S10 in FIGS. 2 and 13 are “255”, “192”, “128”, and “64”. There is no limitation, and other values are set so that the barycentric positions of the drawing pixels located in the same row (drawing pixels having the same x coordinate position) are close to a straight line passing through the start point and end point of the line segment. You may do it.

上記実施形態および変形例の一部または全部を組み合わせて、画像処理システム、画像処理装置を構成するようにしてもよい。   You may make it comprise an image processing system and an image processing apparatus combining a part or all of the said embodiment and modification.

また、上記実施形態の画像処理システム、画像処理装置の一部または全部は、集積回路(例えば、LSI、システムLSI等)として実現されるものであってもよい。   In addition, part or all of the image processing system and the image processing apparatus according to the above-described embodiment may be realized as an integrated circuit (for example, an LSI, a system LSI, or the like).

上記実施形態の各機能ブロックの処理の一部または全部は、プログラムにより実現されるものであってもよい。そして、上記実施形態の各機能ブロックの処理の一部または全部は、コンピュータにおいて、中央演算装置(CPU)により行われる。また、それぞれの処理を行うためのプログラムは、ハードディスク、ROMなどの記憶装置に格納されており、ROMにおいて、あるいはRAMに読み出されて実行される。   Part or all of the processing of each functional block in the above embodiment may be realized by a program. A part or all of the processing of each functional block in the above embodiment is performed by a central processing unit (CPU) in the computer. In addition, a program for performing each processing is stored in a storage device such as a hard disk or a ROM, and is read out and executed in the ROM or the RAM.

また、上記実施形態の各処理をハードウェアにより実現してもよいし、ソフトウェア(OS(オペレーティングシステム)、ミドルウェア、あるいは、所定のライブラリとともに実現される場合を含む。)により実現してもよい。さらに、ソフトウェアおよびハードウェアの混在処理により実現しても良い。なお、上記実施形態に係る画像処理システム、画像処理装置をハードウェアにより実現する場合、各処理を行うためのタイミング調整を行う必要があるのは言うまでもない。上記実施形態においては、説明便宜のため、実際のハードウェア設計で生じる各種信号のタイミング調整の詳細については省略している。   Each processing of the above embodiment may be realized by hardware, or may be realized by software (including a case where the processing is realized together with an OS (Operating System), middleware, or a predetermined library). Further, it may be realized by mixed processing of software and hardware. Needless to say, when the image processing system and the image processing apparatus according to the above-described embodiment are realized by hardware, it is necessary to adjust the timing for performing each process. In the above embodiment, for convenience of explanation, details of timing adjustment of various signals generated in actual hardware design are omitted.

また、上記実施形態における処理方法の実行順序は、必ずしも、上記実施形態の記載に制限されるものではなく、発明の要旨を逸脱しない範囲で、実行順序を入れ替えることができるものである。   Moreover, the execution order of the processing method in the said embodiment is not necessarily restricted to description of the said embodiment, The execution order can be changed in the range which does not deviate from the summary of invention.

前述した方法をコンピュータに実行させるコンピュータプログラム及びそのプログラムを記録したコンピュータ読み取り可能な記録媒体は、本発明の範囲に含まれる。ここで、コンピュータ読み取り可能な記録媒体としては、例えば、フレキシブルディスク、ハードディスク、CD−ROM、MO、DVD、DVD−ROM、DVD−RAM、BD(Blu−ray Disc)、半導体メモリを挙げることができる。   A computer program that causes a computer to execute the above-described method and a computer-readable recording medium that records the program are included in the scope of the present invention. Here, examples of the computer-readable recording medium include a flexible disk, a hard disk, a CD-ROM, an MO, a DVD, a DVD-ROM, a DVD-RAM, a BD (Blu-ray Disc), and a semiconductor memory. .

上記コンピュータプログラムは、上記記録媒体に記録されたものに限られず、電気通信回線、無線又は有線通信回線、インターネットを代表とするネットワーク等を経由して伝送されるものであってもよい。   The computer program is not limited to the one recorded on the recording medium, and may be transmitted via a telecommunication line, a wireless or wired communication line, a network represented by the Internet, or the like.

なお、本発明の具体的な構成は、前述の実施形態に限られるものではなく、発明の要旨を逸脱しない範囲で種々の変更および修正が可能である。   The specific configuration of the present invention is not limited to the above-described embodiment, and various changes and modifications can be made without departing from the scope of the invention.

1000、1000A 画像処理システム
1、1A 画像処理装置
11 入力部
12 閾値設定部
13 評価値取得部
14 描画情報決定部
15 座標変換部
16 座標逆変換部
1000, 1000A image processing system 1, 1A image processing device 11 input unit 12 threshold setting unit 13 evaluation value acquisition unit 14 drawing information determination unit 15 coordinate conversion unit 16 coordinate reverse conversion unit

Claims (7)

画像上において、線分を描画するための線分描画情報を取得するための画像処理装置であって、
前記線分を描画するための情報を入力するための入力部と、
前記線分を描画するための描画情報を取得する線分描画情報取得部と、
を備え、
前記線分描画情報取得部は、
描画対象画素である画素P(xa,ya)と、前記線分の始点と終点とを通る直線と、の位置関係を示す評価値Dを取得する評価値取得部と、
前記始点から前記終点までのx方向の差分量dxと、前記始点から前記終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する閾値設定部と、
前記評価値Dと前記閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と前記描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する描画情報決定部と、
を備え、
前記評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たし、
前記閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たし、
評価値取得部は、
前記評価値Dを前記差分量dyに基づいて更新し、
更新した評価値Dが1.5×dx×k以上である場合、前記更新した評価値Dをさらに前記差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定し、
更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する、
画像処理装置。
An image processing apparatus for acquiring line segment drawing information for drawing a line segment on an image,
An input unit for inputting information for drawing the line segment;
A line segment drawing information acquisition unit for acquiring drawing information for drawing the line segment;
With
The line segment drawing information acquisition unit
An evaluation value acquisition unit that acquires an evaluation value D indicating a positional relationship between a pixel P (xa, ya) that is a drawing target pixel and a straight line that passes through the start point and end point of the line segment;
A threshold value setting unit that sets at least three threshold values Th1, Th2, and Th3 based on a difference amount dx in the x direction from the start point to the end point and a difference amount dy in the y direction from the start point to the end point;
Based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa, ya + 1) in the y-axis positive direction of the drawing target pixel A drawing information determination unit that determines the density of the drawing color of
With
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: satisfies a positive real number,
The threshold values Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
The filling,
The evaluation value acquisition unit
Updating the evaluation value D based on the difference amount dy;
When the updated evaluation value D is 1.5 × dx × k or more, the updated evaluation value D is further updated based on the difference amount dx, and the next drawing target pixel is set to P (xa + 1, ya + 1). Decide
When the updated evaluation value D is less than 1.5 × dx × k, the next drawing target pixel is determined to be P (xa + 1, ya).
Image processing device.
前記評価値Dの初期値は、「0」であり、
前記描画情報決定部は、
(1)前記評価値Dが−0.5×dx×k≦D<Th1を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DAとし、
(2)前記評価値DがTh1≦D<Th2を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DB1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DB2とし、
(3)前記評価値DがTh2≦D<Th3を満たす場合、画素P(xa,ya)の描画色の濃度を濃度DC1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DC2とし、
(4)前記評価値DがTh3≦D<1.5×dx×kを満たす場合、画素P(xa,ya)の描画色の濃度を濃度DD1とするとともに、画素P(xa,ya+1)の描画色の濃度を濃度DD2とし、
描画色の濃度の値が大きい程、描画色の濃度が濃くなるように設定した場合、前記濃度DA、DB1、DB2、DC1、DC2、DD1、および、DD2は、
DA≧DB1≧DC1≧DD1
DB2≦DC2≦DD2
を満たす、
請求項1に記載の画像処理装置。
The initial value of the evaluation value D is “0”,
The drawing information determination unit
(1) When the evaluation value D satisfies −0.5 × dx × k ≦ D <Th1, the density of the drawing color of the pixel P (xa, ya) is the density DA,
(2) When the evaluation value D satisfies Th1 ≦ D <Th2, the density of the drawing color of the pixel P (xa, ya) is set to the density DB1, and the density of the drawing color of the pixel P (xa, ya + 1) is set to the density. DB2
(3) When the evaluation value D satisfies Th2 ≦ D <Th3, the density of the drawing color of the pixel P (xa, ya) is set to the density DC1, and the density of the drawing color of the pixel P (xa, ya + 1) is set to the density. DC2
(4) When the evaluation value D satisfies Th3 ≦ D <1.5 × dx × k, the density of the drawing color of the pixel P (xa, ya) is set to the density DD1, and the pixel P (xa, ya + 1) The density of the drawing color is density DD2,
When the drawing color density is set to be larger as the drawing color density value is larger, the densities DA, DB1, DB2, DC1, DC2, DD1, and DD2 are:
DA ≧ DB1 ≧ DC1 ≧ DD1
DB2 ≦ DC2 ≦ DD2
Meet,
The image processing apparatus according to claim 1.
評価値取得部は、
D=D+2×dy×k
により、前記評価値Dを更新し、
更新した評価値Dが1.5×dx×k以上である場合、前記更新した評価値Dをさらに、
D=D−2×dx×k
により更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定する、
請求項1又は2に記載の画像処理装置。
The evaluation value acquisition unit
D = D + 2 × dy × k
To update the evaluation value D,
When the updated evaluation value D is 1.5 × dx × k or more, the updated evaluation value D is further
D = D−2 × dx × k
And the next drawing target pixel is determined to be P (xa + 1, ya + 1).
The image processing apparatus according to claim 1.
前記線分の始点である第1点と前記線分の終点である第2点とを結ぶ直線の傾きが0以上1以下でない場合、第3点と第4点とを結ぶ直線の傾きが0以上1以下となるように前記第3点および前記第4点を設定し、前記第1点を前記第3点に座標変換し、前記第2点を前記第4点に座標変換する座標変換処理を行う座標変換部と、
前記座標変換処理の座標逆変換処理を行う座標逆変換部と、
をさらに備え、
前記線分描画情報取得部は、前記第3点を前記線分の前記始点とし、前記第4点を前記線分の前記終点として、前記第3点と前記第4点とを結ぶ線分を描画するための描画情報を取得し、
前記座標逆変換部は、前記線分描画情報取得部により取得された前記第3点と前記第4点とを結ぶ線分を描画するための描画情報に含まれる座標位置情報に対して、前記座標逆変換処理を行う、
請求項1から3のいずれかに記載の画像処理装置。

When the slope of the straight line connecting the first point that is the start point of the line segment and the second point that is the end point of the line segment is not greater than 0 and less than 1, the slope of the straight line connecting the third point and the fourth point is 0. A coordinate conversion process in which the third point and the fourth point are set to be 1 or less, the first point is coordinate-converted to the third point, and the second point is coordinate-converted to the fourth point. A coordinate conversion unit for performing
A coordinate inverse transform unit for performing the coordinate inverse transform process of the coordinate transform process;
Further comprising
The line segment drawing information acquisition unit selects a line segment connecting the third point and the fourth point with the third point as the start point of the line segment and the fourth point as the end point of the line segment. Get drawing information for drawing,
The coordinate reverse conversion unit is configured to perform the processing for the coordinate position information included in the drawing information for drawing the line segment connecting the third point and the fourth point acquired by the line segment drawing information acquisition unit. Perform coordinate reverse transformation processing,
The image processing apparatus according to claim 1.

前記係数kは、
k=2×n(nは自然数)
である、
請求項1から4のいずれかに記載の画像処理装置。
The coefficient k is
k = 2 × n (n is a natural number)
Is,
The image processing apparatus according to claim 1.
画像上において、線分を描画するための線分描画情報を取得するための画像処理方法をコンピュータに実行させるためのプログラムであって、
前記線分を描画するための情報を入力するための入力ステップと、
前記線分を描画するための描画情報を取得する線分描画情報取得ステップと、
を備え、
前記線分描画情報取得ステップは、
描画対象画素である画素P(xa,ya)と、前記線分の始点および前記線分の終点とを通る直線と、の位置関係を示す評価値Dを取得する評価値取得ステップと、
前記始点から前記終点までのx方向の差分量dxと、前記始点から前記終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する閾値設定ステップと、
前記評価値Dと前記閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と前記描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する描画情報決定ステップと、
を備え、
前記評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たし、
前記閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たし、
評価値取得ステップは、
前記評価値Dを前記差分量dyに基づいて更新し、
更新した評価値Dが1.5×dx×k以上である場合、前記更新した評価値Dをさらに前記差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定し、
更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する、
画像処理方法をコンピュータに実行させるためのプログラム。
A program for causing a computer to execute an image processing method for acquiring line segment drawing information for drawing a line segment on an image,
An input step for inputting information for drawing the line segment;
A line segment drawing information acquisition step for acquiring drawing information for drawing the line segment;
With
The line segment drawing information acquisition step includes:
An evaluation value acquisition step of acquiring an evaluation value D indicating a positional relationship between a pixel P (xa, ya) that is a drawing target pixel and a straight line passing through the start point of the line segment and the end point of the line segment;
A threshold setting step for setting at least three threshold values Th1, Th2 and Th3 based on a difference amount dx in the x direction from the start point to the end point and a difference amount dy in the y direction from the start point to the end point;
Based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa, ya + 1) in the y-axis positive direction of the drawing target pixel A drawing information determination step for determining the density of the drawing color of
With
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: satisfies a positive real number,
The threshold values Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
The filling,
The evaluation value acquisition step
Updating the evaluation value D based on the difference amount dy;
When the updated evaluation value D is 1.5 × dx × k or more, the updated evaluation value D is further updated based on the difference amount dx, and the next drawing target pixel is set to P (xa + 1, ya + 1). Decide
When the updated evaluation value D is less than 1.5 × dx × k, the next drawing target pixel is determined to be P (xa + 1, ya).
A program for causing a computer to execute an image processing method.
画像上において、線分を描画するための線分描画情報を取得するための画像処理用の集積回路であって、
前記線分を描画するための情報を入力するための入力部と、
前記線分を描画するための描画情報を取得する線分描画情報取得部と、
を備え、
前記線分描画情報取得部は、
描画対象画素である画素P(xa,ya)と、前記線分の始点と終点とを通る直線と、の位置関係を示す評価値Dを取得する評価値取得部と、
前記始点から前記終点までのx方向の差分量dxと、前記始点から前記終点までのy方向の差分量dyとに基づいて、少なくとも3つの閾値Th1、Th2およびTh3を設定する閾値設定部と、
前記評価値Dと前記閾値Th1、Th2およびTh3とに基づいて、描画対象画素P(xa,ya)の描画色の濃度と前記描画対象画素のy軸正方向の隣接画素P(xa,ya+1)の描画色の濃度とを決定する描画情報決定部と、
を備え、
前記評価値Dは、
−0.5×dx×k≦D≦1.5×dx×k
係数k:正の実数
を満たし、
前記閾値Th1、Th2およびTh3は、
−0.5×dx×k<Th1<Th2<Th3<1.5×dx×k
を満たし、
評価値取得部は、
前記評価値Dを前記差分量dyに基づいて更新し、
更新した評価値Dが1.5×dx×k以上である場合、前記更新した評価値Dをさらに前記差分量dxに基づいて更新するとともに、次の描画対象画素をP(xa+1,ya+1)に決定し、
更新した評価値Dが1.5×dx×k未満である場合、次の描画対象画素をP(xa+1,ya)に決定する、
集積回路。
An integrated circuit for image processing for acquiring line segment drawing information for drawing a line segment on an image,
An input unit for inputting information for drawing the line segment;
A line segment drawing information acquisition unit for acquiring drawing information for drawing the line segment;
With
The line segment drawing information acquisition unit
An evaluation value acquisition unit that acquires an evaluation value D indicating a positional relationship between a pixel P (xa, ya) that is a drawing target pixel and a straight line that passes through the start point and end point of the line segment;
A threshold value setting unit that sets at least three threshold values Th1, Th2, and Th3 based on a difference amount dx in the x direction from the start point to the end point and a difference amount dy in the y direction from the start point to the end point;
Based on the evaluation value D and the threshold values Th1, Th2, and Th3, the density of the drawing color of the drawing target pixel P (xa, ya) and the adjacent pixel P (xa, ya + 1) in the y-axis positive direction of the drawing target pixel A drawing information determination unit that determines the density of the drawing color of
With
The evaluation value D is
−0.5 × dx × k ≦ D ≦ 1.5 × dx × k
Coefficient k: satisfies a positive real number,
The threshold values Th1, Th2 and Th3 are:
−0.5 × dx × k <Th1 <Th2 <Th3 <1.5 × dx × k
The filling,
The evaluation value acquisition unit
Updating the evaluation value D based on the difference amount dy;
When the updated evaluation value D is 1.5 × dx × k or more, the updated evaluation value D is further updated based on the difference amount dx, and the next drawing target pixel is set to P (xa + 1, ya + 1). Decide
When the updated evaluation value D is less than 1.5 × dx × k, the next drawing target pixel is determined to be P (xa + 1, ya).
Integrated circuit.
JP2013062952A 2013-03-25 2013-03-25 Image processing apparatus, program, and integrated circuit Expired - Fee Related JP6122322B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013062952A JP6122322B2 (en) 2013-03-25 2013-03-25 Image processing apparatus, program, and integrated circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013062952A JP6122322B2 (en) 2013-03-25 2013-03-25 Image processing apparatus, program, and integrated circuit

Publications (2)

Publication Number Publication Date
JP2014186682A JP2014186682A (en) 2014-10-02
JP6122322B2 true JP6122322B2 (en) 2017-04-26

Family

ID=51834155

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013062952A Expired - Fee Related JP6122322B2 (en) 2013-03-25 2013-03-25 Image processing apparatus, program, and integrated circuit

Country Status (1)

Country Link
JP (1) JP6122322B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113610944B (en) * 2021-07-30 2024-06-14 新线科技有限公司 Line drawing method, device, equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05266205A (en) * 1992-03-19 1993-10-15 Fujitsu Ltd Line plotting system
JPH06266307A (en) * 1993-03-17 1994-09-22 Nippondenso Co Ltd Display device
JP4301037B2 (en) * 2004-03-02 2009-07-22 セイコーエプソン株式会社 Line drawing apparatus, line drawing method, and line drawing program
JP4749868B2 (en) * 2006-01-19 2011-08-17 富士通セミコンダクター株式会社 Image processing device

Also Published As

Publication number Publication date
JP2014186682A (en) 2014-10-02

Similar Documents

Publication Publication Date Title
JP6157138B2 (en) Image processing device
US20060204139A1 (en) Image processing device, image processing method, display controller, and electronic instrument
CN105354809A (en) Predistortion method and device based on pixel position index of output image
WO2010134347A1 (en) Graphics drawing device, graphics drawing method, graphics drawing program, storage medium having graphics drawing program stored, and integrated circuit for drawing graphics
JP5669523B2 (en) Frame interpolation apparatus and method, program, and recording medium
JP2012506646A (en) Video interpolating apparatus and method using region segmentation
JP4255467B2 (en) Digital gamma correction circuit and digital gamma correction method
US8948502B2 (en) Image processing method, and image processor
US9548043B2 (en) Pixel value interpolation method and system
JP4086035B2 (en) Automatic image correction circuit
US8134557B2 (en) Image processing apparatus and image processing method
JP6122322B2 (en) Image processing apparatus, program, and integrated circuit
JP5316385B2 (en) Image processing apparatus and image processing program
JP4686388B2 (en) Image enlarging apparatus and image enlarging method
JP2009008945A (en) Image signal processor, image signal processing method and program
US8907955B2 (en) Vector image drawing device, vector image drawing method, and recording medium
JP2008228251A (en) Image processor, image processing method, and image processing program
JP6242196B2 (en) Image processing apparatus, image processing apparatus control method, and program
US8861894B2 (en) Methods and apparatus for edge-aware pixel data generation
JP4827137B2 (en) Resolution conversion processing method, image processing apparatus, image display apparatus, and program
JP2013251717A (en) Image display processing method and image display processing apparatus
JP2013257665A (en) Movie processing apparatus and control method therefor
US11514614B2 (en) Image processing apparatus, method of controlling image processing apparatus, and non-transitory computer-readable storage medium
JP5350497B2 (en) Motion detection device, control program, and integrated circuit
JP2010160304A (en) Image data processing method and image display system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160302

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20161219

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20170110

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20170307

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20170328

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170331

R150 Certificate of patent or registration of utility model

Ref document number: 6122322

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees