JP2553726B2 - Method and apparatus for rotating image by 90 degrees - Google Patents

Method and apparatus for rotating image by 90 degrees

Info

Publication number
JP2553726B2
JP2553726B2 JP2013165A JP1316590A JP2553726B2 JP 2553726 B2 JP2553726 B2 JP 2553726B2 JP 2013165 A JP2013165 A JP 2013165A JP 1316590 A JP1316590 A JP 1316590A JP 2553726 B2 JP2553726 B2 JP 2553726B2
Authority
JP
Japan
Prior art keywords
row
image data
image
rows
bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2013165A
Other languages
Japanese (ja)
Other versions
JPH03216772A (en
Inventor
豊 尾崎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic System Solutions Japan Co Ltd
Original Assignee
Matsushita Graphic Communication Systems Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Graphic Communication Systems Inc filed Critical Matsushita Graphic Communication Systems Inc
Priority to JP2013165A priority Critical patent/JP2553726B2/en
Publication of JPH03216772A publication Critical patent/JPH03216772A/en
Priority to US08/227,088 priority patent/US5412768A/en
Application granted granted Critical
Publication of JP2553726B2 publication Critical patent/JP2553726B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/60Rotation of a whole image or part thereof

Description

【発明の詳細な説明】 産業上の利用分野 本発明は文字や図形などの画像データを90度回転させ
る画像回転方法及び装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image rotation method and apparatus for rotating image data such as characters and figures by 90 degrees.

従来の技術 画像データをN行×N列の行列で表し、これを90度回
転する従来から行われている方法を第3図を用いて説明
する。
2. Description of the Related Art A conventional method of representing image data by a matrix of N rows by N columns and rotating this by 90 degrees will be described with reference to FIG.

第3図は4行×4列の行列を90度時計回りに回転する
手順を表す。(a)図は元の画像でソース画像という。
90度回転する方法は、ソース画像の行と列を互いに交換
した転置行列をフェーズ16(ph16)までのステップで作
り、フェーズ17で各行のビットの並びを行の中心を対称
軸として各ビットの対称位置に入れ替えたものである。
フェーズ17を目的画像又はディストネーション画像とい
う。通常の構成のメモリの場合、一度に読み出せるのは
ワード(行)単位である。しかし、1ワード目のビット
を各行にそれぞれ移動しなければならないため、フェー
ズ1(ph1)ではまず0を1行の第1列目に移し、フェ
ーズ2で1を2行の第1列に移し、フェーズ3で2を3
行の第1列にフェーズ4で3を4行の第1列に移す。以
下2ワード〜4ワード目を同様のステップで移してゆく
ため、4ワード移すのに16フェーズ必要となる。
FIG. 3 shows the procedure for rotating a 4-row by 4-column matrix 90 degrees clockwise. The figure (a) is an original image and is called a source image.
The method of 90 degree rotation is to create a transposed matrix in which the rows and columns of the source image are exchanged with each other in steps up to phase 16 (ph16), and in phase 17, arrange the bits in each row with the center of the row as the axis of symmetry. It has been replaced with a symmetrical position.
Phase 17 is called the target image or destination image. In the case of a memory having a normal configuration, it is possible to read at a time in units of words (rows). However, since the bit of the first word has to be moved to each row, in phase 1 (ph1), 0 is moved to the first column of the first row, and in phase 2, 1 is moved to the first column of the second row. , Phase 2 to 3
In phase 4, move row 3 to column 1, column 4 in row 1, column 1. Since the second to fourth words are transferred in the same steps, 16 phases are required to transfer 4 words.

発明が解決しようとする課題 しかし、かかる方法によればディストネーション画像
のそれぞれのビット位置にビット単位で順次書き込む必
要がある。例えば、第3図の場合、ソース画像の1ワー
ドの1を書き込むため、フェーズ17の2ワード目を読み
出し、フェーズ17の1のある4列目に1を書き込むこと
になる。このため、処理時間が長くなるという問題があ
った。ところで、メモリ構成を特別なものとすればもっ
と短時間の処理が可能となる。第4図は、ワード(行)
単位および列単位に読み出しのできる特別構造のメモリ
を使用した場合の画像90度時計回り回転方法を示す。
(a)図はソース画像でフェーズ5がディストネーショ
ン画像である。1列の048Cを1度のアクセスで読み込
み、フェーズ1に示すように1ワード目に書き込む。こ
のようにすると4回のアクセスでフェーズ4に示すよう
に転置行列とすることができ、フェーズ5で各行の中心
を対称軸として各ビットの交換を行い90度回転画像を得
ることができる。このように一度で縦方向(列方向)の
目的ビット位置を読み出すか、もしくは書き込みができ
る特別構造のメモリを使用すれば高速化が可能となる。
しかし、この様な特別構造のメモリを構成することによ
り回路量が大きくなるという問題が発生する。特開昭62
−111364号公報には、このような特別構造のメモリを使
用した画像データ回転装置が示されている。
However, according to such a method, it is necessary to sequentially write each bit position of the destination image bit by bit. For example, in the case of FIG. 3, since 1 of 1 word of the source image is written, the 2nd word of phase 17 is read and 1 is written in the 4th column in which 1 of phase 17 is present. Therefore, there is a problem that the processing time becomes long. By the way, if the memory configuration is special, the processing can be performed in a shorter time. Figure 4 shows words (rows)
The method of rotating an image 90 degrees clockwise is shown when a specially-structured memory that can be read in units and columns is used.
In the figure, (a) is a source image, and phase 5 is a destination image. One column of 048C is read by one access, and the first word is written as shown in Phase 1. By doing so, it is possible to form a transposed matrix as shown in phase 4 by four accesses, and in phase 5, it is possible to obtain a 90-degree rotated image by exchanging each bit with the center of each row as the axis of symmetry. In this way, the speed can be increased by using a memory having a special structure in which the target bit position in the vertical direction (column direction) can be read or written at once.
However, there is a problem in that the circuit amount becomes large by constructing the memory having such a special structure. JP 62
Japanese Patent Laid-Open No. 111364 discloses an image data rotating device using such a memory having a special structure.

本発明は行単位にのみ読み出し書き込みのできる通常
のメモリを使用して高速に90度画像回転を行うことので
きる画像回転方法及び装置を提供することを目的とす
る。
SUMMARY OF THE INVENTION It is an object of the present invention to provide an image rotation method and apparatus capable of performing 90-degree image rotation at high speed using a normal memory that can read and write only in units of rows.

課題を解決するための手段 上記目的を達成するため、元画像の大きさに応じて変
換モード数Mを算出し、この変換モード数に応じて、所
定の式から元画像を構成する行列より2つの行を選択
し、これを所定の式により変換したのち、元の行列に戻
し、このような操作を変換モード数繰り返すことにより
元の画像の行列の転置行列を得、90度時計回り回転する
ときは、転置行列の各行のビット並びを、行の中心を対
称軸として各ビットの対称位置に入れ替えを行うことに
より目的画像が得られ、90度反時計回りに回転するとき
は、転置行列の各行の並び順序を逆順の行の並びに変換
することにより目的画像を得るようにしたものであり、
本発明の画像90度時計回り回転方法は、N行×N列の画
像データを90度回転するに際し、変換モード数Mを、 M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、前記N行をO〜N−1と付番し、変換モ
ードL(=1〜M)ごとに、A番行とB番行を、 A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=O〜(N/2L)−1 によって求め、A番行とB番行の行ビット並びをA
(j),B(j)で表し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=O〜(N/2L)−1 によって求め、A(j)をA′(j)にB(j)をB′
(j)に変換し、Lを1からMまで変化させることによ
りN行×N列の変換画像データを求め、この変換画像デ
ータの各行のビット並びをE(j)とし、 F(j)=E(N−j−1),j=O〜N−1 によって各行のビット並びを変換することによりN行×
N列の画像データの90度時計回りの回転画像を得ること
を特徴とするものである。また、本発明の画像90度反時
計回り回転方法は、N行×N列の画像データを90度回転
するに際し、変換モード数Mを、 M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、前記N行をO〜N−1と付番し、変換モ
ードL(=1〜M)ごとに、A番行とB番行を、 A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=O〜(N/2L)−1 によって求め、A番行とB番行の行ビット並びをA
(j),B(j)で表し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=O〜(N/2L)−1 によって求め、A(j)をA′(j)にB(j)をB′
(j)に変換し、Lを1からMまで変化させることによ
りN行×N列の変換画像データを求め、この変換画像デ
ータのi行をE(i,j)で表し、E′(i,j)を E′(i,j)=E(N−i−1,j),i=0〜N−1 によって行の変換をすることによりN行×N列の画像デ
ータの90度反時計回りの画像を得ることを特徴とするも
のである。また、本発明の画像90度回転装置は、画像デ
ータを記憶する画像データ記憶手段と、N行×N列の画
像データの変換モード数Mを M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、変換モードL(=1〜M)を出力する変
換モード演算手段と、前記N行を0〜N−1と付番し、
前記変換モードLに応じて前記N行よりA番行とB番行
を A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=0〜(N/2L)−1 により演算し、このA番行とB番行の行ビット並びA
(j),B(j)を選択する行選択手段と、前記A
(j),B(j)を入力し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=0〜(N/2L)−1 によって演算し、前記画像データのA(j),B(j)を
それぞれA′(j),B′(j)に変換し、この操作を変
換モードLを1〜Mまで変えて行い、変換画像データを
作成する画像変換手段と、前記変換画像データの行ビッ
ト並びをE(j)とし、 F(j)=E(N−j−1),j=0〜N−1 によって各行のビット並びを変換する行ビット並び変換
手段と、前記変換画像データのi行をE(i,j)で表
し、E′(i,j)を E′(i,j)=E(N−j−1),i=0〜N−1 によって行の変換を行う行変換手段とを備えたことを特
徴とするものである。
Means for Solving the Problems In order to achieve the above object, the number M of conversion modes is calculated according to the size of the original image, and according to the number of conversion modes, a matrix that forms the original image is used according to a predetermined formula. Select one row, convert it by a predetermined formula, return it to the original matrix, repeat this operation for the number of conversion modes to obtain the transposed matrix of the original image matrix, and rotate 90 degrees clockwise. In this case, the bit image of each row of the transposed matrix is replaced by the symmetrical position of each bit with the center of the row as the axis of symmetry, and the target image is obtained.When rotated 90 degrees counterclockwise, the transposed matrix The target image is obtained by converting the arrangement order of each row into the row of the reverse order.
In the image 90 ° clockwise rotation method of the present invention, when rotating N rows × N columns of image data by 90 °, the number M of conversion modes is M = [log 2 N] (where [] is an integer whose internal value is an integer. Then the integer,
When the number including the decimal point or less is included, it is obtained by rounding up.), The N rows are numbered as O to N−1, and the A row and the B row are numbered for each conversion mode L (= 1 to M). , a = k * 2 L ~k * 2 L +2 L-1 -1 B = a + 2 L-1 k = O~ (N / 2 L) determined by -1, a number row and row bit sequence of B-number row A
(J), expressed in B (j), A '( j), B' (j) the A '(j) = A ( j) j = k * 2 L ~k * 2 L +2 L-1 -1 A '(j) = B ( j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L +2 L-1 to k * 2 L +2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L +2 L-1 -1 k = O to (N / 2 L ) −1, A (j) is A ′ (j) and B (j) is B ′.
Converted image data is converted into (j) and L is changed from 1 to M to obtain converted image data of N rows × N columns, the bit sequence of each row of this converted image data is E (j), and F (j) = E (N−j−1), j = O to N−1, by converting the bit sequence of each row, N rows ×
It is characterized in that a 90-degree clockwise rotation image of N columns of image data is obtained. Further, in the image 90-degree counterclockwise rotation method of the present invention, when rotating the image data of N rows × N columns by 90 degrees, the number of conversion modes M is M = [log 2 N] (where [] is the internal If the number is an integer,
When the number including the decimal point or less is included, it is obtained by rounding up.), The N rows are numbered as O to N−1, and the A row and the B row are numbered for each conversion mode L (= 1 to M). , a = k * 2 L ~k * 2 L +2 L-1 -1 B = a + 2 L-1 k = O~ (N / 2 L) determined by -1, a number row and row bit sequence of B-number row A
(J), expressed in B (j), A '( j), B' (j) the A '(j) = A ( j) j = k * 2 L ~k * 2 L +2 L-1 -1 A '(j) = B ( j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L +2 L-1 to k * 2 L +2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L +2 L-1 -1 k = O to (N / 2 L ) −1, A (j) is A ′ (j) and B (j) is B ′.
(J) and by changing L from 1 to M, converted image data of N rows × N columns is obtained, the i row of this converted image data is represented by E (i, j), and E ′ (i , j) is converted into a row by E ′ (i, j) = E (N−i−1, j), i = 0 to N−1, thereby reversing the image data of N rows × N columns by 90 degrees. The feature is that a clockwise image is obtained. Further, in the image 90-degree rotation device of the present invention, the image data storage means for storing the image data and the number M of conversion modes of the image data of N rows × N columns are M = [log 2 N] (where [] is an internal If the numerical value of is an integer,
Conversion mode calculation means for obtaining a conversion mode L (= 1 to M) by calculating by rounding up when there are numerical values below the decimal point and numbering the N rows as 0 to N-1;
Depending on the conversion mode L, the A-th row and the B-th row from the N-th row are A = k * 2 L to k * 2 L + 2 L-1 -1 B = A + 2 L-1 k = 0 to (N / 2 L ) -1 to calculate the row bit sequence A and B of row A
(J), B (j) for selecting a row, and A
(J), B (j) and A '(j), B' (j) are A '(j) = A (j) j = k * 2 L to k * 2 L +2 L-1 − 1 A '(j) = B (j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L + 2 L-1 to k * 2 L + 2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L + 2 L-1 -1 k = 0 to (N / 2 L ) -1 to convert A (j) and B (j) of the image data into A '(j) and B' (j), respectively. Image conversion means for generating converted image data and E (j) as the row bit sequence of the converted image data, and F (j) = E (N-j-1), j = 0 to N A row bit arrangement conversion means for converting the bit arrangement of each row by -1, and the i row of the converted image data is represented by E (i, j), and E '(i, j) is represented by E (I, j) = E (N-j-1), is characterized in that a line conversion means by i = 0 to N-1 for converting line.

作 用 上記構成により、変換モード演算手段は元画像を表す
N行×N列の行列の大きさに応じて決まる変換モード数
Mを演算し、変換モードL(=1〜M)を出力する。行
選択手段はこの変換モードLに応じて、行列N行のうち
からA番行とB番行を選択する。画像変換手段はこのA
番行とB番行を上述の式に従ってA′番行とB′番行に
変換し、A′番行をA番行のあった位置にB′番行をB
番行のあった位置に移し、新たな行列をつくる。このよ
うな操作を変換モードLを1からMまで繰り返し行うこ
とにより変換画像データを作成する。この変換画像デー
タが元画像を表す行列の転置行列である。行ビット並び
変換手段は、この変換画像データの各行ビット並びを変
換して、90度時計回り回転画像を作成し、行変換手段は
この変換画像データの各行の並び順を変換して90度反時
計回り回転画像を作成する。
Operation With the above configuration, the conversion mode calculation means calculates the number M of conversion modes determined according to the size of the matrix of N rows × N columns representing the original image, and outputs the conversion mode L (= 1 to M). The row selecting means selects the Ath row and the Bth row from the matrix N rows according to the conversion mode L. The image conversion means is this A
The No. and No. B lines are converted into No. A'line and No. B'line according to the above formula, and No. A'line is at the position of No. A line.
Move to the position where there was a turn and create a new line. Converted image data is created by repeating such an operation from conversion mode L to 1 to M. This converted image data is the transposed matrix of the matrix representing the original image. The row bit sequence conversion means converts each row bit sequence of this converted image data to create a 90-degree clockwise rotated image, and the row conversion means converts the sequence order of each row of this converted image data to 90 degree counterclockwise. Create a clockwise rotated image.

実施例 以下、本発明の一実施例を第1図,第2図を用いて説
明する。
Embodiment One embodiment of the present invention will be described below with reference to FIGS. 1 and 2.

第1図は本発明の画像90度回転装置を表すブロック図
である。1は全体を制御するCPU、2は主記憶である。
3は画像格納領域でキャッシュメモリを備えている。4,
5,6はNビット入力ラッチ回路で、Nビットからなる行
(又はワード)データを入力してラッチする。7は2Nビ
ットデータ変換回路でNビット入力ラッチ回路4,5に入
力したワードを変換して2つのワードとして出力する。
8,9はNビット出力ラッチ回路で2Nビットデータ変換回
路7より出力される2つのワードをそれぞれラッチす
る。10はラッチデータセレクト回路で、Nビット出力ラ
ッチ回路8,9のデータをCPU1から送られる出力データ選
択信号に応じて選択して出力する。11はNビット交換回
路でNビット入力ラッチ回路6より出力されるワードの
ビットの並びを交換し、時計回り回転データを出力す
る。12は行順変更回路でNビット入力ラッチ回路6より
出力される行(ワード)の順位を変更し、反時計回り回
転データを出力する。13はNビット出力ラッチ回路でN
ビット変換回路11,行順変換回路12の出力をラッチし、
画像格納領域3に出力する。
FIG. 1 is a block diagram showing an image 90-degree rotation device of the present invention. Reference numeral 1 is a CPU that controls the whole, and 2 is a main memory.
An image storage area 3 is provided with a cache memory. Four,
Reference numerals 5 and 6 are N-bit input latch circuits which input and latch row (or word) data consisting of N bits. A 2N-bit data conversion circuit 7 converts the word input to the N-bit input latch circuits 4 and 5 and outputs it as two words.
Reference numerals 8 and 9 denote N-bit output latch circuits which respectively latch the two words output from the 2N-bit data conversion circuit 7. A latch data select circuit 10 selects and outputs the data of the N-bit output latch circuits 8 and 9 according to an output data selection signal sent from the CPU 1. An N-bit exchange circuit 11 exchanges the bit arrangement of the word output from the N-bit input latch circuit 6 and outputs clockwise rotation data. A row order changing circuit 12 changes the order of rows (words) output from the N-bit input latch circuit 6 and outputs counterclockwise rotation data. 13 is an N-bit output latch circuit N
Latches the outputs of the bit conversion circuit 11 and the row order conversion circuit 12,
Output to the image storage area 3.

次に第1図、第2図を用いて動作を具体的に説明す
る。第2図はソース画像が4行×4列よりなる行列を90
度回転する手順を示したものである。まず変換モードの
説明をする。変換モード数Mは行列の大きさが2n×2n
表されるときはM=nとなる。第2図の場合、N=4で
ありN=2nからn=2となるのでモード数M=2であ
る。つまり2つの変換モードが存在する。
Next, the operation will be specifically described with reference to FIGS. 1 and 2. In Fig. 2, the source image has a matrix of 4 rows x 4 columns.
It shows a procedure of rotating the rotation once. First, the conversion mode will be described. The number M of conversion modes is M = n when the matrix size is represented by 2 n × 2 n . In the case of FIG. 2, since N = 4 and N = 2 n to n = 2, the number of modes M = 2. That is, there are two conversion modes.

この変換モードに対して2N(N=4)ビットデータ変
換回路7の動作を説明する。
The operation of the 2N (N = 4) bit data conversion circuit 7 in this conversion mode will be described.

2Nビットデータ変換回路7の動作は、変換モード選択
信号に対応して2N(N=4)ビットのデータ列に対して
以下の変換ルールとして表現出来る。
The operation of the 2N-bit data conversion circuit 7 can be expressed as the following conversion rule for a 2N (N = 4) -bit data string corresponding to the conversion mode selection signal.

Nビット入力ラッチ回路4のデータ線を(0、1、
2、3) Nビット入力ラッチ回路5のデータ線を(4、5、
6、7) と番号を付けると 変換モード1 変換モード2 入力 出力 入力 出力 0 → 0 0 → 0 1 → 4 1 → 1 2 → 2 2 → 4 3 → 6 3 → 5 4 → 1 4 → 2 5 → 5 5 → 3 6 → 3 6 → 6 7 → 7 7 → 7 互換表現では 変換モード1(1、4)(3、6) 変換モード2(2、4)(3、5)となる。
The data lines of the N-bit input latch circuit 4 are set to (0, 1,
2, 3) The data lines of the N-bit input latch circuit 5 are (4, 5,
6, 7) are numbered Conversion mode 1 Conversion mode 2 Input output Input output 0 → 0 0 → 0 1 → 4 1 → 1 2 → 2 2 → 4 3 → 6 3 → 5 4 → 1 4 → 2 5 → 5 5 → 3 6 → 3 6 → 6 7 → 7 7 → 7 In the compatible expression, conversion mode 1 (1, 4) (3, 6) is conversion mode 2 (2, 4) (3, 5).

次に全体の動作について説明する。 Next, the overall operation will be described.

CPU1はまず、第1図の変換モード選択信号の変換モー
ド1を選択し、画像格納領域3から、第1ワード目
(0、1、2、3)を読み出しNビット入力ラッチ回路
4に転送する。次に第2ワード目(4、5、6、7)
を、Nビット入力ラッチ回路5に転送する。2Nビットデ
ータ変換回路7はNビット出力ラッチ回路8に(0、
4、2、6)を出力する。又Nビット出力ラッチ回路9
に(1、5、3、7)を出力する。CPU1は、Nビット出
力ラッチ回路8の内容(0、4、2、6)を、画像格納
領域3の第1ワード目に書き込む。又Nビット出力ラッ
チ回路9の内容(1、5、3、7)を画像格納領域3の
第2ワード目に書き込む。この状態がph1である。
The CPU 1 first selects the conversion mode 1 of the conversion mode selection signal shown in FIG. 1, reads the first word (0, 1, 2, 3) from the image storage area 3 and transfers it to the N-bit input latch circuit 4. . Second word (4, 5, 6, 7)
To the N-bit input latch circuit 5. The 2N-bit data conversion circuit 7 causes the N-bit output latch circuit 8 (0,
4, 2, 6) is output. N-bit output latch circuit 9
To (1, 5, 3, 7). The CPU 1 writes the contents (0, 4, 2, 6) of the N-bit output latch circuit 8 in the first word of the image storage area 3. The contents (1, 5, 3, 7) of the N-bit output latch circuit 9 are written in the second word of the image storage area 3. This state is ph1.

同様に、画像格納領域3から、第3ワード目(8、
9、A、B)を読み出しNビット入力ラッチ回路4に転
送する。次に第4ワード目(C、D、E、F)を、Nビ
ット入力ラッチ回路5に転送する。2Nビットデータ変換
回路7はNビット出力ラッチ回路8に(8、C、A、
E)を出力する。又Nビット出力ラッチ回路9に(9、
D、B、F)を出力する。CPU1は、Nビット出力ラッチ
回路8の内容(8、C、A、E)を、画像格納領域3の
第3ワード目に書き込む、又Nビット出力ラッチ回路9
の内容(9、D、B、F)を画像格納領域3の第4ワー
ド目に書き込む。この状態がph2である。
Similarly, from the image storage area 3, the third word (8,
9, A, B) are read and transferred to the N-bit input latch circuit 4. Next, the fourth word (C, D, E, F) is transferred to the N-bit input latch circuit 5. The 2N-bit data conversion circuit 7 includes an N-bit output latch circuit 8 (8, C, A,
E) is output. In addition, the N-bit output latch circuit 9 (9,
D, B, F) are output. The CPU 1 writes the contents (8, C, A, E) of the N-bit output latch circuit 8 into the third word of the image storage area 3, and the N-bit output latch circuit 9
(9, D, B, F) is written in the fourth word of the image storage area 3. This state is ph2.

CPU1は次に、第1図の変換モード選択信号の変換モー
ド2を選択し、画像格納領域3から、第1ワード目
(0、4、2、6)を読み出しNビット入力ラッチ回路
4に転送する。次に第3ワード目(8、C、A、E)
を、Nビット入力ラッチ回路5に転送する。2Nビットデ
ータ変換回路7はNビット出力ラッチ回路8に(0、
4、8、C)を出力する。又Nビット出力ラッチ回路9
に(2、6、A、E)を出力する。CPU1は、Nビット出
力ラッチ回路8の内容(0、4、8、C)を、画像格納
領域3の第1ワード目に書き込む。又Nビット出力ラッ
チ回路9の内容(2、6、A、E)を画像格納領域3の
第3ワード目に書き込む。この状態がph3である。
Next, the CPU 1 selects the conversion mode 2 of the conversion mode selection signal of FIG. 1, reads the first word (0, 4, 2, 6) from the image storage area 3 and transfers it to the N-bit input latch circuit 4. To do. Then the third word (8, C, A, E)
To the N-bit input latch circuit 5. The 2N-bit data conversion circuit 7 causes the N-bit output latch circuit 8 (0,
4, 8, C) are output. N-bit output latch circuit 9
To (2, 6, A, E). The CPU 1 writes the contents (0, 4, 8, C) of the N-bit output latch circuit 8 in the first word of the image storage area 3. The contents (2, 6, A, E) of the N-bit output latch circuit 9 are written in the third word of the image storage area 3. This state is ph3.

同様に、画像格納領域3から、第2ワード目(1、
5、3、7)を読み出しNビット入力ラッチ回路4に転
送する。次に第4ワード目(9、D、B、F)を、Nビ
ット入力ラッチ回路5に転送する。2Nビットデータ変換
回路7はNビット出力ラッチ回路8に(1、5、9、
D)を出力する。又Nビット出力ラッチ回路9に(3、
7、B、F)を出力する。CPU1は、Nビット出力ラッチ
回路8の内容(1、5、9、D)を、画像格納領域3の
第2ワード目に書き込む。又Nビット出力ラッチ回路9
の内容(3、7、B、F)を画像格納領域3の第4ワー
ド目に書き込む。この状態がph4で、このようにして得
られたph4の行列は、(a)に示すソース画像の行列の
転置行列となっている。この転置行列より時計回り、又
は反時計回りの回転画像が得られる。
Similarly, from the image storage area 3, the second word (1,
5, 3, 7) are read and transferred to the N-bit input latch circuit 4. Next, the fourth word (9, D, B, F) is transferred to the N-bit input latch circuit 5. The 2N-bit data conversion circuit 7 has the N-bit output latch circuit 8 (1, 5, 9,
D) is output. In addition, the N-bit output latch circuit 9 (3,
7, B, F) are output. The CPU 1 writes the contents (1, 5, 9, D) of the N-bit output latch circuit 8 in the second word of the image storage area 3. N-bit output latch circuit 9
(3, 7, B, F) is written in the fourth word of the image storage area 3. This state is ph4, and the matrix of ph4 thus obtained is the transposed matrix of the matrix of the source image shown in (a). From this transposed matrix, a clockwise or counterclockwise rotated image can be obtained.

まず、時計回り回転画像について説明する。 First, the clockwise rotated image will be described.

CPU1は次に、画像格納領域3から、第1ワード目
(0、4、8、C)を読み出し、Nビット入力ラッチ回
路6に転送する。Nビット交換回路11はNビット入力ラ
ッチ回路6のデータ(0、4、8、C)のLSB側とMSB側
の交換を行って(C、8、4、0)をNビット出力ラッ
チ回路13に転送する。CPU1は、Nビット出力ラッチ回路
13の内容(C、8、4、0)を、画像格納領域3の第1
ワード目に書き込む。
Next, the CPU 1 reads the first word (0, 4, 8, C) from the image storage area 3 and transfers it to the N-bit input latch circuit 6. The N-bit exchange circuit 11 exchanges the data (0, 4, 8, C) of the N-bit input latch circuit 6 with the LSB side and the MSB side to output (C, 8, 4, 0) as the N-bit output latch circuit 13. Transfer to. CPU1 is an N-bit output latch circuit
The contents of 13 (C, 8, 4, 0) are stored in the first area of the image storage area 3.
Write in the word.

同様に、画像格納領域3から、第2ワード目(1、
5、9、D)を読み出し、Nビット入力ラッチ回路6に
転送する。Nビット交換回路11はNビット入力ラッチ回
路6のデータ(1、5、9、D)のLSB側とMSB側の交換
を行って(D、9、5、1)をNビット出力ラッチ回路
13に転送する。CPU1は、Nビット出力ラッチ回路13の内
容(D、9、5、1)を、画像格納領域3の第2ワード
目に書き込む。
Similarly, from the image storage area 3, the second word (1,
5, 9, D) are read and transferred to the N-bit input latch circuit 6. The N-bit exchange circuit 11 exchanges the data (1, 5, 9, D) of the N-bit input latch circuit 6 with the LSB side and the MSB side to output (D, 9, 5, 1) as the N-bit output latch circuit.
Transfer to 13. The CPU 1 writes the contents (D, 9, 5, 1) of the N-bit output latch circuit 13 in the second word of the image storage area 3.

同様に、画像格納領域3から、第3ワード目(2、
6、A、E)を読み出し、Nビット入力ラッチ回路6に
転送する。Nビット交換回路11はNビット入力ラッチ回
路6のデータ(2、6、A、E)のLSB側とMSB側の交換
を行って(E、A、6、2)をNビット出力ラッチ回路
13に転送する。CPU1は、Nビット出力ラッチ回路13の内
容(E、A、6、2)を、画像格納領域3の第3ワード
目に書き込む。
Similarly, from the image storage area 3, the third word (2,
6, A, E) are read and transferred to the N-bit input latch circuit 6. The N-bit exchange circuit 11 exchanges the data (2, 6, A, E) of the N-bit input latch circuit 6 on the LSB side and the MSB side and outputs (E, A, 6, 2) to the N-bit output latch circuit.
Transfer to 13. The CPU 1 writes the contents (E, A, 6, 2) of the N-bit output latch circuit 13 in the third word of the image storage area 3.

同様に、画像格納領域3から、第4ワード目(3、
7、B、F)を読み出し、Nビット入力ラッチ回路6に
転送する。Nビット交換回路11はNビット入力ラッチ回
路6のデータ(3、7、B、F)のLSB側とMSB側の交換
を行って(F、B、7、3)をNビット出力ラッチ回路
13に転送する。CPU1はNビット出力ラッチ回路13の内容
(F、B、7、3)を、画像格納領域3の第4ワード目
に書き込む。この状態がph5である。
Similarly, from the image storage area 3, the fourth word (3,
7, B, F) are read and transferred to the N-bit input latch circuit 6. The N-bit exchange circuit 11 exchanges the data (3, 7, B, F) of the N-bit input latch circuit 6 on the LSB side and the MSB side and outputs (F, B, 7, 3) to the N-bit output latch circuit.
Transfer to 13. The CPU 1 writes the contents (F, B, 7, 3) of the N-bit output latch circuit 13 in the fourth word of the image storage area 3. This state is ph5.

以上の操作で、時計回り方向の90度回転が可能とな
る。
With the above operation, 90 ° clockwise rotation is possible.

次に反時計回り回転画像について説明する。 Next, the counterclockwise rotated image will be described.

CPU1は画像格納領域3から第1ワード目(0、4、
8、C)を読み出し、Nビット入力ラッチ回路6に転送
する。行順変換回路12はNビット入力ラッチ回路6のデ
ータ行順を第4ワード目とし、Nビット出力ラッチ回路
13を経由して画像格納領域3の第4ワード目に書き込
む。
The CPU 1 reads the first word (0, 4,
8, C) are read and transferred to the N-bit input latch circuit 6. The row order conversion circuit 12 sets the data row order of the N-bit input latch circuit 6 to the fourth word, and sets the N-bit output latch circuit.
The data is written in the fourth word of the image storage area 3 via 13.

次にCPU1は画像格納領域3から第2ワード目(1、
5、9、D)を読み出し、Nビット入力ラッチ回路6に
転送する。
Next, the CPU 1 reads the second word (1,
5, 9, D) are read and transferred to the N-bit input latch circuit 6.

行順変換回路12はNビット入力ラッチ回路6のデータ
行順を第3ワード目とし、Nビット出力ラッチ回路13を
経由して画像格納領域3の第3ワード目に書き込む。
The row order conversion circuit 12 sets the data row order of the N-bit input latch circuit 6 as the third word, and writes it in the third word of the image storage area 3 via the N-bit output latch circuit 13.

同様にして、第3ワード目(2、6、A、E)を第2
ワード目に、第4ワード目(3、7、B、F)を第1ワ
ード目に書き込むことによりph6の状態となる。
Similarly, the third word (2, 6, A, E) is changed to the second word.
By writing the fourth word (3, 7, B, F) to the first word, the state of ph6 is obtained.

以上の操作で反時計回り方向の90度回転が可能とな
る。
With the above operation, it is possible to rotate 90 degrees counterclockwise.

次にNビット*Nワード(N行XN列)のソース画像を
時計回り又は反時計回りに90度回転する動作について説
明する。
Next, the operation of rotating the N-bit * N-word (N rows × N columns) source image 90 degrees clockwise or counterclockwise will be described.

まず変換モード数Mは行列の大きさNに応じて次式で
表される。
First, the number M of conversion modes is represented by the following equation according to the size N of the matrix.

M=〔log2N〕 但し〔 〕は内部の数値が整数のときはその整数値を
表し、小数点以下の数値を含むときは切り上げた整数を
表す。
M = [log 2 N] where [] represents the integer value when the internal numerical value is an integer, and represents the rounded up integer when the numerical value below the decimal point is included.

これはN=2n(nは整数)で表されるときはM=nで
あり2n<N<2n+1の場合はM=n+1を表す。つまり、
変換モード数MはNXNの行列を必ず2MX2Mの大きさの行列
として取り扱うことを表している。本実施例では4行X4
列の画像データを例としているので、M=2となる。も
し、画像データが5行X5列であった場合は、Nは5なの
で、2n<N<2n+1に当てはまり、よって22<N<22+1
なり、M=n+1、つまりM=3となる。従って23X23
の大きさの行列(8X8の行列)として取り扱われること
になる。
This is M = n when represented by N = 2 n (n is an integer), and M = n + 1 when 2 n <N <2 n + 1 . That is,
The number of conversion modes M means that the NXN matrix is always treated as a matrix of size 2 M X2 M. In this embodiment, 4 rows x 4
Since column image data is taken as an example, M = 2. If the image data has 5 rows and 5 columns, N is 5, so that 2 n <N <2 n + 1 is satisfied, so that 2 2 <N <2 2 + 1 and M = n + 1, that is, M = 3. Therefore 2 3 X2 3
Will be treated as a matrix of size (8x8 matrix).

次にCPU1が変換モードL(=1〜M)の時に画像格納
領域3から読み出し、Nビット入力ラッチ回路4、5に
それぞれ入力するワード(行)について第2図の画像デ
ータを例にとって以下に説明する。
Next, regarding the words (rows) read out from the image storage area 3 and inputted to the N-bit input latch circuits 4 and 5 when the CPU 1 is in the conversion mode L (= 1 to M), the image data of FIG. explain.

第2図の画像データの場合、4行X4列であり上述した
ようにM=2となるので、変換モードLは1〜M、つま
り1と2となる。Nビット入力ラッチ回路4に転送する
行番号をA、Nビット入力ラッチ回路5に転送する行番
号をBとすると、 A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=0〜(N/2L)−1 によって表すことができる。
In the case of the image data shown in FIG. 2, since it has 4 rows and 4 columns and M = 2 as described above, the conversion modes L are 1 to M, that is, 1 and 2. When the row number transferred to the N-bit input latch circuit 4 is A and the row number transferred to the N-bit input latch circuit 5 is B, A = k * 2 L to k * 2 L +2 L-1 -1 B = A + 2 L-1 k = 0~ (N / 2 L) can be represented by -1.

本実施例では、N=4、L=1及び2であるので、L
=1(変換モード1)の場合、上述のkを求める式にお
いて、k=0及び1となる。L=1でk=0の場合、上
述のA、Bを求める式において、A=0、B=1とな
り、k=1の場合、A=2、B=3となる。つまり、変
換モード1ではNビット入力ラッチ回路4に転送される
行は0行目(第2図でいえば1ワード目)及び2行目
(同じく3ワード目)、Nビット入力ラッチ回路5に転
送される行は1行目(同じく2ワード目)及び3行目
(同じく4ワード目)となる。また、L=2(変換モー
ド2)の場合、上述のkを求める式において、k=0と
なる。L=2でk=0の場合、上述のA、Bを求める式
において、A=0及び1、B=2及び3となる。つま
り、変換モード2ではNビット入力ラッチ回路4に転送
される行は0行目(第2図でいえば1ワード目)及び1
行目(同じく2ワード目)、Nビット入力ラッチ回路5
に転送される行は2行目(同じく3ワード目)及び3行
目(同じく4ワード目)となる。
In this embodiment, N = 4 and L = 1 and 2, so L
When = 1 (conversion mode 1), k = 0 and 1 in the above equation for obtaining k. When L = 1 and k = 0, in the above formula for obtaining A and B, A = 0 and B = 1, and when k = 1, A = 2 and B = 3. That is, in the conversion mode 1, the rows transferred to the N-bit input latch circuit 4 are the 0-th row (the 1st word in FIG. 2) and the 2nd row (also the 3rd word) and the N-bit input latch circuit 5. The transferred lines are the first line (also the second word) and the third line (also the fourth word). Further, in the case of L = 2 (conversion mode 2), k = 0 in the above equation for obtaining k. In the case of L = 2 and k = 0, A = 0 and 1 and B = 2 and 3 in the above formula for obtaining A and B. That is, in the conversion mode 2, the rows transferred to the N-bit input latch circuit 4 are the 0th row (the 1st word in FIG. 2) and the 1st row.
Row (also second word), N-bit input latch circuit 5
The lines transferred to are the second line (also the third word) and the third line (also the fourth word).

次にこのようにして決定されたA、B行のデータを2N
ビット変換回路7で変換する方法について説明する。
Next, the data of rows A and B determined in this way are
A method of conversion by the bit conversion circuit 7 will be described.

jを0からN−1までの値として(本実施例ではNは
4なのでjは0列から3列を表す)、A行のj列をA
(j)として表し、B行のj列をB(j)として表すと
すると、次の式1から式4により、変換前画像データの
A(j)、B(j)を変換後画像データのA′(j)、
B′(j)に変換する。式5は、式1から式4において
用いられるkを得るための式である。
j is a value from 0 to N−1 (in the present embodiment, N is 4, so j represents columns 0 to 3), and the j column of the A row is A
Assuming that (j) and the j column of the B row are represented as B (j), A (j) and B (j) of the pre-conversion image data of the post-conversion image data are expressed by the following formulas 1 to 4. A '(j),
Convert to B '(j). Equation 5 is an equation for obtaining k used in Equations 1 to 4.

<式1>j=k*2L〜k*2L+2L-1−1 A′(j)=A(j) <式2>k*2L+2L-1〜k*2L+2L−1 A′(j)=B(j−2L-1) <式3>k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) <式4>j=k*2L〜k*2L+2L-1−1 B′(j)=A(j+2L-1) <式5>k=0〜(N/2L)−1 式5において、まずkを求める。本実施例の場合、変
換モードLには1と2があるが、L=1(変換モード
1)の場合を先に説明する。N=4なので、式5によっ
て、k=0及び1となる。
<Formula 1> j = k * 2 L ~k * 2 L +2 L-1 -1 A '(j) = A (j) < Formula 2> k * 2 L +2 L -1 ~k * 2 L +2 L -1 A '(j) = B (j-2 L-1 ) <Formula 3> k * 2 L +2 L-1 to k * 2 L +2 L -1 B' (j) = B (j) <Formula 3>4> j = k * 2 L ~k * 2 L +2 L-1 -1 B '(j) = A (j + 2 L-1) < formula 5> k = 0~ (N / 2 L) -1 equation 5 First, k is obtained. In the present embodiment, there are 1 and 2 in the conversion modes L, but the case of L = 1 (conversion mode 1) will be described first. Since N = 4, according to Equation 5, k = 0 and 1.

式1により、k=0の場合j=0、k=1の場合j=
2となる。従って、A行(0行目、2行目)の0列の値
がA′行(0行目、2行目)の0列の値に、A行(0行
目、2行目)の2列の値がA′行(0行目、2行目)の
2列の値とされる。
According to Equation 1, j = 0 when k = 0 and j = when k = 1
It becomes 2. Therefore, the value of the 0th column of the A row (the 0th row, the 2nd row) becomes the value of the 0th column of the A'row (the 0th row, the 2nd row) and the value of the A row (the 0th row, the 2nd row) The value of the second column is the value of the second column of the A'row (0th row, 2nd row).

式2により、k=0の場合j=1、k=1の場合j=
3となる。B(j−2L-1)はj=1のときB(0)に、
j=3のときB(2)となる。従って、B行(1行目、
3行目)の0列の値がA′行(0行目、2行目)の1列
の値に、B行(1行目、3行目)の2列の値がA′行
(0行目、2行目)の3列の値とされる。
From Equation 2, j = 1 when k = 0 and j = when k = 1
It becomes 3. B (j-2 L-1 ) becomes B (0) when j = 1,
When j = 3, it becomes B (2). Therefore, row B (first row,
The value of the 0th column of the 3rd row) is the value of the 1st column of the A'row (the 0th row, the 2nd row), and the value of the 2nd column of the B row (the 1st row, the 3rd row) is the A'row ( It is a value in the third column (0th row, 2nd row).

式3により、k=0の場合j=1、k=1の場合j=
3となる。従って、B行(1行目、3行目)の1列の値
がB′行(1行目、3行目)の1列の値に、B行(1行
目、3行目)の3列の値がB′行(1行目、3行目)の
3列の値とされる。
From Equation 3, j = 1 when k = 0 and j = when k = 1
It becomes 3. Therefore, the value of the 1st column of the B row (1st row, 3rd row) becomes the value of the 1st column of the B'row (1st row, 3rd row), and the value of 1st column of the B row (1st row, 3rd row) The value of the third column is the value of the third column of the B'row (first row, third row).

式4により、k=0の場合j=0、k=1の場合j=
2となる。A(j+2L-1)はj=0のときA(1)に、
j=2のときA(3)となる。従って、A行(0行目、
2行目)の1列の値がB′行(1行目、3行目)の0列
の値に、A行(0行目、2行目)の3列の値がB′行
(1行目、3行目)の2列の値とされる。
From Equation 4, j = 0 when k = 0 and j = when k = 1
It becomes 2. A (j + 2 L-1 ) becomes A (1) when j = 0,
When j = 2, it becomes A (3). Therefore, line A (line 0,
The value of the 1st column of the 2nd row) is the value of the 0th column of the B'row (the 1st row, the 3rd row), and the value of the 3rd column of the A row (the 0th row, the 2nd row) is the B'row ( It is a value in the second column (first row, third row).

以上の変換モード1の処理によって、第2図(a)の
ソース画像が(b)のph2の画像に変換される。
By the processing of the conversion mode 1 described above, the source image of FIG. 2A is converted into the image of ph2 of FIG.

次に、L=2(変換モード2)の処理に入る。N=4
なので、式5によって、k=0となる。
Next, the process of L = 2 (conversion mode 2) is started. N = 4
Therefore, according to the equation 5, k = 0.

式1により、j=0及び1となる。従って、A行(0
行目、1行目)の0列の値がA′行(0行目、1行目)
の0列の値に、A行(0行目、1行目)の1列の値が
A′行(0行目、1行目)の1列の値とされる。
From Equation 1, j = 0 and 1. Therefore, row A (0
The value of the 0th column in the 1st row is the A'row (the 0th row, the 1st row)
The value of the 1st column of the A row (the 0th row, the 1st row) is set as the value of the 1st column of the A ′ row (the 0th row, the 1st row).

式2により、j=2及び3となる。B(j−2L-1)は
j=2のときB(0)に、j=3のときB(1)とな
る。従って、B行(2行目、3行目)の0列の値がA′
行(0行目、1行目)の2列の値に、B行(2行目、3
行目)の1列の値がA′行(0行目、1行目)の3列の
値とされる。
From Equation 2, j = 2 and 3. B (j-2 L-1 ) is B (0) when j = 2 and B (1) when j = 3. Therefore, the value in the 0th column of row B (second row, third row) is A ′.
The value in the second column of the row (0th row, 1st row) is added to the B row (2nd row, 3rd row)
The value of the 1st column of the (row) is set as the value of the 3rd column of the A ′ row (0th row, 1st row).

式3により、j=2及び3となる。従って、B行(2
行目、3行目)の2列の値がB′行(2行目、3行目)
の2列の値に、B行(2行目、3行目)の3列の値が
B′行(2行目、3行目)の3列の値とされる。
From Equation 3, j = 2 and 3. Therefore, row B (2
The value of the 2nd column in the 3rd row) is the B'row (2nd row, 3rd row)
The value of the third column of the B row (second row, third row) is set as the value of the third column of the B ′ row (second row, third row) in the value of the second column.

式4により、j=0及び1となる。A(j+2L-1)は
j=0のときA(2)に、j=1のときA(3)とな
る。従って、A行(0行目、1行目)の2列の値がB′
行(2行目、3行目)の0列の値に、A行(0行目、1
行目)の3列の値がB′行(2行目、3行目)の1列の
値とされる。
From Equation 4, j = 0 and 1. A (j + 2 L-1 ) is A (2) when j = 0 and A (3) when j = 1. Therefore, the value in the second column of row A (row 0, row 1) is B '.
The value of column 0 of the row (2nd row, 3rd row) is set to the A row (0th row, 1st row)
The value of the 3rd column of the (row) is set as the value of the 1st column of the B ′ row (the 2nd row, the 3rd row).

以上の変換モード2の処理によって、第2図(b)の
ph2の画像がph4の画像に変換される。
As a result of the conversion mode 2 processing described above, FIG.
The ph2 image is converted to the ph4 image.

式1から式5による変換は、変換モード数分M回繰り
返される(本実施例ではM=2)。このようにしてソー
ス画像の転置行列を求め、変換された行データをNビッ
ト出力ラッチ回路8、9にラッチし、ラッチデータセレ
クト回路10により、変換された行データを画像格納領域
3のA行、B行に書き込む。
The conversion according to Expressions 1 to 5 is repeated M times for the number of conversion modes (M = 2 in this embodiment). Thus, the transposed matrix of the source image is obtained, the converted row data is latched in the N-bit output latch circuits 8 and 9, and the converted row data is transferred to the A row of the image storage area 3 by the latch data select circuit 10. , Line B.

さらに、第2図(b)のph4の画像を変換して、ソー
ス画像が時計回り90度回転した画像を得る動作を説明す
る。
Further, the operation of converting the ph4 image in FIG. 2B to obtain an image in which the source image is rotated 90 degrees clockwise will be described.

Nビット入力ラッチ回路6に画像格納領域3からph4
の画像を順に1行ずつ読み出してラッチする。読み出し
た行をE行(j列)として表し、Nビット変換回路11が
次の式によりE′行(j列)に変換する。Eは0行から
N−1行、jは0列からN−1列、本実施例ではE=j
=0〜3となる。
From the image storage area 3 to the ph4
The image is read out line by line and latched. The read row is represented as E row (j column), and the N-bit conversion circuit 11 converts it to E ′ row (j column) by the following equation. E is 0th row to N-1th row, j is 0th column to N-1th row, and E = j in this embodiment.
= 0 to 3.

E′(j)=E(N−j−1) E′=E=0〜N−1 j=0〜N−1 この式により、本実施例では、ph4の画像のE行(0
行目から3行目まで)の3列の値をE′行(0行目から
3行目まで)の0列の値に、同様に2列の値を1列の値
に、1列の値を2列の値に、0列の値を3列の値とす
る。
E ′ (j) = E (N−j−1) E ′ = E = 0 to N−1 j = 0 to N−1 According to this formula, in the present embodiment, E row (0
The value of the 3rd column (from the 3rd row to the 3rd row) is the value of the 0th column of the E ′ row (the 0th to the 3rd row), and similarly, the value of the 2nd column is the value of the 1st column. Let the values be the values in the second column and the values in the zero column be the values in the third column.

このようにして、第2図(b)のph4の画像をph5の画
像に変換し、N行XN列のソース画像を時計回り90度回転
した画像を得る。
In this way, the image of ph4 in FIG. 2 (b) is converted into the image of ph5, and an image obtained by rotating the source image of N rows and XN columns by 90 degrees clockwise is obtained.

また、第2図(b)のph4の画像を変換して、ソース
画像が反時計回り90度回転した画像を得る動作を説明す
る。
The operation of converting the image of ph4 in FIG. 2B to obtain an image in which the source image is rotated 90 degrees counterclockwise will be described.

Nビット入力ラッチ回路6に画像格納領域3からph4
の画像を順に1行ずつ読み出してラッチする。読み出し
た行をE行(j列)として表し、行順変更回路12が次の
式によりF行(j列)に変換する。E=0行からN−1
行、FはN−1行から0行、jは0列からN−1列、本
実施例ではE=j=0〜3、F=3〜0となる。
From the image storage area 3 to the ph4
The image is read out line by line and latched. The read row is represented as E row (j column), and the row reordering circuit 12 converts it to F row (j column) by the following equation. E = 0 to N-1
Rows, F is N-1 to 0 rows, j is 0 to N-1 columns, and in this embodiment, E = j = 0 to 3 and F = 3 to 0.

F(j)=E(j) E=0〜N−1 F=N−1〜0 j=0〜N−1 この式により、本実施例では、ph4の画像のE行(0
行目)の0列〜3列の値をF行(3行目)の0列〜3列
の値に、E行(1行目)の0列〜3列の値をF行(2行
目)の0列〜3列の値に、E行(2行目)の0列〜3列
の値をF行(1行目)の0列〜3列の値に、E行(3行
目)の0列〜3列の値をF行(0行目)の0列〜3列の
値とする。
F (j) = E (j) E = 0 to N−1 F = N−1 to 0 j = 0 to N−1 According to this expression, in the present embodiment, the E row (0
The values of columns 0 to 3 of the (row) are set to the values of columns 0 to 3 of the F row (third row), and the values of columns 0 to 3 of the E row (first row) are set to the row F (2 row). The values in columns 0 to 3 of the E-th row, the values in columns 0 to 3 in the E row (second row) into the values in columns 0 to 3 in the F row (first row), and the E row (3 rows). The values in the 0th column to the 3rd column of the eye are set to the values in the 0th column to the 3rd column of the F row (the 0th row).

このようにして、第2図(b)のph4の画像をph6の画
像に変換し、N行XN列のソース画像を反時計回り90度回
転した画像を得る。
In this way, the image of ph4 in FIG. 2B is converted into the image of ph6, and an image obtained by rotating the source image of N rows and XN columns counterclockwise by 90 degrees is obtained.

ソース画像を時計回り90度回転した画像又は反時計回
り90度回転した画像はNビット出力ラッチ回路13にラッ
チされた後、画像格納領域3に書き込まれる。
The image obtained by rotating the source image 90 degrees clockwise or the image rotated 90 degrees counterclockwise is latched by the N-bit output latch circuit 13 and then written in the image storage area 3.

発明の効果 以上の説明から明らかなように、本発明は元画像の大
きさに応じて変換モード数を定めこの変換モード数に応
じて所定の式から元画像を構成する行列より2つの行を
選択し、これを所定の式により変換した後元の行列に戻
し、このような操作を変換モード数繰り返すことによ
り、転置行列を求め、この行列の各行ごとのビット並び
順の変更により、90度時計回り回転画像を得、また、転
置行列の各行の順を変更することにより90度反時計回り
回転画像を得ることが出来るので、通常のメモリ構成に
より高速に90度回転画像を得ることができる。
EFFECTS OF THE INVENTION As is clear from the above description, according to the present invention, the number of conversion modes is determined according to the size of the original image, and two rows are formed from a matrix forming the original image according to a predetermined formula according to the number of conversion modes. After selecting it, converting it by a predetermined formula and returning it to the original matrix, repeating this operation for the number of conversion modes, we obtain the transposed matrix, and by changing the bit arrangement order of each row of this matrix, 90 degrees A clockwise rotated image can be obtained, and a 90 ° counterclockwise rotated image can be obtained by changing the order of each row of the transposed matrix. Therefore, a 90 ° rotated image can be obtained at high speed with a normal memory configuration. .

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

第1図は本発明の一実施例の構成を示すブロック図、第
2図は本発明を4行×4列の画像に適用した場合の実施
例を示す図、第3図は従来の方法により90度回転画像を
得る手順の説明図、第4図は特別な構造のメモリを用い
て90度回転画像を得る場合の説明図である。 1……CPU、2……主記憶、3……画像格納領域、4,5,6
……Nビット入力ラッチ回路、7……2Nビットデータ交
換回路、8,9……Nビット出力ラッチ回路、10……ラッ
チデータセレクト回路、11……Nビット交換回路、12…
…行順変更回路、13……Nビット出力ラッチ回路。
FIG. 1 is a block diagram showing a configuration of an embodiment of the present invention, FIG. 2 is a diagram showing an embodiment when the present invention is applied to an image of 4 rows × 4 columns, and FIG. 3 is a conventional method. FIG. 4 is an explanatory diagram of a procedure for obtaining a 90 ° rotated image, and FIG. 4 is an explanatory diagram for obtaining a 90 ° rotated image using a memory having a special structure. 1 ... CPU, 2 ... main memory, 3 ... image storage area, 4, 5, 6
... N-bit input latch circuit, 7 ... 2 N-bit data exchange circuit, 8,9 ... N-bit output latch circuit, 10 ... Latch data select circuit, 11 ... N-bit exchange circuit, 12 ...
… Row order change circuit, 13 …… N-bit output latch circuit.

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】N行×N列の画像データを90度回転するに
際し、変換モード数Mを、M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、前記N行をO〜N−1と付番し、変換モ
ードL(=1〜M)ごとに、A番行とB番行を、 A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=O〜(N/2L)−1 によって求め、A番行とB番行の行ビット並びをA
(j),B(j)で表し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=O〜(N/2L)−1 によって求め、A(j)をA′(j)にB(j)をB′
(j)に変換し、Lを1からMまで変化させることによ
りN行×N列の変換画像データを求め、この変換画像デ
ータの各行のビット並びをE(j)とし、 F(j)=E(N−j−1),j=O〜N−1 によって各行のビット並びを変換することによりN行×
N列の画像データの90度時計回りの回転画像を得ること
を特徴とする画像90度回転方法。
1. When rotating N rows × N columns of image data by 90 degrees, the number M of conversion modes is M = [log 2 N] (where [] is the integer when the internal numerical value is an integer,
When the number including the decimal point or less is included, it is obtained by rounding up.), The N rows are numbered as O to N−1, and the A row and the B row are numbered for each conversion mode L (= 1 to M). , a = k * 2 L ~k * 2 L +2 L-1 -1 B = a + 2 L-1 k = O~ (N / 2 L) determined by -1, a number row and row bit sequence of B-number row A
(J), expressed in B (j), A '( j), B' (j) the A '(j) = A ( j) j = k * 2 L ~k * 2 L +2 L-1 -1 A '(j) = B ( j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L +2 L-1 to k * 2 L +2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L +2 L-1 -1 k = O to (N / 2 L ) −1, A (j) is A ′ (j) and B (j) is B ′.
Converted image data is converted into (j) and L is changed from 1 to M to obtain converted image data of N rows × N columns, the bit sequence of each row of this converted image data is E (j), and F (j) = E (N−j−1), j = O to N−1, by converting the bit sequence of each row, N rows ×
An image 90-degree rotation method characterized by obtaining a 90-degree clockwise rotation image of N columns of image data.
【請求項2】N行×N列の画像データを90度回転するに
際し、変換モード数Mを、 M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、前記N行をO〜N−1と付番し、変換モ
ードL(=1〜M)ごとに、A番行とB番行を、 A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=O〜(N/2L)−1 によって求め、A番行とB番行の行ビット並びをA
(j),B(j)で表し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=O〜(N/2L)−1 によって求め、A(j)をA′(j)にB(j)をB′
(j)に変換し、Lを1からMまで変化させることによ
りN行×N列の変換画像データを求め、この変換画像デ
ータのi行をE(i,j)で表し、E′(i,j)を E′(i,j)=E(N−i−1,j),i=0〜N−1 によって行の変換をすることによりN行×N列の画像デ
ータの90度反時計回りの回転画像を得ることを特徴とす
る画像90度回転方法。
2. When rotating N rows × N columns of image data by 90 degrees, the number of conversion modes M is M = [log 2 N] (where [] is the integer when the internal numerical value is an integer,
When the number including the decimal point or less is included, it is obtained by rounding up.), The N rows are numbered as O to N−1, and the A row and the B row are numbered for each conversion mode L (= 1 to M). , a = k * 2 L ~k * 2 L +2 L-1 -1 B = a + 2 L-1 k = O~ (N / 2 L) determined by -1, a number row and row bit sequence of B-number row A
(J), expressed in B (j), A '( j), B' (j) the A '(j) = A ( j) j = k * 2 L ~k * 2 L +2 L-1 -1 A '(j) = B ( j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L +2 L-1 to k * 2 L +2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L +2 L-1 -1 k = O to (N / 2 L ) −1, A (j) is A ′ (j) and B (j) is B ′.
(J) and by changing L from 1 to M, converted image data of N rows × N columns is obtained, the i row of this converted image data is represented by E (i, j), and E ′ (i , j) is converted into a row by E ′ (i, j) = E (N−i−1, j), i = 0 to N−1, thereby reversing the image data of N rows × N columns by 90 degrees. A 90-degree image rotation method characterized by obtaining a clockwise rotation image.
【請求項3】画像データを記憶する画像データ記憶手段
と、N行×N列の画像データの変換モード数Mを M=〔log2N〕 (但し〔 〕は内部の数値が整数のときはその整数を、
少数点以下の数値を含むときは切り上げた整数) によって求め、変換モードL(=1〜M)を出力する変
換モード演算手段と、前記N行を0〜N−1と付番し、
前記変換モードLに応じて前記N行よりA番行とB番行
を A=k*2L〜k*2L+2L-1−1 B=A+2L-1 k=0〜(N/2L)−1 により演算し、このA番行とB番行の行ビット並びA
(j),B(j)を選択する行選択手段と、前記A
(j),B(j)を入力し、A′(j),B′(j)を A′(j)=A(j) j=k*2L〜k*2L+2L-1−1 A′(j)=B(j−2L-1) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=B(j) j=k*2L+2L-1〜k*2L+2L−1 B′(j)=A(j+2L-1) j=k*2L〜k*2L+2L-1−1 k=0〜(N/2L)−1 によって演算し、前記画像データのA(j),B(j)を
それぞれA′(j),B′(j)に変換し、この操作を変
換モードLを1〜Mまで変えて行い、変換画像データを
作成する画像変換手段と、前記変換画像データの行ビッ
ト並びをE(j)とし、 F(j)=E(N−j−1),j=0〜N−1 によって各行のビット並びを変換する行ビット並び変換
手段と、前記変換画像データのi行をE(i,j)で表
し、E′(i,j)を E′(i,j)=E(N−j−1),i=0〜N−1 によって行の変換を行う行変換手段とを備えたことを特
徴とする画像90度回転装置。
3. An image data storage means for storing image data, and a conversion mode number M of N rows × N columns of image data is M = [log 2 N] (where [] is an integer when an internal value is an integer. That integer
Conversion mode calculation means for obtaining a conversion mode L (= 1 to M) by calculating by rounding up when there are numerical values below the decimal point and numbering the N rows as 0 to N-1;
Depending on the conversion mode L, the A-th row and the B-th row from the N-th row are A = k * 2 L to k * 2 L + 2 L-1 -1 B = A + 2 L-1 k = 0 to (N / 2 L ) -1 to calculate the row bit sequence A and B of row A
(J), B (j) for selecting a row, and A
(J), B (j) and A '(j), B' (j) are A '(j) = A (j) j = k * 2 L to k * 2 L +2 L-1 − 1 A '(j) = B (j-2 L-1) j = k * 2 L +2 L-1 ~k * 2 L +2 L -1 B' (j) = B (j) j = k * 2 L + 2 L-1 to k * 2 L + 2 L- 1 B '(j) = A (j + 2 L-1 ) j = k * 2 L to k * 2 L + 2 L-1 -1 k = 0 to (N / 2 L ) -1 to convert A (j) and B (j) of the image data into A '(j) and B' (j), respectively. Image conversion means for generating converted image data and E (j) as the row bit sequence of the converted image data, and F (j) = E (N-j-1), j = 0 to N A row bit arrangement conversion means for converting the bit arrangement of each row by -1, and the i row of the converted image data is represented by E (i, j), and E '(i, j) is represented by E (I, j) = E (N-j-1), i = image 90 degree rotation device characterized by comprising by 0 to N-1 and row conversion means for converting line.
JP2013165A 1990-01-22 1990-01-22 Method and apparatus for rotating image by 90 degrees Expired - Fee Related JP2553726B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2013165A JP2553726B2 (en) 1990-01-22 1990-01-22 Method and apparatus for rotating image by 90 degrees
US08/227,088 US5412768A (en) 1990-01-22 1994-04-13 Method and apparatus for rotating an image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013165A JP2553726B2 (en) 1990-01-22 1990-01-22 Method and apparatus for rotating image by 90 degrees

Publications (2)

Publication Number Publication Date
JPH03216772A JPH03216772A (en) 1991-09-24
JP2553726B2 true JP2553726B2 (en) 1996-11-13

Family

ID=11825563

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013165A Expired - Fee Related JP2553726B2 (en) 1990-01-22 1990-01-22 Method and apparatus for rotating image by 90 degrees

Country Status (1)

Country Link
JP (1) JP2553726B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2973784B2 (en) * 1993-07-19 1999-11-08 松下電器産業株式会社 Multi-value image 90-degree rotation method and apparatus
CN111754409A (en) * 2019-03-27 2020-10-09 北京沃东天骏信息技术有限公司 Image processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
JPH03216772A (en) 1991-09-24

Similar Documents

Publication Publication Date Title
JP2973784B2 (en) Multi-value image 90-degree rotation method and apparatus
JPS61107596A (en) Associative memory
JPH01134495A (en) Image rotator
JPH023515B2 (en)
JP2553726B2 (en) Method and apparatus for rotating image by 90 degrees
JP2997613B2 (en) Discrete cosine transformer
JPH05233795A (en) Image expansion/reduction device
US6195463B1 (en) Multiresolution image processing and storage on a single chip
JP2824976B2 (en) 2D array data rotation device
JPS6149246A (en) Image rotation processing system
JP2548286B2 (en) Image data processor
JP3731191B2 (en) Transposition processing method for matrix data
JPH028336B2 (en)
KR100276793B1 (en) Subpixel Mask Generator
JPH03116322A (en) Matrix transforming device
JPS63118886A (en) Converter for digital image
JPH061449B2 (en) Image memory for image editing
JPS6128165A (en) Bit location converting device
JPS61243572A (en) Method and device for transposing picture
JPH0697462B2 (en) Image rotation method
JPH06230768A (en) Image memory device
JP2512252B2 (en) Image scaling device
JPS62269280A (en) Method of turning picture image by 90×
JPS6054075A (en) Picture enlarging and reducing circuit
JPS62269281A (en) Picture transposing method

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees