JP2011248702A - Image processing device, image processing method, image processing program, and program storage medium - Google Patents

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

Info

Publication number
JP2011248702A
JP2011248702A JP2010122362A JP2010122362A JP2011248702A JP 2011248702 A JP2011248702 A JP 2011248702A JP 2010122362 A JP2010122362 A JP 2010122362A JP 2010122362 A JP2010122362 A JP 2010122362A JP 2011248702 A JP2011248702 A JP 2011248702A
Authority
JP
Japan
Prior art keywords
color
image
area
region
contour
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.)
Pending
Application number
JP2010122362A
Other languages
Japanese (ja)
Inventor
Kei Iwata
圭 岩田
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP2010122362A priority Critical patent/JP2011248702A/en
Publication of JP2011248702A publication Critical patent/JP2011248702A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide an image processing device extracting efficiently and precisely a color-coded region from a color image.SOLUTION: This image processing device extracting a region from an image has: reduced image creating means for creating one reduced image by dividing the image in a matrix state and generating a pixel from an aggregation of pixels in a divided range; clustering means for clustering color information of the reduced image in a predetermined value; color region extraction means for extracting a cluster with the same value as the region; contour extraction means for extracting a contour of the region extracted; and contour specification means for specifying a contour of the region in an original image separated by color from the contour extracted from the contour extraction means.

Description

本発明は、カラー画像において色分けされた領域を抽出する方法、およびその方法を実施するための画像処理装置等に関する。   The present invention relates to a method for extracting a color-coded region in a color image, an image processing apparatus for performing the method, and the like.

スキャナやカメラ等で紙の文書を取り込んだ画像を入力データとして、文字認識を行う装置が種々考案されている。例えば、新聞、雑誌、論文などの紙文書から必要な情報を保存する場合、紙ではかさばるため、スキャナなどで画像データに変換して保存しておくことが一般に行われているが、後に保存した画像データから特定の文書を検索するためには、紙面に含まれる文字情報を認識して記憶、保管しておくことが必要になる。あるいは、画像データとして取り込んだ紙面に含まれる文字情報を認識し、特定の文字列を抽出して保存することにより、キー入力の煩わしさを少なくして携帯情報端末などに特定の情報を登録する、という用途にも文字認識の技術が用いられている。   Various devices have been devised that perform character recognition using an image obtained by capturing a paper document with a scanner or a camera as input data. For example, when saving necessary information from paper documents such as newspapers, magazines, papers, etc., paper is bulky, so it is generally converted to image data with a scanner etc. and saved, but it was saved later In order to search for a specific document from image data, it is necessary to recognize, store, and store character information included in the page. Alternatively, by recognizing the character information included in the paper captured as image data, extracting and storing a specific character string, the specific information is registered in a portable information terminal or the like with less troublesome key input. The character recognition technology is also used for the above-mentioned purposes.

ところで、紙文書の中でも雑誌などのカラー紙面では、背景の色によって1つのまとまりのある領域を表したり、部分的に背景を文書全体の地の色とは別の色にすることによって、文書の一部を強調することがある。   By the way, on a color paper such as a magazine in a paper document, the background color represents a single coherent area, or the background is partially different from the background color of the entire document. Some may be emphasized.

このようなカラー紙面を対象とした文字認識装置では、文字認識を行う前処理として色背景が同じ領域ごとにカラー紙面を分割し、その領域ごとに認識処理を行うことが望ましい。なぜなら一般に文字認識装置は、入力多値画像を前景色と背景色に分離して2値画像を生成し、前景色で描かれた部分を文字として文字認識を行うことが多いが、カラー画像に対して前述のように色背景が異なる領域を分離する処理を行わずに2値画像を生成した場合、2値画像上では別の色背景となっているという情報が失われ、本来分離すべき情報であるにも関わらず1つのまとまりとして文字認識されてしまい、精度良く必要な情報を抽出することができないという問題が発生するためである。   In such a character recognition apparatus for a color paper surface, it is desirable to divide the color paper surface for each region having the same color background as the pre-processing for character recognition, and perform the recognition processing for each region. This is because character recognition apparatuses generally generate a binary image by separating an input multivalued image into a foreground color and a background color, and perform character recognition using a portion drawn in the foreground color as a character. On the other hand, when a binary image is generated without performing the process of separating regions with different color backgrounds as described above, information that the color image is a different color background is lost and should be separated originally. This is because, despite the information, the characters are recognized as one unit and the necessary information cannot be accurately extracted.

あるいは、文書の一部を強調する目的で異なる色領域になっている場合では、しばしば色背景と文字色の濃淡が逆転しており、この領域を他の領域と同じ処理で2値化した場合、文字色と背景色が逆転した2値画像になってしまい、文字認識ができないなどの問題が発生するためである。   Or, if the color area is different for the purpose of emphasizing a part of the document, the color background and the color of the character color are often reversed, and this area is binarized by the same process as other areas This is because a binary image in which the character color and the background color are reversed results in a problem that character recognition cannot be performed.

色が異なる領域を分離し、類似した色で構成される領域を抽出するための技術としては、色空間クラスタリング法、領域拡張法などが一般的である。   As a technique for separating regions having different colors and extracting regions composed of similar colors, a color space clustering method, a region expansion method, and the like are common.

色空間クラスタリング法は、入力された画像の画素を、RGB、YUVなどの色空間においてK−means法やISODATA(Iterative Self−Organizing Data Analysis Technique A)法などの手法でクラスタリングを行い、同色とみなせる画素の集合を1つの領域とする方法である。   In the color space clustering method, the pixels of the input image are clustered in a color space such as RGB or YUV by a method such as K-means method or ISODATA (Iterative Self-Organizing Data Analysis Technique A) method, and can be regarded as the same color. In this method, a set of pixels is used as one area.

領域拡張法は、入力された画像について、画素の色情報を近傍の画素と比較し、色情報の差が閾値よりも小さければ同じ領域とするという処理を、どの領域にも属さない画素がなくなるまで繰り返すことにより、色が異なる領域を分離する方法である。   The area expansion method compares the pixel color information with the neighboring pixels in the input image, and if the difference in color information is smaller than the threshold value, the same area is processed. There is no pixel that does not belong to any area. This is a method of separating regions having different colors by repeating the above.

しかしながら、上述の従来の技術には以下のような問題点がある。カラー印刷物はCMYKと呼ばれる4色の網点を紙面に配置することにより、色を表現することが一般的である。網点は非常に細かいため、人間の目には個々の点を識別することはできず、1つの色として見えるため、網点の配置方法によってさまざまな色を表現することができる。しかし、近年はデジタルカメラや携帯情報端末に搭載されているカメラなどの高画素化が進んでおり、このような高解像度のデバイスでカラー印刷物からカラー画像を取得した場合、人の目には同じ色に見える領域であっても、取得された画素の分布によってはばらつきが生じることがある。そのため取得した画像に対して色空間クラスタリング法を行った場合、画素のばらつきによって人の目には同色である領域の画素が同色とみなされず、精度よくクラスタリングをすることが難しいという問題が発生する。また領域拡張法においても、人の目には同色である領域でも隣接する画素の色の違いが大きくなってしまい、うまく色領域を分離することができないという問題が発生する。さらに、どちらの手法においても画像全体のすべての画素を対象として処理を行うため、高画素数の画像は処理時間が大きくなるという問題もある。   However, the above conventional techniques have the following problems. A color printed material generally expresses colors by arranging four-color halftone dots called CMYK on a paper surface. Since the halftone dots are very fine, individual dots cannot be identified by the human eye and appear as one color, so that various colors can be expressed by the arrangement method of the halftone dots. However, in recent years, the number of pixels of digital cameras and cameras mounted on personal digital assistants has been increasing, and when a color image is acquired from a color print with such a high-resolution device, it is the same for the human eye. Even in a color-visible region, variation may occur depending on the acquired pixel distribution. Therefore, when the color space clustering method is performed on the acquired image, pixels in the same color region are not considered to be the same color by human eyes due to pixel variations, and there is a problem that it is difficult to perform clustering with high accuracy. . Also in the area expansion method, the difference in color between adjacent pixels becomes large even in an area of the same color to the human eye, and there is a problem that the color area cannot be separated well. In addition, in either method, since processing is performed on all pixels of the entire image, there is a problem that processing time is increased for an image with a large number of pixels.

このような問題に対応するために、特許文献1では、カラー原画像から縮小画像を作成し、縮小画像で同じ色とみなせる領域を求め、同じ色とみなされた領域において、その領域の色の種類、色の種類の数、代表色を求め、それに対応する原画像の中において、縮小画像で抽出した色に近い画素を探索し、領域を抽出することを特徴とするカラー画像処理装置及びパターン抽出装置を提案している。   In order to cope with such a problem, in Patent Document 1, a reduced image is created from a color original image, an area that can be regarded as the same color in the reduced image is obtained, and in the area that is regarded as the same color, the color of that area is determined. Color image processing apparatus and pattern characterized by obtaining type, number of color types, representative color, searching pixel corresponding to color extracted from reduced image in corresponding original image, and extracting region An extraction device is proposed.

この装置によれば、縮小画像で抽出した色だけに注目してその領域に対応する原画像の領域を抽出するため、原画像全体の全ての画素を対象として処理を行う従来の方法より、処理時間が短縮できる。   According to this apparatus, since only the color extracted in the reduced image is focused and the original image region corresponding to the region is extracted, the processing is performed more than the conventional method in which processing is performed on all the pixels of the entire original image. Time can be shortened.

特開平 11−288465号公報Japanese Patent Laid-Open No. 11-288465

しかしながら、特許文献1では、縮小画像で同じ色とみなされる領域を求め、その領域において、その領域の色の種類、色の種類の数、代表色を求めているが、色の種類、色の種類の数を求めるために、縮小画像上で求めた同色領域を探索してその中の色の種類を全て調査している。また代表色を求めるために、色の種類ごとに頻度分布を求め、最頻値を代表値とする方法が記載されているが、これらの値を求めるためには、同色領域内の全ての画素を調査してヒストグラムなどを作成する必要があるため処理時間がかかる。   However, in Patent Document 1, an area regarded as the same color in a reduced image is obtained, and in that area, the color type, the number of color types, and the representative color of the area are obtained. In order to obtain the number of types, the same color area obtained on the reduced image is searched to investigate all the types of colors. Further, in order to obtain a representative color, a method is described in which a frequency distribution is obtained for each color type and the mode value is used as a representative value. In order to obtain these values, all pixels in the same color region are described. It takes a lot of processing time because it is necessary to investigate and create a histogram.

また、同文献では縮小画像で求めた領域から、それに対応する原画像の外接矩形を求め、その内部で代表色に近い画素を探索することによって、処理時間を短くしている。確かに、縮小画像で求めた領域が四角形に近い場合は原画像の外接矩形も似たような形状になるため、原画像の探索領域内に同色領域に属さない画素が少なくなり、探索領域を絞ることができる。しかし、縮小画像で求めた領域が四角形に近くない複雑な形状の場合は、対応する原画像の外接矩形では同色領域に属さない画素が多くなるため、同色領域の探索範囲をそれほど大きく絞ることはできず、原画像の外接矩形内のすべての画素について、その領域の代表色や求めた色の種類全てと比較して、同じ領域に属するかを探索しなければならないことから、画素数による処理時間の増大という問題を解決できない場合も多い。また、文字情報は、通常、四角形に近い領域に記録されていることが多いため、複雑な形状の領域を抽出しても、文字認識のための抽出という点では不要となる場合も多い。   Also, in this document, the processing time is shortened by obtaining a circumscribed rectangle of the original image corresponding to the area obtained from the reduced image and searching for pixels close to the representative color in the rectangle. Certainly, if the area obtained from the reduced image is close to a quadrangle, the circumscribed rectangle of the original image has a similar shape.Therefore, there are fewer pixels that do not belong to the same color area in the search area of the original image, and the search area Can be squeezed. However, if the area obtained from the reduced image has a complex shape that is not close to a rectangle, the circumscribed rectangle of the corresponding original image has many pixels that do not belong to the same color area, so the search range for the same color area cannot be narrowed so much. Since all the pixels in the circumscribed rectangle of the original image cannot be compared with the representative colors of the area or all of the obtained color types, it must be searched whether they belong to the same area. In many cases, the problem of increased time cannot be solved. In addition, since character information is usually recorded in a region close to a quadrangle, even if a region having a complicated shape is extracted, it is often unnecessary in terms of extraction for character recognition.

本発明は、上記の問題点に鑑みてなされたものであり、その目的は、色のばらつきを小さくした縮小画像を用いて効率的にかつ精度よく、色分けされた領域を抽出することができる画像処理装置を提供することにある。   The present invention has been made in view of the above-described problems, and an object of the present invention is to provide an image that can efficiently and accurately extract a color-coded region using a reduced image with reduced color variation. It is to provide a processing apparatus.

また、本発明の更なる目的は、抽出した領域から文字領域になりえないような領域を除くことで処理時間をさらに短縮できる画像処理装置を提供することにある。   A further object of the present invention is to provide an image processing apparatus that can further reduce the processing time by removing an area that cannot be a character area from the extracted area.

前記の課題を解決するために、本発明に係る画像処理装置は、画像から領域を抽出する画像処理装置において、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成手段と、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリング手段と、同じ値を有するクラスタを領域として抽出する色領域抽出手段と、抽出した領域の輪郭を抽出する輪郭抽出手段と、前記輪郭抽出手段により抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定手段とを備えることを特徴としている。   In order to solve the above problems, an image processing apparatus according to the present invention is an image processing apparatus that extracts an area from an image, divides the image into a matrix, and generates one pixel from a set of pixels in the divided range. A reduced image generating means for generating a reduced image, a clustering means for clustering the color information of the reduced image into a predetermined value, a color area extracting means for extracting clusters having the same value as an area, It is characterized by comprising contour extracting means for extracting a contour and contour specifying means for specifying the contour of the region of the original image color-coded from the contour extracted by the contour extracting means.

また、本発明に係る画像処理装置は、前記縮小画像生成手段は、分割した範囲の画素集合の平均値を縮小画像の画素とすることを特徴としている。   Further, the image processing apparatus according to the present invention is characterized in that the reduced image generation means uses an average value of a set of pixels in the divided range as pixels of the reduced image.

また、本発明に係る画像処理装置は、同じクラスタに属する画素の連結を膨張または収縮するクラスタ膨張収縮手段を備えることを特徴としている。   The image processing apparatus according to the present invention is characterized by comprising cluster expansion / contraction means for expanding or contracting the connection of pixels belonging to the same cluster.

また、本発明に係る画像処理装置は、前記色領域抽出手段が、同じクラスタに属する画素を連結した領域の画素数が所定の値より小さい領域を抽出しないことを特徴としている。   Further, the image processing apparatus according to the present invention is characterized in that the color area extracting means does not extract an area where the number of pixels in an area where pixels belonging to the same cluster are connected is smaller than a predetermined value.

また、本発明に係る画像処理装置は、前記色領域抽出手段が、同じクラスタに属する画素を連結した領域の形状を評価し、評価値に合致しない領域を抽出しないことを特徴としている。   In addition, the image processing apparatus according to the present invention is characterized in that the color region extraction unit evaluates the shape of a region in which pixels belonging to the same cluster are connected, and does not extract a region that does not match the evaluation value.

また、本発明に係る画像処理方法は、画像から領域を抽出する画像処理方法において、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成ステップと、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリングステップと、同じ値を有するクラスタを領域として抽出する色領域抽出ステップと、抽出した領域の輪郭を抽出する輪郭抽出ステップと、前記輪郭抽出ステップにより抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定ステップと
を備えることを特徴としている。
The image processing method according to the present invention is an image processing method for extracting a region from an image. The image is divided into a matrix, and a reduced image is generated by generating one pixel from a set of pixels in the divided range. A reduced image generating step, a clustering step for clustering color information of the reduced image to a predetermined value, a color region extracting step for extracting a cluster having the same value as a region, and a contour extracting step for extracting the contour of the extracted region And an outline specifying step for specifying the outline of the color-coded original image area from the outline extracted by the outline extracting step.

また、本発明に係る画像処理プログラムは、画像から領域を抽出する画像処理プログラムにおいて、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成ステップと、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリングステップと、同じ値を有するクラスタを領域として抽出する色領域抽出ステップと、抽出した領域の輪郭を抽出する輪郭抽出ステップと、前記輪郭抽出ステップにより抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定ステップとをコンピュータに実行させることを特徴としている。   The image processing program according to the present invention is an image processing program that extracts an area from an image, divides the image into a matrix, generates one pixel from a set of pixels in the divided range, and generates a reduced image. A reduced image generating step, a clustering step for clustering color information of the reduced image to a predetermined value, a color region extracting step for extracting a cluster having the same value as a region, and a contour extracting step for extracting the contour of the extracted region And a contour specifying step for specifying the contour of the color-coded region of the original image from the contour extracted by the contour extracting step.

また、本発明に係る記憶媒体は、上記前記画像処理プログラムを記憶したことを特徴としている。   A storage medium according to the present invention stores the image processing program.

本発明の画像処理装置によれば、色のばらつきを小さくした縮小画像を用いて効率的にかつ精度よく、色分けされた領域を抽出することができ、さらに、抽出した領域から文字領域になりえないような領域を除くことで処理時間を短縮することができる。   According to the image processing apparatus of the present invention, it is possible to efficiently and accurately extract a color-coded region using a reduced image with reduced color variation, and further, the extracted region can be a character region. The processing time can be shortened by removing such areas.

実施の形態に係る画像処理装置の構成を示すブロック図である。It is a block diagram which shows the structure of the image processing apparatus which concerns on embodiment. 実施の形態に係る処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process which concerns on embodiment. 実施の形態に係るクラスタマップである。It is a cluster map concerning an embodiment. 画素のノイズのあるクラスタマップの一例である。It is an example of a cluster map with pixel noise. 実施の形態に係るクラスタマップである。It is a cluster map concerning an embodiment. 実施の形態に係るクラスタマップである。It is a cluster map concerning an embodiment. 実施の形態に係るクラスタマップである。It is a cluster map concerning an embodiment. 実施の形態に係る色領域マップである。It is a color area map concerning an embodiment. 実施の形態に係る輪郭抽出処理についての説明図である。It is explanatory drawing about the contour extraction process which concerns on embodiment. 実施の形態に係る輪郭抽出処理についての説明図である。It is explanatory drawing about the contour extraction process which concerns on embodiment. 色領域の輪郭線が複雑に入り組んだ例である。This is an example in which the outline of the color region is complicated. 実施の形態に係る原画像における色領域を示す図である。It is a figure which shows the color area | region in the original image which concerns on embodiment. 実施の形態に係る縮小画像において抽出した色領域を原画像に対応づけた図である。It is the figure which matched the color area extracted in the reduction image which concerns on embodiment with the original image. 実施の形態に係る色領域の輪郭線の方向を表した図である。It is a figure showing the direction of the outline of the color area which concerns on embodiment. 実施の形態に係る輪郭線の抽出範囲が設定された範囲を示した図である。It is the figure which showed the range in which the extraction range of the outline which concerns on embodiment was set. 実施の形態に係るエッジ方向テーブルの一例を示した図である。It is the figure which showed an example of the edge direction table which concerns on embodiment. 輪郭抽出処理におけるPrewittの方法を示す図である。It is a figure which shows the method of Prewitt in an outline extraction process.

以下、本発明における画像処理装置の実施の形態に関して、カラー紙面から色分けされた文字領域を抽出する例について、図面を用いて以下に説明する。なお、本発明の図面において、同一の参照符号は、同一部分または相当部分を表わすものとする。   Hereinafter, with reference to the drawings, an example of extracting color-coded character areas from color paper will be described with respect to an embodiment of an image processing apparatus according to the present invention. In the drawings of the present invention, the same reference numerals represent the same or corresponding parts.

図1は、本発明を実施するための画像処理装置の構成を示すブロック図である。本発明の画像処理装置は、カラー画像を入力する画像入力部101、入力したカラー画像を記憶する画像メモリ102、画像メモリ102に記憶されたカラー画像よりグレースケール画像データを生成するグレースケール画像生成部103、生成されたグレースケール画像を記憶するグレースケール画像メモリ104、画像メモリ102に記憶されたカラー画像より縮小画像データを生成する縮小画像生成部105、生成された縮小画像を記憶する縮小画像メモリ106、縮小画像の色情報をクラスタリングするクラスタリング部107、同じクラスタに属する画素の連結の膨張または収縮を行うクラスタ膨張収縮部108、同じクラスタに属する画素の連結を領域として抽出する色領域抽出部109、色情報のクラスタリング分類や抽出した色領域を記憶する色領域メモリ110、色領域メモリ110に記憶された色領域に対して、所定の条件に合致した色領域を消去する色領域消去部112、抽出した色領域の輪郭を追跡し、輪郭画素を抽出する輪郭抽出部111、輪郭画素が対応するカラー画像の範囲を設定する輪郭特定範囲設定部113、輪郭画素のエッジ方向を記憶するエッジ方向テーブル114、設定したカラー画像の輪郭特定範囲よりカラー画像の色領域の輪郭を特定する輪郭特定部より構成されている。   FIG. 1 is a block diagram showing a configuration of an image processing apparatus for carrying out the present invention. An image processing apparatus according to the present invention includes an image input unit 101 that inputs a color image, an image memory 102 that stores the input color image, and a grayscale image generation that generates grayscale image data from the color image stored in the image memory 102. Unit 103, a grayscale image memory 104 that stores the generated grayscale image, a reduced image generation unit 105 that generates reduced image data from a color image stored in the image memory 102, and a reduced image that stores the generated reduced image Memory 106, clustering unit 107 that clusters color information of reduced images, cluster expansion / contraction unit 108 that expands / contracts connection of pixels belonging to the same cluster, and color region extraction unit that extracts connection of pixels belonging to the same cluster as a region 109, clustering classification and extraction of color information A color area memory 110 that stores color areas, a color area deletion unit 112 that deletes a color area that matches a predetermined condition with respect to the color areas stored in the color area memory 110, and tracks the outline of the extracted color area A contour extraction unit 111 that extracts a contour pixel, a contour specification range setting unit 113 that sets a range of a color image corresponding to the contour pixel, an edge direction table 114 that stores an edge direction of the contour pixel, and a contour specification of the set color image It is comprised from the outline specific | specification part which specifies the outline of the color area | region of a color image from a range.

図2は本発明の全体の処理の流れを示したフローチャートである。まず、画像処理装置を起動し、画像入力部101において、カラー紙面をCCDカメラやスキャナなどの電子データに変換して入力し、カラー画像(以下では原画像と呼ぶ)として画像メモリ102に記憶する(ステップS201)。なお、本実施の形態では、R,G,Bによりカラー画素を表現している場合について説明するが、YUVやHSVなど他の表色系を用いてもよい。   FIG. 2 is a flowchart showing the overall processing flow of the present invention. First, the image processing apparatus is activated, and the image input unit 101 converts the color paper surface into electronic data such as a CCD camera or a scanner and inputs it, and stores it in the image memory 102 as a color image (hereinafter referred to as an original image). (Step S201). In this embodiment, a case where color pixels are expressed by R, G, and B will be described. However, other color systems such as YUV and HSV may be used.

次にグレースケール画像生成部103において、画像メモリ102に記憶された原画像よりグレースケール画像を生成し、グレースケール画像メモリ104に記憶する(ステップS202)。グレースケール画像を生成する処理としては、R,G,Bの加重平均によって輝度値を計算して画像値とするなどの方法がある。   Next, the gray scale image generation unit 103 generates a gray scale image from the original image stored in the image memory 102 and stores it in the gray scale image memory 104 (step S202). As a process for generating a gray scale image, there is a method of calculating a luminance value by a weighted average of R, G, and B to obtain an image value.

続いて縮小画像生成部105において画像メモリ102に記憶された原画像より縮小画像を生成し、縮小画像メモリ106に記憶する(ステップS203)。縮小画像を生成する処理は、例えば以下のような方法がある。   Subsequently, the reduced image generation unit 105 generates a reduced image from the original image stored in the image memory 102 and stores it in the reduced image memory 106 (step S203). For example, the following method can be used to generate a reduced image.

画像メモリ102に記憶された原画像のN×N画素を1画素とする縮小画像を生成するためには、原画像をN×N画素ごとのマトリクス状に区切り、区切られた各範囲内にある画素の値について、R,G,Bごとに平均値を算出し、その平均値のR,G,Bにより、1つの画素を割り当てる。ここでNが小さすぎる場合は、縮小画像の総画素数が多くなるため、以降の処理において時間がかかり、またカラー印刷物の網点が荒い場合は、縮小画像の画素のばらつきが大きくなるため、後述するクラスタリングにおいて精度も悪くなる。また、Nが大きすぎる場合は小さい色領域を抽出することが難しくなる。一般的にはNは4〜16程度で、入力対象画像に応じた値を選択することが望ましい。このように縮小画像を用いることにより、効率よく色分けされた領域を抽出することができる。また、原画像の画素の平均値を縮小画像とすることにより、原画像における色のばらつきを小さくした縮小画像を用いて精度よく色分けされた領域を抽出することができる。   In order to generate a reduced image in which N × N pixels of the original image stored in the image memory 102 are one pixel, the original image is divided into a matrix for each N × N pixel and is within each divided range. For the pixel values, an average value is calculated for each of R, G, and B, and one pixel is assigned according to the average values of R, G, and B. Here, when N is too small, the total number of pixels of the reduced image increases, so it takes time in the subsequent processing, and when the halftone dot of the color print is rough, the variation in the pixels of the reduced image increases. In the clustering described later, the accuracy also deteriorates. If N is too large, it is difficult to extract a small color area. In general, N is about 4 to 16, and it is desirable to select a value according to the input target image. By using a reduced image in this way, it is possible to extract a color-coded region efficiently. In addition, by using the average value of the pixels of the original image as a reduced image, it is possible to extract a color-coded region with high accuracy using a reduced image in which the color variation in the original image is reduced.

次にクラスタリング部107は縮小画像メモリ106に記憶された縮小画像の色情報を抽出し、クラスタリング処理を行う。クラスタリングとは、データ集合において、何らかの特徴空間上で分布の群れ(クラスタ)を見つけることである。本発明においては、色空間のクラスタリングによりクラスタリング処理を行い、縮小画像上の画素をクラスタに分類し、その分布状況を示すクラスタマップを作成し、色領域メモリ110に記憶する(ステップS204)。色空間のクラスタリングの具体的な方法については、K−means法やISODATA法などの既存の手法を用いればよい。   Next, the clustering unit 107 extracts color information of the reduced image stored in the reduced image memory 106 and performs clustering processing. Clustering is to find a group of clusters (cluster) in some feature space in a data set. In the present invention, clustering processing is performed by clustering the color space, the pixels on the reduced image are classified into clusters, a cluster map indicating the distribution status is created, and stored in the color area memory 110 (step S204). As a specific method of color space clustering, an existing method such as a K-means method or an ISODATA method may be used.

図3はクラスタマップの一例を表しており、番号0から3までの4色のクラスタに分類されている。本発明では画像全体と違う色領域を抽出することが目的であるため、これ以降の処理は背景色以外のクラスタに対して行う。一般的な紙面の画像を取り込んだ場合、背景色は白である場合が多いが、カラー印刷物の種類によってさまざまな色が考えられるため、分類したクラスタの中でもっとも属している画素数が多いものを選べばよい。図3の例においては、0番が背景色を表すクラスタであると判断する。   FIG. 3 shows an example of a cluster map, which is classified into four-color clusters of numbers 0 to 3. Since the purpose of the present invention is to extract a color region different from the entire image, the subsequent processing is performed for clusters other than the background color. When a general paper image is captured, the background color is often white, but various colors can be considered depending on the type of color print, so the number of pixels belonging to the largest number in the classified cluster You can choose. In the example of FIG. 3, it is determined that the number 0 is a cluster representing the background color.

次にクラスタ膨張収縮部108はクラスタマップに対して個々のクラスタごとに膨張処理や収縮処理を行う(ステップS205)。膨張処理とは、ある図形成分の境界画素に接する背景成分中の画素の値を図形成分の画素の値に変換して一画素分膨らませる処理である。逆に収縮処理とは、ある図形成分の境界にある画素の値を全て背景成分の画素に変換して一画素分縮める処理である。これらの処理は、画素の欠けや、不要な画素などのノイズ除去を目的に行われる。本実施の形態では、対象とするクラスタに属する画素の集合を膨らませることを膨張処理、縮めることを収縮処理とする。   Next, the cluster expansion / contraction unit 108 performs expansion processing and contraction processing for each cluster on the cluster map (step S205). The expansion processing is processing for converting the value of the pixel in the background component in contact with the boundary pixel of a certain graphic component into the value of the graphic component pixel and expanding it by one pixel. Conversely, the contraction process is a process of converting all the pixel values at the boundary of a certain graphic component into pixels of the background component and reducing it by one pixel. These processes are performed for the purpose of removing noise such as missing pixels or unnecessary pixels. In this embodiment, expanding a set of pixels belonging to a target cluster is referred to as expansion processing, and contracting is referred to as contraction processing.

図4は、画素のノイズのあるクラスタマップの一例である。この例では、ノイズによって0番のクラスタに2箇所の不要な孤立画素10があり、2番のクラスタは本来長方形であるはずの形状に一部、画素の欠け11が生じている。後述する次のステップS206の色領域抽出処理では、クラスタマップの個々のクラスタごとにラベリング処理(連結している画素に同じラベルを付加する処理)を行い、連結領域を抽出して色領域とするため、このままでは領域の一部が欠けたり、不要な小領域が抽出されること起こりうる。そこで、クラスタマップに対して個々のクラスタごとに膨張処理や収縮処理を行い、ノイズ除去を行う。   FIG. 4 is an example of a cluster map with pixel noise. In this example, there are two unnecessary isolated pixels 10 in the zeroth cluster due to noise, and the second cluster has a pixel defect 11 partly in a shape that should originally be a rectangle. In the color area extraction process in the next step S206, which will be described later, a labeling process (a process of adding the same label to connected pixels) is performed for each cluster in the cluster map, and the connected area is extracted to be a color area. For this reason, a part of the region may be lost or an unnecessary small region may be extracted. Therefore, the cluster map is subjected to expansion processing and contraction processing for each individual cluster to remove noise.

図5は、図4のクラスタマップに対して膨張処理を行った後のクラスタマップである。図4のクラスタマップに対してクラスタごとに8近傍(上下左右斜め方向の周辺)の膨張処理を行っている。   FIG. 5 is a cluster map after the expansion process is performed on the cluster map of FIG. In the cluster map of FIG. 4, expansion processing is performed in the vicinity of 8 (periphery in the vertical and horizontal directions) for each cluster.

図6は、図5のクラスタマップに対して収縮処理を行った後のクラスタマップである。図4のクラスタマップに対して膨張処理を行った後、この状態で、さらに、8近傍の収縮処理を行うと、図6のようなクラスタマップが作成され、図4において画素の欠け11として存在していた2番のクラスタの欠けた部分が埋まり、本来の長方形の領域を抽出することができる。   FIG. 6 is a cluster map after the contraction process is performed on the cluster map of FIG. After performing the dilation process on the cluster map of FIG. 4 and further performing the contraction process in the vicinity of 8 in this state, a cluster map as shown in FIG. 6 is created and exists as a pixel defect 11 in FIG. The missing portion of the second cluster that has been filled is filled, and the original rectangular region can be extracted.

図7は、図6のクラスタマップに対して収縮処理した後に膨張処理を行った後のクラスタマップである。このような処理により、図4において孤立画素10として存在していた1番のクラスタの2箇所の不要な領域が除去される。   FIG. 7 is a cluster map after the expansion process is performed after the contraction process is performed on the cluster map of FIG. By such processing, two unnecessary areas of the first cluster that existed as isolated pixels 10 in FIG. 4 are removed.

このように膨張収縮処理を行うことにより、クラスタリングの段階でクラスタ分布に欠けや余分な画素が存在した場合でも、精度よく色分けされた領域を抽出することができる。   By performing the expansion / contraction process in this way, even when the cluster distribution lacks or there are extra pixels at the clustering stage, it is possible to extract the color-coded region with high accuracy.

次に色領域抽出部109は、色領域メモリ110に記憶されたクラスタマップの個々のクラスタごとにラベリング処理を行い、連結領域を抽出し、色領域マップを作成して色領域メモリ110に記憶する(ステップS206)。その際に、色分けされた文字領域になりえないような小さな領域を除くため、抽出した連結領域についてその連結領域を構成する画素数をカウントし、画素数があらかじめ定められた閾値より多い領域にのみ色領域メモリ110に記憶する。この閾値は、縮小画像に応じて、文字領域になりえないと判定する値を適宜設定すればよい。このように、抽出した色領域から色分けされた文字領域になりえないような小さな領域を抽出しないことにより、処理時間を短縮することができる。   Next, the color area extraction unit 109 performs a labeling process for each cluster in the cluster map stored in the color area memory 110, extracts a connected area, creates a color area map, and stores the color area map in the color area memory 110. (Step S206). At that time, in order to exclude a small area that cannot be a color-coded character area, the number of pixels constituting the connected area is counted for the extracted connected area, and the number of pixels is larger than a predetermined threshold. Only the color area memory 110 is stored. The threshold value may be set as appropriate according to the reduced image. In this way, the processing time can be shortened by not extracting a small area that cannot be a color-coded character area from the extracted color area.

図8は、図3のクラスタ分類に対して背景色以外のクラスタについてラベリング処理を行い、色領域マップを作成した結果である。この例においてはR2とR3のクラスタが連結しているが、クラスタが異なる領域が連結していても別のラベルとしてラベリングを行う。そしてこれらのラベルに一意の番号R1からR4を振って、色領域マップを作成し、色領域メモリ110に記憶する。   FIG. 8 shows a result of creating a color area map by performing a labeling process on clusters other than the background color with respect to the cluster classification of FIG. In this example, the clusters of R2 and R3 are connected, but labeling is performed as another label even if regions having different clusters are connected. Then, unique numbers R 1 to R 4 are assigned to these labels to create a color area map and store it in the color area memory 110.

次のステップS207からS210までの処理は、ステップS206で抽出した色領域ごとに行う。   The next processing from step S207 to S210 is performed for each color region extracted in step S206.

まず、輪郭抽出部111は、色領域メモリ110に記憶された色領域マップを用いて、縮小画像で色領域の輪郭となる画素を抽出するために輪郭抽出処理を行う(ステップS207)。輪郭抽出処理とは、領域の境界線をたどるようにして輪郭線を抽出する処理である。   First, the contour extraction unit 111 performs a contour extraction process in order to extract a pixel that is a contour of a color region in a reduced image, using the color region map stored in the color region memory 110 (step S207). The contour extraction process is a process of extracting a contour line so as to follow the boundary line of the region.

図9は、本実施の形態で使用する4連結の輪郭抽出処理についての説明図である。まず図9(a)に示すように画像の左上より破線の矢印のようにラスタスキャンを行い、輪郭抽出を行う領域で最初に見つかった画素(●印がついた画素)を開始点とする。ラスタスキャンにより、開始点の位置においては上と左に画素がないことが確認済であるため、下、右の順番で抽出方向に画素があるかどうかを調べる。どちらの方向にも画素がない場合は、孤立点として終了する。この図においては下に画素があるため、図9(b)のように下の点へ進みこの点を新しい抽出点とする。これ以降は、抽出点の進行方向に対して右手側の画素から反時計回りの優先順位で画素があるかどうかを調べる。この優先順位を図に表すと、図中の1〜4となる。図9(b)においては進行方向が下であるため、図に示したように左、下、右、上の順で画素があるかどうかを調べ、画素があった時点でその方向に進む。この場合は左に画素がなく、下に画素があるため、下方向に進む。   FIG. 9 is an explanatory diagram of a 4-connected contour extraction process used in the present embodiment. First, as shown in FIG. 9A, raster scanning is performed from the upper left of the image as indicated by a dashed arrow, and the first pixel found in the region where the contour is to be extracted (the pixel marked with ●) is set as the starting point. Since it has been confirmed by the raster scan that there is no pixel at the top and left at the start point position, it is checked whether there is a pixel in the extraction direction in the order of bottom and right. If there are no pixels in either direction, the process ends as an isolated point. In this figure, since there is a pixel below, the process proceeds to a lower point as shown in FIG. 9B, and this point is set as a new extraction point. Thereafter, it is checked whether or not there is a pixel with a counterclockwise priority from the pixel on the right hand side with respect to the traveling direction of the extraction point. This priority order is represented by 1 to 4 in the figure. In FIG. 9B, since the traveling direction is downward, as shown in the figure, it is checked whether there is a pixel in the order of left, bottom, right, and top, and proceeds in that direction when there is a pixel. In this case, there is no pixel on the left and there is a pixel below, so the process proceeds downward.

同様にして輪郭抽出処理を進め、図9(c)においては進行方向が右であるため、図に示したように下、右、上、左の順番で画素があるかどうかを調べる。この場合では、下に画素があるため、下への画素を新しい抽出点とする。以上の処理を繰り返し行い、図9(d)のように抽出点が開始点に戻ったときに終了とする。   Similarly, the contour extraction process proceeds, and in FIG. 9C, since the traveling direction is right, as shown in the figure, it is checked whether there are pixels in the order of bottom, right, top, and left. In this case, since there is a pixel below, the pixel below is set as a new extraction point. The above process is repeated, and when the extraction point returns to the start point as shown in FIG.

図10は、図8で抽出した色領域R1に対して以上の輪郭抽出処理を行った図である。この輪郭抽出処理によって抽出した輪郭線を、色領域メモリ110の色領域マップに記憶する。輪郭抽出処理においては輪郭を抽出する際に進んだ方向、すなわち図10における矢印の方向に輪郭線を持つということがわかるため、輪郭線の方向を合わせて記憶しておく。   FIG. 10 is a diagram obtained by performing the above contour extraction processing on the color region R1 extracted in FIG. The contour line extracted by this contour extraction processing is stored in the color area map of the color area memory 110. In the contour extraction process, it can be seen that there is a contour line in the direction advanced when the contour is extracted, that is, in the direction of the arrow in FIG. 10, so the direction of the contour line is stored together.

またこのとき、抽出した輪郭線の長さをカウントする。輪郭線の長さのカウント方法は、開始画素から再び開始画素に戻るまでにたどった画素の数を輪郭線の長さとする。例えば、図9においては、開始画素から下方向に3、右方向に3、下方向に1、右方向に9、上方向へ3、左方向へ3、上方向へ1、左方向へ9進むことにより開始画素に戻る。よって輪郭線の長さは、これらを合計して32となる。   At this time, the length of the extracted outline is counted. In the contour line length counting method, the number of pixels traced from the start pixel to the start pixel again is defined as the contour line length. For example, in FIG. 9, the start pixel is 3 downward, 3 right, 1 downward, 9 right, 3 upward, 3 left, 1 upward, and 9 left. To return to the start pixel. Therefore, the total length of the contour line is 32.

次に色領域消去部112において、抽出した色領域から色分けされた文字領域になりえないような複雑な形状の領域を除く(ステップS208)。具体的には、輪郭線の長さと色領域を構成する画素数を用いて、“(輪郭線の長さ)/構成画素数”という計算式を用いて評価値を計算する。この値は、色領域の輪郭線が入り組んで、形状が複雑になるほど大きくなる。 Next, in the color area erasing unit 112, an area having a complicated shape that cannot be a color-coded character area is removed from the extracted color area (step S208). Specifically, the evaluation value is calculated using the calculation formula “(length of contour line) 2 / number of constituent pixels” using the length of the contour line and the number of pixels constituting the color region. This value becomes larger as the contour of the color region is complicated and the shape becomes complicated.

図11は、色領域の輪郭線が複雑に入り組んだ例である。図11に示した色領域においては、構成画素数は54で先ほど説明した図9と同じである。しかし輪郭追跡処理を行うと矢印のように、輪郭線の長さは62と図9の輪郭線の長さ32よりも長くなる。この2つの図に示された色領域についてそれぞれ評価値を計算すると、図9は19.0、図11は71.2となり、図11のほうがかなり大きくなることがわかる。そして、この評価値があらかじめ定められた閾値以上である場合は、評価した色領域を色領域メモリ110に記憶された色領域マップから削除する。この閾値は、縮小画像に応じて、色領域の形状が複雑と判定する値を適宜設定すればよい。このように、抽出した色領域から色分けされた文字領域になりえないような複雑な形状の領域を除くことにより、処理時間を短縮することができる。   FIG. 11 shows an example in which the outline of the color region is complicated. In the color region shown in FIG. 11, the number of constituent pixels is 54, which is the same as that shown in FIG. However, when the contour tracking process is performed, the length of the contour line is 62, which is longer than the length 32 of the contour line in FIG. When the evaluation values are calculated for the color regions shown in these two figures, it is found that FIG. 9 is 19.0 and FIG. 11 is 71.2, and FIG. 11 is considerably larger. If the evaluation value is equal to or greater than a predetermined threshold value, the evaluated color area is deleted from the color area map stored in the color area memory 110. As this threshold value, a value for determining that the shape of the color region is complicated may be appropriately set according to the reduced image. In this way, the processing time can be shortened by removing a region having a complicated shape that cannot be a character region color-coded from the extracted color region.

次に、輪郭特定範囲設定部113は色領域マップを参照し、原画像上での輪郭線の抽出範囲の設定を行う(ステップS209)。ここで縮小画像は原画像の画素のN×Nの範囲を1画素として作成しているため、縮小画像の座標が{m,n}であれば、それに対応する原画像は{m*N,n*N}を左上、{(m+1)*N−1,(n+1)*N−1}を右下とするN×Nの範囲になる。ここで、縮小画像は原画像のN×Nの範囲の色情報の平均値を画素値としているため、必ずしも縮小画像上の輪郭線の画素に相当する原画像の範囲に、原画像の色領域の輪郭線が含まれているわけではない。これについて、図12を用いて説明する。   Next, the contour specific range setting unit 113 refers to the color region map and sets the contour extraction range on the original image (step S209). Here, since the reduced image is created with an N × N range of pixels of the original image as one pixel, if the coordinates of the reduced image are {m, n}, the corresponding original image is {m * N, n * N} is in the upper left, and {(m + 1) * N−1, (n + 1) * N−1} is in the lower right range. Here, since the reduced image uses the average value of the color information in the N × N range of the original image as the pixel value, the color area of the original image does not necessarily fall within the range of the original image corresponding to the outline pixel on the reduced image. It does not include the outline. This will be described with reference to FIG.

図12は原画像における色領域を示している。破線で区切ったブロックは縮小画像の1つ1つの画素に相当する範囲を示している。   FIG. 12 shows color regions in the original image. Blocks divided by broken lines indicate ranges corresponding to individual pixels of the reduced image.

図13は縮小画像において抽出した色領域を原画像に対応づけた図を表しており、“×”がついたブロックは抽出された色領域の輪郭線が存在することを表している。このように色領域の輪郭線が存在するブロックは、縮小画像を生成したときに原画像における色領域部分を多く含む場合は、平均値によって算出した縮小画像の画素の色情報が、完全に色領域を含む縮小画像の画素の色情報と近くなるため同じクラスタに分類され、同じ色領域として抽出される。それに対して原画像における色領域部分をあまり含まない場合は、画素の色情報が完全に色領域を含む画素の色情報と近くならないため、同じクラスタに分類されない。しかしその場合は、抽出された色領域の輪郭線に隣接する外側のブロックに、原画像の輪郭線が存在することになる。そこで、抽出した輪郭線の方向によって輪郭線の抽出範囲を拡張する。   FIG. 13 shows a diagram in which a color area extracted in a reduced image is associated with an original image, and a block with “x” indicates that an outline of the extracted color area exists. In this way, when the block having the outline of the color area includes a large number of color area portions in the original image when the reduced image is generated, the color information of the pixel of the reduced image calculated by the average value is completely colored. Since it is close to the color information of the pixel of the reduced image including the area, it is classified into the same cluster and extracted as the same color area. On the other hand, when the color area portion in the original image is not included so much, the color information of the pixel is not completely close to the color information of the pixel including the color area, and thus is not classified into the same cluster. However, in that case, the outline of the original image exists in the outer block adjacent to the outline of the extracted color area. Therefore, the contour extraction range is expanded depending on the direction of the extracted contour.

図14の矢印は、図13で示した色領域の輪郭線の方向を表している。このように輪郭線の外側のブロックは、輪郭線の方向に対して右手側のブロックになる。例えば、{3,3}のブロックでは輪郭線の方向は左であるため、図に示したように上方向のブロックに輪郭線の抽出範囲を拡張する。また{2,3}のブロックにおいては色領域の角に当たるため、左と上の2つの方向の輪郭線が存在する。この場合は、図に示したように上と左を含む正方形のブロックに輪郭線の抽出範囲を拡張する。以上の処理を輪郭線が存在するすべてのブロックについて行う。   The arrow in FIG. 14 represents the direction of the outline of the color region shown in FIG. In this way, the block outside the contour line becomes a block on the right hand side with respect to the direction of the contour line. For example, in the {3, 3} block, the direction of the contour line is left, so that the contour extraction range is extended to the upward block as shown in the figure. Further, in the {2, 3} block, since it hits the corner of the color region, there are contour lines in the left and upper directions. In this case, as shown in the figure, the contour extraction range is extended to a square block including the top and the left. The above processing is performed for all the blocks where the contour exists.

図15は、輪郭線の抽出範囲が設定された範囲を示している。さらに、それに対応するエッジ方向テーブル114を作成する。   FIG. 15 shows a range in which a contour extraction range is set. Furthermore, the corresponding edge direction table 114 is created.

図16は、エッジ方向テーブル114の一例を示したものである。横が縮小画像のX座標、縦が縮小画像のY座標、表の矢印は抽出するエッジの方向である。ここでエッジの方向とは、抽出した色領域から背景領域へ向かう方向、すなわち輪郭線の方向に対して右手側の方向となる。また複数の方向の輪郭線を持つブロックについては、複数のエッジ方向が値としてセットされる。   FIG. 16 shows an example of the edge direction table 114. The horizontal is the X coordinate of the reduced image, the vertical is the Y coordinate of the reduced image, and the arrow in the table is the direction of the edge to be extracted. Here, the edge direction is the direction from the extracted color area to the background area, that is, the direction on the right hand side with respect to the direction of the contour line. For blocks having contour lines in a plurality of directions, a plurality of edge directions are set as values.

次に輪郭特定部115はステップS209で設定した原画像の範囲内において輪郭特定処理を行う(ステップS210)。輪郭特定処理は、微分オペレータやテンプレートマッチングなどさまざまな方法を用いて輪郭となるエッジを検出する処理であり、一般的に知られている画像処理技術である。本実施例においては、代表的なテンプレートマッチングであるPrewittの方法を用いて説明する。   Next, the contour specifying unit 115 performs a contour specifying process within the range of the original image set in step S209 (step S210). The contour specifying process is a process for detecting an edge as a contour using various methods such as a differential operator and template matching, and is a generally known image processing technique. In this embodiment, description will be made using a Prewitt method which is a typical template matching.

図17は輪郭抽出処理におけるPrewittの方法におけるエッジ方向とマスクパターを示している。Prewittの方法は、図17に示したように、輪郭を表す標準パターンとして8つのエッジ方向に対応する8種類のマスクパターンを用意する。入力画素とその近傍の画素に、入力画素をマスクパターンの中央にあてマスクパターンの値を乗じて和をとり、その計算値がマスクパターンに対応するエッジの方向の強さとなる。入力画像は、グレースケール画像メモリ104に記憶されているグレースケール画像を使用する。   FIG. 17 shows the edge direction and the mask pattern in the Prewitt method in the contour extraction process. In the Prewitt method, as shown in FIG. 17, eight types of mask patterns corresponding to eight edge directions are prepared as standard patterns representing contours. The input pixel and its neighboring pixels are summed by multiplying the input pixel at the center of the mask pattern by the value of the mask pattern, and the calculated value becomes the strength in the direction of the edge corresponding to the mask pattern. As the input image, a grayscale image stored in the grayscale image memory 104 is used.

輪郭特定部115はエッジ方向テーブル114を参照し、テーブルに値が設定されている原画像の範囲内において、対応するマスクパターンによりエッジの強さを計算する。例えば図16のエッジ方向テーブル114の{1,2}においては、左方向と上方向のエッジがあることがわかる。それに対応する原画像の範囲は{N,2N}を左上、{2N−1,3N−1}を右下とする範囲になり、その範囲のグレースケール画像の画素に対して、左方向と上方向のエッジを計算する図17のテンプレート(b)、(h)及びその周囲のテンプレート(a)、(c)、(g)を用いて、最もエッジが検出される方向とエッジの強さを計算する。同様に{3,2}においては上方向のエッジがあることがわかるため、対応する原画像の範囲は{3N,2N}を左上、{4N−1,3N−1}を右下とする範囲になり、その範囲のグレースケール画像の画素に対して、上方向のエッジを計算するテンプレート(b)及びその周囲のテンプレート(a)、(c)を用いて、最もエッジが検出される方向とエッジの強さを計算する。   The contour specifying unit 115 refers to the edge direction table 114 and calculates the strength of the edge using the corresponding mask pattern within the range of the original image for which a value is set in the table. For example, in {1, 2} of the edge direction table 114 of FIG. 16, it can be seen that there are left and upward edges. The corresponding range of the original image is a range with {N, 2N} at the upper left and {2N-1, 3N-1} at the lower right. Using the templates (b) and (h) and the surrounding templates (a), (c), and (g) in FIG. 17 for calculating the edge in the direction, the direction in which the edge is detected and the strength of the edge are determined. calculate. Similarly, since {3, 2} has an upward edge, the range of the corresponding original image is a range in which {3N, 2N} is upper left and {4N-1, 3N-1} is lower right. Using the template (b) for calculating the edge in the upward direction and the surrounding templates (a) and (c) for the pixels of the grayscale image in the range, the direction in which the edge is detected most Calculate the edge strength.

このような処理をエッジ方向テーブル114に値が設定されているすべての範囲について行い、原画像における色領域の輪郭特定を行う。一般的な輪郭特定処理では各画素において検出されるエッジの方向はわからないため、全方向に対応するテンプレートを各画素に対して適用しなければならないが、本実施の形態においては、エッジ方向テーブル114に輪郭線の方向が記憶されているため、輪郭線の方向に対応するテンプレートのみを用いればよく、エッジ検出処理時間を大幅に短縮することができる。   Such processing is performed for all the ranges for which values are set in the edge direction table 114, and the outline of the color region in the original image is specified. In a general contour specifying process, the direction of the edge detected in each pixel is not known, so a template corresponding to all directions must be applied to each pixel. In this embodiment, the edge direction table 114 is used. Since the direction of the contour line is stored, only the template corresponding to the direction of the contour line needs to be used, and the edge detection processing time can be greatly shortened.

次に、まだ輪郭特定処理がされていない色領域があるかどうかを調べる(ステップS211)。ある場合はステップS207へ戻り、まだ輪郭特定処理がされていない色領域について、ステップS207からS210までの処理を繰り返し行う。   Next, it is checked whether or not there is a color region that has not been subjected to contour identification processing (step S211). If there is, the process returns to step S207, and the processes from step S207 to S210 are repeated for the color region that has not yet undergone the contour specifying process.

本実施の形態によれば、原画像より色のばらつきを小さくした縮小画像を生成し、これを用いて効率的にかつ精度よく、色分けされた領域を抽出することができ、さらに、抽出した領域から文字領域になりえないような領域を除くことで処理時間を短縮することができる。   According to the present embodiment, it is possible to generate a reduced image in which the color variation is smaller than that of the original image, and to extract the color-coded region efficiently and accurately using the reduced image. The processing time can be shortened by removing an area that cannot be a character area.

なお、本発明は上記に記載した実施の形態に限らず、請求項で示した範囲で数々の変更が可能であり、処理対象もカラー紙面に限らず、物体までの距離を色分けした距離画像からの色領域抽出など、さまざまなカラー画像に応用が可能である。   The present invention is not limited to the embodiment described above, and various modifications can be made within the scope indicated in the claims. The processing target is not limited to the color paper surface, and the distance image to the object is color-coded from the distance image. It can be applied to various color images such as extraction of color areas.

101 画像入力部
102 画像メモリ
103 グレースケール画像生成部
104 グレースケール画像メモリ
105 縮小画像生成部
106 縮小画像メモリ
107 クラスタリング部
108 色領域抽出部
109 クラスタ膨張収縮部
110 色領域メモリ
111 輪郭抽出部
112 色領域消去部
113 輪郭特定範囲設定部
114 エッジ方向テーブル
115 輪郭特定部
DESCRIPTION OF SYMBOLS 101 Image input part 102 Image memory 103 Gray scale image generation part 104 Gray scale image memory 105 Reduction image generation part 106 Reduction image memory 107 Clustering part 108 Color area extraction part 109 Cluster expansion / contraction part 110 Color area memory 111 Outline extraction part 112 Color Area erasing unit 113 Outline specifying range setting unit 114 Edge direction table 115 Outline specifying unit

Claims (8)

画像から領域を抽出する画像処理装置において、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成手段と、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリング手段と、同じ値を有するクラスタを領域として抽出する色領域抽出手段と、抽出した領域の輪郭を抽出する輪郭抽出手段と、前記輪郭抽出手段により抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定手段とを備えることを特徴とする画像処理装置。   In the image processing apparatus for extracting an area from an image, reduced image generating means for dividing the image into a matrix and generating one pixel from a set of pixels in the divided range to generate a reduced image, and the color of the reduced image Clustering means for clustering information into predetermined values, color area extracting means for extracting clusters having the same value as areas, outline extracting means for extracting outlines of the extracted areas, and contours extracted by the outline extracting means And an outline specifying means for specifying the outline of the area of the color-coded original image. 前記縮小画像生成手段は、分割した範囲の画素集合の平均値を縮小画像の画素とすることを特徴とする、請求項1に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the reduced image generation unit uses an average value of a set of pixels in a divided range as a pixel of the reduced image. 前記画像処理装置は、同じクラスタに属する画素の連結を膨張または収縮するクラスタ膨張収縮手段をさらに備えることを特徴とする、請求項1または2に記載の画像処理装置。   The image processing apparatus according to claim 1, further comprising a cluster expansion / contraction unit that expands / contracts connections of pixels belonging to the same cluster. 前記画像処理装置は、前記色領域抽出手段が、同じクラスタに属する画素を連結した領域の画素数が所定の値より小さい領域を抽出しないことを特徴とする、請求項1から3のいずれかに記載の画像処理装置。   4. The image processing apparatus according to claim 1, wherein the color area extraction unit does not extract an area in which the number of pixels in an area where pixels belonging to the same cluster are connected is smaller than a predetermined value. 5. The image processing apparatus described. 前記画像処理装置は、前記色領域抽出手段が、同じクラスタに属する画素を連結した領域の形状を評価し、評価値に合致しない領域を抽出しないことを特徴とする、請求項1から4のいずれかに記載の画像処理装置。   5. The image processing apparatus according to claim 1, wherein the color region extraction unit evaluates the shape of a region in which pixels belonging to the same cluster are connected, and does not extract a region that does not match the evaluation value. An image processing apparatus according to claim 1. 画像から領域を抽出する画像処理方法において、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成ステップと、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリングステップと、同じ値を有するクラスタを領域として抽出する色領域抽出ステップと、抽出した領域の輪郭を抽出する輪郭抽出ステップと、前記輪郭抽出ステップにより抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定ステップとを備えることを特徴とする画像処理方法。   In the image processing method for extracting an area from an image, a reduced image generating step of dividing the image into a matrix and generating one pixel from a set of pixels in the divided range to generate a reduced image, and the color of the reduced image A clustering step for clustering information into predetermined values, a color region extraction step for extracting clusters having the same value as a region, a contour extraction step for extracting a contour of the extracted region, and a contour extracted by the contour extraction step And an outline specifying step for specifying the outline of the area of the color-coded original image. 画像から領域を抽出する画像処理プログラムにおいて、画像をマトリックス状に分割し、分割した範囲の画素の集合から1つの画素を生成して縮小画像を生成する縮小画像生成ステップと、前記縮小画像の色情報を所定の値にクラスタリングするクラスタリングステップと、同じ値を有するクラスタを領域として抽出する色領域抽出ステップと、抽出した領域の輪郭を抽出する輪郭抽出ステップと、前記輪郭抽出ステップにより抽出された輪郭から、色分けされた原画像の領域の輪郭を特定する輪郭特定ステップとをコンピュータに実行させるための画像処理プログラム。   In the image processing program for extracting an area from an image, a reduced image generation step of dividing the image into a matrix and generating one pixel from a set of pixels in the divided range to generate a reduced image, and the color of the reduced image A clustering step for clustering information into predetermined values, a color region extraction step for extracting clusters having the same value as a region, a contour extraction step for extracting a contour of the extracted region, and a contour extracted by the contour extraction step An image processing program for causing a computer to execute an outline specifying step for specifying the outline of a color-coded original image area. 請求項7に記載の画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体。   A computer-readable recording medium on which the image processing program according to claim 7 is recorded.
JP2010122362A 2010-05-28 2010-05-28 Image processing device, image processing method, image processing program, and program storage medium Pending JP2011248702A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010122362A JP2011248702A (en) 2010-05-28 2010-05-28 Image processing device, image processing method, image processing program, and program storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010122362A JP2011248702A (en) 2010-05-28 2010-05-28 Image processing device, image processing method, image processing program, and program storage medium

Publications (1)

Publication Number Publication Date
JP2011248702A true JP2011248702A (en) 2011-12-08

Family

ID=45413869

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010122362A Pending JP2011248702A (en) 2010-05-28 2010-05-28 Image processing device, image processing method, image processing program, and program storage medium

Country Status (1)

Country Link
JP (1) JP2011248702A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017004295A (en) * 2015-06-11 2017-01-05 株式会社ミツバ Traffic light recognition apparatus and traffic light recognition method
JP2019515374A (en) * 2016-08-31 2019-06-06 バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド Method and apparatus for recognizing character areas in an image
CN110120080A (en) * 2019-04-12 2019-08-13 青岛九维华盾科技研究院有限公司 A method of quickly generating standard pattern-painting mass-tone
CN111402232A (en) * 2020-03-16 2020-07-10 深圳市瑞图生物技术有限公司 Method for detecting sperm aggregation in semen
CN111783807A (en) * 2019-04-28 2020-10-16 北京京东尚科信息技术有限公司 Picture extraction method and device and computer-readable storage medium
CN112464850A (en) * 2020-12-08 2021-03-09 东莞先知大数据有限公司 Image processing method, image processing apparatus, computer device, and medium
CN116385435A (en) * 2023-06-02 2023-07-04 济宁市健达医疗器械科技有限公司 Pharmaceutical capsule counting method based on image segmentation

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017004295A (en) * 2015-06-11 2017-01-05 株式会社ミツバ Traffic light recognition apparatus and traffic light recognition method
JP2019515374A (en) * 2016-08-31 2019-06-06 バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド Method and apparatus for recognizing character areas in an image
US10803338B2 (en) 2016-08-31 2020-10-13 Baidu Online Network Technology (Beijing) Co., Ltd. Method and device for recognizing the character area in a image
CN110120080A (en) * 2019-04-12 2019-08-13 青岛九维华盾科技研究院有限公司 A method of quickly generating standard pattern-painting mass-tone
CN110120080B (en) * 2019-04-12 2024-01-05 青岛九维华盾科技研究院有限公司 Method for rapidly generating main color of standard camouflage color
CN111783807A (en) * 2019-04-28 2020-10-16 北京京东尚科信息技术有限公司 Picture extraction method and device and computer-readable storage medium
CN111402232A (en) * 2020-03-16 2020-07-10 深圳市瑞图生物技术有限公司 Method for detecting sperm aggregation in semen
CN111402232B (en) * 2020-03-16 2023-05-16 深圳市瑞图生物技术有限公司 Sperm aggregation detection method in semen
CN112464850A (en) * 2020-12-08 2021-03-09 东莞先知大数据有限公司 Image processing method, image processing apparatus, computer device, and medium
CN112464850B (en) * 2020-12-08 2024-02-09 东莞先知大数据有限公司 Image processing method, device, computer equipment and medium
CN116385435A (en) * 2023-06-02 2023-07-04 济宁市健达医疗器械科技有限公司 Pharmaceutical capsule counting method based on image segmentation
CN116385435B (en) * 2023-06-02 2023-09-26 济宁市健达医疗器械科技有限公司 Pharmaceutical capsule counting method based on image segmentation

Similar Documents

Publication Publication Date Title
CN104751142B (en) A kind of natural scene Method for text detection based on stroke feature
US8947736B2 (en) Method for binarizing scanned document images containing gray or light colored text printed with halftone pattern
Ferrer et al. Lbp based line-wise script identification
JP2011248702A (en) Image processing device, image processing method, image processing program, and program storage medium
JP2005309819A (en) Figure reading method, its device, major color extraction method, and its device
KR20130105952A (en) Method and apparatus for vehicle license plate recognition
JP5974589B2 (en) Image processing apparatus and program
CN110766017B (en) Mobile terminal text recognition method and system based on deep learning
CN110781877B (en) Image recognition method, device and storage medium
JP2010218420A (en) Character recognition apparatus, image reading apparatus, and program
CN110598566A (en) Image processing method, device, terminal and computer readable storage medium
JP4391704B2 (en) Image processing apparatus and method for generating binary image from multi-valued image
CN115578741A (en) Mask R-cnn algorithm and type segmentation based scanned file layout analysis method
Ntzios et al. An old greek handwritten OCR system based on an efficient segmentation-free approach
US8229214B2 (en) Image processing apparatus and image processing method
JP5796107B2 (en) Method and apparatus for text detection
CN115410191B (en) Text image recognition method, device, equipment and storage medium
Hesham et al. A zone classification approach for arabic documents using hybrid features
JP4492258B2 (en) Character and figure recognition and inspection methods
Sherkat et al. Use of colour for hand-filled form analysis and recognition
Chitrakala et al. An efficient character segmentation based on VNP algorithm
Sambyal et al. Connected component based English character set segmentation
Priya et al. A wavelet based method for text segmentation in color images
JPH05342412A (en) Extracting system for gradient vector and feature extracting system for character recognition
JPH09305707A (en) Image extracting system

Legal Events

Date Code Title Description
RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20130131