Image processing device
The image processing device adjusts character areas and sizes based on chapter type to fit translated text, preventing layout distortion in document images.
Patent Information
- Application Number
- JP2024068796
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2025-11-04
AI Technical Summary
Existing image processing systems distort the layout of document images when translated text does not fit within the original text area by uniformly reducing or expanding character size, disrupting the document's layout.
An image processing device that classifies chapters as single-line or multi-line, and adjusts character areas or sizes accordingly to fit translated text, preventing distortion by expanding single-line chapters or reducing character size in multi-line chapters.
Prevents document image layout distortion by ensuring translated text fits within original character areas, maintaining the document's layout integrity.
Smart Images

Figure 2025164981000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to an image processing device. [Background technology]
[0002] One image processing system (a) performs character recognition processing on a document image to obtain text data, (b) performs translation processing on that text data to obtain translated text data, and (c) if the text based on the translated text data (translated text) does not fit in the area where the text is to be pasted, reduces the character size of the text or expands the area (see, for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2015-111807 Summary of the Invention [Problem to be solved by the invention]
[0004] However, in the above-mentioned image processing system, if the translated text does not fit in the area where it is pasted, uniformly reducing the character size of the text or uniformly expanding the area will disrupt the layout of the document image.
[0005] The present invention has been made in view of the above-mentioned problems, and has as its object to provide an image processing device that prevents the layout of a document image from being distorted when text in a source language in the document image is replaced with translated text. [Means for solving the problem]
[0006] The image processing device according to the present invention includes a document image acquisition unit that acquires a document image, a character recognition processing unit that performs character recognition processing on the document image to acquire text data in a source language for each chapter and identifies a character area of the text data in the source language for each chapter, a translation processing unit that acquires translated text data corresponding to the text data in the source language, a layout analysis unit that classifies the chapters into single-line chapters and multi-line chapters, and a character removal unit that removes text in the source language from the character area, and (a) determines, for each chapter, whether text based on the translated text data can fit into the character area, and (b) determines whether text based on the translated text data can fit into the character area. (c) if the text based on the translated text data does not fit in the character area, if the chapter is a single-line chapter, expands the character area so that the text based on the translated text data can fit in the character area, and pastes the text based on the translated text data in the character area, or if the chapter is a multi-line chapter, reduces the character size of the text based on the translated text data so that the text based on the translated text data can fit in the character area, and pastes the text based on the translated text data in the character area. [Effects of the Invention]
[0007] According to the present invention, an image processing device is provided that prevents the layout of a document image from being distorted when text in a source language in the document image is replaced with translated text.
[0008] The above and other objects, features and advantages of the present invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings. [Brief explanation of the drawings]
[0009] [Figure 1] FIG. 1 is a block diagram showing the configuration of an image processing device according to an embodiment of the present invention. [Figure 2]FIG. 2 is a diagram showing an example of a document image. [Figure 3] FIG. 3 is a diagram illustrating a single-line chapter and a multi-line chapter. [Figure 4] FIG. 4 is a diagram illustrating the expansion of a character area. [Figure 5] FIG. 5 is a flowchart illustrating the operation of the image processing device according to the first embodiment. [Figure 6] FIG. 6 is a diagram showing an example of a document image including a mathematical formula. DETAILED DESCRIPTION OF THE INVENTION
[0010] Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
[0011] Embodiment 1
[0012] Fig. 1 is a block diagram showing the configuration of an image processing device according to an embodiment of the present invention. The image processing device shown in Fig. 1 is an information processing device such as a personal computer, or an electronic device such as a digital camera or an image forming device (scanner, multifunction peripheral, etc.), and includes an arithmetic processing device 1, a storage device 2, a communication device 3, a display device 4, an input device 5, an internal device 6, etc.
[0013] The arithmetic processing device 1 includes a computer, which executes programs to function as various processing units. Specifically, the computer includes a CPU (Central Processing Unit), ROM (Read Only Memory), RAM (Random Access Memory), etc., and functions as a predetermined processing unit by loading a program stored in the ROM or storage device 2 into the RAM and executing it on the CPU. The arithmetic processing device 1 may also include an ASIC (Application Specific Integrated Circuit) that functions as a specific processing unit.
[0014] The storage device 2 is a non-volatile storage device such as a flash memory, and stores programs and data necessary for the processes described below. The storage device 2 also stores setting data and the like.
[0015] The communication device 3 is a device that performs data communication with external devices, such as a network interface or a peripheral device interface. The display device 4 is a device that displays various information to the user, such as a display panel such as a liquid crystal display. The input device 5 is a device that detects user operations, such as a keyboard or a touch panel.
[0016] The internal device 6 is a device that executes a predetermined function of the image processing device. For example, if the image processing device is an image forming device, the internal device 6 includes an image reading device that optically reads a document image from a document, a printing device that prints an image on a print sheet, etc.
[0017] Here, the processing device 1 operates as the above-mentioned processing units, namely, a document image acquisition unit 11, a character recognition processing unit 12, a layout analysis unit 13, a character removal unit 14, a translation processing unit 15, a character drawing unit 16, and an output processing unit 17.
[0018] The document image acquisition unit 11 acquires a document image (image data) of a certain document from the storage device 2, communication device 3, internal device 6, etc., and stores it in RAM, etc. For example, this document is a printout output from a printing device, and this document image is optically read from the document by an image reading device. This document is, for example, a thesis. Figure 2 is a diagram showing an example of a document image. The document image 101 shown in Figure 2 includes text from multiple chapters (paragraphs, etc.).
[0019] The character recognition processor 12 performs character recognition processing on the document image 101 to acquire text data in the source language for each chapter, and identifies the character area of the text data in the source language for each chapter. This character area is a rectangular area that is a bounding box of the text for each chapter, and the coordinate values of two vertices of the rectangle that are diagonally opposite each other are identified and saved.
[0020] The layout analysis unit 13 classifies the identified chapters into single-line chapters and multi-line chapters.
[0021] 3 is a diagram illustrating single-line chapters and multi-line chapters. Specifically, as shown in FIG. 3, the layout analysis unit 13 identifies the chapter height (height of the character area) and character size (i.e., line height) for each identified chapter, and if the two match, as shown in FIG. 3(A), the layout analysis unit 13 determines that the chapter is a single-line chapter. If the chapter height is greater than the line height, as shown in FIG. 3(B), the layout analysis unit 13 determines that the chapter is a multi-line chapter. The chapter height and line height (i.e., character height) are identified by the character recognition processing unit 12.
[0022] The character removal unit 14 removes the text in the source language from the identified character region in the document image 101.
[0023] The translation processing unit 15 acquires translated text data corresponding to the text data in the above-mentioned source language. The translation processing unit 15 may execute a translation process on the text data in the above-mentioned source language using an existing method to acquire text data translated into another language, or may use the communication device 3 to access an external server that performs the translation process and acquire the translated text data from the external server. Here, the translation process is performed from Japanese to English. However, translation between other languages is also possible.
[0024] The character drawing unit 16 (a) determines for each chapter whether the text based on the translated text data can fit into the character area (i.e., the character area of the text data in the corresponding original language), and (b) if the text based on the translated text data can fit into the character area, pastes the text based on the translated text data into the character area.
[0025] Specifically, the character rendering unit 16 (a) sets the default character size (e.g., font point size) of the text based on the translated text data so that the default character height of the text based on the translated text data matches the character height of the text in the original language, and (b) determines for each chapter whether the text based on the translated text data will fit into its character area at the default character size. Note that since the number of characters changes depending on the translation, the translated text may not fit into its character area.
[0026] On the other hand, if the text based on the translated text data does not fit into the character area, the character drawing unit 16 (a) if the chapter is a single-line chapter, expands the character area so that the text based on the translated text data fits into the character area, and pastes the text based on the translated text data into the character area, or (b) if the chapter is a multi-line chapter, reduces the character size of the text based on the translated text data so that the text based on the translated text data fits into the character area, and pastes the text based on the translated text data into the character area.
[0027] Fig. 4 is a diagram illustrating the expansion of a character region. Specifically, when expanding a character region as described above, the character drawing unit 16 (a) determines whether or not there is an untranslated portion (numbers, symbols, etc.) at least at one end of the beginning or end of the text data of the chapter, and (b) if it determines that there is no such untranslated portion, as shown in Fig. 4(A), for example, it expands the character region in both directions toward the beginning and end, and if it determines that there is an untranslated portion, as shown in Fig. 4(B), for example, it expands the character region toward the beginning or end where there is no untranslated portion, without expanding toward the untranslated portion.
[0028] The output processing unit 17 outputs (prints, transmits, saves, etc.) the translated document image.
[0029] Next, a description will be given of the operation of the image processing device according to Embodiment 1. Fig. 5 is a flowchart illustrating the operation of the image processing device according to Embodiment 1.
[0030] First, the document image acquisition unit 11 acquires image data of the document image 101 from the storage device 2, the communication device 3, the internal device 6, etc. (step S1).
[0031] The character recognition processing unit 12 performs character recognition processing on the document image 101 to obtain text data in the source language for each chapter, and identifies character regions in the text data in the source language for each chapter (step S2).
[0032] The layout analysis unit 13 classifies the identified chapters into single-line chapters and multi-line chapters (step S3). The translation processing unit 15 also acquires translated text data corresponding to the text data in the source language (step S4).
[0033] The character removal unit 14 removes the text in the source language from the identified character area in the document image 101.
[0034] The character drawing unit 16 selects one unselected chapter from the multiple chapters identified for the document image 101 (step S5), and determines whether the text based on the translated text data (i.e., the translated text) fits into the character area of the corresponding text data in the original language (step S6).
[0035] If it is determined that the translated text does not fit into the character area, the character drawing unit 16 determines whether the chapter is a single-line chapter (step S7).
[0036] If it is determined that the chapter is a single-line chapter, the character drawing unit 16 expands the character area as described above (step S8), and pastes an image of the translated text into the expanded character area (step S9).
[0037] On the other hand, if it is determined that the chapter is not a single-line chapter (i.e., if the chapter is a multi-line chapter), the character drawing unit 16 reduces the character size from the default size without expanding the character area (step S10), and pastes an image of the translated text with reduced character size into the character area (step S9).
[0038] Then, the character drawing unit 16 determines whether the chapter in question is the last chapter in the document image 101 (step S11), and if the chapter in question is not the last chapter, the process returns to step S5, selects the next chapter, and executes the subsequent processes in the same manner. On the other hand, if the chapter in question is the last chapter, the translation ends, and the output processing unit 17 outputs the image data of the translated document image 101 (step S12).
[0039] As described above, according to the first embodiment, character recognition processing unit 12 performs character recognition processing on the document image to acquire text data in the source language for each chapter, and identifies the character area of the text data in the source language for each chapter. Character rendering unit 16 determines, for each chapter, whether text based on the translated text data (translated text) will fit into the character area, and if the translated text will not fit into the character area, if the chapter is a single-line chapter, expands the character area so that the translated text will fit into the character area and pastes the translated text into the character area, or reduces the character size of the translated text so that the translated text will fit into the character area and pastes the translated text into the character area if the chapter is a multi-line chapter.
[0040] This prevents inappropriate reduction of single-line chapters such as titles and headings in the document image, thereby preventing the layout of the document image from being distorted when replacing text in the original language in the document image with translated text.
[0041] Embodiment 2
[0042] FIG. 6 is a diagram showing an example of a document image including a mathematical formula.
[0043] In the second embodiment, the character recognition processing unit 12 detects text data of a mathematical formula from the text data of the source language. Specifically, the character recognition processing unit 12 determines whether the text data of the above-mentioned single-line chapter is text data of a mathematical formula, thereby detecting the text data of the mathematical formula.
[0044] When text data of a mathematical formula is detected, (a) the translation processing unit 15 does not acquire translated text data for the text data of the mathematical formula, (b) the character removal unit 14 does not remove the text in the original language corresponding to the text data of the mathematical formula, and (c) the character drawing unit 16 does not paste text based on the translated text data for the text data of the mathematical formula into the character area.
[0045] In this way, the mathematical expressions included in the document image 101 are not translated, but remain in their original form in the translated document image 101.
[0046] The other configurations and operations of the image processing device according to the second embodiment are the same as those of the first embodiment, and therefore the description thereof will be omitted.
[0047] It should be noted that various changes and modifications to the above-described embodiments will be apparent to those skilled in the art. Such changes and modifications may be made without departing from the spirit and scope of the subject matter and without diminishing its intended advantages. In other words, it is intended that such changes and modifications be included within the scope of the claims. [Industrial Applicability]
[0048] The present invention is applicable to, for example, a translation system. [Explanation of symbols]
[0049] 11 Document image acquisition unit 12 Character recognition processing section 13 Layout analysis section 14 Character removal section 15 Translation processing section 16 Character drawing section
Claims
1. a document image acquisition unit that acquires a document image; a character recognition processing unit that performs character recognition processing on the document image to acquire text data in a source language for each chapter, and identifies character regions of the text data in the source language for each chapter; a translation processing unit that acquires translated text data corresponding to the text data in the source language; a layout analysis unit for classifying the chapters into single-line chapters and multi-line chapters; a character removal unit that removes text in the source language from the character region; a character drawing unit that (a) determines, for each chapter, whether or not the text based on the translated text data can fit into the character area; (b) if the text based on the translated text data can fit into the character area, pastes the text based on the translated text data into the character area; (c) if the text based on the translated text data cannot fit into the character area, if the chapter is a single-line chapter, expands the character area so that the text based on the translated text data can fit into the character area and pastes the text based on the translated text data into the character area; if the chapter is a multi-line chapter, reduces the character size of the text based on the translated text data so that the text based on the translated text data can fit into the character area and pastes the text based on the translated text data into the character area; An image processing device comprising:
2. The image processing device according to claim 1, wherein the character drawing unit (a) sets a default character size of the text based on the translated text data so that a default character height of the text based on the translated text data matches the character height of the text in the original language, and (b) determines, for each chapter, whether the text based on the translated text data will fit into the character area at the default character size.
3. The image processing device described in claim 1, characterized in that the character drawing unit (a) when expanding the character area, determines whether there is an untranslated portion at at least one of the beginning and end of the text data of the chapter, and (b) when it determines that there is an untranslated portion, expands the character area toward the beginning or end where there is no untranslated portion, without expanding the character area toward the untranslated portion, and when it determines that there is no untranslated portion, expands the character area toward both the beginning and end.
4. the character recognition processing unit detects text data of a mathematical formula from the text data of the source language; the translation processing unit does not acquire translated text data for the text data of the mathematical formula, the character removal unit does not remove text in the source language corresponding to the text data of the mathematical formula, the character drawing unit does not paste text based on translated text data of the text data of the mathematical formula into the character area; 4. The image processing device according to claim 1, wherein:
Citation Information
Patent Citations
Image processing system, image processing method, and program
JP2015111807A