Image processing system, image processing method, and computer program

The described method efficiently rotates binary images using vertical and horizontal flips, and transposition processes, addressing the inefficiencies of existing libraries by eliminating the need for 8-bit conversions, thus improving processing speed and memory utilization.

JP2024129487APending Publication Date: 2024-09-27BROTHER KOGYO KK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2023038721
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Existing image processing libraries require significant memory resources and time to rotate binary images due to the need to convert them into 8-bit images, leading to inefficient processing.

Method used

A computer program and image processing system that performs rotation on binary images using vertical flip, horizontal flip, and transposition processes without converting to 8-bit images, utilizing delta swaps and bit shift tables to efficiently rotate binary images at 90-degree intervals.

Benefits of technology

The proposed method allows for faster rotation of binary images by reducing the need for large memory allocations and simplifying the processing steps, thereby enhancing processing speed and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024129487000001
    Figure 2024129487000001
Patent Text Reader

Abstract

To provide a technique that enables high-speed conversion processing, including rotation, for binary images.SOLUTION: An image processing method includes acquiring a binary image and transforming the binary image. Transforming the binary image includes transforming the acquired binary image by performing one or more of a top-down flip process, a left-right flip process, and a transposition process on the binary image, such that the binary image becomes an image rotated by a specified angle. The top-down flip process is a process of transforming a target image into a top-down flipped image in which the top and bottom of the target image are flipped. The left-right flip process is a process of transforming a target image into a left-right flipped image in which the left and right of the target image are flipped. The transposition process is a process of transforming a target image into a transposed image in which the rows and columns of the target image are swapped.SELECTED DRAWING: Figure 2
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to an image processing system, an image processing method, and a computer program. [Background technology]

[0002] Known digital images handled by electronic devices such as personal computers and printers include 8-bit grayscale images, 24-bit color images, 48-bit color images, and even binary images in which one pixel is represented by one bit (see, for example, Patent Document 1). Image processing libraries for implementing rotation of 8-bit images, 24-bit images, and 48-bit images are also known. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] JP 2005-346436 A Summary of the Invention [Problem to be solved by the invention]

[0004] When rotating a binary image using an existing image processing library, the binary image needs to be converted into an 8-bit image. Existing rotation processes, including the process of converting a binary image into an 8-bit image, require a large working area in memory, and therefore take a lot of time.

[0005] Therefore, according to one aspect of the present disclosure, it is desirable to provide a technique that can execute conversion processing, including rotation, on a binary image faster than ever before. [Means for solving the problem]

[0006] According to one aspect of the present disclosure, there is provided a computer program for causing a computer to execute a conversion process for a two-dimensional binary image in which one pixel is represented by one bit. According to one aspect of the present disclosure, the conversion process includes acquiring a binary image, accepting an angle designation at 90 degree intervals, and converting the binary image so that the binary image becomes an image rotated to the designated angle.

[0007] According to one aspect of the present disclosure, transforming the binary image includes transforming the binary image by performing one or more of a vertical flip operation, a horizontal flip operation, and a transposition operation on the binary image, such that the binary image becomes an image rotated by a specified angle.

[0008] The vertical flip process converts a target image into a vertically inverted image by inverting its top and bottom. The left-right flip process converts a target image into a left-right inverted image by inverting its left and right. The transposition process converts a target image into a transposed image by swapping its rows and columns.

[0009] This computer program can convert a binary image so that the binary image is rotated to a specified angle without replacing the binary image with an 8-bit image. Moreover, the rotation can be realized by a combination of relatively simple processes such as up-down flipping, left-right flipping, and transposition. Therefore, it is possible to perform conversion processes including rotation on a binary image faster than before.

[0010] According to an aspect of the present disclosure, there may be provided an image processing method, which may include acquiring a two-dimensional binary image in which one pixel is represented by one bit, accepting an angle designation at 90 degree intervals, and performing one or more of a top-down flip process, a left-right flip process, and a transposition process on the acquired binary image, thereby converting the binary image into an image rotated by the designated angle.

[0011] According to an aspect of the present disclosure, there may be provided an image processing system. The image processing system may include an acquisition unit, a reception unit, and a conversion unit. The acquisition unit may be configured to acquire a two-dimensional binary image in which one pixel is represented by one bit.

[0012] The receiving unit may be configured to receive the angle designation at 90 degree intervals. The converting unit may be configured to convert the binary image into an image rotated by the designated angle by performing one or more of a vertical flipping process, a horizontal flipping process, and a transposition process on the acquired binary image.

[0013] According to this image processing system, it is possible to perform conversion processing, including rotation, on a binary image at higher speeds than in the past. [Brief description of the drawings]

[0014] [Figure 1] FIG. 1 is a block diagram illustrating a configuration of an electronic device. [Diagram 2] FIG. 1 is an explanatory diagram regarding rotation of a binary image. [Diagram 3] FIG. 11 is an explanatory diagram regarding rotation of a mirror image. [Figure 4] 1 is a flowchart (part 1) showing a conversion process executed by a processor. [Diagram 5] 13 is a flowchart (part 2) showing the conversion process executed by the processor. [Figure 6] FIG. 11 is an explanatory diagram relating to up-down inversion processing. [Figure 7] 1A and 1B are diagrams illustrating examples of binary images before and after a vertical flip process is performed. [Figure 8] 11 is a flowchart showing a transposition process executed by a processor. [Figure 9] FIG. 1 is a diagram illustrating the first delta swap for an 8x8 block. [Figure 10] A diagram illustrating the second delta swap for an 8x8 block. [Figure 11]A diagram illustrating the third delta swap for an 8x8 block. [Figure 12] 1A and 1B are diagrams illustrating examples of binary images before and after a transposition process is performed. [Figure 13] 11 is a flowchart showing a left-right reversal process executed by a processor. [Figure 14] 1A and 1B are diagrams illustrating examples of binary images before and after horizontal inversion processing is performed. [Figure 15] 15A to 15D are explanatory diagrams relating to the first to fourth bit shift tables. [Figure 16] 16A-16D are explanatory diagrams relating to the fifth to eighth bit shift tables. [Figure 17] 17A and 17B are diagrams (part 1) for explaining conversion of a bit string using a bit shift table. [Figure 18] 18A and 18B are diagrams (part 2) for explaining conversion of a bit string using a bit shift table. [Figure 19] FIG. 13 is a diagram illustrating an example of left-right inversion without taking padding bits into account. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] Exemplary embodiments of the present disclosure will now be described with reference to the drawings. 1 functions as an image processing system. The electronic device 1 includes a processor 11, a memory 13, a storage 15, a user interface 17, and a communication interface 19. Examples of the electronic device 1 include a personal computer, a printer, a scanner, and a digital multifunction peripheral.

[0016] The processor 11 is configured to execute processing according to the computer program Pr. The memory 13 is a primary storage device equipped with a RAM, and is used as a working area when the processor 11 executes processing. The storage 15 is a secondary storage device equipped with, for example, a hard disk drive or a solid state drive, and stores various data in addition to the computer program Pr.

[0017] The user interface 17 includes an input device for inputting an operation signal from a user who operates the electronic device 1 to the processor 11. The user interface 17 further includes a display for displaying various information to the user.

[0018] The communication interface 19 includes a LAN (Local Area Network) interface and a USB (Universal Serial) interface. The electronic device 1 is configured to be able to communicate with an external device via the communication interface 19.

[0019] The storage 15 stores a computer program Pr for causing the processor 11 to execute conversion processing on a binary image. When the electronic device 1 is a personal computer, the computer program Pr can be installed in the electronic device 1 as a printer driver.

[0020] A binary image is a two-dimensional image in which one pixel is represented by one bit. A two-dimensional image is composed of a set of pixels arranged two-dimensionally, vertically and horizontally. In what follows, a horizontal arrangement of pixels will be referred to as a "row." A row of pixels is a column of pixels from the leftmost pixel to the rightmost pixel. In a two-dimensional image, the pixel column in the first row corresponds to the topmost pixel column, and the pixel column in the last row corresponds to the bottommost pixel column.

[0021] A binary image exists as digital data in which bit strings corresponding to pixel columns in each row from the first row to the last row are connected in series in the memory 13 or storage 15. When the binary image is displayed through the user interface 17, it is displayed as a two-dimensional image in which pixel columns are arranged row by row from top to bottom.

[0022] The processor 11 executes a conversion process on a binary image to be processed, in accordance with an instruction from a user inputted via a user interface 17. The binary image to be processed is acquired in advance from, for example, an external device, and stored in the storage 15.

[0023] According to this embodiment, the conversion process includes a process of rotating the binary image to be processed at intervals of 90 degrees. Specifically, the conversion process includes a process of converting the binary image into an image rotated 90 degrees, 180 degrees, or 270 degrees clockwise.

[0024] A characteristic feature of this embodiment is that the processor 11 realizes rotation at 90 degree intervals by executing one or more of a top-to-bottom flip process, a left-to-right flip process, and a transposition process on the binary image.

[0025] The vertical flip process converts a binary image into a vertically flipped image by flipping its top and bottom. The left-right flip process converts a binary image into a left-right flipped image by flipping its left and right. The transposition process converts a binary image into a transposed image by swapping its rows and columns.

[0026] 2, the processor 11 converts a binary image representing the alphabet "R" into an image rotated 90 degrees clockwise by sequentially performing a vertical flip process and a transposition process on the binary image. Hereinafter, the binary image representing the alphabet "R" will be referred to as a binary image "R".

[0027] The processor 11 converts the binary image "R" into an image rotated 180 degrees by sequentially executing a vertical inversion process and a horizontal inversion process on the binary image "R". The processor 11 converts the binary image "R" into an image rotated 270 degrees by sequentially executing a transposition process and a vertical inversion process on the binary image "R".

[0028] According to this embodiment, the conversion process further includes a process of rotating a mirror image of the binary image to be processed at intervals of 90 degrees, i.e., the conversion process includes a process of converting the binary image into a mirror image, and a process of converting the mirror image into an image rotated 90 degrees, 180 degrees, or 270 degrees clockwise.

[0029] The processor 11 converts the binary image "R" into a mirror image, i.e., a left-right inverted image, by performing a left-right inversion process on the binary image "R" as shown in Fig. 3. The processor 11 converts the binary image "R" into an image obtained by rotating its mirror image by 90 degrees clockwise by performing a top-down inversion process, a transposition process, and a top-down inversion process on the binary image "R" in that order.

[0030] The processor 11 performs a vertical flip process on the binary image "R" to convert the binary image "R" into an image obtained by rotating its mirror image by 180 degrees. The processor 11 performs a transposition process on the binary image "R" to convert the binary image "R" into an image obtained by rotating its mirror image by 270 degrees clockwise.

[0031] In this way, the electronic device 1 of this embodiment is configured to be able to convert the binary image to be processed as a binary image without converting it to an 8-bit image, and to a 90-degree rotated image of a binary image, a 180-degree rotated image of a binary image, a 270-degree rotated image of a binary image, a mirror image, a 90-degree rotated image of a mirror image, a 180-degree rotated image of a mirror image, or a 270-degree rotated image of a mirror image, in accordance with instructions from a user.

[0032] When an instruction to execute a conversion process on a binary image is input via the user interface 17, the processor 11 executes the conversion process shown in FIGS. 4 and 5 based on the computer program Pr.

[0033] When the conversion process is started, the processor 11 acquires a binary image to be processed, which is specified by the user through the user interface 17 (S100). The processor 11 further accepts input of conversion instructions including whether or not to mirror and an angle designation through the user interface 17 (S100). The binary image may be acquired from an external device or may be read from the storage 15. The angle designation is performed at 90 degree intervals.

[0034] In the next step S110, the processor 11 determines whether the conversion instruction input in step S100 is an instruction to convert to a mirror image or a rotated image thereof. If the processor 11 determines that the conversion instruction input is an instruction to convert to a mirror image or a rotated image thereof (Yes in step S110), the processor 11 executes the process of step S150.

[0035] If the processor 11 makes a negative decision in S110 (No in S110), it determines whether the input conversion instruction is an instruction to convert a binary image into a 90-degree rotated image (S120). If the processor 11 makes a positive decision in S120, it executes a vertical inversion process on the binary image to be processed (S121), and further executes a transposition process on the binary image after the vertical inversion (S125).

[0036] In the vertical inversion process, the processor 11 converts the binary image into a vertically inverted image by rearranging the pixel columns of each row from the first row in the binary image to the Mth row corresponding to the last row in reverse order.

[0037] In Fig. 6, each pixel included in a binary image with M rows and N columns is conceptually represented by one rectangular block. The pixel in the mth row and nth column is represented as (m,n). Here, the variable m takes an integer value ranging from 1 to M, and the variable n takes an integer value ranging from 1 to N.

[0038] The processor 11 can convert the binary image to a vertically inverted image by sequentially reading out pixel columns from the Mth row through the 1st row contained in the binary image to be processed and writing the pixel columns of each row to the working area of ​​the memory 13 in the order in which they were read out.

[0039] However, the binary image may include padding bits. According to known data formats, the image size of a binary image must be an integer number of bytes in both height and width. Therefore, padding bits may be added to the binary image only to adjust the image size of the binary image to an integer number of bytes in both height and width.

[0040] According to the example shown in the top row of Fig. 7, the letter "G" is represented as a 2 byte x 2 byte binary image. One square block corresponds to one pixel. Of the total 256 pixels, the pixels shown in the double-lined square blocks correspond to padding bits. For the binary image of the letter "G" shown in the top row of Fig. 7, an 11-bit x 14-bit image area is an area having valid pixels, and the rest are padding bits.

[0041] In the vertical inversion process, the processor 11 reads out the pixel columns of the last row to the first row of the valid image area of ​​the binary image in order, writes the pixel columns of each row in the read order, and then adds necessary padding bits to form a vertically inverted image. In this way, the processor 11 converts the binary image of the letter "G" shown in the upper part of Fig. 7 into the vertically inverted image shown in the lower part of Fig. 7.

[0042] Then, the processor 11 executes the transposition process shown in Fig. 8 (S125). In the transposition process, the processor 11 divides the binary image to be processed into 8-bit x 8-bit block units (S310). Hereinafter, an 8-bit x 8-bit block is referred to as an 8 x 8 block. The binary image to be processed in S125 is the binary image after being upside down by the process of S121.

[0043] In the subsequent processes of S320 to S360, processor 11 performs multiple delta swaps on the corresponding 8x8 blocks for each 8x8 block, thereby swapping the rows and columns of the 8x8 blocks.

[0044] The processor 11 repeatedly executes the transposition process in units of 8x8 blocks in this manner, and writes the transposed 8x8 blocks into the working area of ​​the memory 13 in the correct order, thereby achieving the transposition process of a binary image.

[0045] In S320, processor 11 selects one of the 8x8 blocks constituting the binary image to be processed as the 8x8 block to be processed. In the following S330, processor 11 sets the 8x8 block to be processed as the source, sets the mask to a hexadecimal value of 00aa00aa00aa00aa, sets the shift to a decimal value of 7, and executes a delta swap.

[0046] Delta swap is known as an algorithm that swaps multiple bits that make up a bit string. The source corresponds to the bit string to be processed, and the mask corresponds to binary data in which the bit in the lower digit of the two bits to be swapped in the bit string to be processed is set to 1. The shift corresponds to the distance between the bits to be swapped.

[0047] The value 00aa in hexadecimal notation is the binary value 0000000010101010. In Fig. 9, the pixels corresponding to the value "1" correspond to the pixels with numbers surrounded by a hexagon, i.e., the pixels with identification numbers 9, 11, 13, . . .

[0048] In Fig. 9, each of the 64 pixels constituting an 8x8 block is assigned an identification number ranging from 1 to 64. When the shift is a value of 7, the pixel with identification number 9 is swapped with the pixel with identification number 2. Fig. 9 illustrates how the 8x8 block in the arrangement shown on the left is transformed into the 8x8 block in the arrangement shown on the right by the delta swap performed in S330.

[0049] At S340, processor 11 sets the mask to the value 0000cccc0000cccc in hexadecimal and the shift to the value 14 in decimal, and performs a second delta swap on the 8x8 block after the delta swap at S330.

[0050] According to this setting, bit swapping is performed between the four pixels surrounded by the dashed line and the four pixels surrounded by the dashed line in Fig. 10. Fig. 10 explains that an 8x8 block in the array shown on the left is converted into an 8x8 block in the array shown on the right by the delta swap in S340.

[0051] In S350, processor 11 sets the mask to a hexadecimal value of 00000000f0f0f0f0, and sets the shift to a decimal value of 28. With these settings, processor 11 executes a third delta swap on the 8x8 block after the delta swap in S340.

[0052] According to this setting, bit swapping is performed between bit strings of 16 pixels surrounded by thick lines in Fig. 11. Fig. 11 explains that an 8x8 block of the array shown on the left is converted into an 8x8 block of the array shown on the right by delta swapping in S350. As can be seen from Fig. 11, by executing three delta swaps, the swapping of rows and columns in the 8x8 block is completed.

[0053] In S360, the processor 11 writes the 8x8 blocks after the transposition by the three delta swaps in the working area of ​​the memory 13 at the correct positions according to the arrangement of the transposed binary image.

[0054] Processor 11 repeatedly executes the processes of S320 to S360 while switching the 8x8 block to be processed until all 8x8 blocks of the binary image have been processed (No in S370). In this way, processor 11 generates a transposed image corresponding to the binary image in the working area of ​​memory 13. That is, processor 11 generates an image in which the rows and columns of the binary image are swapped.

[0055] When processor 11 has executed the processes of S320 to S360 for all 8x8 blocks of the binary image (Yes in S370), it ends the transposition process shown in Fig. 8. According to this transposition process, for example, the binary image of the letter "G" in the upper row shown in Fig. 12 is converted into the transposed image shown in the lower row.

[0056] When the transposition process (S125) is performed on the upside-down image generated in S121 by the above-mentioned method, a 90-degree rotated binary image is completed in the working area of ​​the memory 13 (see FIG. 2). The processor 11 outputs the completed 90-degree rotated binary image in S190. The output here includes file output and storage in the storage 15. The processor 11 then ends the conversion process.

[0057] On the other hand, if the processor 11 makes a negative determination in S120 and subsequently determines in S130 that the input conversion instruction is an instruction to convert a binary image into a 180-degree rotated image (Yes in S130), it executes the processes of S131, S135, and S190.

[0058] That is, the processor 11 performs a vertical flip process (S131) ​​on the binary image to be processed, and performs a horizontal flip process (S135) on the binary image after the vertical flip.

[0059] In S135, the processor 11 can execute the left-right inversion process shown in Fig. 13. This left-right inversion process includes a process of left-right inverting a pixel row in a valid image area while leaving padding bits at the right end as shown in Fig. 14. That is, by executing the left-right inversion process shown in Fig. 13, the binary image of the letter "G" in the upper row shown in Fig. 14 is converted into the left-right inverted image shown in the lower row.

[0060] When the horizontal flip process starts, the processor 11 selects a row to be processed from the binary image to be processed (S410). The binary image to be processed in S135 is the binary image after the vertical flip process in S131. In the following S420, the processor 11 determines the size of the padding bit located at the right end of the row to be processed.

[0061] In the next step S430, the processor 11 selects a bit string to be converted within the row to be processed. The bit string to be converted is a two-byte bit string. The bit string to be converted that is selected first is the rightmost two-byte bit string in the row to be processed.

[0062] For example, if the row to be processed is an N-bit bit string, the bit string to be converted is the bit string from the (N-15)th bit in the row to be processed to the Nth bit at the end of the row. Here, the first bit of the leftmost row in the row to be processed is defined as the 1st bit.

[0063] In the next S440, the processor 11 converts the bit string to be converted into a one-byte bit string by referring to the bit shift table 150 according to the size of the padding bit. Eight bit shift tables 150 are prepared according to the size of the padding bit. The one-byte bit string after conversion corresponds to the one-byte bit string of the two-byte bit string before conversion arranged in reverse order, in other words, the bit string reversed from left to right.

[0064] In Fig. 1, eight bit shift tables 150 are collectively expressed as one bit shift table 150. Figs. 15A-15D and 16A-16D show first to eighth bit shift tables 150a-150h corresponding to the eight bit shift tables 150. The first to eighth bit shift tables 150a-150h are each assigned a suffix a-h to the reference number 150. Hereinafter, when simply referring to a bit shift table 150, the description refers to one or more of the first to eighth bit shift tables 150a-150h.

[0065] There are 2^16 ways of 2-byte bit strings, that is, 65536 ways. Each bit shift table 150 describes 65536 possible 2-byte bit strings, and describes 1-byte bit strings after conversion corresponding to each possible 2-byte bit string in association with the corresponding 2-byte bit string before conversion. The bit shift table 150 is stored in the storage 15.

[0066] 15A defines, for each of 65536 different 2-byte bit strings, a 1-byte bit string after conversion of the 2-byte bit string when the padding bits are 7 bits. Since the vertical and horizontal sizes of a binary image are integer bytes, the padding bits are a maximum of 7 bits.

[0067] As shown in FIG. 15A, the first bit shift table 150a defines 256 two-byte bit strings "xhgfedcbaxxxxxxx" for each of the 256 converted one-byte bit strings "abcdefgh".

[0068] The symbol x may be understood to represent a bit that is not related to the one-byte bit string "abcdefgh" after conversion. The one-byte bit string "abcdefgh" after conversion is the one-byte bit string "hgfedcba" included in the two-byte bit string before conversion, rearranged in reverse order, that is, flipped left and right.

[0069] 15B defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bits are 6 bits. That is, the second bit shift table 150b defines 256 two-byte bit strings "xxhgfedcbaxxxxxx" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0070] 15C defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bits are five bits. That is, the third bit shift table 150c defines 256 two-byte bit strings "xxxhgfedcbaxxxxx" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0071] 15D defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bits are four bits. That is, the fourth bit shift table 150d defines 256 two-byte bit strings "xxxxhgfedcbaxxxx" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0072] 16A defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bits are three bits. That is, the fifth bit shift table 150e defines 256 two-byte bit strings "xxxxxhgfedcbaxxx" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0073] 16B defines a 1-byte bit string after conversion of the 2-byte bit string when the padding bits are 2 bits for each of 65536 2-byte bit strings. That is, the sixth bit shift table 150f defines 256 2-byte bit strings "xxxxxxhgfedcbaxx" for each of 256 1-byte bit strings "abcdefgh" after conversion.

[0074] 16C defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bit is one bit. That is, the seventh bit shift table 150g defines 256 two-byte bit strings "xxxxxxxhgfedcbax" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0075] The eighth bit shift table 150h shown in Fig. 16D defines, for each of 65536 two-byte bit strings, a one-byte bit string after conversion of the two-byte bit string when the padding bit is 0. That is, the eighth bit shift table 150h defines 256 two-byte bit strings "xxxxxxxxhgfedcba" for each of 256 one-byte bit strings "abcdefgh" after conversion.

[0076] In S440, the processor 11 refers to the bit shift table 150 according to the size of the padding bits determined in S420, and reads out a converted 1-byte bit string associated with a 2-byte bit string matching the bit string to be converted in the bit shift table 150. By this reading, the processor 11 converts the 2-byte bit string to be converted into a 1-byte bit string.

[0077] When the row to be processed has three padding bits at the right end, the processor 11 refers to the fifth bit shift table 150e and converts the bit string to be converted into a one-byte bit string as shown in Fig. 17A. Fig. 17A shows conversion when the row to be processed is a three-byte (i.e., 24-bit) bit string, has three padding bits at the right end, and the bit string to be converted is the rightmost two bytes.

[0078] In Fig. 17A, one bit is represented by one square block. A block marked with a character string consisting of the symbol # and a number corresponds to a non-padding bit, and the combination of the symbol # and a number indicates the bit identification number when the first bit in the row being processed is defined as number 1. A block marked with the symbol PD corresponds to a padding bit.

[0079] 17A, the processor 11 converts the 8-bit bit string "hgfedcba" adjacent to the left side of the three padding bits into a bit string "abcdefgh" in the reverse order by reading the converted 1-byte bit string from the bit shift table 150. That is, the bit strings from identification number 14 to identification number 21 are converted into bit strings in the reverse order.

[0080] After converting the bit string to be converted into a 1-byte bit string in S440, processor 11 writes the converted 1-byte bit string into the work area of ​​memory 13 in the following S450. After that, processor 11 determines whether left-right flipping of the row to be processed is completed (S460).

[0081] If the processor 11 determines that the left-right flip is not complete, then in S430 the processor 11 reselects the bit string to be converted. Specifically, the processor 11 sets the bit string to be converted to a 2-byte bit string located in an area shifted 1 byte to the left from the bit string to be converted the previous time in the row to be processed.

[0082] Thereafter, the processor 11 converts the reselected bit string to be converted into a one-byte bit string by referring to the bit shift table 150 (S440). According to the example shown in Fig. 17B, the processor 11 reselects, as the bit string to be converted, a two-byte bit string in an area shifted one byte to the left from the bit string to be converted shown in Fig. 17A.

[0083] The processor 11 reads out the converted 1-byte bit string corresponding to the reselected bit string to be converted from the fifth bit shift table 150e. As a result, the bit string from identification number 6 to identification number 13, which is 11 bits away from the right end (the sum of the three padding bits and the shifted 8 bits) is converted into a bit string in the reverse order.

[0084] Processor 11 writes the 1-byte bit string thus converted, corresponding to the bit string to be converted, in the working area of ​​memory 13, following the 1-byte bit string written previously (S450). Processor 11 repeatedly executes the above-mentioned processes of S430 to S450 while switching the bit string to be converted, until left-right flipping of the row to be processed is completed (S460).

[0085] As described above, the bit string to be converted is reselected so as to shift one byte at a time from the right end of the row to be processed. The order in which the conversion targets are selected is the reverse of the order of the conversion targets in the row to be processed. In the working area of ​​memory 13, a one-byte bit string arranged in reverse order by conversion is arranged from the beginning in the order in which the conversion targets were selected. Therefore, when the left-right flipping process for the row to be processed is completed, a bit string in which the left-right flipping of bits other than the padding bits is performed for the row to be processed is generated in the working area.

[0086] If all bit strings in a row to be processed are simply flipped horizontally without taking the padding bits into consideration, the padding bits will move to the beginning of the row, as shown in Fig. 19. That is, in the example shown in Fig. 19, the position of the letter "G" moves to the right as a result of the left-right flip. According to the method of this embodiment, it is possible to suppress the position shift of the binary image caused by the presence of the padding bits, as shown in Fig. 14, and to achieve good left-right flip.

[0087] To facilitate understanding of the processes of S430 to S460, the subsequent processes to those described in Fig. 17B will be described with reference to Fig. 18A and Fig. 18B. According to the example shown in Fig. 18A, processor 11 reselects, as the bit string to be converted, a 2-byte bit string in an area shifted 1 byte to the left from the conversion target shown in Fig. 17B. According to the examples shown in Fig. 17A, Fig. 17B, and Fig. 18A, the row to be processed is 3 bytes.

[0088] Therefore, when reselecting as the conversion target a bit sequence of a 2-byte area shifted one byte further to the right from the reselected conversion target in Figure 17B, the bit sequence of a 2-byte area consisting of a 1-byte area from the beginning of the row to be processed and a 1-byte area to the left of the beginning of the row to be processed will be reselected as the conversion target.

[0089] At this time, the processor 11 regards a 1-byte area to the left of the beginning of the row to be processed as an 8-bit padding bit area as shown in Fig. 18A, and sets the bit string to be converted. The processor 11 converts the bit string to be converted thus set into a 1-byte bit string by referring to the fifth bit shift table 150e.

[0090] As a result, the bit string of the row to be processed shown at the top of Fig. 17A is converted to a bit string in which the remaining bits other than the three padding bits are left-right inverted, as shown in Fig. 18B. The padding bits do not move from the right end.

[0091] In this way, with regard to the setting of the final conversion target for the row being processed, processor 11 sets a 1-byte area from the beginning of the row being processed to the lower part of the bit string being converted, and writes the 1-byte bit string after conversion based on the bit string being converted to the working area of ​​memory 13. This completes the left-right flip for the row being processed.

[0092] When processor 11 determines that left-right flipping of the row to be processed is complete (Yes in S460), it determines whether left-right flipping of the entire binary image is complete (S470). When processor 11 determines that left-right flipping of the entire binary image is not complete (No in S470), it switches the row to be processed to the next row (S410) and executes the process from S420 onward.

[0093] In the left-right reversal process shown in FIG. 13, the processor 11 forms a left-right reversed image for a binary image in the above-described procedure.

[0094] When the left-right flipping process described above is completed in S135, the processor 11 outputs in S190 the 180-degree rotated image of the binary image completed in the work area of ​​the memory 13 by this left-right flipping process. The processor 11 then ends the conversion process.

[0095] If the processor 11 makes a negative determination in S130 and subsequently determines in S140 that the input conversion instruction is an instruction to convert a binary image into a 270-degree rotated image (Yes in S140), it executes the processes of S141, S145, and S190.

[0096] That is, the processor 11 performs a transposition process (S141) on the binary image to be processed, and performs a vertical flip process (S145) on the transposed binary image. The processor 11 outputs a 270-rotation image of the binary image thus completed (S190), and ends the conversion process.

[0097] If the processor 11 determines in S110 that the input conversion instruction is an instruction to convert a mirror image into a 90-degree rotated image, then in S150, the processor 11 executes the processes of S151, S153, S155, and S190.

[0098] That is, the processor 11 performs a vertical flip process (S151) on the binary image to be processed, and performs a transposition process (S153) on the binary image after the vertical flip. The processor 11 performs a vertical flip process (S155) again on the binary image after the transposition.

[0099] The processor 11 outputs the thus completed 90-degree rotated image of the mirror image (S190), and ends the conversion process. It should be noted here that the rotation of the mirror image is completed without performing left-right flipping processing.

[0100] If the processor 11 makes a negative determination in S150 and subsequently determines in S160 that the input conversion instruction is an instruction to convert a mirror image into a 180-degree rotated image (Yes in S160), the processor 11 executes the processes of S161 and S190.

[0101] That is, the processor 11 performs a vertical flip process (S161) on the binary image to be processed. The processor 11 outputs the thus completed 180-rotated image of the mirror image (S190), and ends the conversion process.

[0102] If the processor 11 makes a negative determination in S160 and subsequently determines in S170 that the input conversion instruction is an instruction to convert a mirror image into a 270-degree rotated image (Yes in S170), the processor 11 executes the processes of S171 and S190.

[0103] That is, the processor 11 executes a transposition process (S171) on the binary image to be processed, and outputs the thus completed 270-rotation image of the mirror image (S190), thereby completing the conversion process.

[0104] In addition, if the processor 11 makes a negative decision in S170, that is, if the processor 11 determines that the input conversion instruction is an instruction to convert to a mirror image, the processor 11 executes the processes of S180 and S190.

[0105] That is, the processor 11 executes left-right flip processing (S180) on the binary image to be processed, and outputs a mirror image of the binary image thus completed (S190), thereby completing the conversion processing.

[0106] According to the electronic device 1 of the present embodiment described above, it is possible to convert a binary image so that the binary image is rotated to a specified angle without replacing the binary image with an 8-bit image. Therefore, there is no need to secure a large working area in the memory 13 to replace the binary image with an 8-bit image.

[0107] The time required to secure a working area in memory 13 accounts for a larger portion of the time required to convert a binary image as the working area becomes larger. Therefore, according to the electronic device 1 of the present embodiment, which can rotate a binary image without converting it to an 8-bit image and only requires securing a small working area in memory 13, it is possible to perform conversion processing including rotation on a binary image faster than conventional methods.

[0108] The electronic device 1 of this embodiment is also excellent in that it realizes the rotation of a binary image and the rotation of a mirror image by a combination of three processes, namely, a top-bottom flip process, a left-right flip process, and a transposition process. By realizing rotation by a combination of such simple processes, it is possible to simplify the configuration of the corresponding computer program Pr and also to speed up the processing.

[0109] The electronic device 1 of the present embodiment is also useful in that it can selectively flip the main image of a binary image excluding padding bits from left to right. That is, according to the electronic device 1 of the present embodiment, when flipping a binary image including padding bits from left to right, it is possible to prevent the padding bits from moving to the left-right flipped position.

[0110] 13, the converted bit string can be written to the memory 13 in units of bytes by referring to the bit shift table 150. That is, it is not necessary to determine the write destination address for each bit and write the bit. Therefore, the converted bit string can be written to the memory 13 efficiently.

[0111] According to this embodiment, the transposition process is realized by using delta swap, so that the transposition process can be efficiently executed with a small amount of processing.

[0112] [Other embodiments] The present disclosure is not limited to the above-described embodiment, and can adopt various aspects. For example, in the above embodiment, the processor 11 secures a work area in the memory 13 and records the binary image in the middle of conversion in the work area. However, the binary image in the middle of conversion may be recorded so as to overwrite the original binary image. In this case, the minimum information of the original binary image required for conversion may be stored in the work area of ​​the memory 13.

[0113] In the above embodiment, the reason for converting a 2-byte bit string into a 1-byte bit string by referring to the bit shift table 150 is related to the fact that the padding bits are a maximum of 7 bits. Depending on the maximum size of the padding bits, the size of the converted bit string can be set to be equal to or smaller than the size of the bit string before conversion minus the maximum size of the padding bits.

[0114] In the above embodiment, when the padding bit is 0, the eighth bit shift table 150h is used to convert the 2-byte bit string to a 1-byte bit string (S440). However, in the eighth bit shift table 150h, as shown in FIG. 16D, the upper 1-byte bit string "xxxxxxxx" of the 2-byte bit string does not affect the 1-byte bit string after conversion.

[0115] Therefore, the eighth bit shift table 150h may be replaced with an inversion table that describes the one-byte bit string "hgfedcba" before conversion and the one-byte bit string "abcdefgh" after conversion in association with each other.

[0116] The inversion table can be configured to describe the 256 possible one-byte bit strings "hgfedcba" before conversion, and to describe the one-byte bit string "abcdefgh" as the bit string after conversion in association with this.

[0117] When the padding bit is 0, the processor 11 can operate to select a 1-byte bit string, instead of a 2-byte bit string, as the bit string to be converted, byte by byte from the right end of the row to be processed to the left (S430), and convert the bit string to be converted, "hgfedcba", to a 1-byte bit string "abcdefgh" in the reverse order based on the inversion table (S440). This modified example is significant in that it can realize left-right inversion processing using an inversion table with a smaller data size than the eighth bit shift table 150h.

[0118] The function of one component in the above embodiment may be distributed among multiple components. The functions of multiple components may be integrated into one component. Some of the configurations of the above embodiment may be omitted. All aspects included in the technical idea specified by the wording of the claims are embodiments of the present disclosure.

[0119] [Technical idea disclosed in this specification] It can be understood that the present specification discloses the following technical ideas. [Item 1] A computer program for causing a computer to execute a conversion process on a two-dimensional binary image in which one pixel is represented by one bit, The conversion process includes: obtaining said binary image; Accepting angle specifications in 90 degree intervals, converting the binary image by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the binary image so that the binary image is an image rotated by the specified angle; Including, The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process is a computer program for converting a target image into a transposed image in which the rows and columns are swapped. [Item 2] The conversion process includes: converting the binary image by performing one or more of the up-down flipping process, the left-right flipping process, and the transposition process on the binary image so that a left-right flipped image of the binary image is an image rotated by the angle; 2. The computer program according to item 1, further comprising: [Item 3] the left-right flipping process includes converting each row of the target image into the left-right flipped image for each bit string of the first size based on a table that defines a left-right flipped bit string for each pattern of a bit string of a first size including padding bits that the binary image can have, and the bit string after left-right flipping is a bit string of a second size, 3. The computer program according to claim 1, wherein the second size is defined as a value equal to or less than the size of a bit string obtained by removing padding bits from a bit string of the first size. [Item 4] 4. The computer program according to item 3, wherein the left-right flipping process includes converting the target image into the left-right flipped image by setting a bit string of the first size as a conversion target for each row of the target image at the second size interval, converting each of the conversion targets into the left-right flipped bit string based on the table, and arranging the left-right flipped bit strings corresponding to each of the conversion targets in a reverse order to the order of the conversion targets in the corresponding row. [Item 5] the bit string of the first size is a bit string of 2 bytes, 5. The computer program according to item 3 or 4, wherein the bit string of the second size is a bit string of 1 byte. [Item 6] 6. The computer program according to any one of items 1 to 5, wherein the transposition process includes converting the target image into the transposed image by performing delta swaps on bit strings of corresponding partitions of a predetermined size in the target image multiple times. [Item 7] 7. The computer program according to item 6, wherein the transposition process includes converting the target image into the transposed image by performing the delta swap a plurality of times for each 8×8 bit partition as the partition of the predetermined size. [Item 8] Obtaining a two-dimensional binary image in which one pixel is represented by one bit; Accepting angle specifications in 90 degree intervals, converting the binary image by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the acquired binary image so that the binary image becomes an image rotated by the specified angle; Including, The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process is an image processing method in which a target image is converted into a transposed image in which rows and columns are interchanged. [Item 9] an acquisition unit configured to acquire a two-dimensional binary image in which one pixel is represented by one bit; A reception unit configured to receive an angle specification at 90 degree intervals; a conversion unit configured to convert the acquired binary image into an image rotated by the specified angle by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the acquired binary image; Equipped with The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process converts a target image into a transposed image in which the rows and columns of the target image are swapped. [Explanation of symbols]

[0120] 1...electronic device, 11...processor, 13...memory, 15...storage, 17...user interface, 19...communication interface, 150, 150a, 150b, 150c, 150d, 150e, 150f, 150g, 150h...bit shift table, Pr...computer program.

Claims

1. A computer program for causing a computer to execute a conversion process for a two-dimensional binary image in which one pixel is represented by one bit, The conversion process includes: obtaining said binary image; Accepting angle specifications in 90 degree intervals; converting the binary image by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the binary image so that the binary image is an image rotated by the specified angle; Including, The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process is a computer program for converting a target image into a transposed image in which the rows and columns are swapped.

2. The conversion process includes: converting the binary image by performing one or more of the up-down flipping process, the left-right flipping process, and the transposition process on the binary image so that a left-right flipped image of the binary image is an image rotated by the angle; The computer program of claim 1 , further comprising:

3. the left-right flipping process includes converting each row of the target image into the left-right flipped image for each bit string of the first size based on a table that defines a left-right flipped bit string for each pattern of a bit string of a first size including padding bits that the binary image can have, and the bit string after left-right flipping is a bit string of a second size, 2. The computer program product according to claim 1, wherein the second size is defined as a value equal to or smaller than a size of a bit string obtained by removing padding bits from a bit string of the first size.

4. 4. The computer program product of claim 3, wherein the left-right flipping process includes converting the target image into the left-right flipped image by setting a bit string of the first size as a conversion target for each row of the target image at the second size interval, converting each of the conversion targets into the left-right flipped bit string based on the table, and arranging the left-right flipped bit strings corresponding to each of the conversion targets in a reverse order to the order of the conversion targets in the corresponding row.

5. the first size bit string is a two-byte bit string, 4. The computer program product according to claim 3, wherein the bit string of the second size is a bit string of one byte.

6. The computer program according to any one of claims 1 to 5, wherein the transposition process includes converting the target image into the transposed image by performing a delta swap on the bit string of a corresponding partition multiple times for each partition of a predetermined size in the target image.

7. 7. The computer program product according to claim 6, wherein the transposition process includes converting the target image into the transposed image by performing the delta swap a plurality of times for each 8x8 bit partition as the partition of the predetermined size.

8. Obtaining a two-dimensional binary image in which one pixel is represented by one bit; Accepting angle specifications in 90 degree intervals; converting the binary image by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the acquired binary image so that the binary image becomes an image rotated by the specified angle; Including, The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process is an image processing method in which a target image is converted into a transposed image in which rows and columns are interchanged.

9. an acquisition unit configured to acquire a two-dimensional binary image in which one pixel is represented by one bit; A reception unit configured to receive an angle designation at 90 degree intervals; a conversion unit configured to convert the acquired binary image into an image rotated by the specified angle by performing one or more of a vertical flip process, a horizontal flip process, and a transposition process on the acquired binary image; Equipped with The upside-down inversion process is a process of converting a target image into an upside-down inverted image by inverting the upside-down image, The left-right inversion process is a process of converting a target image into a left-right inverted image by inverting the left-right of the target image, The transposition process converts a target image into a transposed image in which the rows and columns of the target image are swapped.

Citation Information

Patent Citations

  • Image rotating device, image reading device, and image processing device

    JP2005346436A