JP2008061036A - Image processing program and apparatus - Google Patents

Image processing program and apparatus Download PDF

Info

Publication number
JP2008061036A
JP2008061036A JP2006236965A JP2006236965A JP2008061036A JP 2008061036 A JP2008061036 A JP 2008061036A JP 2006236965 A JP2006236965 A JP 2006236965A JP 2006236965 A JP2006236965 A JP 2006236965A JP 2008061036 A JP2008061036 A JP 2008061036A
Authority
JP
Japan
Prior art keywords
image
pixel
reference point
pixels
generated
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.)
Granted
Application number
JP2006236965A
Other languages
Japanese (ja)
Other versions
JP4840033B2 (en
Inventor
Maki Kondo
真樹 近藤
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.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2006236965A priority Critical patent/JP4840033B2/en
Publication of JP2008061036A publication Critical patent/JP2008061036A/en
Application granted granted Critical
Publication of JP4840033B2 publication Critical patent/JP4840033B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processing program and apparatus which can improve the generation speed of a reduction picture and an expansion picture. <P>SOLUTION: The reference points on an input image are set such that the spacing between may become equal in the X-axis direction and in the Y-axis direction. For this reason, the distance to a reference point located at a-th position in the direction of the X-axis on the basis of X-coordinates 0 and the distance to a reference point located at a-th position in the direction of the Y-axis on the basis of Y-coordinates 0 can be made equal. Therefore, a first element corresponding to the a-th reference point in the direction of the X-axis and a second element corresponding to the a-th reference point in the direction of the Y-axis can be made equal. As a result, weight can be computed by the ability to use the first element for the second element, and the calculation of the second element can be made unnecessary. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、元の画像が縮小された縮小画像または拡大された拡大画像を生成する画像処理プログラムおよび画像処理装置に関し、特に、縮小画像および拡大画像の生成速度を向上させることのできる画像処理プログラムおよび画像処理装置に関するものである。   The present invention relates to an image processing program and an image processing apparatus for generating a reduced image or an enlarged image obtained by reducing an original image, and in particular, an image processing program capable of improving the generation speed of a reduced image and an enlarged image. And an image processing apparatus.

従来より、パーソナルコンピュータ(以下、単に「PC」と称す)等において、作成した画像の縮小を行う場合には、近傍画素の補間によって縮小を行う方法として、バイ・リニア法、バイ・キュービック法、平均画素法などが用いられている。また、画像の拡大を行う場合には、バイ・リニア法、バイ・キュービック法などが用いられる。(特許文献1参照)。   Conventionally, when a created image is reduced in a personal computer (hereinafter simply referred to as “PC”) or the like, as a method of reducing by interpolation of neighboring pixels, a bi-linear method, a bi-cubic method, An average pixel method or the like is used. Further, when enlarging an image, a bi-linear method, a bi-cubic method, or the like is used. (See Patent Document 1).

ここで、縮小画像を生成する一般的なバイ・リニア法について、図5を用いて説明する。図5は、従来のバイ・リニア法について説明する図である。図5においては、小さな四角形の集合体にて模式的に画像を表現しており、小さな四角形のそれぞれがピクセル格子に相当している。ピクセル格子の各頂点(格子点)は、画素が配置される位置である。   Here, a general bi-linear method for generating a reduced image will be described with reference to FIG. FIG. 5 is a diagram for explaining the conventional bi-linear method. In FIG. 5, an image is schematically represented by a collection of small squares, and each of the small squares corresponds to a pixel grid. Each vertex (grid point) of the pixel grid is a position where a pixel is arranged.

図5中、左方には、13×9画素で構成された入力画像(元画像)が表示されている。入力画像においては、各格子点のそれぞれにおける画素を黒丸で表示している。9行13列に配置された各画素のそれぞれには、左上端を原点とし、横軸をX軸、縦軸をY軸とするXY座標が付与されている。具体的には、画像左上端の画素(ピクセル)の座標が(0,0)とされ、右下端の画素に最終座標(12,8)が付与されている。また、図5に示した入力画像は、13×9画素を備えているので、X軸方向におけるピクセル格子間の数(ピクセル格子間の数を表す画素数)は、13画素から1画素を減算した12となる。Y軸方向におけるピクセル格子間の数も同様に、9画素から1画素を減算した8となる。このX軸,Y軸方向の画素数またはピクセル格子間の数が、X軸方向およびY軸方向の長さに相当する値となる。   In FIG. 5, an input image (original image) composed of 13 × 9 pixels is displayed on the left side. In the input image, pixels at each lattice point are displayed as black circles. Each pixel arranged in 9 rows and 13 columns is provided with XY coordinates with the upper left corner as the origin, the horizontal axis as the X axis, and the vertical axis as the Y axis. Specifically, the coordinates of the pixels (pixels) at the upper left corner of the image are (0, 0), and the final coordinates (12, 8) are given to the pixels at the lower right corner. Further, since the input image shown in FIG. 5 has 13 × 9 pixels, the number of pixel lattices in the X-axis direction (the number of pixels representing the number of pixel lattices) is subtracted from 13 pixels. 12 Similarly, the number of pixel lattices in the Y-axis direction is 8 which is obtained by subtracting one pixel from nine pixels. The number of pixels in the X-axis and Y-axis directions or the number between pixel lattices is a value corresponding to the length in the X-axis direction and the Y-axis direction.

ここで、例えば、縮小率が0.6倍で指定されると、生成される縮小画像(出力画像)は、X軸方向に7.8画素、Y軸方向に5.4画素の大きさとなる。ピクセル格子間の数で表せば、生成される縮小画像は、7.2×4.8の大きさとなる。しかし、デジタル画像においては、画素数は整数値である必要があるので、小数点以下の値を切り捨て又は切り上げて整数化を行う。この整数化により、ここでは、8×5画素で構成される縮小画像が生成されている。   Here, for example, if the reduction ratio is specified at 0.6, the generated reduced image (output image) has a size of 7.8 pixels in the X-axis direction and 5.4 pixels in the Y-axis direction. . When expressed in terms of the number of pixel grids, the generated reduced image has a size of 7.2 × 4.8. However, since the number of pixels needs to be an integer value in a digital image, the value after the decimal point is rounded down or rounded up. By this integerization, a reduced image composed of 8 × 5 pixels is generated here.

図5においては、右上方に生成される縮小画像を示した。図5に示す縮小画像は、8×5画素で構成されているので、X軸方向におけるピクセル格子間の数は7となり、Y軸方向におけるピクセル格子間の数は4となる。また、各画素には、入力画像と同様に画像左上端の画素の座標を(0,0)として、(0,0)〜(7,4)の座標がそれぞれ付与されている。   FIG. 5 shows a reduced image generated at the upper right. Since the reduced image shown in FIG. 5 is composed of 8 × 5 pixels, the number of pixel lattices in the X-axis direction is 7, and the number of pixel lattices in the Y-axis direction is 4. Similarly to the input image, each pixel is given coordinates (0, 0) to (7, 4), where the coordinates of the pixel at the upper left corner of the image are (0, 0).

縮小画像の画素数が決定されると、その決定された画素数分(8×5画素)の画素値を生成する。縮小画像の各画素の画素値の生成に際しては、まず、縮小画像の各画素に対応する入力画像上の座標(参照点)を決定する。言い換えれば、縮小画像の各画素の座標(x,y)に対応する入力画像上の参照点の座標(X,Y)を決定する。   When the number of pixels of the reduced image is determined, pixel values corresponding to the determined number of pixels (8 × 5 pixels) are generated. In generating a pixel value of each pixel of the reduced image, first, coordinates (reference points) on the input image corresponding to each pixel of the reduced image are determined. In other words, the coordinates (X, Y) of the reference point on the input image corresponding to the coordinates (x, y) of each pixel of the reduced image are determined.

参照点の座標の決定においては、以下に示す2つの方法が広く知られている。図5においては、第1の方法にて参照点を入力画像上に設定する方法を縮小画像の下方左側に示し、第2の方法にて参照点を入力画像上に設定する方法を縮小画像の下方右側に示す。この縮小画像下方の入力画像上において表示された実線の白丸が、設定された参照点を示している。   In determining the coordinates of the reference point, the following two methods are widely known. In FIG. 5, a method for setting a reference point on the input image by the first method is shown on the lower left side of the reduced image, and a method for setting the reference point on the input image by the second method is shown in FIG. Shown on the lower right side. A solid white circle displayed on the input image below the reduced image indicates the set reference point.

第1の方法は、縮小画像の原点の画素に対応する参照点の座標を(0,0)とすると共に、縮小率の逆数を参照点の間隔として、入力画像の原点からその間隔ずつ進行した位置を、参照点の座標とする方法である。これによれば、各参照点の座標は、縮小画像の各画素の座標に、縮小率の逆数を乗算することによって求められる。縮小画像を縮小率の逆数倍すると、入力画像の大きさとなるからである。尚、ここでの縮小率は、上記の指定された縮小率0.6ではなく、実際に縮小画像を生成する際に用いられた画素数の比である。   In the first method, the coordinates of the reference point corresponding to the pixel at the origin of the reduced image are set to (0, 0), and the reciprocal of the reduction ratio is set as the interval between the reference points, and the interval advances from the origin of the input image. This is a method in which the position is the coordinate of the reference point. According to this, the coordinates of each reference point are obtained by multiplying the coordinates of each pixel of the reduced image by the reciprocal of the reduction ratio. This is because the size of the input image is obtained by multiplying the reduced image by the inverse of the reduction ratio. Note that the reduction ratio here is not the specified reduction ratio of 0.6, but the ratio of the number of pixels used in actually generating a reduced image.

この第1の方法によれば、図5に示すように、縮小画像の第1行目に配列される画素に対応する参照点は、入力画像の第1行目に設定され、縮小画像の第1列目に配列される画素に対応する参照点は、入力画像の第1列目に設定される。   According to this first method, as shown in FIG. 5, the reference points corresponding to the pixels arranged in the first row of the reduced image are set in the first row of the input image, and Reference points corresponding to the pixels arranged in the first column are set in the first column of the input image.

具体的には、図5においては、X軸方向において13画素を8画素にする縮小が行われているので、X軸方向の縮小率は、8/13であり、その逆数は13/8、即ち、1.625である。従って、8画素を13画素分に配分して配置するには、入力画像の画素間隔(ピクセル格子間)の1.625倍ずつに参照点を配置すれば良いこととなるので、X軸方向に座標を1.625ずつ進めた位置に参照点のX座標が規定される。つまり、縮小画像の画素p(0,0)に対応する入力画像上の参照点の座標を(0,0)とすると、例えば、縮小画像の画素P(1,0)に対応する入力画像上の参照点の座標は、(1.625,0)、縮小画像の画素p(2,0)〜(7,0)に対応する入力画像上の参照点の座標は、(1.625×n,0)となる(尚、nは縮小画像における画素のx座標の値2〜7である)。   Specifically, in FIG. 5, since the reduction of 13 pixels to 8 pixels is performed in the X-axis direction, the reduction ratio in the X-axis direction is 8/13, and its reciprocal is 13/8. That is, 1.625. Accordingly, in order to allocate 8 pixels to 13 pixels, the reference points need only be arranged at 1.625 times the pixel interval (inter-pixel lattice) of the input image. The X coordinate of the reference point is defined at a position where the coordinate is advanced by 1.625. In other words, if the coordinates of the reference point on the input image corresponding to the pixel p (0,0) of the reduced image are (0,0), for example, on the input image corresponding to the pixel P (1,0) of the reduced image The coordinates of the reference point are (1.625,0), and the coordinates of the reference point on the input image corresponding to the pixels p (2,0) to (7,0) of the reduced image are (1.625 × n). , 0) (where n is the x coordinate value 2-7 of the pixel in the reduced image).

同様に、Y軸方向において9画素を5画素にする縮小が行われているので、Y軸方向の縮小率は、5/9であり、その逆数は9/5、即ち、1.8である。従って、Y軸方向に座標を1.8ずつ進めた位置に参照点のY座標が規定される。このため、例えば、縮小画像の画素p(0,1)〜(0,4)に対応する入力画像上の参照点の座標は、(0,1.8×n)となる(尚、nは縮小画像における画素のy座標の値1〜4である)。これにより、縮小画像の各画素に対応する入力画像上の各参照点のそれぞれのXY座標が規定される。   Similarly, since the reduction of 9 pixels to 5 pixels in the Y-axis direction is performed, the reduction ratio in the Y-axis direction is 5/9, and its reciprocal is 9/5, that is, 1.8. . Therefore, the Y coordinate of the reference point is defined at a position where the coordinate is advanced by 1.8 in the Y-axis direction. Therefore, for example, the coordinates of the reference point on the input image corresponding to the pixels p (0, 1) to (0, 4) of the reduced image are (0, 1.8 × n) (where n is The y-coordinate values of the pixels in the reduced image are 1 to 4). Thereby, the XY coordinates of each reference point on the input image corresponding to each pixel of the reduced image are defined.

第2の方法は、縮小画像のY軸に沿った両辺上の画素に対応する参照点は、入力画像のY軸に沿った両辺上に設定するとしたものであり、縮小画像のX軸方向両端の画素を除いた残りの画素に対応する参照点を、入力画像においてそのX軸に沿って均等に割り付ける方法である。このため、画素数ではなく、ピクセル格子間の数によって算出した縮小率の逆数を用いて、参照点は、入力画像上に割り付けられる。尚、図5に示した例においては、縮小画像のX軸に沿った両辺上の画素に対応する参照点についても、入力画像のX軸に沿った両辺上に設定するとしている。従って、この第2の方法によれば、縮小画像の第1行目に配列される画素に対応する参照点は、入力画像の第1行目に設定され、縮小画像の第1列目に配列される画素に対応する参照点は、入力画像の第1列目に設定される。その上、縮小画像の最終行に配列される画素に対応する参照点は、入力画像の最終行に設定され、縮小画像の最終列に配列される画素に対応する参照点は、入力画像の最終列に設定される。   In the second method, reference points corresponding to pixels on both sides along the Y axis of the reduced image are set on both sides along the Y axis of the input image, and both ends of the reduced image in the X axis direction are set. This is a method in which reference points corresponding to the remaining pixels excluding these pixels are equally allocated along the X axis in the input image. For this reason, the reference point is allocated on the input image by using the reciprocal of the reduction ratio calculated not by the number of pixels but by the number between pixel grids. In the example shown in FIG. 5, reference points corresponding to pixels on both sides along the X axis of the reduced image are also set on both sides along the X axis of the input image. Therefore, according to the second method, the reference points corresponding to the pixels arranged in the first row of the reduced image are set in the first row of the input image and arranged in the first column of the reduced image. The reference point corresponding to the pixel to be set is set in the first column of the input image. In addition, the reference point corresponding to the pixel arranged in the final row of the reduced image is set to the final row of the input image, and the reference point corresponding to the pixel arranged in the final column of the reduced image is the final point of the input image. Set to column.

具体的には、図5に示すように、8×5画素の縮小画像においては、X軸方向の8画素の内、両端の2画素に対応する参照点は、入力画像上のY軸に沿った両辺上に配置され、残りの6画素に対応する参照点が、入力画像のX軸方向に均等に割り付けられる。ピクセル格子間の数によって算出される縮小率は、入力画像のピクセル格子間の数が12、縮小画像のピクセル格子間の数が7であるので、12/7となり、その逆数は7/12、即ち、約1.714となる。従って、入力画像のピクセル格子間の1.714倍の間隔で参照点を設定することにより、6つの画素に対応する6つの参照点がX軸方向に略均等の間隔で配置されることとなる。これにより、縮小画像の画素p(0,0)に対応する入力画像上の参照点の座標は(0,0)、縮小画像の画素p(7,0)に対応する入力画像上の参照点の座標は(12,0)となり、縮小画像の画素p(1,0)〜(6,0)に対応する入力画像上の参照点の座標は、(1.714×n,0)となる(尚、nは縮小画像における画素のx座標の値1〜6である)。   Specifically, as shown in FIG. 5, in the reduced image of 8 × 5 pixels, the reference points corresponding to the two pixels at both ends of the 8 pixels in the X axis direction are along the Y axis on the input image. The reference points arranged on both sides and corresponding to the remaining six pixels are evenly assigned in the X-axis direction of the input image. The reduction ratio calculated by the number of pixel grids is 12/7 because the number of pixel grids of the input image is 12 and the number of pixel grids of the reduced image is 7, and the reciprocal is 7/12. That is, about 1.714. Therefore, by setting the reference points at 1.714 times the spacing between the pixel grids of the input image, the six reference points corresponding to the six pixels are arranged at substantially equal intervals in the X-axis direction. . Thereby, the coordinates of the reference point on the input image corresponding to the pixel p (0,0) of the reduced image are (0,0), and the reference point on the input image corresponding to the pixel p (7,0) of the reduced image. The coordinates of the reference point on the input image corresponding to the pixels p (1, 0) to (6, 0) of the reduced image are (1.714 × n, 0). (Where n is the value 1 to 6 of the x coordinate of the pixel in the reduced image).

同様に、Y軸方向においてピクセル格子間隔8を4にする縮小が行われているので、縮小率は、4/8であり、その逆数は8/4、即ち、2.0である。従って、Y軸方向に座標を2.0ずつ進めた位置に参照点のY座標が規定される。このため、例えば、縮小画像の画素p(0,1)〜(0,4)に対応する入力画像上の参照点の座標は、(0,2.0×n)となる(尚、nは縮小画像における画素のy座標の値1〜4である)。これにより、縮小画像の各画素に対応する入力画像上の各参照点のそれぞれのXY座標が規定される。   Similarly, since the pixel grid interval 8 is reduced to 4 in the Y-axis direction, the reduction ratio is 4/8, and the reciprocal thereof is 8/4, that is, 2.0. Therefore, the Y coordinate of the reference point is defined at a position where the coordinate is advanced by 2.0 in the Y-axis direction. Therefore, for example, the coordinates of the reference point on the input image corresponding to the pixels p (0,1) to (0,4) of the reduced image are (0, 2.0 × n) (where n is The y-coordinate values of the pixels in the reduced image are 1 to 4). Thereby, the XY coordinates of each reference point on the input image corresponding to each pixel of the reduced image are defined.

縮小画像の画素に対応する参照点を決定した後は、参照点周辺の周辺画素に対する重みを算出する。この重みは、参照点とその参照点周辺の周辺画素との距離に応じた値である。バイ・リニア法では、周辺画素の画素値を単純に平均して参照点の画素とするのではなく、参照点と周辺画素との位置関係を加味して、参照点に近い画素程、より大きく参照点の画素値に寄与する割合が大きくなるように、重み付けがなされるのである。   After determining the reference points corresponding to the pixels of the reduced image, the weights for the peripheral pixels around the reference points are calculated. This weight is a value corresponding to the distance between the reference point and surrounding pixels around the reference point. In the bilinear method, the pixel values of the surrounding pixels are not simply averaged to obtain the pixel of the reference point, but the pixel closer to the reference point is larger in consideration of the positional relationship between the reference point and the surrounding pixel. The weighting is performed so that the ratio contributing to the pixel value of the reference point is increased.

図5における拡大図Aには、バイ・リニア法における重み付けの概念を示した。縮小画像の画素p(x,y)に対応する入力画像上の参照点P(X,Y)は、入力画像本来の画素の座標には無く、本来の画素によって形成される格子内に位置している。そして、参照点が属するピクセル格子を形成する画素であって、参照点に近接する4つの画素が周辺画素となる。このため、参照点のXY座標の小数点以下の値を切り捨てることにより、周辺画素の内の最も座標の小さいもの(基準周辺画素)が求められ、該基準周辺画素の座標をP(i,j)とすれば、P(i+1,j)、P(i,j+1)、P(i+1,j+1)の4点が周辺画素として抽出される。尚、参照点P(X,Y)が、入力画像の格子点に存在する場合には、周辺画素には、その格子点上の画素が含まれる。   Enlarged view A in FIG. 5 shows the concept of weighting in the bilinear method. The reference point P (X, Y) on the input image corresponding to the pixel p (x, y) of the reduced image is not in the coordinates of the original pixel of the input image, but is located in the grid formed by the original pixel. ing. Then, four pixels that form a pixel grid to which the reference point belongs and that are close to the reference point are peripheral pixels. For this reason, by truncating the values below the decimal point of the XY coordinates of the reference point, the pixel with the smallest coordinate among the peripheral pixels (reference peripheral pixel) is obtained, and the coordinates of the reference peripheral pixel are set to P (i, j). Then, four points P (i + 1, j), P (i, j + 1), and P (i + 1, j + 1) are extracted as peripheral pixels. When the reference point P (X, Y) exists at a grid point of the input image, the peripheral pixels include pixels on the grid point.

参照点と各周辺画素との位置関係、言い換えれば、参照点がどれほど周辺画素に近いかは、各周辺画素の座標と参照点との座標で形成されるエリアa1,a2,a3,a4の面積で表すことができる。参照点P(X,Y)が、周辺画素であるP(i,j)に近づくほど、エリアa1の面積は縮小し、逆にエリアa4の面積は増大する。つまり、各エリアa1,a2,a3,a4それぞれの面積割合を、周辺画素P(i+1,j+1)、P(i,j+1)、P(i+1,j)、P(i,j)それぞれの重みとすることができる。   The positional relationship between the reference point and each peripheral pixel, in other words, how close the reference point is to the peripheral pixel is the area of areas a1, a2, a3, a4 formed by the coordinates of each peripheral pixel and the reference point. It can be expressed as As the reference point P (X, Y) approaches the peripheral pixel P (i, j), the area of the area a1 is reduced, and conversely, the area of the area a4 is increased. That is, the area ratio of each of the areas a1, a2, a3, and a4 is set to the weight of each of the peripheral pixels P (i + 1, j + 1), P (i, j + 1), P (i + 1, j), and P (i, j). can do.

この重みは、拡大図Aからも解るように、2の要素で構成されており、第1要素と第2要素との乗算によって算出される。第1要素は、参照点から各周辺画素までのX軸方向の距離であるtまたは1−tである。距離tは、参照点のX座標から、そのX座標を整数化(小数点以下の切り捨て)した値を減算して求められる。また、重みの第2要素は、参照点から各周辺画素までのY軸方向の距離であるsまたは1−sである。距離sは、参照点のY座標から、そのY座標を整数化(小数点以下の切り捨て)した値を減算して求められる。例えば、拡大図Aに示した参照点Pの座標(X,Y)は、(6.5,5.4)であるので、6.5から6を減算した値0.5が距離tとして算出される。同様に、5.4から5を減算した値0.4が距離sとして求められる。   This weight is composed of two elements as can be seen from the enlarged view A, and is calculated by multiplication of the first element and the second element. The first element is t or 1-t which is the distance in the X-axis direction from the reference point to each peripheral pixel. The distance t is obtained by subtracting a value obtained by converting the X coordinate into an integer (rounded down after the decimal point) from the X coordinate of the reference point. The second element of the weight is s or 1-s which is the distance in the Y-axis direction from the reference point to each peripheral pixel. The distance s is obtained by subtracting a value obtained by converting the Y coordinate into an integer (rounded down after the decimal point) from the Y coordinate of the reference point. For example, since the coordinate (X, Y) of the reference point P shown in the enlarged view A is (6.5, 5.4), a value 0.5 obtained by subtracting 6 from 6.5 is calculated as the distance t. Is done. Similarly, a value 0.4 obtained by subtracting 5 from 5.4 is obtained as the distance s.

尚、図5においては、このように算出される重みの第1要素である距離tのそれぞれを、X軸方向に配列された参照点に対応つけて中央部に表示した入力画像の上辺側に示している。また、重みの第2要素である距離sのそれぞれをY軸方向に配列された参照点に対応つけて中央部に表示した入力画像の左辺側に示している。   In FIG. 5, the distances t, which are the first elements of the weights calculated in this way, are associated with the reference points arranged in the X-axis direction on the upper side of the input image displayed at the center. Show. Further, each of the distances s, which are the second elements of the weight, is shown on the left side of the input image displayed in the center portion in association with the reference points arranged in the Y-axis direction.

ピクセル格子間隔は1であるので、算出された各距離を乗算して算出される各エリアa1〜a4の面積は、そのまま、各エリアa1〜a4の面積割合となる。故に、P(i,j)に対する重みは距離1−t×距離1−s、P(i+1,j)に対する重みは距離t×距離1−s、P(i,j+1)に対する重みは距離1−t×距離s、P(i+1,j+1)に対する重みは距離t×距離sとなる。   Since the pixel grid interval is 1, the area of each area a1 to a4 calculated by multiplying each calculated distance is the area ratio of each area a1 to a4 as it is. Therefore, the weight for P (i, j) is distance 1−t × distance 1-s, the weight for P (i + 1, j) is distance t × distance 1-s, and the weight for P (i, j + 1) is distance 1−. The weight for t × distance s, P (i + 1, j + 1) is distance t × distance s.

そして、算出された各重みで周辺画素の画素値に重み付けした後、それらの平均値を算出することで、目的とする参照点の画素値、即ち、縮小画像の画素の画素値を得る。従って、縮小画像の各画素p(x,y)の画素値を求める演算式は、(1)式のようになる。   Then, after weighting the pixel values of the surrounding pixels with the calculated weights, the average value thereof is calculated to obtain the pixel value of the target reference point, that is, the pixel value of the pixel of the reduced image. Therefore, an arithmetic expression for obtaining the pixel value of each pixel p (x, y) of the reduced image is as shown in Expression (1).

Figure 2008061036
尚、縮小画像の各画素p(x,y)をp(0,0)〜p(m−1,n−1)、対応する参照点の基準周辺画素をP(i,j)〜P(im−1,jn−1)、各画素p(0,0)〜p(m−1,n−1)を求めるための重みの第1要素である距離tをt〜tm−1,第2要素である距離sをs〜sn−1とすれば、(1)式におけるxは、0〜m−1の整数値であり、yは0〜n−1の整数値である。また、(1)式において周辺画素の座標にて示される項には、その周辺画素の画素値が代入される。
特開2001−43357号公報
Figure 2008061036
Note that each pixel p (x, y) of the reduced image is p (0, 0) to p (m−1, n−1), and the reference peripheral pixel of the corresponding reference point is P (i 0 , j 0 ) to P (i m−1 , j n−1 ) and the distance t, which is the first element of the weight for obtaining each pixel p (0,0) to p (m−1, n−1), are represented by t 0 to t. m-1 , if the distance s as the second element is s 0 to s n−1 , x in the formula (1) is an integer value of 0 to m−1, and y is 0 to n−1. It is an integer value. In addition, the pixel value of the peripheral pixel is substituted into the term indicated by the coordinates of the peripheral pixel in equation (1).
JP 2001-43357 A

しかしながら、画像を構成する画素は膨大な数であるため、各画素を補間演算にて生成するには多大な時間が必要となるという問題点があった。また、かかる補間演算においては、上記のように、補間演算に関与する各画素に重みづけを行うため、その重みを算出する処理が更に処理時間を増大(処理速度を低下)させる一因となるという問題点があった。ここで、重みの第1要素である距離t及び距離1−tは、縮小画像を形成する画素が該縮小画像において同じ列にあれば、行が変わっても同じ値となるため、縮小画像1行目の画素値の演算において算出した各距離t及び距離1−tの少なくとも一方を記憶し、2行目以降の画素値の演算には、記憶された距離tや距離1−t用いる手法が提案されている。これによれば、2行目以降においては距離tや距離1−tの算出を省略することができるので、画像処理全体にかかる時間を短縮することができる。しかし、距離tや距離1−tの算出を省略した場合であっても、画像データの演算には、未だ膨大な多大な処理時間が必要となるという問題点があった。   However, since there are an enormous number of pixels constituting an image, it takes a long time to generate each pixel by interpolation calculation. In addition, in such an interpolation calculation, as described above, each pixel involved in the interpolation calculation is weighted. Therefore, the process of calculating the weight further increases the processing time (decreases the processing speed). There was a problem. Here, the distance t and the distance 1-t, which are the first elements of the weight, are the same value even if the row changes if the pixels forming the reduced image are in the same column in the reduced image. At least one of each distance t and distance 1-t calculated in the calculation of the pixel value in the row is stored, and the method of using the stored distance t or the distance 1-t is used in the calculation of the pixel values in the second and subsequent rows. Proposed. According to this, since the calculation of the distance t and the distance 1-t can be omitted in the second and subsequent rows, the time required for the entire image processing can be shortened. However, even when the calculation of the distance t and the distance 1-t is omitted, there is a problem that a huge amount of processing time is still required for the calculation of the image data.

本発明は、上記問題点を解決するためになされたものであり、縮小画像および拡大画像の生成速度を向上させることのできる画像処理プログラムおよび画像処理装置を提供することを目的としている。   SUMMARY An advantage of some aspects of the invention is that it provides an image processing program and an image processing apparatus capable of improving the generation speed of a reduced image and an enlarged image.

この目的を達成するために、請求項1記載の画像処理プログラムは、画像の一辺とその一辺に交差する他辺とが異なる画素数で構成された元画像の画像データを取得するデータ取得ステップと、元画像に対し倍率を変更した生成画像の各画素の画素値の生成に際し前記データ取得ステップにて取得した画像データの画素値の内、画素生成に関与する元画像の画素値に重み付けする重み付けステップと、その重み付けステップにて重み付けされた画素値に基づいて生成画像の各画素の画素値を生成する画像データ生成ステップとを備えたものであり、更に、前記画像データ生成ステップは、生成画像の各画素に対応する元画像上の各参照点を、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、前記一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定する参照点設定ステップと、その参照点設定ステップにて設定された参照点周辺の周辺画素の画素値を抽出する画素値抽出ステップとを有し、その画素値抽出ステップにて抽出された画素値の補間演算にて生成画像の画素値を生成するものであり、前記重み付けステップは、前記参照点設定ステップにより設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、周辺画素の画素値に対する重みの第1要素を算出する第1要素算出ステップと、その第1要素算出ステップにより算出された前記第1要素を、前記参照点の一辺方向における位置を示す位置情報に対応して記憶する第1要素記憶ステップと、前記参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素として、前記第1要素記憶ステップにて記憶された第1要素の内、前記参照点の他辺方向における位置を示す位置情報によって抽出されるものを用い、その抽出された第2要素と、前記第1要素記憶ステップにて記憶された第1要素の内の前記参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて重みを算出する重み算出ステップとを備えている。   In order to achieve this object, the image processing program according to claim 1 includes a data acquisition step of acquiring image data of an original image in which one side of an image and another side intersecting the one side have different numbers of pixels; The weighting for weighting the pixel value of the original image involved in the pixel generation among the pixel values of the image data acquired in the data acquisition step when generating the pixel value of each pixel of the generated image with the magnification changed with respect to the original image And an image data generation step that generates a pixel value of each pixel of the generated image based on the pixel value weighted in the weighting step, and the image data generation step further includes: In the direction along one side of the original image, each reference point on the original image corresponding to each pixel is set as an interval set based on the magnification of the generated image, and In a direction along the other side, the reference point setting step for setting the same position as the reference point interval along the one side, and peripheral pixels around the reference point set in the reference point setting step A pixel value extracting step of extracting the pixel value of the pixel value, and generating a pixel value of the generated image by interpolation calculation of the pixel value extracted in the pixel value extracting step, wherein the weighting step includes Based on the distance between the reference point set in the reference point setting step and the peripheral pixel located in the direction along one side of the original image with respect to the reference point, the first element of the weight for the pixel value of the peripheral pixel is calculated And a first element storage step for storing the first element calculated by the first element calculation step in correspondence with position information indicating a position in one side direction of the reference point. And the second element of the weight based on the distance between the reference point and the peripheral point located in the direction along the other side of the original image with respect to the reference point. Among the first elements, one extracted by position information indicating the position of the reference point in the other side direction is used. The extracted second element and the first element stored in the first element storing step are stored. A weight calculating step of calculating a weight using a first element extracted by position information indicating a position in one side direction of the reference point among the elements.

請求項2記載の画像処理プログラムは、請求項1記載の画像処理プログラムにおいて、前記画像データ生成ステップは、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値を生成するものであり、前記第1要素算出ステップは、前記画素列の第1行目の画素値が前記画像データ生成ステップにて生成される際に第1要素を算出すると共に、その算出された第1要素を前記第1要素記憶ステップにて記憶するものであり、前記重み算出ステップは、前記画像データ生成ステップにて第1行目以外の異なる画素列の画素値を生成する場合には、前記第1要素記憶ステップにて記憶された第1要素を用いて重みを算出するものである。   The image processing program according to claim 2 is the image processing program according to claim 1, wherein the image data generation step includes a pixel value of each pixel for each pixel column arranged in a line along one side direction of the generated image. The first element calculation step calculates the first element when the pixel value of the first row of the pixel column is generated in the image data generation step, and the first element calculation step calculates the first element. The first element is stored in the first element storage step, and the weight calculation step is performed when the pixel value of a different pixel column other than the first row is generated in the image data generation step. The weight is calculated using the first element stored in the first element storage step.

請求項3記載の画像処理プログラムは、請求項1又は2に記載の画像処理プログラムにおいて、前記画像データ生成ステップ及び前記重み付けステップは、元画像の長辺を前記一辺として処理を行うものであり、前記参照点設定ステップは、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから前記倍率を算出する長辺基準倍率算出ステップを有し、その長辺基準倍率算出ステップにて算出される倍率に基づいた間隔で参照点を設定するものである。   The image processing program according to claim 3 is the image processing program according to claim 1 or 2, wherein the image data generation step and the weighting step perform processing with the long side of the original image as the one side, The reference point setting step includes a long side reference magnification calculating step for calculating the magnification from the number of pixels indicating the length of the long side of the original image and the number of pixels indicating the length of the corresponding long side of the generated image. The reference points are set at intervals based on the magnification calculated in the long side reference magnification calculation step.

請求項4記載の画像処理プログラムは、請求項3記載の画像処理プログラムにおいて、生成画像の長辺方向に配置する画素数は整数値とされており、前記画像データ生成ステップは、元画像の短辺の長さを示す画素数に対し、前記長辺基準倍率算出ステップにて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数を算出する短辺画素数算出ステップと、その短辺画素数算出ステップにて算出された値において小数点以下の値を切り捨てて画素数を整数化する整数化ステップとを備え、生成画像の短辺方向に配置する画素数をその整数化ステップにて得られた画素数として、生成画像の各画素の画素値を生成するものである。   According to a fourth aspect of the present invention, in the image processing program according to the third aspect, the number of pixels arranged in the long side direction of the generated image is an integer value, and the image data generating step A short side pixel number calculating step for calculating the number of pixels indicating the short side length in the generated image based on the magnification calculated in the long side reference magnification calculating step with respect to the number of pixels indicating the side length; An integerization step for rounding off the value after the decimal point in the value calculated in the short side pixel number calculation step to convert the number of pixels to an integer, and converting the number of pixels to be arranged in the short side direction of the generated image into the integer The pixel value of each pixel of the generated image is generated as the number of pixels obtained in the step.

請求項5記載の画像処理プログラムは、請求項1から4のいずれかに記載の画像処理プログラムにおいて、前記画像データ取得ステップは、元画像の画像データの各画素値をラスタ形式で取得するものであり、前記参照点設定ステップは、前記元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するものであり、前記第1要素算出ステップは、短辺方向に設定された参照点のそれぞれに対応する第1要素を算出するものであり、前記画像データ生成ステップは、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値を生成するものである。   The image processing program according to claim 5 is the image processing program according to any one of claims 1 to 4, wherein the image data acquisition step acquires each pixel value of the image data of the original image in a raster format. And, in the reference point setting step, if the short side of the original image is a side along the main scanning direction of the raster scan with respect to the image, at least the pixels in the first row in the short side direction in the generated image are virtually The reference point corresponding to each pixel is set until the number of generated pixels in the long side direction is reached, and the first element calculating step corresponds to each of the reference points set in the short side direction. The first element is calculated, and the image data generation step sequentially generates a pixel value of each pixel for each pixel column arranged in a row along the short side direction of the generated image. .

請求項6記載の画像処理プログラムは、請求項1から5のいずれかに記載の画像処理プログラムにおいて、前記画像データ生成ステップは、縮小画像の画素値を生成するものである。   An image processing program according to a sixth aspect is the image processing program according to any one of the first to fifth aspects, wherein the image data generating step generates a pixel value of a reduced image.

請求項7記載の画像処理装置は、画像の一辺とその一辺に交差する他辺とが異なる画素数で構成された元画像の画像データを取得するデータ取得手段と、元画像に対し倍率を変更した生成画像の各画素の画素値の生成に際し前記データ取得手段にて取得した画像データの画素値の内、画素生成に関与する元画像の画素値に重み付けする重み付け手段と、その重み付け手段にて重み付けされた画素値に基づいて生成画像の各画素の画素値を生成する画像データ生成手段とを備えたものであり、更に、前記画像データ生成手段は、生成画像の各画素に対応する元画像上の各参照点を、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、前記一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定する参照点設定手段と、その参照点設定手段にて設定された参照点周辺の周辺画素の画素値を抽出する画素値抽出手段とを有し、その画素値抽出手段にて抽出された画素値の補間演算にて生成画像の画素値を生成するものであり、前記重み付け手段は、前記参照点設定手段により設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、周辺画素の画素値に対する重みの第1要素を算出する第1要素算出手段と、その第1要素算出手段により算出された前記第1要素を、前記参照点の一辺方向における位置を示す位置情報に対応して記憶する第1要素記憶手段と、前記参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素として、前記第1要素記憶手段に記憶された第1要素の内、前記参照点の他辺方向における位置を示す位置情報によって抽出されるものを用い、その抽出された第2要素と、前記第1要素記憶手段に記憶された第1要素の内の前記参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて重みを算出する重み算出手段とを備えている。   The image processing apparatus according to claim 7, wherein a data acquisition unit that acquires image data of an original image in which one side of the image and another side intersecting the one side have different numbers of pixels, and a magnification of the original image are changed In the generation of the pixel value of each pixel of the generated image, among the pixel values of the image data acquired by the data acquisition unit, the weighting unit for weighting the pixel value of the original image involved in pixel generation, and the weighting unit Image data generating means for generating a pixel value of each pixel of the generated image based on the weighted pixel values, and the image data generating means further includes an original image corresponding to each pixel of the generated image The upper reference points are intervals set based on the magnification of the generated image in the direction along one side of the original image, and along the one side in the direction along the other side intersecting the one side. reference A reference point setting unit that sets the same interval as the interval, and a pixel value extracting unit that extracts a pixel value of surrounding pixels around the reference point set by the reference point setting unit. The pixel value of the generated image is generated by the interpolation calculation of the pixel value extracted by the extraction unit, and the weighting unit is configured to generate a reference point set by the reference point setting unit and an original for the reference point. Based on the distance from the surrounding pixels located in the direction along one side of the image, the first element calculating means for calculating the first element of the weight for the pixel value of the surrounding pixels, and the first element calculating means A first element storing means for storing the first element corresponding to position information indicating a position in one side direction of the reference point; and the reference point and the reference point in a direction along the other side of the original image. Based on the distance to the surrounding pixels As the second element of the weight, the one extracted from the first element stored in the first element storage means by the position information indicating the position of the reference point in the other side direction is used. Weight calculating means for calculating a weight using two elements and a first element extracted by position information indicating a position in one side direction of the reference point among the first elements stored in the first element storage means And.

請求項8記載の画像処理装置は、請求項7記載の画像処理装置において、前記画像データ生成手段は、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値を生成するものであり、前記第1要素算出手段は、前記画素列の第1行目の画素値が前記画像データ生成手段にて生成される際に第1要素を算出すると共に、その算出された第1要素を前記第1要素記憶手段に記憶するものであり、前記重み算出手段は、前記画像データ生成手段にて第1行目以外の異なる画素列の画素値を生成する場合には、前記第1要素記憶手段に記憶された第1要素を用いて重みを算出するものである。   The image processing device according to claim 8 is the image processing device according to claim 7, wherein the image data generation unit includes a pixel value of each pixel for each pixel column arranged in a line along one side direction of the generated image. The first element calculation unit calculates the first element when the pixel value of the first row of the pixel column is generated by the image data generation unit, and the calculation is performed. The first element is stored in the first element storage unit, and the weight calculation unit generates a pixel value of a different pixel column other than the first row in the image data generation unit. The weight is calculated using the first element stored in the first element storage means.

請求項9記載の画像処理装置は、請求項7又は8に記載の画像処理装置において、前記画像データ生成手段及び前記重み付け手段は、元画像の長辺を前記一辺として処理を行うものであり、前記参照点設定手段は、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから前記倍率を算出する長辺基準倍率算出手段を有し、その長辺基準倍率算出手段にて算出される倍率に基づいた間隔で参照点を設定するものである。   The image processing device according to claim 9 is the image processing device according to claim 7 or 8, wherein the image data generation unit and the weighting unit perform processing with the long side of the original image as the one side, The reference point setting means includes a long side reference magnification calculating means for calculating the magnification from the number of pixels indicating the length of the long side of the original image and the number of pixels indicating the length of the corresponding long side of the generated image. The reference points are set at intervals based on the magnification calculated by the long side reference magnification calculation means.

請求項10記載の画像処理装置は、請求項9記載の画像処理装置において、生成画像の長辺方向に配置する画素数は整数値とされており、前記画像データ生成手段は、元画像の短辺の長さを示す画素数に対し、前記長辺基準倍率算出手段にて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数を算出する短辺画素数算出手段と、その短辺画素数算出手段にて算出された値において小数点以下の値を切り捨てて画素数を整数化する整数化手段とを備え、生成画像の短辺方向に配置する画素数をその整数化手段にて得られた画素数として、生成画像の各画素の画素値を生成するものである。   An image processing apparatus according to a tenth aspect is the image processing apparatus according to the ninth aspect, wherein the number of pixels arranged in the long side direction of the generated image is an integer value, and the image data generating means Short-side pixel number calculating means for calculating the number of pixels indicating the length of the short side in the generated image based on the magnification calculated by the long-side reference magnification calculating means with respect to the number of pixels indicating the side length; And an integerizing means for rounding off the value after the decimal point in the value calculated by the short side pixel number calculating means to make the number of pixels an integer, and converting the number of pixels arranged in the short side direction of the generated image to the integer The pixel value of each pixel of the generated image is generated as the number of pixels obtained by the means.

請求項11記載の画像処理装置は、請求項7から10のいずれかに記載の画像処理装置において、前記画像データ取得手段は、元画像の画像データの各画素値をラスタ形式で取得するものであり、前記参照点設定手段は、前記元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するものであり、前記第1要素算出手段は、短辺方向に設定された参照点のそれぞれに対応する第1要素を算出するものであり、前記画像データ生成手段は、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値を生成するものである。   The image processing device according to claim 11 is the image processing device according to any one of claims 7 to 10, wherein the image data acquisition means acquires each pixel value of the image data of the original image in a raster format. And when the short side of the original image is a side along the main scanning direction of the raster scanning with respect to the image, the reference point setting means virtually sets at least the pixels in the first row in the short side direction in the generated image. The reference point corresponding to each pixel is set by increasing until the number of generated pixels in the long side direction is reached, and the first element calculating means corresponds to each of the reference points set in the short side direction. The first element is calculated, and the image data generation means sequentially generates a pixel value of each pixel for each pixel column arranged in a row along the short side direction of the generated image. .

請求項12記載の画像処理装置は、請求項7から11のいずれかに記載の画像処理装置において、前記画像データ生成手段は、縮小画像の画素値を生成するものである。   An image processing apparatus according to a twelfth aspect is the image processing apparatus according to any one of the seventh to eleventh aspects, wherein the image data generation means generates a pixel value of a reduced image.

請求項1記載の画像処理プログラムによれば、データ取得ステップにより画像データが取得される。画像データ生成ステップにおける参照点設定ステップにより、元画像に対し倍率を変更した生成画像の各画素に対応する元画像上の各参照点は、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定される。そして、データ取得ステップにて取得した画像データの画素値の内、設定された参照点周辺の周辺画素の画素値が画素値抽出ステップにて抽出され、画像データ生成ステップにより、その抽出された画素値の補間演算にて生成画像の画素値が生成される。   According to the image processing program of the first aspect, the image data is acquired by the data acquisition step. Each reference point on the original image corresponding to each pixel of the generated image whose magnification has been changed with respect to the original image by the reference point setting step in the image data generation step is the same as the generated image in the direction along one side of the original image. The interval is set based on the magnification, and in the direction along the other side intersecting with one side, the interval is set to the same interval as the reference point interval along the one side. Then, among the pixel values of the image data acquired in the data acquisition step, pixel values of peripheral pixels around the set reference point are extracted in the pixel value extraction step, and the extracted pixels are detected in the image data generation step. The pixel value of the generated image is generated by the value interpolation calculation.

補間演算がなされる画素値に対しては、重み付けステップにより重み付けが行われる。この重み付けステップによる重み付けにおいては、第1要素算出ステップにより、参照点設定ステップにより設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、重みの第1要素が算出され、算出された第1要素は、第1要素記憶ステップにより、参照点の一辺方向における位置を示す位置情報に対応して記憶される。また、参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素には、第1要素記憶ステップにて記憶された第1要素の内、参照点の他辺方向における位置を示す位置情報によって抽出されるものが用いられる。そして、その抽出された第2要素と、第1要素記憶ステップにて記憶された第1要素の内の参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて、重み算出ステップにより、重みが算出される。   The pixel value subjected to the interpolation calculation is weighted by a weighting step. In the weighting by this weighting step, the first element calculation step is based on the distance between the reference point set by the reference point setting step and the peripheral pixels located in the direction along one side of the original image with respect to the reference point. Thus, the first element of the weight is calculated, and the calculated first element is stored in correspondence with the position information indicating the position in the one side direction of the reference point by the first element storing step. The second element of the weight based on the distance between the reference point and the peripheral pixel located in the direction along the other side of the original image with respect to the reference point is the first element stored in the first element storing step. Among the elements, those extracted by position information indicating the position of the reference point in the other side direction are used. And using the extracted second element and the first element extracted by the position information indicating the position in the one side direction of the reference point among the first elements stored in the first element storage step, The weight is calculated by the weight calculation step.

よって、算出された第1要素を第2要素として用いることができ、第2要素の算出を省略することができるので、その第2要素の算出に要する時間分、処理時間を削減して、画像処理全体にかかる処理時間を短縮することができるという効果がある。   Therefore, the calculated first element can be used as the second element, and the calculation of the second element can be omitted. Therefore, the processing time is reduced by the time required for the calculation of the second element, and the image There is an effect that the processing time required for the entire processing can be shortened.

本プログラムでは、一辺方向と他辺方向とにおいて同じ間隔で参照点を設定するので、結果的に、生成画像および元画像を、一辺を基準の長さとする正方形に仮想化することができる。このため、元画像の一辺方向において端部からn番目に配列される参照点と、他辺方向において一辺側の端部からn番目に配列される参照点とは、端部から参照点までの距離が同じになる。ここで、第1要素は、元画像の一辺に沿った方向の距離に基づいており、第2要素は、元画像の他辺に沿った方向の距離に基づいているので、参照点の他辺方向における位置を示す位置情報によって抽出される第1要素を第2要素に用いても、的確な重みを算出することができるという効果がある。   In this program, since the reference points are set at the same interval in the one side direction and the other side direction, as a result, the generated image and the original image can be virtualized into a square having one side as a reference length. Therefore, the reference point arranged nth from the end in the one side direction of the original image and the reference point arranged nth from the end on the one side in the other side direction are from the end to the reference point. The distance will be the same. Here, the first element is based on the distance in the direction along one side of the original image, and the second element is based on the distance in the direction along the other side of the original image. Even if the first element extracted by the position information indicating the position in the direction is used as the second element, there is an effect that an accurate weight can be calculated.

尚、位置情報としては、例えば、画像の左上端を原点とした場合における原点から参照点までの距離、座標、原点からの参照点の数などが例示される。   The position information includes, for example, the distance from the origin to the reference point, the coordinates, and the number of reference points from the origin when the upper left corner of the image is the origin.

また、元画像の一辺に沿った方向に並ぶ参照点のそれぞれは、元画像の他辺に沿った方向の距離が同じであるので、それらの参照点に対応する画素値の算出に際しては、同じ第2要素を用いて重みを算出することができる。同様に、元画像の他辺に沿った方向に並ぶ参照点のそれぞれは、元画像の一辺に沿った距離が同じであるので、同じ第1要素を用いて重みを算出することができる。このため、算出された第1要素を第1要素記憶ステップにて記憶することにより、一度算出した第1要素を用いて重みを算出できる。故に、重みの算出の度に、第1要素および第2要素を算出する必要が無く、その算出回数を抑制して、生成画像を生成するに要する処理時間を削減することができるという効果がある。   Further, since the reference points arranged in the direction along one side of the original image have the same distance in the direction along the other side of the original image, the same pixel values are calculated when calculating the pixel values corresponding to the reference points. The weight can be calculated using the second element. Similarly, since the reference points arranged in the direction along the other side of the original image have the same distance along one side of the original image, the weight can be calculated using the same first element. Therefore, by storing the calculated first element in the first element storing step, the weight can be calculated using the first element calculated once. Therefore, it is not necessary to calculate the first element and the second element each time the weight is calculated, and there is an effect that the number of calculation times can be suppressed and the processing time required to generate the generated image can be reduced. .

請求項2記載の画像処理プログラムによれば、請求項1記載の画像処理プログラムの奏する効果に加え、画像データ生成ステップにより、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値が生成される。そして、生成画像の画素列の第1行目の画素値が画像データ生成ステップにて生成される際に、第1要素算出ステップにより第1要素が算出される。算出された第1要素は、第1要素記憶ステップにて記憶される。また、画像データ生成ステップにて第1行目以外の異なる画素列の画素値を生成する場合には、重み算出ステップによる重みの算出は、第1要素記憶ステップにて記憶された第1要素を用いて実行される。よって、画像データ生成ステップによる画素値生成の初期段階から、その画素値の生成に必要な重みの算出に、記憶された第1要素を用いることができ、第1要素の算出回数を、最低限必要な回数とすることができるという効果がある。つまり、本プログラムによれば、一行目の画素値を生成する際に、各画素に対する重みの第1要素を1度算出するだけでよいので、重みを算出する処理を効率的に実行することができるという効果がある。   According to the image processing program of claim 2, in addition to the effect produced by the image processing program of claim 1, the image data generation step is performed for each pixel column arranged in a row along one side direction of the generated image. A pixel value for each pixel is generated. Then, when the pixel value of the first row of the pixel row of the generated image is generated in the image data generation step, the first element is calculated by the first element calculation step. The calculated first element is stored in the first element storing step. When generating pixel values of different pixel columns other than the first row in the image data generation step, the weight calculation in the weight calculation step is performed by using the first element stored in the first element storage step. To be executed. Therefore, from the initial stage of pixel value generation by the image data generation step, the stored first element can be used for calculating the weight necessary for generating the pixel value, and the number of times of calculation of the first element is minimized. There is an effect that the required number of times can be achieved. That is, according to this program, when the pixel value of the first row is generated, it is only necessary to calculate the first element of the weight for each pixel once, so that the process of calculating the weight can be executed efficiently. There is an effect that can be done.

請求項3記載の画像処理プログラムによれば、請求項1又は2に記載の画像処理プログラムの奏する効果に加え、長辺基準倍率算出ステップにより、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから倍率が算出され、その長辺基準倍率算出ステップにて算出された倍率に基づいた間隔で、参照点設定ステップにより参照点が設定される。そして、画像データ生成ステップ及び重み付けステップにより、元画像の長辺を一辺として処理が行われる。このため、画像データ生成ステップにより、元画像の長辺を一辺として生成画像の各画素値が生成される。また、重み付けステップにより、元画像の長辺を一辺として重みの算出が実行される。長辺方向に設定される参照点の数は、短辺方向に設定される参照点の数よりも多いので、重み付けステップにおける第1要素算出ステップにて算出される重みの第1要素は、長辺方向に設定される参照点に対応して算出する方が、短辺方向に設定される参照点に対応して算出するよりも、多く、第1要素を算出することができる。よって、第1要素算出ステップにて算出される重みの第1要素にて、第2要素を網羅することができるという効果がある。つまり、第1要素記憶ステップにて記憶された第1要素を、その位置情報に基づいて、第2要素として抽出する場合に、対応する第1要素がないといった事態を回避することができ、第2要素の全てを記憶されている第1要素で補うことができるという効果がある。   According to the image processing program of the third aspect, in addition to the effect produced by the image processing program according to the first or second aspect, the long side reference magnification calculating step calculates the number of pixels indicating the length of the long side of the original image. The magnification is calculated from the number of pixels indicating the length of the corresponding long side of the generated image, and the reference point is set by the reference point setting step at intervals based on the magnification calculated in the long side standard magnification calculation step. Is done. Then, the image data generation step and the weighting step perform processing with the long side of the original image as one side. Therefore, in the image data generation step, each pixel value of the generated image is generated with the long side of the original image as one side. Further, in the weighting step, the weight is calculated with the long side of the original image as one side. Since the number of reference points set in the long side direction is larger than the number of reference points set in the short side direction, the first element of the weight calculated in the first element calculating step in the weighting step is long. The number of the first elements can be calculated more in the case of calculation corresponding to the reference point set in the side direction than in the case of calculation corresponding to the reference point set in the short side direction. Therefore, there is an effect that the second element can be covered by the first element of the weight calculated in the first element calculating step. That is, when the first element stored in the first element storage step is extracted as the second element based on the position information, a situation in which there is no corresponding first element can be avoided, There is an effect that all the two elements can be supplemented by the stored first element.

請求項4記載の画像処理プログラムによれば、請求項3記載の画像処理プログラムの奏する効果に加え、生成画像の長辺方向に配置する画素数は整数値とされており、元画像の短辺の長さを示す画素数に対し、長辺基準倍率算出ステップにて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数が、短辺画素数算出ステップによって算出される。そして、整数化ステップにより、短辺画素数算出ステップにて算出された値において小数点以下の値が切り捨ててられ、画素数が整数化される。生成画像の短辺方向に配置する画素数は、その整数化ステップにて得られた画素数とされ、画像データ生成ステップにより、生成画像の各画素の画素値が生成される。よって、元画像の範囲内に参照点を設定することができ、参照点が元画像の範囲内に設定不能となることを回避できるという効果がある。   According to the image processing program of claim 4, in addition to the effect of the image processing program of claim 3, the number of pixels arranged in the long side direction of the generated image is an integer value, and the short side of the original image Based on the magnification calculated in the long side reference magnification calculating step, the number of pixels indicating the short side length in the generated image is calculated in the short side pixel number calculating step. . Then, in the integer step, the value after the decimal point is rounded down in the value calculated in the short side pixel number calculation step, and the number of pixels is converted into an integer. The number of pixels arranged in the short side direction of the generated image is the number of pixels obtained in the integer step, and the pixel value of each pixel of the generated image is generated in the image data generation step. Therefore, the reference point can be set within the range of the original image, and it is possible to avoid that the reference point cannot be set within the range of the original image.

つまり、長辺基準倍率算出ステップにて算出された倍率と、端数を含む画素数の値との演算すると、元画像の短辺に存在する画素数となる。このため、短辺画素数算出ステップにて算出された値に対し、小数点以下の値を切り上げて生成画像の短辺の画素数とすると、上記倍率との演算結果にて求められる画素数は、当然、本来の元画像の短辺の画素数を超えてしまう。本プログラムでは、上記倍率に基づいた間隔で、参照点設定ステップにより参照点が設定されるため、上記の小数点以下の値を切り上げた値を生成画像の短辺の画素数とし、その画素数を、上記の倍率に基づいて得られる間隔で配置しようとすれば、参照点は、元画像の短辺には収まりきらない。   That is, when the magnification calculated in the long side reference magnification calculation step and the value of the number of pixels including the fraction are calculated, the number of pixels existing on the short side of the original image is obtained. For this reason, if the value calculated in the short side pixel number calculating step is rounded up to the number of pixels on the short side of the generated image by rounding up the value after the decimal point, the number of pixels obtained from the calculation result with the magnification is as follows: Naturally, the number of pixels on the short side of the original original image is exceeded. In this program, since the reference point is set by the reference point setting step at intervals based on the magnification, the value obtained by rounding up the value after the decimal point is set as the number of pixels on the short side of the generated image, and the number of pixels is set as the number of pixels. If an attempt is made to arrange them at intervals obtained based on the above magnification, the reference points will not fit within the short side of the original image.

一方で、小数点以下の値を切り捨てて生成画像の短辺の画素数とすると、その画素数に上記の倍率で演算して求められる画素数は、元画像の短辺の画素数を超えることはない。従って、生成画像の画素に対応する参照点を、上記倍率に基づいた間隔で、短辺方向に設定しても、その参照点は、必ず、元画像の範囲内に設定されることとなり、参照点が元画像上において設定不能となることを回避できるという効果がある。   On the other hand, if the value after the decimal point is rounded down to the number of pixels on the short side of the generated image, the number of pixels obtained by calculating the number of pixels at the above magnification does not exceed the number of pixels on the short side of the original image. Absent. Therefore, even if the reference point corresponding to the pixel of the generated image is set in the short side direction at an interval based on the magnification, the reference point is always set within the range of the original image. There is an effect that it is possible to avoid that the point cannot be set on the original image.

請求項5記載の画像処理プログラムによれば、請求項1から4のいずれかに記載の画像処理プログラムの奏する効果に加え、画像データ取得ステップにより、元画像の画像データの各画素値は、ラスタ形式で取得される。そして、元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、参照点設定ステップにおいて、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点が設定される。そして、第1要素算出ステップにて、短辺方向に設定された参照点のそれぞれに対応する第1要素が算出され、画像データ生成ステップにより、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値が生成される。   According to the image processing program of the fifth aspect, in addition to the effect produced by the image processing program according to any one of the first to fourth aspects, each pixel value of the image data of the original image is rasterized by the image data acquisition step. Get in format. When the short side of the original image is a side along the main scanning direction of the raster scanning with respect to the image, at least the first row of pixels in the short side direction in the generated image is virtually long in the reference point setting step. A reference point corresponding to each pixel is set by increasing the number of generated pixels in the side direction. Then, in the first element calculation step, first elements corresponding to the respective reference points set in the short side direction are calculated, and arranged in a row along the short side direction of the generated image in the image data generation step. The pixel value of each pixel is sequentially generated for each pixel column to be processed.

一般に、多くの画像処理プログラムにおいては、左上端となる画素から右側方向へ向かって(画像に配列された画素の行方向に沿って)順次処理を実行し、その行の最終画素に到達すると、次の行の左端の画素から再び右側方向に向かって順次処理を行ういわゆるラスタ走査で、画素値を生成、処理することが多い。従って、本プログラムにおいて、元画像の画像データの各画素値を、ラスタ形式(ラスタ走査に応じた順)で取得することにより、このラスタ走査に従った処理形態で、各画素値をスムーズに生成することができるという効果がある。また、本プログラムを、従来の画像処理のプログラムに搭載する(組み込む)ことを容易とすることができ、既存プログラムとの互換性を保つことができるという効果がある。故に、本プログラムを、汎用性の高いプログラムとすることができる。   In general, in many image processing programs, when processing is performed sequentially from the pixel at the upper left corner in the right direction (along the row direction of the pixels arranged in the image) and the final pixel in the row is reached, In many cases, pixel values are generated and processed by so-called raster scanning in which processing is sequentially performed from the leftmost pixel of the next row toward the right side again. Therefore, in this program, by acquiring each pixel value of the image data of the original image in a raster format (in order according to the raster scan), each pixel value is smoothly generated in a processing mode according to this raster scan. There is an effect that can be done. Further, the present program can be easily mounted (incorporated) in a conventional image processing program, and there is an effect that compatibility with an existing program can be maintained. Therefore, this program can be a highly versatile program.

また、本プログラムにおいては、元画像の短辺が画像に対するラスタ走査の主走査方向(画像に配列された画素の行方向)に沿った辺である場合には、参照点設定ステップにおいて、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するので、第1要素算出ステップおよび画像データ生成ステップにおいて、ラスタ走査の方向に従って画像処理を行いつつ、長辺を基準とする第1要素の算出や画素値生成を実行することができ、長辺を基準として第1要素、画素値を算出する上記した利点を享受することができるという効果がある。   Further, in this program, when the short side of the original image is a side along the main scanning direction of the raster scanning with respect to the image (the row direction of the pixels arranged in the image), at least the generation is performed in the reference point setting step. Since the pixels in the first row of the short side direction in the image are virtually increased to the number of generated pixels in the long side direction and the reference points corresponding to the respective pixels are set, the first element calculating step and the image data generating step In the above, calculation of the first element with reference to the long side and generation of the pixel value can be executed while performing image processing in accordance with the direction of raster scanning, and the calculation of the first element and pixel value with respect to the long side is performed. There is an effect that it is possible to enjoy the benefits.

請求項6記載の画像処理プログラムによれば、請求項1から5のいずれかに記載の画像処理プログラムの奏する効果に加え、画像データ生成ステップは、縮小画像の画素値を生成するものであるので、縮小画像を迅速に生成することができるという効果がある。   According to the image processing program of the sixth aspect, in addition to the effect produced by the image processing program according to any one of the first to fifth aspects, the image data generation step generates a pixel value of the reduced image. There is an effect that a reduced image can be generated quickly.

請求項7記載の画像処理装置によれば、データ取得手段により画像データが取得される。画像データ生成手段における参照点設定手段により、元画像に対し倍率を変更した生成画像の各画素に対応する元画像上の各参照点は、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定される。そして、データ取得手段にて取得した画像データの画素値の内、設定された参照点周辺の周辺画素の画素値が画素値抽出手段にて抽出され、画像データ生成手段により、その抽出された画素値の補間演算にて生成画像の画素値が生成される。   According to the image processing apparatus of the seventh aspect, the image data is acquired by the data acquisition means. In the direction along one side of the original image, each reference point on the original image corresponding to each pixel of the generated image whose magnification has been changed with respect to the original image by the reference point setting means in the image data generating means The interval is set based on the magnification, and in the direction along the other side intersecting with one side, the interval is set to the same interval as the reference point interval along the one side. Then, among the pixel values of the image data acquired by the data acquisition unit, the pixel values of the peripheral pixels around the set reference point are extracted by the pixel value extraction unit, and the extracted pixels by the image data generation unit The pixel value of the generated image is generated by the value interpolation calculation.

補間演算がなされる画素値に対しては、重み付け手段により重み付けが行われる。この重み付け手段による重み付けにおいては、第1要素算出手段により、参照点設定手段により設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、重みの第1要素が算出され、算出された第1要素は、第1要素記憶手段において、参照点の一辺方向における位置を示す位置情報に対応して記憶される。また、参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素には、第1要素記憶手段に記憶された第1要素の内、参照点の他辺方向における位置を示す位置情報によって抽出されるものが用いられる。そして、その抽出された第2要素と、第1要素記憶手段にて記憶された第1要素の内の参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて、重み算出手段により、重みが算出される。   The pixel value subjected to the interpolation calculation is weighted by weighting means. In the weighting by the weighting means, the first element calculation means is based on the distance between the reference point set by the reference point setting means and the surrounding pixels located in the direction along one side of the original image with respect to the reference point. Thus, the first element of the weight is calculated, and the calculated first element is stored in the first element storage unit corresponding to the position information indicating the position in the one side direction of the reference point. The second element of the weight based on the distance between the reference point and the peripheral pixel located in the direction along the other side of the original image with respect to the reference point is the first element stored in the first element storage means. Of these, those extracted by position information indicating the position of the reference point in the other side direction are used. And using the extracted second element and the first element extracted by the position information indicating the position in the one side direction of the reference point among the first elements stored in the first element storage means, The weight is calculated by the weight calculation means.

よって、算出された第1要素を第2要素として用いることができ、第2要素の算出を省略することができるので、その第2要素の算出に要する時間分、処理時間を削減して、画像処理全体にかかる処理時間を短縮することができるという効果がある。   Therefore, the calculated first element can be used as the second element, and the calculation of the second element can be omitted. Therefore, the processing time is reduced by the time required for the calculation of the second element, and the image There is an effect that the processing time required for the entire processing can be shortened.

本装置では、一辺方向と他辺方向とにおいて同じ間隔で参照点を設定するので、結果的に、生成画像および元画像を、一辺を基準の長さとする正方形に仮想化することができる。このため、元画像の一辺方向において端部からn番目に配列される参照点と、他辺方向において一辺側の端部からn番目に配列される参照点とは、端部から参照点までの距離が同じになる。ここで、第1要素は、元画像の一辺に沿った方向の距離に基づいており、第2要素は、元画像の他辺に沿った方向の距離に基づいているので、参照点の他辺方向における位置を示す位置情報によって抽出される第1要素を第2要素に用いても、的確な重みを算出することができるという効果がある。   In the present apparatus, since the reference points are set at the same interval in the one side direction and the other side direction, as a result, the generated image and the original image can be virtualized into a square having one side as a reference length. Therefore, the reference point arranged nth from the end in the one side direction of the original image and the reference point arranged nth from the end on the one side in the other side direction are from the end to the reference point. The distance will be the same. Here, the first element is based on the distance in the direction along one side of the original image, and the second element is based on the distance in the direction along the other side of the original image. Even if the first element extracted by the position information indicating the position in the direction is used as the second element, there is an effect that an accurate weight can be calculated.

尚、位置情報としては、例えば、画像の頂点を原点とした場合における原点から参照点までの距離、座標、原点からの参照点の数などが例示される。   The position information includes, for example, the distance from the origin to the reference point when the vertex of the image is the origin, coordinates, the number of reference points from the origin, and the like.

また、元画像の一辺に沿った方向に並ぶ参照点のそれぞれは、元画像の他辺に沿った方向の距離が同じであるので、それらの参照点に対応する画素値の算出に際しては、同じ第2要素を用いて重みを算出することができる。同様に、元画像の他辺に沿った方向に並ぶ参照点のそれぞれは、元画像の一辺に沿った距離が同じであるので、同じ第1要素を用いて重みを算出することができる。このため、算出された第1要素を第1要素記憶手段に記憶することにより、一度算出した第1要素を用いて重みを算出できる。故に、重みの算出の度に、第1要素および第2要素を算出する必要が無く、その算出回数を抑制して、生成画像を生成するに要する処理時間を削減することができるという効果がある。   Further, since the reference points arranged in the direction along one side of the original image have the same distance in the direction along the other side of the original image, the same pixel values are calculated when calculating the pixel values corresponding to the reference points. The weight can be calculated using the second element. Similarly, since the reference points arranged in the direction along the other side of the original image have the same distance along one side of the original image, the weight can be calculated using the same first element. Therefore, by storing the calculated first element in the first element storage unit, the weight can be calculated using the first element calculated once. Therefore, it is not necessary to calculate the first element and the second element each time the weight is calculated, and there is an effect that the number of calculation times can be suppressed and the processing time required to generate the generated image can be reduced. .

請求項8記載の画像処理装置によれば、請求項7記載の画像処理装置の奏する効果に加え、画像データ生成手段により、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値が生成される。そして、生成画像の画素列の第1行目の画素値が画像データ生成手段にて生成される際に、第1要素算出手段により第1要素が算出される。算出された第1要素は、第1要素記憶手段に記憶される。また、画像データ生成手段にて第1行目以外の異なる画素列の画素値を生成する場合には、重み算出手段による重みの算出は、第1要素記憶手段に記憶された第1要素を用いて実行される。よって、画像データ生成手段による画素値生成の初期段階から、その画素値の生成に必要な重みの算出に、記憶された第1要素を用いることができ、第1要素の算出回数を、最低限必要な回数とすることができるという効果がある。つまり、本装置によれば、一行目の画素値を生成する際に、各画素に対する重みの第1要素を1度算出するだけでよいので、重みを算出する処理を効率的に実行することができるという効果がある。   According to the image processing device of the eighth aspect, in addition to the effect produced by the image processing device according to the seventh aspect, the image data generation unit performs, for each pixel column arranged in a line along the one side direction of the generated image. A pixel value for each pixel is generated. Then, when the pixel value of the first row of the pixel column of the generated image is generated by the image data generating unit, the first element is calculated by the first element calculating unit. The calculated first element is stored in the first element storage means. In addition, when the image data generating unit generates pixel values of different pixel columns other than the first row, the weight calculation by the weight calculating unit uses the first element stored in the first element storage unit. Executed. Therefore, from the initial stage of pixel value generation by the image data generation means, the stored first element can be used for calculating the weight necessary for generating the pixel value, and the number of times of calculation of the first element is minimized. There is an effect that the required number of times can be achieved. That is, according to this apparatus, when the pixel value of the first row is generated, it is only necessary to calculate the first element of the weight for each pixel once, so that the process of calculating the weight can be executed efficiently. There is an effect that can be done.

請求項9記載の画像処理装置によれば、請求項7又は8に記載の画像処理装置の奏する効果に加え、長辺基準倍率算出手段により、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから倍率が算出され、その長辺基準倍率算出手段にて算出された倍率に基づいた間隔で、参照点設定手段により参照点が設定される。そして、画像データ生成手段及び重み付け手段により、元画像の長辺を一辺として処理が行われる。このため、画像データ生成手段により、元画像の長辺を一辺として生成画像の各画素値が生成される。また、重み付け手段により、元画像の長辺を一辺として重みの算出が実行される。長辺方向に設定される参照点の数は、短辺方向に設定される参照点の数よりも多いので、重み付け手段における第1要素算出手段にて算出される重みの第1要素は、長辺方向に設定される参照点に対応して算出する方が、短辺方向に設定される参照点に対応して算出するよりも、多く、第1要素を算出することができる。よって、第1要素算出手段にて算出される重みの第1要素にて、第2要素を網羅することができるという効果がある。つまり、第1要素記憶手段に記憶された第1要素を、その位置情報に基づいて、第2要素として抽出する場合に、対応する第1要素がないといった事態を回避することができ、第2要素の全てを、記憶されている第1要素で補うことができるという効果がある。   According to the image processing device of the ninth aspect, in addition to the effect produced by the image processing device according to the seventh or eighth aspect, the long side reference magnification calculating means calculates the number of pixels indicating the length of the long side of the original image, and The magnification is calculated from the number of pixels indicating the length of the corresponding long side of the generated image, and the reference point is set by the reference point setting means at intervals based on the magnification calculated by the long side reference magnification calculating means. Is done. Then, the image data generation unit and the weighting unit process the long side of the original image as one side. For this reason, each pixel value of the generated image is generated by the image data generating means with the long side of the original image as one side. Further, the weighting unit calculates the weight using the long side of the original image as one side. Since the number of reference points set in the long side direction is larger than the number of reference points set in the short side direction, the first element of the weight calculated by the first element calculating unit in the weighting unit is the long The number of the first elements can be calculated more in the case of calculation corresponding to the reference point set in the side direction than in the case of calculation corresponding to the reference point set in the short side direction. Therefore, there is an effect that the second element can be covered by the first element of the weight calculated by the first element calculating means. That is, when the first element stored in the first element storage means is extracted as the second element based on the position information, a situation in which there is no corresponding first element can be avoided. There is an effect that all the elements can be supplemented by the stored first element.

請求項10記載の画像処理装置によれば、請求項9記載の画像処理装置の奏する効果に加え、生成画像の長辺方向に配置する画素数は整数値とされており、元画像の短辺の長さを示す画素数に対し、長辺基準倍率算出手段にて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数が、短辺画素数算出手段によって算出される。そして、整数化手段により、短辺画素数算出手段にて算出された値において小数点以下の値が切り捨ててられ、画素数が整数化される。生成画像の短辺方向に配置する画素数は、その整数化手段にて得られた画素数とされ、画像データ生成手段により、生成画像の各画素の画素値が生成される。よって、元画像の範囲内に参照点を設定することができ、参照点が元画像の範囲内に設定不能となることを回避できるという効果がある。   According to the image processing device of claim 10, in addition to the effect produced by the image processing device of claim 9, the number of pixels arranged in the long side direction of the generated image is an integer value, and the short side of the original image The number of pixels indicating the length of the short side in the generated image is calculated by the short side pixel number calculating unit based on the magnification calculated by the long side reference magnification calculating unit. . Then, the integer conversion means rounds down the value after the decimal point in the value calculated by the short side pixel number calculation means, and the number of pixels is converted to an integer. The number of pixels arranged in the short side direction of the generated image is the number of pixels obtained by the integer conversion unit, and the pixel value of each pixel of the generated image is generated by the image data generation unit. Therefore, the reference point can be set within the range of the original image, and it is possible to avoid that the reference point cannot be set within the range of the original image.

つまり、長辺基準倍率算出手段にて算出された倍率と、端数を含む画素数の値との演算すると、元画像の短辺に存在する画素数となる。このため、短辺画素数算出手段にて算出された値に対し、小数点以下の値を切り上げて生成画像の短辺の画素数とすると、上記倍率との演算結果にて求められる画素数は、当然、本来の元画像の短辺の画素数を超えてしまう。本装置では、上記倍率に基づいた間隔で、参照点設定手段により参照点が設定されるため、上記の小数点以下の値を切り上げた値を生成画像の短辺の画素数とし、その画素数を、上記の倍率に基づいて得られる間隔で配置しようとすれば、参照点は、元画像の短辺には収まりきらない。   In other words, when the magnification calculated by the long side reference magnification calculating means and the value of the number of pixels including the fraction are calculated, the number of pixels existing on the short side of the original image is obtained. For this reason, if the value calculated by the short side pixel number calculating means is rounded up to the number of pixels on the short side of the generated image by rounding up the value after the decimal point, the number of pixels obtained from the calculation result with the magnification is as follows: Naturally, the number of pixels on the short side of the original original image is exceeded. In this apparatus, since the reference point is set by the reference point setting means at intervals based on the magnification, the value obtained by rounding up the value after the decimal point is set as the number of pixels on the short side of the generated image, and the number of pixels is set as the number of pixels. If an attempt is made to arrange them at intervals obtained based on the above magnification, the reference points will not fit within the short side of the original image.

一方で、小数点以下の値を切り捨てて生成画像の短辺の画素数とすると、その画素数に上記の倍率で演算して求められる画素数は、元画像の短辺の画素数を超えることはない。従って、生成画像の画素に対応する参照点を、上記倍率に基づいた間隔で、短辺方向に設定しても、その参照点は、必ず、元画像の範囲内に設定されることとなり、参照点が元画像上において設定不能となることを回避できるという効果がある。   On the other hand, if the value after the decimal point is rounded down to the number of pixels on the short side of the generated image, the number of pixels obtained by calculating the number of pixels at the above magnification does not exceed the number of pixels on the short side of the original image. Absent. Therefore, even if the reference point corresponding to the pixel of the generated image is set in the short side direction at an interval based on the magnification, the reference point is always set within the range of the original image. There is an effect that it is possible to avoid that the point cannot be set on the original image.

請求項11記載の画像処理装置によれば、請求項7から10のいずれかに記載の画像処理装置の奏する効果に加え、画像データ取得手段により、元画像の画像データの各画素値は、ラスタ形式で取得される。そして、元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、参照点設定手段において、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点が設定される。そして、第1要素算出手段にて、短辺方向に設定された参照点のそれぞれに対応する第1要素が算出され、画像データ生成手段により、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値が生成される。   According to the image processing device of the eleventh aspect, in addition to the effect produced by the image processing device according to any one of the seventh to tenth aspects, each pixel value of the image data of the original image is rasterized by the image data acquisition means. Get in format. When the short side of the original image is a side along the main scanning direction of the raster scanning with respect to the image, the reference point setting unit virtually sets at least the pixels in the first row in the short side direction in the generated image. A reference point corresponding to each pixel is set by increasing the number of generated pixels in the side direction. Then, the first element calculation means calculates first elements corresponding to the respective reference points set in the short side direction, and the image data generation means arranges the first elements in a row along the short side direction of the generated image. The pixel value of each pixel is sequentially generated for each pixel column to be processed.

一般に、多くの画像処理装置においては、左上端となる画素から右側方向へ向かって(画像に配列された画素の行方向に沿って)順次処理を実行し、その行の最終画素に到達すると、次の行の左端の画素から再び右側方向に向かって順次処理を行ういわゆるラスタ走査で、画素値を生成、処理することが多い。従って、本装置において、元画像の画像データの各画素値を、ラスタ形式(ラスタ走査に応じた順)で取得することにより、このラスタ走査に従った処理形態で、各画素値をスムーズに生成することができるという効果がある。また、本装置を、従来の画像処理装置に組み込むや互換することを容易とすることができ、既存装置との互換性を保つことができるという効果がある。故に、本装置を、汎用性の高い装置とすることができる。   In general, in many image processing apparatuses, when processing is sequentially performed from the pixel at the upper left end toward the right side (along the row direction of the pixels arranged in the image) and the final pixel in the row is reached, In many cases, pixel values are generated and processed by so-called raster scanning in which processing is sequentially performed from the leftmost pixel of the next row toward the right side again. Therefore, by acquiring each pixel value of the image data of the original image in a raster format (in order corresponding to the raster scan) in this apparatus, each pixel value is generated smoothly in a processing mode according to this raster scan. There is an effect that can be done. Further, the present apparatus can be easily incorporated or compatible with a conventional image processing apparatus, and there is an effect that compatibility with an existing apparatus can be maintained. Therefore, this device can be a highly versatile device.

また、本装置においては、元画像の短辺が画像に対するラスタ走査の主走査方向(画像に配列された画素の行方向)に沿った辺である場合には、参照点設定手段において、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するので、第1要素算出手段および画像データ生成手段において、ラスタ走査の方向に従って画像処理を行いつつ、長辺を基準とする第1要素の算出や画素値生成を実行することができ、長辺を基準として第1要素、画素値を算出する上記した利点を享受することができるという効果がある。   Further, in this apparatus, when the short side of the original image is a side along the main scanning direction of raster scanning with respect to the image (the row direction of the pixels arranged in the image), at least the reference point setting unit generates Since the number of pixels in the first row in the short side direction in the image is virtually increased to the number of generated pixels in the long side direction and the reference point corresponding to each pixel is set, the first element calculating unit and the image data generating unit In the above, calculation of the first element with reference to the long side and generation of the pixel value can be executed while performing image processing in accordance with the direction of raster scanning, and the calculation of the first element and pixel value with respect to the long side is performed. There is an effect that it is possible to enjoy the benefits.

請求項12記載の画像処理装置によれば、請求項7から11のいずれかに記載の画像処理装置の奏する効果に加え、画像データ生成手段は、縮小画像の画素値を生成するものであるので、縮小画像を迅速に生成することができるという効果がある。   According to the image processing device of the twelfth aspect, in addition to the effect produced by the image processing device according to any one of the seventh to eleventh aspects, the image data generating means generates a pixel value of the reduced image. There is an effect that a reduced image can be generated quickly.

以下、本発明の好ましい実施例について、添付図面を参照して説明する。尚、本実施形態の画像処理プログラムの構成は、図5を基に、既に背景技術で説明したバイ・リニア法を主体としつつ、その改良を行ったものであるので、同一の部分には同一の番号を付し、その説明は省略する。   Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings. Note that the configuration of the image processing program of the present embodiment is based on FIG. 5 and the bilinear method already described in the background art has been mainly improved, and the same parts are the same. The description is omitted.

図1は、本発明の一実施形態におけるプリンタ1の電気的な構成を示したブロック図である。このプリンタ1は、パーソナルコンピュータ(以下「PC」と称する)2や、デジタルカメラ21や、外部メディア20から入力された画像データを、指定された縮小率で縮小して出力することができるように構成されている。   FIG. 1 is a block diagram showing an electrical configuration of a printer 1 according to an embodiment of the present invention. The printer 1 can reduce and output image data input from a personal computer (hereinafter referred to as “PC”) 2, a digital camera 21, or an external medium 20 at a specified reduction ratio. It is configured.

プリンタ1は、CPU11と、ROM12と、RAM13と、印刷ヘッドなどから構成され、印刷媒体(例えば、紙媒体など)への印刷(出力)を行う印刷部15と、出力画像サイズや縮小率などの入力値をユーザが入力可能なユーザ操作部(例えば、テンキーなど)を有する操作パネル16とを備えている。   The printer 1 includes a CPU 11, a ROM 12, a RAM 13, and a print head. The printer 1 performs printing (output) on a print medium (for example, a paper medium), an output image size, a reduction rate, and the like. And an operation panel 16 having a user operation unit (for example, a numeric keypad) through which the user can input an input value.

また、プリンタ1は、ケーブル5を介してPC2と接続可能なインターフェイス(以下「I/F」と称する)17と、ケーブル6を介してデジタルカメラ21と接続可能なI/F18と、イメージデータを記憶する外部メディア20(例えば、SDメモリカード、メモリスティックなど)を着脱自在に装着可能な外部メディアスロット19とを備えている。   The printer 1 also has an interface (hereinafter referred to as “I / F”) 17 that can be connected to the PC 2 via the cable 5, an I / F 18 that can be connected to the digital camera 21 via the cable 6, and image data. And an external media slot 19 into which external media 20 (for example, an SD memory card, a memory stick, etc.) to be stored can be detachably mounted.

よって、プリンタ1は、PC20に記憶されている画像データをケーブル5及びI/F17を介して入力することが可能であると共に、デジタルカメラ21によって撮影された画像データをケーブル6及びI/F18を介して入力することが可能である。さらに、外部メディアスロット19に装着された外部メディア20から、その外部メディア20に記憶されている画像データを入力することが可能である。   Therefore, the printer 1 can input the image data stored in the PC 20 via the cable 5 and the I / F 17 and also the image data photographed by the digital camera 21 via the cable 6 and the I / F 18. It is possible to input via. Further, it is possible to input image data stored in the external medium 20 from the external medium 20 mounted in the external media slot 19.

CPU11は、プリンタ1全体を制御する演算処理装置(演算装置)であり、ROM12には、このCPU11により実行される各種の制御プログラムや、その実行の際に参照される固定値データが格納されている。なお、ROM12には、後述する図3のフローチャートに示すプログラムを備えた画像縮小プログラム12aが、制御プログラムの一部として記憶されている。画像縮小プログラム12aは、バイ・リニア法のアルゴリズムを基本とすると共に、その一部を改良して設計されている。   The CPU 11 is an arithmetic processing device (arithmetic device) that controls the entire printer 1, and the ROM 12 stores various control programs executed by the CPU 11 and fixed value data that is referred to during the execution. Yes. The ROM 12 stores an image reduction program 12a having a program shown in the flowchart of FIG. 3 to be described later as a part of the control program. The image reduction program 12a is designed based on the algorithm of the bi-linear method and partly improved.

また、RAM13は、CPU11で実行される制御プログラムに必要な各種レジスタ群などが設定されたワーキングエリアや、処理中のデータを一時的に格納するテンポラリエリア等を有しランダムにアクセスできる書き換え可能なメモリである。   The RAM 13 has a working area in which various register groups necessary for a control program executed by the CPU 11 are set, a temporary area for temporarily storing data being processed, and the like, which can be accessed at random. It is memory.

このRAM13は、入力画像メモリ13aと、出力画像メモリ13bと、入力画像サイズメモリ13cと、出力画像サイズメモリ13dと、縮小率メモリ13eと、縮小重みメモリ13fとを備えている。入力画像メモリ13aは、PC2、デジタルカメラ21、及び外部メディア20から、それぞれ、I/F17、I/F18、及び外部メディアスロット19を介してプリンタ1へ入力された入力画像の画像データであって、生成される縮小画像の元画像となる画像データを記憶するものである。   The RAM 13 includes an input image memory 13a, an output image memory 13b, an input image size memory 13c, an output image size memory 13d, a reduction rate memory 13e, and a reduction weight memory 13f. The input image memory 13a is image data of input images input from the PC 2, the digital camera 21, and the external medium 20 to the printer 1 via the I / F 17, I / F 18, and the external media slot 19, respectively. The image data that is the original image of the generated reduced image is stored.

入力画像の画像データ(以下、「入力画像データ」と称す)は、ラスタデータであって入力画像を形成する各画素の画素値(RGB値)で構成されている。本実施形態において、入力画像は、その左上端を原点とすると共に、画像上において原点から右側に向かう方向をX軸、原点から下方へ向かう方向をY軸とし、画像を構成するM×Nの各画素のそれぞれを2次元配列で表現するべく、画像の左上隅に配置される画素の座標を(0,0)、画像の右下隅に配置される画素の座標を(M−1,N−1)として、各々の画素それぞれに座標が付与されている。また、入力画像は、矩形状の画像であり、該入力画像の一辺とその一辺に直交する他辺(隣り合う辺)とが、異なる画素数で構成されている。   Image data of an input image (hereinafter referred to as “input image data”) is raster data and is composed of pixel values (RGB values) of each pixel forming the input image. In this embodiment, the input image has the upper left corner as the origin, and the direction from the origin to the right side on the image is the X axis and the direction from the origin downward is the Y axis. In order to represent each pixel in a two-dimensional array, the coordinates of the pixel arranged at the upper left corner of the image are (0, 0), and the coordinates of the pixel arranged at the lower right corner of the image are (M-1, N- As 1), coordinates are assigned to each pixel. The input image is a rectangular image, and one side of the input image and another side (adjacent side) orthogonal to the one side are configured with different numbers of pixels.

一般に、画像に対する逐次処理は、原点の画素から開始され、順次、上から下に向かってX軸方向に走査して(M−1,N−1)まで実行するラスタ走査の方式に従って実行される。本実施形態では、入力画像データは、上記したようにラスタデータの形式とされており、各画素値がラスタ走査の順番に羅列された態様で、この入力画像メモリ13aに記憶されている。   In general, sequential processing for an image starts from a pixel at the origin, and is executed according to a raster scanning method in which scanning is performed in the X-axis direction from top to bottom and executed to (M−1, N−1). . In the present embodiment, the input image data is in the form of raster data as described above, and is stored in the input image memory 13a in a form in which each pixel value is arranged in the order of raster scanning.

尚、ラスタデータは、色のついた点(ドット)の羅列として表現したデータであり、本実施形態では、かかるラスタデータがラスタ走査の順に従って配置された状態をラスタ形式と称す。   The raster data is data expressed as an array of colored points (dots). In this embodiment, the state in which such raster data is arranged in the order of raster scanning is referred to as a raster format.

出力画像メモリ13bは、画像縮小プログラム12aに従い、入力画像メモリ13aに記憶されている入力画像データを縮小することによって生成された縮小画像(出力画像)の画像データ(以下「出力画像データ」と称す)を記憶するものである。本実施形態においては、出力画像についても入力画像と同様に、その左上端を原点とすると共に、画像上において原点から右側に向かう方向をX軸、原点から下方へ向かう方向をY軸とし、画像を構成するm×nの各画素のそれぞれを2次元配列で表現するべく、画像の左上隅に配置される画素の座標を(0,0)、画像の右下隅に配置される画素の座標を(m−1,n−1)として、各々の画素にそれぞれ座標が付与されている。   The output image memory 13b is image data (hereinafter referred to as “output image data”) of a reduced image (output image) generated by reducing the input image data stored in the input image memory 13a in accordance with the image reduction program 12a. ) Is stored. In the present embodiment, similarly to the input image, the output image also has the upper left corner as the origin, the direction from the origin to the right on the image is the X axis, and the direction downward from the origin is the Y axis. In order to express each of the m × n pixels constituting the two-dimensional array, the coordinates of the pixel arranged at the upper left corner of the image are (0, 0), and the coordinates of the pixel arranged at the lower right corner of the image are As (m-1, n-1), coordinates are assigned to each pixel.

また、この出力画像メモリ13bには、出力画像データが、入力画像データと同様のラスタ形式で、即ち、出力画像を形成する各画素の画素値(RGB値)が、ラスタ走査の順に従って記憶されている。故に、出力画像メモリ13bに記憶されている画像データ(画素値)を、先頭から順に取り出すことにより、原点の画素から、順次、上から下に向かってX軸方向に走査して、(M−1,N−1)に至る順に画素値が出力されて出力画像を形成することができる。   Further, in this output image memory 13b, the output image data is stored in the same raster format as the input image data, that is, the pixel values (RGB values) of each pixel forming the output image are stored in the order of raster scanning. ing. Therefore, the image data (pixel values) stored in the output image memory 13b are sequentially extracted from the top, and the pixels from the origin are sequentially scanned in the X-axis direction from the top to the bottom (M− 1, N-1) in order of pixel values, and an output image can be formed.

印刷に際しては、出力画像メモリ13bに記憶される各画素値は、RGB値からCMYK値に変換されて、印刷部15へ出力される。尚、入力画像データ及び出力画像データは、RGB値で構成されているものに限られるものでなく、例えば、CMYK値で構成されたものであっても良い。   At the time of printing, each pixel value stored in the output image memory 13 b is converted from an RGB value to a CMYK value and output to the printing unit 15. The input image data and the output image data are not limited to those composed of RGB values, and may be composed of CMYK values, for example.

入力画像データから縮小画像データ(出力画像データ)を作成した後に、ユーザが、拡大画像の作成を所望することがある。ここで、縮小画像データに対して拡大処理を行うと、拡大画像の画質が低下してしまうので、縮小画像データに対して再編集(拡大等)を行う場合には、入力画像データを用いて要求に応じた画像データを生成する。このため、作成された出力画像データは、入力画像メモリ13aとは別に設けられた出力画像メモリ13bに記憶されるようになっており、入力画像データは、そのままの状態で、入力画像メモリ13aに保持される。   After creating reduced image data (output image data) from input image data, the user may desire to create an enlarged image. Here, if the enlargement process is performed on the reduced image data, the image quality of the enlarged image is deteriorated. Therefore, when re-editing (enlargement or the like) is performed on the reduced image data, the input image data is used. Generate image data according to the request. Therefore, the created output image data is stored in an output image memory 13b provided separately from the input image memory 13a, and the input image data is stored in the input image memory 13a as it is. Retained.

入力画像サイズメモリ13cは、入力画像の大きさ(画像サイズ)を示すサイズデータを記憶するメモリである。上記したように、入力画像メモリ13aに記憶される入力画像データは、一群の画素値の羅列で形成されているものである。従って、かかる画像データそのものから画像の大きさを判断することはできない。通常、外部から入力される入力画像データには、そのサイズを示すサイズデータが付加されており、かかるサイズデータは、この入力画像サイズメモリ13cに書き込まれて記憶される。本実施形態では、このサイズデータは、画像のX軸方向の画素数Mと、画像のY軸方向の画素数Nである。CPU11は、この入力画像サイズメモリ13cに記憶されるサイズデータにて、画像のX軸方向およびY軸方向に配列させる画素数を把握することができる。また、X軸方向の画素数と、Y軸方向との画素数が既知となることにより、入力画像メモリ13aに記憶された各画素値を有する画素の画像上の位置(座標)を把握することができる。   The input image size memory 13c is a memory for storing size data indicating the size (image size) of the input image. As described above, the input image data stored in the input image memory 13a is formed by an enumeration of a group of pixel values. Therefore, the size of the image cannot be determined from the image data itself. Normally, size data indicating the size is added to the input image data input from the outside, and the size data is written and stored in the input image size memory 13c. In the present embodiment, this size data is the number of pixels M in the X-axis direction of the image and the number of pixels N in the Y-axis direction of the image. The CPU 11 can grasp the number of pixels arranged in the X-axis direction and the Y-axis direction of the image from the size data stored in the input image size memory 13c. Further, by knowing the number of pixels in the X-axis direction and the number of pixels in the Y-axis direction, the position (coordinates) on the image of the pixel having each pixel value stored in the input image memory 13a is grasped. Can do.

出力画像サイズメモリ13dは、出力画像の大きさ(画像サイズ)を示すサイズデータを記憶するメモリである。入力画像サイズメモリ13cに記憶されるサイズデータと同様に、出力画像のX軸方向の画素数mと、画像のY軸方向の画素数nとがサイズデータとして記憶されている。出力画像メモリ13bに記憶される出力画像データは、この出力画像サイズメモリ13cに記憶される画素数に従って配置され、出力画像が形成される。   The output image size memory 13d is a memory for storing size data indicating the size (image size) of the output image. Similar to the size data stored in the input image size memory 13c, the number of pixels m in the X-axis direction of the output image and the number of pixels n in the Y-axis direction of the image are stored as size data. The output image data stored in the output image memory 13b is arranged according to the number of pixels stored in the output image size memory 13c, and an output image is formed.

縮小率メモリ13eは、生成する出力画像(縮小画像)の縮小率として入力された値を記憶するメモリである。縮小率は、ユーザによる操作パネル16の操作によって入力され、この縮小率メモリ13eに書き込まれる。本実施形態においては、縮小率は、1%毎に設定可能とされており、生成可能な出力画像の縮小レンジ(縮小範囲)は、0%〜100%の範囲であって、0%および100%を含まない範囲、即ち元の画像の1%以上99%以下とされている。操作者の所定の入力操作により縮小率が入力(指定)されると、入力された値がこの縮小率メモリ13eに記憶される。   The reduction ratio memory 13e is a memory that stores a value input as a reduction ratio of an output image (reduced image) to be generated. The reduction ratio is input by the operation of the operation panel 16 by the user, and is written in the reduction ratio memory 13e. In the present embodiment, the reduction rate can be set every 1%, and the reduction range (reduction range) of the output image that can be generated is in the range of 0% to 100%, where 0% and 100%. %, That is, 1% to 99% of the original image. When the reduction rate is input (designated) by a predetermined input operation by the operator, the input value is stored in the reduction rate memory 13e.

尚、本実施形態において縮小率とは、生成される画像の大きさが元の画像に対して占める比率を示しており、例えば縮小率75%であれば、生成される出力画像の大きさは、入力画像の75%となる。同様に、縮小率50%であれば、生成される出力画像の大きさは、入力画像の画像の50%となり、縮小率25%であれば、入力画像の25%の大きさの画像となる。   In the present embodiment, the reduction ratio indicates the ratio of the size of the generated image to the original image. For example, if the reduction ratio is 75%, the size of the output image to be generated is , 75% of the input image. Similarly, when the reduction rate is 50%, the size of the generated output image is 50% of the input image, and when the reduction rate is 25%, the size is 25% of the input image. .

CPU11は、出力画像の生成に際して、まず、その大きさを規定する必要がある。出力画像の大きさは、画像の長辺を基準に規定されるようになっており、CPU11により、この縮小率メモリ13eに記憶される縮小率が、入力画像の長辺の画素数(サイズデータ)に乗算されて求められる。ここで、指定された縮小率によっては、出力画像の画素数に小数点以下の端数が生じてしまうので、四捨五入によって整数化が行われ、出力画像の長辺の大きさ(サイズデータ、画素数m)が決定される。かかる場合には、出力画像は、厳密には、ユーザが入力した縮小率で形成される大きさとは異なる大きさに(若干大きく、または小さく)形成されることとなる。   When generating the output image, the CPU 11 first needs to define the size. The size of the output image is defined based on the long side of the image, and the reduction ratio stored in the reduction ratio memory 13e by the CPU 11 is the number of pixels (size data) of the long side of the input image. ) Multiplied by. Here, depending on the specified reduction ratio, the number of pixels of the output image may be fractional, so rounding is performed to make an integer, and the size of the long side of the output image (size data, number of pixels m) ) Is determined. In such a case, strictly speaking, the output image is formed in a size (slightly larger or smaller) different from the size formed at the reduction rate input by the user.

一方、出力画像の短辺の大きさは、求められた画素数mと入力画像の対応する長辺の画素数Mとの比率m/Mを、入力画像の対応する短辺の画素数Nに乗算されて求められる。本実施形態においては、かかる演算によって生じた小数点以下の端数を切り捨てて整数化を行うように構成されており、得られた整数値が、出力画像の短辺の大きさ(画素数n)とされる。   On the other hand, the size of the short side of the output image is determined by setting the ratio m / M between the obtained number of pixels m and the corresponding long side pixel number M of the input image to the corresponding short side pixel number N of the input image. Obtained by multiplication. In the present embodiment, a fractional part generated by such an operation is rounded down to be converted into an integer, and the obtained integer value is the size of the short side (number of pixels n) of the output image. Is done.

また、ユーザによる操作パネル16の操作によって入力される値が、出力画像のサイズ(出力画像の辺の画素数)である場合には、出力画像と入力画像との大きさとの比率から縮小率が算出されて、この縮小率メモリ13eに記憶される。ここで、算出される縮小率は、出力画像および入力画像の長辺の画素数の比率で求められる。例えば、出力画像の長辺の画素数がm、対応する入力画像の長辺の画素数がMであると、縮小率は、m/Mとなる。かかる場合には、出力画像の長辺の大きさは整数値である。出力画像短辺の大きさ(画素数n)は、上記した縮小率が指定された場合と同様に求められる。   Further, when the value input by the user operating the operation panel 16 is the size of the output image (the number of pixels on the side of the output image), the reduction rate is determined from the ratio between the size of the output image and the input image. It is calculated and stored in the reduction ratio memory 13e. Here, the calculated reduction ratio is obtained by the ratio of the number of pixels on the long side of the output image and the input image. For example, when the number of pixels on the long side of the output image is m and the number of pixels on the long side of the corresponding input image is M, the reduction ratio is m / M. In such a case, the size of the long side of the output image is an integer value. The size (number of pixels n) of the short side of the output image is obtained in the same manner as when the above reduction ratio is designated.

縮小重みメモリ13fは、(1)式に示した出力画像の画素値生成の補間演算に用いられる重みを算出するための重みの第1要素を記憶するメモリである。出力画像の各画素の画素値は、入力画像の対応する位置(参照点)の画素値として補間演算によって求められるので、この縮小重みメモリ13fは、X軸方向の参照点の数、m個分のメモリ(Pメモリ13f0〜Pm−1メモリ13fm−1)で構成されている。出力画像の各画素p(x,y)に対応する入力画像上の参照点P(X,Y)を、出力画像の画素の座標(0,0)〜(m−1,n−1)のそれぞれに対応させて参照点P00〜Pm−1n−1とすると(Pの添え字は、入力画像の対応する画素の座標を示す。また、理解を容易とするために、添え字に用いるm−1にm’、n−1にn’を適宜代用して表示する)、Pメモリ13f0には、参照点P00の画素値を算出するべく求められた第1要素が、P1メモリ13f1には、参照点P10の画素値を算出するための第1要素が、・・・、Pm−1メモリ13fm−1には、参照点Pm’0の画素値を算出するための第1要素が、それぞれ記憶されている。 The reduction weight memory 13f is a memory that stores a first element of a weight for calculating a weight used for the interpolation calculation for generating the pixel value of the output image shown in the equation (1). Since the pixel value of each pixel of the output image is obtained by interpolation calculation as the pixel value of the corresponding position (reference point) of the input image, this reduction weight memory 13f has the number of reference points in the X-axis direction, m. is constructed in the memory (P 0 memory 13f0~P m-1 memory 13fm-1). A reference point P (X, Y) on the input image corresponding to each pixel p (x, y) of the output image is represented by coordinates (0, 0) to (m−1, n−1) of the pixels of the output image. If the reference points P 00 to P m-1n-1 are associated with each other (the subscript of P indicates the coordinates of the corresponding pixel of the input image. Also, for easy understanding, it is used as a subscript. m ′ for m−1 and n ′ for n−1 are appropriately substituted), and the P 0 memory 13f0 has a first element obtained to calculate the pixel value of the reference point P 00 as the P1 memory. the 13f1, the first element for calculating a pixel value of the reference point P 10 is, ..., the P m-1 memory 13Fm-1, for calculating a pixel value of the reference point P M'0 Each first element is stored.

バイ・リニア法を基本とする画像縮小プログラム12aでは、従来のバイ・リニア法と同様に、補間演算に際して各周辺画素に付与される重みには、参照点とその参照点周辺の周辺画素との距離に応じた値を用いている(図5における拡大図A参照)。また、上記したように、この重みは、参照点から各周辺画素までのX軸方向の距離であるtまたは1−t(第1要素)と、参照点から各周辺画素までのY軸方向の距離であるsまたは1−sと(第2要素)との乗算、即ち、(距離t又は距離1−t)×(距離s又は距離1−s)で求められる値である((1)式参照)。   In the image reduction program 12a based on the bi-linear method, as in the conventional bi-linear method, the weight given to each peripheral pixel in the interpolation calculation is the relationship between the reference point and the peripheral pixels around the reference point. A value corresponding to the distance is used (see enlarged view A in FIG. 5). Further, as described above, this weight is determined by t or 1-t (first element) that is a distance in the X-axis direction from the reference point to each peripheral pixel, and in the Y-axis direction from the reference point to each peripheral pixel. Multiplication of the distance s or 1-s and the (second element), that is, a value obtained by (distance t or distance 1-t) × (distance s or distance 1-s) (expression (1)) reference).

本実施形態では、CPU11によって、出力画像の1行分の画素の各対応する参照点の座標から、それぞれ1度だけ第1要素が算出され、その算出された各第1要素が、対応するPメモリ13f0〜Pm−1メモリ13fm−1に記憶される。 In the present embodiment, the CPU 11 calculates the first element only once from the coordinates of the corresponding reference points of the pixels for one row of the output image, and each of the calculated first elements corresponds to the corresponding P. 0 is stored in the memory 13f0~P m-1 memory 13fm-1.

m×nの画素で形成される出力画像は、行方向にm個の画素が、列方向にn個の画素が配列されたものであり、同じ列に属する各画素のx座標は同じとなり、同じ行に属する各画素のy座標は同じとなる。従って、出力画像の1の列の各画素に対応する入力画像上の各参照点の座標は、X座標が同じとなる。このため、X座標の同じ一群の参照点については、参照点と周辺画素とのX軸方向の距離は等しくなるので、同じ第1要素(1の第1要素)を用いることができる。尚、本実施形態においては、入力画像のX軸上(Y座標=0)に配置される参照点をY軸方向における0番目の参照点とし、以降、Y軸方向に沿って1番目、2番目、・・・n−1番目とする。同様に、入力画像のY軸上(X座標=0)に配置される参照点をX軸方向における0番目の参照点とし、以降、X軸方向に沿って1番目、2番目、・・・m−1番目とする。   The output image formed by m × n pixels is an array of m pixels in the row direction and n pixels in the column direction, and the x coordinate of each pixel belonging to the same column is the same, The y coordinate of each pixel belonging to the same row is the same. Accordingly, the coordinates of each reference point on the input image corresponding to each pixel in one column of the output image have the same X coordinate. For this reason, with respect to a group of reference points having the same X coordinate, the distances in the X-axis direction between the reference point and the peripheral pixels are equal, so the same first element (one first element) can be used. In the present embodiment, the reference point arranged on the X axis (Y coordinate = 0) of the input image is set as the 0th reference point in the Y axis direction. ..., N−1. Similarly, the reference point arranged on the Y axis (X coordinate = 0) of the input image is set as the 0th reference point in the X axis direction, and thereafter, the first, second,... Along the X axis direction. It is assumed that m−1.

故に、画像縮小プログラム12aにおいて、Pメモリ13f0に記憶される第1要素は、参照点P00〜P0n’(X座標0を基点としてX軸方向に0番目に位置する各参照点)の画素値を算出するために用いられ、Pメモリ13f1に記憶される第1要素は、参照点P10〜P1n’(X座標0を基点としてX軸方向に1番目に位置する各参照点)の画素値を算出するために用いられ、・・・、Pm−1メモリ13fm−1に記憶される第1要素は、参照点Pm’0〜Pm−1n−1(X座標0を基点としてX軸方向にm−1番目に位置する各参照点)の画素値を算出するために用いられる。言い換えれば、各参照点に対応する第1要素は、X軸方向の参照点の位置に対応する縮小重みメモリ13fに記憶される。 Thus, the image reduction program 12a, P 0 first elements stored in the memory 13f0 are reference points P 00 to P 0n 'of (each reference point located in the 0-th X-coordinate 0 in the X-axis direction as a base point) used to calculate the pixel value, the first elements stored in the P 1 memory 13f1 are reference points P 10 ~P 1n '(each reference point located in the first X-coordinate 0 in the X-axis direction as a base point ), And the first elements stored in the P m-1 memory 13fm-1 are reference points P m′0 to P m−1n-1 (X coordinate 0). Is used to calculate the pixel value of each reference point (m−1th position in the X-axis direction). In other words, the first element corresponding to each reference point is stored in the reduction weight memory 13f corresponding to the position of the reference point in the X-axis direction.

更に、本実施形態においては、図2において後述するが、画像縮小プログラム12aは、重みの第2要素の算出は行わずに、縮小重みメモリ13fに記憶される重みの第1要素を、重みの第2要素に用いて、各参照点の画素値を算出するように構成されている。   Furthermore, in the present embodiment, as will be described later with reference to FIG. 2, the image reduction program 12a does not calculate the second element of the weight, but converts the first element of the weight stored in the reduction weight memory 13f to the weight of the first element. Using the second element, the pixel value of each reference point is calculated.

つまり、本実施形態では、入力画像上の参照点は、その間隔がX軸方向においてもY軸方向においても等しくなるように設定される。従って、X座標0の位置からX軸方向にa番目に位置する参照点Pまでの距離と、Y座標0からY軸方向にa番目に位置する参照点Pまでの距離とを等しくすることができる。故に、X軸方向におけるa番目の参照点に対応する第1要素は、Y軸方向においてa番目の参照点の画素値を算出する場合の重みの第2要素とすることができるのである。例えば、Pメモリ13f1に記憶される第1要素は、X座標0を基点としてX軸方向に1番目に位置する参照点P10に対応する第1要素である。Y座標0を基点としてY軸方向に1番目に位置する参照点は、参照点P01〜Pm’1であるので、Pメモリ13f1に記憶される第1要素は、参照点P01〜Pm’1の各画素値を算出する際の重みの第2要素とすることができる。 That is, in the present embodiment, the reference points on the input image are set so that the distance between them is equal in both the X-axis direction and the Y-axis direction. Therefore, the distance from the position of the X coordinate 0 to the reference point P located in the a-axis direction in the X-axis direction and the distance from the Y coordinate 0 to the reference point P located in the a-axis direction in the Y-axis direction can be made equal. it can. Therefore, the first element corresponding to the a-th reference point in the X-axis direction can be the second element of the weight when calculating the pixel value of the a-th reference point in the Y-axis direction. For example, the first elements stored in the P 1 memory 13f1 is first element corresponding to the reference point P 10 located at the first in the X-axis direction X-coordinate 0 as a reference point. Reference points located in the first in the Y-axis direction Y-coordinate 0 as the base point, because the reference point P 01 to P M'1, first elements stored in the P 1 memory 13f1 are reference points P 01 ~ It can be used as the second element of the weight when calculating each pixel value of P m′1 .

図2は、本実施形態の画像縮小プログラム12aにて実行される縮小画像(出力画像)生成の概要を模式的に示した図である。図2においては、小さな四角形の集合体にて模式的に画像を表現しており、小さな四角形のそれぞれがピクセル格子に相当している。ピクセル格子の各頂点(格子点)は、画素が配置される位置である。   FIG. 2 is a diagram schematically showing an outline of reduced image (output image) generation executed by the image reduction program 12a of this embodiment. In FIG. 2, an image is schematically represented by a collection of small squares, and each of the small squares corresponds to a pixel grid. Each vertex (grid point) of the pixel grid is a position where a pixel is arranged.

図2中、左方には、13×9画素で構成された入力画像が表示されている。入力画像においては、各格子点のそれぞれにおける画素を黒丸で表示している。9行13列に配置された各画素のそれぞれには、(0,0)〜(12,8)の各座標が付与されており、X軸方向におけるピクセル格子間の数は12であり、Y軸方向におけるピクセル格子間の数は8である。   In FIG. 2, an input image composed of 13 × 9 pixels is displayed on the left side. In the input image, pixels at each lattice point are displayed as black circles. The coordinates of (0, 0) to (12, 8) are assigned to each of the pixels arranged in 9 rows and 13 columns, the number of pixel grids in the X-axis direction is 12, and Y The number between pixel grids in the axial direction is 8.

出力画像の生成に際しては、まず、生成する出力画像の大きさが、指定された縮小率に基づいて決定される。図2においては、ユーザによって操作パネル16から縮小率60%が指定され、縮小率メモリ13eに0.6が記憶された場合を例として示している。従って、入力画像のX軸方向の画素数13に縮小率0.6を乗算して得られた7.8画素を、四捨五入にした8画素が出力画像X軸方向の画素数となる。そして、かかる長辺の画素数の比である8/13を、入力画像のY軸方向の画素数9に乗算して得られる画素数5.53を、小数点以下を切り捨てて整数化することにより、Y軸方向の画素数5が求められる。従って、8×5画素の大きさを有する出力画像が形成されることとなる。   When generating an output image, first, the size of the output image to be generated is determined based on the designated reduction ratio. FIG. 2 shows an example in which a reduction rate of 60% is designated by the user from the operation panel 16 and 0.6 is stored in the reduction rate memory 13e. Accordingly, 8 pixels obtained by rounding off 7.8 pixels obtained by multiplying the number of pixels 13 in the X-axis direction of the input image by the reduction ratio 0.6 is the number of pixels in the output image X-axis direction. Then, by multiplying 8/13, which is the ratio of the number of pixels on the long side, by the number of pixels 9 in the Y-axis direction of the input image, the number of pixels 5.53 is rounded down to an integer. The number of pixels 5 in the Y-axis direction is obtained. Therefore, an output image having a size of 8 × 5 pixels is formed.

図2の上方には、この出力画像を表示している。太線の実線で囲まれた長方形の部分が、実際の出力画像に相当している。出力画像の各格子点における黒丸は、各画素を示しており、5行8列に配置された各画素のそれぞれには、(0,0)〜(7,4)の各座標が付与されている。また、出力画像におけるX軸方向におけるピクセル格子間の数は7であり、Y軸方向におけるピクセル格子間の数は4である。尚、破線部分のピクセル格子は、後述する仮想化された領域を示している。   This output image is displayed in the upper part of FIG. A rectangular portion surrounded by a thick solid line corresponds to an actual output image. The black circles at the respective grid points of the output image indicate the respective pixels, and the coordinates of (0, 0) to (7, 4) are given to the respective pixels arranged in 5 rows and 8 columns. Yes. The number of pixel grids in the X-axis direction in the output image is 7, and the number of pixel grids in the Y-axis direction is 4. Note that the pixel grid in the broken line portion represents a virtualized area described later.

出力画像の大きさが決定されると、次に、出力画像の各画素に対応する入力画像上の参照点が設定される。上記したように、出力画像の各画素の画素値は、入力画像の対応する位置(参照点)の画素値として求められるからである。尚、入力画像上における参照点の設定は、実際に描画を行って実行されるのではなく演算によって参照点の座標を求めることによって行われるが、説明を容易とするために、入力画像上に参照点を表示して説明する。   Once the size of the output image is determined, next, a reference point on the input image corresponding to each pixel of the output image is set. This is because the pixel value of each pixel of the output image is obtained as the pixel value of the corresponding position (reference point) of the input image as described above. Note that the reference point on the input image is set by calculating the coordinates of the reference point by calculation rather than by actually drawing, but for ease of explanation, the reference point is set on the input image. Reference points are displayed and explained.

ここで、本実施形態においては、次の2の条件を満たすように参照点を設定する。1つ目の条件は、参照点の間隔をX軸方向とY軸方向とで等しくすることである。2つ目の条件は、参照点の間隔を、入力画像の長辺に沿って配列される参照点の間隔で規定することである。これにより、参照点を頂点として結ぶ格子は、正方形となる。また、入力画像と出力画像との両者は、図2に示したように、あたかも正方形であるかのように取り扱われる。   Here, in the present embodiment, reference points are set so as to satisfy the following two conditions. The first condition is that the interval between reference points is equal in the X-axis direction and the Y-axis direction. The second condition is that the interval between reference points is defined by the interval between reference points arranged along the long side of the input image. Thereby, the grid connecting the reference points as vertices becomes a square. Also, both the input image and the output image are handled as if they were square as shown in FIG.

ここで、参照点の設定においては、背景技術において説明した2の方法が採用し得るので、出力画像の下方左側には、入力画像に対し第1の方法によって参照点を設定した状態を、出力画像下方右側には、入力画像に対し第2の方法によって参照点を設定した状態を示す。この出力画像下方の入力画像の表示において、太線で囲まれた長方形の部分が、実際の入力画像に相当している。太線で囲まれた長方形に連接された破線の表示部分は、仮想化された領域を示している。また、入力画像上に表示された実線の白丸は、設定された参照点を示しており、入力画像の上辺側には、用いられる(算出された)重みの第1要素tのそれぞれをX軸方向に配列された参照点に対応つけて示し、入力画像の左辺側には、用いられる重みの第2要素のそれぞれをY軸方向に配列された参照点に対応つけて示している。破線領域に表示された破線の丸は、仮想上の画素を示している。   Here, in setting the reference point, the two methods described in the background art can be adopted. Therefore, on the lower left side of the output image, the state where the reference point is set by the first method for the input image is output. The lower right side of the image shows a state in which the reference point is set for the input image by the second method. In the display of the input image below the output image, a rectangular portion surrounded by a thick line corresponds to the actual input image. A broken line display portion connected to a rectangle surrounded by a thick line indicates a virtualized area. A solid white circle displayed on the input image indicates a set reference point. On the upper side of the input image, each of the first elements t of the weights used (calculated) is displayed on the X axis. The reference points arranged in the direction are shown in association with the reference points. On the left side of the input image, the second elements of the weights used are shown in association with the reference points arranged in the Y-axis direction. A broken-line circle displayed in the broken-line area indicates a virtual pixel.

参照点設定の第1の方法は、出力画像の第1行目に配列される画素に対応する参照点を、入力画像の第1行目に設定すると共に、出力画像の第1列目に配列される画素に対応する参照点を、入力画像の第1列目に設定する方法である。ここで、本実施形態は、参照点の間隔を、入力画像の長辺に沿って配列される参照点の間隔で規定するものである。図2においては、X軸方向が長辺であるので、X軸に配列される画素数の比率8/13の逆数によって、参照点の間隔が求められる。   In the first method of setting reference points, reference points corresponding to pixels arranged in the first row of the output image are set in the first row of the input image and arranged in the first column of the output image. This is a method of setting a reference point corresponding to a pixel to be set in the first column of the input image. In this embodiment, the reference point interval is defined by the reference point interval arranged along the long side of the input image. In FIG. 2, since the X-axis direction is a long side, the interval between reference points is obtained by the reciprocal of the ratio 8/13 of the number of pixels arranged on the X-axis.

従って、出力画像の第1列目に配列される画素に対応する参照点を入力画像の第1列目に設定するとすれば、第2列目以降の各参照点のX軸方向の位置は、13/8(1.625)ずつX軸方向に進行した位置となる。同様に、出力画像の第1行目に配列される画素に対応する参照点を入力画像の第1行目に設定するとすれば、Y軸方向における第2行目以降の参照点の位置は、13/8(1.625)ずつY軸方向に進行した位置となる。   Accordingly, if the reference point corresponding to the pixel arranged in the first column of the output image is set in the first column of the input image, the position in the X-axis direction of each reference point after the second column is The position is advanced in the X-axis direction by 13/8 (1.625). Similarly, if the reference points corresponding to the pixels arranged in the first row of the output image are set in the first row of the input image, the positions of the reference points after the second row in the Y-axis direction are The position is advanced in the Y-axis direction by 13/8 (1.625).

参照点設定の第2の方法は、出力画像のY軸に沿った両辺上の画素に対応する参照点は、入力画像のY軸に沿った両辺上に設定するとしたものであり、X軸方向両端の画素を除いた残りの画素に対応する参照点を、X軸に沿って均等に割り付ける方法である。図2においては、X軸方向が長辺であるので、X軸に配列されるピクセル格子間の数の比率7/12の逆数によって、参照点の間隔が求められる。   In the second method of setting the reference point, reference points corresponding to pixels on both sides along the Y axis of the output image are set on both sides along the Y axis of the input image, and the X axis direction In this method, reference points corresponding to the remaining pixels excluding pixels at both ends are evenly allocated along the X axis. In FIG. 2, since the X-axis direction is a long side, the interval between the reference points is obtained by the reciprocal of the ratio 7/12 of the number of pixel grids arranged on the X-axis.

従って、出力画像の第1列目に配列される画素に対応する参照点を入力画像の第1列目に設定するとすれば、第2列目以降の各参照点のX軸方向の位置は、12/7(1.714)ずつX軸方向に進行した位置となる。同様に、出力画像の第1行目に配列される画素に対応する参照点を入力画像の第1行目に設定するとすれば、Y軸方向における第2行目以降の参照点の位置は、12/7(1.714)ずつY軸方向に進行した位置となる。   Accordingly, if the reference point corresponding to the pixel arranged in the first column of the output image is set in the first column of the input image, the position in the X-axis direction of each reference point after the second column is The position is advanced in the X-axis direction by 12/7 (1.714). Similarly, if the reference points corresponding to the pixels arranged in the first row of the output image are set in the first row of the input image, the positions of the reference points after the second row in the Y-axis direction are The position is advanced in the Y-axis direction by 12/7 (1.714).

このように本実施形態の手法で参照点を設定した場合には、X軸方向においてもY軸方向においても8画素を13画素分の長さに配置したことと同義となり、結果として、出力画像を8×8画素、入力画像を13×13画素の正方形に仮想化したこととなる。   Thus, when the reference point is set by the method of the present embodiment, it is synonymous with the arrangement of 8 pixels in the length of 13 pixels in both the X-axis direction and the Y-axis direction, and as a result, the output image Is virtualized as a square of 8 × 8 pixels and the input image is 13 × 13 pixels.

これによれば、入力画像上の各参照点について、X座標0を基点としてX軸方向にa番目に位置する参照点までの距離と、Y座標0を基点としてY軸方向にa番目に位置する参照点までの距離とは等しくなる。言い換えれば、X座標0を基点としてX軸方向にa番目に位置する参照点のX座標と、Y座標0を基点としてY軸方向にa番目に位置する参照点のY座標とは等しくなる。その結果、Y座標0を基点としてY軸方向にa番目に位置する参照点とその周辺画素とのY軸方向における距離は、X座標0を基点としてX軸方向にa番目に位置する参照点とその周辺画素とのX軸方向における距離に等しくすることができるので、図2下方の2の入力画像の上辺側および左辺側に示すように、X軸方向におけるa番目の参照点に対応する第1要素と、Y軸方向におけるa番目の参照点に対応する第2要素とを等しくすることができるのである。   According to this, for each reference point on the input image, the distance to the reference point located a-th in the X-axis direction with the X coordinate 0 as the base point, and the a-th position in the Y-axis direction with the Y coordinate 0 as the base point The distance to the reference point is equal. In other words, the X coordinate of the reference point located a-th in the X-axis direction with the X coordinate 0 as the base point is equal to the Y coordinate of the reference point located a-th in the Y-axis direction with the Y coordinate 0 as the base point. As a result, the distance in the Y-axis direction between the reference point located at the a-th position in the Y-axis direction from the Y-coordinate 0 and the surrounding pixels is the reference point located at the a-th position in the X-axis direction from the X-coordinate 0. 2 and its peripheral pixels in the X-axis direction, and corresponds to the a-th reference point in the X-axis direction, as shown on the upper side and the left side of the two input images in the lower part of FIG. The first element and the second element corresponding to the a-th reference point in the Y-axis direction can be made equal.

尚、本実施形態においては、第1の方法にて参照点の設定を行うように構成されている。   In the present embodiment, the reference point is set by the first method.

次に、図3のフローチャートを参照して、上記のように構成されたプリンタ1で実行される縮小処理について説明する。図3は、本実施形態の画像縮小プログラム12aに基づいてCPU11により実行される縮小処理のフローチャートである。   Next, the reduction process executed by the printer 1 configured as described above will be described with reference to the flowchart of FIG. FIG. 3 is a flowchart of the reduction process executed by the CPU 11 based on the image reduction program 12a of the present embodiment.

この縮小処理は、ユーザにより、入力画像の縮小が指定(縮小率の入力)されることにより起動され、入力画像サイズメモリ13cに記憶されるサイズデータ(画素数M,N)を読み出し(S1)、縮小率メモリ13eに記憶される縮小率Rを読み出す(S2)。この縮小率Rは、ユーザにより、操作パネル16から入力された値であり、入力されたタイミングで、本縮小処理に先立って、縮小率メモリ13eに記憶される。また、PC2などからプリンタ1に入力された入力画像データは、その入力されたタイミングで、入力画像メモリ13aに書き込まれて記憶されている。尚、このインターフェース17,18または外部メディアスロット19を介して入力された入力画像データをCPU11が入力画像メモリ13aに書込む処理が、請求項に記載のデータ取得ステップに相当する。   This reduction process is started when the user designates the reduction of the input image (input of reduction ratio), and reads the size data (number of pixels M, N) stored in the input image size memory 13c (S1). Then, the reduction rate R stored in the reduction rate memory 13e is read (S2). The reduction ratio R is a value input from the operation panel 16 by the user, and is stored in the reduction ratio memory 13e at the input timing prior to the main reduction process. The input image data input to the printer 1 from the PC 2 or the like is written and stored in the input image memory 13a at the input timing. The process in which the CPU 11 writes the input image data input through the interfaces 17 and 18 or the external media slot 19 into the input image memory 13a corresponds to the data acquisition step described in the claims.

そして、出力画像のサイズデータ(画素数m,n)を算出する(S3)。この出力画像のサイズデータは、上記したように出力画像のX軸方向の画素数mと、Y軸方向の画素数nとであり、X軸が長辺であれば、画素数mは、入力画像のX軸方向の画素数Mに縮小率Rを乗算した値を整数化(四捨五入)して求められる。また、画素数nは、画素数mとMとの比(m/M)を入力画像のY軸方向の画素数Nに乗算した値を整数化(小数点以下切り捨て)して求められる。一方、Y軸が長辺であれば、画素数nは、入力画像のY軸方向の画素数Nに縮小率Rを乗算した値を整数化(四捨五入)して求められ、画素数mは、画素数nとNとの比(n/N)を入力画像のX軸方向の画素数Mに乗算した値を整数化(小数点以下切り捨て)して求められる。つまり、本実施形態では、長辺を基準に出力画像の大きさを決定する。また、短辺については、小数点以下の値を切り捨てて画素数を整数化する。このため、長辺の比率で規定される係数cで参照点を設定しても、短辺側においてもはみ出すことなく参照点を入力画像上に設定することができる。その後、求めた出力画像のサイズデータ(画素数m,n)を出力画像サイズメモリ13cに記憶する(S4)。   Then, size data (number of pixels m, n) of the output image is calculated (S3). The size data of the output image is the number of pixels m in the X-axis direction and the number of pixels n in the Y-axis direction of the output image as described above. If the X-axis is a long side, the number of pixels m is The value obtained by multiplying the number M of pixels in the X-axis direction of the image by the reduction ratio R is obtained as an integer (rounded off). The number of pixels n is obtained by converting the ratio of the number of pixels m and M (m / M) to the number of pixels N in the Y-axis direction of the input image to an integer (rounded down). On the other hand, if the Y-axis is a long side, the number of pixels n is obtained by converting the number of pixels N in the Y-axis direction of the input image by a reduction ratio R to an integer (rounded off), and the number of pixels m is A value obtained by multiplying the ratio (n / N) of the number of pixels n and N by the number of pixels M in the X-axis direction of the input image is obtained by converting to an integer (rounded down). That is, in this embodiment, the size of the output image is determined based on the long side. For the short side, the value after the decimal point is rounded down to make the number of pixels an integer. For this reason, even if the reference point is set with the coefficient c defined by the ratio of the long side, the reference point can be set on the input image without protruding on the short side. Thereafter, the obtained size data (number of pixels m, n) of the output image is stored in the output image size memory 13c (S4).

次いで、出力画像サイズメモリ13cに記憶した画素数nが画素数m以下であるかを確認し(S5)、その結果、画素数nが画素数m以下であれば(S5:Yes)、出力画像(及び入力画像)は、X軸方向を長辺とする画像であるので、画素数mを基準として、出力画像の各画素に対応する入力画像の座標(参照点)を算出する係数Cを求める(S6)。この係数Cは、図2において説明した参照点の間隔であり、入力画像のX軸方向の画素数Mを出力画像の画素数mで除して算出される。つまり、係数Cは、縮小率m/Mの逆数となっている。   Next, it is confirmed whether or not the number of pixels n stored in the output image size memory 13c is equal to or less than the number of pixels m (S5). As a result, if the number of pixels n is equal to or less than the number of pixels m (S5: Yes), the output image Since (and the input image) is an image having the long side in the X-axis direction, a coefficient C for calculating the coordinates (reference point) of the input image corresponding to each pixel of the output image is obtained on the basis of the number of pixels m. (S6). The coefficient C is the reference point interval described in FIG. 2, and is calculated by dividing the number of pixels M in the X-axis direction of the input image by the number of pixels m of the output image. That is, the coefficient C is the reciprocal of the reduction ratio m / M.

一方、画素数nが画素数mを超えていれば(S5:No)、出力画像(及び入力画像)は、Y軸方向を長辺とする画像であるので、画素数nを基準として、出力画像の各画素に対応する入力画像の座標(参照点)を算出する係数Cが、入力画像のY軸方向の画素数Nを出力画像の画素数nで除して算出される(S7)。つまり、縮小率n/Nの逆数が求められる。   On the other hand, if the number of pixels n exceeds the number of pixels m (S5: No), the output image (and the input image) is an image having a long side in the Y-axis direction. A coefficient C for calculating the coordinates (reference point) of the input image corresponding to each pixel of the image is calculated by dividing the number of pixels N in the Y-axis direction of the input image by the number of pixels n of the output image (S7). That is, the reciprocal of the reduction ratio n / N is obtained.

S6またはS7の処理の後は、x=0、y=0として(S8)、出力画像の各画素p(x,y)に対応する入力画像上の参照点の座標P(X,Y)を算出する(S9)。参照点のX座標は、入力画像の各画素のx座標に係数Cを乗算して求められ、参照点のY座標は、入力画像の各画素のy座標に係数Cを乗算して求められる。つまり、同じ係数Cが入力画像各画素のx座標とy座標とに乗算されるので、各参照点を入力画像上においてX軸方向にもY軸方向にも同じ間隔で配置する座標が、それぞれの参照点に付与される。   After the process of S6 or S7, x = 0 and y = 0 are set (S8), and the coordinates P (X, Y) of the reference point on the input image corresponding to each pixel p (x, y) of the output image are set. Calculate (S9). The X coordinate of the reference point is obtained by multiplying the x coordinate of each pixel of the input image by the coefficient C, and the Y coordinate of the reference point is obtained by multiplying the y coordinate of each pixel of the input image by the coefficient C. That is, since the same coefficient C is multiplied by the x coordinate and the y coordinate of each pixel of the input image, the coordinates at which the reference points are arranged at the same interval in the X axis direction and the Y axis direction on the input image are respectively To the reference point.

続いて、y=0であるかを確認し(S10)、y=0であれば(S10:Yes)、縮小処理の起動直後のS9の処理が実行されたタイミングであり、出力画像の第1行目に配列される画素に対応する参照点(参照点P00〜P0m’)の処理が実行される状態にあるので、重みの第1要素を算出する(S11)。ここで、重みの第1要素は、距離tおよび距離1−tであるが、参照点P00〜P0m’に対応する距離tを距離t〜距離tm−1とすると、各参照点に対応する距離t(x=0〜m−1)は、参照点PのX座標値を整数化(小数点以下切り捨て)した値をそのX座標値から減算して(t=X−int(X))求められる。また、求められたtを1から減算して、各参照点に対応する距離1−tが算出される。 Subsequently, it is confirmed whether y = 0 (S10). If y = 0 (S10: Yes), it is the timing when the process of S9 immediately after the start of the reduction process is executed, and the first output image Since the processing of the reference points (reference points P 00 to P 0m ′ ) corresponding to the pixels arranged in the row is being executed, the first element of the weight is calculated (S11). Here, the first element of the weight is the distance t and the distance 1-t. When the distance t corresponding to the reference points P 00 to P 0m ′ is the distance t 0 to the distance t m−1 , each reference point The distance t x (x = 0 to m−1) corresponding to is obtained by subtracting the value obtained by converting the X coordinate value of the reference point P into an integer (truncated after the decimal point) from the X coordinate value (t x = X−int (X)) required. Further, the obtained t x is subtracted from 1 to calculate a distance 1-t x corresponding to each reference point.

次いで、算出したtおよび1−tを、xによって指定されるPxメモリに書き込む(S12)。これにより、参照点P00に対応する第1要素である距離tおよび1−tは、縮小重みメモリ13fのPメモリ13f0に書き込まれる。同様に、参照点P10〜Pm’0に対応する第1要素である距離t〜tm−1および1−t〜1−tm−1は、縮小重みメモリ13fのPメモリ13f1〜Pm−1メモリ13m−1の対応するメモリに書き込まれる。 Next, the calculated t x and 1−t x are written into the Px memory designated by x (S12). Thus, the distance t 0 and 1-t 0 to the reference point P 00 is the first element corresponding is written in P 0 memory 13f0 reduced weight memory 13f. Similarly, the distances t 1 to t m−1 and 1−t 1 to 1−t m−1 which are the first elements corresponding to the reference points P 10 to P m′0 are the P 1 memory of the reduced weight memory 13f. 13f1 to Pm -1 are written in the corresponding memories of the memory 13m-1.

その後、xがm−1以下(x≦m−1)であるかを確認し(S13)、ここで、xがm−1以下であれば(S13:Yes)、対応する画素p(x,y)の画素値を算出するために、参照点P(X,Y)のX座標の小数点以下の値を切り捨てて整数化した値をi、Y座標の小数点以下の値を切り捨てて整数化した値をjとして、参照点P(X,Y)の基準周辺画素P(i,j)を決定すると共に、P(i+1,j+1)、P(i,j+1)、P(i+1,j)を求め、参照点P(X,Y)の4つの周辺画素を選定する(S14)。参照点P(X,Y)が、入力画像の格子点に存在する場合には、周辺画素には、参照点と同位置のその格子点上の画素が含まれる。   Thereafter, it is confirmed whether x is m−1 or less (x ≦ m−1) (S13). Here, if x is m−1 or less (S13: Yes), the corresponding pixel p (x, In order to calculate the pixel value of y), the value obtained by rounding down the value after the decimal point of the X coordinate of the reference point P (X, Y) is converted to an integer by rounding down the value after the decimal point of the i coordinate and the Y coordinate. The reference peripheral pixel P (i, j) of the reference point P (X, Y) is determined with the value j, and P (i + 1, j + 1), P (i, j + 1), and P (i + 1, j) are obtained. Then, four peripheral pixels of the reference point P (X, Y) are selected (S14). When the reference point P (X, Y) exists at a lattice point of the input image, the peripheral pixels include pixels on the lattice point at the same position as the reference point.

そして、yの値に対応する縮小重みメモリ13fに記憶されるtをs、1−tを1−sとして読み出してから(S15)、xの値に対応する縮小重みメモリ13fに記憶されるtと、1−tとを読み出す(S16)。yの値に対応する縮小重みメモリ13fとは、Pメモリ13f0〜Pメモリ13fmの内、yの値で指定されるメモリであり、例えば、yの値が0である場合には、Pメモリ13f0が指定され、yの値が1であればPメモリ13f1が指定される。同様に、xの値に対応する縮小重みメモリ13fとは、Pメモリ13f0〜Pメモリ13fmの内、xの値で指定されるメモリであり、例えば、xの値が0である場合には、Pメモリ13f0が指定され、xの値が1であればPメモリ13f1が指定される。 Then, t x stored in the reduction weight memory 13f corresponding to the value of y is read as s y and 1-t x as 1-s y (S15), and then stored in the reduction weight memory 13f corresponding to the value of x. The stored t x and 1-t x are read (S16). The reduced weight memory 13f corresponding to the value of y, among P 0 memory 13F0~P m memory 13Fm, a memory specified by the value of y, for example, when the value of y is 0, P If the 0 memory 13f0 is designated and the value of y is 1, the P 1 memory 13f1 is designated. Similarly, the reduced weight memory 13f corresponding to the value of x, of the P 0 memory 13F0~P m memory 13Fm, a memory specified by the value of x, for example, if the value of x is 0 is, P 0 memory 13f0 is specified, the value of x is P 1 memory 13f1 if 1 is designated.

ここで、yの値は、出力画像のy座標の値であると共に、入力画像の参照点のY軸方向における位置を示す値番目に対応している。つまり、参照点のY軸方向における位置を示す情報にて、縮小重みメモリ13fに記憶される重みの第1要素が第2要素として抽出されることとなる。   Here, the value of y corresponds to the value of y indicating the position of the reference point of the input image in the Y-axis direction as well as the value of the y coordinate of the output image. That is, the first element of the weight stored in the reduced weight memory 13f is extracted as the second element based on the information indicating the position of the reference point in the Y-axis direction.

そして、読み出したt、1−tを重みの第1要素、s、1−sを重みの第2要素とすると共に、S14の処理で選定した周辺画素の画素値を(1)式に示したバイ・リニア法で補間演算して、p(x,y)の画素値を算出する(S17)。その後、算出したp(x,y)の画素値を出力画像メモリ13bに書込んでから(S18)、xがm−1未満であるか(x<m−1)を確認し(S19)、xがm−1以上であれば(S19:No)、その行において算出するべき全ての画素値の算出が完了したので、y=0であるかを確認し(S20)、ここで、y=0であれば(S20:Yes)、xがn−1未満であるか(x<n−1)を確認する(S21)。 Then, the read t x and 1-t x are set as the first element of the weight, and s y and 1- sy are set as the second element of the weight, and the pixel values of the peripheral pixels selected in the process of S14 are (1). The pixel value of p (x, y) is calculated by performing an interpolation operation using the bilinear method shown in the equation (S17). Then, after writing the calculated pixel value of p (x, y) into the output image memory 13b (S18), it is confirmed whether x is less than m−1 (x <m−1) (S19). If x is greater than or equal to m−1 (S19: No), since calculation of all pixel values to be calculated in the row has been completed, it is confirmed whether y = 0 (S20), where y = If it is 0 (S20: Yes), it is confirmed whether x is less than n-1 (x <n-1) (S21).

本実施形態においては、画像の長辺を基準に参照点の設定を行う事としているので、画像のY軸が長辺である場合には、X軸方向において本来の画素数であるm個分の第1要素の算出が完了しても、X軸の画素数を仮想的にn個として、画素数nに対応する重みの第1要素を算出する必要がある。S20の処理においてy=0である場合には、第1要素を算出するタイミングであるため、かかる第1要素の算出を終了しても良いか否かを判断するために、xがn−1未満であるかを確認するのである。つまり、Y軸が長辺であれば、Y軸方向の画素数nはX軸方向の画素数mよりも大きい(m<n)ので、xの値がm−1であると、x<n−1となるからである。従って、xがn−1以上であれば(S21:No)、長辺はX軸(m≧n)であり、その行において算出するべき全ての画素値の算出は完了しているので、Y軸方向において最終の画素に到達しているかを調べるために、yがn−1未満であるか(y<n−1)を確認する(S22)。その結果、yがn−1以上であれば(S22:No)、出力画像の最終行nの最後の画素まで、画素値の算出が終了しているので、この縮小処理を終了する。   In the present embodiment, since the reference point is set based on the long side of the image, when the Y axis of the image is the long side, the original number of pixels in the X-axis direction is set to m. Even if the calculation of the first element is completed, it is necessary to calculate the first element having a weight corresponding to the number n of pixels, assuming that the number of pixels on the X axis is virtually n. If y = 0 in the process of S20, it is the timing for calculating the first element. Therefore, in order to determine whether or not the calculation of the first element may be terminated, x is n−1. It is confirmed whether it is less than. That is, if the Y-axis is a long side, the number of pixels n in the Y-axis direction is larger than the number of pixels m in the X-axis direction (m <n). Therefore, if the value of x is m−1, x <n This is because -1. Therefore, if x is n−1 or more (S21: No), the long side is the X axis (m ≧ n), and the calculation of all pixel values to be calculated in the row has been completed. In order to check whether the final pixel has been reached in the axial direction, it is confirmed whether y is less than n-1 (y <n-1) (S22). As a result, if y is n−1 or more (S22: No), calculation of pixel values up to the last pixel in the last row n of the output image is completed, and thus this reduction process is terminated.

一方、S10の処理で確認した結果、y=0でなければ(S10:No)、各参照点に対応する各第1要素の算出は終了しているので、その処理をS14の処理に移行する。これにより、第1要素を算出するS11,S12の処理は、スキップされる。各参照点に対応する第1要素は、同じX座標を有する参照点毎に、1度算出すれば良い。故に、y=0、即ち、出力画像の先頭行の各画素の画素値を算出する期間において、各参照点に対応する各第1要素を1度算出した後は、y=0でないことを条件に、S11〜S13の処理を回避するように構成しているのである。   On the other hand, as a result of checking in the process of S10, if y = 0 is not satisfied (S10: No), the calculation of each first element corresponding to each reference point is completed, and the process is shifted to the process of S14. . Thereby, the processing of S11 and S12 for calculating the first element is skipped. The first element corresponding to each reference point may be calculated once for each reference point having the same X coordinate. Therefore, if y = 0, that is, if the first element corresponding to each reference point is calculated once in the period for calculating the pixel value of each pixel in the first row of the output image, y = 0 is not satisfied. In addition, the processing of S11 to S13 is avoided.

また、S13の処理で確認した結果、xがm−1を超えていれば(S13:No)、出力画像においてy座標の値がyである行のm個の画素の画素値は、全て算出されているので、その処理をS20の処理に移行する。S13の処理は、第1要素を算出する場合(y=0)のみ経由する処理である。従って、このS13の処理において、xがm−1を超える値となるのは、第1要素を算出する場合(y=0)であり、また、出力画像(入寮画像)のX軸がY軸よりも短いことが条件となる。つまり、長辺に対応する画素数分の第1要素を生成するので、m<nであれば、第1要素は、n個分生成しなくてはならない。第2要素は、Y軸方向の画素数分、n個必要となるからである。故に、S13の処理でNoに分岐した場合は、更に、第1要素を算出するべく、その処理をS20の処理に移行するのである。   As a result of checking in the process of S13, if x exceeds m−1 (S13: No), the pixel values of all m pixels in the row in which the y coordinate value is y in the output image are all calculated. Therefore, the process proceeds to S20. The process of S13 is a process that passes only when the first element is calculated (y = 0). Therefore, in the process of S13, x exceeds m−1 when the first element is calculated (y = 0), and the X axis of the output image (dormitory image) is the Y axis. Shorter than that. That is, since the first elements for the number of pixels corresponding to the long side are generated, if m <n, n first elements must be generated. This is because n second elements are required for the number of pixels in the Y-axis direction. Therefore, when branching to No in the process of S13, the process proceeds to the process of S20 to further calculate the first element.

加えて、S19の処理で確認した結果、xがm−1未満であれば(S19:Yes)、xがX軸方向の最終画素を示すまで、その行における画素に対する画素値を算出するために、また、y=0である場合には第1要素の算出をる引き続き実行するためにも、その処理をS23の処理に移行して、xに1加算してから(S23)、その処理をS9の処理に移行する。これにより、xがm−1に達するまで、繰り返して、S9〜S19の処理が実行されて、その行における全画素に対する画素値の算出が(y=0である場合には第1要素の算出についても)実行される。   In addition, if x is less than m−1 as a result of checking in the process of S19 (S19: Yes), in order to calculate pixel values for the pixels in the row until x indicates the final pixel in the X-axis direction. In order to continue the calculation of the first element when y = 0, the process shifts to the process of S23, and 1 is added to x (S23). The process proceeds to S9. As a result, the processes of S9 to S19 are repeated until x reaches m−1, and the calculation of the pixel values for all the pixels in the row (when y = 0, the first element is calculated). Is also executed).

更に、S20で確認した結果、y=0でなければ(S20:No)、xがn−1未満である確認をする必要がない。y=0である場合には、m<nであれば、第1要素を算出するためにS11及びS12の処理を実行する必要があるが、y=0でなければ、第1要素は必要分算出済であるので、対応する画素値の算出を行うだけでよく、S11及びS12の処理を実行する必要がない。従って、y=0でなければ(S20:No)、xがn−1未満であるかの確認をする必要がないので、S21の処理をスキップして、その処理をS22の処理に移行する。   Furthermore, as a result of confirmation in S20, if y = 0 is not satisfied (S20: No), it is not necessary to confirm that x is less than n-1. In the case of y = 0, if m <n, it is necessary to execute the processes of S11 and S12 in order to calculate the first element, but if y = 0, the first element is required. Since it has already been calculated, it is only necessary to calculate the corresponding pixel value, and it is not necessary to execute the processing of S11 and S12. Therefore, if y = 0 is not satisfied (S20: No), it is not necessary to confirm whether x is less than n−1. Therefore, the process of S21 is skipped, and the process proceeds to S22.

また、S21の処理は、y=0である場合にのみ実行されるものである。故に、このS21の処理で確認した結果、xがn−1未満であれば(S21:Yes)、第1要素は、出力画像のX軸方向の画素数mに対応する分まで算出が終了しているが、長辺はY軸方向であってm<nである。したがって、更に、n−1に達するまで、対応する第1要素を算出する必要がある。故に、その処理をS23の処理に移行して、xに1加算してから、その処理をS9の処理に移行する。尚、このように、出力画像のY軸方向の画素数nに対応する分の第1要素を算出する場合には、縮小重みメモリ13fは、そのn個分のメモリPメモリ13f0〜Pn―1メモリ13fn−1で構成される。 Further, the process of S21 is executed only when y = 0. Therefore, if x is less than n−1 as a result of checking in the process of S21 (S21: Yes), the calculation of the first element is completed up to the amount corresponding to the number of pixels m in the X-axis direction of the output image. However, the long side is the Y-axis direction and m <n. Therefore, it is necessary to calculate the corresponding first element until n−1 is reached. Therefore, after shifting the process to the process of S23 and adding 1 to x, the process shifts to the process of S9. In this manner, when calculating the first element of the amount corresponding to the number of pixels n in the Y-axis direction of the output image is reduced weight memory 13f is memory P 0 memory 13F0~P n of the n-number fraction -1 memory 13fn-1.

更に、S22の処理で確認した結果、yがn−1未満であれば(S22:Yes)、1の行においてX軸方向最後の画素まで画素値または対応する第1要素の算出が終了した状態であるが、処理された行は出力画像の最終行nではないので、その処理をS24の処理に移行して、yの値に1加算すると共にx=0として、出力画像における次行の先頭画素を指定してから(S24)、その処理をS9の処理に移行する。これにより、出力画像の最終行の最終画素(p(m−1,n−1))に到達するまで、繰り返して、S9〜S24の処理が実行され、出力画像の各画素に対応する画素値が算出される。   Further, as a result of checking in the process of S22, if y is less than n-1 (S22: Yes), the calculation of the pixel value or the corresponding first element up to the last pixel in the X-axis direction in one row is completed. However, since the processed line is not the last line n of the output image, the process shifts to the process of S24, 1 is added to the value of y, and x = 0, and the beginning of the next line in the output image After designating a pixel (S24), the process proceeds to S9. As a result, the processes of S9 to S24 are repeated until the final pixel (p (m−1, n−1)) in the final row of the output image is reached, and the pixel values corresponding to the respective pixels of the output image. Is calculated.

以上説明したように、プリンタ2に搭載された画像縮小プログラム12aによる縮小処理では、重みの第1要素を、重みの第2要素として用いることができるので、重みの第2要素の算出を省略することができ、その結果、出力画像を生成する処理速度を向上させることができる。   As described above, in the reduction processing by the image reduction program 12a installed in the printer 2, the first element of the weight can be used as the second element of the weight, and therefore the calculation of the second element of the weight is omitted. As a result, the processing speed for generating the output image can be improved.

次に、図4を参照して、第2実施形態について説明する。上記した第1実施形態は、出力画像の生成を画像縮小プログラム12a、即ちソフトウェアによって行うように構成された。これに代えて、第2実施形態においては、出力画像(縮小画像)を生成する処理を、ハード回路によって実現するように構成されている。このため、第2実施形態おいては、プリンタ1には画像縮小プログラム12aは搭載されておらず、画像縮小プログラム12aに代えて、縮小画像を生成するハード回路が備えられている。尚、第1実施形態と同じ部分には同じ符号を付してその説明を省略する。   Next, a second embodiment will be described with reference to FIG. In the first embodiment described above, the output image is generated by the image reduction program 12a, that is, software. Instead, in the second embodiment, the processing for generating the output image (reduced image) is configured to be realized by a hardware circuit. For this reason, in the second embodiment, the printer 1 does not include the image reduction program 12a, and includes a hardware circuit that generates a reduced image instead of the image reduction program 12a. In addition, the same code | symbol is attached | subjected to the same part as 1st Embodiment, and the description is abbreviate | omitted.

図4は、プリンタ1の内部に搭載された、画像の縮小処理を実行する画像縮小回路200の構成を示すブロック図である。図4に示すように、画像縮小回路200は、データ入力部201、画像長辺算出部202、縮小重み計算部203、縦横同一重み記憶部204、データ縮小部205、データ出力部206を備えている。   FIG. 4 is a block diagram illustrating a configuration of an image reduction circuit 200 that is mounted inside the printer 1 and that performs image reduction processing. As shown in FIG. 4, the image reduction circuit 200 includes a data input unit 201, an image long side calculation unit 202, a reduction weight calculation unit 203, a vertical and horizontal same weight storage unit 204, a data reduction unit 205, and a data output unit 206. Yes.

データ入力部201は、PC2から送出された入力画像データ及び入力画像のサイズデータと、プリンタ1の操作パネル16から入力された出力画像のサイズデータとを、画像縮小回路内に入力するものであり、PC2から送出された入力画像データを記憶するための入力画像メモリ201aと、入力画像および出力画像のサイズデータを記憶するデータサイズメモリ201bとを備えている。尚、第2実施形態においては、操作パネル16からは縮小率ではなく、出力画像のサイズデータ(出力画像のX軸方向およびY軸方向それぞれの画素数m,n)が入力されるようになっている。   The data input unit 201 inputs the input image data and the size data of the input image sent from the PC 2 and the size data of the output image input from the operation panel 16 of the printer 1 into the image reduction circuit. , An input image memory 201a for storing the input image data sent from the PC 2 and a data size memory 201b for storing the size data of the input image and the output image are provided. In the second embodiment, not the reduction ratio but the size data of the output image (number of pixels m and n in the X-axis direction and Y-axis direction of the output image) is input from the operation panel 16. ing.

PC2からプリンタ1へは、入力画像データはラスタデータの態様で、ラスタ走査の順に従って入力され、入力画像メモリ201aには、メモリの先頭側から後方へ向かって順に、入力画像データを構成する各ラスタデータ(各画素値)が、ラスタ走査の順で配置されるように記憶される。   Input image data is input from the PC 2 to the printer 1 in the form of raster data in the order of raster scanning, and each of the input image data constituting the input image data is sequentially input to the input image memory 201a from the head side to the rear side. Raster data (each pixel value) is stored so as to be arranged in the order of raster scanning.

このデータ入力部201への、入力画像データおよびサイズデータの入力が終了すると、データ入力部201から画像長辺算出部202に、データサイズメモリ201bに記憶されたサイズデータが出力される。また、入力画像メモリ201aに記憶される画像データは、データ入力部201からデータ縮小部205へ出力される。   When the input of the input image data and the size data to the data input unit 201 is completed, the size data stored in the data size memory 201b is output from the data input unit 201 to the image long side calculation unit 202. The image data stored in the input image memory 201 a is output from the data input unit 201 to the data reduction unit 205.

画像長辺算出部202は、データ入力部201から入力されたサイズデータに基づいて、画像の長辺がX軸であるかY軸であるかを判断するものである。データ入力部201からの出力画像のサイズデータは、X軸方向の画素数mとY軸方向の画素数nとであるので、画像長辺算出部202においては、mとnとを比較して、画像の長辺が判断される。そして、出力画像のサイズデータの内、長辺と判断された方の画素数は、縮小重み計算部203に出力される。また、対応する入力画像の長辺のサイズデータについても、縮小重み計算部203に出力される。   The image long side calculation unit 202 determines whether the long side of the image is the X axis or the Y axis based on the size data input from the data input unit 201. Since the size data of the output image from the data input unit 201 is the number of pixels m in the X-axis direction and the number of pixels n in the Y-axis direction, the image long side calculation unit 202 compares m and n. The long side of the image is determined. The number of pixels determined to be the long side in the output image size data is output to the reduction weight calculation unit 203. The size data of the long side of the corresponding input image is also output to the reduction weight calculation unit 203.

縮小重み計算部203は、画像長辺算出部202から入力されたサイズデータに基づき、補間演算に用いる重みの第1要素を算出するものである。縮小重み計算部203は、画像長辺算出部202からの入力画像および出力画像の長辺の画素数から、その両者の比(M/m又はN/n)を算出する。第1実施形態で述べたように、算出された比は、出力画像の各画素に対応する参照点の間隔を規定するものであり、出力画像の画素の座標(x,y)に乗算することにより、参照点の座標が決定される。そして、その参照点のX座標を整数化(切り捨て)した値を、参照点のX座標から減算することにより、重みの第1要素が算出される。この第1要素の算出は、長辺の画素数分、実行される。つまり、出力画像の画素p(0,0)からp(0,m−1)またはp(0,n−1)に至るまで実行される。算出された第1要素は、順次、縦横同一重み記憶部204に出力される。また、算出された入力画像長辺の画素数と出力画像長辺の画素数との比は、データ縮小部205に出力される。   The reduction weight calculation unit 203 calculates the first element of the weight used for the interpolation calculation based on the size data input from the image long side calculation unit 202. The reduction weight calculation unit 203 calculates the ratio (M / m or N / n) between the input image from the image long side calculation unit 202 and the number of pixels on the long side of the output image. As described in the first embodiment, the calculated ratio defines an interval between reference points corresponding to each pixel of the output image, and is multiplied by the coordinates (x, y) of the pixel of the output image. Thus, the coordinates of the reference point are determined. Then, the first element of the weight is calculated by subtracting the value obtained by converting the X coordinate of the reference point into an integer (rounded down) from the X coordinate of the reference point. The calculation of the first element is executed for the number of pixels on the long side. That is, the process is executed from the pixel p (0, 0) of the output image to p (0, m-1) or p (0, n-1). The calculated first element is sequentially output to the vertical and horizontal equal weight storage unit 204. The calculated ratio between the number of pixels on the long side of the input image and the number of pixels on the long side of the output image is output to the data reduction unit 205.

縦横同一重み記憶部204は、縮小重み計算部203からの重みの第1要素を記憶するメモリであり、入力された順番に対応つけて、入力された第1要素を記憶するものである。縮小重み計算部203は、出力画像の画素p(0,0)からp(0,m−1)またはp(0,n−1)に向かって、順次、第1要素を算出するので、縮小重み計算部203から縦横同一重み記憶部204への第1要素の入力順は、入力画像上の参照点の順番(位置)に対応することとなる。故に、縦横同一重み記憶部204においては、第1要素は、入力画像上の参照点の順番に対応して記憶されることとなる。縮小重み計算部203に記憶された第1要素は、データ縮小部205の要求に応答して、データ縮小部205に出力される。   The vertical / horizontal equal weight storage unit 204 is a memory that stores the first element of the weight from the reduction weight calculation unit 203, and stores the input first element in association with the input order. The reduction weight calculation unit 203 sequentially calculates the first element from the pixel p (0,0) of the output image toward p (0, m-1) or p (0, n-1). The input order of the first element from the weight calculation unit 203 to the vertical and horizontal same weight storage unit 204 corresponds to the order (position) of the reference points on the input image. Therefore, in the same vertical and horizontal weight storage unit 204, the first element is stored corresponding to the order of the reference points on the input image. The first element stored in the reduction weight calculation unit 203 is output to the data reduction unit 205 in response to a request from the data reduction unit 205.

データ縮小部205は、データ入力部201から入力される入力画像データと、縮小重み計算部203から入力される入力画像長辺の画素数と出力画像長辺の画素数との比と、縦横同一重み記憶部204に記憶される第1要素とから、出力画像の各画素(入力画像上の各参照点)の画素値を、バイ・リニア法の補間演算によって算出するものである。ここで、補間演算に用いられる周辺画素の抽出は、第1実施形態と同様に実行される。また、第1実施形態と同様に、参照点の画素値生成の補間演算に用いられる第1要素には、その参照点のX軸方向の順番に対応して縦横同一重み記憶部204に記憶されるものが用いられ、第2要素には、その参照点のY軸方向の順番と同じ順番で縦横同一重み記憶部204に記憶される第1要素が用いられる。これにより、入力画像に対し縮小処理が実行され、入力画像が縮小された出力画像データが生成される。生成された出力画像データは、データ出力部206を介して、画像縮小回路200から出力される。   The data reduction unit 205 has the same aspect ratio as the ratio between the input image data input from the data input unit 201 and the number of pixels of the input image long side and the output image long side input from the reduction weight calculation unit 203. From the first element stored in the weight storage unit 204, the pixel value of each pixel of the output image (each reference point on the input image) is calculated by bilinear interpolation. Here, the extraction of the peripheral pixels used for the interpolation calculation is executed in the same manner as in the first embodiment. Similarly to the first embodiment, the first element used for the interpolation calculation for generating the pixel value of the reference point is stored in the same vertical and horizontal weight storage unit 204 corresponding to the order of the reference point in the X-axis direction. As the second element, the first element stored in the same vertical and horizontal weight storage unit 204 in the same order as the order of the reference points in the Y-axis direction is used. As a result, a reduction process is performed on the input image, and output image data in which the input image is reduced is generated. The generated output image data is output from the image reduction circuit 200 via the data output unit 206.

このように、第2実施形態における画像縮小回路200によれば、入力画像データの縮小をハード回路によって実現することができる。このため、CPUによって同様の縮小処理を実行するよりも高速に処理を実行することができる。   Thus, according to the image reduction circuit 200 in the second embodiment, the reduction of the input image data can be realized by the hardware circuit. For this reason, the processing can be executed at a higher speed than the similar reduction processing is executed by the CPU.

以上上記各実施形態に基づき本発明を説明したが、本発明は上記各実施形態に何ら限定されるものでなく、本発明の趣旨を逸脱しない範囲内で種々の改良変形が可能であることは容易に推察できるものである。   Although the present invention has been described based on the above embodiments, the present invention is not limited to the above embodiments, and various improvements and modifications can be made without departing from the spirit of the present invention. It can be easily guessed.

例えば、上記各実施形態では、画像縮小プログラム12aまたは画像縮小回路200は、いずれもプリンタ1に搭載された。これに代えて、画像縮小プログラム12aまたは画像縮小回路200をPC2に搭載し、プリンタ1ではなく、PC2において縮小された画像データを生成するようにしてもよい。   For example, in each of the above embodiments, the image reduction program 12a or the image reduction circuit 200 is mounted on the printer 1. Alternatively, the image reduction program 12a or the image reduction circuit 200 may be mounted on the PC 2 to generate reduced image data on the PC 2 instead of the printer 1.

また、上記実施形態における画像縮小プログラム12aは、画像処理プログラムの1実施形態として、入力画像上の参照点の間隔をX軸方向とY軸方向とで等しくすると共に、重みの第1要素を重みの第2要素としても用いて縮小画像を生成するものとした。同様に、画像縮小回路200は、出力画像として、縮小画像を形成するものとして構成された。しかし、本発明は、縮小画像の生成に限って適用されるものではなく、例えば、入力画像を拡大した拡大画像を生成する場合に適用しても良い。具体的には、拡大画像である出力画像の各画素に対応する入力画像上の参照点の間隔を、X軸方向及びY軸方向の両方で同じ間隔とするとともに、その間隔を拡大倍率の逆数にて規定する構成とする。これにより、X座標0からa番目に位置する参照点とY座標0からa番目に位置する参照点との距離を等しくして、各参照点にて形成される格子を正方形とすることができる。故に、縮小画像を形成した場合と同様に、第1要素を第2要素として用いることができる。   In addition, the image reduction program 12a in the above embodiment, as one embodiment of the image processing program, makes the interval between reference points on the input image equal in the X-axis direction and the Y-axis direction, and weights the first element of the weight. The reduced image is generated also as the second element. Similarly, the image reduction circuit 200 is configured to form a reduced image as an output image. However, the present invention is not limited to the generation of a reduced image, and may be applied, for example, to generate an enlarged image obtained by enlarging an input image. Specifically, the interval between reference points on the input image corresponding to each pixel of the output image, which is an enlarged image, is the same interval in both the X-axis direction and the Y-axis direction, and the interval is the reciprocal of the enlargement magnification. The configuration specified in. Thus, the distance between the reference point located at the a th position from the X coordinate 0 and the reference point located at the a th position from the Y coordinate 0 can be made equal, and the grid formed by each reference point can be made square. . Therefore, the first element can be used as the second element as in the case where the reduced image is formed.

加えて、上記各実施形態では、縮小画像を形成する補間演算のアルゴリズムには、バイ・リニア法を用いたが、これに代えて、補間演算にて画素値を生成する他のアルゴリズム、例えば、バイ・キュービック法のアルゴズムを用いても良い。   In addition, in each of the above embodiments, the bi-linear method is used for the algorithm of the interpolation calculation that forms the reduced image, but instead, other algorithms that generate pixel values by the interpolation calculation, for example, A bicubic algorithm may be used.

本発明の1実施形態の画像処理プログラムを搭載したプリンタの電気的構成を示すブロック図である。1 is a block diagram showing an electrical configuration of a printer equipped with an image processing program according to an embodiment of the present invention. 画像縮小プログラムにて実行される出力画像生成の概要を模式的に示した図である。It is the figure which showed typically the outline | summary of the output image generation performed with an image reduction program. 画像縮小プログラムに基づいてCPUにより実行される縮小処理のフローチャートである。It is a flowchart of the reduction process performed by CPU based on an image reduction program. 第2実施形態におけるプリンタ内部に搭載された画像縮小回路の構成を示すブロック図である。It is a block diagram which shows the structure of the image reduction circuit mounted in the printer in 2nd Embodiment. 従来の縮小画像生成の概要を模式的に示した図である。It is the figure which showed typically the outline | summary of the conventional reduced image production | generation.

符号の説明Explanation of symbols

1 プリンタ(画像処理装置)
12a 画像処理プログラム
13f 縮小重みメモリ(第1要素記憶手段、重み付け手段)
17 インターフェース(データ取得手段)
18 インターフェース(データ取得手段)
19 外部メディアスロット(データ取得手段)
200 画像縮小回路(画像処理装置)
201 データ入力部(データ取得手段)
202 画像長辺算出部(短辺画素数算出手段、整数化手段、画像データ生成手段)
203 縮小重み計算部(重み付け手段、第1要素算出手段)
204 縦横同一重み記憶部(第1要素記憶手段、重み付け手段)
205 データ縮小部(重み付け手段、画像データ生成手段、参照点設定手段、画素値抽出手段、重み算出手段)
S3 短辺画素数算出ステップ、短辺画素数算出手段、整数化ステップ、整数化手段
S9 参照点設定ステップ、参照点設定手段
S3,S9,S14,S17 画像データ生成ステップ、画像データ生成手段
S11,S12,S15〜S17 重み付けステップ、重み付け手段
S14 画素値抽出ステップ、画素値抽出手段
S11 第1要素算出ステップ、第1要素算出手段
S12 第1要素記憶ステップ
S17 重み算出ステップ、重み算出手段
1 Printer (image processing device)
12a Image processing program 13f Reduction weight memory (first element storage means, weighting means)
17 Interface (data acquisition means)
18 Interface (data acquisition means)
19 External media slot (data acquisition means)
200 Image reduction circuit (image processing device)
201 Data input unit (data acquisition means)
202 Image long side calculation unit (short side pixel number calculation means, integerization means, image data generation means)
203 Reduction weight calculation unit (weighting means, first element calculation means)
204 Vertical and horizontal same weight storage section (first element storage means, weighting means)
205 Data reduction unit (weighting means, image data generation means, reference point setting means, pixel value extraction means, weight calculation means)
S3 Short side pixel number calculating step, short side pixel number calculating means, integerizing step, integerizing means S9 reference point setting step, reference point setting means S3, S9, S14, S17 Image data generating step, image data generating means S11, S12, S15 to S17 Weighting step, weighting means S14 Pixel value extraction step, pixel value extraction means S11 First element calculation step, first element calculation means S12 First element storage step S17 Weight calculation step, weight calculation means

Claims (12)

画像の一辺とその一辺に交差する他辺とが異なる画素数で構成された元画像の画像データを取得するデータ取得ステップと、元画像に対し倍率を変更した生成画像の各画素の画素値の生成に際し前記データ取得ステップにて取得した画像データの画素値の内、画素生成に関与する元画像の画素値に重み付けする重み付けステップと、その重み付けステップにて重み付けされた画素値に基づいて生成画像の各画素の画素値を生成する画像データ生成ステップとを備えた画像処理プログラムにおいて、
前記画像データ生成ステップは、生成画像の各画素に対応する元画像上の各参照点を、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、前記一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定する参照点設定ステップと、その参照点設定ステップにて設定された参照点周辺の周辺画素の画素値を抽出する画素値抽出ステップとを有し、その画素値抽出ステップにて抽出された画素値の補間演算にて生成画像の画素値を生成するものであり、
前記重み付けステップは、前記参照点設定ステップにより設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、周辺画素の画素値に対する重みの第1要素を算出する第1要素算出ステップと、その第1要素算出ステップにより算出された前記第1要素を、前記参照点の一辺方向における位置を示す位置情報に対応して記憶する第1要素記憶ステップと、
前記参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素として、前記第1要素記憶ステップにて記憶された第1要素の内、前記参照点の他辺方向における位置を示す位置情報によって抽出されるものを用い、その抽出された第2要素と、前記第1要素記憶ステップにて記憶された第1要素の内の前記参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて重みを算出する重み算出ステップとを備えていることを特徴とする画像処理プログラム。
A data acquisition step for acquiring image data of an original image having a different number of pixels from one side of the image and the other side intersecting the one side, and a pixel value of each pixel of the generated image whose magnification is changed with respect to the original image Of the pixel values of the image data acquired in the data acquisition step at the time of generation, a weighting step for weighting the pixel values of the original image involved in pixel generation, and the generated image based on the pixel values weighted in the weighting step In an image processing program comprising an image data generation step for generating a pixel value of each pixel of
In the image data generation step, each reference point on the original image corresponding to each pixel of the generated image is set to an interval set based on the magnification of the generated image in the direction along one side of the original image, and the one side In a direction along the other side that intersects the reference point, a reference point setting step that is set to a position that is the same as the reference point interval along the one side, and a periphery around the reference point set in the reference point setting step A pixel value extracting step for extracting a pixel value of the pixel, and generating a pixel value of the generated image by an interpolation calculation of the pixel value extracted in the pixel value extracting step,
The weighting step includes weighting the pixel values of the peripheral pixels based on the distance between the reference point set by the reference point setting step and the peripheral pixels located in the direction along one side of the original image with respect to the reference point. A first element calculating step for calculating a first element of the first element, and storing the first element calculated by the first element calculating step in correspondence with position information indicating a position in one side direction of the reference point. An element storage step;
The first element stored in the first element storage step as the second element of the weight based on the distance between the reference point and a peripheral pixel located in the direction along the other side of the original image with respect to the reference point Among these, the one extracted from the position information indicating the position in the other side direction of the reference point is used, and the extracted second element and the first element stored in the first element storage step An image processing program comprising: a weight calculation step of calculating a weight using a first element extracted by position information indicating a position in one side direction of the reference point.
前記画像データ生成ステップは、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値を生成するものであり、
前記第1要素算出ステップは、前記画素列の第1行目の画素値が前記画像データ生成ステップにて生成される際に第1要素を算出すると共に、その算出された第1要素を前記第1要素記憶ステップにて記憶するものであり、
前記重み算出ステップは、前記画像データ生成ステップにて第1行目以外の異なる画素列の画素値を生成する場合には、前記第1要素記憶ステップにて記憶された第1要素を用いて重みを算出するものであることを特徴とする請求項1記載の画像処理プログラム。
The image data generation step generates a pixel value of each pixel for each pixel column arranged in a row along one side direction of the generated image,
The first element calculation step calculates the first element when the pixel value of the first row of the pixel column is generated in the image data generation step, and the calculated first element is the first element. It is memorized in one element memory step,
The weight calculation step uses the first element stored in the first element storage step when the pixel value of a different pixel column other than the first row is generated in the image data generation step. The image processing program according to claim 1, wherein:
前記画像データ生成ステップ及び前記重み付けステップは、元画像の長辺を前記一辺として処理を行うものであり、
前記参照点設定ステップは、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから前記倍率を算出する長辺基準倍率算出ステップを有し、その長辺基準倍率算出ステップにて算出される倍率に基づいた間隔で参照点を設定するものであることを特徴とする請求項1又は2に記載の画像処理プログラム。
The image data generation step and the weighting step perform processing with the long side of the original image as the one side,
The reference point setting step includes a long side reference magnification calculating step for calculating the magnification from the number of pixels indicating the length of the long side of the original image and the number of pixels indicating the length of the corresponding long side of the generated image. 3. The image processing program according to claim 1, wherein the reference points are set at intervals based on the magnification calculated in the long side reference magnification calculation step.
生成画像の長辺方向に配置する画素数は整数値とされており、
前記画像データ生成ステップは、元画像の短辺の長さを示す画素数に対し、前記長辺基準倍率算出ステップにて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数を算出する短辺画素数算出ステップと、その短辺画素数算出ステップにて算出された値において小数点以下の値を切り捨てて画素数を整数化する整数化ステップとを備え、生成画像の短辺方向に配置する画素数をその整数化ステップにて得られた画素数として、生成画像の各画素の画素値を生成するものであることを特徴とする請求項3記載の画像処理プログラム。
The number of pixels to be arranged in the long side direction of the generated image is an integer value,
The image data generating step is a pixel indicating the length of the short side in the generated image based on the magnification calculated in the long side reference magnification calculating step with respect to the number of pixels indicating the length of the short side of the original image. A short side pixel number calculating step for calculating the number, and an integer step for rounding down the values after the decimal point in the value calculated in the short side pixel number calculating step to make the number of pixels an integer. 4. The image processing program according to claim 3, wherein the pixel value of each pixel of the generated image is generated by using the number of pixels arranged in the side direction as the number of pixels obtained in the integer step.
前記画像データ取得ステップは、元画像の画像データの各画素値をラスタ形式で取得するものであり、
前記参照点設定ステップは、前記元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するものであり、
前記第1要素算出ステップは、短辺方向に設定された参照点のそれぞれに対応する第1要素を算出するものであり、
前記画像データ生成ステップは、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値を生成するものであることを特徴とする請求項1から4のいずれかに記載の画像処理プログラム。
The image data acquisition step acquires each pixel value of the image data of the original image in a raster format,
In the reference point setting step, when the short side of the original image is a side along the main scanning direction of raster scanning with respect to the image, at least the first row of pixels in the short side direction in the generated image is virtually long. Increase until the number of generated pixels in the side direction, and set the reference point corresponding to each pixel,
The first element calculating step calculates a first element corresponding to each of the reference points set in the short side direction,
5. The image data generation step sequentially generates a pixel value of each pixel for each pixel column arranged in a row along the short side direction of the generated image. 5. An image processing program according to any one of the above.
前記画像データ生成ステップは、縮小画像の画素値を生成するものであることを特徴とする請求項1から5のいずれかに記載の画像処理プログラム。   The image processing program according to claim 1, wherein the image data generation step generates a pixel value of a reduced image. 画像の一辺とその一辺に交差する他辺とが異なる画素数で構成された元画像の画像データを取得するデータ取得手段と、元画像に対し倍率を変更した生成画像の各画素の画素値の生成に際し前記データ取得手段にて取得した画像データの画素値の内、画素生成に関与する元画像の画素値に重み付けする重み付け手段と、その重み付け手段にて重み付けされた画素値に基づいて生成画像の各画素の画素値を生成する画像データ生成手段とを備えた画像処理装置において、
前記画像データ生成手段は、生成画像の各画素に対応する元画像上の各参照点を、元画像の一辺に沿った方向においては、生成画像の倍率に基づいて設定される間隔とし、前記一辺に交差する他辺に沿った方向においては、前記一辺に沿った参照点間隔と同じ間隔とする位置に設定する参照点設定手段と、その参照点設定手段にて設定された参照点周辺の周辺画素の画素値を抽出する画素値抽出手段とを有し、その画素値抽出手段にて抽出された画素値の補間演算にて生成画像の画素値を生成するものであり、
前記重み付け手段は、前記参照点設定手段により設定される参照点と、その参照点に対し元画像の一辺に沿った方向に位置する周辺画素との距離に基づいて、周辺画素の画素値に対する重みの第1要素を算出する第1要素算出手段と、その第1要素算出手段により算出された前記第1要素を、前記参照点の一辺方向における位置を示す位置情報に対応して記憶する第1要素記憶手段と、
前記参照点とその参照点に対し元画像の他辺に沿った方向に位置する周辺画素との距離に基づいた重みの第2要素として、前記第1要素記憶手段に記憶された第1要素の内、前記参照点の他辺方向における位置を示す位置情報によって抽出されるものを用い、その抽出された第2要素と、前記第1要素記憶手段に記憶された第1要素の内の前記参照点の一辺方向における位置を示す位置情報によって抽出される第1要素とを用いて重みを算出する重み算出手段とを備えていることを特徴とする画像処理装置。
Data acquisition means for acquiring image data of an original image composed of a different number of pixels on one side of the image and the other side intersecting the one side, and a pixel value of each pixel of the generated image whose magnification is changed with respect to the original image Of the pixel values of the image data acquired by the data acquisition means at the time of generation, weighting means for weighting the pixel values of the original image involved in pixel generation, and the generated image based on the pixel values weighted by the weighting means In an image processing apparatus comprising image data generating means for generating a pixel value of each pixel of
The image data generation means sets each reference point on the original image corresponding to each pixel of the generated image as an interval set based on the magnification of the generated image in the direction along one side of the original image, and the one side In a direction along the other side intersecting with the reference point, the reference point setting means for setting the same position as the reference point interval along the one side, and the periphery of the reference point set by the reference point setting means A pixel value extracting unit that extracts a pixel value of a pixel, and generates a pixel value of a generated image by an interpolation calculation of the pixel value extracted by the pixel value extracting unit;
The weighting means weights the pixel values of the surrounding pixels based on the distance between the reference point set by the reference point setting means and the surrounding pixels located in a direction along one side of the original image with respect to the reference point. A first element calculating means for calculating a first element of the first and a first element calculated by the first element calculating means in correspondence with position information indicating a position in one side direction of the reference point. Element storage means;
As a second element of the weight based on the distance between the reference point and a peripheral pixel located in the direction along the other side of the original image with respect to the reference point, the first element stored in the first element storage means Of these, the reference extracted from the position information indicating the position of the reference point in the other side direction, the extracted second element, and the reference of the first element stored in the first element storage means An image processing apparatus, comprising: a weight calculating unit that calculates a weight using a first element extracted by position information indicating a position in one side direction of a point.
前記画像データ生成手段は、生成画像の一辺方向に沿って列状に配置される画素列毎に各画素の画素値を生成するものであり、
前記第1要素算出手段は、前記画素列の第1行目の画素値が前記画像データ生成手段にて生成される際に第1要素を算出すると共に、その算出された第1要素を前記第1要素記憶手段に記憶するものであり、
前記重み算出手段は、前記画像データ生成手段にて第1行目以外の異なる画素列の画素値を生成する場合には、前記第1要素記憶手段に記憶された第1要素を用いて重みを算出するものであることを特徴とする請求項7記載の画像処理装置。
The image data generation means generates a pixel value of each pixel for each pixel column arranged in a row along one side direction of the generated image,
The first element calculation means calculates the first element when the pixel value of the first row of the pixel column is generated by the image data generation means, and the calculated first element is the first element. Is stored in one-element storage means,
When the image data generation unit generates pixel values of different pixel columns other than the first row, the weight calculation unit calculates a weight using the first element stored in the first element storage unit. The image processing apparatus according to claim 7, wherein the image processing apparatus calculates.
前記画像データ生成手段及び前記重み付け手段は、元画像の長辺を前記一辺として処理を行うものであり、
前記参照点設定手段は、元画像の長辺の長さを示す画素数と、生成画像の対応する長辺の長さを示す画素数とから前記倍率を算出する長辺基準倍率算出手段を有し、その長辺基準倍率算出手段にて算出される倍率に基づいた間隔で参照点を設定するものであることを特徴とする請求項7又は8に記載の画像処理装置。
The image data generation means and the weighting means perform processing with the long side of the original image as the one side,
The reference point setting means includes a long side reference magnification calculating means for calculating the magnification from the number of pixels indicating the length of the long side of the original image and the number of pixels indicating the length of the corresponding long side of the generated image. 9. The image processing apparatus according to claim 7, wherein reference points are set at intervals based on the magnification calculated by the long side reference magnification calculating means.
生成画像の長辺方向に配置する画素数は整数値とされており、
前記画像データ生成手段は、元画像の短辺の長さを示す画素数に対し、前記長辺基準倍率算出手段にて算出された倍率に基づいて、生成画像における短辺の長さを示す画素数を算出する短辺画素数算出手段と、その短辺画素数算出手段にて算出された値において小数点以下の値を切り捨てて画素数を整数化する整数化手段とを備え、生成画像の短辺方向に配置する画素数をその整数化手段にて得られた画素数として、生成画像の各画素の画素値を生成するものであることを特徴とする請求項9記載の画像処理装置。
The number of pixels to be arranged in the long side direction of the generated image is an integer value,
The image data generation means is a pixel indicating the length of the short side in the generated image based on the magnification calculated by the long side reference magnification calculation means with respect to the number of pixels indicating the length of the short side of the original image. A short side pixel number calculating means for calculating the number, and an integerizing means for rounding down the values after the decimal point in the value calculated by the short side pixel number calculating means to make the number of pixels an integer, The image processing apparatus according to claim 9, wherein the pixel value of each pixel of the generated image is generated using the number of pixels arranged in the side direction as the number of pixels obtained by the integer conversion unit.
前記画像データ取得手段は、元画像の画像データの各画素値をラスタ形式で取得するものであり、
前記参照点設定手段は、前記元画像の短辺が画像に対するラスタ走査の主走査方向に沿った辺である場合には、少なくとも生成画像における短辺方向第1行目の画素を仮想的に長辺方向の生成画素数となるまで増やして、各画素に対応する参照点を設定するものであり、
前記第1要素算出手段は、短辺方向に設定された参照点のそれぞれに対応する第1要素を算出するものであり、
前記画像データ生成手段は、生成画像の短辺方向に沿って列状に配置される画素列毎に、順次、各画素の画素値を生成するものであることを特徴とする請求項7から10のいずれかに記載の画像処理装置。
The image data acquisition means acquires each pixel value of the image data of the original image in a raster format,
When the short side of the original image is a side along the main scanning direction of raster scanning with respect to the image, the reference point setting means virtually sets at least the first row of pixels in the short side direction of the generated image to be long. Increase until the number of generated pixels in the side direction, and set the reference point corresponding to each pixel,
The first element calculation means calculates a first element corresponding to each of the reference points set in the short side direction,
11. The image data generation unit is configured to sequentially generate a pixel value of each pixel for each pixel column arranged in a row along the short side direction of the generated image. An image processing apparatus according to any one of the above.
前記画像データ生成手段は、縮小画像の画素値を生成するものであることを特徴とする請求項7から11のいずれかに記載の画像処理装置。   The image processing apparatus according to claim 7, wherein the image data generation unit generates a pixel value of a reduced image.
JP2006236965A 2006-08-31 2006-08-31 Image processing program and image processing apparatus Expired - Fee Related JP4840033B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006236965A JP4840033B2 (en) 2006-08-31 2006-08-31 Image processing program and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006236965A JP4840033B2 (en) 2006-08-31 2006-08-31 Image processing program and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2008061036A true JP2008061036A (en) 2008-03-13
JP4840033B2 JP4840033B2 (en) 2011-12-21

Family

ID=39243266

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006236965A Expired - Fee Related JP4840033B2 (en) 2006-08-31 2006-08-31 Image processing program and image processing apparatus

Country Status (1)

Country Link
JP (1) JP4840033B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10134176A (en) * 1996-10-29 1998-05-22 Sony Corp Method and device for image signal processing
JP2002344733A (en) * 2001-05-21 2002-11-29 Canon Inc Image processing unit and processing method therefor
JP2006074222A (en) * 2004-08-31 2006-03-16 Olympus Corp Image resolution conversion apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10134176A (en) * 1996-10-29 1998-05-22 Sony Corp Method and device for image signal processing
JP2002344733A (en) * 2001-05-21 2002-11-29 Canon Inc Image processing unit and processing method therefor
JP2006074222A (en) * 2004-08-31 2006-03-16 Olympus Corp Image resolution conversion apparatus

Also Published As

Publication number Publication date
JP4840033B2 (en) 2011-12-21

Similar Documents

Publication Publication Date Title
JP5106735B2 (en) Shape processor
JP6029344B2 (en) Image processing apparatus, image processing method, and program
JP2010021730A (en) Image processing apparatus, image processing method, and program
US8169656B2 (en) Image processing devices and methods for resizing an original image therefor
US8780127B2 (en) Image forming apparatus, method for controlling same, and storage medium
JP2017200042A (en) Image forming device
US9600747B2 (en) Image forming apparatus and control method that execute a plurality of rendering processing units in parallel
CN102436357B (en) Image processing apparatus and image processing method
JP4966260B2 (en) Image processing method, image processing apparatus, program, and computer-readable storage medium
JP4840033B2 (en) Image processing program and image processing apparatus
JP6904717B2 (en) Image processing equipment, its control method, and programs
JP3912971B2 (en) Image processing apparatus and method
JP4325812B2 (en) Vector image drawing circuit and vector image drawing method
JPH05207266A (en) Picture edit processing unit
JP4710508B2 (en) Image processing program and image processing apparatus
JP6238589B2 (en) Image forming apparatus, image processing method, and program
JPH0652304A (en) Device and method for processing image
JP6157234B2 (en) Image processing apparatus, image processing method, and program
JP4125245B2 (en) Document display method and document display apparatus
JP3211591B2 (en) Image processing device
JP5414384B2 (en) Image processing apparatus, image processing method, and program
JP4316476B2 (en) Image processing apparatus and image forming apparatus
JP3517982B2 (en) Drawing device
JP4423812B2 (en) Drawing processing apparatus and drawing processing method
JP3294249B2 (en) Image processing device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090330

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110114

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110222

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110422

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: 20110906

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110919

R150 Certificate of patent or registration of utility model

Ref document number: 4840033

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20141014

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees