JP2007140593A - Inscribed rectangle detection device and inscribed rectangle detection program - Google Patents

Inscribed rectangle detection device and inscribed rectangle detection program Download PDF

Info

Publication number
JP2007140593A
JP2007140593A JP2005329213A JP2005329213A JP2007140593A JP 2007140593 A JP2007140593 A JP 2007140593A JP 2005329213 A JP2005329213 A JP 2005329213A JP 2005329213 A JP2005329213 A JP 2005329213A JP 2007140593 A JP2007140593 A JP 2007140593A
Authority
JP
Japan
Prior art keywords
image
rectangle
vertical
mask
center position
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.)
Granted
Application number
JP2005329213A
Other languages
Japanese (ja)
Other versions
JP4594848B2 (en
Inventor
Jun Shimamura
潤 島村
Kyoko Sudo
恭子 数藤
Hiroyuki Arai
啓之 新井
Kenichi Arakawa
賢一 荒川
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone 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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2005329213A priority Critical patent/JP4594848B2/en
Publication of JP2007140593A publication Critical patent/JP2007140593A/en
Application granted granted Critical
Publication of JP4594848B2 publication Critical patent/JP4594848B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

<P>PROBLEM TO BE SOLVED: To provide an inscribed rectangle detection device capable of detecting a rectangle inside an image at high speed by a small calculation amount even when a plurality of areas are present inside the image. <P>SOLUTION: This inscribed rectangle detection device has: a contraction hierarchy image generation part 1 generating a hierarchy image from an input image and outputting the number of hierarchies thereof; a target hierarchy image determination part 2 outputting a bottom layer among the hierarchy images each having at least one color except a background color from the hierarchy images as a target hierarchy number; a maximum rectangle detection part 3 scanning a mask and determining a mask center and a mask size having a maximum area remaining inside one color area except the background color, in each color area of the hierarchy image corresponding to the target hierarchy number; a rectangle restoration part 4 converting the mask size and the mask center into a size and a center on the input image, and outputting them as a restoration rectangle lengthwise/crosswise size and a restoration rectangle center position; and a restoration rectangle expansion part 5 performing expansion, update and output on the input image while remaining inside the area color by use of the restoration rectangle lengthwise/crosswise size and the restoration rectangle center position. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる矩形を検出し、該矩形の中心位置と該矩形の縦横サイズを出力する内接矩形検出装置および内接矩形検出プログラムに関する。   The present invention detects, from an input image divided into at least one region, a rectangle that remains in one of the regions, and outputs the center position of the rectangle and the vertical and horizontal sizes of the rectangle. The present invention relates to an inscribed rectangle detection apparatus and an inscribed rectangle detection program.

プロジェクタ等の投影装置によって光が投射された3次元空間を前記投影装置とは異なる場所に設置されたカメラ等で撮影した画像を、光が投射された領域と投射されない領域に分割し、光が投影された領域において該領域内に留まる矩形を検出する従来の内接矩形検出装置では、検出した内接矩形の形状を補正して投影装置に入力することにより前記投影装置とは異なる観測者位置からも矩形として歪み無く観測させることを可能としている。   An image obtained by photographing a three-dimensional space in which light is projected by a projection device such as a projector with a camera or the like installed in a place different from the projection device is divided into a region where light is projected and a region where light is not projected. In a conventional inscribed rectangle detection device that detects a rectangle that remains in the projected region, an observer position different from that of the projection device is corrected by correcting the shape of the detected inscribed rectangle and inputting it to the projection device. Therefore, it is possible to observe as a rectangle without distortion.

例えば、下記非特許文献1に記載の方法では、複数台のプロジェクタで光を投射した平面で構成される空間を撮像し、投射領域、非投射領域に分割した画像から、投射領域からなる多角形Lを深度Z=1の深度平面上に描画されているものとし、深度Z=0の深度平面上に検出したいアスペクト比の矩形Rを描画し、該矩形RをZ=0平面に投影した矩形Sが完全に前記多角形L内にとどまるように投影する深度0から1の間で移動する投影中心のうち、最小の深度を有する投影中心位置を決定することにより前記多角形L内で面積最大となる内接矩形を求めることを可能としている。   For example, in the method described in Non-Patent Document 1 below, a polygon composed of a projection area is captured from an image obtained by capturing a space formed by a plane on which light is projected by a plurality of projectors and dividing the image into a projection area and a non-projection area. It is assumed that L is drawn on the depth plane of depth Z = 1, a rectangle R having an aspect ratio to be detected is drawn on the depth plane of depth Z = 0, and the rectangle R is projected onto the Z = 0 plane. By determining the position of the projection center having the smallest depth among the projection centers moving between the depths 0 to 1 where S is projected so as to completely stay within the polygon L, the maximum area within the polygon L is determined. It is possible to obtain an inscribed rectangle.

また、例えば下記非特許文献2に記載の方法では、1台のプロジェクタで光を投射した平面で構成される空間を撮像し、投射領域、非投射領域に分割した画像から、多角形となる投射領域を構成する各辺上に所定のアスペクト比の矩形の1点が乗るように配置して矩形内全てが投射領域となるかどうかを判定する処理を辺上をずらしながら行なって多角形の全辺で繰り返し、この処理を矩形のサイズを大きくしながらも繰り返すことによって前記多角形内での面積最大となる内接矩形を求めることを可能としている。
「iLamps:Geometrically aware and self−configuring projectors」(Remesh Raskar,Jeroen van Baar,Paul Beardsley,Thomas Willwacher,Srinivas Rao,Clifron Forlines:ACM Transactions on Graphics(TOG),ISSN:0730−0301,Vol.22,Issue 3,pp.809−818,July 2003) 「A Self Correcting Projector」(Remesh Raskar,Paul Beardsley:IEEE Computer Vision and Pattern Recognition,vol.2,pp.504−508,December 2001)
In addition, for example, in the method described in Non-Patent Document 2 below, a space formed by a plane on which light is projected by one projector is imaged, and a projection that becomes a polygon from an image divided into a projection area and a non-projection area All polygons are formed by shifting the sides of the rectangle so that one point of a rectangle with a predetermined aspect ratio is placed on each side of the area and determining whether or not all of the rectangle is the projection area. It is possible to obtain an inscribed rectangle that maximizes the area within the polygon by repeating this process while increasing the size of the rectangle.
"ILamps: Geometrically aware and self-configuring projectors" (Remesh Raskar, Jeroen van Baar, Paul Beardsley, Thomas Willwacher, Srinivas Rao, Clifron Forlines: ACM Transactions on Graphics (TOG), ISSN: 0730-0301, Vol.22, Issue 3, pp. 809-818, July 2003) “A Self Correcting Projector” (Remesh Raskar, Paul Beardsley: IEEE Computer Vision and Pattern Recognition, vol. 2, pp. 504-508, December 2001)

しかしながら、非特許文献1、非特許文献2共に光が投射された領域と投射されない領域に分割された2領域の画像を矩形検出対象としており、複数の領域に分割された画像に関しては言及されていない。例えば、3次元空間を撮像した画像が空間中の平面毎に分割されたものを対象とし、ある1つの平面内を示す領域のみに留まる矩形を検出しようとした際、全ての領域につき矩形検出処理を施す必要があり、計算処理時間が膨大に増えるといった問題があった。   However, in both Non-Patent Document 1 and Non-Patent Document 2, two regions of images divided into a region where light is projected and a region where light is not projected are targeted for rectangular detection, and an image divided into a plurality of regions is mentioned. Absent. For example, when an image obtained by capturing an image of a three-dimensional space is divided into planes in the space, and a rectangle that stays only in an area indicating a certain plane is detected, rectangle detection processing is performed for all areas. There is a problem that the calculation processing time increases enormously.

本発明は、上述したような従来技術が有する問題点に鑑みてなされたものであり、矩形検出装置において、画像中に複数領域が存在する場合においても、少ない計算量で高速に画像中の矩形を検出できる装置およびプログラムを提供することを目的とする。   The present invention has been made in view of the above-described problems of the prior art. In the rectangular detection device, even when there are a plurality of regions in the image, the rectangle in the image can be obtained at high speed with a small amount of calculation. An object of the present invention is to provide a device and a program capable of detecting the above.

上記課題を解決するために、本発明の内接矩形検出装置は、少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる矩形のうち面積最大となる矩形の中心位置と該矩形の縦横サイズを出力する内接矩形検出装置であって、前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成手段と、前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定手段と、前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形検出手段と、前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元手段と、前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大手段と、を備えてなることを特徴としている。   In order to solve the above problems, an inscribed rectangle detection apparatus according to the present invention has a maximum area among rectangles that remain in a certain one of the regions from an input image divided into at least one region. An inscribed rectangle detecting device for outputting a center position of a rectangle and a vertical and horizontal size of the rectangle, generating a hierarchical image from the input image, storing the hierarchical image in a memory, and outputting the number of hierarchical layers And a target layer image determination means for determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than the background color defined in advance from the layer image, and the target layer number A mask provided in advance in each color region of the corresponding hierarchical image is scanned to determine the maximum mask vertical and horizontal size and mask center position that remain in one color region other than the background color, and the area A maximum rectangle detecting means for storing a region color in which a large mask stays in a memory and outputting the mask height and width size and the mask center position, and the mask height and width size and the mask center position on the input image. Rectangle restoration means for converting to a position and outputting it as a restored rectangle vertical and horizontal size and restored rectangle center position, respectively, and using the restored rectangle vertical and horizontal size and restored rectangle center position, and enlarging on the input image while remaining within the region color And a restoration rectangle enlarging means for updating the vertical and horizontal sizes and the center position for output.

また、少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる複数の矩形のうち、互いに矩形同士が重複することのない矩形群の夫々の中心位置と縦横サイズを予めユーザによって与えられた検出矩形数分検出する内接矩形検出装置であって、前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成手段と、前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定手段と、前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形検出手段と、前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元手段と、前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大手段と、前記拡大された矩形内部に属する入力画像の画素の画素値に背景色を代入して入力画像を更新し、検出された矩形の数である検出済矩形数を1増加させる入力画像更新手段と、前記検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定し、処理を繰り返す場合は前記収縮階層画像生成手段を起動し、繰り返さない場合は処理を終了する終了条件判定手段と、を備えてなることを特徴としている。   In addition, from the input image divided into at least one region, a center of each of a plurality of rectangles that do not overlap each other among a plurality of rectangles that remain in a certain one of the regions. An inscribed rectangle detecting device that detects positions and vertical and horizontal sizes by the number of detection rectangles given in advance by a user, generating a hierarchical image from the input image, storing the hierarchical image in a memory, and outputting the hierarchical number Generation means, target hierarchy image determination means for determining and outputting the lowest layer image number as a target hierarchy number among hierarchical images having at least one color other than the background color defined in advance from the hierarchy image, and the target hierarchy Scan the mask given in advance in each color area of the hierarchical image corresponding to the number, and the maximum mask vertical and horizontal size and mask center staying in one color area other than the background color A maximum rectangle detecting means for determining a position, storing the area color where the maximum area mask remains in a memory, and outputting the mask vertical and horizontal sizes and the mask center position; and inputting the mask vertical and horizontal mask sizes and the mask center position into an input image Using the rectangular restoration means that converts the vertical and horizontal sizes and the center position to the restored rectangular vertical and horizontal sizes and the restored rectangular center position, respectively, and uses the restored rectangular vertical and horizontal sizes and the restored rectangular center position, and stays within the region color. Is enlarged on the input image, restored rectangular enlargement means for updating the vertical and horizontal sizes and the center position, and the background image is substituted for the pixel value of the pixel of the input image belonging to the enlarged rectangle to input the input image. An input image update unit that updates and increases the number of detected rectangles, which is the number of detected rectangles, and compares the detected number of rectangles with the number of detected rectangles and continues the rectangle detection process. Ri whether determined return, if the process is repeated is characterized by comprising and an end condition determining means to end the process if activating the shrink layer image generation means, not repeated.

また、前記収縮階層画像生成手段は、生成する階層画像の画素値を決定する際に処理対象の画像座標に対応する1段上の階層画像の対応画像座標と対応画素値を求め、該対応画像座標の画素近傍内に画素値が前記対応画素値と異なる少なくとも1つ以上画素が存在すれば前記処理対象画像座標の画素値を前記背景色に、その他の場合は前記対応画素値として決定することを特徴としている。   The contracted hierarchical image generating means obtains the corresponding image coordinates and corresponding pixel values of the hierarchical image one level higher corresponding to the image coordinates to be processed when determining the pixel values of the hierarchical image to be generated. If at least one pixel having a pixel value different from the corresponding pixel value is present in the vicinity of the coordinate pixel, the pixel value of the processing target image coordinate is determined as the background color, and in other cases, the corresponding pixel value is determined. It is characterized by.

また、前記対象階層画像決定手段は、前記収縮階層画像生成手段において出力された階層画像の階層数を受信し、画像サイズが小さい階層を下層としたときの最下層の階層画像から処理を始め、階層画像で使用されている使用色数を数え上げて背景色以外の色が利用されているかどうかを判定する処理を、初めて該判定条件が満たされるまで上層の階層画像へと階層番号順に処理を行ない、前記判定条件が満たされた際の階層画像番号を対象階層画像番号とし出力することを特徴としている。   Further, the target hierarchy image determining means receives the number of hierarchy images output in the contraction hierarchy image generation means, and starts processing from the lowest hierarchy image when the hierarchy having a small image size is set as the lower hierarchy, The process of counting the number of colors used in the hierarchical image and determining whether a color other than the background color is used is performed in the hierarchical number order until the first determination condition is satisfied. The hierarchical image number when the determination condition is satisfied is output as the target hierarchical image number.

前記最大矩形検出手段は、前記対象階層画像決定手段において出力された対象階層画像番号を受信して対象階層番号目の階層画像を対象階層画像としてメモリから読み出すと共に、予めユーザによって設定されたマスクの縦横サイズを全て読出し、前記入力マスクの未処理のマスクのうち面積が最大となるマスクを処理マスクとして設定し、該処理マスクを前記対象階層画像上に設定し、該処理マスク内の各画素の画素値に処理対象画像上で対応する画素の画素値をコピーし、該処理マスク内が全て同一画素値でかつ、その画素値が全て背景色以外の同一画素値となる条件を満たすまで処理マスクを対象階層画像上で走査し、前記条件が満たされない際には前記条件が満たされるまで全ての前記入力マスクに亘って処理を繰り返し、前記条件が満たされた時には、処理マスク内の画素値を領域色としてメモリに格納した後、前記条件を満たした時の処理マスク中心位置と処理マスクの縦横サイズを矩形中心位置と矩形縦横サイズとして、対象階層番号と共に出力することを特徴としている。   The maximum rectangle detecting unit receives the target layer image number output from the target layer image determining unit, reads out the layer image of the target layer number from the memory as a target layer image, and stores a mask preset by the user. Read all the vertical and horizontal sizes, set a mask having the largest area among the unprocessed masks of the input mask as a processing mask, set the processing mask on the target hierarchical image, and set each pixel in the processing mask. Copy the pixel value of the corresponding pixel on the processing target image to the pixel value, and process mask until the condition that all the pixel values in the process mask are the same pixel value and all the pixel values other than the background color are satisfied On the target hierarchical image, and when the condition is not satisfied, the process is repeated over all the input masks until the condition is satisfied, When satisfied, the pixel value in the processing mask is stored in the memory as a region color, and the processing mask center position and the vertical and horizontal size of the processing mask when the above condition is satisfied are set as the rectangular center position and the rectangular vertical and horizontal size. It is characterized by being output with a number.

また、前記矩形復元手段は、前記最大矩形検出手段において出力された矩形中心位置、矩形縦横サイズ、対象階層番号を受信し、対象階層画像を元階層画像、矩形中心位置、矩形縦横サイズを元中心位置、元縦横サイズ、対象階層画像に対する1階層上層の階層画像を上階層画像とし、元階層画像に対する上階層画像の縦サイズ、横サイズ夫々の比率を用いて元中心位置、元縦横サイズを上階層画像における中心位置と縦横サイズに変換し、上階層画像を元階層画像、変換された中心位置と縦横サイズを元中心位置、元縦横サイズとして更新する処理を、元階層画像の階層番号が最上層の番号に一致するまで繰り返し、最後に元中心位置、元縦横サイズを復元矩形中心位置、復元矩形縦横サイズとして出力することを特徴としている。   The rectangle restoration unit receives the rectangle center position, the rectangle height and width size, and the target layer number output from the maximum rectangle detection unit, and sets the target layer image as the original layer image, the rectangle center position, and the rectangle height and width as the center. The position, original height and width size, and the layer image one layer higher than the target layer image are set as the upper layer image, and the original center position and the original height and width size are increased by using the ratio of the vertical size and horizontal size of the upper layer image to the original layer image, respectively. In the process of updating the center position and vertical / horizontal size in the hierarchical image to update the upper hierarchical image as the original hierarchical image and the converted center position and vertical / horizontal size as the original central position and original vertical / horizontal size, the hierarchical number of the original hierarchical image is the highest. The process is repeated until it matches the upper layer number, and finally, the original center position and the original vertical and horizontal size are output as the restored rectangular center position and the restored rectangular vertical and horizontal size.

また本発明の内接矩形検出プログラムは、少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる矩形のうち面積最大となる矩形の中心位置と該矩形の縦横サイズを出力する処理をコンピュータに行わせるための内接矩形検出プログラムであって、前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成ステップと、前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定ステップと、前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形決定ステップと、前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元ステップと、前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大ステップと、を実行させるためのプログラムであることを特徴としている。   The inscribed rectangle detection program according to the present invention includes a center position of a rectangle having a maximum area among rectangles remaining in one area of the input image divided into at least one area. An inscribed rectangle detection program for causing a computer to perform processing for outputting the vertical and horizontal sizes of the rectangle, generating a hierarchical image from the input image, storing the hierarchical image in a memory, and outputting the number of layers A target layer image determination step for determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than a predefined background color from the layer image, and the target layer number The maximum mask vertical and horizontal size of the area that stays in one color area other than the background color by scanning the mask given in advance in each color area of the hierarchical image corresponding to A mask center position is determined, a region color in which the maximum area mask remains is stored in a memory, and a maximum rectangle determining step for outputting the mask height and width size and the mask center position; and the mask height and width size and the mask center position are determined. Using the rectangular restoration step for converting the vertical and horizontal sizes and the center position on the input image to output the restored rectangular vertical and horizontal sizes and the restored rectangular center position, respectively, and using the restored rectangular vertical and horizontal sizes and the restored rectangular center position, It is a program for executing a restoration rectangle enlargement step for enlarging on the input image as long as it stays, updating the vertical and horizontal sizes and the center position, and outputting it.

また、少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる複数の矩形のうち、互いに矩形同士が重複することのない矩形群の夫々の中心位置と縦横サイズを予めユーザによって与えられた検出矩形数分検出する処理をコンピュータに行わせるための内接矩形検出プログラムであって、前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成ステップと、前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定ステップと、前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形決定ステップと、前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元ステップと、前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大ステップと、前記拡大された矩形内部に属する入力画像の画素の画素値に背景色を代入して入力画像を更新し、検出された矩形の数である検出済矩形数を1増加させる入力画像更新ステップと、前記検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定し、処理を繰り返す場合は前記収縮階層画像生成ステップを起動し、繰り返さない場合は処理を終了する終了条件判定ステップと、を実行させるためのプログラムであることを特徴としている。   In addition, from the input image divided into at least one region, a center of each of a plurality of rectangles that do not overlap each other among a plurality of rectangles that remain in a certain one of the regions. An inscribed rectangle detection program for causing a computer to perform processing for detecting a position and a vertical and horizontal size by the number of detection rectangles given in advance by a user, generating a hierarchical image from the input image and storing it in a memory, A contraction layer image generation step for outputting the number of layers, and a target layer for determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than a background color defined in advance from the layer image One color region other than the background color by scanning the mask given in advance in each color region of the hierarchical image corresponding to the target hierarchical number, and an image determining step Determining the maximum mask vertical and horizontal size and mask center position remaining in the area, storing the area color in which the area maximum mask stays in a memory, and outputting the mask vertical and horizontal mask size and mask center position; and A rectangular restoration step for converting the mask vertical and horizontal sizes and the mask center position into vertical and horizontal sizes and center positions on the input image and outputting them as a restored rectangular vertical and horizontal sizes and restored rectangular center positions, respectively, and the restored rectangular vertical and horizontal sizes and restored rectangular centers A restoration rectangle enlargement step that uses the position to enlarge the input image as long as it stays within the region color, updates the vertical and horizontal sizes, and updates the center position, and outputs the pixels of the input image belonging to the inside of the enlarged rectangle An input image update step of updating the input image by substituting the background color for the value, and increasing the number of detected rectangles, which is the number of detected rectangles, by one; The number of detected rectangles is compared with the number of detected rectangles to determine whether or not to continue the rectangle detection process. If the process is repeated, the contraction layer image generation step is started. If not, the process is terminated. It is a program for executing the termination condition determination step.

(1)請求項1〜6に記載の発明によれば、複数の領域を複数色で表現した入力画像に減色効果のある収縮フィルタを適用しながら階層画像を生成し、画像サイズが小さな下層の階層画像を用いて矩形検出を行なうため、画像中に複数領域が存在する場合においても、少ない計算量で高速に矩形を検出することが可能となる。
(2)請求項7、8に記載の発明によれば、画像中に複数領域が存在する場合においても、少ない計算量で高速に矩形を検出することが可能なプログラムを提供することができる。
(1) According to the first to sixth aspects of the present invention, a hierarchical image is generated while applying a contraction filter having a subtractive color effect to an input image in which a plurality of regions are expressed in a plurality of colors. Since rectangle detection is performed using a hierarchical image, even when there are a plurality of regions in the image, it is possible to detect the rectangle at a high speed with a small amount of calculation.
(2) According to the seventh and eighth aspects of the invention, it is possible to provide a program capable of detecting a rectangle at a high speed with a small amount of calculation even when a plurality of regions are present in an image.

以下、本発明の実施形態について図面を用いて説明する。まず、本発明における複数平面検出装置の構成について説明する。図1は、この発明の実施形態例による内接矩形検出装置を説明するための図であり、(a)は一実施形態例の構成図、(b)は他の実施形態例の構成図である。内接矩形検出装置100は、収縮階層画像生成部1、対象階層画像決定部2、最大矩形検出部3、矩形復元部4および復元矩形拡大部5とから概略構成されている。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. First, the configuration of the multi-plane detection device according to the present invention will be described. 1A and 1B are diagrams for explaining an inscribed rectangle detecting apparatus according to an embodiment of the present invention. FIG. 1A is a configuration diagram of one embodiment, and FIG. 1B is a configuration diagram of another embodiment. is there. The inscribed rectangle detection apparatus 100 is generally configured by a contraction hierarchy image generation unit 1, a target hierarchy image determination unit 2, a maximum rectangle detection unit 3, a rectangle restoration unit 4, and a restoration rectangle enlargement unit 5.

また6はカメラ等で撮影された画像を入力する画像入力部、7は処理対象画像の構成色数をカウントして出力する使用色数カウント部、8は処理マスク内の画像値を格納するメモリである。また図1(b)の9は、矩形検出処理を繰り返すか否かを判定する終了条件判定部、10は入力画像更新部である。   Reference numeral 6 denotes an image input unit that inputs an image captured by a camera or the like, 7 denotes a used color number counting unit that counts and outputs the number of constituent colors of the processing target image, and 8 denotes a memory that stores an image value in the processing mask. It is. Further, reference numeral 9 in FIG. 1B denotes an end condition determination unit that determines whether to repeat the rectangle detection process, and reference numeral 10 denotes an input image update unit.

収縮階層画像生成部1は、少なくとも1つ以上の領域に領域分割された画像を受信し、階層画像を生成してメモリに格納し、その階層数を出力する。   The contraction layer image generation unit 1 receives an image divided into at least one region, generates a layer image, stores it in a memory, and outputs the number of layers.

対象階層画像決定部2は、階層数を受信し、前記階層画像から予め定義された背景色以外の少なくとも1色以上を有す階層画像のうち最下層の画像番号を対象階層番号として決定し出力する。   The target layer image determination unit 2 receives the number of layers, determines the image number of the lowest layer among the layer images having at least one color other than the background color defined in advance from the layer image, and outputs the target layer number To do.

最大矩形検出部3は、対象階層画像番号を受信し、該対象階層番号に対応する階層画像において1つの色領域内に留まる面積最大の矩形縦横サイズと矩形中心位置を決定し、該面積最大矩形が留まった領域色をメモリに格納し、前記矩形縦横サイズと矩形中心位置を夫々矩形縦横サイズ、矩形中心位置として対象階層番号と共に出力する。   The maximum rectangle detection unit 3 receives the target hierarchical image number, determines the maximum rectangular vertical and horizontal size and rectangular center position that remain in one color region in the hierarchical image corresponding to the target hierarchical number, and determines the maximum rectangular area Is stored in the memory, and the rectangular vertical and horizontal sizes and the rectangular center position are output together with the target hierarchy number as the rectangular vertical and horizontal sizes and the rectangular center position, respectively.

矩形復元部4は、矩形縦横サイズと矩形中心位置、対象階層番号を受信し、これらを入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する。   The rectangular restoration unit 4 receives the rectangular vertical and horizontal sizes, the rectangular center position, and the target hierarchy number, converts them into the vertical and horizontal sizes and the central position on the input image, and outputs them as the restored rectangular vertical and horizontal sizes and the restored rectangular center position, respectively. .

復元矩形拡大部5は、復元矩形縦横サイズ、復元矩形中心位置を受信し、メモリから領域色を読み出し、前記復元矩形縦横サイズ、復元矩形中心位置で表現される復元矩形を前記領域色内に留まるうちは入力画像上で拡大させ、矩形の縦横サイズ、中心位置を更新し、これを最終出力する。   The restoration rectangle enlarging unit 5 receives the restoration rectangle vertical and horizontal sizes and the restoration rectangle center position, reads the area color from the memory, and the restoration rectangle represented by the restoration rectangle height and width and restoration rectangle center position remains in the area color. The image is enlarged on the input image, the vertical and horizontal sizes and the center position of the rectangle are updated, and this is finally output.

次に内接矩形検出装置で行われる処理フローを詳細に説明する。内接矩形検出装置100では、収縮階層画像生成部1が起動される。収縮階層画像生成部1は起動すると、まず少なくとも1つ以上の領域に領域分割された画像を受信する。次に入力画像を段階的に縮小した図5に示すような階層画像(ピラミッド画像)を作成する。階層画像の生成は入力画像をその縦横サイズを例えば2で除算した整数値を新規画像サイズとして縮小する処理を、新規画像を入力画像と置き換え縦横両者の新規画像サイズが0になるまで繰り返すことによって実現される。これによって、入力画像を第0階層とした階層数分の画像群が生成されることになる。   Next, a processing flow performed by the inscribed rectangle detection device will be described in detail. In the inscribed rectangle detection apparatus 100, the contraction hierarchy image generation unit 1 is activated. When activated, the contraction hierarchy image generation unit 1 first receives an image divided into at least one region. Next, a hierarchical image (pyramid image) as shown in FIG. Hierarchical image generation is performed by repeating the process of reducing the input image to an integer value obtained by dividing the vertical and horizontal sizes by 2, for example, by replacing the new image with the input image until the new vertical and horizontal new image sizes become zero. Realized. As a result, as many image groups as the number of layers in which the input image is the 0th layer are generated.

ここで本発明では、画像を縮小する際、処理対象の画像座標に対応する1段上の階層画像の対応画像座標と対応画素値を求め、該対応画像座標の画素近傍内に画素値が前記対応画素値と異なる少なくとも1つ以上画素が存在すれば前記処理対象画像座標の画素値を前記背景色に、その他の場合は前記対応画素値として決定する。   Here, in the present invention, when the image is reduced, the corresponding image coordinate and the corresponding pixel value of the hierarchical image one level higher corresponding to the image coordinate to be processed are obtained, and the pixel value is within the vicinity of the pixel of the corresponding image coordinate. If at least one pixel different from the corresponding pixel value exists, the pixel value of the processing target image coordinates is determined as the background color, and in other cases, the corresponding pixel value is determined.

なお、対応画像座標は、新規画像サイズを1段上の階層画像のサイズを2で除算して決定する例では、処理対象の画像座標を(i,j)とすると(2*i+0.5,2*j+0.5)で決定される。また、近傍には3×3の近傍を利用しても良いし、予め指定された任意の近傍領域でも良い。収縮階層画像生成部は最後に生成した階層画像の階層数を出力し処理を終える。   In the example in which the new image size is determined by dividing the size of the hierarchical image one level above by 2, if the image coordinates to be processed are (i, j), (2 * i + 0.5, 2 * j + 0.5). Further, a 3 × 3 neighborhood may be used as the neighborhood, or an arbitrary neighborhood area designated in advance may be used. The contracted layer image generation unit outputs the number of layers of the finally generated layer image and ends the process.

続いて対象階層画像決定部2が起動する。対象階層画像決定部2の処理の流れを図2に示す。対象階層画像決定部2は起動すると、ステップS1において階層数を受信した後、処理番号kに(階層数−1)を設定し(ステップS2)、処理番号kが0以上かどうかを判定し(ステップS3)、kが0以上であれば処理番号目の階層画像をメモリ8から読出し、処理対象画像として設定する(ステップS4)。   Subsequently, the target hierarchy image determination unit 2 is activated. The flow of processing of the target hierarchy image determination unit 2 is shown in FIG. When the target hierarchy image determination unit 2 is activated, after receiving the number of hierarchies in step S1, (number of hierarchies −1) is set as the process number k (step S2), and it is determined whether the process number k is 0 or more ( In step S3), if k is equal to or greater than 0, the hierarchical image of the process number is read from the memory 8 and set as a process target image (step S4).

続いて処理対象画像の構成色数をカウントして出力する使用色数カウント部7を起動し、処理対象画像の使用色数を決定し(ステップS5)、ステップS6において使用色数が2より小さいか否かを判定する。この使用色数が2以上であれば、処理対象画像は背景色以外の色を有すとみなせるので、ステップS7において現在の処理番号kを対象階層番号として出力して処理を終了する。また使用色数が2より小さい場合は、ステップS8において、処理番号が0で且つ使用色数が1であるか否かを判定し、そうでなければ、現在の画像は背景色のみから構成されるとみなせるので、ステップS9において処理番号kから1減算してステップS3の処理に戻る。   Subsequently, the number of used colors counting unit 7 that counts and outputs the number of constituent colors of the processing target image is activated to determine the number of used colors of the processing target image (step S5). In step S6, the number of used colors is smaller than two. It is determined whether or not. If the number of colors used is 2 or more, the processing target image can be regarded as having a color other than the background color. Therefore, in step S7, the current processing number k is output as the target hierarchy number, and the processing ends. If the number of used colors is smaller than 2, it is determined in step S8 whether the process number is 0 and the number of used colors is 1. Otherwise, the current image is composed only of the background color. In step S9, 1 is subtracted from the process number k, and the process returns to step S3.

また、使用色数が2より小さい時に処理番号が0で使用色数が1であれば、入力画像は少なくとも1つ以上の領域に領域分割されており、画像全体が背景色以外の1色で構成されているとみなせるので、ステップS10において入力画像原点、縦横サイズを内接矩形位置、縦横サイズとして出力し、以降の処理を行なわない。尚前記ステップS3において、処理番号が0以上ではないと判定された場合は異常終了となる。   If the processing number is 0 and the number of used colors is 1 when the number of used colors is less than 2, the input image is divided into at least one region, and the entire image is one color other than the background color. In step S10, the input image origin and the vertical and horizontal sizes are output as the inscribed rectangle position and the vertical and horizontal sizes, and the subsequent processing is not performed. If it is determined in step S3 that the process number is not equal to or greater than 0, the process ends abnormally.

続いて最大矩形検出部3が起動する。最大矩形検出部3の処理の流れを図3に示す。最大矩形検出部3は起動すると、まずステップS11において対象階層番号を受信し、予めユーザによって設定された全マスクの縦横サイズを全て読出し(ステップS12)、対象階層番号目の階層画像をメモリから読出し処理対象画像として設定する(ステップS13)。   Subsequently, the maximum rectangle detector 3 is activated. The flow of processing of the maximum rectangle detection unit 3 is shown in FIG. When the maximum rectangle detector 3 is activated, it first receives the target hierarchy number in step S11, reads all the vertical and horizontal sizes of all masks set in advance by the user (step S12), and reads the hierarchical image of the target hierarchy number from the memory. It sets as a processing target image (step S13).

ここでマスクとは処理対象画像で検出したい矩形サイズであり、例えば、収縮階層画像生成部で縮小画像生成の際の色決定時に3×3近傍を用いて収縮された時には、図6に示すように3×3,3×2,3×1,2×3,2×2,2×1,1×3,1×2,1×1の矩形が処理対象画像から検出可能であるのでこれら9つの矩形がマスクとして設定可能である。もし、利用者がアスペクト比が1:1(正方形)の矩形を検出したければ、上記9つの矩形のなかから3×3,2×2,1×1の3つをマスクとして設定しておけばよい。   Here, the mask is a rectangular size to be detected in the processing target image. For example, when the contraction layer image generation unit contracts using a neighborhood of 3 × 3 when determining a color when generating a reduced image, as shown in FIG. Since 3 × 3, 3 × 2, 3 × 1, 2 × 3, 2 × 2, 2 × 1, 1 × 3, 1 × 2, and 1 × 1 rectangles can be detected from the processing target image, these 9 Two rectangles can be set as masks. If the user wants to detect a rectangle with an aspect ratio of 1: 1 (square), three of the nine rectangles 3 × 3, 2 × 2, and 1 × 1 can be set as masks. That's fine.

次にステップS14において全マスクが処理されたかどうかを判定する。全マスクが処理されて無ければ、未処理マスクの内、面積最大のマスクを処理マスクとして設定する(ステップS15)。例えば上記の例では3×3のマスクが設定される。続いて処理マスクを処理対象画像上で1画素分ラスタスキャン方向にずらし(ステップS16)、マスク内の各画素の画素値に処理対象画像上で対応する画素の画素値をコピーする(ステップS17)。   In step S14, it is determined whether all masks have been processed. If all the masks have not been processed, the mask having the largest area among the unprocessed masks is set as the processing mask (step S15). For example, in the above example, a 3 × 3 mask is set. Subsequently, the processing mask is shifted in the raster scan direction by one pixel on the processing target image (step S16), and the pixel value of the corresponding pixel on the processing target image is copied to the pixel value of each pixel in the mask (step S17). .

そして処理マスク内が全て同一画素値かつ、該画素値が背景色以外であるか否かをステップS18において判定し、そうであれば、処理マスク内の画素値を領域色としてメモリ8に格納し(ステップS19)、現在の処理マスク中心位置と縦横サイズを矩形中心位置と矩形縦横サイズとして対象階層番号と共に出力し(ステップS20)、処理を終了する。また処理マスク内が全て同一画素値で該画素値が背景色以外ではない場合は、ステップS21において前記全画素のラスタスキャンが終了したか否かを判定する。そしてマスクのラスタスキャンが終了してなければステップS16の処理に戻り、マスクのラスタスキャンが終了してればステップS14の処理へと戻る。尚前記ステップS14において、全マスク処理済みであると判定された場合は異常終了となる。   Then, it is determined in step S18 whether or not all the processing masks have the same pixel value and the pixel values are other than the background color. If so, the pixel values in the processing mask are stored in the memory 8 as the region colors. (Step S19) The current processing mask center position and vertical / horizontal size are output together with the target hierarchy number as the rectangular center position and rectangular vertical / horizontal size (step S20), and the process ends. If all the processing masks have the same pixel value and the pixel value is not other than the background color, it is determined in step S21 whether or not the raster scan of all the pixels has been completed. If the mask raster scan is not completed, the process returns to step S16. If the mask raster scan is completed, the process returns to step S14. If it is determined in step S14 that all mask processes have been completed, the process ends abnormally.

続いて矩形復元部4が起動する。矩形復元部4は起動するとまず、矩形中心位置と矩形縦横サイズ、対象階層番号を受信する。続いて入力画像上での縦横サイズ、中心位置に変換し、夫々復元矩形縦横サイズ、復元矩形中心位置として出力する。この処理は、対象階層画像を元階層画像、矩形中心位置、矩形縦横サイズを元中心位置(i,j)、元縦横サイズ(W×H)、対象階層画像に対する1階層上層の階層画像を上階層画像とすると、元階層画像に対する上階層画像の縦サイズ、横サイズ夫々の比率Rx,Ryを用いて元中心位置、元縦横サイズを下記の式1〜式4に従って上階層画像における中心位置(i’,j’)と縦横サイズ(W’×H’)に変換し、上階層画像を元階層画像として更新し、また、変換された中心位置と縦横サイズを元中心位置、元縦横サイズとして更新する処理を、元階層画像の階層番号が最上層の番号に一致するまで繰り返すことによって実現される。   Subsequently, the rectangle restoration unit 4 is activated. When the rectangle restoration unit 4 is activated, it first receives the rectangle center position, the rectangle vertical and horizontal sizes, and the target hierarchy number. Subsequently, the image is converted into a vertical and horizontal size and a center position on the input image, and output as a restored rectangle vertical and horizontal size and a restored rectangle center position, respectively. In this process, the target hierarchical image is the original hierarchical image, the rectangular center position, the rectangular vertical and horizontal size is the original central position (i, j), the original vertical and horizontal size (W × H), and the hierarchical image that is one layer above the target hierarchical image is Assuming a hierarchical image, the original center position and the original vertical / horizontal size are determined by using the ratios Rx and Ry of the vertical size and horizontal size of the upper hierarchical image relative to the original hierarchical image according to the following formulas 1 to 4, respectively. i ′, j ′) and vertical / horizontal size (W ′ × H ′), the upper layer image is updated as the original layer image, and the converted center position and vertical / horizontal size are set as the original center position and the original vertical / horizontal size. The updating process is realized by repeating until the layer number of the original layer image matches the number of the top layer.

i’=(int)(Rx*i)+0.5 (式1)
j’=(int)(Ry*j)+0.5 (式2)
W’=(int)(Rx*W+1.0) (式3)
H’=(int)(Ry*H+1.0) (式4)
なお式1〜式4において、(int)は実数値から整数値への変換を意味する。
i '= (int) (Rx * i) +0.5 (Formula 1)
j ′ = (int) (Ry * j) +0.5 (Formula 2)
W ′ = (int) (Rx * W + 1.0) (Formula 3)
H ′ = (int) (Ry * H + 1.0) (Formula 4)
In Expressions 1 to 4, (int) means conversion from a real value to an integer value.

続いて復元矩形拡大部5が起動する。復元矩形拡大部5は、復元矩形縦横サイズ、復元矩形中心位置を受信し、最大矩形検出部3でメモリ出力された領域色をメモリ8から読み出す。続いて前記復元矩形縦横サイズ、復元矩形中心位置を用い、復元矩形を入力画像上で前記領域色内に留まるうちは拡大させ、縦横サイズ、中心位置を更新して出力し、処理を終了する。この拡大処理は例えば矩形を構成する左の縦直線を左方向に1画素ずらし、直線上に領域色と異なる色がないかどうかを判定し、なければさらにずらすといった処理を、図7に示すように拡大方向が4つあるため、左右縦直線、上下横直線の4直線全てに対して行なえば良い。このとき縦の直線から処理を行なえば横長の矩形が、横の直線から処理を行なう場合では縦長の矩形が検出されることになるので、どちらから処理を行なうかは利用者の所望の矩形形状に応じて予め定義されていても良いものとする。
(第1実施例)
次に本発明における第1の実施形態を具体的データに即して説明する。まず、図8に示すような複数の領域に分割された画像縦横サイズが640×480の入力画像が入力されているものとする。ここで図8において、色の違いはそれぞれ別の領域であることを示し、黒は背景色を示している。本実施例では図8に示す入力画像において、ある1つの領域内に留まる矩形のうち面積最大となる矩形の中心位置と該矩形の縦横サイズを出力する例について述べる。
Subsequently, the restored rectangular enlargement unit 5 is activated. The restoration rectangle enlargement unit 5 receives the restoration rectangle vertical and horizontal sizes and the restoration rectangle center position, and reads the area color output from the memory by the maximum rectangle detection unit 3 from the memory 8. Subsequently, using the restored rectangular vertical and horizontal sizes and the restored rectangular center position, the restored rectangle is enlarged while remaining in the region color on the input image, the vertical and horizontal sizes and the central position are updated and output, and the process is terminated. In this enlargement process, for example, the left vertical line constituting the rectangle is shifted by one pixel in the left direction, and it is determined whether there is no color different from the region color on the straight line. Since there are four enlargement directions, it may be performed for all four straight lines, ie, left and right vertical lines and vertical and horizontal lines. At this time, if processing is performed from a vertical straight line, a horizontally long rectangle will be detected, and if processing is performed from a horizontal straight line, a vertically long rectangle will be detected. It may be defined in advance according to.
(First embodiment)
Next, the first embodiment of the present invention will be described based on specific data. First, it is assumed that an input image having a vertical and horizontal image size of 640 × 480 divided into a plurality of regions as shown in FIG. 8 is input. Here, in FIG. 8, the difference in color indicates a different area, and black indicates the background color. In this embodiment, an example will be described in which the center position of a rectangle having the maximum area among the rectangles remaining in a certain region and the vertical and horizontal sizes of the rectangle are output in the input image shown in FIG.

内接矩形検出装置100では、まず収縮階層画像生成部1が起動し、色の決定に収縮を適用した階層画像を生成し、該階層画像の階層数を出力する。本実施例では、各階層画像の縦横サイズを1段上の階層画像の縦横サイズを2で除算した整数値で決定するものとし、収縮時に利用する近傍には3×3近傍を用いたものとして以降説明を進める。この例では図9に示すよう夫々の画像縦横サイズは階層0から順に(640×480),(320×240),(160×120),(80×60),(40×30),(20×15),(10×7),(5×3),(2×1),(1×1)となり、階層数として10が出力される。また、生成された階層画像の色数は図10に示すように、収縮されて下層の画像ほど該画像を構成する色数が減ることになる。なお、図10は収縮の効果の説明用に図9で示した各階層画像の縦横サイズを入力画像の縦横サイズに一致させたものであり、本発明で使用する階層画像とは異なる。   In the inscribed rectangle detection apparatus 100, first, the contracted hierarchical image generation unit 1 is activated, generates a hierarchical image in which contraction is applied to color determination, and outputs the number of hierarchical levels of the hierarchical image. In this embodiment, the vertical and horizontal sizes of each hierarchical image are determined by an integer value obtained by dividing the vertical and horizontal size of the hierarchical image one level higher by 2, and the neighborhood used at the time of contraction is assumed to be a 3 × 3 neighborhood. The description will be continued hereinafter. In this example, as shown in FIG. 9, the vertical and horizontal sizes of the images are (640 × 480), (320 × 240), (160 × 120), (80 × 60), (40 × 30), (20 × 15), (10 × 7), (5 × 3), (2 × 1), (1 × 1), and 10 is output as the number of layers. Further, as shown in FIG. 10, the number of colors of the generated hierarchical image is shrunk, and the number of colors constituting the image decreases as the lower layer image is displayed. FIG. 10 is a diagram in which the vertical and horizontal sizes of each hierarchical image shown in FIG. 9 are matched with the vertical and horizontal sizes of the input image for the purpose of explaining the effect of contraction, and is different from the hierarchical image used in the present invention.

続いて、対象階層画像決定部2が起動し、階層数を受信し、前記階層画像から背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し、出力する。本実施例では階層数10を受信し、階層番号9の画像から処理を施し、画像を構成する色数が2以上の第6階層の階層画像が背景色である黒以外の少なくとも1色以上を有すと判定され、対象階層番号として6が出力されることになる。   Subsequently, the target layer image determination unit 2 is activated, receives the number of layers, determines the lowest layer image number as a target layer number from among the layer images having at least one color other than the background color from the layer image, Output. In this embodiment, the number of layers 10 is received, the image is processed from the image of layer number 9, and the sixth layer image having the number of colors constituting the image is at least one color other than black as the background color. Therefore, 6 is output as the target hierarchy number.

続いて、最大矩形検出部3が起動し、対象階層画像番号を受信し、該対象階層番号に対応する階層画像において1つの色領域内に留まる面積最大の矩形縦横サイズと矩形中心位置を決定する。本実施例では、まず対象階層番号として6を受信する。続いて全マスクの縦横サイズを全て読出される。本実施例では最終的に横長の矩形を検出するため(3×3),(3×2),(3×1),(2×2),(2×1),(1×1)の6つの縦横サイズを読み出したものとする。続いて対象階層番号目の階層画像をメモリ8から読出し処理対象画像として設定される。   Subsequently, the maximum rectangle detection unit 3 is activated, receives the target layer image number, and determines the maximum rectangle vertical and horizontal size and rectangle center position that remain in one color region in the layer image corresponding to the target layer number. . In this embodiment, first, 6 is received as the target hierarchy number. Subsequently, all the vertical and horizontal sizes of all the masks are read out. In this embodiment, in order to finally detect a horizontally long rectangle, (3 × 3), (3 × 2), (3 × 1), (2 × 2), (2 × 1), (1 × 1) Assume that six vertical and horizontal sizes are read out. Subsequently, the hierarchical image of the target hierarchical number is read from the memory 8 and set as a processing target image.

次にマスクを階層画像上でラスタスキャンし、1つの色領域内に留まる面積最大の矩形縦横サイズと矩形中心位置が決定される。本実施例では、(3×3),(3×2),(2×2),(3×1),(2×1),(1×1)の順にマスクが第6階層の階層画像上でラスタスキャンされ、マスク縦横サイズが(1×1)の時に中心位置が(2.5,1.5)で、色が200の領域内に留まったものとする。そこで最大矩形検出部3では、領域色として200をメモリ保存し、矩形中心位置が(2.5,1.5)、矩形縦横サイズが(1×1)と対象階層番号6を出力して処理を終了する。   Next, the mask is raster-scanned on the hierarchical image, and a rectangular vertical size and a rectangular center position having the maximum area remaining in one color region are determined. In the present embodiment, a hierarchical image whose mask is the sixth hierarchy in the order of (3 × 3), (3 × 2), (2 × 2), (3 × 1), (2 × 1), and (1 × 1). It is assumed that the raster scan is performed above and the center position is (2.5, 1.5) and the color remains in the region of 200 when the vertical and horizontal size of the mask is (1 × 1). Therefore, the maximum rectangle detection unit 3 stores 200 as a region color in memory, and outputs the target hierarchy number 6 with the rectangle center position (2.5, 1.5) and the rectangle vertical / horizontal size (1 × 1). Exit.

続いて、矩形復元部4が起動し、これらを入力画像上での縦横サイズ、中心位置に変換する。本実施例では、まず、矩形中心位置(2.5,1.5)、矩形縦横サイズが(1×1)と対象階層番号6を受信したものとする。次に1段上の階層である第5階層の階層画像における中心位置と矩形サイズへと前記矩形中心位置、前記矩形縦横サイズを変換する。この実施例では第6階層に対する第5階層の縦横サイズ比率がそれぞれ2と2.1であるので、矩形中心位置、前記矩形縦横サイズは夫々(5.5,3.5)、(3×3)に更新される。この更新処理を入力画像である第0階層まで繰り返した結果、本実施例では縦横サイズ(127×127)、中心位置(191.5,127.5)となり、矩形復元部4はこれを夫々復元矩形縦横サイズ、復元矩形中心位置として出力する。図11に前記復元矩形縦横サイズ、復元矩形中心位置で表現される復元矩形を図中黒枠で示す。   Subsequently, the rectangle restoration unit 4 is activated and converts them into the vertical and horizontal sizes and the center position on the input image. In this embodiment, it is assumed that the rectangle center position (2.5, 1.5), the rectangle vertical and horizontal size (1 × 1), and the target hierarchy number 6 are received. Next, the rectangular center position and the rectangular vertical and horizontal size are converted into the central position and the rectangular size in the hierarchical image of the fifth hierarchy which is the hierarchy one level above. In this embodiment, the vertical and horizontal size ratios of the fifth hierarchy with respect to the sixth hierarchy are 2 and 2.1, respectively, so that the rectangular center position and the rectangular vertical and horizontal sizes are (5.5, 3.5) and (3 × 3), respectively. ) Is updated. As a result of repeating this update processing up to the 0th hierarchy as the input image, in this embodiment, the vertical and horizontal sizes (127 × 127) and the center position (191.5, 127.5) are obtained, and the rectangular restoration unit 4 restores each of them. Output as rectangle vertical / horizontal size and restored rectangle center position. FIG. 11 shows a restoration rectangle represented by the restoration rectangle length and width size and the restoration rectangle center position by a black frame in the figure.

続いて、復元矩形拡大部5が起動し、復元矩形縦横サイズ、復元矩形中心位置を受信し、メモリから領域色を読み出し、前記復元矩形縦横サイズ、復元矩形中心位置で表現される復元矩形を前記領域色内に留まるうちは入力画像上で拡大させ、矩形の縦横サイズ、中心位置を更新し、これを最終出力する。本実施例ではまず復元矩形縦横サイズ(127×127)、復元矩形中心位置(191.5,127.5)を受信し、メモリ8から領域色200を読み出す。続いて矩形を構成する左の縦直線を左方向に1画素ずらし、該縦直線上に領域色200と異なる色がないかどうかを判定し、なければさらにずらすことによって、左方向に拡大する。この処理を右の縦直線、上下の横直線と全ての復元矩形構成直線について行なうことによって拡大された矩形の縦横サイズ、中心位置が本実施例では(203×180)、(115,57)と夫々なり、これを最終出力する。最終出力される矩形の縦横サイズ、中心位置で表現される矩形を図12に図中白枠で示す。
(第2実施例)
次に本発明における第2の実施形態を具体的データに即して説明する。入力画像、背景色は第1実施例と同様とする。第1実施例ではある1つの領域内に留まる1つの矩形のみ検出するが、本実施例ではある1つの領域内に留まる矩形を夫々重複することなく複数検出するため、検出された矩形の数である検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定する、図1(b)に示す終了条件判定部9と、検出済みの矩形領域に属する入力画像の画素の画素値に背景色を代入して入力画像を更新し、検出された矩形の数である検出済矩形数を1増加させる、図1(b)に示す入力画像更新部10を設けたことが第1実施例と異なる。本実施例では収縮階層画像生成部1、対象階層画像決定部2、最大矩形検出部3、矩形復元部4、復元矩形拡大部5で行われる処理は第1実施例と変わることが無いので、処理の詳細な記述は省く。また、検出矩形数は予め3と与えられているものとする。
Subsequently, the restoration rectangle enlargement unit 5 is activated, receives the restoration rectangle vertical and horizontal sizes and the restoration rectangle center position, reads the area color from the memory, and displays the restoration rectangle represented by the restoration rectangle height and width and restoration rectangle center position. As long as it stays within the region color, it is enlarged on the input image, the vertical and horizontal sizes and the center position of the rectangle are updated, and this is finally output. In this embodiment, first, the restored rectangular vertical and horizontal sizes (127 × 127) and the restored rectangular center position (191.5, 127.5) are received, and the area color 200 is read from the memory 8. Subsequently, the left vertical straight line constituting the rectangle is shifted by one pixel in the left direction, and it is determined whether or not there is a color different from the region color 200 on the vertical straight line. By performing this process on the right vertical line, the upper and lower horizontal lines, and all the restored rectangular constituent straight lines, the vertical and horizontal sizes and center positions of the expanded rectangles are (203 × 180) and (115, 57) in this embodiment. This is the final output. A rectangle represented by the vertical and horizontal sizes and the center position of the final output rectangle is shown by a white frame in FIG.
(Second embodiment)
Next, a second embodiment of the present invention will be described based on specific data. The input image and background color are the same as in the first embodiment. In the first embodiment, only one rectangle staying in one area is detected, but in this embodiment, a plurality of rectangles staying in one area are detected without overlapping each other. Comparing a certain detected number of rectangles with the number of detected rectangles and determining whether or not to continue the rectangle detection process, an end condition determining unit 9 shown in FIG. 1B and an input image belonging to the detected rectangular area An input image update unit 10 shown in FIG. 1B is provided that updates the input image by substituting the background color into the pixel value of each pixel, and increases the number of detected rectangles, which is the number of detected rectangles, by one. This is different from the first embodiment. In the present embodiment, the processing performed in the contraction layer image generation unit 1, the target layer image determination unit 2, the maximum rectangle detection unit 3, the rectangle restoration unit 4, and the restoration rectangle enlargement unit 5 is not different from the first embodiment. A detailed description of the processing is omitted. The number of detection rectangles is assumed to be 3 in advance.

本実施例における内接矩形検出装置では、まず、終了条件判定部9が起動される。終了条件判定部9は起動されると、図4の処理フローのステップS31において、検出された矩形の数である検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定し、処理を繰り返す場合は収縮階層画像生成部1を起動し(ステップS32)、繰り返さない場合は処理を終了する。検出矩形数は3であり、初期状態では前記検出済矩形数は0であり、3より小さいため収縮階層画像生成部1を起動して処理を終了する。   In the inscribed rectangle detecting apparatus in the present embodiment, first, the end condition determining unit 9 is activated. When the termination condition determination unit 9 is activated, in step S31 of the processing flow of FIG. 4, the number of detected rectangles, which is the number of detected rectangles, is compared with the number of detected rectangles, and whether or not the rectangle detection process is repeated continuously. If the process is to be repeated, the contracted hierarchy image generation unit 1 is activated (step S32). If the process is not to be repeated, the process is terminated. The number of detected rectangles is 3, and in the initial state, the number of detected rectangles is 0 and is smaller than 3, so that the contracted hierarchy image generation unit 1 is activated and the process is terminated.

収縮階層画像生成部1、対象階層画像決定部2、最大矩形検出部3、矩形復元部4、復元矩形拡大部5が起動されて第1実施例同様矩形縦横サイズが(203×180)、矩形中心位置が(115,57)が出力された後、入力画像更新部10が起動する(ステップS33)。入力画像更新部10は起動すると、メモリ8から入力画像を読み出し、矩形の縦横サイズ、中心位置で表現される矩形内の画素の値を全て背景色で埋め入力画像を更新する。本実施例での入力画像の更新結果を図13に示す。次に検出済矩形数0に1を増加させて1とし、終了条件判定部9を起動して処理を終了する。   The contracted layer image generation unit 1, the target layer image determination unit 2, the maximum rectangle detection unit 3, the rectangle restoration unit 4, and the restoration rectangle enlargement unit 5 are activated, and the rectangular vertical and horizontal sizes are (203 × 180) and rectangular as in the first embodiment. After the center position (115, 57) is output, the input image update unit 10 is activated (step S33). When activated, the input image update unit 10 reads the input image from the memory 8 and updates the input image by filling all the pixel values in the rectangle represented by the vertical and horizontal sizes and the center position of the rectangle with the background color. The update result of the input image in this embodiment is shown in FIG. Next, 1 is increased to 1 to the number of detected rectangles to 1, and the end condition determination unit 9 is activated to end the process.

以上の処理が終了条件判定部9において検出済矩形数が検出矩形数以上になるまで繰り返される。1回目の繰り返し処理によって検出された矩形は第1実施例同様図12に示す矩形が検出される。2回目の繰り返し処理で検出された結果を図14に、3回目の繰り返し処理で検出された結果を図15に夫々示す。   The above process is repeated in the end condition determination unit 9 until the number of detected rectangles exceeds the number of detected rectangles. The rectangle shown in FIG. 12 is detected as in the first embodiment as the rectangle detected by the first iteration. FIG. 14 shows the results detected in the second iteration, and FIG. 15 shows the results detected in the third iteration.

また前記図1〜図4で述べた内接矩形検出装置は、例えばコンピュータ装置が有するCPUによって実現され、該内接矩形検出装置の機能を実現するソフトウエアのプログラムとして搭載することができる。   The inscribed rectangle detecting device described with reference to FIGS. 1 to 4 is realized by, for example, a CPU included in a computer device, and can be installed as a software program for realizing the functions of the inscribed rectangle detecting device.

また内接矩形検出装置の機能を実現するソフトウエアのプログラムコードを記録した記録媒体を、システム又は装置に供給し、そのシステム又は装置のCPU(MPU)が記憶媒体に格納されたプログラムコードを読み出し実行することも可能である。この場合、記憶媒体から読み出されたプログラムコード自体が前記実施形態の機能を実現することになり、このプログラムコードを記憶した記憶媒体としては、例えば、CD−ROM、DVD−ROM、CD−R、CD−RW、MO、及びHDD等がある。   In addition, a recording medium on which a software program code for realizing the function of the inscribed rectangle detecting apparatus is recorded is supplied to the system or apparatus, and the CPU (MPU) of the system or apparatus reads the program code stored in the storage medium. It is also possible to execute. In this case, the program code itself read from the storage medium realizes the functions of the above-described embodiment, and examples of the storage medium storing the program code include CD-ROM, DVD-ROM, and CD-R. , CD-RW, MO, and HDD.

以上、本発明を実施形態例に基づき具体的に説明したが、上記実施の形態の説明は、本発明を説明するためのものであって、特許請求の範囲に記載の発明を限定し、或は範囲を減縮する様に解すべきではない。又、本発明の各部構成は上記実施の形態に限らず、特許請求の範囲に記載の技術的範囲内で種々の変形が可能であることは勿論である。   Although the present invention has been specifically described above based on the embodiments, the description of the above embodiments is for explaining the present invention, and limits the invention described in the claims. Should not be construed as reducing the range. The configuration of each part of the present invention is not limited to the above-described embodiment, and various modifications can be made within the technical scope described in the claims.

本発明による内接矩形検出装置の構成例を表し、(a)は一実施形態例のブロック図、(b)は他の実施形態例のブロック図である。1 illustrates a configuration example of an inscribed rectangle detection device according to the present invention, where (a) is a block diagram of an embodiment and (b) is a block diagram of another embodiment. 本発明による内接矩形検出装置の対象階層画像決定部を示すフローチャートである。It is a flowchart which shows the object hierarchy image determination part of the inscribed rectangle detection apparatus by this invention. 本発明による内接矩形検出装置の最大矩形検出部における処理を示すフローチャートである。It is a flowchart which shows the process in the largest rectangle detection part of the inscribed rectangle detection apparatus by this invention. 本発明による内接矩形検出装置の他の実施形態例における要部の処理を示すフローチャートである。It is a flowchart which shows the process of the principal part in the other embodiment of the inscribed rectangle detection apparatus by this invention. 本発明による内接矩形検出装置における収縮階層画像生成部の処理を説明するための説明図である。It is explanatory drawing for demonstrating the process of the contraction hierarchy image generation part in the inscribed rectangle detection apparatus by this invention. 本発明による内接矩形検出装置における最大矩形検出部の処理を説明するための説明図である。It is explanatory drawing for demonstrating the process of the largest rectangle detection part in the inscribed rectangle detection apparatus by this invention. 本発明による内接矩形検出装置における復元矩形拡大部の処理を説明するための説明図である。It is explanatory drawing for demonstrating the process of the decompression | restoration rectangle expansion part in the inscribed rectangle detection apparatus by this invention. 本発明の第1実施例における入力画像を表す説明図である。It is explanatory drawing showing the input image in 1st Example of this invention. 本発明の第1実施例における、生成される収縮階層画像の説明図である。It is explanatory drawing of the shrinkage | contraction hierarchical image produced | generated in 1st Example of this invention. 本発明の第1実施例における収縮効果をするために各階層画像の縦横サイズを入力画像サイズに一致させた説明図である。It is explanatory drawing which made the vertical and horizontal size of each hierarchical image correspond to the input image size in order to make the contraction effect in 1st Example of this invention. 本発明の第1実施例における復元矩形を説明する説明図である。It is explanatory drawing explaining the decompression | restoration rectangle in 1st Example of this invention. 本発明の第1実施例における最終出力される矩形を説明する説明図である。It is explanatory drawing explaining the rectangle finally output in 1st Example of this invention. 本発明の第2実施例における入力画像の更新結果を表す説明図である。It is explanatory drawing showing the update result of the input image in 2nd Example of this invention. 本発明の第2実施例における2回目の繰り返し処理で検出された結果を表す説明図である。It is explanatory drawing showing the result detected by the 2nd repetition process in 2nd Example of this invention. 本発明の第2実施例における3回目の繰り返し処理で検出された結果を表す説明図である。It is explanatory drawing showing the result detected by the 3rd repetition process in 2nd Example of this invention.

符号の説明Explanation of symbols

1…収縮階層画像生成部、2…対象階層画像決定部、3…最大矩形検出部、4…矩形復元部、5…復元矩形拡大部、6…画像入力部、7…使用色数カウント部、8…メモリ、9…終了条件判定部、10…入力画像更新部、100…内接矩形検出装置。
DESCRIPTION OF SYMBOLS 1 ... Shrinkage hierarchy image generation part, 2 ... Target hierarchy image determination part, 3 ... Maximum rectangle detection part, 4 ... Rectangle restoration part, 5 ... Restoration rectangle expansion part, 6 ... Image input part, 7 ... Used color number count part, DESCRIPTION OF SYMBOLS 8 ... Memory, 9 ... End condition determination part, 10 ... Input image update part, 100 ... Inscribed rectangle detection apparatus.

Claims (8)

少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる矩形のうち面積最大となる矩形の中心位置と該矩形の縦横サイズを出力する内接矩形検出装置であって、
前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成手段と、
前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定手段と、
前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形検出手段と、
前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元手段と、
前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大手段と、
を備えてなることを特徴とする内接矩形検出装置。
An inscribed rectangle that outputs the center position of the rectangle having the largest area and the vertical and horizontal size of the rectangle from the input image divided into at least one region and staying in one of the regions. A detection device,
A contracted hierarchical image generating means for generating a hierarchical image from the input image, storing it in a memory, and outputting the number of layers;
A target layer image determining means for determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than the background color defined in advance from the layer image;
A mask provided in advance in each color area of the hierarchical image corresponding to the target hierarchical number is scanned to determine the maximum mask vertical and horizontal size and mask center position that remain in one color area other than the background color, and the maximum area A maximum rectangle detecting means for storing an area color where a mask stays in a memory and outputting the mask vertical and horizontal sizes and the mask center position;
Rectangle restoration means for converting the mask vertical and horizontal sizes and the mask center position into vertical and horizontal sizes and center positions on the input image and outputting them as restored rectangular vertical and horizontal sizes and restored rectangular center positions, respectively.
A restoration rectangle enlargement unit that uses the restoration rectangle vertical and horizontal sizes and the restoration rectangle center position, enlarges it on the input image while remaining in the region color, and updates and outputs the vertical and horizontal sizes and the center position;
An inscribed rectangle detecting device comprising:
少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる複数の矩形のうち、互いに矩形同士が重複することのない矩形群の夫々の中心位置と縦横サイズを予めユーザによって与えられた検出矩形数分検出する内接矩形検出装置であって、
前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成手段と、
前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定手段と、
前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形検出手段と、
前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元手段と、
前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大手段と、
前記拡大された矩形内部に属する入力画像の画素の画素値に背景色を代入して入力画像を更新し、検出された矩形の数である検出済矩形数を1増加させる入力画像更新手段と、
前記検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定し、処理を繰り返す場合は前記収縮階層画像生成手段を起動し、繰り返さない場合は処理を終了する終了条件判定手段と、
を備えてなることを特徴とする内接矩形検出装置。
From the input image divided into at least one or more areas, among the plurality of rectangles that remain in one of the areas, the respective center positions of the rectangles that do not overlap each other An inscribed rectangle detecting device that detects the vertical and horizontal sizes by the number of detection rectangles given in advance by a user,
A contracted hierarchical image generating means for generating a hierarchical image from the input image, storing it in a memory, and outputting the number of layers;
A target layer image determining means for determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than the background color defined in advance from the layer image;
A mask provided in advance in each color area of the hierarchical image corresponding to the target hierarchical number is scanned to determine the maximum mask vertical and horizontal size and mask center position that remain in one color area other than the background color, and the maximum area A maximum rectangle detecting means for storing an area color where a mask stays in a memory and outputting the mask vertical and horizontal sizes and the mask center position;
Rectangle restoration means for converting the mask vertical and horizontal sizes and the mask center position into vertical and horizontal sizes and center positions on the input image and outputting them as restored rectangular vertical and horizontal sizes and restored rectangular center positions, respectively.
A restoration rectangle enlargement unit that uses the restoration rectangle vertical and horizontal sizes and the restoration rectangle center position, enlarges it on the input image while remaining in the region color, and updates and outputs the vertical and horizontal sizes and the center position;
An input image update means for updating the input image by substituting the background color into the pixel value of the pixel of the input image belonging to the enlarged rectangle, and increasing the number of detected rectangles, which is the number of detected rectangles;
The number of detected rectangles is compared with the number of detected rectangles to determine whether or not to continue the rectangle detection process. If the process is repeated, the contracted hierarchy image generation unit is activated. If not, the process ends. An end condition determining means;
An inscribed rectangle detecting device comprising:
前記収縮階層画像生成手段は、生成する階層画像の画素値を決定する際に処理対象の画像座標に対応する1段上の階層画像の対応画像座標と対応画素値を求め、
該対応画像座標の画素近傍内に画素値が前記対応画素値と異なる少なくとも1つ以上画素が存在すれば前記処理対象画像座標の画素値を前記背景色に、その他の場合は前記対応画素値として決定すること
を特徴とする請求項1又は2に記載の内接矩形検出装置。
The contracted hierarchical image generation means obtains the corresponding image coordinates and corresponding pixel values of the hierarchical image on the first level corresponding to the image coordinates to be processed when determining the pixel values of the hierarchical image to be generated,
If at least one pixel having a pixel value different from the corresponding pixel value exists in the vicinity of the pixel of the corresponding image coordinate, the pixel value of the processing target image coordinate is set as the background color, and in other cases, the corresponding pixel value is set as the corresponding pixel value. The inscribed rectangle detecting device according to claim 1 or 2, wherein the inscribed rectangle detecting device is determined.
前記対象階層画像決定手段は、
前記収縮階層画像生成手段において出力された階層画像の階層数を受信し、
画像サイズが小さい階層を下層としたときの最下層の階層画像から処理を始め、階層画像で使用されている使用色数を数え上げて背景色以外の色が利用されているかどうかを判定する処理を、初めて該判定条件が満たされるまで上層の階層画像へと階層番号順に処理を行ない、前記判定条件が満たされた際の階層画像番号を対象階層画像番号とし出力すること
を特徴とする請求項1〜3のうちいずれか1項に記載の内接矩形検出装置。
The target hierarchy image determination means includes
Receiving the number of layers of the layer image output in the contraction layer image generation means;
Starting from the lowest layer image when the image size is a lower layer, the number of colors used in the layer image is counted to determine whether a color other than the background color is used 2. The processing is performed in order of hierarchical number to the upper hierarchical image until the determination condition is satisfied for the first time, and the hierarchical image number when the determination condition is satisfied is output as the target hierarchical image number. The inscribed rectangle detection device according to any one of?
前記最大矩形検出手段は、
前記対象階層画像決定手段において出力された対象階層画像番号を受信して対象階層番号目の階層画像を対象階層画像としてメモリから読み出すと共に、予めユーザによって設定されたマスクの縦横サイズを全て読出し、
前記入力マスクの未処理のマスクのうち面積が最大となるマスクを処理マスクとして設定し、
該処理マスクを前記対象階層画像上に設定し、該処理マスク内の各画素の画素値に処理対象画像上で対応する画素の画素値をコピーし、該処理マスク内が全て同一画素値でかつ、その画素値が全て背景色以外の同一画素値となる条件を満たすまで処理マスクを対象階層画像上で走査し、前記条件が満たされない際には前記条件が満たされるまで全ての前記入力マスクに亘って処理を繰り返し、
前記条件が満たされた時には、処理マスク内の画素値を領域色としてメモリに格納した後、前記条件を満たした時の処理マスク中心位置と処理マスクの縦横サイズを矩形中心位置と矩形縦横サイズとして、対象階層番号と共に出力すること
を特徴とする請求項1〜4のうちいずれか1項に記載の内接矩形検出装置。
The maximum rectangle detecting means includes
Receiving the target layer image number output in the target layer image determining means, reading out the layer image of the target layer number from the memory as the target layer image, and reading out all the vertical and horizontal sizes of the mask set in advance by the user;
A mask having the largest area among unprocessed masks of the input mask is set as a processing mask,
The processing mask is set on the target hierarchy image, the pixel value of the corresponding pixel on the processing target image is copied to the pixel value of each pixel in the processing mask, and all the processing masks have the same pixel value and The processing mask is scanned on the target hierarchical image until the condition that the pixel values are all the same pixel values other than the background color is satisfied. When the condition is not satisfied, all the input masks are scanned until the condition is satisfied. Repeat the process
When the condition is satisfied, the pixel value in the processing mask is stored in the memory as a region color, and the processing mask center position and the processing mask vertical and horizontal size when the condition is satisfied are set as the rectangular center position and the rectangular vertical and horizontal size. The inscribed rectangle detecting device according to claim 1, wherein the inscribed rectangle detecting device outputs the target hierarchy number together with the target hierarchy number.
前記矩形復元手段は、
前記最大矩形検出手段において出力された矩形中心位置、矩形縦横サイズ、対象階層番号を受信し、
対象階層画像を元階層画像、矩形中心位置、矩形縦横サイズを元中心位置、元縦横サイズ、対象階層画像に対する1階層上層の階層画像を上階層画像とし、
元階層画像に対する上階層画像の縦サイズ、横サイズ夫々の比率を用いて元中心位置、元縦横サイズを上階層画像における中心位置と縦横サイズに変換し、上階層画像を元階層画像、変換された中心位置と縦横サイズを元中心位置、元縦横サイズとして更新する処理を、
元階層画像の階層番号が最上層の番号に一致するまで繰り返し、
最後に元中心位置、元縦横サイズを復元矩形中心位置、復元矩形縦横サイズとして出力すること
を特徴とする請求項1〜5のうちいずれか1項に記載の内接矩形検出装置。
The rectangle restoration means includes
Receives the rectangular center position, rectangular vertical and horizontal sizes, and target hierarchy number output by the maximum rectangular detection means,
The target hierarchical image is the original hierarchical image, the rectangular center position, the rectangular vertical and horizontal size is the original central position, the original vertical and horizontal size, and the hierarchical image one layer above the target hierarchical image is the upper hierarchical image,
The original center position and the original vertical / horizontal size are converted into the center position and vertical / horizontal size in the upper layer image using the ratio of the vertical size and horizontal size of the upper layer image to the original layer image, and the upper layer image is converted to the original layer image. Update the center position and vertical / horizontal size as the original central position and original vertical / horizontal size,
Repeat until the layer number of the original layer image matches the number of the top layer,
6. The inscribed rectangle detection device according to claim 1, wherein the original center position and the original vertical and horizontal size are output as a restored rectangular center position and a restored rectangular vertical and horizontal size.
少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる矩形のうち面積最大となる矩形の中心位置と該矩形の縦横サイズを出力する処理をコンピュータに行わせるための内接矩形検出プログラムであって、
前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成ステップと、
前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定ステップと、
前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形決定ステップと、
前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元ステップと、
前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大ステップと、
を実行させるための内接矩形検出プログラム。
A computer that outputs from the input image divided into at least one region, the center position of the rectangle having the largest area among the rectangles remaining in one of the regions and the vertical and horizontal sizes of the rectangle An inscribed rectangle detection program for causing
A contracted hierarchical image generation step of generating a hierarchical image from the input image, storing it in a memory, and outputting the number of hierarchical levels;
A target layer image determining step of determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than the background color defined in advance from the layer image;
A mask provided in advance in each color area of the hierarchical image corresponding to the target hierarchical number is scanned to determine the maximum mask vertical and horizontal size and mask center position that remain in one color area other than the background color, and the maximum area A maximum rectangle determining step for storing a region color in which a mask stays in a memory and outputting the vertical and horizontal sizes of the mask and the center position of the mask;
A rectangular restoration step of converting the mask vertical and horizontal sizes and the mask center position into vertical and horizontal sizes and a center position on the input image and outputting them as restored rectangular vertical and horizontal sizes and restored rectangular center positions, respectively.
A restoration rectangle enlargement step that uses the restoration rectangle vertical and horizontal sizes and restoration rectangle center positions, enlarges them on the input image while staying within the region color, updates the vertical and horizontal sizes and center positions, and outputs them.
An inscribed rectangle detection program for executing
少なくとも1つ以上の領域に領域分割された入力画像から、前記領域のうちのある1つの領域内に留まる複数の矩形のうち、互いに矩形同士が重複することのない矩形群の夫々の中心位置と縦横サイズを予めユーザによって与えられた検出矩形数分検出する処理をコンピュータに行わせるための内接矩形検出プログラムであって、
前記入力画像から階層画像を生成してメモリに格納し、その階層数を出力する収縮階層画像生成ステップと、
前記階層画像から予め定義された背景色以外の少なくとも1色以上を有する階層画像のうち最下層の画像番号を対象階層番号として決定し出力する対象階層画像決定ステップと、
前記対象階層番号に対応する階層画像の各色領域において予め与えられたマスクを走査して背景色以外の1つの色領域内に留まる面積最大のマスク縦横サイズとマスク中心位置を決定し、該面積最大マスクが留まった領域色をメモリに格納し、前記マスク縦横サイズと前記マスク中心位置を出力する最大矩形決定ステップと、
前記マスク縦横サイズと前記マスク中心位置を入力画像上での縦横サイズ、中心位置に変換して夫々復元矩形縦横サイズ、復元矩形中心位置として出力する矩形復元ステップと、
前記復元矩形縦横サイズ、復元矩形中心位置を用い、前記領域色内に留まるうちは入力画像上で拡大させ、縦横サイズ、中心位置を更新して出力する復元矩形拡大ステップと、
前記拡大された矩形内部に属する入力画像の画素の画素値に背景色を代入して入力画像を更新し、検出された矩形の数である検出済矩形数を1増加させる入力画像更新ステップと、
前記検出済矩形数と前記検出矩形数分を比較し引き続き矩形検出処理を繰り返すか否かを判定し、処理を繰り返す場合は前記収縮階層画像生成ステップを起動し、繰り返さない場合は処理を終了する終了条件判定ステップと、
を実行させるための内接矩形検出プログラム。
From the input image divided into at least one or more areas, among the plurality of rectangles that remain in one of the areas, the respective center positions of the rectangles that do not overlap each other An inscribed rectangle detection program for causing a computer to perform processing for detecting the vertical and horizontal sizes by the number of detection rectangles given in advance by a user,
A contracted hierarchical image generation step of generating a hierarchical image from the input image, storing it in a memory, and outputting the number of hierarchical levels;
A target layer image determining step of determining and outputting the lowest layer image number as a target layer number among layer images having at least one color other than the background color defined in advance from the layer image;
A mask provided in advance in each color area of the hierarchical image corresponding to the target hierarchical number is scanned to determine the maximum mask vertical and horizontal size and mask center position that remain in one color area other than the background color, and the maximum area A maximum rectangle determining step for storing a region color in which a mask stays in a memory and outputting the vertical and horizontal sizes of the mask and the center position of the mask;
A rectangular restoration step of converting the mask vertical and horizontal sizes and the mask center position into vertical and horizontal sizes and a center position on the input image and outputting them as restored rectangular vertical and horizontal sizes and restored rectangular center positions, respectively.
A restoration rectangle enlargement step that uses the restoration rectangle vertical and horizontal sizes and restoration rectangle center positions, enlarges them on the input image while staying within the region color, updates the vertical and horizontal sizes and center positions, and outputs them.
An input image update step of updating the input image by substituting the background color into the pixel value of the pixel of the input image belonging to the enlarged rectangle, and increasing the number of detected rectangles, which is the number of detected rectangles;
The number of detected rectangles is compared with the number of detected rectangles to determine whether or not to continue the rectangle detection process. If the process is repeated, the contraction layer image generation step is started, and if not, the process ends. An end condition determination step;
An inscribed rectangle detection program for executing
JP2005329213A 2005-11-14 2005-11-14 Inscribed rectangle detection apparatus and inscribed rectangle detection program Expired - Fee Related JP4594848B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005329213A JP4594848B2 (en) 2005-11-14 2005-11-14 Inscribed rectangle detection apparatus and inscribed rectangle detection program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005329213A JP4594848B2 (en) 2005-11-14 2005-11-14 Inscribed rectangle detection apparatus and inscribed rectangle detection program

Publications (2)

Publication Number Publication Date
JP2007140593A true JP2007140593A (en) 2007-06-07
JP4594848B2 JP4594848B2 (en) 2010-12-08

Family

ID=38203416

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005329213A Expired - Fee Related JP4594848B2 (en) 2005-11-14 2005-11-14 Inscribed rectangle detection apparatus and inscribed rectangle detection program

Country Status (1)

Country Link
JP (1) JP4594848B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9191536B2 (en) 2013-08-23 2015-11-17 Brother Kogyo Kabushiki Kaisha Processing apparatus
US9332149B2 (en) 2013-08-23 2016-05-03 Brother Kogyo Kabushiki Kaisha Image processing apparatus capable of generating image including arranged images
US9633414B2 (en) 2012-07-25 2017-04-25 Nec Corporation Update region detection device
CN112991470A (en) * 2021-02-08 2021-06-18 上海通办信息服务有限公司 Method and system for checking photo background color of certificate under complex background
CN114239781A (en) * 2021-12-21 2022-03-25 三维码(厦门)网络科技有限公司 Method, equipment and storage medium for rapidly generating three-dimensional code

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61289478A (en) * 1985-06-17 1986-12-19 Nippon Telegr & Teleph Corp <Ntt> Matching method for pictorial pattern
JPS63298486A (en) * 1987-05-28 1988-12-06 Ricoh Co Ltd Area dividing and discriminating system for document picture

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61289478A (en) * 1985-06-17 1986-12-19 Nippon Telegr & Teleph Corp <Ntt> Matching method for pictorial pattern
JPS63298486A (en) * 1987-05-28 1988-12-06 Ricoh Co Ltd Area dividing and discriminating system for document picture

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9633414B2 (en) 2012-07-25 2017-04-25 Nec Corporation Update region detection device
US9191536B2 (en) 2013-08-23 2015-11-17 Brother Kogyo Kabushiki Kaisha Processing apparatus
US9332149B2 (en) 2013-08-23 2016-05-03 Brother Kogyo Kabushiki Kaisha Image processing apparatus capable of generating image including arranged images
CN112991470A (en) * 2021-02-08 2021-06-18 上海通办信息服务有限公司 Method and system for checking photo background color of certificate under complex background
CN112991470B (en) * 2021-02-08 2023-12-26 上海通办信息服务有限公司 Certificate photo background color checking method and system under complex background
CN114239781A (en) * 2021-12-21 2022-03-25 三维码(厦门)网络科技有限公司 Method, equipment and storage medium for rapidly generating three-dimensional code

Also Published As

Publication number Publication date
JP4594848B2 (en) 2010-12-08

Similar Documents

Publication Publication Date Title
JP5558973B2 (en) Image correction apparatus, correction image generation method, correction table generation apparatus, correction table generation method, correction table generation program, and correction image generation program
JP7372199B2 (en) Projection system, projection device, and calibration method for its displayed image
JP6568223B2 (en) Projection device, projection method, and projection program
JP2005124133A (en) Image processing system, projector, program, information storing medium, and image processing method
JP2008211354A (en) Projector, program, and information storage medium
KR20070093995A (en) Motion vector calculation method, hand-movement correction device using the method, imaging device, and motion picture generation device
JP2007226643A (en) Image processor
JP2006074512A (en) Photographing device, and image processing method, and program for photographing device
JPH11304453A (en) Method for multi-gradation rounding-off correcting process and pattern inspection device
JP2008276380A (en) Image magnification device and method
JP4594848B2 (en) Inscribed rectangle detection apparatus and inscribed rectangle detection program
JP2006222965A (en) Image processing method and image processor
JP2009044302A (en) Image processing system, projector, program, and information storage medium
JP2009075646A (en) Video display system and parameter generation method of same
CN114286068B (en) Focusing method, focusing device, storage medium and projection equipment
JP2019220887A (en) Image processing system, image processing method, and program
JP2008211355A (en) Projector, program, and information storage medium
JP2007081611A (en) Method of setting display screen correction parameter
JP2006350562A (en) Image processor and image processing program
JP2010193154A (en) Image processor and method
TW201917698A (en) Multi-dimensional image projection apparatus and multi-dimensional image calibration method thereof
JP3743404B2 (en) Image processing method, image processing program, and recording medium recording image processing program
JP5093517B2 (en) Projector, program, information storage medium, and image generation method
JP6285657B2 (en) Image processing apparatus, image processing method, and program
JP2005267465A (en) Image processing device, pickup image projection apparatus, image processing method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080124

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20090602

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20100514

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100831

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100914

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100917

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130924

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4594848

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees