JP2006268339A - Method for generating list of connected elements of image - Google Patents

Method for generating list of connected elements of image Download PDF

Info

Publication number
JP2006268339A
JP2006268339A JP2005084414A JP2005084414A JP2006268339A JP 2006268339 A JP2006268339 A JP 2006268339A JP 2005084414 A JP2005084414 A JP 2005084414A JP 2005084414 A JP2005084414 A JP 2005084414A JP 2006268339 A JP2006268339 A JP 2006268339A
Authority
JP
Japan
Prior art keywords
image
connected component
window frame
list
variable
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
JP2005084414A
Other languages
Japanese (ja)
Inventor
Kanji Yokogawa
完治 横川
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.)
Hitachi Software Engineering Co Ltd
Original Assignee
Hitachi Software Engineering Co Ltd
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 Hitachi Software Engineering Co Ltd filed Critical Hitachi Software Engineering Co Ltd
Priority to JP2005084414A priority Critical patent/JP2006268339A/en
Publication of JP2006268339A publication Critical patent/JP2006268339A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an efficient method for extracting connected elements corresponding to an object in an image and arranging the image of the connected elements according to a feature quantity of the connected elements. <P>SOLUTION: The method for generating a list of connected elements comprises a step for converting a grayscale image into a binary image, a labeling step for generating a label image with a certain number for each of the connected elements assigned to pixels of the connected elements on the binary image, a window framing step for setting up a minimum rectangle enclosing each of the connected elements with reference to the label image, a feature extracting step for calculating the feature quantity of each of the connected elements, a sorting step for sorting the connected elements according to the feature quantity, and a drawing step for generating a list image of the connected elements to display a list of images of the connected elements in the sorted order. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、画像処理技術に関し、特にコンピュータを使用して画像連結成分の一覧を作成する方法において、画像中のオブジェクトに対応する画像の連結成分の一覧を作成する技術に関する。   The present invention relates to an image processing technique, and more particularly to a technique for creating a list of connected components of an image corresponding to an object in an image in a method for creating a list of image connected components using a computer.

一般に、多数のオブジェクトが存在する画像を、人手で解析しカウントしたり分類したりするのは、多くの場合、困難である。この問題を解決するために、コンピュータに作業を支援させることが考えられる。   In general, it is often difficult to manually analyze, count, and classify an image having a large number of objects. In order to solve this problem, it is conceivable to let the computer support the work.

薬の錠剤などのようにオブジェクトの形状・大きさが強く制限されている場合については、コンピュータにより自動的にカウントする方法が知られている(例えば特許文献1、特許文献2参照)。   In the case where the shape and size of an object is strongly limited, such as a medicine tablet, a method of automatically counting by a computer is known (for example, see Patent Document 1 and Patent Document 2).

特開平09-231342号公報JP 09-231342 A 特開平07-282219号公報Japanese Unexamined Patent Publication No. 07-282219

しかしながら、複雑な形状のオブジェクトについての処理については未開拓である。   However, processing for objects with complex shapes has not been developed yet.

例えば、食品を扱う工場や販売店では、衛生管理のために、常時、害虫の調査を行っている。従来は、接着剤を塗った紙、いわゆる捕虫紙を一定の期間、所定の場所に配置し、捕虫紙により捕らえられた虫を人手により分類していた。このような、虫を分類する作業は時間がかかるとともに、経験や能力の個人差が大きいことから、結果にばらつきが生じることが問題となっていた。そこで、コンピュータを用いて分類作業を半自動化することが望まれていた。   For example, factories and dealers that handle food constantly investigate pests for hygiene management. Conventionally, paper coated with an adhesive, so-called insect trap paper, is placed in a predetermined place for a certain period, and insects caught by the trap insect paper are classified manually. Such an operation for classifying insects takes time, and since there are large individual differences in experience and ability, there has been a problem that the results vary. Therefore, it has been desired to semi-automate the classification work using a computer.

また、衛星画像を利用した交通量観測についても同様な問題がある。交通量観測作業は、交通量を把握し、渋滞状況の情報を各車輌に与えて渋滞を避けさせるなどにより渋滞を緩和するための有効な手段である。衛星画像を使った交通量観測は、道路にセンサを設置して交通量を観測する方法に比べて、コストが安いという利点があり、各方面からその実現が期待されている。しかしながら、衛星画像から車輌を全自動的に検出することは現在の技術では不可能である。したがって、人手で衛星画像を解析する必要があるが、直接、この画像を解析するのは困難であるため、何らかの方法によって画像解析を支援することが望まれている。   There is a similar problem in traffic volume observation using satellite images. The traffic volume observation work is an effective means for reducing traffic congestion by grasping traffic volume and giving information on traffic congestion status to each vehicle to avoid traffic congestion. Traffic volume observation using satellite images has the advantage of lower costs compared to the method of observing traffic volume by installing sensors on the road, and its realization is expected from various directions. However, it is impossible with the current technology to detect a vehicle from a satellite image fully automatically. Therefore, it is necessary to manually analyze the satellite image. However, since it is difficult to directly analyze the image, it is desired to support the image analysis by some method.

本発明の目的は、複雑な形状のオブジェクトについても画像中のオブジェクトに対応する連結成分を抽出し、連結成分の特徴量に従って連結成分の像を配置する効率的な方法を求めることである。   An object of the present invention is to obtain an efficient method for extracting a connected component corresponding to an object in an image even for an object having a complicated shape and arranging an image of the connected component according to a feature amount of the connected component.

画像中に多数のオブジェクトが存在する場合に、オペレータがオブジェクトを識別するには、背景の影響を避けるなどのために、画像から個々のオブジェクトを抽出し、適当な基準に従ってオブジェクトを並べて表示することが効果的である。例えば、捕虫紙をカメラで撮影し、その画像をコンピュータで処理し、虫を大きさの順に並べることにより、虫の分類作業効率が向上する。   If there are many objects in the image, the operator can identify the objects by extracting individual objects from the image and displaying them side by side according to appropriate criteria, such as to avoid background effects. Is effective. For example, insect trapping paper is photographed with a camera, the image is processed with a computer, and the insects are arranged in order of size, so that the insect classification work efficiency is improved.

図1は、捕虫紙を撮影した画像である。捕虫紙上には多数の大小様々な形状の虫が捕らえられている。図3は捕虫紙上の虫を切り取って、虫の占める面積の広い順に並べた図である。矢印の方向にいくに従って虫の面積が狭くなる。図1又はそれを2値化した図2を利用するよりは、図3を使う方が能率的に虫の分類を行うことができる。   FIG. 1 is an image obtained by photographing insect trapping paper. Many insects of various sizes are captured on the trapping paper. FIG. 3 is a diagram in which the insects on the trapping paper are cut out and arranged in order of increasing area occupied by the insects. As you go in the direction of the arrow, the insect area decreases. Rather than using FIG. 1 or binarized FIG. 2, using FIG. 3 can more efficiently classify insects.

また、衛星画像についても同様の処理を行って、交通量の観測を容易にすることができる。図4(a)は処理対象の衛星画像であり、この画像中の車輌の数をカウントする。図4(c)は衛星画像中のオブジェクトを面積の広い順に並べた画像である。より具体的には、矢印の指す方向に向けてオブジェクトの面積が狭くなる。この画像には車輌の他に交通標識や車線の断片などのオブジェクトが紛れ込んでいるが、オペレータは図4(c)を使えば、図4(a)またはそれを2値化した図4(b)を使うより、より容易にオブジェクトの形状から車輌を選び出してカウントすることができる。   In addition, the same processing can be performed on the satellite image to facilitate traffic volume observation. FIG. 4A shows a satellite image to be processed, and the number of vehicles in this image is counted. FIG. 4 (c) is an image in which objects in a satellite image are arranged in order of increasing area. More specifically, the area of the object becomes narrower in the direction indicated by the arrow. This image contains objects such as traffic signs and lane fragments in addition to the vehicle. If the operator uses FIG. 4 (c), FIG. 4 (a) or binarized FIG. 4 (b) ) Can be selected and counted from the object shape more easily.

より詳細には、本発明は、濃淡画像を2値画像に変換する2値化ステップと、2値画像上の連結成分の画素に連結成分ごとに定まった番号を割り振られたラベル画像を生成するラベリングステップと、ラベル画像を参照して、各連結成分を囲む最小の長方形を設定する窓枠ステップと、各連結成分の特徴量を算出する特徴抽出ステップと、特徴量に従って連結成分をソートするソートステップと、ソートされた順に連結成分の像の一覧を表示する連結成分一覧画像を生成する描画ステップと、からなることを特徴とする連結成分一覧作成方法である。   More specifically, the present invention generates a label image in which a grayscale image is converted into a binary image, and a label image in which a number determined for each connected component is assigned to pixels of the connected component on the binary image. A labeling step, a window frame step for setting a minimum rectangle surrounding each connected component with reference to the label image, a feature extracting step for calculating a feature amount of each connected component, and a sort for sorting the connected components according to the feature amount A connected component list creating method comprising: a step; and a drawing step for generating a connected component list image that displays a list of connected component images in sorted order.

上記窓枠ステップにおいて、まず、各連結成分iについて変数x min に十分大きな初期値を設定し、変数x maxに十分小さな初期値を設定し、変数y minに十分大きな初期値を設定し、変数y maxに十分小さな初期値を設定し、次に、ラベル画像をラスタ走査して、現在の位置(x, y)が連結成分i上であれば、xがx minより小さい時、x minにxの値を代入し、xがx maxより大きい時、x max にxの値を代入し、yがy minより小さい時、y minにyの値を代入し、yがy maxより大きい時、y maxにyの値を代入して各連結成分を囲む最小の長方形を設定することを特徴とする連結成分一覧作成方法による。 In the window frame step, first, for each connected component i, a sufficiently large initial value is set for the variable x i min , a sufficiently small initial value is set for the variable x i max, and a sufficiently large initial value is set for the variable y i min. If the variable y i max is set to a sufficiently small initial value, and then the label image is raster scanned and the current position (x, y) is on the connected component i, x is smaller than x i min when, assigns the value of x to x i min, when x is greater than x i max, assigns the value of x to x i max, when y is smaller than y i min, the value of y to y i min assignment, and when y is greater than y i max, by connected component list generation method characterized by setting the minimum rectangle surrounding each connected component by substituting the value of y to y i max.

図5(a)は処理対象である画像を濃淡により表した図である。図5(a)に示される数字は画素の濃度を示す。図5(b)は濃淡画像に対して閾値を5として2値化された2値画像である。すなわち、濃淡画像中の濃度が5以上の画素は領域に、5未満の画素は背景に変換されている。2値画像の数字1は領域の画素であること、また、数字0は背景の画素を意味する。尚、図1のようにオブジェクトが濃淡画像の濃度が低い領域に対応している場合は、濃淡画像を濃度の反転した画像に変換した後に2値化を行う。図5(b)の2値画像の中には三つの連結成分がある。画素の連結性は注目している画素の上下左右とともに斜め方向も考慮した、いわゆる、8連結で定義されたものを採用している。図5(c)は2値画像に対してラベリングの処理を施した結果のラベル画像である(非特許文献1参照)。   FIG. 5A is a diagram showing the image to be processed by shading. The numbers shown in FIG. 5A indicate the pixel density. FIG. 5B shows a binary image obtained by binarizing a grayscale image with a threshold value of 5. That is, pixels with a density of 5 or more in the grayscale image are converted to regions, and pixels less than 5 are converted to the background. The number 1 in the binary image is a region pixel, and the number 0 means a background pixel. In the case where the object corresponds to an area where the density of the grayscale image is low as shown in FIG. 1, binarization is performed after the grayscale image is converted into an image with inverted density. There are three connected components in the binary image of FIG. For the connectivity of the pixels, what is defined by so-called 8-connection that takes into account the diagonal direction as well as the top, bottom, left, and right of the pixel of interest is adopted. FIG. 5C shows a label image obtained as a result of labeling processing performed on a binary image (see Non-Patent Document 1).

八木伸行・他7名:C言語で学ぶ実践画像処理、第7章、pp.95−108:オーム社(平成4年)Nobuyuki Yagi and 7 others: Practical image processing learned in C language, Chapter 7, pp.95-108: Ohmsha (1992)

尚、ラベリングとは連結している画素同士には同一の番号を割り当て、分離している画素に対しては異なった番号を割り付ける処理のことである。ラベル画像中で背景の画素の値は0に設定され、三つの連結成分の画素は1から3までの数字で連結成分ごとに番号付けされている。図5(d)はラベル画像中の各連結成分に窓枠を設定した様子を示す図である。本命最初において、「窓枠」は、連結成分を囲む最小の長方形を意味し、この長方形の左上の画素と右下の画素の座標によって窓枠の位置が定義される。窓枠501が“1”、窓枠502が“2”、窓枠503が“3”の数字(番号)を付した連結成分に関する窓枠である。次に、連結成分の特徴量を抽出する。特徴量には、例えば面積、周囲長、円形度など様々な特徴量があるが、ここでは特徴量として面積を対象としている。   Labeling is a process of assigning the same number to connected pixels and assigning different numbers to separated pixels. The value of the background pixel in the label image is set to 0, and the pixels of the three connected components are numbered for each connected component with numbers from 1 to 3. FIG. 5D is a diagram showing a state in which a window frame is set for each connected component in the label image. First, “window frame” means the smallest rectangle surrounding the connected component, and the position of the window frame is defined by the coordinates of the upper left pixel and the lower right pixel of this rectangle. The window frame 501 is a window frame related to a connected component with a number (number) of “1”, window frame 502 “2”, and window frame 503 “3”. Next, the feature amount of the connected component is extracted. The feature amount includes various feature amounts such as an area, a perimeter, and a circularity, but here, the area is targeted as the feature amount.

連結成分1(窓枠1)、連結成分2(窓枠2)、連結成分3(窓枠3)の面積は、それぞれ8画素、6画素、9画素である。図5(e)は連結成分をその面積の順に左から右、上から下に並べた画像である。すなわち、この画像中の左上に連結成分3が、その右に連結成分1が、左下に連結成分2が配置されている。各連結成分の画素の値は元の濃淡画像での濃度(輝度)を表している。   The areas of the connected component 1 (window frame 1), the connected component 2 (window frame 2), and the connected component 3 (window frame 3) are 8 pixels, 6 pixels, and 9 pixels, respectively. FIG. 5 (e) is an image in which connected components are arranged in order of area from left to right and from top to bottom. That is, the connected component 3 is arranged at the upper left in the image, the connected component 1 is arranged at the right, and the connected component 2 is arranged at the lower left. The value of each connected component pixel represents the density (luminance) in the original grayscale image.

本発明の画像中のオブジェクトに対応する連結成分を抽出し、連結成分の特徴量に従って連結成分の像を配置する方法によれば、オペレータが容易にオブジェクトをカウントしたり、分類したりすることができるようになる。また、窓枠を使うことにより、連結成分の情報を高速に抽出することが可能である。   According to the method of extracting connected components corresponding to objects in an image of the present invention and arranging images of the connected components according to the feature quantities of the connected components, the operator can easily count or classify the objects. become able to. Further, by using a window frame, it is possible to extract information on connected components at high speed.

以下、本発明の一実施の形態による連結成分一覧作成方法について説明を行う。図6は本発明の一実施の形態による連結成分一覧作成を行う画像処理システムの例を示す機能ブロック図である。本実施の形態による画像処理システムは、入力装置と、出力装置と、処理装置と、記憶装置と、を有している。入力装置は、例えばキーボード601又はマウスである。キーボード601、マウスは、パラメータの入力やコマンドの起動などに使われる。出力装置は、例えばLCDディスプレイ615が備えられている。ディスプレイ615は、各種の画像の表示やデータ処理の確認などに利用される。処理装置602は、2値化モジュール603と、ラベリングモジュール604と、窓枠モジュール605と、面積算出モジュール606と、ソートモジュール607と、描画モジュール608と、例えば6つのモジュールを含む。   Hereinafter, a connected component list creation method according to an embodiment of the present invention will be described. FIG. 6 is a functional block diagram showing an example of an image processing system for creating a connected component list according to an embodiment of the present invention. The image processing system according to the present embodiment includes an input device, an output device, a processing device, and a storage device. The input device is, for example, a keyboard 601 or a mouse. The keyboard 601 and the mouse are used for parameter input and command activation. The output device is provided with an LCD display 615, for example. The display 615 is used for displaying various images and confirming data processing. The processing device 602 includes a binarization module 603, a labeling module 604, a window frame module 605, an area calculation module 606, a sorting module 607, and a drawing module 608, for example, six modules.

記憶装置609は、2値化モジュール603と描画モジュール608の入力である濃淡画像610と、2値化モジュール603の出力でラベリングモジュール604の入力である2値画像611と、ラベリングモジュール604の出力で窓枠モジュール605の入力であるラベル画像612と、描画モジュール608の出力である作業用画像613と、窓枠モジュール605の出力である領域配列614と、を記憶するそれぞれの記憶領域を含む。   The storage device 609 is a grayscale image 610 that is an input of the binarization module 603 and the drawing module 608, a binary image 611 that is an input of the labeling module 604 at the output of the binarization module 603, and an output of the labeling module 604. Each storage area stores a label image 612 that is an input of the window frame module 605, a work image 613 that is an output of the drawing module 608, and an area array 614 that is an output of the window frame module 605.

図7は、図6の窓枠モジュール605における処理の詳細な流れを示すフローチャート図である。このフローチャート図には、領域配列と呼ばれる配列rが含まれている。領域配列rの要素r[i]は連結成分iについての情報を持つ構造体であり、図9(b)に示すように、id、xmin、xmax、ymin、ymax、sの六つのメンバを含む。idは連結成分iの識別子であり、xmin・xmax・ymin・ymaxは連結成分iを囲む窓枠を指定する。sは連結成分iの面積を表す。   FIG. 7 is a flowchart showing a detailed flow of processing in the window frame module 605 of FIG. This flowchart includes an array r called a region array. Element r [i] of region array r is a structure having information about connected component i, and includes six members of id, xmin, xmax, ymin, ymax, and s, as shown in FIG. 9B. . id is an identifier of the connected component i, and xmin, xmax, ymin, and ymax specify a window frame surrounding the connected component i. s represents the area of the connected component i.

図7に示すように、本実施の形態による窓枠モジュール605における処理は、1)ステップ701からステップ708までの処理であって領域配列rに初期値を設定する処理部分と、2)ステップ709からステップ724までの処理であって領域配列rに窓枠の情報をセットする部分と、に分かれる。フローチャートの前半の部分(上記1))では、ラベル画像中の連結成分の個数をnRegionとすると、変数iを1からnRegionまで変えながら、ステップ704において領域配列の要素r[i]のメンバidにiを、ステップ705においてメンバxminに適当に大きな数bigNを、ステップ706においてメンバxmaxに適当に小さな数smallNを、ステップ707においてメンバyminに適当に大きな数bigNを、ステップ708においてメンバymaxに適当に小さな数smallNをそれぞれ代入する。   As shown in FIG. 7, the processing in the window frame module 605 according to the present embodiment is 1) processing from step 701 to step 708, and a processing part for setting an initial value in the region array r, and 2) step 709. And the process from step 724 to step 724, where the window frame information is set in the area array r. In the first half of the flowchart (1) above, if the number of connected components in the label image is nRegion, the variable i is changed from 1 to nRegion, and in step 704, the member id of the element r [i] of the region array is changed. i, an appropriate large number bigN for member xmin in step 705, an appropriately small number smallN for member xmax in step 706, an appropriately large number bigN for member ymin in step 707, and an appropriate number yN for member ymax in step 708 Substitute small numbers smallN respectively.

画像のx軸の方向は、紙面上において左から右へ向いており、y軸の方向は紙面において上から下へ向いている。画像のx軸方向のサイズをWで、y軸方向のサイズをHで表す。フローチャートの後半の部分ではステップ709からステップ714までにおいて、ラベル画像を左から右へ、上から下へ走査する。ステップ715で座標(x, y)のラベル画像の画素の値を変数iに代入する。この画素が連結成分の画素であるか否かをチェックするために、ステップ716において変数iの値が0か否かを判定する。変数iの値が0であれば、連結成分の画素ではないためステップ714に進み、走査を繰り返す。変数iの値が0でなければ、連結成分の画素であるため、ステップ717に進む。そこで領域配列の要素r[i]のメンバxminがxより大きいか否かを判定し、大きい場合は(YES)、ステップ718でメンバxminにxを代入する。ステップ719でメンバxmaxがxより小さいか否かを判定し、小さければ(YES)、ステップ720でメンバxmaxにxを代入する。同様の処理をメンバyminとメンバymaxとについてステップ721からステップ724までのステップにおいて行う。走査を終了すると、領域配列の要素r[i]のメンバxminは連結成分iの左端のx座標の値を、メンバxmaxは右端のx座標の値を、メンバyminは上端のy座標の値を、メンバymaxは下端のy座標の値をそれぞれ持つことになる。本実施の形態によるフローチャート図の表すアルゴリズムを用いると、ラベル画像を一度走査するだけで処理が行えるため極めて効率が良いという利点がある。   The x-axis direction of the image is from left to right on the paper surface, and the y-axis direction is from top to bottom on the paper surface. The size of the image in the x-axis direction is represented by W, and the size in the y-axis direction is represented by H. In the latter half of the flowchart, in step 709 to step 714, the label image is scanned from left to right and from top to bottom. In step 715, the value of the pixel of the label image at coordinates (x, y) is substituted into variable i. In order to check whether or not this pixel is a connected component pixel, it is determined in step 716 whether or not the value of the variable i is zero. If the value of the variable i is 0, since it is not a connected component pixel, the process proceeds to step 714 to repeat scanning. If the value of the variable i is not 0, the pixel is a connected component, and the process proceeds to step 717. Therefore, it is determined whether or not the member xmin of the element r [i] of the region array is larger than x. If it is larger (YES), x is substituted into the member xmin in Step 718. In step 719, it is determined whether or not the member xmax is smaller than x. If it is smaller (YES), x is substituted into the member xmax in step 720. A similar process is performed in steps 721 to 724 for the member ymin and the member ymax. At the end of scanning, the member xmin of the element r [i] of the region array is the value of the left end x coordinate of the connected component i, the member xmax is the value of the right end x coordinate, and the member ymin is the value of the upper end y coordinate. , Member ymax has the value of the y-coordinate at the lower end. The use of the algorithm represented by the flowchart according to the present embodiment has an advantage that the processing can be performed only by scanning the label image once, so that it is extremely efficient.

図8は、図6の面積算出モジュール606における処理の詳細を示すフローチャート図である。このフローチャート図には、ステップ801からステップ803までの変数iについてのループと、ステップ805からステップ807までの変数yについてのループと、ステップ808からステップ810までの変数xについてのループが含まれる。最初のループでは、変数iは連結成分を表し、1からnRegionまで変わる。後の二つのループでは変数yはr[i].yminからr[i].ymaxまで変わり、変数xはr[i].xminからr[i].xmaxまで変わる。すなわち、これらのループでは、連結成分iを囲む窓枠を左から右へ、上から下へ走査する。図8において、全ての連結成分iについて、領域配列の要素のメンバr[i].sを0に初期化し(ステップ804)、連結成分iを囲む窓枠内のラベル画像の画素が連結成分iの画素であれば(ステップ811)、メンバr[i].sの値を一つ増やして(ステップ812)連結成分iの面積を算出する。この窓枠を使った面積算出アルゴリズムにおいては最小限の画素にアクセスするだけで良いため、算出処理の効率が良いという利点がある。   FIG. 8 is a flowchart showing details of processing in the area calculation module 606 of FIG. This flowchart includes a loop for variable i from step 801 to step 803, a loop for variable y from step 805 to step 807, and a loop for variable x from step 808 to step 810. In the first loop, the variable i represents the connected component and varies from 1 to nRegion. In the latter two loops, the variable y changes from r [i] .ymin to r [i] .ymax, and the variable x changes from r [i] .xmin to r [i] .xmax. That is, in these loops, the window frame surrounding the connected component i is scanned from left to right and from top to bottom. In FIG. 8, the element r [i] .s of the region array element is initialized to 0 for all connected components i (step 804), and the pixels of the label image in the window frame surrounding the connected components i are connected components i. (Step 811), the value of the member r [i] .s is incremented by one (step 812), and the area of the connected component i is calculated. In the area calculation algorithm using the window frame, it is only necessary to access the minimum number of pixels, so that there is an advantage that the calculation process is efficient.

次に図6のソートモジュール607が連結成分をその面積が大きい順にソートする。図9(a)はソートで使われる配列orderの要素の構造を示したものである。図9(a)に示すように、要素はメンバsとメンバidからなる構造体である。order[i].sとorder[i].idの初期値はそれぞれr[i].sとr[i].idである。図9(c)は図5(d)の窓枠付きラベル画像と領域配列rと配列orderの関係を示した図である。図9(c)の左側の配列orderはソート前の状態を示し、右側の配列orderはソート後の状態を示す。ソートの結果、連結成分3・連結成分1・連結成分2の順に配列orderの要素を並べることができる。   Next, the sorting module 607 in FIG. 6 sorts the connected components in descending order of area. FIG. 9 (a) shows the structure of the elements of the array order used for sorting. As shown in FIG. 9A, the element is a structure composed of a member s and a member id. The initial values of order [i] .s and order [i] .id are r [i] .s and r [i] .id, respectively. FIG. 9C is a diagram showing the relationship between the label image with a window frame, the region array r, and the array order in FIG. The array order on the left side of FIG. 9C shows the state before sorting, and the array order on the right side shows the state after sorting. As a result of the sorting, the elements of the array order can be arranged in the order of connected component 3, connected component 1, and connected component 2.

図10は図6の描画モジュール608の処理の詳細を示すフローチャート図である。描画モジュール608は、連結成分を面積の大きい順に出力画像の左から右に並べて描画する。一行に収まりきれない場合には改行を行う。変数xと変数yとは連結成分を出力画像中に配置した時の連結成分を囲む窓枠の左上の点のx座標とy座標を意味する。変数dyは一行の連結成分中でy方向の最も大きいサイズを求めるための変数である。   FIG. 10 is a flowchart showing details of processing of the drawing module 608 of FIG. The drawing module 608 draws the connected components by arranging them from the left to the right of the output image in descending order of area. If it cannot fit on one line, a line feed is performed. The variables x and y mean the x and y coordinates of the upper left point of the window frame surrounding the connected component when the connected component is arranged in the output image. The variable dy is a variable for obtaining the largest size in the y direction in one row of connected components.

図10に示すように、まず、ステップ1001からステップ1003までにおいて、変数x、変数y、および、変数dyに初期値0を設定する。次に、ステップ1004において変数iに1を代入する。ステップ1005においてiが連結成分の個数nRegion以下か否かを判定する。nRegion以下でないなら(NO)、処理を終了する(return)。nRegion以下なら(YES)、ステップ1006においてi番目に面積の大きい連結成分の識別子を得るために、order[i].idの値を変数idに代入する。次に、ステップ1007において連結成分idを出力画像中に配置した時の右端のx座標xRightを算出する。ステップ1008においてxRightが出力画像の幅Wより大きいか否かを判定する。大きくなければ(NO)、ステップ1013において連結成分idを出力画像中に配置した時の下端のy座標yLowを算出する。ステップ1014においてyLowが出力画像の高さHより大きいか否かを判定する。大きければ(YES)、処理を終了する(return)。大きくなければ(NO)、ステップ1015において手続きdraw(id, x, y)を呼んで、連結成分idを描き込む。次に、ステップ1016とステップ1017とにおいてdyと連結成分idの高さを比較して、dyの方が小さければ、dyに連結成分idの高さを代入する。   As shown in FIG. 10, first, in step 1001 to step 1003, initial values 0 are set to the variable x, the variable y, and the variable dy. Next, in step 1004, 1 is substituted into the variable i. In step 1005, it is determined whether i is less than or equal to the number n of connected components. If it is not less than nRegion (NO), the process is terminated (return). If nRegion or less (YES), the value of order [i] .id is substituted into the variable id to obtain the identifier of the connected component with the i-th largest area in Step 1006. In step 1007, the right end x-coordinate xRight when the connected component id is arranged in the output image is calculated. In step 1008, it is determined whether xRight is larger than the width W of the output image. If not larger (NO), in step 1013, the y coordinate yLow of the lower end when the connected component id is arranged in the output image is calculated. In step 1014, it is determined whether yLow is greater than the height H of the output image. If it is larger (YES), the process is terminated (return). If not larger (NO), the procedure draw (id, x, y) is called in step 1015 to draw the connected component id. Next, in step 1016 and step 1017, dy and the height of the connected component id are compared. If dy is smaller, the height of the connected component id is substituted into dy.

次に、ステップ1018において、変数xをxRightと連結成分間の間隔SPACEを加算した値にする。ステップ1019において変数iの値を1つ増やし、ステップ1005に戻ってループする。ステップ1008で大きければ(YES)、改行の処理を行う。すなわち、ステップ1009において変数xの値を0にし、ステップ1010において変数yの値をy + dy + SPACEにする。ステップ1011において変数dyの値を0にする。ステップ1012において変数yが出力画像の高さHより大きいか否かを判定する。変数yが出力画像の高さHより大きければ(YES)、処理を終了する。変数yが出力画像の高さHより大きくなければ(NO)、ステップ1005に戻り、ループする。   Next, in step 1018, the variable x is set to a value obtained by adding xRight and the interval SPACE between connected components. In step 1019, the value of the variable i is incremented by 1, and the process returns to step 1005 to loop. If it is larger in step 1008 (YES), a line feed process is performed. That is, in step 1009, the value of the variable x is set to 0, and in step 1010, the value of the variable y is set to y + dy + SPACE. In step 1011, the value of the variable dy is set to zero. In step 1012, it is determined whether the variable y is greater than the height H of the output image. If the variable y is larger than the height H of the output image (YES), the process is terminated. If the variable y is not greater than the height H of the output image (NO), the process returns to step 1005 and loops.

図11は、図10のステップ1015で呼んでいる手続きdraw(id, x, y)の詳細を示すフローチャート図である。図11に示すフローチャート図には、ステップ1101からステップ1103までの変数y1についてのループと、ステップ1104からステップ1106までの変数x1についてのループがある。二つのループでは変数y1はr[id].yminからr[id].ymaxまで変わり、変数x1はr[id].xminからr[id].xmaxまで変わる。すなわち、これらのループでは連結成分idを囲む窓枠を左から右へ、上から下へ走査する。ステップ1107で座標(x1, y1)のラベル画像の画素が連結成分idの画素であるか否かを判定する。座標(x1, y1)のラベル画像の画素が連結成分idの画素でなければ(NO)、直接、ステップ1106へ進む。座標(x1, y1)のラベル画像の画素が連結成分idの画素であれば(YES)、ステップ1108とステップ1109とで連結成分idを囲む窓枠の左上の点(r[id].xmin, r[id].ymin)を点(x, y)に対応させる平行移動によって、点(x1, y1)を点(x2, y2)に変換する。ステップ1110で入力画像imgInの座標(x1, y1)の画素の値を出力画像imgOutの座標(x2, y2)の画素に代入する。次にステップ1106へ進む。ステップ1106では変数x1の値を一つ増やし、ステップ1105に戻ってループする。   FIG. 11 is a flowchart showing details of the procedure draw (id, x, y) called in step 1015 of FIG. The flowchart shown in FIG. 11 includes a loop for variable y1 from step 1101 to step 1103 and a loop for variable x1 from step 1104 to step 1106. In the two loops, the variable y1 changes from r [id] .ymin to r [id] .ymax, and the variable x1 changes from r [id] .xmin to r [id] .xmax. That is, in these loops, the window frame surrounding the connected component id is scanned from left to right and from top to bottom. In step 1107, it is determined whether the pixel of the label image at the coordinates (x1, y1) is a pixel of the connected component id. If the pixel of the label image at the coordinates (x1, y1) is not a pixel of the connected component id (NO), the process proceeds directly to step 1106. If the pixel of the label image at the coordinates (x1, y1) is a pixel of the connected component id (YES), in step 1108 and step 1109, the upper left point (r [id] .xmin, The point (x1, y1) is converted to the point (x2, y2) by the parallel movement that corresponds r [id] .ymin) to the point (x, y). In step 1110, the value of the pixel at the coordinates (x1, y1) of the input image imgIn is substituted into the pixel at the coordinates (x2, y2) of the output image imgOut. Next, the process proceeds to step 1106. In step 1106, the value of the variable x1 is incremented by one, and the process returns to step 1105 to loop.

この窓枠を使ったアルゴリズムは最小限の画素にアクセスするので、効率が良い。従来の方法(非特許文献1p.108)では、一つの連結成分を描く毎に画像全体を走査する必要があるため、全体で連結成分の個数だけ画像全体を走査する。一方、本実施の形態による窓枠を使ったアルゴリズムでは、連結成分の窓枠内だけを走査すればよいので、全ての連結成分を描くのに高々一回の画像全体の走査で済む。   This window frame algorithm is efficient because it accesses the minimum number of pixels. In the conventional method (Non-patent Document 1 p.108), since it is necessary to scan the entire image every time one connected component is drawn, the entire image is scanned by the number of connected components as a whole. On the other hand, in the algorithm using the window frame according to the present embodiment, since it is only necessary to scan the inside of the window frame of the connected components, it is only necessary to scan the entire image at most once to draw all the connected components.

尚、上記の例では、虫や常在などの画像解析を例にして説明したが、例えば、天体写真、星の明るさなどに関する解析にも利用できることは言うまでもない。また、上記各処理をコンピュータに実行させるためのプログラムも本発明の範疇に入るものである。   In the above example, image analysis such as insects and resident is described as an example, but it goes without saying that it can also be used for analysis of astronomical photographs, star brightness, and the like. A program for causing a computer to execute each of the above processes also falls within the scope of the present invention.

以上、本実施の形態による画像処理技術における連結成分一覧作成方法においては、画像中のオブジェクトに対応する連結成分を抽出し、連結成分の特徴量に従って連結成分の像を配置する方法により、オペレータが容易にオブジェクトをカウントしたり、分類したりすることができるようになった。また、窓枠を使うことにより、連結成分の情報を高速に抽出することができるという利点がある。   As described above, in the connected component list creation method in the image processing technique according to the present embodiment, the operator extracts the connected component corresponding to the object in the image and arranges the image of the connected component according to the feature amount of the connected component. You can now easily count and classify objects. Moreover, there is an advantage that the information of the connected component can be extracted at high speed by using the window frame.

本発明は画像処理技術に利用可能である。   The present invention is applicable to image processing technology.

捕虫紙の濃淡画像の例を示す図である。It is a figure which shows the example of the light and shade image of insect trap paper. 捕虫紙の2値画像の例を示す図である。It is a figure which shows the example of the binary image of insect trap paper. 捕虫紙の連結成分一覧を示す図である。It is a figure which shows the connection component list of insect trap paper. 道路の衛星画像の処理例を示す図である。It is a figure which shows the example of a process of the satellite image of a road. 本実施の形態による濃淡画像の処理例を示す図である。It is a figure which shows the example of a process of the grayscale image by this Embodiment. 本実施の形態による画像処理ハードウェアシステムのブロック図を示す図である。It is a figure which shows the block diagram of the image processing hardware system by this Embodiment. 窓枠モジュール605の処理の詳細を示すフローチャート図である。It is a flowchart figure which shows the detail of a process of the window frame module 605. FIG. 面積算出モジュール606の処理の詳細を示すフローチャート図である。FIG. 10 is a flowchart showing details of processing of an area calculation module 606. 窓枠付きラベル画像と領域配列rと配列orderとの関係を示す図である。It is a figure which shows the relationship between the label image with a window frame, area | region arrangement | sequence r, and arrangement | sequence order. 描画モジュール608の詳細を示すフローチャート図である。5 is a flowchart showing details of a drawing module 608. FIG. 手続きdraw(id, x, y)の詳細を示すフローチャート図である。It is a flowchart figure which shows the detail of procedure draw (id, x, y).

符号の説明Explanation of symbols

601・・・キーボード、602・・・処理装置、603・・・2値化モジュール、604・・・ラベリングモジュール、605・・・窓枠モジュール、606・・・面積算出モジュール、607・・・ソートモジュール、608・・・描画モジュール、609・・・記憶装置、610・・・濃淡画像、611・・・2値画像、612・・・ラベル画像、613・・・作業用画像、614・・・領域配列、615・・・ディスプレイ。 601 ... Keyboard, 602 ... Processing device, 603 ... Binarization module, 604 ... Labeling module, 605 ... Window frame module, 606 ... Area calculation module, 607 ... Sort Module, 608 ... Drawing module, 609 ... Storage device, 610 ... Gray image, 611 ... Binary image, 612 ... Label image, 613 ... Work image, 614 ... Area arrangement, 615... Display.

Claims (3)

コンピュータを使用して画像連結成分の一覧を作成する方法において、
画像を濃淡に関する2値画像に変換する2値化ステップと、
前記2値画像上の連結成分の画素に連結成分毎に定まった番号が割り振られたラベル画像を生成するラベリングステップと、
該ラベル画像を参照して、各連結成分を囲む最小の長方形からなる窓枠を設定する窓枠設定ステップと、
前記窓枠内において各連結成分の特徴量を算出する特徴量抽出ステップと、
前記特徴量に基づいて前記各連結成分をソートするソートステップと、
ソートされた順に前記各連結成分の像の一覧を表示する連結成分一覧を生成するステップと
を有することを特徴とする画像連結成分一覧作成方法。
In a method of creating a list of image connected components using a computer,
A binarization step for converting the image into a binary image relating to shading;
A labeling step for generating a label image in which a number determined for each connected component is assigned to pixels of the connected component on the binary image;
With reference to the label image, a window frame setting step for setting a window frame consisting of a minimum rectangle surrounding each connected component;
A feature amount extracting step of calculating a feature amount of each connected component within the window frame;
A sorting step of sorting each connected component based on the feature amount;
Generating a connected component list for displaying a list of images of the respective connected components in the sorted order.
上記窓枠ステップにおいて、
まず、各連結成分iについて
変数x minに十分大きな初期値を設定し、変数x maxに十分小さな初期値を設定し、変数y minに十分大きな初期値を設定し、変数y maxに十分小さな初期値を設定し、
次に、ラベル画像をラスタ走査して、現在の位置(x, y)が連結成分i上であれば、xがx minより小さい時、x minにxの値を代入し、xがx maxより大きい時、x maxにxの値を代入し、yがy minより小さい時、y minにyの値を代入し、yがy maxより大きい時、y maxにyの値を代入し、各連結成分を囲む最小の長方形を設定することを特徴とする請求項1に記載の画像連結成分一覧作成方法。
In the window frame step,
First, for each connected component i, a sufficiently large initial value is set for the variable x i min , a sufficiently small initial value is set for the variable x i max , a sufficiently large initial value is set for the variable y i min , and the variable y i max Set a sufficiently small initial value to
Next, the label image is raster scanned, if the current position (x, y) is connected component i, at x is less than x i min, and assigns the value of x to x i min, x is when greater than x i max, assigns the value of x to x i max, when y is smaller than y i min, and assigns the value of y to y i min, when y is greater than y i max, y i max The image connected component list creation method according to claim 1, wherein a value of y is substituted into and a minimum rectangle surrounding each connected component is set.
画素の濃度の大小に基づいて画像を2値化する2値化モジュールと、
連結している画素同士に同じラベルを付すラベリングモジュールと、
同じラベルが付された各連結成分を囲む最小の長方形からなる窓枠を設定する窓枠モジュールと、
前記窓枠内において各連結成分の特徴量を算出する特徴量抽出モジュールと、
前記特徴量に基づいて前記各連結成分をソートするソートモジュールと、
ソートされた順に前記各連結成分の像の一覧を表示する連結成分一覧を生成する連結成分一覧生成モジュールと
を備えた画像処理装置。
A binarization module that binarizes the image based on the magnitude of the pixel density;
A labeling module for attaching the same label to connected pixels;
A window frame module for setting a window frame consisting of a minimum rectangle surrounding each connected component with the same label;
A feature amount extraction module for calculating a feature amount of each connected component in the window frame;
A sorting module for sorting the connected components based on the feature amount;
An image processing apparatus comprising: a connected component list generation module that generates a connected component list that displays a list of images of the respective connected components in the sorted order.
JP2005084414A 2005-03-23 2005-03-23 Method for generating list of connected elements of image Pending JP2006268339A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005084414A JP2006268339A (en) 2005-03-23 2005-03-23 Method for generating list of connected elements of image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005084414A JP2006268339A (en) 2005-03-23 2005-03-23 Method for generating list of connected elements of image

Publications (1)

Publication Number Publication Date
JP2006268339A true JP2006268339A (en) 2006-10-05

Family

ID=37204268

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005084414A Pending JP2006268339A (en) 2005-03-23 2005-03-23 Method for generating list of connected elements of image

Country Status (1)

Country Link
JP (1) JP2006268339A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101026051B1 (en) 2008-12-15 2011-03-30 삼성전기주식회사 Method for grouping pixels in 2d digital image
US9124818B2 (en) 2013-11-01 2015-09-01 Kabushiki Kaisha Toshiba Image erasing apparatus and method for processing image on sheet

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101026051B1 (en) 2008-12-15 2011-03-30 삼성전기주식회사 Method for grouping pixels in 2d digital image
US9124818B2 (en) 2013-11-01 2015-09-01 Kabushiki Kaisha Toshiba Image erasing apparatus and method for processing image on sheet

Similar Documents

Publication Publication Date Title
KR102220174B1 (en) Learning-data enhancement device for machine learning model and method for learning-data enhancement
CN111784685B (en) Power transmission line defect image identification method based on cloud edge cooperative detection
CN109781733B (en) Defect inspection apparatus, defect inspection method, and computer-readable storage medium
CN104424482B (en) Image processing equipment and image processing method
US9547800B2 (en) System and a method for the detection of multiple number-plates of moving cars in a series of 2-D images
JP4942510B2 (en) Vehicle image recognition apparatus and method
US20120269398A1 (en) Method and system for identifying a license plate
CN105308944A (en) Classifying objects in images using mobile devices
CN106971185B (en) License plate positioning method and device based on full convolution network
US8331680B2 (en) Method of gray-level optical segmentation and isolation using incremental connected components
CN109951635A (en) It takes pictures processing method, device, mobile terminal and storage medium
US20030012438A1 (en) Multiple size reductions for image segmentation
JP2006293528A (en) Method and apparatus for selecting learning image, and method, apparatus, program and recording medium for creating image processing algorithm
US20200302135A1 (en) Method and apparatus for localization of one-dimensional barcodes
CN110837809A (en) Blood automatic analysis method, blood automatic analysis system, blood cell analyzer, and storage medium
CN112733858B (en) Image character rapid identification method and device based on character region detection
JP6630341B2 (en) Optical detection of symbols
JP2006268339A (en) Method for generating list of connected elements of image
Bala et al. Image simulation for automatic license plate recognition
Varkentin et al. Development of an application for car license plates recognition using neural network technologies
JP2017228297A (en) Text detection method and apparatus
CN114549628A (en) Power pole inclination detection method, device, equipment and storage medium
CN112464946A (en) Garbage image collection method and system based on big data
JP6373729B2 (en) Program, image processing apparatus and image processing method
CN109558876B (en) Character recognition processing method and device