KR19990032184A - How to rotate black and white image data - Google Patents

How to rotate black and white image data Download PDF

Info

Publication number
KR19990032184A
KR19990032184A KR1019970053159A KR19970053159A KR19990032184A KR 19990032184 A KR19990032184 A KR 19990032184A KR 1019970053159 A KR1019970053159 A KR 1019970053159A KR 19970053159 A KR19970053159 A KR 19970053159A KR 19990032184 A KR19990032184 A KR 19990032184A
Authority
KR
South Korea
Prior art keywords
memory
byte
pointer
image
rotating
Prior art date
Application number
KR1019970053159A
Other languages
Korean (ko)
Inventor
이상덕
손승우
김순용
Original Assignee
정선종
한국전자통신연구원
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 정선종, 한국전자통신연구원 filed Critical 정선종
Priority to KR1019970053159A priority Critical patent/KR19990032184A/en
Publication of KR19990032184A publication Critical patent/KR19990032184A/en

Links

Landscapes

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

Abstract

본 발명은 흑백 화상 데이터를 화면상에서 90°, 180°, 270°회전시키는 방법에 관한 것으로, 좌우측 쉬프트 장치, 캐리 비트 장치, 좌우측 로테이트 장치를 사용하여 비트 단위로 저장된 흑백 화상 데이터 처리를 용이하게 하며 고속으로 화상을 회전시킬 수 있게 한다.The present invention relates to a method of rotating black and white image data 90 °, 180 °, 270 ° on a screen, and facilitates processing of black and white image data stored in units of bits using a left and right shift device, a carry bit device, and a left and right rotate device. Allows to rotate the image at high speed.

우측 90°회전 시에는 좌측으로 한 비트를 쉬프트하여 캐리 비트에 저장하는 좌측 쉬프트장치와 캐리 비트에 저장된 내용을 이용한 좌측 로테이트장치를 사용하여 회전하고, 우측 180°회전 시에는 좌측 쉬프트 장치와 캐리 비트 장치, 우측 로테이트 장치를 사용하여 화상 데이터를 우측 또는 좌측으로 180°회전시키고, 우측 270°로 회전 시에는 우측 쉬프트 장치와 캐리 비트 장치, 좌측 로테이트 장치를 사용하여 화상 데이터를 우측으로 270°또는 좌측으로 90°회전시켜 비트 단위로 저장된 흑백 화상 데이터를 쉽게 회전 처리할 수 있으며, 데이터의 크기가 크더라도 고속으로 회전시킬 수 있다.When rotating the right 90 °, rotate by using the left shift device which shifts one bit to the left and store it in the carry bit and the left rotate device using the contents stored in the carry bit, and when the right 180 ° rotates, the left shift device and the carry bit Rotate the image data 180 ° to the right or left by using the device, right rotate device, and 270 ° or left to the right by using the right shift device, carry bit device, and left rotate device when rotating to the right 270 °. By rotating it by 90 °, the black and white image data stored in bit units can be easily rotated, and it can be rotated at high speed even if the data size is large.

Description

흑백 화상 데이터 회전 방법How to rotate black and white image data

본 발명은 스캔을 통하여 입력된 흑백화상(monochrome image) 데이터를 좌우로 90°, 180°, 270° 회전시키는 방법에 관한 것으로, 특히 비트 단위로 저장된 흑백 화상 데이터를 고속의 쉬프트 장치와 로테이트 장치를 결합하여 크기가 큰 화상 데이터일지라도 고속으로 회전시키는 방법에 관한 것이다.The present invention relates to a method of rotating 90 °, 180 °, and 270 ° of left and right monochrome image data input by scanning. In particular, the present invention relates to a high speed shift device and a rotate device for converting monochrome image data stored in bits. The present invention relates to a method of rotating at high speed even with large sized image data.

일반적으로 문서 한 장을 스캔하여 그 데이터를 디스플레이하려면 윈도우 시스템에서 표시가능한 화상의 형태인 비트맵 형식으로 나타낸다. 이러한 비트맵은 특별한 압축방식을 사용하지 않은 형식이므로 문서 한 장 분량을 스캔하게 되면 상당히 큰 용량을 차지하게 된다. 특히 한 화소(pixel) 당 하나의 비트로 저장된 흑백 화상 데이터를 처리하기 위해서는 비트 단위의 연산을 사용해야 한다. 이러한 비트 단위 연산을 요구하는 화상을 회전함에 있어서 종래의 방법에서는 원시 화상의 비트 위치를 가지고 회전될 화상의 비트 위치를 계산해내는 방법으로 원하는 회전 연산을 수행했다.In general, to scan a document and display its data, it is displayed in a bitmap format, which is a form of an image that can be displayed in a window system. Since these bitmaps do not use a special compression scheme, scanning a single document can be quite large. In particular, in order to process black and white image data stored in one bit per pixel, a bitwise operation must be used. In rotating an image requiring such a bitwise operation, a conventional rotational operation is performed by calculating a bit position of an image to be rotated with the bit position of an original image.

종래의 비트맵 화상 데이터의 저장 방식은 화면의 한 화소당 색상에 따라 비트 수가 할당되어 있고, 높은 해상도로 표현할 경우 많은 용량을 차지한다. 특히 흑백 비트맵의 경우 그 특성상 비트 연산을 수행해야 하므로 바이트 단위로 읽어서 처리하기 어려우며 연산에 많은 시간이 소요된다. 특히 고해상도로 표현된 화상의 경우 연산 횟수가 많아진다.In the conventional method of storing bitmap image data, the number of bits is allocated according to the color per pixel of the screen, and occupies a large amount when expressed at a high resolution. In particular, in the case of black and white bitmap, it is difficult to read and process by byte unit because it requires bit operation. In particular, in the case of an image expressed in high resolution, the number of operations increases.

상기와 같은 종래 기술의 문제점을 개선하기 위하여, 본 발명에서는 실제 중앙처리장치에서 가장 연산속도가 빠른 좌우로 쉬프트 하는 장치와 쉬프트한 한 비트를 저장하는 캐리 비트 장치와 이 캐리 장치에 적재된 비트를 읽어서 좌우로 로테이트를 수행하는 로테이트 장치를 사용하여 비트별 연산을 쉽게 하고 화상 데이터를 고속으로 회전할 수 있게 하는 것을 그 목적으로 한다.In order to solve the problems of the prior art as described above, in the present invention, a carry bit device for storing a shifted bit and a carry bit device for storing the shifted bit and the bit loaded in the carry device in the actual CPU. It is an object to make it easy to perform bit-by-bit operations and to rotate image data at high speed by using a rotation apparatus that reads and rotates from side to side.

도 1 은 흑백 화상 데이터를 우측으로 90°회전시 각 비트의 위치와 메모리 포인터 변화를 나타낸 형태도.BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a diagram showing the position of each bit and the memory pointer change when black and white image data is rotated 90 degrees to the right.

도 2 는 화상 데이터를 우측으로 90°또는 좌측으로 270°회전시키는 방법을 나타낸 개략도.2 is a schematic diagram showing a method of rotating image data 90 ° to the right or 270 ° to the left.

도 3 은 화상 데이터를 우측 또는 좌측으로 180°회전시키는 방법을 나타낸 개략도.3 is a schematic diagram showing a method of rotating image data 180 ° to the right or left.

도 4 는 화상 데이터를 우측으로 270°또는 좌측으로 90°회전시키는 방법을 나타낸 개략도.4 is a schematic diagram showing a method of rotating image data 270 ° to the right or 90 ° to the left.

도 5 는 본 발명에 의거하여 화상 데이터를 회전시키는 방법을 보인 흐름도.Fig. 5 is a flowchart showing a method of rotating image data in accordance with the present invention.

도 6 은 화상 데이터를 우측으로 90°또는 좌측으로 270°회전시키는 방법을 보인 흐름도.6 is a flowchart showing a method of rotating image data 90 ° to the right or 270 ° to the left.

*도면의 주요부분에 대한 부호의 설명** Description of the symbols for the main parts of the drawings *

10 : 원시화상 메모리 11 : 원시화상 메모리의 시작주소10: raw image memory 11: starting address of raw image memory

12 : 원시화상 메모리 포인터 20 : 목적화상 메모리12: raw image memory pointer 20: target image memory

21 : 목적화상 메모리의 시작주소 22 : 목적화상 메모리 포인터21: Start address of the target image memory 22: Target image memory pointer

23 : 결과 메모리 31 : 좌측 쉬프트(SHL)23: Result memory 31: Left shift (SHL)

32 : 우측 쉬프트(SHR) 40 : 캐리32: right shift (SHR) 40: carry

51 : 좌측 로테이터(RCL) 52 : 우측 로테이터(RCR)51: left rotator (RCL) 52: right rotator (RCR)

상기 목적을 달성하는 본 발명은 비트맵으로 읽어들인 흑백화상 비트맵 데이터를 화면상에서 소정의 방향으로 소정 각도만큼 회전시키는 흑백 화상 데이터 회전 방법으로, 사용자로부터 회전방향과 회전각도를 입력받는 단계와; 상기 입력받은 방향과 각도에 의거하여, 목적화상 메모리의 시작주소에 저장될 원시화상의 시작주소를 가리키는 원시화상 메모리 포인터를 지정하여 8바이트(8비트×8비트)단위로 읽어 임시 8바이트 메모리에 저장하는 읽기 단계와; 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 시작주소를 시작으로 하여, 사용자로부터 입력된 회전방향과 회전각도에 의거하여 하나의 열(8비트) 또는 행(8비트)단위로 1바이트씩 읽어서, 입력된 회전 방향 및 각도에 의거하여 좌측 또는 우측 쉬프트 로테이터에 쉬프트시키고, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 1바이트를 저장하고, 상기 열 또는 행단위의 8바이트를 반복하여 회전시키는 단계와; 상기 원시화상 메모리 포인터를 변동시켜 전체 화상의 높이와 너비에 해당하는 원시화상에 대하여 8바이트 단위로 상기 읽기 및 회전단계를 반복하여 회전시켜 저장하는 것을 특징으로 한다.According to an aspect of the present invention, there is provided a method of rotating black and white image data in which a black and white image bitmap data read as a bitmap is rotated by a predetermined angle on a screen, the method comprising: receiving a rotation direction and a rotation angle from a user; Based on the input direction and angle, a raw image memory pointer indicating the start address of the original image to be stored at the start address of the target image memory is designated and read in units of 8 bytes (8 bits x 8 bits) to a temporary 8 byte memory. A reading step of storing; One column (8 bits) or row (8 bits) based on the rotation direction and rotation angle input from the user, starting from the start address indicated by the source image memory pointer of the raw image data stored in the temporary 8 byte memory. Read one byte at a time, shift it to the left or right shift rotator based on the input rotation direction and angle, shift one byte of the rotator to the target image pointer, and store one byte. Rotating 8 bytes repeatedly; The read and rotate steps may be repeatedly rotated and stored in units of 8 bytes with respect to the original image corresponding to the height and width of the entire image by changing the original image memory pointer.

본 발명에서는 사용자로부터 입력받은 회전방향과 각도에 의거하여 차별되게 상기 원시화상 메모리 포인터를 지정하는 것이 중요한 특징이다.In the present invention, it is important to designate the original image memory pointer differently based on the rotation direction and the angle input from the user.

