JP2004086793A - Method and program for extracting object image - Google Patents

Method and program for extracting object image Download PDF

Info

Publication number
JP2004086793A
JP2004086793A JP2002250058A JP2002250058A JP2004086793A JP 2004086793 A JP2004086793 A JP 2004086793A JP 2002250058 A JP2002250058 A JP 2002250058A JP 2002250058 A JP2002250058 A JP 2002250058A JP 2004086793 A JP2004086793 A JP 2004086793A
Authority
JP
Japan
Prior art keywords
block
data
shape
search reference
image data
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
JP2002250058A
Other languages
Japanese (ja)
Other versions
JP4150554B2 (en
Inventor
Takashi Ida
井田 孝
Osamu Hori
堀 修
Nobuyuki Matsumoto
松本 信幸
Hidenori Takeshima
竹島 秀則
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP2002250058A priority Critical patent/JP4150554B2/en
Publication of JP2004086793A publication Critical patent/JP2004086793A/en
Application granted granted Critical
Publication of JP4150554B2 publication Critical patent/JP4150554B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To exactly calculate contours even when other object exists in the vicinity and when an object is thin. <P>SOLUTION: This object image extraction program is constituted of a first step for arranging a plurality of search reference blocks at contour parts of an alpha mask by shifting mutual positions on receiving image data and input of the alpha mask of the approximate shape of an extraction object, a second step for searching similar blocks which are larger than the search reference block and having the similar patterns from the image data by every search reference block and a third step for replacing the alpha masks in each search reference block with the ones formed by reducing the alpha masks of each similar block. In an object image extraction method for making the contours of the alpha masks coincident with the contours of the object by recursively repeating the third step for prescribed frequencies, label data for distinguishing an object defined area, a background defined area and an undefined area is separately inputted and the similar blocks are searched by referring to the label data in the second step. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、画像中の物体領域を求める物体画像抽出方法及び物体画像抽出プログラムに関する。
【0002】
【従来の技術】
画像中から任意の物体の領域を抽出する技術は、例えば、背景を別の画像に置き換えるといった画像の加工を行う際に有用である。そのためには物体の領域をその輪郭に沿って正しく求める必要がある。
【0003】
物体の領域は具体的にはアルファマスク(あるいはシェイプデータ)と呼ばれる画像で表される。アルファマスクは物体が存在する領域(物体領域)とそれ以外の領域とで異なる画素値が設定された画像である。原画とそのアルファマスクの一例をそれぞれ、図3と図4に示す。図3の原画に写った右側の船031のアルファマスクが図4である。
【0004】
言い換えれば、物体を抽出することはアルファマスクを生成することである。
アルファマスクが一度求まれば、それを参照することで簡単に物体領域以外の背景領域を別の画像に置き換えることができる。
【0005】
このような物体抽出の際、何らかの方法で暫定的に物体の概略形状が予め求まっている場合に、その概略形状を元に物体の正確な形状を求める技術が求められている。その手法の一つとして、自己相似写像を用いる物体抽出方法(フラクタル法)を提案されている(例えば、特許文献1、特許文献2、非特許文献1を参照)。この技術の概要を図5、図6、図7、図8を用いて説明する。
【0006】
図5は船031に概略形状051が与えられた様子であり、そのアルファマスクが図6である。この段階では、アルファマスクの輪郭は物体の輪郭とずれている。フラクタル法では、このような原画像データとアルファマスクの入力に対し、まず、アルファマスクを用いて物体の概略形状に沿って複数の正方形のブロックを設定する。これらのブロックをチャイルドブロックと呼ぶ。そして、原画像データの同じ位置にアルファマスクと同様にチャイルドブロックを設定する。図7は原画像データにチャイルドブロックを設定した様子である。分かりやすくするために原画像データに概略形状も示してある。
【0007】
次に、原画像データを用いて各チャイルドブロックに対応するペアレントブロックを求める。ペアレントブロックのサイズは、チャイルドブロックの縦横2倍とし、ペアレントブロックの中の画像パターン(図柄)は、チャイルドブロックの中の画像パターンと同じになるようにする。
【0008】
このようなチャイルドブロックの図柄と相似なペアレントブロックを見つけるためには、原画像データ上でチャイルドブロックの近くで縦横2倍のブロックを候補ブロックとして仮に設定する。そして、その候補ブロックを縦横1/2に縮小した縮小ブロックとチャイルドブロックの誤差を求める。
【0009】
誤差は濃淡画像の場合、例えば、絶対値誤差(各画素の差の絶対値をブロック内の全画素で加算)を用いる。このような誤差評価をいくつかの候補ブロックに対して行い、チャイルドブロックと最も誤差が小さかった候補ブロックをペアレントブロックと決定する。このようなペアレントブロックを図7に示した全てのチャイルドブロックに対して求める。
【0010】
図8は、船031の先端部分に設定されたチャイルドブロック081に対して求まったペアレントブロック082の例である。それぞれのブロックの中の図柄が相似であることが分かる。図8では、2値画像を示しているが、画素に256レベルの画素値が与えられる濃淡画像でも同様である。
【0011】
以上の処理で、チャイルドブロックとこれと相似な図柄を持つペアレントブロックの組のデータが得られるので、次に、求めたペアレントブロックをアルファマスクの同じ位置に原画像データと同様にペアレントブロックを設定する。
【0012】
物体の抽出は、チャイルドブロックとペアレントブロックを利用してアルファマスクを補正することで行う。具体的には、各チャイルドブロックのアルファマスクのデータを、それぞれに対応するペアレントブロックのアルファマスクのデータを縦横1/2に縮小したもので置き換える処理を行えば良い。
【0013】
この置き換え変換(自己相似写像)を1回行うと、概略形状は正しい形状に少し近づく。この近づいたアルファマスクに同じ置き換え変換を再度施す。このようにアルファマスクに再帰的に置き換え変換を繰り返すとほぼ正しい形状に収束する。置き換え変換を一定の回数行ったアルファマスクを物体抽出結果とする。
【0014】
【特許文献1】
特開2000−82145号公報
【0015】
【特許文献2】
特開2001−188910号公報
【0016】
【非特許文献1】
井田、三本杉,「自己相似写像による輪郭線のフィッティング」,第5回 画像センシングシンポジウム講演論文集,C−15,pp.115−120,June 1999.
【0017】
【発明が解決しようとする課題】
しかし、従来のフラクタル法では、他の物体が近くにある場合に他の物体の輪郭を抽出してしまうことがある。また、物体形状が細い場合には、物体形状が消滅してしまうことがあるなど、必ずしも正確に物体の形状を抽出できないことがある。
【0018】
そこで、本発明では他の物体が近くにある場合や、物体形状が細い場合でも正確に物体の形状を抽出することができる方法およびプログラムを提供することを目的とする。
【0019】
【課題を解決するための手段】
上記課題を解決するため、本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きいブロックであって前記画像データ上におけるこのブロックに対応する領域の図柄が前記画像データ上における前記探索基準ブロックに対応する領域の図柄と最も相似している相似ブロックを探索する第3のステップと、前記各探索基準ブロックに対応する領域のシェイプデータをそれぞれの相似ブロックに対応する領域のシェイプデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有し、前記第1のステップでは、前記画像データ中の各画素における前記対象物体の存在する確かさを表すラベルデータも受け、前記第3のステップでは、前記ラベルデータを参照して、対象物体が存在する可能性が低い画素同士の誤差を無視若しくは軽視してブロック全体の誤差の加重和を計算し、前記加重和が最小となる相似ブロックの探索を行うことを特徴とする。
【0020】
また、前記シェイプデータが、対象物体の概略形状の領域を表し、その各画素が前記画像データの各画素と1対1に対応させたものであり、前記ラベルデータが、前記画像データを対象物体確定領域、非対象物体確定領域、未定領域の3種類のうち少なくとも2種類の領域に区分し、その各画素が前記画像データの各画素と1対1に対応させたものであるとし、前記第3のステップでは、前記相似ブロックの候補である複数の候補ブロックそれぞれについて、前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは両方共に非対象物体確定領域に区分される領域に存在する場合には、当該対応点についての誤差を無視若しくは軽視して求め、前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴としても良い。
【0021】
また、前記第3のステップでは、前記相似ブロックの候補である複数の候補ブロックそれぞれについて、前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは、両方共に非対象物体確定領域に区分される領域に存在する場合には、当該対応点についての誤差に乗じる重み係数を0または小さな値にして求め、前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴としても良い。
【0022】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、これらのうち、前記シェイプデータ上における探索基準ブロックに対応する領域のパターンが所定のパターンであるものは設定を解除する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有することを特徴とする。
【0023】
また、前記第2のステップでは、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、各探索基準ブロックと中心位置を同じくする検査ブロックについて、前記シェイプデータ上における検査ブロックに対応する領域のパターンを調べ、検査ブロックのパターンが、所定のパターンであるものについては探索基準ブロックの設定を解除することを特徴としても良い。
【0024】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索するとともに、前記シェイプデータ上の対応する領域のパターンが所定のパターンである相似ブロックとこれに対応する探索基準ブロックの設定を解除する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有することを特徴とする。
【0025】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、前記画像データと前記シェイプデータの両方の上下左右の少なくとも一辺を所定の幅だけ拡張する第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有することを特徴とする。
【0026】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより小さくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記シェイプデータにおいて前記各相似ブロックに対応する領域のデータをそれぞれの探索基準ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有することを特徴とする。
【0027】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、これらを拡大して拡大画像データと拡大シェイプデータとを生成する第1のステップと、前記拡大シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記拡大画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記拡大シェイプデータにおいて前記各相似ブロックに対応する領域のデータをそれぞれの探索基準ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップと、第4のステップで得られた拡大シェイプデータを元の大きさに縮小する第5のステップとを有することを特徴とする。
【0028】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータと前記画像データとを用いて対象物体の形状を抽出したシェイプデータを生成する第2のステップと、前記抽出したシェイプデータを所定の大きさに縮小し、1画素の画素値を前記抽出したシェイプデータの複数の対応する画素の画素値を用いて求めた縮小シェイプデータを生成する第3のステップとを有することを特徴とする。
【0029】
本発明の物体画像抽出方法は、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、これらを拡大して拡大画像データ及び拡大シェイプデータを生成する第1のステップと、前記拡大シェイプデータと前記拡大画像データとを用いて対象物体の形状を抽出した拡大シェイプデータを生成する第2のステップと、前記抽出した拡大シェイプデータを元の大きさに縮小し、1画素の画素値を前記抽出したシェイプデータの複数の対応する画素の画素値を用いて求めたシェイプデータを生成する第3のステップとを有することを特徴とする。
【0030】
本発明の物体画像抽出プログラムは、コンピュータに、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きいブロックであって前記画像データ上におけるこのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似している相似ブロックを探索する第3のステップと、前記各探索基準ブロックに対応する領域のシェイプデータをそれぞれの相似ブロックに対応する領域のシェイプデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させ、前記第1のステップでは、前記画像データ中の各画素における前記対象物体の存在する確かさを表すラベルデータも受け、前記第3のステップでは、前記ラベルデータを参照して、対象物体が存在する可能性が低い画素同士の誤差を無視若しくは軽視してブロック全体の誤差の加重和を計算し、前記加重和が最小となる相似ブロックの探索を行うことを特徴とする。
【0031】
また、前記シェイプデータが、対象物体の概略形状を表し、その各画素が前記画像データの各画素と1対1に対応させたものであり、前記ラベルデータが、前記画像データを対象物体確定領域、非対象物体確定領域、未定領域の3種類のうち少なくとも2種類の領域に区分し、その各画素が前記画像データの各画素と1対1に対応させたものとし、前記第3のステップでは、前記相似ブロックの候補である複数の候補ブロックそれぞれについて、前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは両方共に非対象物体確定領域に区分される領域に存在する場合に、当該対応点についての誤差を無視または軽視して求め、前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴としても良い。
【0032】
本発明の物体画像抽出プログラムは、コンピュータに、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、これらのうち、前記シェイプデータ上における探索基準ブロックに対応する領域のパターンが所定のパターンであるものは設定を解除する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる。
【0033】
また、前記第2のステップでは、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、各探索基準ブロックと中心位置を同じくする検査ブロックについて、前記シェイプデータ上における検査ブロックに対応する領域のパターンを調べ、検査ブロックのパターンが、所定のパターンであるものについては探索基準ブロックの設定を解除することを特徴としても良い。
【0034】
本発明の物体画像抽出プログラムは、コンピュータに、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索するとともに、前記シェイプデータ上の対応する領域のパターンが所定のパターンである相似ブロックとこれに対応する探索基準ブロックの設定を解除する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる。
【0035】
本発明の物体画像抽出プログラムは、コンピュータに、抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、前記画像データと前記シェイプデータの両方の上下左右の少なくとも一辺を所定の幅だけ拡張する第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる。
【0036】
【発明の実施の形態】
以下、図面を参照して本発明の複数の実施形態についてそれぞれ説明する。
【0037】
(各実施形態に共通な事項)図40は本発明の各実施形態で用いるPC(パーソナルコンピュータ)やWS(ワークステーション)等の図である。各実施形態で用いるPCやWSは、マウス等のポインティングデバイスやキーボードやその他の外部機器(例えばデジタルカメラ)等の入力装置4007と、入力装置4007からの入力を受け付ける入力受付部4004、CRTやLCD等の画像表示装置4008とこれに画像信号を出力する画像出力部4006を備える。
【0038】
また、各実施形態で用いるPCやWSは、ハードディスク等の磁気ディスクドライブ4002、メモリ4005、中央演算装置4001、光ディスクドライブ4003を備える。
【0039】
本発明の各実施形態はいずれも、PC(パーソナルコンピュータ)あるいはWS(ワークステーション)上で動作させる物体画像抽出プログラムである。利用者は予め磁気ディスクドライブ4002に格納しておいたプログラムをメモリ4005に読み出してPCやWSに実行させる。
【0040】
利用者は物体画像抽出プログラムを実行する前に、予め物体形状の抽出処理対象の画像データを取得して磁気ディスクドライブ4002に格納しておく。物体画像抽出プログラムは、実行時に、この画像データを磁気ディスクドライブ4002から読み出してメモリ4005に記憶させる。
【0041】
そして、表示装置4008に画像データを表示し、物体の概略形状を指定した概略形状のアルファマスクのデータを利用者にマウスを用いて入力してもらう。入力されたアルファマスクのデータもメモリ4005に記憶させておく。
【0042】
さらに、物体画像抽出プログラムは、画像データと概略形状のアルファマスクのデータをもとにして物体形状の抽出を行う。物体形状の抽出によって正確な形状のアルファマスクが生成され、これを抽出結果として出力する。
【0043】
輪郭抽出結果のアルファマスクは、PCやWSが備える磁気ディスクドライブ4002やメモリ4005に記憶させておく。そして、例えば画像中から物体の画像を切り出す他のプログラムや装置で用いる。
【0044】
尚、PCやWSにカメラを接続して利用者が任意のタイミングで画像を取得できるようにしておいても良い。また、概略形状のアルファマスクのデータを背景差分法等を用いて自動的に生成するようにしても構わない。
【0045】
尚、以下の説明では探索基準ブロックをチャイルドブロックと呼び、探索基準ブロックより大きく(例えば縦横2倍)て、かつ、図柄が相似なブロックである相似ブロックをペアレントブロックと呼ぶ。
【0046】
(第1の実施形態)本実施形態は、輪郭抽出対象物体の近くに他の物体輪郭などのエッジがある場合に、物体形状の抽出が正確に行えないことがあるのを改善するものである。
【0047】
以下、図1のフローチャートを用いて本実施形態の処理を説明する。
【0048】
(ステップ010)画像データと、概略形状のアルファマスクと、ラベルデータをメモリ上に準備する。
【0049】
画像データは、例えば利用者が予めデジタルカメラ等で撮影してハードディスクに記憶させておいた画像データを読み出す。
【0050】
アルファマスクは、例えば利用者が画像表示装置に表示された画像データを見ながらマウスで指定して作成する物体の形状を表すデータである。アルファマスクは画像データと同じ画素数のデータで、物体が存在する場所は画素値1、存在しない場所は画素値0となっている。
【0051】
ラベルデータはアルファマスクとは別の物体領域や背景領域に関する情報を表すデータであり、利用者が画像データを見ながらマウスを利用して指定して作成するものである。画素毎に、例えば、予め必ず背景や対象物以外の物体だと分かっている領域は非対象物体確定領域(背景確定領域)として各画素の画素値を0とし、予め物体だと分かっている領域は対象物体確定領域(物体確定領域)として各画素の画素値を1とし、背景か物体か未定の領域は未定領域として各画素の画素値を2とする。尚、ラベルデータの生成は、例えばアルファマスクを参照して、自動的に行っても良い。
【0052】
(ステップ011)アルファマスクの輪郭部分にチャイルドブロックCを設定する。本実施形態ではチャイルドブロックCは図7のように互いに重なり合うように設定するが、重ねずに接するように設定しても良い。設定したチャイルドブロックCの位置情報(例えば、左上角の座標と右下角の座標)をメモリに記憶しておく。
【0053】
(ステップ012)各々のチャイルドブロックと相似なブロックであるペアレントブロックPをラベルデータと画像データを参照しながら見つける。
【0054】
まず、チャイルドブロックの近傍にペアレントブロック候補となる候補ブロックを設定する。そして、画像データ上で、チャイルドブロックの領域のパターンと候補ブロックとの領域のパターンとのラベルデータを参照して誤差を求める。
複数の候補ブロックについて誤差を計算し、誤差が最小となるものをペアレントブロックとする。候補ブロックはペアレントブロックと同じ画素数のブロックであるので、チャイルドブロックと候補ブロックとの誤差を求める際には、候補ブロックを縮小してチャイルドブロックと同じ画素数にして行う。
【0055】
ラベルデータを参照した誤差計算は次のようにして行う。例えば、利用者が図15の領域151の内側の物体を抽出しない領域として指定した場合、ラベルデータは、この内部が0の画素値(背景確定領域)、それ以外が2の画素値(未定領域)とする。そして、チャイルドブロックのある画素をX、それに対応する縮小ブロックの画素をXと表すとして、XとXの誤差を以下のように定義する。(1)XとXの両方が背景確定領域内の時は「XとXの誤差」を無視して「0」とする。
(2)XとXの両方が物体確定領域内の時も「XとXの誤差」を無視して「0」とする。
(3)前記(1)でも(2)でもないときは、「XとXの誤差」=「XとXの画素値の差の絶対値」とする。
【0056】
このようにして求めたXとXの誤差をブロック内で加算し、その候補ブロックとチャイルドブロックの誤差とする。そして、最も小さい誤差が得られた候補ブロックをペアレントブロックとして決定する。そして、決定したペアレントブロックの位置情報をチャイルドブロックと対応付けてメモリに記憶しておく。
【0057】
(ステップ013)全てのチャイルドブロックに対するペアレントブロックが決定するまで、前記ステップ012を繰り返す。
(ステップ014)アルファマスク上において、各々のチャイルドブロックに対応する領域のデータを、それに対応するペアレントブロックのデータをチャイルドブロックと同じ画素数に縮小したもので置き換える。
(ステップ015)全てのチャイルドブロックに対して、前記ステップ014を行う。これにより、アルファマスクの全てのチャイルドブロックが一度置き換えられたことになる。
(ステップ016)ステップ014とステップ015を再帰的に所定の回数繰り返す。これにより、アルファマスクの輪郭が物体の輪郭に漸近する。
【0058】
尚、ステップ12で誤差計算にあたっては、(1)と(2)のケースでは誤差を無視して0としたが、誤差を軽視、すなわち、0より大きくて1より小さい所定の係数を乗じても良い。あるいは、(1)と(2)のケースでは、誤差を無視して計算そのもの省略しても良い。
【0059】
以下、従来のフラクタル法による物体形状の抽出例と本実施形態の物体形状の抽出例を比較を行う。
【0060】
他の物体が近くにある場合に、従来のフラクタル法を用いて物体形状の抽出を行った例を説明する。図9に示したチャイルドブロック091には、右下の船031の領域に加えて左上の船032の領域も含まれている。この場合、チャイルドブロック091と完全に相似な、つまり絶対値誤差が0となる候補ブロックは見つからない可能性が高いが、誤差が最小となる候補ブロックがペアレントブロックとして選ばれることになる。
【0061】
船031を抽出するためには、ペアレントブロックには船031の領域に関して相似になるようなブロック093が選ばれるのが都合がよい。このようになれば、アルファマスクの輪郭は置き換え変換によって船031の輪郭に収束するからである。しかし、必ずしもブロック093が選ばれるとは限らない。
【0062】
図11(a)はチャイルドブロック091の周囲を拡大した図であり、ペアレントブロック候補のブロック093、船032の輪郭114、船031の輪郭115が示されている。尚、図11(a)では、ペアレントブロック候補のブロック093は、船031の輪郭115に関して相似になるように設定されている。
【0063】
図11(b)には、チャイルドブロック091の画像パターン111、ブロック093を縮小した画像パターン112、および画像パターン111と画像パターン112の差分パターン113が示されている。
【0064】
ここで、横線で塗った船032の領域及び船031の領域の画素値は同じ値とし、それら以外の領域は別の画素値で一定とする。差分パターン113では、画像パターン111と画像パターン112で画素値の誤差が生じる部分を黒く塗ってある。絶対値誤差はこの黒い領域の面積に比例する。
【0065】
一方、図12(a)及び図12(b)は、ペアレントブロック候補であるブロック121が輪郭114に関して相似になるように設定した場合である。この場合の差分パターン122の黒領域の面積は図11(b)の差分パターン113よりも小さくなってしまう。この結果、図10のようにブロック121がペアレントブロックとして選ばれ、船031のアルファマスクの輪郭はこの部分については置き換え変換によって船032に近づいてしまうため、正しい輪郭が求まらない。
【0066】
これに対し、ステップ012のようにラベルデータを用いて処理することにより、物体抽出に都合のよいペアレントブロックが選択される。このことを図3の原画像から図4のようなアルファマスクを生成する場合を例に説明する。
【0067】
図5は物体の概略形状が与えられた状態であり、この概略形状のアルファマスクが図6である。そして、チャイルドブロックが配置された結果が図7である。
【0068】
図13(a)はチャイルドブロック091の周辺を拡大した図である。輪郭114は船032の輪郭であり、輪郭115は船031の輪郭である。また、ペアレントブロック093は船031輪郭115に関して相似になるように配置されている。背景確定領域の境界線である背景確定領域ライン131の左上側が前述の図15で示した背景確定領域151である。
【0069】
図13(b)はチャイルドブロック091の画像パターン132と、ペアレントブロック093の画像パターン133(チャイルドブロックと同じ大きさに縮小したもの)と、画像パターン132と画像パターン133の差分パターン134とを示した図である。
【0070】
尚、図13(b)では、画像パターン132及び画像パターン133には背景確定領域ライン131も示し、差分パターン134には、画像パターン132における背景確定領域と画像パターン133における背景確定領域の共通領域の境界ライン135も示した。
【0071】
図11(a)及び図11(b)で説明したように、従来、このようなペアレントブロックの配置では、左上側に多くの誤差が発生していた。しかし、本実施形態では、画像パターン132と画像パターン133においてどちらも背景確定領域である画素の誤差はゼロとしているため、差分パターン134の境界ライン135よりも左上側の領域には誤差が現れない。そのため、従来に比べて差分パターン134のようにブロック全体での誤差が小さくなる。
【0072】
図14(a)及び図14(b)は、ペアレントブロックを図12(a)及び図12(b)と同様に、船032の輪郭114に関して相似になるように配置した場合の図である。この場合も図13のケースと同様にライン135の左上側の誤差がキャンセルされるが、元々ライン135の左上側には誤差がないので、全体としては図12のケースと同様に右下側の誤差が生じる。
【0073】
図13と図14とを比較すると、本実施形態では図13のケースの方が図14のケースよりも誤差が小さくなり、図13のケース、すなわち、輪郭115に関して自己相似になるようにペアレントブロックが選ばれるので、船031の輪郭が正しく抽出される。
【0074】
本実施形態では、ラベルデータは利用者がマウスを利用して予め指定しておくとしたが、以下に説明するラベルデータを自動的に求める方法を利用してラベルデータを求めても良い。
【0075】
また本実施形態では、ステップ014とステップ015を所定の回数繰り返すとしたが、繰り返しの条件は「回数」に限られない。例えば、ステップ015で置き換えを行う際にチャイルドブロックのアルファマスクとペアレントブロックのアルファマスクを縮小したものとの絶対値差分の和を計算し、絶対値差分の和が所定の閾値以下になるまで繰り返すようにしても良い。
【0076】
(第1のラベルデータ生成方法)例えば、予め、物体の色や背景の色が分かっている場合には、その色の領域をそれぞれ物体確定領域、背景確定領域とする方法もある。
【0077】
この方法について、上述のように概略形状051が与えられた場合を例に説明する。
【0078】
(1)図37に示すように概略形状051を一定の幅Wで膨張させて形状371を求める。同様にして2Wの幅で膨張させて形状372を求める。
【0079】
ここで、膨張とはモルフォロジーフィルタによる処理の一種であり、処理対象領域(ここでは物体領域)以外の画素を走査しながら、注目画素から一定の距離以内に処理対象領域がある場合にはその画素を処理対象領域に加える処理である。
【0080】
(2)概略形状051をWと2Wの幅で収縮させてそれぞれ形状373と形状374を求める。
【0081】
ここで、収縮もモルフォロジーフィルタによる処理の一種であり、処理対象領域の画素を走査しながら、注目画素から一定の距離以内に処理対象領域以外がある場合にはその画素を処理対象領域から除く処理である。
【0082】
(3)形状371と形状372に挟まれた領域381(図38の斜線で示した領域)を背景色サンプリング領域とする。また、形状373と形状374にはさまれた領域382(図38の横線で示した領域)を前景色サンプリング領域とする。ここで、概略形状051から一定距離離れた部分から色をサンプリングするのは、概略形状が正しい形状とずれていることを考慮しているためである。
【0083】
(4)元画像において背景色サンプリング領域にある画素の色をすべて取り出すことで背景色テーブルを作成する。また、同様にして前景色テーブルを作成する。
【0084】
尚、全ての色を取り出すのではなく、一定数以上の画素が同じ色であった場合にその色を登録しても良い。
【0085】
(5)背景色テーブルと前景色テーブルとを比較して、同じ色が登録されていたら、その色を両テーブルから除く。
【0086】
(6)このようにして得られた2つの色テーブルを用いて元画像の各画素を走査する。そして、背景色テーブルにある色の画素を背景確定領域とし、前景色テーブルにある色の画素は物体確定領域とし、いずれのテーブルにない色の画素は未定領域としてラベルデータを作成する。
【0087】
上記(1)〜(6)のようにすることで色の観点で背景や物体と推定できる領域をそれぞれの確定領域とすることができる。
【0088】
尚、似た色を個別に登録するのではなく、予め元画像の色レベルを量子化してから色テーブルの作成、ラベルデータの作成を行うと扱う色数が減るので処理量を減らすことができ、処理の高速化に資する。
【0089】
(第2のラベルデータ生成方法)画面内で局所的に色テーブルを作成し、それぞれ切換えながらラベルデータを作成すれば、局所的に最適化された情報が得られる。
【0090】
局所的に色テーブルを作成する例としては、次のような方法が考えられる。例えば、図39に示したように、概略形状051に沿ってブロック391、392などを配置し、各ブロックの内部だけで前述した色テーブルを作成する。そして、ラベルデータを作成する際には各画素が属するブロックの色テーブルを用いて、背景確定、物体確定、未定のいずれかに決定する。その際、ブロック391と392とが重なっている部分では、まず、どちらかのブロックの色テーブルでラベルを決め、そのラベルが未定であったときには、他方の色テーブルでラベルを付け直す。
【0091】
(第3のラベルデータ生成方法)背景色テーブルや物体色テーブルの生成にあたっては、モルフォロジーフィルタを用いる代わりに、利用者が背景あるいは物体として画面を指示した画素の色を登録して生成する方法もある。
【0092】
(第3のラベルデータ生成方法)予め輪郭抽出対象の物体が写っていない背景画像が取得できている場合には、背景画像と現在の画像の差を求め、差が一定値以上の画素を物体確定とする方法もある。
【0093】
(第4のラベルデータ生成方法)概略形状の輪郭から一定の範囲内に正しい輪郭があると仮定できる場合には、概略形状の背景領域を収縮した結果を背景確定領域としたり、概略形状の物体領域を収縮した結果を物体確定領域とすることもできる。この方法ならば、処理対象領域の周囲が縮められる。
【0094】
(第5のラベルデータ生成方法)概略形状の物体領域が必ず物体の全体を含むことが分かっている場合には、概略形状の背景領域をそのまま、あるいは、1〜2画素収縮したものを背景確定領域とする。一方、概略形状の物体領域を数画素、例えば、チャイルドブロックの1辺の画素数の1/2程度収縮した領域を物体確定領域とする。
【0095】
さらに、このようにして決めた物体確定領域や背景確定領域を領域成長法を用いて、広げても良い。逆に、概略形状の物体領域の全体が必ず物体に含まれる場合も同様である。
【0096】
ここで、領域成長法とは、成長対象の領域の境界部分において領域内部と外部の画素値を比較し、画素値の差が一定値以下である場合には、外部の画素を領域内にとりこんでいくというものである。この処理を繰り返すことにより、画素値が近い部分が領域に取り込まれる。
【0097】
(第6のラベルデータ生成方法)利用者によって物体上の1点が入力されたときに、その点を起点として領域成長法により物体領域を求め、それを物体確定領域としてもよい。背景についても同様に領域成長法を用いて背景確定領域を設定できる。
【0098】
(ラベルデータの段階数)ここまでのラベルデータ生成方法では、背景確定、物体確定、未定の3段階のデータを生成する例を述べたが、段階数を増やしてもよい。例えば、背景である確率が高いほどラベルデータの画素値を0に近づけ、物体である確率が高いほど画素値を255に近づけ、未定領域は画素値128に対応させるような段階付けが考えられる。
【0099】
何らかの方法で(例えば上述第1のラベルデータ生成方法における背景色サンプリングと物体色サンプリングの方法などにより)背景と物体の色を調べておく。そして、各画素が背景と物体の色のどちらに近いかに応じてラベルデータの画素値を決めてラベルデータを生成する。
【0100】
このようにして生成したラベルデータを用いたペアレントブロック探索は、チャイルドブロックのある画素の画素値をX、ペアレントブロック候補の縮小ブロックの画素の画素値をX、「XとXの画素値の差の絶対値」をE、誤差計算用の重み係数をWとして、
「XとXの誤差」=W×E
を各画素毎に計算して和を求め、「XとXの誤差」が最小となるものをペアレントブロックとして採用する。
【0101】
ここで重み係数Wは、
(A)XとXの両方のラベルデータの画素値が0にも255にも近くない場合には常に1に保つ。
(B)XかXのいずれか一方のラベルデータの画素値が0に近い場合には、他方のラベルが小さいほど重み係数Wを1より小さくする。
(C)XかXのいずれか一方のラベルデータの画素値が255に近い場合には、他方のラベルが大きいほど重み係数Wを1より小さくする。
【0102】
このようにWを制御することで、物体である確率が高い画素同士や背景である確率が高い画素同士の誤差の影響を多段階で軽減できる。
【0103】
以上、本実施形態では、物体の輪郭抽出にあたってラベルデータというマスキング情報を用いることにより、複数の物体が近接している場合でも正確に輪郭を抽出できる。
【0104】
(第2の実施形態)以下、本発明の第2の実施形態について図3と図26を用いて説明する。本実施形態は、複数の物体を個別に順次抽出するときに有効な実施形態である。尚、ここでは第1の実施形態と異なる部分を中心に説明する。
【0105】
図3に示した画像には船032と船031とが存在し、本実施形態ではこれらの輪郭を順次抽出する。ここではまず、船032は第1の実施形態で説明した方法で抽出し、それから船031を抽出する。
【0106】
図26は、第1の実施形態で説明した方法で抽出した船032の物体領域261を黒く塗りつぶした図である。この状況に対して、第1の実施形態と同様にして、図5のように概略形状を設定し、チャイルドブロックを図7のように配置する。
【0107】
そして、チャイルドブロックのある画素の画素値をX、それに対応する縮小ブロックの画素の画素値をXとして、XとXの誤差の計算式を、
(1)XあるいはXのいずれか一方が領域261内のときは、「XとXとの誤差」=「0」
(2)前記(1)に該当しない時は、「XとXとの誤差」=「XとXとの画素値の差の絶対値」
のように定義する。
【0108】
このように定義することで、図11における画像パターン112の左上の横線領域内では誤差がカウントされなくなり、ブロック093の誤差がゼロとなりこれがペアレントブロックとして選択される。すなわち、図9のチャイルドブロック091に対して船031の輪郭に関して相似なペアレントブロック093が求まるような誤差の計算式になる。
【0109】
以上、本実施形態によれば複数の物体の輪郭を順次抽出する際に、既に検出済みの物体の輪郭の情報を利用して検出済み物体をマスキングするので、複数の物体が近接している場合でも正確に物体の輪郭を抽出可能である。
【0110】
(第3の実施形態)本発明の第3の実施形態について図面を参照して説明する。本実施形態は、従来、物体領域が細い場合に輪郭の検出が困難な場合があったが、これを解決するためのものである。尚、ここでは第1の実施形態と異なる部分を中心に説明する。
【0111】
従来のフラクタル法では、図16のチャイルドブロック161周辺のような物体形状が細い場合の物体抽出を行うことが困難である。
【0112】
細い部分に配置されたチャイルドブロック161に対しては、完全に相似なペアレントブロックは存在しない。チャイルドブロック161に対しては、例えば、ブロック162がペアレントブロックとして選ばれる。
【0113】
このチャイルドブロック161とペアレントブロック162を用いて、概略形状051のアルファマスクに対してペアレントブロック162からチャイルドブロック161への置き換え変換を行うと、その度にこの部分の物体領域の幅が1/2になり、置き換え変換を繰り返し行うといずれ物体領域は消滅してしまう。
【0114】
本実施形態は上述の問題に対応することができるものである。以下、図2のフローチャートを用いて本実施形態における処理の流れを説明する。
【0115】
(ステップ020)第1の実施形態のステップ010と同じ処理を行う。
【0116】
(ステップ021)概略形状のアルファマスクの輪郭部分に沿って、図7のようにチャイルドブロックを配置する。
(ステップ022)ステップ021で配置されたチャイルドブロックのうち、物体の細い部分に配置されていると判定されたものを除去する。細い部分であるか否かの判定方法については後述する。
【0117】
(ステップ023)ステップ022でキャンセルされなかったチャイルドブロックと相似なペアレントブロックを画像データを参照しながら見つける。本実施形態では、第1の実施例のようにラベルデータも参照しながら相似ブロックを求める。
(ステップ024)全てのチャイルドブロックに対するペアレントブロックを決定するまで、前記ステップ023を繰り返す。
【0118】
(ステップ025)アルファマスク上で、各々のチャイルドブロックに対応する領域のデータを、それに対応するペアレントブロックの領域のデータをチャイルドブロックと同じ画素数に縮小したもので置き換える。
(ステップ026)全てのチャイルドブロックに対して、ステップ025を行う。これにより、アルファマスクの全てのチャイルドブロック内部が一度置き換えられたことになる。
(ステップ027)ステップ025と026を再帰的に所定の回数繰り返す。これにより、アルファマスクの輪郭が物体の輪郭に漸近する。
【0119】
尚、本実施形態ではラベルデータを用いるとしたが必須ではない。従来と同じくラベルデータを用いなくても良い。
【0120】
このように処理することにより、細い物体部分ではチャイルドブロックが配置されないため、その部分が消滅するという不具合を多くの場合に回避できる。
【0121】
上記ステップ022における、物体の細い部分であるか否かの判定は、判定対象のチャイルドブロックのアルファマスクでの画素値を用いて行う。以下、具体的な処理方法を図18、図19、図20、図21、図22を用いて説明する。
【0122】
図18は16×16画素のチャイルドブロックのアルファマスクを拡大したものである。白い画素は物体を表し、黒い画素は背景を表す。
【0123】
このチャイルドブロックのアルファマスクに対して、左上端の画素から右上端の画素まで順に1画素ずつ走査して、画素値の変化の回数を数える。さらに、右上端の画素から右下端の画素、右下端の画素から左下端の画素、左下端の画素から左上端の画素と4辺を走査し、変化の回数を全て数え上げる。
【0124】
このようにして求める変化回数は必ず偶数になる。そして、変化回数が4回以上である場合には、そこは物体の細い部分であると判定する。
【0125】
図18の場合、左上端の画素から右上端の画素までの走査と、右下端の画素から左下端の画素までの走査でそれぞれ黒から白、白から黒の2回ずつ変化し、変化回数は合計で4回となるので、細い部分であると判定される。
【0126】
チャイルドブロックは概略形状の輪郭に沿って配置されているため、このようにブロックの周囲を走査すると、細い部分でなければ通常は図21に示したような変化回数が2回のケースとなる。変化回数が2回の場合にはフラクタル法により抽出可能である。
【0127】
変化回数が2回よりも多い場合は、複雑な形状をしていたり細い部分であると推定される。複雑な形状の場合、フラクタル法では対応できないことが多い。
【0128】
図19に変化回数が6回、図20に変化回数が4回の例を示す。このようなケースでは、自己相似性がないため無理にフラクタル法を適用せずに、チャイルドブロックをキャンセルして概略形状をそのまま残すことにより、物体領域の消滅を回避した方が良いと考えられる。
【0129】
図22に示したケースでは変化回数が0回となり、この場合は置き換え変換によりこの白い物体領域は消滅する。この小さい物体がノイズなどであり、消滅して構わない場合にはチャイルドブロックはこのまま残して構わないが、これが小さな物体であることが分かっている場合には、利用者がマウスで指定する等の手法で情報を与えてこのチャイルドブロックをキャンセルする。
【0130】
上述の例では、ステップ022でチャイルドブロックの4辺を走査した。この方法は簡便でよいのだが、細い物体部分の消滅を完全には回避できない。
【0131】
例えば、チャイルドブロックのパターンは、図21(a)であっても、そのペアレントブロックが図20(a)であるような場合には、1回の置き換え変換でそのチャイルドブロックが上書きされ、置き換え変換の繰り返しによって物体領域は消滅してしまう。
【0132】
このような状況を避けるには、とりあえずペアレントブロックを求め、そのペアレントブロックの4辺を走査してアルファマスクの画素値の変化回数を数える。そして、変化回数が2より大きい場合にはそのペアレントブロックとチャイルドブロックをキャンセルする。
【0133】
この場合のフローチャートを図23に示す。チャイルドブロックとペアレントブロックを除去するステップ234以外は図2と同じなので他のステップの説明は省略する。
【0134】
図17は、チャイルドブロック161とペアレントブロック162の位置関係の一例を表す図である。これまでに、チャイルドブロック161の4辺を走査する例とペアレントブロック162を走査する例を述べた。
【0135】
この他に、チャイルドブロックと中心を共有しペアレントブロック162と同じ大きさのブロック163の4辺を走査して、同様に変化回数によって細い部分であるか否かの判定を行ってもよい。ブロック163であれば、ペアレントブロックの探索前に判定できるので処理量を削減できる。また、チャイルドブロック161を用いるよりもペアレントブロック162を用いた判定に近い結果が得られる。
【0136】
以上、本実施形態ではペアレントブロックの4辺の画素を走査して、ペアレントブロック内に含まれている物体の形状を推定した上で置き換え処理を行うか否かを決定しているので、物体の細い部分や複雑な形状の部分等の輪郭を残すことができる。
【0137】
(第4の実施形態)置き換え変換の繰り返しによって消滅する物体領域は、ペアレントブロックの幅よりも細い形状の物体領域である。従って、物体領域の消滅を回避するには、概略形状の許容誤差は小さくなるが、ペアレントブロックとチャイルドブロックを小さくすれば良いと考えられる。
【0138】
しかし、もともと、チャイルドブロックが例えば4×4画素というような小さなブロックの場合、これ以上小さくすると、解像度が粗くなり、自己相似性を利用するのに十分な画像パターンが得られなくなってしまう。
【0139】
そこで本実施形態では、ペアレントブロックのサイズを変えずに原画像と概略形状を拡大し、物体領域をペアレントブロックの幅よりも太くすることで消滅を回避する。そして、必要であれば、抽出結果のアルファマスクを元のサイズに縮小する。
【0140】
本実施形態のフローチャートを図27に示す。これまでの実施形態と異なるのは、処理の一番最初に原画像と概略形状を拡大するステップ271を行う点である。ステップ271における原画像の拡大は、例えば0次内挿、線形(1次)内挿、あるいは、もっと高次の画素内挿法を用いて行う。アルファマスクである概略形状の拡大には、例えば0次内挿を用いる。以降のステップは、これまでの実施形態と同様なので説明を省略する。
【0141】
以上、本実施形態では元画像を拡大して輪郭抽出を行うので、従来の輪郭抽出処理法では形状が消滅してしまう可能性が高い、物体の細い部分の輪郭であっても正確に抽出できるようになる。
【0142】
(第5の実施形態)本実施形態は画像の端にある物体の輪郭を抽出するのに好適な輪郭抽出処理に関する実施形態である。
【0143】
フラクタル法においては、原画像の外側に一定の幅をパディングした方が高い抽出精度が得られる場合がある。例えば、図24に示すように原画像241の中に斜線で示した部分に物体242があり、物体242の輪郭と多少ずれた概略形状243が与えられたとする。
【0144】
図24のように配置されたチャイルドブロック244の場合、概略形状243を物体242の輪郭に近づけるためには、ペアレントブロックは、その内部の画像パターンがチャイルドブロックと相似になるように、図示した位置のブロック245に配置するのが望ましい。
【0145】
ペアレントブロックの探索はチャイルドブロックを中心とした一定の範囲で行われるので、その範囲にブロック245があればよい。しかし、図24の場合はブロック245の右側が画像からはみ出してしまうため、ブロック245はたとえ探索範囲内であっても誤差評価が行われず、ペアレントブロックの候補から除かれる。そのため、チャイルドブロック244の部分ではペアレントブロックとして、図示したものとは別のブロックが選ばれ、輪郭が正確に求まらなくなってしまう。
【0146】
そこで、本実施形態では図25に横線で示した領域253のように、探索範囲となる可能性がある分だけ予め画像を外側に拡張しておく。これをパディングと呼ぶ。
【0147】
本実施形態では、パディングの画素値は画像の最も外側の画素値で外挿し、パディングを行う位置と幅は以下のように決める。
【0148】
概略形状の輪郭上にチャイルドブロックを配置することが予め分かっている場合、物体抽出に先立って、まず、概略形状243に外接する矩形251を求める。矩形251が求まれば、この内部を中心にチャイルドブロックが配置された場合に、ペアレントブロックの探索範囲となりうる部分の外枠252が決まる。
【0149】
外枠252の内部は、ペアレントブロックの探索時に候補ブロックとして誤差を計算する可能性がある。そこで、外枠252が画像241からはみでた幅だけパディングを行う。その際、画像241の左上側や右下側のように外枠252がはみだしていない部分のパディングは必要ないが、画像データを記憶させるためのメモリの容量に特に制限がない場合には、上下左右の全ての側に十分な幅のパディングを行ってもよい。このように画像の外側をパディングすることで、画像の端の近くの輪郭線を正確に抽出できない問題を回避できる。
【0150】
図28は本実施形態の物体抽出処理のフローチャートである。いわゆるフラクタル法による物体抽出の最初にステップ281を実行してパディングを行う。他のステップは、これまでの実施形態と同様である。
【0151】
以上、本実施形態では原画像の外側に所定の幅でパディングを設けることにより、画像の端に存在する輪郭の抽出を正確に行えるようになる。
【0152】
(第6の実施形態)本実施形態は概略形状と正しい形状のズレが大きい場合の輪郭抽出処理に関する実施形態である。
【0153】
図30は、従来のフラクタル法では正しく物体輪郭を抽出できないケースの一例である。図30は、物体の輪郭301とその概略形状302と、概略形状302の輪郭上に中心がくるように配置したチャイルドブロックの一つであるチャイルドブロック303を示した図である。
【0154】
チャイルドブロック303には物体輪郭301が含まれていないので、ペアレントブロックの探索ではチャイルドブロック303と相似なブロックとして、例えば、図31に示したブロック311が選ばれてしまう。このように、概略形状と正しい形状のズレが大きい場合には、物体の自己相似構造を抽出できず、その結果、物体の輪郭が正しく抽出されないことがある。
【0155】
そこで、本実施形態ではペアレントブロックを先に配置する。これを図32と図33に示す。まず、図32のブロック321のように概略形状302の輪郭上に中心がくるようにペアレントブロックを配置する。そして、このペアレントブロックと相似な縦横1/2のブロックを探索する。
【0156】
この場合、ブロック321の左下に物体輪郭301が含まれるので、このブロック321と相似な縦横1/2のブロックを探索すると図33ようにブロック331がチャイルドブロックとして選ばれる。
【0157】
図29は本実施形態の輪郭抽出処理のフローチャートである。ステップ291〜ステップ293までがペアレントブロックを先に配置して相似なチャイルドブロックを探索する処理である。これ以降の置き換え処理は、先の実施形態のものと同様である。
【0158】
(ステップ291)アルファマスクの輪郭部分にペアレントブロックPを配置する。チャイルドブロックを配置する例を示した図7と同様、ペアレントブロックPの各々の中心を概略形状の輪郭が通り、隣り合うペアレントブロックは重なり合うよう配置する。
(ステップ292)ペアレントブロックPと相似なチャイルドブロックCを見つける。
(ステップ293)全てのペアレントブロックに対して前記ステップ292を行い、それぞれチャイルドブロックを決定する。
以下は、これまでと同様な置き換え処理なので説明を省略する。
【0159】
以上本実施形態では、ペアレントブロックを先に概略形状の輪郭に配置し、後でチャイルドブロックを探索することので、チャイルドブロックを先に配置した場合よりも概略形状と正しい形状との間の許容誤差が大きくなるので、従来よりも物体の自己相似構造を抽出しやすくなる。その結果、物体が正しく抽出しやすくなる。
【0160】
(第7の実施形態)本実施形態は物体領域と背景領域の中間状態も表すアルファマスクを得るのに好適な輪郭抽出処理に関する実施形態である。以下、本実施形態について説明する。
【0161】
図36は本実施形態による輪郭抽出処理のフローチャートである。
(ステップ361)図34に示すように、画像データ342及び概略形状のアルファマスク341を所定の倍率で拡大して、拡大画像データ344及び拡大アルファマスク343を生成する。本実施形態では拡大率は縦横2倍とする。
(ステップ362)拡大画像データ344および拡大アルファマスク343に対し前述したフラクタル法の処理を行って、正確なアルファマスクを抽出する。ここで、アルファマスクの各画素の画素値は背景を0、物体を255とする。
(ステップ363)フラクタル法により得られたアルファマスクを元のサイズに縮小して、画像データ342に対するアルファマスクを得る。
【0162】
図35はステップ363の拡大アルファマスクの元サイズへの縮小処理を説明する図である。本実施形態では元サイズの画像を縦横2倍に拡大してフラクタル法の処理を行っているので、拡大アルファマスクの4つの画素353が縮小して得られるアルファマスクの画素352に対応する。本実施形態では、縮小して得られるアルファマスクの画素352の画素値には画素353の画素値の平均値を用いることとする。従って、縮小して得られるアルファマスクの各画素の画素値は4個の画素の平均値となる。
【0163】
本実施形態では、拡大アルファマスクの各画素は、背景の場合は画素値0を与え、物体の場合は画素値255を与えておく。従って、縮小して得られるアルファマスクの各画素に対応する4個の拡大アルファマスクの画素のうち、物体画素が0個、1個、2個、3個、4個の場合、平均値はそれぞれ、0、64、128、192、255となる。
【0164】
図35では、画素352には物体画素が2個含まれるので画素352の画素値は128となる。また、画素354のように対応画素の値がすべて同じであれば、それらに対応する画素351はその値と同じになる。
【0165】
このようにして得られたアルファマスクの各画素の画素値を抽出物体を別の画像に合成するときの画素混合比率として用いることにより、輪郭線が与えるギザギザ感が改善された、より自然な合成画像を得ることができる。
【0166】
合成画像の画素値の計算式は、抽出物体が写っている画像の画素の画素値をX、その画素に対応するアルファマスクの値をA、合成相手となる別の画像による同じ位置の画素の画素値をYとすると、
「合成画像の画素値」=(A×X+(255−A)×Y)/255
のようなる。このように、アルファマスクの各画素の画素値は0を完全な透明、255を完全な不透明とした透明度を表したものと見なせる。
【0167】
なお、前述した拡大処理においては、画像データに対しては、例えば1次内挿、アルファマスクに対しては例えば0次内挿によって画素内挿を行う。また、例えばサムネイル画像と呼ばれる縮小画像のためのアルファマスクを生成するような場合には、元画像を拡大する必要は無く、元のサイズで0と255の値を持つアルファマスクを生成した後に前述した要領で縮小すれば良い。
また、画像データと生成したアルファマスクとを用いて、例えば画像圧縮規格PNGやGIFなど、透明度に対応した画像を生成して保存しておけば汎用の物体画像となり、再利用が可能となる。
【0168】
以上、本実施形態では元画像を拡大して輪郭抽出を行って得られる拡大アルファマスクを縮小してアルファマスクを生成する際に、拡大アルファマスクの複数の画素値を参照して求めた多段階の値をアルファマスクの各画素値として用いている。よって、物体を抽出する際にアルファマスクの画素値を透明度として用いることで、滑らかな物体の輪郭線を得ることが可能である。
【0169】
【発明の効果】
以上、本発明によれば、フラクタル法において、他の物体輪郭などのエッジが近くにある場合や物体領域が細い場合でも、物体の輪郭を正確に求めることができる。
【図面の簡単な説明】
【図1】本発明第1の実施形態の輪郭抽出処理のフローチャート。
【図2】本発明第3の実施形態の輪郭抽出処理のフローチャート。
【図3】抽出対象画像の例。
【図4】図3の画像に関するアルファマスクの例。
【図5】概略形状を設定した様子。
【図6】概略形状のアルファマスク。
【図7】チャイルドブロックを配置した様子。
【図8】あるチャイルドブロックとそのペアレントブロックの例。
【図9】別のチャイルドブロックとそのペアレントブロックの例。
【図10】図9において別のペアレントブロックが選ばれた例。
【図11】図9において誤差が計算される様子。
【図12】図10において誤差が計算される様子。
【図13】本発明によって誤差が計算される例。
【図14】本発明によって誤差が計算される別の例。
【図15】ラベルデータを入力した例。
【図16】細い部分にチャイルドブロックが配置された例。
【図17】細い部分に配置されたチャイルドブロックとその周囲のペアレントブロックなどの例。
【図18】チャイルドブロックにおけるアルファマスク。
【図19】アルファマスクのパターンの例:変化回数が6。
【図20】アルファマスクのパターンの例:変化回数が4。
【図21】アルファマスクのパターンの例:変化回数が2。
【図22】アルファマスクのパターンの例:変化回数が0。
【図23】本発明第3の実施形態の輪郭抽出処理の変形例のフローチャート。
【図24】画像の端に物体がある例。
【図25】画像の端にパディングを設けて拡張した例。
【図26】一つ目の物体の領域を抽出して、マスクが設定された例。
【図27】本発明第4の実施形態の輪郭抽出処理のフローチャート。
【図28】本発明第5の実施形態の輪郭抽出処理のフローチャート。
【図29】本発明第6の実施形態の輪郭抽出処理のフローチャート。
【図30】チャイルドブロックを配置した例。
【図31】ペアレントブロックを求めた例。
【図32】ペアレントブロックを配置した例。
【図33】チャイルドブロックを求めた例。
【図34】画像データとアルファマスクを拡大する処理の概念を説明する図。
【図35】アルファマスクの縮小処理の概念を説明する図。
【図36】本発明第7の実施形態の輪郭抽出処理のフローチャート。
【図37】概略形状に膨張と収縮を行った例。
【図38】色テーブルを作成する際のサンプリング領域を示した図。
【図39】局所的に色テーブルを作成する例。
【図40】本発明の各実施形態で用いるコンピュータの概略構成を説明する図。
【符号の説明】
031 輪郭抽出対象である船
032 船031の近くに写っている別の船
051 船031の概略形状
081、091、161、244、303、331 チャイルドブロック
082、093、121、162、245、311、321 ペアレントブロック
114 船032の輪郭の一部
115 船031の輪郭の一部
111、132 チャイルドブロック
112、133 縮小したペアレントブロック
113、122、134 差分
131、135 ラベルデータの境界線の一部
151 ラベルデータの境界
241 画像
242 物体
243 物体242の概略形状
253 パディング処理による拡張領域
301 物体輪郭の一部
302 概略形状の一部
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an object image extraction method and an object image extraction program for finding an object region in an image.
[0002]
[Prior art]
A technique for extracting a region of an arbitrary object from an image is useful, for example, when performing image processing such as replacing the background with another image. For that purpose, it is necessary to correctly determine the region of the object along its contour.
[0003]
The region of the object is specifically represented by an image called an alpha mask (or shape data). The alpha mask is an image in which different pixel values are set in a region where an object is present (object region) and other regions. An example of the original image and its alpha mask are shown in FIGS. 3 and 4, respectively. FIG. 4 shows the alpha mask of the ship 031 on the right shown in the original image of FIG.
[0004]
In other words, extracting an object is generating an alpha mask.
Once the alpha mask is obtained, the background area other than the object area can be easily replaced with another image by referring to the alpha mask.
[0005]
In the case of such an object extraction, when a rough shape of an object is temporarily obtained in advance by some method, a technique for obtaining an accurate shape of the object based on the rough shape is required. As one of the methods, an object extraction method (a fractal method) using a self-similar mapping has been proposed (for example, see Patent Literature 1, Patent Literature 2, Non-Patent Literature 1). The outline of this technique will be described with reference to FIGS. 5, 6, 7, and 8. FIG.
[0006]
FIG. 5 shows a state in which a schematic shape 051 is given to a ship 031. FIG. 6 shows an alpha mask thereof. At this stage, the contour of the alpha mask is shifted from the contour of the object. In the fractal method, a plurality of square blocks are first set along the approximate shape of the object using the alpha mask with respect to such input of the original image data and the alpha mask. These blocks are called child blocks. Then, a child block is set at the same position in the original image data as in the case of the alpha mask. FIG. 7 shows a state where child blocks are set in the original image data. The schematic shape is also shown in the original image data for easy understanding.
[0007]
Next, a parent block corresponding to each child block is obtained using the original image data. The size of the parent block is twice as long and wide as the child block, and the image pattern (pattern) in the parent block is the same as the image pattern in the child block.
[0008]
In order to find such a parent block similar to the design of the child block, a block that is twice as long and wide as the candidate block is temporarily set near the child block on the original image data. Then, an error between a reduced block obtained by reducing the candidate block in half vertically and horizontally and a child block is obtained.
[0009]
In the case of a grayscale image, the error is, for example, an absolute value error (the absolute value of the difference between the pixels is added for all the pixels in the block). Such an error evaluation is performed on some candidate blocks, and the candidate block having the smallest error from the child block is determined as the parent block. Such parent blocks are obtained for all child blocks shown in FIG.
[0010]
FIG. 8 is an example of the parent block 082 obtained for the child block 081 set at the tip of the ship 031. It can be seen that the symbols in each block are similar. FIG. 8 shows a binary image, but the same applies to a grayscale image in which pixels are given pixel values of 256 levels.
[0011]
By the above processing, data of a set of a child block and a parent block having a pattern similar to this can be obtained. Next, the obtained parent block is set at the same position of the alpha mask in the same manner as the original image data. I do.
[0012]
The extraction of the object is performed by correcting the alpha mask using the child block and the parent block. More specifically, a process may be performed in which the alpha mask data of each child block is replaced with data obtained by reducing the alpha mask data of the corresponding parent block by half in length and width.
[0013]
When this replacement transformation (self-similar mapping) is performed once, the approximate shape slightly approaches the correct shape. The same replacement conversion is performed again on the approached alpha mask. As described above, when the replacement conversion is repeated recursively to the alpha mask, the shape converges to a substantially correct shape. An alpha mask that has undergone a certain number of replacement transformations is defined as an object extraction result.
[0014]
[Patent Document 1]
JP 2000-82145 A
[0015]
[Patent Document 2]
JP 2001-188910 A
[0016]
[Non-patent document 1]
Ida, Mihonsugi, "Contour fitting by self-similar mapping", Proc. Of the 5th Image Sensing Symposium, C-15, pp. 115-120, June 1999.
[0017]
[Problems to be solved by the invention]
However, in the conventional fractal method, the contour of another object may be extracted when another object is nearby. In addition, when the object shape is thin, the object shape may not always be accurately extracted, for example, the object shape may disappear.
[0018]
Therefore, an object of the present invention is to provide a method and a program that can accurately extract the shape of an object even when another object is nearby or the object shape is small.
[0019]
[Means for Solving the Problems]
In order to solve the above problem, an object image extracting method according to the present invention includes a first step of receiving image data including a target object to be extracted and shape data representing a region of a schematic shape of the target object in the image data. A second step of setting a plurality of search reference blocks at different positions along the outline of the schematic shape represented by the shape data; and for each of the search reference blocks, a size larger than the search reference block. A third step of searching for a similar block which is a block and has a pattern in an area corresponding to the block on the image data most similar to a pattern in an area corresponding to the search reference block on the image data; The shape data of the area corresponding to each search reference block is converted to the shape data of the area corresponding to each similar block. And a fourth step of repeatedly performing a process of replacing the object with a reduced one until a predetermined condition is satisfied. In the first step, the probability that the target object exists in each pixel in the image data is expressed. Label data is also received, and in the third step, a weighted sum of errors of the entire block is calculated by referring to the label data, ignoring or neglecting an error between pixels having a low possibility that the target object is present, A search is performed for a similar block in which the weighted sum is minimized.
[0020]
Further, the shape data represents a region of a schematic shape of the target object, each pixel of which corresponds to each pixel of the image data on a one-to-one basis, and the label data indicates that the image data corresponds to the target object. The image is divided into at least two types of regions out of three types of a determined region, a non-target object determined region, and an undetermined region, and each of the pixels is one-to-one corresponding to each pixel of the image data. In the third step, for each of the plurality of candidate blocks that are candidates for the similar block, data of an area corresponding to the search reference block in the image data and data obtained by reducing an area corresponding to the candidate block in the image data are obtained. Of each corresponding point is calculated, and the weighted sum is stored in an area where both of the corresponding points are divided into target object defined areas by the label data. If, or if both are present in a region that is partitioned into non-target object determined regions, ignore or neglect the error for the corresponding point, find the candidate block with the minimum weighted sum of the error. It may be characterized in that it is determined as a similar block.
[0021]
In the third step, for each of the plurality of candidate blocks that are candidates for the similar block, data of an area corresponding to the search reference block in the image data and an area corresponding to the candidate block in the image data are determined. The error of each corresponding point with the reduced data is calculated, and the weighted sum is calculated when the corresponding points are both present in the area divided into the target object defined area by the label data, or both are non-target objects. If it exists in the area divided into the definite area, the weight coefficient multiplied by the error for the corresponding point is determined to be 0 or a small value, and the candidate block having the minimum weighted sum of the errors is determined as the similar block. It may be characterized by doing.
[0022]
The object image extracting method according to the present invention includes: a first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data; A plurality of search reference blocks are set to be shifted from each other along the outline of the approximate shape to be set, and among these, a pattern of an area corresponding to the search reference block on the shape data is a predetermined pattern. Is a second step of canceling the setting, and for each of the search reference blocks, a symbol of a region larger than the search reference block and corresponding to the block on the image data is corresponding to the search reference block. A third step of searching for a similar block most similar to the above, and searching for each of the search reference blocks in the shape data. The process of replacing the data of the corresponding area obtained by reducing the data of the region corresponding to each of the similar block in, and having a fourth step of performing repeated until a predetermined condition is satisfied.
[0023]
In the second step, a plurality of search reference blocks are set to be shifted from each other along the outline of the schematic shape represented by the shape data, and the inspection is performed so that the center position is the same as each search reference block. For the block, a pattern of an area corresponding to the inspection block on the shape data is examined, and if the inspection block pattern is a predetermined pattern, the setting of the search reference block may be canceled.
[0024]
The object image extracting method according to the present invention includes: a first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data; A second step of setting a plurality of search reference blocks at different positions along the outline of the approximate shape to be set, and for each of the search reference blocks, a size larger than the search reference block and A similar block whose pattern in the region corresponding to the block is most similar to the symbol in the region corresponding to the search reference block is searched, and a similar block in which the pattern of the corresponding region on the shape data is a predetermined pattern. A third step of canceling the setting of the search reference block corresponding to the search data; The process of replacing the data in the area corresponding to the reference block obtained by reducing the data of the region corresponding to each of the similar block, and having a fourth step of performing repeated until a predetermined condition is satisfied.
[0025]
The object image extraction method of the present invention receives image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and receives both the image data and the shape data. A first step of extending at least one of the upper, lower, left, and right sides by a predetermined width, and a second step of setting a plurality of search reference blocks at different positions along the outline of the schematic shape represented by the shape data. Searching, for each search reference block, a similar block that is larger than the search reference block and whose pattern in the area corresponding to the block on the image data is most similar to the pattern in the area corresponding to the search reference block A third step, and in the shape data, data of an area corresponding to each of the search reference blocks is Processing for replacing in those reduced data in the area corresponding to the similar block, and having a fourth step of performing repeated until a predetermined condition is satisfied.
[0026]
The object image extracting method according to the present invention includes: a first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data; A second step of setting a plurality of search reference blocks to be shifted from each other along the outline of the approximate shape to be set, and for each of the search reference blocks, the search reference blocks are smaller than the search reference blocks and are set on the image data. A third step of searching for a similar block in which the design of the region corresponding to the block is the most similar to the design of the region corresponding to the search reference block; and converting the data of the region corresponding to each of the similar blocks in the shape data. The process of replacing the data in the area corresponding to the search reference block with the reduced data is performed until a predetermined condition is satisfied. Characterized by a fourth step of performing repeatedly.
[0027]
The object image extracting method according to the present invention receives image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and enlarges these to obtain enlarged image data and enlarged image data. A first step of generating shape data, a second step of setting a plurality of search reference blocks to be shifted from each other along a contour of a schematic shape represented by the enlarged shape data, and the search For each reference block, a third similar block is searched for a similar block that is larger than the search reference block and whose symbol in the area corresponding to the block on the enlarged image data is most similar to the symbol in the area corresponding to the search reference block. And, in the enlarged shape data, data of an area corresponding to each of the similar blocks is set as a respective search reference block. A fourth step of repeatedly performing a process of replacing the data in the corresponding area with the reduced data until a predetermined condition is satisfied, and a fifth step of reducing the enlarged shape data obtained in the fourth step to the original size. And a step.
[0028]
The object image extracting method according to the present invention includes a first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data; A second step of generating shape data in which the shape of the target object is extracted using the image data, and reducing the extracted shape data to a predetermined size, and extracting a pixel value of one pixel from the extracted shape data. And a third step of generating reduced-shape data obtained by using pixel values of a plurality of corresponding pixels.
[0029]
The object image extracting method of the present invention receives image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and expands these to obtain enlarged image data and enlarged image data. A first step of generating shape data, a second step of generating enlarged shape data obtained by extracting the shape of the target object using the enlarged shape data and the enlarged image data, and generating the extracted enlarged shape data. Generating the shape data obtained by reducing the pixel value of one pixel to the original size and using the pixel values of a plurality of corresponding pixels of the extracted shape data. .
[0030]
The object image extracting program according to the present invention includes: a first step of receiving, by a computer, image data including a target object to be extracted, and shape data representing a general shape region of the target object in the image data; A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the data, and for each of the search reference blocks, a block larger than the search reference block. A third step of searching for a similar block in which the design of the region corresponding to this block on the image data is most similar to the design of the region corresponding to the search reference block; and a region corresponding to each of the search reference blocks. Replace the shape data of the area with the reduced shape data of the area corresponding to each similar block And a fourth step of repeating the process until a predetermined condition is satisfied. In the first step, label data representing the certainty of the existence of the target object at each pixel in the image data is also received. In the third step, a weighted sum of errors of the entire block is calculated by referring to the label data and ignoring or neglecting an error between pixels having a low possibility that the target object exists, and calculating the weighted sum of the errors. A search for similar blocks is performed.
[0031]
Further, the shape data represents a schematic shape of the target object, and each pixel thereof corresponds to each pixel of the image data on a one-to-one basis, and the label data represents the image data representing the target object determination area. , A non-target object determined area and an undetermined area are divided into at least two types of areas, and each pixel is made to correspond to each pixel of the image data on a one-to-one basis. In the third step, For each of the plurality of candidate blocks that are candidates for the similar block, corresponding points of data of an area corresponding to the search reference block in the image data and data obtained by reducing an area corresponding to the candidate block in the image data Is calculated, and the weighted sum thereof is calculated assuming that the corresponding points are both present in an area divided into the target object defined area by the label data, Alternatively, when both are present in an area partitioned into a non-target object confirmed area, the error for the corresponding point is determined by ignoring or neglecting, and the candidate block in which the weighted sum of the error is minimized is regarded as the similar block. The determination may be a feature.
[0032]
The object image extracting program according to the present invention includes: a first step of receiving, by a computer, image data including a target object to be extracted, and shape data representing a general shape region of the target object in the image data; A plurality of search reference blocks are set to be shifted from each other along the outline of the schematic shape represented by the data, and among these, a pattern of an area corresponding to the search reference block on the shape data is a predetermined pattern. Is a second step of canceling the setting, and for each of the search reference blocks, a symbol in a region larger than the search reference block and corresponding to the block on the image data corresponds to the search reference block. A third step of searching for a similar block most similar to the pattern in the area; Processing for replacing in those reduced data in the area corresponding data in the area corresponding to the each search reference block in each of the similar block, to execute a fourth step of performing repeated until a predetermined condition is satisfied.
[0033]
In the second step, a plurality of search reference blocks are set to be shifted from each other along the outline of the schematic shape represented by the shape data, and the inspection is performed so that the center position is the same as each search reference block. For the block, a pattern of an area corresponding to the inspection block on the shape data is examined, and if the inspection block pattern is a predetermined pattern, the setting of the search reference block may be canceled.
[0034]
The object image extracting program according to the present invention includes: a first step of receiving, by a computer, image data including a target object to be extracted, and shape data representing a general shape region of the target object in the image data; A second step of setting a plurality of search reference blocks to be shifted from each other along the outline of the schematic shape represented by the data; A similar block in which the pattern of the region corresponding to the block on the data is most similar to the symbol of the region corresponding to the search reference block is searched, and the pattern of the corresponding region on the shape data is a predetermined pattern. A third step of releasing the setting of the block and the corresponding search reference block; And replacing the data of the area corresponding to each search reference block with the reduced data of the area corresponding to each similar block in the data until a predetermined condition is satisfied. .
[0035]
An object image extraction program according to the present invention is configured such that a computer receives image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and receives the image data and the shape data. A first step of extending at least one of the upper, lower, left, and right sides by a predetermined width, and setting a plurality of search reference blocks to be shifted from each other along the outline of the schematic shape represented by the shape data A second step, wherein, for each of the search reference blocks, the similarity of the pattern in the area corresponding to the block larger than the search reference block and corresponding to the block on the image data is most similar to the design of the area corresponding to the search reference block. A third step of searching for a block; and a step in the shape data corresponding to each of the search reference blocks. The process of replacing the data with those obtained by reducing the data of the region corresponding to each of the similar block, to execute a fourth step of performing repeated until a predetermined condition is satisfied.
[0036]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, a plurality of embodiments of the present invention will be described with reference to the drawings.
[0037]
(Matters Common to Each Embodiment) FIG. 40 is a diagram of a PC (personal computer), WS (workstation), or the like used in each embodiment of the present invention. The PC and WS used in each embodiment include an input device 4007 such as a pointing device such as a mouse, a keyboard, and other external devices (for example, a digital camera), an input receiving unit 4004 that receives input from the input device 4007, a CRT and an LCD. And the like, and an image output unit 4006 for outputting an image signal to the image display device 4008.
[0038]
The PC and WS used in each embodiment include a magnetic disk drive 4002 such as a hard disk, a memory 4005, a central processing unit 4001, and an optical disk drive 4003.
[0039]
Each of the embodiments of the present invention is an object image extraction program that operates on a PC (personal computer) or WS (workstation). The user reads the program stored in the magnetic disk drive 4002 in advance into the memory 4005 and causes the PC or WS to execute the program.
[0040]
Before executing the object image extraction program, the user acquires image data to be subjected to the object shape extraction processing and stores it in the magnetic disk drive 4002 in advance. When the object image extraction program is executed, the image data is read from the magnetic disk drive 4002 and stored in the memory 4005.
[0041]
Then, the image data is displayed on the display device 4008, and the user inputs the data of the alpha mask of the schematic shape specifying the schematic shape of the object using the mouse. The input alpha mask data is also stored in the memory 4005.
[0042]
Further, the object image extraction program extracts an object shape based on the image data and the data of the alpha mask of the approximate shape. An alpha mask having an accurate shape is generated by extracting the object shape, and this is output as an extraction result.
[0043]
The alpha mask resulting from the contour extraction is stored in the magnetic disk drive 4002 or the memory 4005 of the PC or WS. Then, for example, it is used in another program or apparatus that cuts out an image of an object from an image.
[0044]
Note that a camera may be connected to a PC or WS so that a user can acquire an image at an arbitrary timing. Further, the data of the alpha mask of the approximate shape may be automatically generated using a background subtraction method or the like.
[0045]
In the following description, the search reference block is called a child block, and a similar block that is larger than the search reference block (for example, twice vertically and horizontally) and has a similar design is called a parent block.
[0046]
(First Embodiment) This embodiment is intended to improve the case where the shape of an object cannot be accurately extracted when there is an edge such as another object contour near the contour extraction target object. .
[0047]
Hereinafter, the processing of this embodiment will be described with reference to the flowchart of FIG.
[0048]
(Step 010) Image data, a roughly shaped alpha mask, and label data are prepared in a memory.
[0049]
As the image data, for example, the user reads out image data which has been shot by a digital camera or the like in advance and stored in a hard disk.
[0050]
The alpha mask is, for example, data representing the shape of an object specified and created by a mouse while viewing image data displayed on an image display device by a user. The alpha mask is data having the same number of pixels as the image data. A pixel where the object exists is 1 and a pixel where the object does not exist is 0.
[0051]
The label data is data representing information related to an object area and a background area different from the alpha mask, and is created by a user designating the image data using a mouse while viewing the image data. For each pixel, for example, a region that is known in advance to be an object other than the background or the target object is defined as a non-target object defined region (background defined region) with the pixel value of each pixel set to 0, and a region that is known in advance to be an object Sets the pixel value of each pixel to 1 as a target object fixed area (object fixed area), and sets the pixel value of each pixel to 2 as an undetermined area for a background or object undetermined area. The generation of the label data may be performed automatically with reference to, for example, an alpha mask.
[0052]
(Step 011) A child block C is set at the outline of the alpha mask. In the present embodiment, the child blocks C are set so as to overlap each other as shown in FIG. The position information (for example, the coordinates of the upper left corner and the coordinates of the lower right corner) of the set child block C is stored in the memory.
[0053]
(Step 012) A parent block P similar to each child block is found with reference to the label data and the image data.
[0054]
First, a candidate block that is a parent block candidate is set near the child block. Then, an error is obtained by referring to the label data of the pattern of the child block area and the pattern of the candidate block area on the image data.
An error is calculated for a plurality of candidate blocks, and the one with the smallest error is defined as a parent block. Since the candidate block is a block having the same number of pixels as the parent block, when calculating an error between the child block and the candidate block, the candidate block is reduced to have the same number of pixels as the child block.
[0055]
The error calculation with reference to the label data is performed as follows. For example, when the user designates an area inside the area 151 of FIG. 15 as not to extract an object, the label data has a pixel value of 0 (background defined area) inside, and a pixel value of 2 otherwise (undefined area). ). Then, a pixel in the child block is represented by X c , And the pixel of the corresponding reduced block is X p X c And X p Is defined as follows. (1) X c And X p When both are within the background fixed area, "X c And X p Is ignored and "0" is ignored.
(2) X c And X p When both are within the object confirmation area, “X c And X p Is ignored and "0" is ignored.
(3) If neither (1) nor (2) above, "X c And X p Error ”=“ X c And X p The absolute value of the pixel value difference ”.
[0056]
X obtained in this way c And X p Is added in the block to obtain an error between the candidate block and the child block. Then, the candidate block with the smallest error is determined as a parent block. Then, the determined position information of the parent block is stored in the memory in association with the child block.
[0057]
(Step 013) Step 012 is repeated until a parent block for all child blocks is determined.
(Step 014) On the alpha mask, the data of the area corresponding to each child block is replaced with the data of the corresponding parent block reduced to the same number of pixels as the child block.
(Step 015) Step 014 is performed for all child blocks. This means that all child blocks of the alpha mask have been replaced once.
(Step 016) Steps 014 and 015 are recursively repeated a predetermined number of times. Thereby, the contour of the alpha mask approaches the contour of the object.
[0058]
In the calculation of the error in step 12, in the cases of (1) and (2), the error is ignored and set to 0. However, the error is neglected, that is, even if the error is multiplied by a predetermined coefficient larger than 0 and smaller than 1. good. Alternatively, in the cases (1) and (2), the calculation itself may be omitted ignoring the error.
[0059]
Hereinafter, an example of extracting an object shape by the conventional fractal method will be compared with an example of extracting an object shape according to the present embodiment.
[0060]
An example in which an object shape is extracted using a conventional fractal method when another object is nearby will be described. The child block 091 shown in FIG. 9 includes the region of the ship 032 at the upper left in addition to the region of the ship 031 at the lower right. In this case, there is a high possibility that a candidate block completely similar to the child block 091, that is, a candidate having an absolute value error of 0 is not found, but a candidate block with the smallest error is selected as a parent block.
[0061]
In order to extract the ship 031, it is convenient to select a block 093 similar to the parent block with respect to the region of the ship 031. In this case, the contour of the alpha mask converges to the contour of the boat 031 by the replacement transformation. However, block 093 is not always selected.
[0062]
FIG. 11A is an enlarged view of the periphery of the child block 091, and shows a parent block candidate block 093, a contour 114 of the ship 032, and a contour 115 of the ship 031. In FIG. 11A, the parent block candidate block 093 is set to be similar to the outline 115 of the ship 031.
[0063]
FIG. 11B shows an image pattern 111 of the child block 091, an image pattern 112 obtained by reducing the block 093, and a difference pattern 113 between the image pattern 111 and the image pattern 112.
[0064]
Here, it is assumed that the pixel values of the region of the ship 032 and the region of the ship 031 painted with the horizontal line are the same value, and the other regions are constant with different pixel values. In the difference pattern 113, a portion where a pixel value error occurs between the image pattern 111 and the image pattern 112 is painted black. The absolute value error is proportional to the area of this black region.
[0065]
On the other hand, FIGS. 12A and 12B show a case in which the block 121 which is a parent block candidate is set to be similar with respect to the contour 114. In this case, the area of the black region of the difference pattern 122 is smaller than the difference pattern 113 of FIG. 11B. As a result, as shown in FIG. 10, the block 121 is selected as a parent block, and the outline of the alpha mask of the ship 031 approaches the ship 032 by the replacement conversion for this portion, so that a correct outline cannot be obtained.
[0066]
On the other hand, by performing processing using the label data as in step 012, a parent block convenient for object extraction is selected. This will be described with reference to a case where an alpha mask as shown in FIG. 4 is generated from the original image of FIG.
[0067]
FIG. 5 shows a state in which the general shape of the object is given, and FIG. 6 shows an alpha mask of this general shape. FIG. 7 shows the result of the arrangement of the child blocks.
[0068]
FIG. 13A is an enlarged view of the periphery of the child block 091. The outline 114 is the outline of the ship 032, and the outline 115 is the outline of the ship 031. The parent block 093 is arranged so as to be similar to the ship 031 outline 115. The upper left side of the background determined area line 131 which is the boundary line of the background determined area is the background determined area 151 shown in FIG.
[0069]
FIG. 13B shows an image pattern 132 of the child block 091, an image pattern 133 of the parent block 093 (reduced to the same size as the child block), and a difference pattern 134 between the image pattern 132 and the image pattern 133. FIG.
[0070]
In FIG. 13B, the image pattern 132 and the image pattern 133 also show a background defined area line 131, and the difference pattern 134 is a common area of the background defined area in the image pattern 132 and the background defined area in the image pattern 133. Is also shown.
[0071]
As described with reference to FIGS. 11A and 11B, conventionally, in such an arrangement of the parent blocks, many errors have occurred on the upper left side. However, in the present embodiment, since the error of the pixel which is the background defined region in both the image pattern 132 and the image pattern 133 is zero, no error appears in the region on the upper left side of the boundary line 135 of the difference pattern 134. . For this reason, the error in the entire block like the difference pattern 134 is smaller than in the related art.
[0072]
FIGS. 14A and 14B are diagrams showing a case where the parent blocks are arranged so as to be similar to the contour 114 of the ship 032, similarly to FIGS. 12A and 12B. In this case as well, the error in the upper left of the line 135 is canceled as in the case of FIG. 13, but since there is no error in the upper left of the line 135, the lower right of the line 135 as a whole is the same as in the case of FIG. An error occurs.
[0073]
Comparing FIG. 13 with FIG. 14, in the present embodiment, the error of the case of FIG. 13 is smaller than the case of FIG. 14, and the parent block is self-similar with respect to the case of FIG. Is selected, the contour of the ship 031 is correctly extracted.
[0074]
In the present embodiment, the label data is specified in advance by the user using the mouse, but the label data may be obtained by using a method for automatically obtaining the label data described below.
[0075]
In the present embodiment, steps 014 and 015 are repeated a predetermined number of times, but the condition of repetition is not limited to “number of times”. For example, when the replacement is performed in step 015, the sum of the absolute difference between the alpha mask of the child block and the reduced alpha mask of the parent block is calculated, and the calculation is repeated until the sum of the absolute difference becomes equal to or less than a predetermined threshold. You may do it.
[0076]
(First Label Data Generation Method) For example, when the color of an object or the background color is known in advance, there is also a method of setting the color regions as the object defined region and the background defined region, respectively.
[0077]
This method will be described by taking the case where the schematic shape 051 is given as described above as an example.
[0078]
(1) As shown in FIG. 37, the general shape 051 is expanded with a constant width W to obtain the shape 371. In the same manner, the shape 372 is obtained by expanding at a width of 2W.
[0079]
Here, the dilation is a kind of processing by a morphological filter. When a pixel other than a processing target area (here, an object area) is scanned and a processing target area is within a predetermined distance from a target pixel, the pixel is expanded. Is added to the processing target area.
[0080]
(2) The approximate shape 051 is contracted by the widths of W and 2W to obtain the shapes 373 and 374, respectively.
[0081]
Here, shrinkage is also a type of processing by a morphological filter. When scanning a pixel in a processing target area, if there is a non-processing target area within a certain distance from a target pixel, the pixel is excluded from the processing target area. It is.
[0082]
(3) An area 381 (an area shaded in FIG. 38) sandwiched between the shapes 371 and 372 is set as a background color sampling area. An area 382 (an area indicated by a horizontal line in FIG. 38) sandwiched between the shapes 373 and 374 is set as a foreground color sampling area. Here, the reason why the color is sampled from a portion at a certain distance from the general shape 051 is that the general shape is deviated from the correct shape.
[0083]
(4) A background color table is created by extracting all the colors of the pixels in the background color sampling area in the original image. A foreground color table is created in the same manner.
[0084]
Instead of extracting all colors, if a certain number of pixels have the same color, that color may be registered.
[0085]
(5) Compare the background color table with the foreground color table, and if the same color is registered, remove that color from both tables.
[0086]
(6) Each pixel of the original image is scanned using the two color tables thus obtained. Then, the pixel of the color in the background color table is defined as the background defined area, the pixel of the color in the foreground color table is defined as the object defined area, and the pixel of the color not in any table is defined as the undetermined area to create the label data.
[0087]
By performing the above (1) to (6), regions that can be estimated as a background or an object from the viewpoint of color can be set as respective defined regions.
[0088]
It should be noted that if the similar color is not individually registered, but the color level of the original image is quantized in advance and then the color table is created and the label data is created, the number of colors to be handled is reduced, so that the processing amount can be reduced. , Which contributes to faster processing.
[0089]
(Second Label Data Generation Method) If a color table is locally created in a screen and label data is created while switching the respective tables, locally optimized information can be obtained.
[0090]
As an example of locally creating a color table, the following method can be considered. For example, as shown in FIG. 39, blocks 391 and 392 are arranged along the schematic shape 051, and the above-described color table is created only inside each block. Then, when creating the label data, one of the background fixed, the object fixed, and the undetermined is determined using the color table of the block to which each pixel belongs. At this time, in the portion where the blocks 391 and 392 overlap, first, a label is determined in the color table of one of the blocks, and if the label is undecided, the label is relabeled in the other color table.
[0091]
(Third Label Data Generation Method) In generating a background color table and an object color table, instead of using a morphological filter, a method of registering and generating a color of a pixel for which a user has designated a screen as a background or an object may be used. is there.
[0092]
(Third Label Data Generation Method) When a background image in which the object whose contour is to be extracted is not obtained in advance, the difference between the background image and the current image is obtained, and pixels having a difference equal to or greater than a certain value There is also a method of confirming.
[0093]
(Fourth Label Data Generation Method) If it can be assumed that there is a correct outline within a certain range from the outline of the outline shape, the result of contracting the background region of the outline shape is used as the background defined region, or the object of the outline shape is determined. The result of contracting the region may be used as the object confirmation region. With this method, the periphery of the processing target area is reduced.
[0094]
(Fifth Label Data Generation Method) If it is known that the roughly-shaped object region always includes the entire object, the background region of the roughly-shaped background is left as it is, or a background image obtained by contracting one to two pixels is fixed. Area. On the other hand, a roughly contracted object region is reduced by several pixels, for example, a region contracted by about の of the number of pixels on one side of the child block is defined as an object defined region.
[0095]
Further, the object determined area and the background determined area determined in this way may be expanded by using the area growing method. Conversely, the same applies to a case where the whole of the roughly shaped object region is always included in the object.
[0096]
Here, the area growth method compares the pixel values inside and outside the area at the boundary of the area to be grown, and incorporates the external pixels into the area if the difference between the pixel values is equal to or less than a certain value. It goes out. By repeating this process, a portion having a similar pixel value is captured in the area.
[0097]
(Sixth Label Data Generation Method) When one point on the object is input by the user, an object area may be obtained by the area growing method with the point as a starting point, and may be used as the object confirmed area. Similarly, the background defined area can be set for the background by using the area growing method.
[0098]
(Number of Levels of Label Data) In the label data generation method up to this point, an example has been described in which data of three levels of background determination, object determination, and undetermined are generated, but the number of levels may be increased. For example, it is conceivable that the pixel value of the label data is made closer to 0 as the probability of being the background is higher, the pixel value is made closer to 255 as the probability of being the object is higher, and the undetermined region is made to correspond to the pixel value of 128.
[0099]
The colors of the background and the object are checked by some method (for example, by the method of sampling the background color and the object color in the first label data generation method described above). Then, the label data is generated by determining the pixel value of the label data depending on whether each pixel is closer to the background or the color of the object.
[0100]
In the parent block search using the label data generated in this manner, the pixel value of a certain pixel in the child block is calculated as X c , The pixel value of the pixel of the reduced block of the parent block candidate is X p , "X c And X p The absolute value of the difference between the pixel values of E is E, and the weighting coefficient for error calculation is W.
"X c And X p Error = W × E
Is calculated for each pixel to obtain a sum, and “X c And X p Is used as a parent block.
[0101]
Here, the weight coefficient W is
(A) X c And X p When the pixel values of both label data are not close to 0 or 255, they are always kept at 1.
(B) X c Or X p When the pixel value of any one of the label data is close to 0, the weight coefficient W is set to be smaller than 1 as the other label is smaller.
(C) X c Or X p If the pixel value of any one of the label data is close to 255, the weight coefficient W is made smaller than 1 as the other label becomes larger.
[0102]
By controlling W in this manner, the influence of an error between pixels having a high probability of being an object and pixels having a high probability of being a background can be reduced in multiple stages.
[0103]
As described above, in the present embodiment, the outline can be accurately extracted even when a plurality of objects are close to each other by using the masking information called the label data when extracting the outline of the object.
[0104]
(Second Embodiment) Hereinafter, a second embodiment of the present invention will be described with reference to FIGS. This embodiment is effective when a plurality of objects are individually and sequentially extracted. Note that, here, the description will be focused on parts different from the first embodiment.
[0105]
A ship 032 and a ship 031 are present in the image shown in FIG. 3, and in the present embodiment, these contours are sequentially extracted. Here, first, the ship 032 is extracted by the method described in the first embodiment, and then the ship 031 is extracted.
[0106]
FIG. 26 is a diagram in which the object region 261 of the ship 032 extracted by the method described in the first embodiment is painted black. In this situation, as in the first embodiment, a schematic shape is set as shown in FIG. 5, and the child blocks are arranged as shown in FIG.
[0107]
Then, the pixel value of a certain pixel in the child block is represented by X c , The pixel value of the pixel of the corresponding reduced block is X p As X c And X p Equation for calculating the error
(1) X c Or X p Is within the area 261, “X c And X p Error = “0”
(2) When the above does not apply to (1), "X c And X p Error = “X c And X p The absolute value of the difference between the pixel value and
Is defined as
[0108]
With this definition, the error is not counted in the upper left horizontal line area of the image pattern 112 in FIG. 11, and the error of the block 093 becomes zero, which is selected as a parent block. In other words, the calculation formula of the error is such that a parent block 093 similar to the child block 091 in FIG. 9 with respect to the contour of the ship 031 is obtained.
[0109]
As described above, according to the present embodiment, when sequentially extracting the contours of a plurality of objects, the detected objects are masked using the information of the contours of the already detected objects. However, the contour of the object can be accurately extracted.
[0110]
Third Embodiment A third embodiment of the present invention will be described with reference to the drawings. In the present embodiment, conventionally, there has been a case where it is difficult to detect the contour when the object region is thin, but this is to solve this. Note that, here, the description will be focused on parts different from the first embodiment.
[0111]
With the conventional fractal method, it is difficult to extract an object when the object shape is small, such as around the child block 161 in FIG.
[0112]
There is no completely similar parent block for the child block 161 arranged in the narrow portion. For the child block 161, for example, the block 162 is selected as the parent block.
[0113]
When the parent block 162 is replaced with the child block 161 by using the child block 161 and the parent block 162, the width of the object area in this portion is reduced by half each time. Then, if the replacement conversion is repeatedly performed, the object region will eventually disappear.
[0114]
This embodiment can address the above-mentioned problem. Hereinafter, the flow of processing in the present embodiment will be described with reference to the flowchart of FIG.
[0115]
(Step 020) The same processing as step 010 of the first embodiment is performed.
[0116]
(Step 21) A child block is arranged as shown in FIG. 7 along the outline portion of the roughly-shaped alpha mask.
(Step 022) Of the child blocks arranged in step 211, those that are determined to be arranged in the narrow part of the object are removed. A method for determining whether or not the portion is a thin portion will be described later.
[0117]
(Step 023) A parent block similar to the child block not canceled in step 022 is found with reference to the image data. In the present embodiment, similar blocks are obtained with reference to label data as in the first embodiment.
(Step 024) Step 023 is repeated until the parent blocks for all the child blocks are determined.
[0118]
(Step 025) On the alpha mask, the data of the area corresponding to each child block is replaced with the data of the area of the corresponding parent block reduced to the same number of pixels as the child block.
(Step 026) Step 025 is performed for all child blocks. This means that the inside of all the child blocks of the alpha mask has been replaced once.
(Step 027) Steps 025 and 026 are recursively repeated a predetermined number of times. Thereby, the contour of the alpha mask approaches the contour of the object.
[0119]
In this embodiment, label data is used, but this is not essential. The label data need not be used as in the related art.
[0120]
By performing such processing, since the child block is not arranged in the thin object portion, it is possible to avoid the problem that the portion disappears in many cases.
[0121]
The determination as to whether or not the object is a thin portion in step 022 is performed using the pixel value of the child block to be determined in the alpha mask. Hereinafter, a specific processing method will be described with reference to FIGS. 18, 19, 20, 21, and 22. FIG.
[0122]
FIG. 18 is an enlarged view of the alpha mask of a child block of 16 × 16 pixels. White pixels represent the object and black pixels represent the background.
[0123]
With respect to the alpha mask of the child block, the pixel is sequentially scanned one pixel at a time from the upper left pixel to the upper right pixel, and the number of pixel value changes is counted. Further, the four pixels are scanned from the upper right pixel to the lower right pixel, the lower right pixel to the lower left pixel, and the lower left pixel to the upper left pixel, and the number of changes is counted.
[0124]
The number of changes obtained in this way is always an even number. If the number of changes is four or more, it is determined that the change is a thin part of the object.
[0125]
In the case of FIG. 18, the scanning from the upper left pixel to the upper right pixel and the scanning from the lower right pixel to the lower left pixel change twice from black to white and from white to black, respectively. Since the total is four times, it is determined to be a thin portion.
[0126]
Since the child block is arranged along the outline of the general shape, scanning around the block in this way usually results in two changes as shown in FIG. 21 unless it is a narrow part. When the number of changes is two, it can be extracted by the fractal method.
[0127]
If the number of changes is more than two, it is estimated that the part has a complicated shape or is a thin part. In the case of complex shapes, the fractal method often cannot cope.
[0128]
FIG. 19 shows an example in which the number of changes is six, and FIG. 20 shows an example in which the number of changes is four. In such a case, since there is no self-similarity, it is considered better to avoid the disappearance of the object region by canceling the child block and leaving the schematic shape as it is without forcibly applying the fractal method.
[0129]
In the case shown in FIG. 22, the number of changes is 0, and in this case, the white object region disappears by the replacement conversion. If this small object is noise, etc. and it is OK to disappear, the child block can be left as it is, but if it is known that this is a small object, the user specifies with a mouse etc. The child block is canceled by giving information by a technique.
[0130]
In the above example, in step 022, four sides of the child block were scanned. Although this method is simple and convenient, it does not completely avoid the disappearance of thin object parts.
[0131]
For example, even if the pattern of the child block is as shown in FIG. 21 (a), if the parent block is as shown in FIG. 20 (a), the child block is overwritten by one replacement conversion and the replacement conversion is performed. By repeating this, the object area disappears.
[0132]
In order to avoid such a situation, a parent block is first obtained, and four sides of the parent block are scanned to count the number of changes in the pixel value of the alpha mask. If the number of changes is greater than 2, the parent block and the child block are cancelled.
[0133]
FIG. 23 shows a flowchart in this case. Except for the step 234 for removing the child block and the parent block, it is the same as FIG. 2, and the description of the other steps is omitted.
[0134]
FIG. 17 is a diagram illustrating an example of a positional relationship between the child block 161 and the parent block 162. The example in which the four sides of the child block 161 are scanned and the example in which the parent block 162 is scanned have been described above.
[0135]
In addition, the four sides of the block 163 that shares the center with the child block and has the same size as the parent block 162 may be scanned, and whether or not the part is a thin part may be similarly determined based on the number of changes. In the case of the block 163, since the determination can be made before the search for the parent block, the processing amount can be reduced. Further, a result closer to the determination using the parent block 162 is obtained than using the child block 161.
[0136]
As described above, in the present embodiment, the pixels on the four sides of the parent block are scanned, the shape of the object included in the parent block is estimated, and it is determined whether or not to perform the replacement process. It is possible to leave a contour of a thin portion or a portion having a complicated shape.
[0137]
(Fourth Embodiment) An object region that disappears due to repeated replacement conversion is an object region having a shape smaller than the width of a parent block. Therefore, in order to avoid the disappearance of the object region, it is considered that the parent block and the child block should be made small, although the allowable error of the general shape becomes small.
[0138]
However, originally, when the child block is a small block such as 4 × 4 pixels, if the size is further reduced, the resolution becomes coarse, and an image pattern sufficient for utilizing the self-similarity cannot be obtained.
[0139]
Therefore, in the present embodiment, the original image and the general shape are enlarged without changing the size of the parent block, and the disappearance is avoided by making the object region thicker than the width of the parent block. Then, if necessary, the alpha mask resulting from the extraction is reduced to the original size.
[0140]
FIG. 27 shows a flowchart of this embodiment. The difference from the previous embodiments is that step 271 for enlarging the original image and the schematic shape is performed at the very beginning of the processing. The enlargement of the original image in step 271 is performed using, for example, zero-order interpolation, linear (first-order) interpolation, or a higher-order pixel interpolation method. For example, zero-order interpolation is used for enlarging the approximate shape that is an alpha mask. Subsequent steps are the same as those in the previous embodiments, and a description thereof will be omitted.
[0141]
As described above, in the present embodiment, since the contour is extracted by enlarging the original image, it is possible to accurately extract even the contour of a thin part of the object, which is highly likely to lose its shape by the conventional contour extraction processing method. Become like
[0142]
(Fifth Embodiment) This embodiment is an embodiment relating to a contour extraction process suitable for extracting a contour of an object at an end of an image.
[0143]
In the fractal method, higher extraction accuracy may be obtained by padding a fixed width outside the original image. For example, as shown in FIG. 24, it is assumed that an object 242 is present in a portion indicated by oblique lines in the original image 241, and a rough shape 243 slightly deviated from the contour of the object 242 is given.
[0144]
In the case of the child block 244 arranged as shown in FIG. 24, in order to bring the schematic shape 243 closer to the contour of the object 242, the parent block is positioned as shown in FIG. Is desirably arranged in the block 245 of FIG.
[0145]
Since the search for the parent block is performed within a certain range centered on the child block, the block 245 only needs to be within that range. However, in the case of FIG. 24, the right side of the block 245 protrudes from the image. Therefore, even if the block 245 is within the search range, the error evaluation is not performed and the block 245 is excluded from the parent block candidates. Therefore, in the child block 244, a block different from the illustrated one is selected as the parent block, and the contour cannot be obtained accurately.
[0146]
Therefore, in the present embodiment, the image is expanded outward in advance by an amount corresponding to the possibility of the search range, as in a region 253 indicated by a horizontal line in FIG. This is called padding.
[0147]
In the present embodiment, the pixel value of padding is extrapolated with the outermost pixel value of the image, and the position and width of padding are determined as follows.
[0148]
If it is known in advance that a child block is arranged on the outline of the general shape, a rectangle 251 circumscribing the general shape 243 is first obtained before extracting the object. When the rectangle 251 is obtained, the outer frame 252 of a portion that can be a search range of the parent block when the child block is arranged around the inside is determined.
[0149]
The error inside the outer frame 252 may be calculated as a candidate block when searching for a parent block. Therefore, padding is performed by the width of the outer frame 252 protruding from the image 241. At this time, padding of the portion where the outer frame 252 does not protrude such as the upper left and lower right sides of the image 241 is not necessary. However, when there is no particular limitation on the capacity of the memory for storing the image data, A sufficient width of padding may be applied to all the left and right sides. By padding the outside of the image in this way, it is possible to avoid the problem that a contour line near the edge of the image cannot be accurately extracted.
[0150]
FIG. 28 is a flowchart of the object extraction processing according to the present embodiment. At the beginning of the object extraction by the so-called fractal method, padding is performed by executing step 281. Other steps are the same as in the previous embodiments.
[0151]
As described above, in the present embodiment, by providing padding with a predetermined width outside the original image, the contour existing at the end of the image can be accurately extracted.
[0152]
(Sixth Embodiment) This embodiment is an embodiment relating to the contour extraction processing when the deviation between the approximate shape and the correct shape is large.
[0153]
FIG. 30 shows an example of a case where an object contour cannot be correctly extracted by the conventional fractal method. FIG. 30 is a diagram showing a contour 301 of an object, a schematic shape 302 thereof, and a child block 303 which is one of child blocks arranged so that the center is located on the outline of the schematic shape 302.
[0154]
Since the child block 303 does not include the object outline 301, the block 311 shown in FIG. 31, for example, is selected as a block similar to the child block 303 in the search for the parent block. As described above, when the difference between the approximate shape and the correct shape is large, the self-similar structure of the object cannot be extracted, and as a result, the contour of the object may not be correctly extracted.
[0155]
Therefore, in the present embodiment, the parent block is arranged first. This is shown in FIGS. 32 and 33. First, the parent block is arranged such that the center is located on the outline of the schematic shape 302 as in a block 321 in FIG. Then, a block having a length and width that are similar to the parent block is searched for.
[0156]
In this case, since the object outline 301 is included at the lower left of the block 321, if a block similar to this block 321 is searched for a half-width and half-length block, the block 331 is selected as a child block as shown in FIG.
[0157]
FIG. 29 is a flowchart of the contour extraction processing according to the present embodiment. Steps 291 to 293 are processing for arranging parent blocks first and searching for similar child blocks. Subsequent replacement processing is the same as that of the previous embodiment.
[0158]
(Step 291) Parent block P is arranged at the outline of the alpha mask. Similar to FIG. 7 showing an example of arranging child blocks, the outline of the outline shape passes through the center of each parent block P, and adjacent parent blocks are arranged so as to overlap.
(Step 292) Find a child block C similar to the parent block P.
(Step 293) The above step 292 is performed for all parent blocks, and child blocks are determined respectively.
Since the following is the same replacement processing as before, the description will be omitted.
[0159]
As described above, in the present embodiment, the parent block is arranged on the outline of the schematic shape first, and the child block is searched later. Becomes larger, so that it becomes easier to extract the self-similar structure of the object than before. As a result, the object can be easily extracted correctly.
[0160]
(Seventh Embodiment) The present embodiment relates to a contour extraction process suitable for obtaining an alpha mask that also represents an intermediate state between an object region and a background region. Hereinafter, the present embodiment will be described.
[0161]
FIG. 36 is a flowchart of the contour extraction processing according to the present embodiment.
(Step 361) As shown in FIG. 34, the image data 342 and the roughly shaped alpha mask 341 are enlarged at a predetermined magnification to generate enlarged image data 344 and an enlarged alpha mask 343. In the present embodiment, the enlargement ratio is twice as high in the horizontal and vertical directions.
(Step 362) The above-mentioned fractal processing is performed on the enlarged image data 344 and the enlarged alpha mask 343 to extract an accurate alpha mask. Here, the pixel value of each pixel of the alpha mask is 0 for the background and 255 for the object.
(Step 363) An alpha mask for the image data 342 is obtained by reducing the alpha mask obtained by the fractal method to the original size.
[0162]
FIG. 35 is a view for explaining the process of reducing the enlarged alpha mask to the original size in step 363. In the present embodiment, since the original size image is enlarged by two times vertically and horizontally to perform the fractal process, the four pixels 353 of the enlarged alpha mask correspond to the pixels 352 of the alpha mask obtained by reduction. In the present embodiment, the average value of the pixel values of the pixels 353 is used as the pixel values of the pixels 352 of the alpha mask obtained by reduction. Therefore, the pixel value of each pixel of the alpha mask obtained by reduction is an average value of the four pixels.
[0163]
In the present embodiment, each pixel of the enlarged alpha mask is given a pixel value of 0 in the case of a background, and a pixel value of 255 in the case of an object. Therefore, if the number of object pixels is 0, 1, 2, 3, or 4 among the four enlarged alpha mask pixels corresponding to each pixel of the reduced alpha mask, the average value is respectively , 0, 64, 128, 192, 255.
[0164]
In FIG. 35, since the pixel 352 includes two object pixels, the pixel value of the pixel 352 is 128. If the values of the corresponding pixels are all the same as in the pixel 354, the corresponding pixel 351 has the same value.
[0165]
By using the pixel value of each pixel of the alpha mask obtained in this way as a pixel mixture ratio when synthesizing the extracted object with another image, the jagged feeling given by the outline is improved, and a more natural synthesis Images can be obtained.
[0166]
The formula for calculating the pixel value of the composite image is as follows: X is the pixel value of the pixel of the image in which the extracted object is captured, A is the value of the alpha mask corresponding to the pixel, and A is the value of the pixel at the same position in another image to be combined. If the pixel value is Y,
“Pixel value of composite image” = (A × X + (255−A) × Y) / 255
It becomes like. As described above, the pixel value of each pixel of the alpha mask can be regarded as representing transparency in which 0 is completely transparent and 255 is completely opaque.
[0167]
In the above-described enlargement processing, pixel interpolation is performed on the image data by, for example, primary interpolation, and on the alpha mask by, for example, zero-order interpolation. Also, for example, when an alpha mask for a reduced image called a thumbnail image is generated, there is no need to enlarge the original image, and after generating an alpha mask having values of 0 and 255 in the original size, What is necessary is just to reduce in the manner described.
Further, if an image corresponding to transparency, such as the image compression standard PNG or GIF, is generated and stored using the image data and the generated alpha mask, the image becomes a general-purpose object image and can be reused.
[0168]
As described above, in the present embodiment, when generating an alpha mask by reducing an enlarged alpha mask obtained by enlarging an original image and performing contour extraction, a multi-step calculation is performed with reference to a plurality of pixel values of the enlarged alpha mask. Is used as each pixel value of the alpha mask. Therefore, by using the pixel value of the alpha mask as transparency when extracting an object, it is possible to obtain a smooth outline of the object.
[0169]
【The invention's effect】
As described above, according to the present invention, in the fractal method, the contour of an object can be accurately obtained even when an edge such as another object contour is close or the object region is narrow.
[Brief description of the drawings]
FIG. 1 is a flowchart of a contour extraction process according to a first embodiment of the present invention.
FIG. 2 is a flowchart of a contour extraction process according to a third embodiment of the present invention.
FIG. 3 is an example of an extraction target image.
FIG. 4 is an example of an alpha mask for the image of FIG. 3;
FIG. 5 shows a state in which a schematic shape is set.
FIG. 6 is a schematic shape of an alpha mask.
FIG. 7 shows a state where child blocks are arranged.
FIG. 8 shows an example of a certain child block and its parent block.
FIG. 9 is an example of another child block and its parent block.
FIG. 10 is an example in which another parent block is selected in FIG. 9;
FIG. 11 shows how an error is calculated in FIG.
FIG. 12 shows how an error is calculated in FIG.
FIG. 13 is an example in which an error is calculated according to the present invention.
FIG. 14 is another example in which an error is calculated according to the present invention.
FIG. 15 shows an example in which label data is input.
FIG. 16 is an example in which a child block is arranged in a thin portion.
FIG. 17 is an example of a child block arranged in a thin portion and a parent block around the child block.
FIG. 18 is an alpha mask in a child block.
FIG. 19 shows an example of an alpha mask pattern: the number of changes is 6.
FIG. 20 shows an example of an alpha mask pattern: the number of changes is four.
FIG. 21 shows an example of an alpha mask pattern: the number of changes is 2.
FIG. 22 shows an example of an alpha mask pattern: the number of changes is 0.
FIG. 23 is a flowchart of a modification of the contour extraction processing according to the third embodiment of the present invention.
FIG. 24 is an example in which an object is present at an end of an image.
FIG. 25 is an example in which padding is provided at an end of an image to expand the image.
FIG. 26 is an example in which a region of a first object is extracted and a mask is set.
FIG. 27 is a flowchart of contour extraction processing according to the fourth embodiment of the present invention.
FIG. 28 is a flowchart of contour extraction processing according to the fifth embodiment of the present invention.
FIG. 29 is a flowchart of contour extraction processing according to the sixth embodiment of the present invention.
FIG. 30 is an example in which child blocks are arranged.
FIG. 31 is an example in which a parent block is obtained.
FIG. 32 is an example in which parent blocks are arranged.
FIG. 33 is an example in which a child block is obtained.
FIG. 34 is a view for explaining the concept of processing for enlarging image data and an alpha mask;
FIG. 35 is a view for explaining the concept of an alpha mask reduction process.
FIG. 36 is a flowchart of contour extraction processing according to the seventh embodiment of the present invention.
FIG. 37 is an example in which expansion and contraction are performed in a schematic shape.
FIG. 38 is a diagram showing a sampling area when a color table is created.
FIG. 39 is an example of locally creating a color table.
FIG. 40 is an exemplary view for explaining the schematic configuration of a computer used in each embodiment of the present invention;
[Explanation of symbols]
031 Ship whose contour is to be extracted
032 Another ship in the vicinity of ship 031
051 Outline of ship 031
081, 091, 161, 244, 303, 331 Child Block
082,093,121,162,245,311,321 Parent block
114 Part of outline of ship 032
115 Part of the outline of ship 031
111, 132 Child block
112,133 Reduced parent block
113, 122, 134 Difference
131, 135 Part of the boundary line of the label data
151 Label Data Boundary
241 images
242 object
243 Schematic shape of object 242
253 Expansion area by padding processing
301 Part of object contour
302 Part of schematic shape

Claims (17)

抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きいブロックであって前記画像データ上におけるこのブロックに対応する領域の図柄が前記画像データ上における前記探索基準ブロックに対応する領域の図柄と最も相似している相似ブロックを探索する第3のステップと、
前記各探索基準ブロックに対応する領域のシェイプデータをそれぞれの相似ブロックに対応する領域のシェイプデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有し、
前記第1のステップでは、
前記画像データ中の各画素における前記対象物体の存在する確かさを表すラベルデータも受け、
前記第3のステップでは、
前記ラベルデータを参照して、対象物体が存在する可能性が低い画素同士の誤差を無視若しくは軽視してブロック全体の誤差の加重和を計算し、前記加重和が最小となる相似ブロックの探索を行うことを特徴とする物体画像抽出方法。
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each of the search reference blocks, a symbol in a region larger than the search reference block and corresponding to this block on the image data is most similar to a symbol in an area corresponding to the search reference block on the image data. A third step of searching for similar blocks that
And a fourth step of repeatedly performing a process of replacing the shape data of the area corresponding to each search reference block with a reduced version of the shape data of the area corresponding to each similar block until a predetermined condition is satisfied,
In the first step,
Also receives label data indicating the certainty of the existence of the target object in each pixel in the image data,
In the third step,
Referring to the label data, calculating the weighted sum of the errors of the entire block by ignoring or neglecting the error between pixels having a low possibility that the target object is present, and searching for a similar block in which the weighted sum is minimized. A method for extracting an object image, comprising:
前記シェイプデータが、
対象物体の概略形状の領域を表し、その各画素が前記画像データの各画素と1対1に対応させたものであり、
前記ラベルデータが、
前記画像データを対象物体確定領域、非対象物体確定領域、未定領域の3種類のうち少なくとも2種類の領域に区分し、その各画素が前記画像データの各画素と1対1に対応させたものであるとし、
前記第3のステップでは、
前記相似ブロックの候補である複数の候補ブロックそれぞれについて、
前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、
その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは両方共に非対象物体確定領域に区分される領域に存在する場合には、当該対応点についての誤差を無視若しくは軽視して求め、
前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴とする請求項1記載の物体抽出方法。
The shape data is
Represents a region of the approximate shape of the target object, each pixel of which is in one-to-one correspondence with each pixel of the image data,
The label data is
The image data is divided into at least two types of regions out of three types of a target object fixed region, a non-target object fixed region, and an undetermined region, and each pixel corresponds to each pixel of the image data on a one-to-one basis. And
In the third step,
For each of the plurality of candidate blocks that are candidates for the similar block,
The data of the area corresponding to the search reference block in the image data, and the error of each corresponding point of the data obtained by reducing the area corresponding to the candidate block in the image data,
If the weighted sum is, both of the corresponding points are present in the area divided into the target object defined area by the label data, or both are present in the area divided into the non-target object defined area, Ignoring or neglecting the error about the corresponding point,
2. The object extraction method according to claim 1, wherein a candidate block that minimizes the weighted sum of the errors is determined as the similar block.
前記第3のステップでは、
前記相似ブロックの候補である複数の候補ブロックそれぞれについて、
前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、
その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは、両方共に非対象物体確定領域に区分される領域に存在する場合には、当該対応点についての誤差に乗じる重み係数を0または小さな値にして求め、
前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴とする請求項2記載の物体抽出方法。
In the third step,
For each of the plurality of candidate blocks that are candidates for the similar block,
The data of the area corresponding to the search reference block in the image data, and the error of each corresponding point of the data obtained by reducing the area corresponding to the candidate block in the image data,
The weighted sum, if both the corresponding points are present in the area divided into the target object confirmed area by the label data, or if both are present in the area divided into the non-target object confirmed area, A weighting factor for multiplying the error for the corresponding point by 0 or a small value is obtained,
3. The object extraction method according to claim 2, wherein a candidate block having a minimum weighted sum of the errors is determined as the similar block.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、これらのうち、前記シェイプデータ上における探索基準ブロックに対応する領域のパターンが所定のパターンであるものは設定を解除する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有する物体画像抽出方法。
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A plurality of search reference blocks are set so as to be shifted from each other along the outline of the general shape represented by the shape data, and among these, a pattern of an area corresponding to the search reference block on the shape data is a predetermined pattern. The second step of canceling the setting of the pattern of
For each of the search reference blocks, a third similar block which is larger than the search reference block and in which the design of the region corresponding to the block on the image data is most similar to the design of the region corresponding to the search reference block is searched. Steps and
And a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. Object image extraction method.
前記第2のステップでは、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、
各探索基準ブロックと中心位置を同じくする検査ブロックについて、前記シェイプデータ上における検査ブロックに対応する領域のパターンを調べ、
検査ブロックのパターンが、所定のパターンであるものについては探索基準ブロックの設定を解除することを特徴とする請求項4記載の物体画像抽出方法。
In the second step,
Along the outline of the schematic shape represented by the shape data, a plurality of search reference blocks are set at different positions,
For an inspection block having the same center position as each search reference block, a pattern of an area corresponding to the inspection block on the shape data is examined,
5. The object image extracting method according to claim 4, wherein the setting of the search reference block is canceled when the pattern of the inspection block is a predetermined pattern.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索するとともに、前記シェイプデータ上の対応する領域のパターンが所定のパターンである相似ブロックとこれに対応する探索基準ブロックの設定を解除する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有する物体画像抽出方法。
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each search reference block, while searching for a similar block that is larger than the search reference block and the symbol of the region corresponding to the block on the image data is most similar to the symbol of the region corresponding to the search reference block, A third step of canceling the setting of a similar block in which a pattern of a corresponding area on the shape data is a predetermined pattern and a search reference block corresponding to the similar block;
And a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. Object image extraction method.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、前記画像データと前記シェイプデータの両方の上下左右の少なくとも一辺を所定の幅だけ拡張する第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有する物体画像抽出方法。
Receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and defining at least one of the upper, lower, left, and right sides of both the image data and the shape data by a predetermined width A first step to extend only
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each of the search reference blocks, a third similar block which is larger than the search reference block and in which the design of the region corresponding to the block on the image data is most similar to the design of the region corresponding to the search reference block is searched. Steps and
And a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. Object image extraction method.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより小さくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、
前記シェイプデータにおいて前記各相似ブロックに対応する領域のデータをそれぞれの探索基準ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを有する物体画像抽出方法。
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each search reference block, a third similar block that is smaller than the search reference block and that has a pattern in the area corresponding to the block on the image data most similar to the pattern in the area corresponding to the search reference block is searched. Steps and
And a fourth step of repeatedly performing a process of replacing the data of the area corresponding to each similar block with the reduced data of the area corresponding to each search reference block in the shape data until a predetermined condition is satisfied. Object image extraction method.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、これらを拡大して拡大画像データと拡大シェイプデータとを生成する第1のステップと、
前記拡大シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記拡大画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、前記拡大シェイプデータにおいて前記各相似ブロックに対応する領域のデータをそれぞれの探索基準ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップと、
第4のステップで得られた拡大シェイプデータを元の大きさに縮小する第5のステップとを有する物体画像抽出方法。
A first method of receiving image data including a target object to be extracted and shape data representing a region of a schematic shape of the target object in the image data, and enlarging these to generate enlarged image data and enlarged shape data; Steps and
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the enlarged shape data;
For each of the search reference blocks, a search is performed for a similar block that is larger than the search reference block, and in which the design of the region corresponding to the block on the enlarged image data is most similar to the design of the region corresponding to the search reference block. Step 3 of repeating the process of replacing the data of the area corresponding to each similar block with the reduced data of the area corresponding to each search reference block in the enlarged shape data until a predetermined condition is satisfied. 4 steps,
A fifth step of reducing the enlarged shape data obtained in the fourth step to the original size.
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータと前記画像データとを用いて対象物体の形状を抽出したシェイプデータを生成する第2のステップと、
前記抽出したシェイプデータを所定の大きさに縮小し、1画素の画素値を前記抽出したシェイプデータの複数の対応する画素の画素値を用いて求めた縮小シェイプデータを生成する第3のステップとを有する物体画像抽出方法。
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of generating shape data in which the shape of the target object is extracted using the shape data and the image data;
A third step of reducing the extracted shape data to a predetermined size and generating reduced shape data in which a pixel value of one pixel is obtained by using pixel values of a plurality of corresponding pixels of the extracted shape data; An object image extraction method comprising:
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、これらを拡大して拡大画像データ及び拡大シェイプデータを生成する第1のステップと、
前記拡大シェイプデータと前記拡大画像データとを用いて対象物体の形状を抽出した拡大シェイプデータを生成する第2のステップと、
前記抽出した拡大シェイプデータを元の大きさに縮小し、1画素の画素値を前記抽出したシェイプデータの複数の対応する画素の画素値を用いて求めたシェイプデータを生成する第3のステップとを有する物体画像抽出方法。
A first step of receiving image data including a target object to be extracted and shape data representing an area of a schematic shape of the target object in the image data, and enlarging these to generate enlarged image data and enlarged shape data When,
A second step of generating enlarged shape data obtained by extracting the shape of the target object using the enlarged shape data and the enlarged image data;
A third step of reducing the extracted enlarged shape data to an original size and generating shape data in which a pixel value of one pixel is obtained by using pixel values of a plurality of corresponding pixels of the extracted shape data; An object image extraction method comprising:
コンピュータに、
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きいブロックであって前記画像データ上におけるこのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似している相似ブロックを探索する第3のステップと、
前記各探索基準ブロックに対応する領域のシェイプデータをそれぞれの相似ブロックに対応する領域のシェイプデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させ、
前記第1のステップでは、
前記画像データ中の各画素における前記対象物体の存在する確かさを表すラベルデータも受け、
前記第3のステップでは、
前記ラベルデータを参照して、対象物体が存在する可能性が低い画素同士の誤差を無視若しくは軽視してブロック全体の誤差の加重和を計算し、前記加重和が最小となる相似ブロックの探索を行うことを特徴とする物体画像抽出プログラム。
On the computer,
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each of the search reference blocks, a similar block that is a block larger than the search reference block and whose symbol of the area corresponding to this block on the image data is most similar to the symbol of the area corresponding to the search reference block A third step of searching;
And a fourth step of repeatedly performing a process of replacing the shape data of the area corresponding to each search reference block with a reduced version of the shape data of the area corresponding to each similar block until a predetermined condition is satisfied,
In the first step,
Also receives label data indicating the certainty of the existence of the target object in each pixel in the image data,
In the third step,
Referring to the label data, ignore or neglect the error between pixels having a low possibility that the target object is present, calculate the weighted sum of the errors of the entire block, and search for a similar block in which the weighted sum is minimized. An object image extraction program characterized by being performed.
前記シェイプデータが、
対象物体の概略形状を表し、その各画素が前記画像データの各画素と1対1に対応させたものであり、
前記ラベルデータが、
前記画像データを対象物体確定領域、非対象物体確定領域、未定領域の3種類のうち少なくとも2種類の領域に区分し、その各画素が前記画像データの各画素と1対1に対応させたものとし、
前記第3のステップでは、
前記相似ブロックの候補である複数の候補ブロックそれぞれについて、
前記画像データにおける前記探索基準ブロックに対応する領域のデータと、前記画像データにおける候補ブロックに対応する領域を縮小したデータとの各対応点の誤差を計算し、
その加重和を、前記対応点が両方共に前記ラベルデータによって対象物体確定領域に区分される領域に存在する場合、若しくは両方共に非対象物体確定領域に区分される領域に存在する場合に、当該対応点についての誤差を無視または軽視して求め、
前記誤差の加重和が最小となる候補ブロックを前記相似ブロックとして決定することを特徴とする請求項12記載の物体画像抽出プログラム。
The shape data is
Represents the schematic shape of the target object, each pixel of which is in one-to-one correspondence with each pixel of the image data;
The label data is
The image data is divided into at least two types of regions out of three types of a target object fixed region, a non-target object fixed region, and an undetermined region, and each pixel corresponds to each pixel of the image data on a one-to-one basis. age,
In the third step,
For each of the plurality of candidate blocks that are candidates for the similar block,
The data of the area corresponding to the search reference block in the image data, and the error of each corresponding point of the data obtained by reducing the area corresponding to the candidate block in the image data,
The weighted sum is determined when the corresponding points are both present in an area that is divided into target object defined areas by the label data, or when both are present in an area that is partitioned into non-target object defined areas. Ignoring or neglecting errors about points,
13. The non-transitory computer-readable storage medium according to claim 12, wherein a candidate block that minimizes the weighted sum of the errors is determined as the similar block.
コンピュータに、
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、これらのうち、前記シェイプデータ上における探索基準ブロックに対応する領域のパターンが所定のパターンであるものは設定を解除する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる物体画像抽出プログラム。
On the computer,
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A plurality of search reference blocks are set so as to be shifted from each other along the outline of the general shape represented by the shape data, and among these, a pattern of an area corresponding to the search reference block on the shape data is a predetermined pattern. The second step of canceling the setting of the pattern of
For each of the search reference blocks, a third similar block which is larger than the search reference block and in which the design of the region corresponding to the block on the image data is most similar to the design of the region corresponding to the search reference block is searched. Steps and
And performing a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. An object image extraction program to be used.
前記第2のステップでは、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定し、
各探索基準ブロックと中心位置を同じくする検査ブロックについて、前記シェイプデータ上における検査ブロックに対応する領域のパターンを調べ、
検査ブロックのパターンが、所定のパターンであるものについては探索基準ブロックの設定を解除することを特徴とする請求項14記載の物体画像抽出プログラム。
In the second step,
Along the outline of the schematic shape represented by the shape data, a plurality of search reference blocks are set at different positions,
For an inspection block having the same center position as each search reference block, a pattern of an area corresponding to the inspection block on the shape data is examined,
15. The object image extraction program according to claim 14, wherein the setting of the search reference block is canceled when the pattern of the inspection block is a predetermined pattern.
コンピュータに、
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受ける第1のステップと、
前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索するとともに、前記シェイプデータ上の対応する領域のパターンが所定のパターンである相似ブロックとこれに対応する探索基準ブロックの設定を解除する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる物体画像抽出プログラム。
On the computer,
A first step of receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data;
A second step of setting a plurality of search reference blocks so as to be shifted from each other along the outline of the general shape represented by the shape data;
For each search reference block, while searching for a similar block that is larger than the search reference block and the symbol of the region corresponding to the block on the image data is most similar to the symbol of the region corresponding to the search reference block, A third step of canceling the setting of a similar block in which a pattern of a corresponding area on the shape data is a predetermined pattern and a search reference block corresponding to the similar block;
And performing a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. An object image extraction program to be used.
コンピュータに、
抽出すべき対象物体を含む画像データと、前記画像データ中の対象物体の概略形状の領域を表すシェイプデータとを受け、前記画像データと前記シェイプデータの両方の上下左右の少なくとも一辺を所定の幅だけ拡張する第1のステップと、前記シェイプデータによって表される概略形状の輪郭に沿って、複数の探索基準ブロックを互いの位置をずらして設定する第2のステップと、
前記探索基準ブロック毎に、前記探索基準ブロックより大きくて、前記画像データ上におけるそのブロックに対応する領域の図柄が前記探索基準ブロックに対応する領域の図柄と最も相似した相似ブロックを探索する第3のステップと、
前記シェイプデータにおいて前記各探索基準ブロックに対応する領域のデータをそれぞれの相似ブロックに対応する領域のデータを縮小したもので置き換える処理を、所定の条件を満たすまで繰り返し行う第4のステップとを実行させる物体画像抽出プログラム。
On the computer,
Receiving image data including a target object to be extracted, and shape data representing a region of a schematic shape of the target object in the image data, and defining at least one of the upper, lower, left, and right sides of both the image data and the shape data by a predetermined width A first step of extending a plurality of search reference blocks along the outline of the schematic shape represented by the shape data, and
For each of the search reference blocks, a third similar block which is larger than the search reference block and in which the design of the region corresponding to the block on the image data is most similar to the design of the region corresponding to the search reference block is searched. Steps and
And performing a fourth step of repeatedly performing a process of replacing data of an area corresponding to each of the search reference blocks in the shape data with reduced data of an area corresponding to each similar block until a predetermined condition is satisfied. An object image extraction program to be used.
JP2002250058A 2002-08-29 2002-08-29 Object image extraction method, object image extraction program Expired - Fee Related JP4150554B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002250058A JP4150554B2 (en) 2002-08-29 2002-08-29 Object image extraction method, object image extraction program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002250058A JP4150554B2 (en) 2002-08-29 2002-08-29 Object image extraction method, object image extraction program

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2008140592A Division JP2008243226A (en) 2008-05-29 2008-05-29 Object image extraction method

Publications (2)

Publication Number Publication Date
JP2004086793A true JP2004086793A (en) 2004-03-18
JP4150554B2 JP4150554B2 (en) 2008-09-17

Family

ID=32056982

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002250058A Expired - Fee Related JP4150554B2 (en) 2002-08-29 2002-08-29 Object image extraction method, object image extraction program

Country Status (1)

Country Link
JP (1) JP4150554B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008116557A2 (en) * 2007-03-24 2008-10-02 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Device and method for adapting a mask image
CN113642611A (en) * 2021-07-16 2021-11-12 重庆邮电大学 Fetal heart ultrasonic image identification method based on multiple granularities
WO2022250869A1 (en) * 2021-05-27 2022-12-01 Microsoft Technology Licensing, Llc Image processing for stream of input images

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008116557A2 (en) * 2007-03-24 2008-10-02 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Device and method for adapting a mask image
WO2008116557A3 (en) * 2007-03-24 2009-06-04 Fraunhofer Ges Forschung Device and method for adapting a mask image
WO2022250869A1 (en) * 2021-05-27 2022-12-01 Microsoft Technology Licensing, Llc Image processing for stream of input images
US11714881B2 (en) 2021-05-27 2023-08-01 Microsoft Technology Licensing, Llc Image processing for stream of input images with enforced identity penalty
CN113642611A (en) * 2021-07-16 2021-11-12 重庆邮电大学 Fetal heart ultrasonic image identification method based on multiple granularities
CN113642611B (en) * 2021-07-16 2024-04-12 重庆邮电大学 Fetal heart ultrasonic image identification method based on multiple granularities

Also Published As

Publication number Publication date
JP4150554B2 (en) 2008-09-17

Similar Documents

Publication Publication Date Title
JP4806230B2 (en) Deterioration dictionary generation program, method and apparatus
US8401333B2 (en) Image processing method and apparatus for multi-resolution feature based image registration
JP2984633B2 (en) Reference image creation method and pattern inspection device
CN105528614B (en) A kind of recognition methods of the cartoon image space of a whole page and automatic recognition system
JP2001175857A (en) Reference image generating method, pattern inspecting device, and recording medium with recorded reference image generating program
JP4125273B2 (en) Image processing apparatus and method, and program
JP2002142128A (en) Image processing device and recording medium
JP2009211626A (en) Image processing device and method
CN114529925B (en) Method for identifying table structure of whole line table
JP2005234603A (en) Map information updating method and map updating device
US11410300B2 (en) Defect inspection device, defect inspection method, and storage medium
JP4791295B2 (en) Ruled line extraction program, ruled line extraction device, ruled line extraction method
JP5600524B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP2006350680A (en) Image processing apparatus, image processing method, and computer program
JP2008243226A (en) Object image extraction method
CN111260675A (en) High-precision extraction method and system for image real boundary
CN113033559A (en) Text detection method and device based on target detection and storage medium
JP5067882B2 (en) Image processing apparatus, image processing method, and program
JP4150554B2 (en) Object image extraction method, object image extraction program
US8971627B2 (en) Template matching processing device and template matching processing program
JP2011002965A (en) Image retrieval method and device
JP2003216959A (en) Method, device and program for extracting outline
JP2010066865A (en) Difference extraction device and difference extraction program
JP4756436B2 (en) Pattern recognition apparatus, pattern recognition method, and pattern recognition program
JP2006337167A (en) Inspection method of low-contrast flaw under cyclic noise, and inspection method of low-contrast flaw under repeated pattern

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050207

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20050415

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20050606

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20071026

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071102

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071220

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20071220

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080401

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080529

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20080609

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: 20080624

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: 20080630

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

Free format text: PAYMENT UNTIL: 20110704

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110704

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees