JP7362405B2 - Image processing device, image processing method, and program - Google Patents

Image processing device, image processing method, and program Download PDF

Info

Publication number
JP7362405B2
JP7362405B2 JP2019186008A JP2019186008A JP7362405B2 JP 7362405 B2 JP7362405 B2 JP 7362405B2 JP 2019186008 A JP2019186008 A JP 2019186008A JP 2019186008 A JP2019186008 A JP 2019186008A JP 7362405 B2 JP7362405 B2 JP 7362405B2
Authority
JP
Japan
Prior art keywords
color
character
image
text
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2019186008A
Other languages
Japanese (ja)
Other versions
JP2021061564A (en
Inventor
玲司 三沢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2019186008A priority Critical patent/JP7362405B2/en
Publication of JP2021061564A publication Critical patent/JP2021061564A/en
Application granted granted Critical
Publication of JP7362405B2 publication Critical patent/JP7362405B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、画像処理装置、画像処理方法、およびプログラムに関し、詳しくは、画像圧縮を文字領域と背景領域等その他の領域とで、異なる形態の圧縮を行う技術に関するものである。 The present invention relates to an image processing device, an image processing method, and a program, and more particularly to a technique for performing different types of image compression for text areas and other areas such as background areas.

この種の技術は、圧縮する画像を文字領域とそれ以外の写真領域や背景領域に分け、文字領域にはMMR方式の圧縮を行い、写真領域や背景領域にはJPEG方式の圧縮を行っている。これにより、画像の文字部分をJPEG方式で圧縮する場合に生じ得るモスキートノイズと呼ばれる画像劣化の発生を防いでいる。 This type of technology divides the image to be compressed into a text area and other photo areas and background areas, compressing the text area using the MMR method, and compressing the photo area and background area using the JPEG method. . This prevents the occurrence of image deterioration called mosquito noise that may occur when the text portion of an image is compressed using the JPEG method.

特許文献1は、このように画像の領域を分け、領域ごとに圧縮の方式を異ならせる場合に、圧縮された画像から文字領域の代表色を抽出する際にその色情報が変化するという問題を開示している。そして、この問題を解決すべく、特許文献1では、圧縮を二段階で行い、圧縮率が小さい画像に対して代表色抽出を行い、上記色情報の変化を低減するとしている。 Patent Document 1 solves the problem that when image regions are divided in this way and the compression method is different for each region, the color information changes when extracting the representative color of the text region from the compressed image. Disclosed. In order to solve this problem, Patent Document 1 states that compression is performed in two stages, representative colors are extracted for images with a low compression ratio, and changes in the color information are reduced.

特開2013-125994号公報Japanese Patent Application Publication No. 2013-125994

しかしながら、特許文献1では、段階的な圧縮で圧縮率を小さくして文字の色情報の劣化を低減しようとしても、その小さくした圧縮率に応じた色変化がわずかであったとしても生じることになる。これは、程度の差はあれ、最終的に得られる画像において画質劣化の原因となり得る。 However, in Patent Document 1, even if an attempt is made to reduce the deterioration of character color information by reducing the compression rate through stepwise compression, even if the color change is small, it will occur in accordance with the reduced compression rate. Become. This may cause image quality deterioration in the final image, although the degree may vary.

本発明の目的は、圧縮された画像における文字色抽出によって文字の色変化が生じたとしても、最終的に生成する画像における文字の色変化を防ぐことが可能な技術を提供することである。 An object of the present invention is to provide a technique that can prevent text color changes in a finally generated image even if text color changes occur due to text color extraction in a compressed image.

上記目的を達成するために本発明の一態様に係る画像処理装置は、第1画像を該第1画像より低い解像度の第2画像に変換する縮小手段と、前記縮小手段によって得られる前記第2画像の文字領域における文字色を抽出する抽出手段と、前記抽出手段によって抽出された文字色を、当該文字色の色値と前記第2画像の文字領域における背景色の色値との関係と、前記文字領域における文字のエッジを構成する画素の数と、前記文字を構成する画素の数に基づいて補正する補正手段と、前記補正手段によって文字色が補正された前記文字領域を含む画像として、前記第1画像が圧縮された圧縮画像を生成する生成手段と、を有することを特徴とする。 In order to achieve the above object, an image processing apparatus according to one aspect of the present invention includes a reduction means for converting a first image into a second image having a lower resolution than the first image, and a second image obtained by the reduction means. an extraction means for extracting a character color in a character region of an image; and a relationship between a color value of the character color extracted by the extraction means and a color value of a background color in the character region of the second image; An image including a correction means for correcting based on the number of pixels forming an edge of a character in the character area and the number of pixels forming the character, and the character area whose character color has been corrected by the correction means, The image forming apparatus is characterized by comprising a generating means for generating a compressed image in which the first image is compressed.

本発明によれば、圧縮された画像における文字色抽出によって文字の色変化が生じたとしても、最終的に生成する画像における文字の色変化を防ぐことが可能となる。 According to the present invention, even if text color changes occur due to text color extraction in a compressed image, it is possible to prevent text color changes in the finally generated image.

実施形態に係る圧縮画像における文字抽出によって文字色が変化することを説明する模式図である。FIG. 3 is a schematic diagram illustrating that a character color changes due to character extraction in a compressed image according to an embodiment. 図1における画素を拡大して示す模式図である。FIG. 2 is a schematic diagram showing a pixel in FIG. 1 in an enlarged manner. 本発明の一実施形態に係る画像処理システムの構成を示すブロック図である。1 is a block diagram showing the configuration of an image processing system according to an embodiment of the present invention. 図3に示すMFPの構成を示すブロック図である。4 is a block diagram showing the configuration of the MFP shown in FIG. 3. FIG. 本発明の一実施形態に係るデータ処理部によって実現される画像処理部の構成を示すブロック図である。FIG. 2 is a block diagram showing the configuration of an image processing section realized by a data processing section according to an embodiment of the present invention. (a)~(e)は、本発明の第1実施形態に係るデータ処理部による画像処理で生成される画像を説明する図である。(a) to (e) are diagrams illustrating images generated by image processing by the data processing unit according to the first embodiment of the present invention. 実施形態に係る文字色抽出部の処理を説明するための模式図である。FIG. 3 is a schematic diagram for explaining processing of a character color extraction unit according to the embodiment. (a)および(b)は、実施形態に係る文字色抽出処理の詳細を説明するための模式図である。(a) and (b) are schematic diagrams for explaining details of character color extraction processing according to the embodiment. 本発明の実施形態で用いるエッジ検出のためのウインドウを模式的に示す図である。FIG. 3 is a diagram schematically showing a window for edge detection used in an embodiment of the present invention. 本発明の一実施形態に係る補正係数を具体的に説明するための模式図である。FIG. 3 is a schematic diagram for specifically explaining a correction coefficient according to an embodiment of the present invention. 本発明の第1実施形態に係る補正によって文字の代表色を補正した結果を示す図である。FIG. 3 is a diagram showing the results of correcting the representative colors of characters by the correction according to the first embodiment of the present invention. (a)、(b)および(c)は、本発明の第1実施形態に係るデータ処理部が実行する処理を示すフローチャートである。(a), (b), and (c) are flowcharts showing processing executed by the data processing unit according to the first embodiment of the present invention. 本発明の第1実施形態に係る文字色補正処理を示すフローチャートである。3 is a flowchart showing text color correction processing according to the first embodiment of the present invention. 本発明の第2実施形態に係る、文字ごとに背景色および大きさが変化する画像の一例を示す模式図である。FIG. 7 is a schematic diagram showing an example of an image in which the background color and size change for each character according to the second embodiment of the present invention. 本発明の第2実施形態に係る、文字ごとの文字色補正を行った結果を示す模式図である。FIG. 7 is a schematic diagram showing the result of character color correction for each character according to the second embodiment of the present invention. 本発明の第2実施形態に係るデータ処理部が実行する処理を示すフローチャートである。It is a flowchart which shows the process performed by the data processing part based on 2nd Embodiment of this invention.

以下、本発明を実施するための形態について図面を参照して詳細に説明する。ただし、この実施形態に記載されている構成要素はあくまで例示であり、本発明の範囲をそれらに限定する趣旨のものではない。また、実施形態で説明されている構成要素の組み合わせのすべてが、課題を解決するための手段に必須のものとは限らず、種々の変形及び変更が可能である。 DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, embodiments for carrying out the present invention will be described in detail with reference to the drawings. However, the components described in this embodiment are merely examples, and the scope of the present invention is not intended to be limited thereto. Further, not all combinations of the constituent elements described in the embodiments are essential to the means for solving the problem, and various modifications and changes are possible.

先ず、本発明の実施形態を説明する前に、圧縮画像において文字の色抽出を行うことによって文字の色変化が生じることについて説明する。画像圧縮によって、一例として、解像度が300dpiの入力画像における縦横2×2画素の色が、縮小された、解像度が150dpiの画像における1画素の色にまとめられてしまうことを説明する。図1は、この色の変化を説明するための模式図である。図1において、符号601、符号602、符号603は、解像度300dpiの入力画像(第1画像)を示し、それぞれ白背景上の文字、色背景上の文字、反転文字を表している。符号604、符号605、符号606は、上記入力画像のデータを圧縮して得られる、解像度150dpiの縮小画像(第2画像)を示している。符号607、符号608、符号609は、縮小画像604~606に対して文字色抽出を行って得られる文字色を表した2値画像を示している。 First, before describing embodiments of the present invention, it will be explained that character color changes occur when character color is extracted from a compressed image. As an example, it will be explained that by image compression, the colors of 2×2 pixels in the vertical and horizontal directions in an input image with a resolution of 300 dpi are reduced to the color of 1 pixel in an image with a resolution of 150 dpi. FIG. 1 is a schematic diagram for explaining this color change. In FIG. 1, reference numerals 601, 602, and 603 indicate input images (first images) with a resolution of 300 dpi, and represent characters on a white background, characters on a colored background, and inverted characters, respectively. Reference numerals 604, 605, and 606 indicate reduced images (second images) with a resolution of 150 dpi obtained by compressing the data of the input image. Reference numerals 607, 608, and 609 indicate binary images representing text colors obtained by extracting text colors from the reduced images 604 to 606.

入力画像601を圧縮して得られえる縮小画像604は、縮小によって文字のエッジ部が薄くなっている様子(グレー(R、G、B)=(128、128、128))を示している。これは、図2に示すように、入力画像601における縦横2×2画素の色が、1画素の色にまとめられてしまう(平均化されてしまう)ためである。なお、図2は、入力画像601における画素610、および縮小画像604における画素611を拡大して示す図である。以上のように1画素の色が平均化された色となる縮小画像604に対して文字色抽出を行うと、それによって得られる2値画像607における文字色は、入力画像601における文字と比較して明るい(濃度が薄い)色となる。すなわち、縮小画像における文字の全黒画素と全グレー画素から平均を算出するため、文字色がより明るい状態((R、G、B)=(80、80、80))となる。 A reduced image 604 obtained by compressing the input image 601 shows that the edges of the characters have become thinner due to the reduction (gray (R, G, B) = (128, 128, 128)). This is because, as shown in FIG. 2, the colors of 2×2 pixels in the vertical and horizontal directions in the input image 601 are combined (averaged) into the color of one pixel. Note that FIG. 2 is an enlarged view showing a pixel 610 in the input image 601 and a pixel 611 in the reduced image 604. When text color extraction is performed on the reduced image 604 in which the color of one pixel is an averaged color as described above, the text color in the resulting binary image 607 is compared with the text in the input image 601. The color becomes brighter (lighter in density). That is, since the average is calculated from all black pixels and all gray pixels of the character in the reduced image, the character color becomes brighter ((R, G, B) = (80, 80, 80)).

入力画像602における文字についても、同様に、圧縮した画像に対する文字色抽出によって色変化を生じる。すなわち、入力画像602のピンク色の背景上の黒文字(黒(R、G、B)=(0、0、0))は、縮小画像605において、文字のエッジ部が薄くなり、背景色のピンクが混ざった状態((R、G、B)=(128、100、128))となる。そして、この縮小画像605に対して文字色抽出を行った場合の2値画像608の文字色は、比較的明るい色となり、背景色のピンク(ピンク(R、G、B)=(255、200、255))が混ざった状態((R、G、B)=(100、80、100))となる。反転文字の入力画像603についても同様であり、黒背景上の白文字(白(R、G、B)=(255、255、255))は、縮小画像606において、文字のエッジ部が濃い状態(グレー(R、G、B)=(128、128、128))となる。そして、縮小画像606に対して文字色抽出を行って得られる2値画像609は文字色が暗い状態((R、G、B)=(140、140、140))となる。これは、縮小画像606における全白画素と全グレー画素から平均を算出するためである。 Similarly, for the characters in the input image 602, color changes occur due to character color extraction from the compressed image. In other words, for black characters (black (R, G, B) = (0, 0, 0)) on a pink background in the input image 602, the edges of the characters become lighter in the reduced image 605, and the background color becomes pink. becomes a mixed state ((R, G, B)=(128, 100, 128)). Then, when text color extraction is performed on this reduced image 605, the text color of the binary image 608 becomes a relatively bright color, and the background color is pink (pink (R, G, B) = (255, 200 , 255)) is mixed ((R, G, B) = (100, 80, 100)). The same applies to the input image 603 of inverted characters, and the white characters on a black background (white (R, G, B) = (255, 255, 255)) have dark edges in the reduced image 606. (Gray (R, G, B) = (128, 128, 128)). Then, a binary image 609 obtained by performing text color extraction on the reduced image 606 has a dark text color ((R, G, B)=(140, 140, 140)). This is to calculate the average from all white pixels and all gray pixels in the reduced image 606.

以上説明したように、圧縮による縮小画像に対して文字色抽出を行うと、最終的に得られる画像の文字色が変化するという問題が生じ得る。 As described above, when text color extraction is performed on a compressed reduced image, a problem may arise in that the text color of the finally obtained image changes.

本発明の実施形態は、文字色が画像の縮小によって背景色の影響を受ける度合いに応じて、抽出した文字色の補正を行う。これにより、最終的に得られる文字色の、元の画像における文字色からの変化を低減することができる。 In an embodiment of the present invention, the extracted text color is corrected depending on the degree to which the text color is influenced by the background color due to image reduction. This makes it possible to reduce changes in the finally obtained text color from the text color in the original image.

(第1実施形態)
図3は、本発明の一実施形態に係る画像処理システムの構成を示すブロック図である。本実施形態の画像処理システムは、複合機(MFP)101とクライアントPC102が、ネットワーク103を介して接続されることによって構成されている。図3において、破線104、105はそれぞれ処理の流れを示しており、破線104は、ユーザがMFP101のスキャナを用いて紙文書を読み込ませる処理を示す。その際、ユーザは、後述するMFP101の操作部(図4の203)を用いて、スキャン画像を送信する宛先(例えば、クライアントPC102と、スキャンや送信に関わる各種設定を行うことができる。その各種設定として、ユーザは、カラーモード、ファイル形式(例えば、JPEG、TIFF、PDF、PDF(高圧縮))などを指定できる。以下では、データ書式としてPDF(高圧縮)が指定された場合について説明を行う。また、PDF(高圧縮)の詳細については後述する。破線105は、指定された各種設定に基づいて、MFP101のソフトウェアあるいはハードウェア機能を利用してデータを生成し、指定された宛先に送信する処理を示す。ここで、クライアントPC102へ送信された画像は、PDFなどのファイル形式で送信されることになるので、クライアントPC102の有する汎用的なビューアで閲覧可能である。
(First embodiment)
FIG. 3 is a block diagram showing the configuration of an image processing system according to an embodiment of the present invention. The image processing system of this embodiment is configured by connecting a multifunction peripheral (MFP) 101 and a client PC 102 via a network 103. In FIG. 3, dashed lines 104 and 105 each indicate the flow of processing, and dashed line 104 indicates processing in which the user uses the scanner of the MFP 101 to read a paper document. At that time, the user can use the operation unit (203 in FIG. 4) of the MFP 101, which will be described later, to set the destination to which the scanned image is to be sent (for example, the client PC 102) and various settings related to scanning and transmission. As settings, the user can specify the color mode, file format (for example, JPEG, TIFF, PDF, PDF (high compression)), etc. Below, we will explain the case where PDF (high compression) is specified as the data format. The details of PDF (high compression) will be described later.A broken line 105 indicates that data is generated using the software or hardware functions of the MFP 101 based on various specified settings, and is sent to the specified destination. The image is transmitted to the client PC 102 in a file format such as PDF, so it can be viewed using a general-purpose viewer included in the client PC 102.

図4は、図3に示すMFP101の構成を示すブロック図である。図4に示すように、本実施形態のMFP101は、画像入力デバイスであるスキャナ部201、画像出力デバイスであるプリンタ部202、MFP全体の制御を行う制御ユニット204、ユーザーインタフェースである操作部203等を有して構成されている。制御ユニット204は、スキャナ部201、プリンタ部202、操作部203と信号接続し、一方では、LAN209と信号接続することによって、画像情報やデバイス情報の入出力を行うコントローラである。この制御ユニット204を構成するCPU205はMFP101のシステム全体を制御するプロセッサである。同じくRAM206はCPU205が動作するためのシステムワークメモリであり、画像データを一時記憶するための画像メモリでもある。また、ROM210はブートROMであり、システムのブートプログラム等のプログラムが格納されている。さらに、記憶部211は、ハードディスクドライブ等の不揮発性記憶媒体であり、システム制御ソフトウェアや画像データを格納する。操作部I/F207は操作部(UI)203とのインターフェース部であり、操作部203に表示するための画像データを操作部203に対して出力する。また、操作部I/F207は、操作部203を介して本画像処理装置のユーザが指示した情報を、CPU205に伝える役割をする。NetworkI/F208は本画像処理装置をLAN209に接続し、データの入出力を行う。例えば、PDF形式の圧縮データを別の装置に送信したり、別の装置からPDF形式の圧縮データを受信したりする。以上のデバイスがシステムバス216上に配置される。システムバス216は、制御ユニット204内のデバイスを接続することで、情報を伝達させる。また、ImageBusI/F212は、システムバス216と、画像データを高速で転送する画像バス217とを接続し、データ構造を変換するバスブリッジである。画像バス217は、例えば、PCIバスやIEEE1394で構成される。画像バス217上には以下のデバイスが配置される。RIP部213は、PDL(ページ記述言語)コードを解析し、指定された解像度のビットマップイメージに展開する、いわゆるレンダリング処理を実現する。デバイスI/F214は、信号線218を介して画像入力デバイスであるスキャナ部201を接続し、信号線219を介して画像出力デバイスであるプリンタ部202を接続しており、画像データの同期系/非同期系の変換を行う。データ処理部215では、領域判定や圧縮処理、PDFファイル生成などの処理を行うことによって、PDF(高圧縮)を生成する。生成されたPDF(高圧縮)は、NetworkI/F208及びLAN209を介して、指定された宛先(例えば、クライアントPC102)に送信される。また、このデータ処理部215は、NetworkI/F208及びLAN209を介して受信した圧縮データの伸長を行うこともできる。伸長画像は、デバイスI/F214を介してプリンタ部202に送られ、印刷されることになる。 FIG. 4 is a block diagram showing the configuration of MFP 101 shown in FIG. 3. As shown in FIG. 4, the MFP 101 of this embodiment includes a scanner unit 201 that is an image input device, a printer unit 202 that is an image output device, a control unit 204 that controls the entire MFP, an operation unit 203 that is a user interface, etc. It is configured with The control unit 204 is a controller that inputs and outputs image information and device information by making signal connections with the scanner section 201, printer section 202, and operation section 203, and on the other hand, by making a signal connection with the LAN 209. A CPU 205 constituting the control unit 204 is a processor that controls the entire system of the MFP 101. Similarly, the RAM 206 is a system work memory for the operation of the CPU 205, and is also an image memory for temporarily storing image data. Further, the ROM 210 is a boot ROM, and stores programs such as a system boot program. Furthermore, the storage unit 211 is a nonvolatile storage medium such as a hard disk drive, and stores system control software and image data. The operation unit I/F 207 is an interface unit with the operation unit (UI) 203 and outputs image data to be displayed on the operation unit 203 to the operation unit 203. Further, the operation unit I/F 207 serves to transmit information instructed by the user of the image processing apparatus via the operation unit 203 to the CPU 205. A Network I/F 208 connects this image processing apparatus to a LAN 209 and inputs and outputs data. For example, compressed data in PDF format is transmitted to another device, or compressed data in PDF format is received from another device. The above devices are arranged on the system bus 216. System bus 216 connects devices within control unit 204 to communicate information. Further, the ImageBus I/F 212 is a bus bridge that connects the system bus 216 and an image bus 217 that transfers image data at high speed, and converts the data structure. The image bus 217 is composed of, for example, a PCI bus or IEEE1394. The following devices are arranged on the image bus 217. The RIP unit 213 analyzes a PDL (page description language) code and develops it into a bitmap image of a specified resolution, which is what is called rendering processing. The device I/F 214 is connected to the scanner section 201, which is an image input device, via a signal line 218, and to the printer section 202, which is an image output device, via a signal line 219. Performs asynchronous conversion. The data processing unit 215 generates a PDF (highly compressed) by performing processing such as region determination, compression processing, and PDF file generation. The generated PDF (highly compressed) is sent to a specified destination (for example, client PC 102) via Network I/F 208 and LAN 209. The data processing unit 215 can also decompress compressed data received via the Network I/F 208 and the LAN 209. The expanded image will be sent to the printer unit 202 via the device I/F 214 and printed.

図4に示すデータ処理部215は、以上概略を説明したように、入力データからPDF(高圧縮)を生成する画像処理部を構成する。図5は、データ処理部215によって実現される画像処理部の構成を示すブロック図であり、入力データ(RGBの多値画像データ)から出力データ(PDF(高圧縮))を生成するための各処理部を示す。データ処理部215は、プロセッサがコンピュータプログラムを実行することにより、図5に示す各処理部として機能するように構成してもよいし、その一部または全部をASICや電子回路等のハードウェアで構成するようにしてもよい。 The data processing unit 215 shown in FIG. 4 constitutes an image processing unit that generates a PDF (highly compressed) from input data, as outlined above. FIG. 5 is a block diagram showing the configuration of the image processing section realized by the data processing section 215, in which each section is used to generate output data (PDF (highly compressed)) from input data (RGB multivalued image data). The processing section is shown. The data processing unit 215 may be configured so that the processor executes a computer program to function as each processing unit shown in FIG. It may be configured.

図5において、グレー変換部301は、スキャナ部201によって読み取られた入力データ(RGBの多値画像データ)に基づいてグレーの多値画像データを生成する。図6(a)は、スキャナ部201によって読み取られた入力データ(RGBの多値画像データ)の一例を示している。入力データは、「EF」の文字列501、色背景上の「EF」の文字列502、白抜き文字の「EF」の文字列503、写真の画像504を含んでいる。これらを含む入力データに基づいて、下記の(1)式で規定される輝度Yのグレーの画像データが生成される。 In FIG. 5, a gray conversion unit 301 generates gray multi-value image data based on input data (RGB multi-value image data) read by the scanner unit 201. FIG. 6A shows an example of input data (RGB multi-value image data) read by the scanner unit 201. The input data includes a character string 501 of "EF", a character string 502 of "EF" on a colored background, a character string 503 of "EF" in outline characters, and a photographic image 504. Based on input data including these, gray image data with a luminance Y defined by the following equation (1) is generated.

Y=0.299×R+0.587×G+0.114×B ・・・(1)
本実施形態では、グレーの信号として一般的なYUVカラースペースにおいて上記(1)式で定義される輝度Yを用いるが、これに限定されない。
Y=0.299×R+0.587×G+0.114×B...(1)
In this embodiment, the luminance Y defined by the above equation (1) in the general YUV color space is used as the gray signal, but the present invention is not limited thereto.

2値化部302は、グレー変換部301で得られるグレーの多値画像データに基づき2値の画像データを生成する。本実施形態で用いる2値化の方法は、グレーの多値画像データから得られるヒストグラムから単一の閾値を算出し、その閾値によって2値化を行う方法である。図6(b)は、図6(a)に示すグレーの多値画像に基づいて2値化部302が生成する2値画像の一例を示している。 The binarization unit 302 generates binary image data based on the gray multi-value image data obtained by the gray conversion unit 301. The binarization method used in this embodiment is a method in which a single threshold value is calculated from a histogram obtained from gray multivalued image data, and binarization is performed using the threshold value. FIG. 6(b) shows an example of a binary image generated by the binarization unit 302 based on the gray multivalued image shown in FIG. 6(a).

再び図5を参照すると、第一の領域判定部303は、2値化部302で生成された2値画像データにおいて、文字領域と写真領域を検出する。これにより、図6(a)に示す入力画像の例では、図6(c)に示すように、文字領域情報(X、Y、W、H)521、522、反転文字領域であることを示す情報(以下、反転文字領域情報)523、及び写真領域情報(X、Y、W、H)524が得られる。 Referring again to FIG. 5, the first area determination unit 303 detects a text area and a photo area in the binary image data generated by the binarization unit 302. As a result, in the example of the input image shown in FIG. 6(a), as shown in FIG. 6(c), the character area information (X, Y, W, H) 521, 522 indicates that it is an inverted character area. Information (hereinafter referred to as inverted character area information) 523 and photo area information (X, Y, W, H) 524 are obtained.

上述した第一の領域判定部303による領域判定処理は、公知の領域識別手法(例えば、特開平06-068301号公報)によってなされる。具体的には、図6(b)に示す2値画像データに対して、領域判定を行う場合についてその概要説明すると次のとおりである。黒画素の輪郭を追跡することにより、黒画素塊を検出する。その結果、図6(d)に示すように黒画素塊1~6が得られる。そして、得られた黒画素塊を、大きさや形状、黒画素密度のうちの少なくとも1つを用いて、文字か反転文字か写真かに分類する。例えば、縦横比が1に近く、かつ、大きさが定められた範囲の黒画素塊1~4を、文字を構成する黒画素塊と判定する。また、矩形形状で黒画素密度が高い画素塊5は、反転文字と判定する。そして、残りの黒画素塊6は、写真を構成する画素塊と判定する。さらに、文字を構成する黒画素塊同士の距離が所定の距離(例えば、3画素)以内である場合、その黒画素塊同士を同じグループに分類する。その上で、同じグループに分類された黒画素塊の何れをも包含する外接矩形領域を文字領域と判定する。その結果、図6(d)に示す黒画素塊1、2及び黒画素塊3、4は黒画素塊同士の距離が近いと判断され、文字領域と判定される。以上の判定処理によって、図6(c)に示す情報521、522が文字領域、情報523が反転文字領域、情報524が写真領域であるという判定結果が出力される。 The area determination process by the first area determination unit 303 described above is performed by a known area identification method (for example, Japanese Patent Laid-Open No. 06-068301). Specifically, the outline of the case where area determination is performed on the binary image data shown in FIG. 6(b) is as follows. Black pixel clusters are detected by tracing the contours of black pixels. As a result, black pixel blocks 1 to 6 are obtained as shown in FIG. 6(d). Then, the obtained black pixel clusters are classified into characters, inverted characters, or photographs using at least one of size, shape, and black pixel density. For example, black pixel blocks 1 to 4 whose aspect ratio is close to 1 and whose size is within a predetermined range are determined to be black pixel blocks constituting a character. Further, a pixel block 5 having a rectangular shape and a high black pixel density is determined to be an inverted character. The remaining black pixel blocks 6 are determined to be pixel blocks constituting a photograph. Further, if the distance between black pixel blocks forming a character is within a predetermined distance (for example, 3 pixels), the black pixel blocks are classified into the same group. Then, a circumscribed rectangular area that includes any of the black pixel blocks classified into the same group is determined to be a character area. As a result, black pixel blocks 1 and 2 and black pixel blocks 3 and 4 shown in FIG. 6(d) are determined to be close to each other, and are determined to be character areas. Through the above determination process, a determination result is output that the information 521 and 522 shown in FIG. 6(c) are a text area, the information 523 is an inverted text area, and the information 524 is a photo area.

次に、第二の領域判定部304は、第一の領域判定部303で文字領域と判定された領域に対して文字切り出し処理を行う。これにより、文字単位の文字領域情報(x、y、w、h)を得ることができる。図6(e)は、図6(c)に示す文字領域情報521~523に対して、文字切り出し処理を行った結果を示している。すなわち、文字領域情報521は単位の文字領域情報541、542に、文字領域情報522は単位の文字領域情報543、544に、反転文字領域情報523は単位の文字領域情報545、546に、それぞれ分離して検出される。以上の文字切り出し処理は、文字領域の中で、横方向からの射影と縦方向からの射影にもとづき、各文字の外接矩形を文字切り矩形として切り出すことによって個々の文字を分離して検出する。 Next, the second area determination unit 304 performs character extraction processing on the area determined by the first area determination unit 303 to be a character area. Thereby, character area information (x, y, w, h) can be obtained for each character. FIG. 6(e) shows the result of character segmentation processing performed on the character area information 521 to 523 shown in FIG. 6(c). That is, the character area information 521 is separated into unit character area information 541 and 542, the character area information 522 is separated into unit character area information 543 and 544, and the inverted character area information 523 is separated into unit character area information 545 and 546. detected. The above character cutting process separates and detects individual characters by cutting out the circumscribed rectangle of each character as a character cutting rectangle in a character area based on horizontal and vertical projections.

再び図5を参照すると、MMR圧縮部305は、2値化部302によって2値化された2値画像データを入力とし、第一の領域判定部303で文字領域と判定された領域に対してMMR圧縮を行う。MMR圧縮が行われたMMRデータは、PDF生成部310へ入力される。 Referring again to FIG. 5, the MMR compression unit 305 inputs the binary image data binarized by the binarization unit 302, and applies data to the area determined to be a character area by the first area determination unit 303. Perform MMR compression. The MMR data that has been subjected to MMR compression is input to the PDF generation unit 310.

縮小部307は、スキャナ部201によって読み取られた入力データ(RGBの多値画像データ)の縮小を行い、縮小多値画像を生成する。生成された縮小多値画像は、RAM206に一時的に格納される。本実施形態では、縮小とは、低解像度への解像度変換を意味しており、例えばバイキュービック法による解像度変換を行うものである。文字領域穴埋め部308は、2値化部302によって2値化された2値画像データ、及び第一の領域判定部303で得られた文字領域情報(X、Y、W、H)を参照し、文字領域内の背景色の平均値を算出する。また、第二の領域判定部304から得られた単位文字領域情報(x、y、w、h)を参照し、算出した背景色の平均値を縮小多値画像の単位文字領域に割り当てる。つまり、算出した背景色で縮小多値画像の文字領域内の単位文字領域を穴埋めし、穴埋め縮小多値画像を生成する。これにより、後述のJPEG圧縮部309の圧縮率が向上する。JPEG圧縮部309は、文字領域穴埋め部308によって、生成された穴埋め縮小多値画像をJPEG圧縮する。JPEG圧縮されたJPEGデータは、後述するPDF生成部310へ入力される。 The reduction unit 307 reduces the input data (RGB multi-value image data) read by the scanner unit 201 to generate a reduced multi-value image. The generated reduced multilevel image is temporarily stored in the RAM 206. In this embodiment, reduction means resolution conversion to a lower resolution, such as resolution conversion using a bicubic method. The character area filling unit 308 refers to the binary image data binarized by the binarizing unit 302 and the character area information (X, Y, W, H) obtained by the first area determining unit 303. , calculate the average value of the background color within the character area. Further, with reference to the unit character area information (x, y, w, h) obtained from the second area determination unit 304, the calculated average value of the background color is assigned to the unit character area of the reduced multivalued image. That is, a unit character area in the character area of the reduced multi-valued image is filled with the calculated background color to generate a filled-in reduced multi-valued image. This improves the compression rate of the JPEG compression unit 309, which will be described later. A JPEG compression unit 309 performs JPEG compression on the filled-in reduced multivalued image generated by the character area filling unit 308 . The JPEG compressed JPEG data is input to a PDF generation unit 310, which will be described later.

文字色抽出部306は、第一の領域判定部303及び第二の領域判定部304から得られる文字領域情報(X、Y、W、H)、及び単位文字領域情報(x、y、w、h)を参照する。そして、これらを参照しながら2値化部302によって生成される2値画像データの黒部分と、縮小部307によって生成される縮小多値画像を位置対応させながら文字領域中の文字毎の代表色を抽出する。 The character color extraction unit 306 extracts character area information (X, Y, W, H) obtained from the first area determination unit 303 and the second area determination unit 304, and unit character area information (x, y, w, See h). Then, while referring to these, the black part of the binary image data generated by the binarization unit 302 and the reduced multilevel image generated by the reduction unit 307 are positioned in correspondence with each other, and the representative color of each character in the character area is Extract.

図7は、本実施形態の文字色抽出部306の処理を説明するための模式図である。図7において、符号801、符号802、符号803は縮小部307によって生成される、150dpiの縮小多値画像を示し、符号804、符号805、符号806は2値化部302によって生成される、300dpiの2値画像を示している。また、符号807、符号808、符号809は2値画像データ(300dpi)における文字毎の文字色を示し、符号810、符号811、符号812は文字色抽出後の文字色を示している。 FIG. 7 is a schematic diagram for explaining the processing of the character color extraction unit 306 of this embodiment. In FIG. 7, reference numerals 801, 802, and 803 indicate 150 dpi reduced multilevel images generated by the reduction unit 307, and reference numerals 804, 805, and 806 indicate 300 dpi reduced multilevel images generated by the binarization unit 302. A binary image is shown. Further, numerals 807, 808, and 809 indicate the character colors of each character in the binary image data (300 dpi), and numerals 810, 811, and 812 indicate the font colors after character color extraction.

ここで、文字色810は、2値画像データ804の単位文字領域情報(x、y、w、h)を参照し、その2値画像の黒部分に対応する色値を、縮小多値画像801から取得する。図8(a)および図8(b)は、この処理の詳細を説明するための模式図である。図8(a)は、300dpiの2値画像804を拡大した図である。図8(b)は、150dpiの縮小多値画像801を拡大した図である。なお、図8(a)と図8(b)とは、1画素の大きさを同じにして図示しているため、図8(b)に示す150dpiの画像は、図8(a)に示す300dpiの画像と比べて幅と高さが1/2となる。文字色抽出部306は、図8(b)に示す縮小画像において、図8(a)に示す2値画像の黒画素1503~1506の位置に対応する色値1507を取得する。このようにして、2値画像の総ての黒画素に対応する色値を取得し、平均値を算出する。 Here, the character color 810 refers to the unit character area information (x, y, w, h) of the binary image data 804, and the color value corresponding to the black part of the binary image is set to the reduced multi-value image 801. Get from. FIGS. 8(a) and 8(b) are schematic diagrams for explaining details of this process. FIG. 8A is an enlarged view of a 300 dpi binary image 804. FIG. 8(b) is an enlarged view of the 150 dpi reduced multilevel image 801. Note that since FIGS. 8(a) and 8(b) are illustrated with the same pixel size, the 150 dpi image shown in FIG. 8(b) is the same as that shown in FIG. 8(a). The width and height are 1/2 that of a 300 dpi image. The character color extraction unit 306 obtains color values 1507 corresponding to the positions of black pixels 1503 to 1506 of the binary image shown in FIG. 8(a) in the reduced image shown in FIG. 8(b). In this way, the color values corresponding to all the black pixels of the binary image are obtained, and the average value is calculated.

図7において、符号807は、このようにして得られた、2値画像における文字毎の平均値の色を示している。平均色807に示すように、文字「E」は、平均色(R、G、B)=(80、80、80)であり、文字「F」は、平均色(R、G、B)=(75、75、75)である。このように、一般には、文字「E」と文字「F」の平均色が異なる。これは、縮小多値画像801は、スキャナによって読み取られたデータを縮小したものであるからである。すなわち、文字「E」も文字「F」も画素毎に色値はばらつきをもっているからであり、また、縮小によって文字のエッジ部に生じる中間調の状態が文字「E」と文字「F」とで異なるからである。これに対し、文字毎の色値を揃えるには、類似した色、例えば、所定の輝度差、色差の範囲内である場合は、一つの代表色に置き換えることを行う。そして、本実施形態では、上記一つの代表色を選択する場合に、平均色算出前の2値画像データにおいて黒画素数が多い文字の平均色を代表色として選択する方法を用いる。すなわち、文字「E」を構成する画素数と、文字「F」を構成する画素数を比較すると、文字「E」を構成する画素数が多い。このため、文字「E」の平均色(R、G、B)=(80、80、80)を代表色として選択する。図7の符号810は、このように選択された代表色である文字「E」の平均色が、文字「F」の代表色(R、G、B)=(80、80、80)とされることを示している。 In FIG. 7, reference numeral 807 indicates the color of the average value of each character in the binary image obtained in this way. As shown in average color 807, the letter "E" has an average color (R, G, B) = (80, 80, 80), and the letter "F" has an average color (R, G, B) = (80, 80, 80). (75, 75, 75). In this way, the average colors of the letters "E" and "F" are generally different. This is because the reduced multilevel image 801 is a reduced version of data read by a scanner. In other words, the color values of both the letter "E" and the letter "F" vary from pixel to pixel, and the halftone state that occurs at the edge of the letter due to reduction differs between the letters "E" and "F". This is because they are different. On the other hand, in order to align the color values for each character, similar colors, for example, within a predetermined luminance difference and color difference range, are replaced with one representative color. In this embodiment, when selecting the one representative color, a method is used in which the average color of characters with a large number of black pixels in the binary image data before average color calculation is selected as the representative color. That is, when comparing the number of pixels that make up the letter "E" and the number of pixels that make up the letter "F," the number of pixels that make up the letter "E" is larger. Therefore, the average color (R, G, B)=(80, 80, 80) of the letter "E" is selected as the representative color. Reference numeral 810 in FIG. 7 indicates that the average color of the letter "E" which is the representative color selected in this way is the representative color (R, G, B) of the letter "F" = (80, 80, 80). Which indicates that.

同様に、図7に示す300dpiの2値画像データ805の単位文字領域情報(x、y、w、h)を参照し、その2値画像データの黒部分に対応する色値を、150dpiの縮小多値画像802から取得する。図7の符号808は、このようにして得られた文字毎の平均色を示している。平均色808に示すように、文字「E」は、平均色(R、G、B)=(100、80、100)であり、文字「F」は、平均色(R、G、B)=(95、75、95)である。また、図7の符号811は、文字「E」、文字「F」の代表色が(R、G、B)=(100、80、100)であることを示している。同様に、図7に示す300dpiの2値画像データ806の単位文字領域情報(x、y、w、h)を参照し、その2値画像データの黒部分に対応する色値を、150dpiの縮小多値画像803から取得する。図7の符号809は、このようにして得られた文字毎の平均色を示している。平均色809に示すように、文字「E」は、平均色(R、G、B)=(140、140、140)であり、文字「F」は、平均色(R、G、B)=(135、135、135)である。また、符号812は、文字「E」、文字「F」ともに代表色が(R、G、B)=(140、140、140)であることを示している。以上のように文字色抽出部306は、文字領域毎の文字色を抽出する。 Similarly, with reference to the unit character area information (x, y, w, h) of the 300 dpi binary image data 805 shown in FIG. 7, the color value corresponding to the black part of the binary image data is reduced by 150 dpi. It is acquired from the multivalued image 802. Reference numeral 808 in FIG. 7 indicates the average color for each character obtained in this manner. As shown in average color 808, the letter "E" has an average color (R, G, B) = (100, 80, 100), and the letter "F" has an average color (R, G, B) = (100, 80, 100). (95, 75, 95). Further, reference numeral 811 in FIG. 7 indicates that the representative colors of the letters "E" and "F" are (R, G, B)=(100, 80, 100). Similarly, with reference to the unit character area information (x, y, w, h) of the 300 dpi binary image data 806 shown in FIG. 7, the color value corresponding to the black part of the binary image data is reduced by 150 dpi. It is acquired from the multivalued image 803. Reference numeral 809 in FIG. 7 indicates the average color for each character obtained in this way. As shown in average color 809, the letter "E" has an average color (R, G, B) = (140, 140, 140), and the letter "F" has an average color (R, G, B) = (140, 140, 140). (135, 135, 135). Further, reference numeral 812 indicates that the representative colors of both the letter "E" and the letter "F" are (R, G, B)=(140, 140, 140). As described above, the text color extraction unit 306 extracts the text color for each text area.

再び図5を参照すると、文字色補正部311は、文字色抽出部306によって得られた文字色を補正する。これにより、入力データ(多値画像データ)の文字のエッジ部分の色値が縮小部307における縮小による背景色の影響を受けて、最終的に得られる文字色の変化を低減することができる。すなわち、文字色を、その文字色と文字の背景の色との関係に基づいて補正する。 Referring to FIG. 5 again, the text color correction unit 311 corrects the text color obtained by the text color extraction unit 306. Thereby, the color value of the edge portion of the character of the input data (multivalued image data) is influenced by the background color due to reduction in the reduction unit 307, and it is possible to reduce changes in the finally obtained character color. That is, the text color is corrected based on the relationship between the text color and the background color of the text.

本発明の一実施形態は、下記の(2)式に従って文字色を補正する。
補正後の文字色(R、G、B)=補正前の文字色(R、G、B)+{補正前の文字色(R、G、B)-背景色(R、G、B)}×補正係数 ・・・(2)
One embodiment of the present invention corrects the text color according to the following equation (2).
Text color after correction (R, G, B) = Text color before correction (R, G, B) + {Text color before correction (R, G, B) - Background color (R, G, B)} ×Correction coefficient...(2)

また、(2)式の補正係数は、以下の(3)式で算出されるものである。
補正係数=エッジを構成する画素の数/文字を構成する画素の数 ・・・(3)
Furthermore, the correction coefficient in equation (2) is calculated using equation (3) below.
Correction coefficient = Number of pixels forming an edge/Number of pixels forming a character...(3)

ここで、エッジを構成する画素は次のように検出することができる。図9は、エッジ検出のためのウインドウを模式的に示す図である。図10は、補正係数を具体的に説明するための模式図である。補正係数を具体的に説明するための模式図である。300dpiの2値画像データ(図10の符号901、符号902、符号903)に対して、図9に示すような3×3のウインドウを適用する。3×3のウインドウにおいて、「1」~「9」は、2値画像データにウインドウを適用する際の2値画像データの画素の位置を示している。このウインドウにおいて、2値画像においてエッジか否かを判断する注目画素に対してウインドウの位置「5」を対応させる。また、注目画素の周囲の画素に対して、位置「1」、「2」、「3」、「4」、「6」、「7」、「8」、「9」をそれぞれ対応させる。このようなウインドウを適用することで、2値画像における「黒=“1”」の画素を注目画素とし、順次注目画素を変えてその注目画素がエッジを構成する画素か否かを判断していく。そして、位置「5」の注目画素が「黒」であり、かつ、位置「1」、「2」、「3」、「4」、「6」、「7」、「8」、「9」の周囲の画素の内、少なくとも1つが「白=“0”」である場合、位置「5」の注目画素は、エッジを構成する画素と判断する。 Here, pixels forming an edge can be detected as follows. FIG. 9 is a diagram schematically showing a window for edge detection. FIG. 10 is a schematic diagram for specifically explaining the correction coefficient. FIG. 3 is a schematic diagram for specifically explaining a correction coefficient. A 3×3 window as shown in FIG. 9 is applied to 300 dpi binary image data (numerals 901, 902, and 903 in FIG. 10). In the 3×3 window, “1” to “9” indicate the positions of pixels of binary image data when the window is applied to the binary image data. In this window, the window position "5" is made to correspond to the pixel of interest for which it is determined whether or not it is an edge in the binary image. Furthermore, the positions "1", "2", "3", "4", "6", "7", "8", and "9" are made to correspond to the pixels around the pixel of interest, respectively. By applying such a window, a pixel with black = "1" in a binary image is set as a pixel of interest, and the pixel of interest is sequentially changed to determine whether or not the pixel of interest constitutes an edge. go. Then, the pixel of interest at position "5" is "black", and the pixel at position "1", "2", "3", "4", "6", "7", "8", "9" If at least one of the surrounding pixels is "white="0", the pixel of interest at position "5" is determined to be a pixel forming an edge.

なお、上例は、図2に示したように、300dpiの画像を150dpiの画像に縮小する際の背景の色に影響を受ける画素をエッジとして検出する例である。縮小する率が変わった場合、この背景の色に影響を受ける画素の範囲は変わる。例えば、600dpiの画像を150dpiの画像に縮小する場合は、4×4の画素が1画素に変換される。この場合、縮小によって影響を受ける画素は、4×4の画素のうち3×4の画素になる。従って、これらの画素をエッジとして検出するためのウインドウは7×7のサイズとなる。このように縮小率に応じて、用いるウインドウのサイズを変える。 Note that the above example is an example in which pixels affected by the color of the background are detected as edges when a 300 dpi image is reduced to a 150 dpi image, as shown in FIG. When the reduction rate changes, the range of pixels affected by this background color changes. For example, when reducing a 600 dpi image to a 150 dpi image, 4×4 pixels are converted to 1 pixel. In this case, the pixels affected by the reduction are 3×4 pixels out of 4×4 pixels. Therefore, the window for detecting these pixels as edges has a size of 7×7. In this way, the size of the window used is changed depending on the reduction ratio.

また、エッジは、上例では、300dpiの2値画像において検出するものとしたが、300dpiの多値画像において検出してもよい。この場合、上記「黒」は、例えば、(0、0、0)で表され、「白」は(255、255、255)で表される。また、反転文字の場合は(図10の符号903)、第一の領域判定部303でから得られる反転文字領域情報に基づいて2値画像データの白黒反転を行った後、図9のウインドウを適用することにより、エッジを構成する画素を検出する。以上のように文字毎にエッジを構成する画素を検出しその数を算出する。 Further, in the above example, edges are detected in a 300 dpi binary image, but they may also be detected in a 300 dpi multilevel image. In this case, the above "black" is represented by (0, 0, 0), and "white" is represented by (255, 255, 255), for example. In the case of inverted characters (reference numeral 903 in FIG. 10), after inverting the black and white of the binary image data based on the inverted character area information obtained from the first area determination unit 303, the window in FIG. By applying this, pixels forming an edge are detected. As described above, pixels forming edges for each character are detected and their number is calculated.

本実施形態は、補正係数を(3)式によって求めるのは次の理由からである。文字のエッジ部分の色値が、縮小部307における縮小によって背景色の影響を受けやすいため、その影響度合いを数値化する。つまり、小さい文字(小ポイント文字や、細線を含む文字)ほど、エッジを構成する画素が文字に占める割合は大きく、その文字全体として背景色の影響を受けやすい。このため、小さい文字ほど補正係数を大きくする。逆に、大きい文字ほどエッジを構成する画素が文字に占める割合は小さく、背景色の影響を受けにくい。このため、大きい文字ほど補正係数を小さくする。なお、補正係数を、例えば、文字の大きさそのものに基づいて決定してもよい。具体的には、第二の領域判定部304で得られる単位文字領域情報において、文字毎の幅と高さがわかるため、これらの情報を用いて、直接補正係数を定めることができる。 In this embodiment, the correction coefficient is calculated using equation (3) for the following reason. Since the color value of the edge portion of the character is easily influenced by the background color due to reduction in the reduction unit 307, the degree of influence is quantified. In other words, the smaller the character (small point character or character including thin lines), the larger the proportion of pixels forming edges in the character, and the more the character as a whole is more susceptible to the influence of the background color. Therefore, the smaller the character, the larger the correction coefficient. Conversely, the larger the character, the smaller the proportion of the pixels constituting the edge of the character, and the less affected by the background color. Therefore, the larger the character, the smaller the correction coefficient. Note that the correction coefficient may be determined based on the size of the character itself, for example. Specifically, since the width and height of each character are known in the unit character area information obtained by the second area determination unit 304, the correction coefficient can be directly determined using this information.

補正係数に関し、エッジ部分の色値が画像の縮小によって背景色の影響を受ける場合の、その影響度合いは、上述した画素数の比のみに限定されない。例えば、背景色の影響で変化する色の見え方次第で、例えば、画素数の比のべき乗や画素数の差とすることもできる。また、上記画素数の比に加えて、背景色と文字色の色差など、色の違いに応じて補正係数に重みづけをしてもよい。 Regarding the correction coefficient, when the color value of the edge portion is influenced by the background color due to the reduction of the image, the degree of influence is not limited to the ratio of the number of pixels described above. For example, depending on the appearance of the color that changes due to the influence of the background color, it may be a power of the ratio of the number of pixels or a difference in the number of pixels. Furthermore, in addition to the ratio of the number of pixels, the correction coefficients may be weighted according to color differences, such as the color difference between the background color and the text color.

なお、上例では、縮小による色の変化を、RGB空間の色値(R、G、B)で説明したが、これに限るものではなく、例えば、YCbCrやLab空間の色値で行ってもよい。 In addition, in the above example, the color change due to reduction was explained using color values (R, G, B) in RGB space, but it is not limited to this. For example, it can also be performed using color values in YCbCr or Lab space. good.

図10は、補正係数の例を具体的に説明するための模式図である。図10において、符号901、符号902、符号903は、2値化部302によって生成される300dpiの2値画像データを示している。符号904、符号905、符号906は、300dpiの2値画像データから得られるエッジ画像を示している。符号907、符号908、符号909は、補正係数を示している。 FIG. 10 is a schematic diagram for specifically explaining an example of a correction coefficient. In FIG. 10, reference numerals 901, 902, and 903 indicate 300 dpi binary image data generated by the binarization unit 302. Reference numerals 904, 905, and 906 indicate edge images obtained from 300 dpi binary image data. Reference numerals 907, 908, and 909 indicate correction coefficients.

先ず、小さい文字(小ポイント文字や、細線を含む文字)である場合、2値画像データ901に示すように、文字「E」を構成する画素数は110であり、文字「F」を構成する画素数は90である。従って、この場合、文字を構成する画素数(1文字平均)=100となる。次に、エッジ画像904に示すように、文字「E」のエッジを構成する画素数は36であり、文字「F」のエッジを構成する画素数は44である。従って、エッジを構成する画素数はこれらの1文字あたりの平均=40となる。以上より、補正係数は、補正係数907における演算式で算出されるように0.4となる。 First, in the case of a small character (a small point character or a character containing thin lines), as shown in binary image data 901, the number of pixels that make up the letter "E" is 110, and the number of pixels that make up the letter "F" is 110. The number of pixels is 90. Therefore, in this case, the number of pixels constituting a character (average for one character) is 100. Next, as shown in edge image 904, the number of pixels forming the edge of the letter "E" is 36, and the number of pixels forming the edge of the letter "F" is 44. Therefore, the average number of pixels forming an edge is 40 per character. From the above, the correction coefficient is 0.4 as calculated by the arithmetic expression for the correction coefficient 907.

同様に、大きい文字である場合、2値画像データ902に示すように、文字「E」を構成する画素数は450であり、文字「F」を構成する画素数は350である。従って、文字を構成する画素数(1文字平均)=400となる。次に、エッジ画像905に示すように、文字「E」のエッジを構成する画素数は85であり、文字「F」のエッジを構成する画素数は75である。従って、エッジを構成する画素数はこれらの1文字あたりの平均=80となる。結果として、補正係数は、補正係数908における演算式で算出されるように0.2となる。 Similarly, in the case of large letters, the number of pixels forming the letter "E" is 450, and the number of pixels forming the letter "F" is 350, as shown in binary image data 902. Therefore, the number of pixels constituting a character (average for one character) is 400. Next, as shown in edge image 905, the number of pixels forming the edge of the letter "E" is 85, and the number of pixels forming the edge of the letter "F" is 75. Therefore, the average number of pixels forming an edge is 80 per character. As a result, the correction coefficient becomes 0.2 as calculated by the arithmetic expression in the correction coefficient 908.

反転文字の場合、2値画像データ903に示すように、第一の領域判定部303から得られる反転文字領域情報にもとづいて、白黒反転を行った後、文字を構成する画素数、及びエッジを構成する画素数を算出する。文字「E」を構成する画素数は110であり、文字「F」を構成する画素数は90である。従って、文字を構成する画素数は、これらの1文字平均=100となる。次に、エッジ画像906に示すように、文字「E」のエッジを構成する画素数は36であり、文字「F」のエッジを構成する画素数は44である。従って、エッジを構成する画素数は1文字平均=40となる。結果として、補正係数は、補正係数909における演算式で算出されるように0.4となる。 In the case of inverted characters, as shown in binary image data 903, after black and white inversion is performed based on the inverted character area information obtained from the first area determination unit 303, the number of pixels composing the character and edges are determined. Calculate the number of constituent pixels. The number of pixels forming the letter "E" is 110, and the number of pixels forming the letter "F" is 90. Therefore, the average number of pixels constituting a character is 100 for each character. Next, as shown in edge image 906, the number of pixels forming the edge of the letter "E" is 36, and the number of pixels forming the edge of the letter "F" is 44. Therefore, the average number of pixels forming an edge is 40 per character. As a result, the correction coefficient becomes 0.4 as calculated by the calculation formula for the correction coefficient 909.

図11は、抽出した文字の代表色を(2)式によって補正した結果を示す図である。補正係数が、前述の通り0.4とすると、補正後の文字色1001に示すように、抽出された代表色810(図7)((R、G、B)=(80、80、80))が、代表色(R、G、B)=(10、10、10)に補正される。このように、抽出された代表色810は、入力画像における文字の色((R、G、B)=(0、0、0))により近い色に補正される。その結果、画像を縮小することによる背景色の文字の色に対する影響を軽減することができる。 FIG. 11 is a diagram showing the results of correcting the representative colors of extracted characters using equation (2). Assuming that the correction coefficient is 0.4 as described above, the extracted representative color 810 (FIG. 7) ((R, G, B) = (80, 80, 80) as shown in the corrected character color 1001 ) is corrected to representative colors (R, G, B) = (10, 10, 10). In this way, the extracted representative color 810 is corrected to a color closer to the character color ((R, G, B) = (0, 0, 0)) in the input image. As a result, the influence of the background color on the character color due to image reduction can be reduced.

同様に、補正後の文字色1002に示すように、代表色811(図7)((R、G、B)=(100、80、100))は、代表色(R、G、B)=(38、32、38)に補正される。さらに同じく、補正後の文字色1003に示すように、代表色812(図7)((R、G、B)=(140、140、140))は、代表色(R、G、B)=(196、196、196)に補正される。 Similarly, as shown in the corrected character color 1002, the representative color 811 (FIG. 7) ((R, G, B) = (100, 80, 100)) is the representative color (R, G, B) = Corrected to (38, 32, 38). Furthermore, as shown in the corrected character color 1003, the representative color 812 (FIG. 7) ((R, G, B) = (140, 140, 140)) is the representative color (R, G, B) = (196, 196, 196).

再び図5を参照すると、PDF生成部310は、MMR圧縮部305で圧縮されたMMRデータ、文字色補正部311より得られた文字色、JPEG圧縮部309で圧縮されたJPEGデータを合成する。そして、合成したデータをPDFフォーマット(PDFデータ)に変換することにより、PDF(高圧縮)を生成する。 Referring again to FIG. 5, the PDF generation unit 310 synthesizes the MMR data compressed by the MMR compression unit 305, the text color obtained from the text color correction unit 311, and the JPEG data compressed by the JPEG compression unit 309. Then, by converting the combined data into a PDF format (PDF data), a PDF (highly compressed) is generated.

以上説明した実施形態によれば、上記補正された文字色が合成されたPDFデータにおける文字色は、仮に文字色が合成されないPDFデータにおける文字色より、入力画像における文字色に色値が近くなる。 According to the embodiment described above, the text color in the PDF data in which the corrected text color is combined has a color value closer to the text color in the input image than the text color in the PDF data in which the text color is not combined. .

図12(a)、図12(b)および図12(c)は、上述したデータ処理部215(図4)が実行する処理を示すフローチャートである。具体的には、これらフローチャートは、データ処理部215が実行する、MMRデータの生成、JPEGデータの生成、および文字色データの生成の各処理を示している。なお、フローチャートが示す処理を実行するプログラムは、図4のROM210、または、記憶部211に格納され、CPU205にて実行される。CPU205は、ImageBusI/F212、システムバス216、画像バス217を用いて、データ処理部215とデータのやり取りをすることが可能である。また、フローチャートの説明における記号「S」は、ステップを表すものとする。この点、以下のフローチャートの説明においても同様とする。 FIGS. 12(a), 12(b), and 12(c) are flowcharts showing the processing executed by the data processing unit 215 (FIG. 4) described above. Specifically, these flowcharts show each process executed by the data processing unit 215: generation of MMR data, generation of JPEG data, and generation of text color data. Note that a program that executes the processing shown in the flowchart is stored in the ROM 210 or the storage unit 211 in FIG. 4, and is executed by the CPU 205. The CPU 205 can exchange data with the data processing unit 215 using the ImageBus I/F 212, the system bus 216, and the image bus 217. Further, the symbol "S" in the explanation of the flowchart represents a step. This point also applies to the description of the flowcharts below.

<MMRデータの生成>
図12(a)は、MMRデータの生成処理を示している。S401にて、グレー変換を行う。CPU205は、スキャナ部201によって読み取られた入力データ(RGBの多値画像データ)からグレーの多値画像データを生成する処理を実行する。この処理の詳細はグレー変換部301の動作説明において前述した通りである。次に、S402にて、2値化を行う。CPU205は、S401で得られたグレーの多値画像データから2値画像データを生成する処理を実行する。この処理の詳細は2値化部302の動作説明において前述した通りである。さらに、S403にて、第一の領域判定を行う。CPU205は、S402にて生成された2値画像データから、文字領域と写真領域を検出する処理を実行する。ここで得られた文字領域情報(X、Y、W、H)、及び反転文字領域情報は、RAM206に一時的に格納される。この処理の詳細は、第一の領域判定部303の動作説明において前述した通りである。次に、S404にて、第二の領域判定を行う。CPU205は、S403にて文字領域と判定された領域に対して文字切り出し処理を行う。ここで得られた単位文字領域情報(x、y、w、h)は、RAM206に一時的に格納される。この処理の詳細は、第二の領域判定部304の動作説明において前述した通りである。最後に、S405にて、MMR圧縮を行う。CPU205は、S402にて2値化された2値画像データを入力とし、S403にて文字領域と判定された領域(前記2値画像データ上の文字領域)をMMR圧縮する。この処理の詳細は、MMR圧縮部305の動作説明において前述した通りである。
<Generation of MMR data>
FIG. 12(a) shows the MMR data generation process. In S401, gray conversion is performed. The CPU 205 executes processing for generating gray multi-value image data from the input data (RGB multi-value image data) read by the scanner unit 201 . The details of this processing are as described above in the explanation of the operation of the gray conversion unit 301. Next, in S402, binarization is performed. The CPU 205 executes processing to generate binary image data from the gray multi-value image data obtained in S401. The details of this processing are as described above in the explanation of the operation of the binarization section 302. Furthermore, in S403, a first region determination is performed. The CPU 205 executes a process of detecting a text area and a photo area from the binary image data generated in S402. The character area information (X, Y, W, H) and inverted character area information obtained here are temporarily stored in the RAM 206. The details of this process are as described above in the explanation of the operation of the first area determining section 303. Next, in S404, a second region determination is performed. The CPU 205 performs character extraction processing on the area determined to be a character area in S403. The unit character area information (x, y, w, h) obtained here is temporarily stored in the RAM 206. The details of this process are as described above in the explanation of the operation of the second region determining section 304. Finally, in S405, MMR compression is performed. The CPU 205 inputs the binary image data binarized in S402, and performs MMR compression on the area determined to be a text area (the text area on the binary image data) in S403. The details of this processing are as described above in the explanation of the operation of the MMR compression section 305.

<JPEGデータの生成>
図12(c)は、JPEGデータの生成処理を示すフローチャートである。S420にて、CPU205は、入力データ(RGBの多値画像データ)の縮小を行い、縮小多値画像を生成する。生成された縮小多値画像は、RAM206に一時的に格納される。この処理の詳細は、縮小部307の動作説明において前述した通りである。次に、S421にて、文字領域の穴埋め処理を行う。CPU205は、ステップS402にて生成された2値画像データ、及びS403にて得られた文字領域情報(X、Y、W、H)を参照し、文字領域内の背景色の平均値を算出する。次に、S404にて得られた単位文字領域情報(x、y、w、h)を参照し、算出した背景色の平均値を縮小多値画像の単位文字領域に割り当てる。つまり、算出した背景色で縮小多値画像の単位文字領域を穴埋めし、穴埋め縮小多値画像を生成する。この文字領域穴埋め処理の詳細は、文字領域穴埋め部308の動作説明において前述した通りである。さらに、S422にて、CPU205は、S421にて生成された穴埋め縮小多値画像をJPEG圧縮する。JPEG圧縮の詳細は、JPEG圧縮部309の動作説明において前述した通りである。以上のように生成されたJPEGデータは、RAM206に一時的に格納される。
<Generation of JPEG data>
FIG. 12(c) is a flowchart showing the JPEG data generation process. In S420, the CPU 205 reduces the input data (RGB multi-value image data) to generate a reduced multi-value image. The generated reduced multilevel image is temporarily stored in the RAM 206. The details of this processing are as described above in the explanation of the operation of the reduction unit 307. Next, in S421, blank filling processing for the character area is performed. The CPU 205 refers to the binary image data generated in step S402 and the character area information (X, Y, W, H) obtained in S403, and calculates the average value of the background color in the character area. . Next, referring to the unit character area information (x, y, w, h) obtained in S404, the calculated average value of the background color is assigned to the unit character area of the reduced multivalued image. That is, the unit character area of the reduced multi-valued image is filled with the calculated background color to generate a filled-in reduced multi-valued image. The details of this character area filling process are as described above in the explanation of the operation of the character area filling section 308. Further, in S422, the CPU 205 performs JPEG compression on the hole-filling reduced multivalued image generated in S421. The details of JPEG compression are as described above in the explanation of the operation of the JPEG compression unit 309. The JPEG data generated as described above is temporarily stored in the RAM 206.

<文字色データの生成>
図12(b)は、文字色データの生成処理を示すフローチャートである。S410にて、CPU205は、2値画像データ、及びS403によって得られた文字領域情報(X、Y、W、H)を参照することによって、最初の文字領域を探索する。そして、S411にて、CPU205は、注目領域が文字領域であるか否かを判定する。注目領域が文字領域であるとの判定結果を得た場合(S411のYES)、処理をS412へ移行する。注目領域が文字領域ではないとの判定結果を得た場合(S411のNO)、処理をS414へ移行する。次に、S412にて、CPU205は、S403にて得られる文字領域情報(X,Y、W、H)、及びS404にて得られる単位文字領域情報(x、y、w、h)を参照する。そして、これら情報を参照しながら、2値画像データの黒部分と、S420にて生成される縮小多値画像を位置対応させながら文字領域毎の文字色を抽出する。この代表色の抽出方法については、文字色抽出部306の動作説明において前述した通りである。
<Generation of text color data>
FIG. 12(b) is a flowchart showing the text color data generation process. In S410, the CPU 205 searches for the first character area by referring to the binary image data and the character area information (X, Y, W, H) obtained in S403. Then, in S411, the CPU 205 determines whether the attention area is a character area. If a determination result is obtained that the region of interest is a character region (YES in S411), the process moves to S412. If a determination result is obtained that the attention area is not a character area (NO in S411), the process moves to S414. Next, in S412, the CPU 205 refers to the character area information (X, Y, W, H) obtained in S403 and the unit character area information (x, y, w, h) obtained in S404. . Then, referring to this information, the character color of each character area is extracted while positionally corresponding the black portion of the binary image data and the reduced multivalued image generated in S420. The method for extracting this representative color is as described above in the explanation of the operation of the character color extraction section 306.

次に、S413にて、CPU205は、S412にて得られた文字領域毎の文字色を補正する。図13は、文字色補正処理を示すフローチャートである。なお、本実施形態では、図13が示すフローチャートの処理は、文字領域毎に実行される。また、後述する第2実施形態では、図13が示すフローチャートの処理は、単位文字領域毎に実行される。 Next, in S413, the CPU 205 corrects the character color for each character area obtained in S412. FIG. 13 is a flowchart showing text color correction processing. Note that in this embodiment, the process of the flowchart shown in FIG. 13 is executed for each character area. Furthermore, in a second embodiment to be described later, the process of the flowchart shown in FIG. 13 is executed for each unit character area.

図13において、先ず、S701にて、CPU205は、2値画像データ、及びS403にて得られる文字領域情報(X,Y、W、H)を参照し、文字領域内における背景色を算出する。次に、S702にて、CPU205は、S402にて生成された2値画像データからエッジ検出を行う。エッジ検出については、文字色補正部311の動作説明において前述した通りである。さらに、S703にて、CPU205は、S402にて生成された2値画像データと、S702にて生成されたエッジ検出画像を用いて、補正係数を算出する。補正係数の算出については、文字色補正部311の動作説明において前述した通りである。最後に、S704にて、CPU205は、S406にて抽出された文字色と、S701にて算出された背景色と、S703にて算出された補正係数を用いて文字色を補正する。文字色の補正については、文字色補正部311の動作説明において前述した通りである。 In FIG. 13, first, in S701, the CPU 205 refers to the binary image data and the character area information (X, Y, W, H) obtained in S403, and calculates the background color in the character area. Next, in S702, the CPU 205 performs edge detection from the binary image data generated in S402. Edge detection is as described above in the explanation of the operation of the text color correction section 311. Furthermore, in S703, the CPU 205 calculates a correction coefficient using the binary image data generated in S402 and the edge detection image generated in S702. The calculation of the correction coefficient is as described above in the explanation of the operation of the text color correction section 311. Finally, in S704, the CPU 205 corrects the text color using the text color extracted in S406, the background color calculated in S701, and the correction coefficient calculated in S703. The text color correction is as described above in the explanation of the operation of the text color correction unit 311.

再び図12を参照すると、S413の文字色補正の後、S414にて、CPU205は、全文字領域の探索が終了したか否かを判定する。全文字領域の探索が終了しているとの判定結果を得た場合(S414のYES)、本処理を終了する。全文字領域の探索が終了していないとの判定結果を得た場合(S414のNO)、処理をS415へ移行する。S415にて、CPU205は、次の文字領域を探索する。S415の探索の後、処理をS411へ移行し、S415で探索された次の文字列領域に対しS411以降の処理が行われる。以上のように生成された文字領域毎の文字色データは、RAM206に一時的に格納される。 Referring again to FIG. 12, after the text color correction in S413, in S414, the CPU 205 determines whether the search for all character areas has been completed. If it is determined that the search for all character areas has been completed (S414: YES), the process ends. If it is determined that the search for all character areas has not been completed (NO in S414), the process moves to S415. In S415, the CPU 205 searches for the next character area. After the search in S415, the process moves to S411, and the processes from S411 onwards are performed on the next character string area searched in S415. The character color data for each character area generated as described above is temporarily stored in the RAM 206.

<PDF(高圧縮)の生成>
図12(a)、図12(b)および図12(c)に示すフローチャートで上述したように、MMRデータ、JPEGデータ、文字色データが生成され、CPU205は、これらのデータをPDF形式に変換することでPDF(高圧縮)を生成する。
<Generation of PDF (highly compressed)>
As described above in the flowcharts shown in FIGS. 12(a), 12(b), and 12(c), MMR data, JPEG data, and text color data are generated, and the CPU 205 converts these data into PDF format. This will generate a PDF (highly compressed).

以上のように、本実施形態は、PDF(高圧縮)において文字の周囲の色(背景色)、及び文字のエッジ情報にもとづいて文字色抽出後の文字色を補正する。これにより、文字色に周囲の色が混ざってしまうことによる輝度、彩度などの文字色の変化を低減させることが可能となる。 As described above, the present embodiment corrects the character color after character color extraction in PDF (high compression) based on the color around the character (background color) and the edge information of the character. This makes it possible to reduce changes in the text color, such as brightness and saturation, due to mixing of surrounding colors with the text color.

(第2実施形態)
上述した第1実施形態では、文字領域内における背景色を算出し、文字領域内の文字列の文字色を一括して補正を行う場合について説明した。本実施形態では、文字毎に文字色を補正する場合について説明する。これにより、文字領域内で文字ごとに背景色が変化する場合や、文字の大きさが変化する場合には、それぞれの文字に適した文字色補正が可能となる。なお、以下では、第1実施形態と同様の処理については、その説明を省略する。
(Second embodiment)
In the first embodiment described above, a case has been described in which the background color within a character area is calculated and the character colors of character strings within the character area are collectively corrected. In this embodiment, a case will be described in which the character color is corrected for each character. As a result, when the background color changes for each character within the character area or when the size of the characters changes, it becomes possible to perform character color correction suitable for each character. Note that, below, descriptions of processes similar to those in the first embodiment will be omitted.

図14は、同一の文字領域内で背景色が変化し、かつ文字の大きさが変化する画像の一例を示す模式図である。図14において、符号1101は、入力データ(多値画像データ)を示している。ここで、文字「E」は、大文字であり、背景色は白((R、G、B)=(255、255、255))である。文字「F」は、小文字であり、背景色はピンク((R、G、B)=(255、200、255))である。符号1102は、入力データ1101が縮小部(図5の符号307)によって縮小された縮小多値画像を示している。第1実施形態で前述したように、文字のエッジ部では、文字色に背景の色が混ざっていることがわかる。符号1103は、入力データ1101が2値化部(図5の符号307)によって2値化された2値画像データを示している。文字「E」と文字「F」それぞれの単位文字領域情報(x、y、w、h)を示している。そして、符号1104は、2値画像における文字毎の文字色を示し、文字「E」の平均色が((R、G、B)=(50、50、50))であり、文字「F」の平均色が((R、G、B)=(95、75、95))であることを示している。 FIG. 14 is a schematic diagram showing an example of an image in which the background color changes and the character size changes within the same character area. In FIG. 14, reference numeral 1101 indicates input data (multivalued image data). Here, the letter "E" is a capital letter, and the background color is white ((R, G, B) = (255, 255, 255)). The letter "F" is a lowercase letter, and the background color is pink ((R, G, B) = (255, 200, 255)). Reference numeral 1102 indicates a reduced multilevel image obtained by reducing the input data 1101 by a reduction unit (reference numeral 307 in FIG. 5). As described above in the first embodiment, it can be seen that the background color is mixed with the character color at the edge portion of the character. Reference numeral 1103 indicates binary image data obtained by binarizing the input data 1101 by a binarization unit (reference numeral 307 in FIG. 5). The unit character area information (x, y, w, h) of each of the character "E" and the character "F" is shown. The code 1104 indicates the character color of each character in the binary image, and the average color of the character "E" is ((R, G, B) = (50, 50, 50)), and the average color of the character "F" is It shows that the average color of is ((R, G, B) = (95, 75, 95)).

ここで、第1実施形態では、文字毎の色値を揃えるため、文字色の補正前に、類似した色、例えば、所定の輝度差、色差の範囲内にある色を、一つの代表色に置き換えることとしている。これに対し、本実施形態では、文字色の補正前ではなく、文字色の補正後に、一つの代表色に置き換える。これにより、同一の文字領域内に類似した色がある場合、文字色補正後も同じ色値にすることが可能となり、また、異なる色の場合(類似した色ではない場合)は、それぞれの文字に適した文字色補正が可能となる。 In the first embodiment, in order to align the color values for each character, before correcting the character color, similar colors, for example, colors within a predetermined brightness difference and color difference range, are combined into one representative color. We are planning to replace it. In contrast, in this embodiment, the color is replaced with one representative color after the text color is corrected, not before the text color is corrected. As a result, if there are similar colors in the same character area, it is possible to have the same color value even after character color correction, and if the colors are different (not similar colors), each character This enables text color correction suitable for

図15は、図14の文字色1104に示す文字毎の平均色を用いて、文字毎に文字色補正を行った結果を示す模式図である。図15に示すように、文字「E」では、背景色(R、G、B)=(255、255、255)と補正係数0.19(=85/450)を用い、文字「F」では、背景色(R、G、B)=(255、200、255)と、補正係数0.5(=44/90)を用いる。その結果、文字「E」は、文字色(R、G、B)=(11、11、11)に補正され、文字「F」は、文字色(R、G、B)=(15、12、15)に補正される。 FIG. 15 is a schematic diagram showing the result of character color correction for each character using the average color for each character shown in the character color 1104 in FIG. As shown in Figure 15, for the letter "E", background color (R, G, B) = (255, 255, 255) and correction coefficient 0.19 (=85/450) are used, and for the letter "F", , background color (R, G, B)=(255, 200, 255) and a correction coefficient of 0.5 (=44/90). As a result, the character "E" is corrected to the character color (R, G, B) = (11, 11, 11), and the character "F" is corrected to the character color (R, G, B) = (15, 12). , 15).

以上のように補正された、文字「E」の文字色(R、G、B)=(11、11、11)と、文字「F」の文字色(R、G、B)=(15、12、15)は、所定の輝度差(例えば10)の範囲内にある。本実施形態では、この範囲内に色を類似した色とする。従って、文字毎の色値を揃えるため、一つの代表色に置き換える。「E」を構成する画素数と、「F」を構成する画素数を比較し、「E」を構成する画素数が多いため、文字「E」の平均色(R、G、B)=(11、11、11)を代表色として選択する。 The font color of the letter “E” (R, G, B) = (11, 11, 11) and the font color of the letter “F” (R, G, B) = (15, 12, 15) are within a predetermined luminance difference (for example, 10). In this embodiment, similar colors are used within this range. Therefore, in order to equalize the color values for each character, they are replaced with one representative color. Comparing the number of pixels that make up "E" and the number of pixels that make up "F", since the number of pixels that make up "E" is large, the average color of the letter "E" (R, G, B) = ( 11, 11, 11) are selected as representative colors.

このように、本実施形態によっても、文字色を補正して最終的に得られる文字の色は、入力画像データにおける文字の色により近いものとなる。その結果、文字色に背景の色が混ざってしまうことによる輝度、彩度など文字色の変化を低減させることが可能となる。 In this way, according to this embodiment as well, the color of the characters finally obtained by correcting the color of the characters is closer to the color of the characters in the input image data. As a result, it is possible to reduce changes in the text color, such as brightness and saturation, due to the background color being mixed with the text color.

図16は、本発実施形態に係るデータ処理部215(図4)が実行する処理を示すフローチャートである。フローチャートに示す処理を実行するプログラムは、図4のROM210、または、記憶部211に格納され、CPU205にて実行される。このとき、CPU205は、ImageBusI/F212、システムバス216、画像バス217を用いて、データ処理部215とデータのやり取りをすることができる。以下では、第1実施形態と異なる部分である文字毎に文字色を補正する処理について図16に示すフローチャートを参照して説明する。この説明では、第1実施形態において前述した図12、および図13に示す処理を適宜参照する。また、図16に示すS410、S411、S414およびS415の処理については、図12(b)のS410、S411、S414およびS415と同様の処理であるためそれらの説明を省略する。 FIG. 16 is a flowchart showing the processing executed by the data processing unit 215 (FIG. 4) according to the present embodiment. A program that executes the processing shown in the flowchart is stored in the ROM 210 or the storage unit 211 in FIG. 4, and is executed by the CPU 205. At this time, the CPU 205 can exchange data with the data processing unit 215 using the ImageBus I/F 212, the system bus 216, and the image bus 217. Below, the process of correcting the character color for each character, which is different from the first embodiment, will be explained with reference to the flowchart shown in FIG. 16. In this description, the processes shown in FIG. 12 and FIG. 13 described above in the first embodiment will be referred to as appropriate. Further, the processes of S410, S411, S414, and S415 shown in FIG. 16 are the same as the processes of S410, S411, S414, and S415 of FIG. 12(b), so the description thereof will be omitted.

先ず、S1301にて、CPU205は、S411にて文字領域と判定された領域に対して、S404にて得られる単位文字領域情報(x、y、w、h)を参照し、最初の単位文字領域を探索する処理を実行する。次に、S1302にて、CPU205は、S404にて得られる単位文字領域情報(x、y、w、h)を参照する。そして、この情報を参照して2値画像データの黒部分と、S420にて生成される縮小多値画像を位置対応させながら文字領域中の単位文字領域毎の文字色を抽出する処理を実行する。代表色の抽出方法については、文字色抽出部306の動作において前述した通りである。 First, in S1301, the CPU 205 refers to the unit character area information (x, y, w, h) obtained in S404 for the area determined to be a character area in S411, and selects the first unit character area. Execute processing to search for. Next, in S1302, the CPU 205 refers to the unit character area information (x, y, w, h) obtained in S404. Then, referring to this information, a process is executed to extract the character color for each unit character area in the character area while positionally corresponding the black part of the binary image data and the reduced multivalued image generated in S420. . The representative color extraction method is as described above in the operation of the character color extraction unit 306.

次に、S1303にて、CPU205は、S1302にて得られた文字色を補正する。ここで、第1実施形態では、この補正処理を文字領域毎に実行した。本実施形態では、図16に示す処理を単位文字領域毎に実行する。 Next, in S1303, the CPU 205 corrects the character color obtained in S1302. In the first embodiment, this correction process is performed for each character area. In this embodiment, the process shown in FIG. 16 is executed for each unit character area.

S1304にて、CPU205は、全単位文字領域の探索が終了したか否かを判定する処理を実行する。全単位文字領域の探索が終了しているとの判定結果を得た場合(S1304のYES)、処理をS1305へ移行する。全単位文字領域の探索が終了していないとの判定結果を得た場合(S1304のNO)、処理をS1306へ移行する。S1306にて、CPU205は、次の単位文字領域を探索する。S1306の探索の後、処理をS1302へ移行し、S1306で探索された次の単位文字列領域に対しS1302以降の処理が行われる。 In S1304, the CPU 205 executes processing to determine whether the search for all unit character areas has been completed. If it is determined that the search for all unit character areas has been completed (YES in S1304), the process moves to S1305. If it is determined that the search for all unit character areas has not been completed (NO in S1304), the process moves to S1306. In S1306, the CPU 205 searches for the next unit character area. After the search in S1306, the process moves to S1302, and the processes from S1302 onwards are performed on the next unit character string area searched in S1306.

S1305にて、CPU205は、S1303にて得られた文字色補正後の文字色を代表色に置き換える処理を実行する。同一の文字領域内に類似した色、例えば、所定の輝度差、色差の範囲内であれば、一つの代表色に置き換える。 In S1305, the CPU 205 executes processing to replace the corrected text color obtained in S1303 with a representative color. If a color is similar within the same character area, for example, within a predetermined brightness difference and color difference range, it is replaced with one representative color.

以上のように、文字毎に文字色を補正することにより、文字領域内で背景色が変化する場合や、文字の大きさが変化する場合には、それぞれの文字に適した文字色補正が可能となる。また、同一の文字領域内に類似した色がある場合、文字色補正後も同じ色値にすることが可能となり、異なる色の場合(類似した色ではない場合)は、それぞれの文字に適した文字色補正が可能となる。 As described above, by correcting the font color for each character, if the background color changes within the character area or the font size changes, the font color can be corrected to suit each character. becomes. In addition, if there are similar colors in the same character area, it is possible to maintain the same color value even after character color correction, and if the colors are different (not similar colors), the color value suitable for each character can be set. Text color correction becomes possible.

(その他の実施形態)
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other embodiments)
The present invention provides a system or device with a program that implements one or more functions of the embodiments described above via a network or a storage medium, and one or more processors in a computer of the system or device reads and executes the program. This can also be achieved by processing. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

306 文字色抽出部
307 縮小部
310 PDF生成部
311 文字色補正部
306 Text color extraction unit 307 Reduction unit 310 PDF generation unit 311 Text color correction unit

Claims (6)

第1画像を該第1画像より低い解像度の第2画像に変換する縮小手段と、
前記縮小手段によって得られる前記第2画像の文字領域における文字色を抽出する抽出手段と、
前記抽出手段によって抽出された文字色を、当該文字色の色値と前記第2画像の文字領域における背景色の色値との関係と、前記文字領域における文字のエッジを構成する画素の数と、前記文字を構成する画素の数に基づいて補正する補正手段と、
前記補正手段によって文字色が補正された前記文字領域を含む画像として、前記第1画像が圧縮された圧縮画像を生成する生成手段と、
を有することを特徴とする画像処理装置。
Reduction means for converting the first image into a second image having a lower resolution than the first image;
extraction means for extracting a character color in a character area of the second image obtained by the reduction means;
The character color extracted by the extraction means is determined based on the relationship between the color value of the character color and the color value of the background color in the character area of the second image , and the number of pixels forming the edge of the character in the character area. , a correction means for correcting based on the number of pixels constituting the character ;
generation means for generating a compressed image in which the first image is compressed as an image including the character area whose character color has been corrected by the correction means;
An image processing device comprising:
前記補正手段は、前記文字色の色値と前記第2画像の文字領域における背景色の色値との関係によって求められる値に、補正係数を乗じることにより、前記文字色を補正する
ことを特徴する請求項1に記載の画像処理装置。
The correction means corrects the text color by multiplying a value obtained from the relationship between the color value of the text color and the color value of a background color in the text area of the second image by a correction coefficient. The image processing apparatus according to claim 1.
前記補正手段は、
補正後の文字色=補正前の文字色+(補正前の文字色-背景色}×補正係数
ここで、補正係数は、前記第2画像において、(文字領域における文字のエッジを構成する画素の数)/(文字を構成する画素の数)である
で表される式によって前記文字色を補正する
ことを特徴とする請求項に記載の画像処理装置。
The correction means is
Text color after correction = Text color before correction + (Text color before correction - Background color) x Correction coefficient Here, the correction coefficient is determined by 3. The image processing apparatus according to claim 2 , wherein the character color is corrected by an equation expressed as: (number of pixels constituting a character)/(number of pixels constituting a character).
前記生成手段は、前記圧縮画像として、
前記第1画像から生成される2値画像に対する領域判定で取得される前記文字領域の情報に基づき前記2値画像から生成されるMMRデータと、
前記第2画像から生成されるJPEGデータと、
前記補正された文字色と、
に基づいてPDFデータを生成する
ことを特徴とする請求項1からのいずれか1項に記載の画像処理装置。
The generating means generates, as the compressed image,
MMR data generated from the binary image based on information on the character area obtained by area determination on the binary image generated from the first image;
JPEG data generated from the second image;
the corrected text color;
The image processing apparatus according to any one of claims 1 to 3 , wherein the image processing apparatus generates PDF data based on.
第1画像を該第1画像より低い解像度の第2画像に変換する縮小工程と、
前記縮小工程にて得られる前記第2画像の文字領域における文字色を抽出する抽出工程と、
前記抽出工程にて抽出された文字色を、当該文字色の色値と前記第2画像の文字領域における背景色の色値との関係と、前記文字領域における文字のエッジを構成する画素の数と、前記文字を構成する画素の数に基づいて補正する補正工程と、
前記補正工程にて文字色が補正された前記文字領域を含む画像として、前記第1画像が圧縮された圧縮画像を生成する生成工程と、
を有することを特徴とする画像処理方法。
a reduction step of converting the first image into a second image having a lower resolution than the first image;
an extraction step of extracting a character color in a character area of the second image obtained in the reduction step;
The character color extracted in the extraction step is determined based on the relationship between the color value of the character color and the color value of the background color in the character area of the second image, and the number of pixels forming the edge of the character in the character area. and a correction step of correcting based on the number of pixels forming the character,
a generation step of generating a compressed image in which the first image is compressed as an image including the character area whose character color has been corrected in the correction step;
An image processing method comprising :
コンピュータに請求項に記載の画像処理方法を実行させるためのプログラム。 A program for causing a computer to execute the image processing method according to claim 5 .
JP2019186008A 2019-10-09 2019-10-09 Image processing device, image processing method, and program Active JP7362405B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019186008A JP7362405B2 (en) 2019-10-09 2019-10-09 Image processing device, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019186008A JP7362405B2 (en) 2019-10-09 2019-10-09 Image processing device, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2021061564A JP2021061564A (en) 2021-04-15
JP7362405B2 true JP7362405B2 (en) 2023-10-17

Family

ID=75380535

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019186008A Active JP7362405B2 (en) 2019-10-09 2019-10-09 Image processing device, image processing method, and program

Country Status (1)

Country Link
JP (1) JP7362405B2 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004260327A (en) 2003-02-24 2004-09-16 Canon Inc Image compression apparatus
JP2009017247A (en) 2007-07-05 2009-01-22 Konica Minolta Business Technologies Inc Image processing device and program
JP2015198385A (en) 2014-04-02 2015-11-09 キヤノン株式会社 Image processing apparatus, image processing method and program
JP2017117331A (en) 2015-12-25 2017-06-29 株式会社リコー Image processing apparatus, image processing method, and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004260327A (en) 2003-02-24 2004-09-16 Canon Inc Image compression apparatus
JP2009017247A (en) 2007-07-05 2009-01-22 Konica Minolta Business Technologies Inc Image processing device and program
JP2015198385A (en) 2014-04-02 2015-11-09 キヤノン株式会社 Image processing apparatus, image processing method and program
JP2017117331A (en) 2015-12-25 2017-06-29 株式会社リコー Image processing apparatus, image processing method, and program

Also Published As

Publication number Publication date
JP2021061564A (en) 2021-04-15

Similar Documents

Publication Publication Date Title
JP5875637B2 (en) Image processing apparatus and image processing method
US8384964B2 (en) Image processing apparatus and image processing method
JP6743092B2 (en) Image processing apparatus, image processing control method, and program
JP4586891B2 (en) Color reduction method, color reduction processing apparatus, image forming apparatus, and computer program
US10373030B2 (en) Image processing apparatus that executes halftone process on target image data including edge pixel
JP4632443B2 (en) Image processing apparatus, image processing method, and program
US8670623B2 (en) Image processing apparatus, image conversion method, and computer-readable storage medium for computer program based on calculated degree of complexity
JP5645612B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP5893379B2 (en) Image compression apparatus, image compression method, and computer program
JP6370080B2 (en) Image processing apparatus, image processing method, and program.
US8810877B2 (en) Image processing apparatus, image processing method, and storage medium for eliminating blurring of scanned image
US8274515B2 (en) Vector image generation method, image processing apparatus, and computer-readable storage medium for computer program
JP2022030055A (en) Image processing apparatus, image processing method, and program
JP7362405B2 (en) Image processing device, image processing method, and program
JP7134045B2 (en) Image processing device, image processing method, and program
JP4710672B2 (en) Character color discrimination device, character color discrimination method, and computer program
JP6091400B2 (en) Image processing device
JP4504096B2 (en) Image processing apparatus, program, and storage medium
JP6641982B2 (en) Image processing apparatus, image processing method, and program
JP4375106B2 (en) Image processing device
JP7185451B2 (en) Image processing device, image processing method, and program
JP2012231261A (en) Image processing apparatus and control method thereof
US11924390B2 (en) Apparatus, method, and storage medium for performing color reduction processing
JP2022061279A (en) Image processing apparatus, method for controlling image processing apparatus, and program
JP2022141319A (en) Image processing device, control method for the same, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20221004

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20230616

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230627

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230825

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20230905

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20231004

R151 Written notification of patent or utility model registration

Ref document number: 7362405

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151