따라서 본 발명에서는 우측 90°인 경우에는 원시화상 메모리의 맨 좌측 최하단의 주소로 하고, 우측 180°인 경우에는 원시화상 메모리의 맨 우측 최하단의 주소로 하고, 우측 270°인 경우에는 원시화상 메모리의 맨 우측 최상단의 주소로 지정한다.Therefore, in the present invention, the rightmost bottom left address of the raw image memory is set at the right 90 °, the rightmost bottommost address of the raw picture memory is set at the right 180 °, and the rightmost bottom right address of the raw picture memory is set at the right 270 °. It is specified as the top right address.

원시화상을 우측 90°(좌측 270°)로 회전시킬 경우, 상기 회전단계는 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 좌측 최하단의 주소를 시작으로 하여, 상방향으로 배열된 하나의 열(8비트)을 읽어서 좌측으로 쉬프트시키고, 좌측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계를 수행하고, 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 열을 우측으로 90°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시키게 된다.When the raw image is rotated 90 degrees to the right (270 degrees to the left), the rotating step starts the address of the leftmost bottom of the raw image memory pointed to by the raw image memory pointer to the raw image data stored in the temporary 8 bytes of memory. After reading one column (8 bits) arranged upward, shift it to the left, shift it to the left rotator, and shift 1 byte of the rotator to the destination image pointer to indicate the starting address indicated by the destination image pointer. Starting with storing one byte in one row (8 bits) arranged to the right, and repeating the above procedure, rotating eight columns of the temporary 8-byte memory by 90 ° to the right to eight rows. It is stored in the target image memory and rotated.

또한, 원시화상을 우측 180°(좌측 180°)로 회전시킬 경우, 상기 회전단계는 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 우측 최하단의 주소를 시작으로 하여, 좌측방향으로 배열된 하나의 행(8비트)을 읽어서 좌측으로 쉬프트시키고, 우측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계를 수행하고, 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 행을 우측으로 180°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시킨다.When the original image is rotated 180 degrees to the right (180 degrees to the left), the rotating step includes the bottom right address of the raw image memory pointed to by the raw image memory pointer to the raw image data stored in the temporary 8-byte memory. Starting from, one row (8 bits) arranged in the left direction is read, shifted to the left, shifted to the right rotator, and then shifted by one byte of the rotator to the target image pointer, and the start point indicated by the target image pointer Storing one byte in one row (8 bits) arranged to the right, starting with an address, and repeating the above procedure to rotate eight rows of temporary 8-byte memory by 180 ° to the right The image is stored in the target image memory as a row and rotated.

또한, 원시화상을 우측 270°(좌측 90°)로 회전시킬 경우, 상기 회전단계는 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 우측 최상단의 주소를 시작으로 하여, 하향으로 배열된 하나의 열(8비트)을 읽어서 우측으로 쉬프트시키고, 좌측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계를 수행하고, 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 열을 우측으로 270°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시킨다.When the raw image is rotated to the right 270 ° (left 90 °), the rotating step includes the address of the far right uppermost end of the raw image memory pointed to by the raw image memory pointer to the raw image data stored in the temporary 8-byte memory. Starting from, one column (8 bits) arranged downward is read, shifted to the right, shifted to the left rotator, and then shifted one byte of the rotator to the target image pointer, and the starting address indicated by the target image pointer. Storing one byte into one row (8 bits) arranged to the right, starting with. Repeating the above procedure, the eight columns of the temporary 8-byte memory are rotated by 270 ° to the right and eight rows are stored. Rotates it in the target image memory.

이하 도면을 참조하여 본 발명을 상세히 설명하도록 한다.Hereinafter, the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명에서 화상이 회전되는 일례를 알기 쉽게 보여주는 것으로, 회전하기 전의 원시화상과 그 원시화상을 90。만큼 우측으로 회전시켰을 경우, 원시화상을 표현하는 원시화상 메모리(10)의 데이터배열과 90°만큼 우측으로 회전되어 이루어진 목적화상을 표현하는 목적화상 메모리(20)의 데이터배열이 도시되어 있다. 도시된 바와 같이 원시화상 메모리의 왼쪽 맨 아래 주소(11)가 우측 90°로 회전한 목적화상에서는 목적화상 메모리의 시작주소(21)로 대응됨을 볼 수 있다.FIG. 1 shows an example in which an image is rotated in the present invention, and a data array of a raw image memory 10 expressing a raw image when the raw image before rotation and the original image are rotated by 90 ° to the right. And a data arrangement of the object image memory 20 representing the object image formed by being rotated to the right by 90 °. As shown, it can be seen that the lower left address 11 of the raw image memory corresponds to the start address 21 of the target image memory in the object image rotated to the right by 90 °.

본 발명에서는 사용자가 회전시키고자 하는 회전방향과 각도를 크게 세경우로 구분하여 회전작업을 수행하도록 한다.In the present invention, the rotation direction and the angle to be rotated by the user are divided into three cases to perform the rotation operation.

도 2는 그 첫 번째로 화상 데이터를 우측으로 90°또는 좌측으로 270°회전시켜야 할 경우를 도시하고 있는 것으로, 원시화상 메모리의 주소를 가리키는 원시화상 메모리 포인터(12)와, 회전된 화상의 기억되는 주소를 가리키는 목적 메모리 포인터(22)와, 상기 원시화상 메모리 포인터(12)가 가리키는 주소의 데이터를 좌측으로 한 비트씩 쉬프트시키는 좌측 쉬프트 장치(31)와, 쉬프트된 소정의 각도만큼 회전시키기 위한 좌측 로테이트 장치(51)와 그리고 이들을 연결하도록 쉬프트된 한 비트가 저장되는 캐리 비트 장치(40)와, 이들을 이용하여 회전된 한 바이트 화상이 저장되는 결과 메모리(23)와, 회전에 이용할 데이터를 저장하는 S1∼S8 메모리가 사용되어 본 발명의 데이터 회전작업이 수행된다.Fig. 2 shows a case where the image data should be rotated 90 degrees to the right or 270 degrees to the left. The original image memory pointer 12 indicating the address of the original image memory and the storage of the rotated image are shown. An objective memory pointer 22 indicating an address to be addressed, a left shift device 31 for shifting the data of the address indicated by the raw image memory pointer 12 by one bit to the left, and a rotated by a predetermined angle A carry bit device 40 in which the left rotate device 51 and a bit shifted to connect them are stored, a result memory 23 in which a rotated one-byte image is stored using these, and data to be used for rotation. S1 to S8 memories are used to perform the data rotation operation of the present invention.

원시화상을 우측 90°(좌측 270°)로 회전시킬 경우에는, 원시화상이 저장된 메모리의 맨 좌측 최하단 주소를 회전화상 메모리의 시작 주소로 지정하여 원래 화상이 저장된 메모리의 맨 좌측 최하단 주소가 회전된 화상 메모리의 시작 주소로 대응되게 한다. 따라서, 회전된 화상의 시작 바이트는 원래 화상 데이터의 맨 좌측 최하단으로부터 위로 8비트(b1∼b8)에 해당된다. 원시 화상에서 읽어 들인 8바이트(S1∼S8)의 열(column)에 해당하는 것이 회전된 화상의 행에 저장되는 한 바이트가 된다. 상기 원시화상 메모리의 맨 좌측 최하단 주소에 원시화상 메모리 포인터(12)를 이동시킨 후, 회전에 이용할 한 바이트를 읽어서 S1에 저장한 후 원시 메모리 포인터(12)를 w 만큼 감소시켜 메모리에서 한 행위로 이동하고, 이 과정을 8번 반복하여 S1에서 S8까지 8바이트를 저장하고, 저장된 8바이트인 S1∼S8을 좌측 쉬프트를 사용하여 최상의 비트인 b1을 1비트 왼쪽으로 쉬프트하고 좌측 로테이트를 사용하여 쉬프트된 캐리를 결과 메모리에 저장하고, 이 과정을 S1에서 S8의 모든 열에 대하여 차례로 최상위 비트들을 왼쪽으로 쉬프트하여 결과 메모리에 저장하고, 결과 메모리에 저장되어진 회전된 화상 한 바이트를 회전화상을 저장하는 목적 메모리 포인터(22)가 가리키는 메모리에 저장한 후 목적 메모리 포인터(22)를 1 증가시키고, 이 과정을 S1에서 S8의 모든 열에 대해서 8번 수행하고, 이 과정을 화상의 높이(h)만큼 반복하고 이 과정을 다시 화상의 너비(w) 만큼 반복하여 전체 화상이 회전되게 한다.When rotating the original image to the right 90 ° (left 270 °), specify the lowest left address of the memory in which the original image is stored as the start address of the rotating image memory, and rotate the lowest left address of the memory in which the original image is stored. It corresponds to the start address of the picture memory. Therefore, the start byte of the rotated image corresponds to 8 bits b1 to b8 from the bottom left end of the original image data. One byte stored in the row of the rotated image corresponds to a column of eight bytes (S1 to S8) read from the original image. After moving the raw image memory pointer 12 to the leftmost bottom address of the raw image memory, reading one byte to be used for rotation, storing it in S1, and reducing the raw memory pointer 12 by w to perform the operation in the memory. Move, repeat this process 8 times to store 8 bytes from S1 to S8, shift the stored 8 bytes S1 to S8 with left shift to the most significant bit b1 to 1 bit left, and shift with left rotate. To store the resultant carry in the result memory, shifting the most significant bits to the left in order for all the columns of S1 to S8 in the result memory, and storing the rotated image one byte of the rotated image stored in the result memory. After storing in the memory pointed to by the memory pointer 22, the target memory pointer 22 is incremented by 1, and this process is performed from S1 to S8. Performed eight times for the column, and the process to be repeated by the height (h) of the image and the whole image repeatedly rotated by the width (w) of the image the process again.

도 3 은 원시화상을 우측 180°(좌측 180°)로 회전시킬 경우를 도시하고 있는 것으로, 원시화상이 저장된 메모리의 맨 우측 최하단 주소를 회전된 화상이 기억되는 회전화상 메모리의 시작 주소로 지정하고, 상기 원시화상 메모리의 맨 우측 최하단주소에 원시화상 메모리 포인터(12)를 이동시킨 후, 회전에 이용할 한 바이트를 읽어서 S1에 저장한 후 원시 메모리 포인터(12)를 1 만큼 감소시켜 메모리에서 한 바이트 왼쪽으로 이동하고, 이 과정을 8번 반복하여 S1에서 S8까지 8바이트를 저장하고, 저장된 8바이트인 S1∼S8을 좌측 쉬프트를 사용하여 최상의 비트인 b1을 1비트 왼쪽으로 쉬프트하고 우측 로테이트를 사용하여 쉬프트된 캐리를 결과 메모리(23)에 저장하고, 이 과정을 S1의 모든 열(b1∼b8)에 대하여 차례로 비트들을 우측으로 쉬프트하여 결과 메모리(23)에 저장하고, 결과 메모리(23)에 저장되어진 회전된 화상 한 바이트를 회전화상을 저장하는 목적 메모리 포인터(22)가 가리키는 메모리에 저장한 후 목적 메모리 포인터(22)를 1 증가시키고, 이 과정을 S1에서 S8에 대해서 8번 수행하고, 이 과정을 화상의 너비(w) 만큼 반복하고 이 과정을 다시 화상의 높이(h) 만큼 반복하여 전체 화상이 회전되게 한다.FIG. 3 shows a case in which the original image is rotated 180 degrees to the right (180 degrees to the left). The bottom right address of the memory in which the original image is stored is designated as the start address of the rotated image memory in which the rotated image is stored. After moving the raw image memory pointer 12 to the far right bottom address of the raw image memory, reading one byte to be used for rotation, storing the result in S1, and reducing the raw memory pointer 12 by one, one byte in memory. Move to the left, repeat this process 8 times to store 8 bytes from S1 to S8, shift the 8-bit stored S1 to S8 with left shift, shift the best bit b1 to 1 bit left, and use right rotate. The shifted carry is stored in the result memory 23, and the process is shifted to the right in order for all the columns b1 to b8 of S1, and the result memory 2 3) and store one byte of the rotated image stored in the result memory 23 in the memory indicated by the object memory pointer 22 for storing the rotated image, and then increase the object memory pointer 22 by one. The process is performed eight times from S1 to S8, and this process is repeated by the width w of the image and this process is repeated by the height h of the image so that the entire image is rotated.

원래 화상이 저장된 메모리의 맨 우측 최하단의 주소가 회전된 화상 메모리의 시작 주소로 변환된다. 회전 각도가 180°일 때는 원래 화상의 행 데이터 한 바이트가 회전된 화상에서도 행 데이터로써 저장된다. 따라서 한 바이트씩 읽어서 처리할 수 있다. 그러나 180°회전되기 때문에 읽어들인 한 바이트 내의 비트열(bit column)이 역전된다. 이 문제는 좌측 쉬프트 장치를 사용하여 좌측으로 쉬프트된 비트들을 우측으로 로테이트 시켜 비트 열을 역전시키고 결과 메모리(23)에 저장한 후 목적 메모리 포인터(22)가 가리키는 주소에 저장한다.The address at the bottom right of the memory in which the original image is stored is converted to the start address of the rotated image memory. When the rotation angle is 180 °, one byte of row data of the original image is stored as row data even in the rotated image. So you can read them one byte at a time. However, because it is rotated 180 °, the bit column within one byte read is reversed. This problem uses a left shift device to rotate the bits shifted to the left to the right to reverse the bit string, store them in the result memory 23 and store them at the address indicated by the destination memory pointer 22.

도 4는 원시화상을 우측 270°(좌측 90°)로 회전시킬 경우로, 원시화상이 저장된 메모리의 맨 우측 최상단 주소를 회전화상 메모리의 시작 주소로 지정하고, 상기 시작주소로 원시화상 메모리 포인터(12)를 이동시킨 후, 회전에 이용할 한 바이트를 읽어서 S8에 저장한 후 원시 메모리 포인터(12)를 너비(w) 만큼 증가시켜 메모리에서 한 행아래로 이동하고, 이 과정을 8번 반복하여 S8에서 S1까지 8바이트를 저장하고, 저장된 8바이트인 S1∼S8을 우측 쉬프트를 사용하여 최하위의 비트인 b1을 1비트 오른쪽으로 쉬프트하고 좌측 로테이트를 사용하여 쉬프트된 캐리를 결과 메모리에 저장하고, 이 과정을 S1에서 S8의 모든 열에 대하여 차례로 최하위 비트들을 오른쪽으로 쉬프트하여 결과 메모리(23)에 저장하고, 결과 메모리(23)에 저장되어진 회전된 화상 한 바이트를 회전화상을 저장하는 목적 메모리 포인터(22)가 가리키는 메모리에 저장한 후 목적 메모리 포인터(22)를 1 증가시키고, 이 과정을 S1에서 S8의 모든 열에 대해서 8번 수행하고, 이 과정을 화상의 높이(h)만큼 반복하고 이 과정을 다시 화상의 너비(w) 만큼 반복하여 전체 화상이 회전되게 한다.FIG. 4 illustrates a case in which a raw image is rotated to the right 270 ° (left 90 °), and the top right address of the memory in which the raw image is stored is designated as the start address of the rotated image memory, and the start image memory pointer ( 12), read one byte for rotation and store it in S8, then increase the raw memory pointer 12 by width (w) to move down one row in memory, repeating this process eight times Stores 8 bytes from S1 to S1, shifts the least significant bit b1 to right by 1 bit using right shift, and stores the shifted carry to result memory using left rotate. The process shifts the least significant bits to the right in order for all the columns of S1 to S8 and stores them in the result memory 23, and the rotated image one byte stored in the result memory 23 After storing the rotated image in the memory pointed to by the object memory pointer 22, the object memory pointer 22 is increased by one, this process is performed eight times for all the columns of S1 to S8, and the process is performed. Repeat (h) and repeat this process by the width w of the image so that the entire image is rotated.

회전의 특성상 좌측으로 90°회전하는 경우에서도 똑같이 적용된다. 우측으로 270°회전시킬 경우 원래 화상이 저장된 메모리의 맨 우측 최상단의 주소가 회전된 화상 메모리의 시작 주소로 대응된다. 도 4에 도시된 바와 같이 원시 화상 메모리의 맨 우측 최상단 주소에서 하단으로 읽어들인 8바이트(S1∼S8)의 각 비트 열들의 조합하여 회전된 화상의 한 바이트로 저장된다. 이 경우에서는 S8부터 가장 최하위 비트 b1이 회전된 화상의 시작이 되므로 우측으로 쉬프트하여 저장된 캐리 비트를 좌측으로 로테이트하여 결과 메모리(23)에 8비트를 채워서 목적 메모리 포인터(22)가 가리키는 주소에 저장한다.The same applies to the rotation of 90 ° to the left due to the nature of the rotation. When rotating 270 ° to the right, the address of the far rightmost top of the memory in which the original image is stored corresponds to the start address of the rotated image memory. As shown in Fig. 4, the combination of the respective bit strings of 8 bytes (S1 to S8) read from the far right uppermost address of the raw image memory to the bottom is stored as one byte of the rotated image. In this case, since the least significant bit b1 becomes the start of the rotated image from S8, the left carry bit is shifted to the right, and the stored carry bit is rotated to the left to fill the result memory 23 with 8 bits and stored at the address indicated by the destination memory pointer 22. do.

도 5는 화상 데이터를 우측 또는 좌측으로 90°, 180°, 270°회전시키기 위한 전체 흐름도를 보여주는 것이다.5 shows an overall flowchart for rotating image data 90 °, 180 °, 270 ° to the right or left.

먼저 화상의 회전 방향과 회전 각도를 입력받는다(61). 입력된 회전 방향과 회전 각도에 따라 우측 90°, 우측 180°, 우측 270°로 분기하여 실행한다(62). 각각은 90°회전의 특성상 좌측 270°, 180°, 90°회전과 동일하다. 입력값에 따라 분기가 결정되면 각 분기에 맞는 원시 메모리 포인터(12) 값을 계산해낸다(63,64,65). 즉, 좌측 90°회전일 경우는 원시 메모리의 맨 우측 최상단의 주소(w - 1)가 원시 메모리 포인터(12) 값이 되며(63), 좌측 180°회전일 경우 맨 우측 최하단의 주소((h*w)-1)가 원시 메모리 포인터(12) 값이 되며(64), 좌측 270°회전일 경우 맨 좌측 최하단의 주소(w * (h - 1))가 원시 메모리 포인터(12)가 되어 회전 방법의 시작점으로 한다. 이렇게 각 분기에 따라 원시 주소를 계산한 후 90°좌측 회전일 경우 우측 쉬프트(32)와 캐리(40)와 좌측 로테이트(51)를 사용하여 회전을 수행하고(66), 180°좌측 회전일 경우 좌측 쉬프트(31)와 캐리(40)와 우측 로테이트(52)를 사용하고(67), 좌측 270°회전일 경우 좌측 쉬프트(41)와 좌측 로테이트(52)를 사용하여 화상을 회전시키고(68), 그 회전된 화상데이터를 목적메모리에 저장함으로서(69) 회전된 화상을 얻게 된다.First, the rotation direction and the rotation angle of the image are input (61). According to the input rotation direction and the rotation angle, the operation branches to right 90 °, right 180 °, and right 270 ° (62). Each is equal to the left 270 °, 180 °, 90 ° rotation in the characteristic of 90 ° rotation. When the branch is determined according to the input value, the raw memory pointer 12 value corresponding to each branch is calculated (63, 64, 65). That is, in the left 90 ° rotation, the rightmost top address (w-1) of the raw memory becomes the raw memory pointer 12 value (63), and in the left 180 ° rotation, the rightmost bottom address ((h * w) -1) is the value of the raw memory pointer 12 (64), and when the left is rotated 270 °, the lowest left address (w * (h-1)) becomes the raw memory pointer 12 and rotated. Let's start with the method. In this way, after calculating the raw address according to each branch, when the rotation is 90 ° left, the rotation is performed by using the right shift 32, the carry 40, and the left rotate 51 (66), and the rotation is 180 ° left. Use the left shift 31, the carry 40, and the right rotate 52 (67), and rotate the image using the left shift 41 and the left rotate 52 (68) when rotating left 270 ° (68). By storing the rotated image data in the object memory, the rotated image is obtained.

도 6은 본 발명의 실시 예로서 화상 데이터를 우측으로 90°회전시키기 위한 흐름도를 나타내며 이를 구체적으로 설명하면 다음과 같다.6 is a flowchart for rotating image data 90 ° to the right as an embodiment of the present invention, which will be described in detail as follows.

본 실시 예는 좌측 270°회전에도 동일하게 적용된다. 도 5에서 기술된 원시 메모리 포인터(12)로 이동시킨 후, 회전에 이용할 한 바이트를 읽어서 S1에 저장한 후 원시 메모리 포인터(12)를 w 만큼 감소시켜 메모리에서 한 행위로 이동시킨다(101). 이 과정을 8번 반복하여 S1에서 S8까지 8바이트를 먼저 저장한다(102). 저장된 8바이트인 S1∼S8을 좌측 쉬프트를 사용하여 최상의 비트인 b1을 1비트 왼쪽으로 쉬프트하고(103) 좌측 로테이트를 사용하여 쉬프트된 캐리를 결과 메모리에 저장한다. 이 과정을 S1에서 S8의 모든 열에 대하여 차례로 최상위 비트들을 왼쪽으로 쉬프트하여 결과 메모리에 저장한다(105). 결과 메모리(23)에는 회전된 화상 한 바이트가 생기고 이것을 목적 메모리 포인터(22)가 가리키는 메모리에 저장한 후 목적 메모리 포인터(22)를 1 증가시킨다(106). 이 과정(103,104,105,106)을 S1에서 S8의 모든 열에 대해서 8번 수행한다(107). 8바이트를 완료하면 다시 목적 메모리 포인터를 w*8만큼 감소시킨 후 1증가시키고 이 과정(101∼ 107)을 화상의 h 만큼 반복하고 이 과정(101∼ 108)을 다시 화상의 w 만큼 반복하되 원시화상의 메모리 포인터를 화상의 ((h-1)*w)+1 만큼 증가시키면서 수행하면 전체 화상이 회전하게 된다.This embodiment is equally applicable to the left 270 ° rotation. After moving to the original memory pointer 12 described in FIG. 5, one byte to be used for rotation is read and stored in S1, and then the original memory pointer 12 is reduced by w to move to an action in the memory (101). This process is repeated eight times to store eight bytes from S1 to S8 first (102). The left 8 shifts S1 to S8, which are stored, shift the most significant bit b1 1 bit to the left (103), and the shifted carry is stored in the result memory using the left rotate. This process shifts the most significant bits to the left in order for all columns of S1 to S8 (105) and stores them in the result memory. The resultant memory 23 has a byte of rotated images, which are stored in the memory pointed to by the object memory pointer 22 and then incremented by one (106). This process (103, 104, 105, 106) is performed eight times for all the columns of S1 to S8 (107). When 8 bytes are completed, the target memory pointer is decreased by w * 8, and then increased by 1, and this process (101 to 107) is repeated by h of the image, and this process (101 to 108) is repeated by w of the image. Performing while increasing the memory pointer of an image by ((h-1) * w) +1 of the image causes the entire image to rotate.

상술한 바와 같이 본 발명에 의한 화상회전성능은 종래의 화상회전방법의 성능과 비교해 볼 때, 종래에는 원시화상의 화상데이터를 목적화상 포인터가 가리키는 주소에 저장하는 일을 일일이 각각의 비트별로 하던 것을 본 발명에 의하면 8바이트씩 묶어 회전작업이 이루어지게 함으로 전체 작업처리시간의 단축과 함께, 비트 단위로 연산이 가능한 쉬프트 장치와 로테이트 장치, 그리고 이를 연결하는 캐리 비트 장치를 사용하여 비트 단위로 구성된 흑백 비트맵 화상 데이터를 쉽게 처리할 수 있으며, 사용한 두 장치는 하드웨어 장치와의 유사성으로 인하여 고속으로 회전하는 방법이 가능하다. 따라서 고해상도로 표현된 흑백 비트맵 화상 데이터를 비트 단위로 쉽게 처리할 수 있으며, 큰 용량의 데이터일지라도 고속으로 회전할 수 있게 되는 효과를 제공한다.As described above, when the image rotation performance according to the present invention is compared with that of the conventional image rotation method, it has been conventionally performed to store the image data of the original image at the address indicated by the target image pointer for each bit. According to the present invention, the rotation operation is performed by binding 8 bytes to reduce the overall processing time, and the shift unit and the rotation unit that can be operated in units of bits, and the monochrome unit composed of bits using a carry bit unit connecting the same Bitmap image data can be easily processed, and the two devices used can be rotated at high speed due to similarity with hardware devices. Therefore, black and white bitmap image data expressed in high resolution can be easily processed in units of bits, and it is possible to rotate at a high speed even for a large amount of data.

Claims (5)

비트맵 형태로 저장된 흑백화상 비트맵 데이터를 화면상에서 소정의 방향으로 소정 각도만큼 회전시키는 방법에 있어서,In the method for rotating the black and white image bitmap data stored in the bitmap form in a predetermined direction on the screen by a predetermined angle, 사용자로부터 회전방향과 회전각도를 입력받는 단계와;Receiving a rotation direction and rotation angle from a user; 상기 입력받은 방향과 각도에 의거하여, 목적화상 메모리의 시작주소에 저장될 원시화상의 시작주소를 가리키는 원시화상 메모리 포인터를 지정하여 8바이트(8비트×8비트)단위로 읽어 임시 8바이트 메모리에 저장하는 읽기 단계와;Based on the input direction and angle, a raw image memory pointer indicating the start address of the original image to be stored at the start address of the target image memory is designated and read in units of 8 bytes (8 bits x 8 bits) to a temporary 8 byte memory. A reading step of storing; 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 시작주소를 시작으로 하여, 사용자로부터 입력된 회전방향과 회전각도에 의거하여 하나의 열(8비트) 또는 행(8비트)단위로 1바이트씩 읽어서, 입력된 회전 방향 및 각도에 의거하여 좌측 또는 우측 쉬프트 로테이터에 쉬프트시키고, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 1바이트를 저장하고, 상기 열 또는 행단위의 8바이트를 반복하여 회전시키는 단계와;One column (8 bits) or row (8 bits) based on the rotation direction and rotation angle input from the user, starting from the start address indicated by the source image memory pointer of the raw image data stored in the temporary 8 byte memory. Read one byte at a time, shift it to the left or right shift rotator based on the input rotation direction and angle, shift one byte of the rotator to the target image pointer, and store one byte. Rotating 8 bytes repeatedly; 상기 원시화상 메모리 포인터를 변동시켜 전체 화상의 높이와 너비에 해당하는 원시화상에 대하여 8바이트 단위로 상기 읽기 및 회전단계를 반복하여 회전시켜 저장하는 것을 특징으로 하는 흑백 화상 데이터 회전 방법.And changing the original image memory pointer to rotate and store the read and rotate steps in 8 byte units for the original image corresponding to the height and width of the entire image. 제 1 항에 있어서,The method of claim 1, 상기 지정되는 원시화상 메모리 포인터는,The designated raw image memory pointer is 우측 90°인 경우에는 원시화상 메모리의 맨 좌측 최하단의 주소로 하고,In case of right side 90 °, it is regarded as the lowest left address of the raw image memory. 우측 180°인 경우에는 원시화상 메모리의 맨 우측 최하단의 주소로 하고,If it is 180 ° to the right, it is set as the lowest right address of the raw image memory. 우측 270°인 경우에는 원시화상 메모리의 맨 우측 최상단의 주소로 지정하는 것을 특징으로 하는 흑백 화상 데이터 회전 방법.And 270 ° to the right, the black and white image data rotating method as specified by the address at the top right of the raw image memory. 제 2 항에 있어서,The method of claim 2, 원시화상을 우측 90°(좌측 270°)로 회전시킬 경우,If you rotate the original image 90 ° to the right (270 ° to the left), 상기 회전단계는,The rotating step, 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 좌측 최하단의 주소를 시작으로 하여, 상방향으로 배열된 하나의 열(8비트)을 읽어서 좌측으로 쉬프트시키고, 좌측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계와;The raw image data stored in the temporary 8-byte memory is shifted to the left by reading one column (8 bits) arranged in the upward direction, starting with the lowest leftmost address of the raw image memory indicated by the raw image memory pointer. After shifting to the left rotator, one byte of the rotator is shifted to the target image pointer, and one byte is stored in one row (8 bits) arranged to the right starting from the start address indicated by the target image pointer. Steps; 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 열을 우측으로 90°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시키는 것을 특징으로 하는 흑백 화상 데이터 회전 방법.Repeating the above steps to rotate the eight columns of the temporary 8-byte memory by 90 ° to the right, storing them in the target image memory in eight rows, and rotating them. 제 2 항에 있어서,The method of claim 2, 원시화상을 우측 180°(좌측 180°)로 회전시킬 경우,When rotating the original image to the right 180 ° (left 180 °), 상기 회전단계는,The rotating step, 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 우측 최하단의 주소를 시작으로 하여, 좌측방향으로 배열된 하나의 행(8비트)을 읽어서 좌측으로 쉬프트시키고, 우측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계와;The raw image data stored in the temporary 8-byte memory is shifted to the left by reading one row (8 bits) arranged leftward, starting with the address at the far right bottom of the raw image memory indicated by the raw image memory pointer. After shifting to the right rotator, one byte of the rotator is shifted to the target image pointer to store one byte in one row (8 bits) arranged to the right starting from the start address indicated by the target image pointer. Steps; 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 행을 우측으로 180°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시키는 것을 특징으로 하는 흑백 화상 데이터 회전 방법.And repeating the above steps, rotating eight rows of the temporary 8-byte memory by 180 ° to the right, storing the eight rows of the temporary 8-byte memory in the target image memory, and rotating them. 제 2 항에 있어서,The method of claim 2, 원시화상을 우측 270°(좌측 90°)로 회전시킬 경우,If you rotate the original image to the right 270 ° (left 90 °), 상기 회전단계는,The rotating step, 상기 임시 8바이트의 메모리에 저장된 원시화상데이터를 상기 원시화상 메모리 포인터가 가리키는 원시화상 메모리의 맨 우측 최상단의 주소를 시작으로 하여, 하향으로 배열된 하나의 열(8비트)을 읽어서 우측으로 쉬프트시키고, 좌측로테이터에 쉬프트시킨 후, 그 로테이터의 1바이트를 목적화상 포인터에 쉬프트시켜 상기 목적화상 포인터가 가리키는 시작주소를 시작으로 하여 우측으로 배열되는 하나의 행(8비트)으로 1바이트를 저장하는 단계와;The raw image data stored in the temporary 8-byte memory starts with the address of the far rightmost top of the raw image memory pointed to by the raw image memory pointer, and reads one column (8 bits) arranged downward and shifts it to the right. Shifting the left rotator to the target image pointer and storing one byte in one row (8 bits) arranged to the right starting from the start address indicated by the target image pointer. Wow; 상기 과정을 반복하여 임시 8바이트 메모리의 8개의 열을 우측으로 270°만큼 회전시켜 8개의 행으로 목적화상메모리에 저장하여 회전시키는 것을 특징으로 하는 흑백 화상 데이터 회전 방법.Repeating the above steps to rotate the eight columns of the temporary 8-byte memory to the right by 270 °, storing them in the target image memory in eight rows, and rotating them.
KR1019970053159A 1997-10-16 1997-10-16 How to rotate black and white image data KR19990032184A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019970053159A KR19990032184A (en) 1997-10-16 1997-10-16 How to rotate black and white image data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019970053159A KR19990032184A (en) 1997-10-16 1997-10-16 How to rotate black and white image data

Publications (1)

Publication Number Publication Date
KR19990032184A true KR19990032184A (en) 1999-05-06

Family

ID=66042185

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019970053159A KR19990032184A (en) 1997-10-16 1997-10-16 How to rotate black and white image data

Country Status (1)

Country Link
KR (1) KR19990032184A (en)

Similar Documents

Publication Publication Date Title
US4627020A (en) Method for rotating a binary image
EP0433645A2 (en) Method to rotate a bitmap image 90 degrees
US4441208A (en) Picture information processing and storing device
US4809081A (en) Method and apparatus for decompressing encoded data
US5889893A (en) Method and apparatus for the fast rotation of an image
JPH0426150B2 (en)
US5670982A (en) System for fast 90-degree rotation of bi-level images
US5299018A (en) System and method for storing received facsimile image data in computer memory
US5148292A (en) Apparatus for effectively compressing video data representing a relatively simple image having strong area correlation
JPH04145493A (en) Method and apparatus for altering direction of video display
US4916746A (en) Image rotation circuit
KR19990032184A (en) How to rotate black and white image data
JPH04358288A (en) Reducing printer
EP0677822A2 (en) Digital image rotation
US7460718B2 (en) Conversion device for performing a raster scan conversion between a JPEG decoder and an image memory
US20020009236A1 (en) Image data conversion device and image data conversion method for converting the order of pixels
JP2798025B2 (en) Video coding method and apparatus
JP2753349B2 (en) Arbitrary angle rotation image data input / output method, input / output circuit thereof, and electronic file device using the same
JP4165391B2 (en) Image processing method and image processing apparatus
JP2945553B2 (en) High-speed restoration of image data
JPS6249782B2 (en)
JP2556047B2 (en) Image information coding device
JP4158695B2 (en) Image processing method and image processing apparatus
JPH0124319B2 (en)
KR920001619B1 (en) Image processing apparatus

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E601 Decision to refuse application