JP6676563B2 - Image processing apparatus, image processing method, and image processing program - Google Patents
Image processing apparatus, image processing method, and image processing program Download PDFInfo
- Publication number
- JP6676563B2 JP6676563B2 JP2017031325A JP2017031325A JP6676563B2 JP 6676563 B2 JP6676563 B2 JP 6676563B2 JP 2017031325 A JP2017031325 A JP 2017031325A JP 2017031325 A JP2017031325 A JP 2017031325A JP 6676563 B2 JP6676563 B2 JP 6676563B2
- Authority
- JP
- Japan
- Prior art keywords
- area
- image
- pixel
- region
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
Description
本発明は、画像中の任意の領域を抽出する技術に関する。 The present invention relates to a technique for extracting an arbitrary area in an image.
幅広い分野において、画像からの任意の領域を抽出したいという要求がある。テレビ局やスタジオ等では、グリーンバック背景に被写体を設置して被写体領域のみを抽出するクロマキー技術が活用されている。被写体領域のみを抽出することにより、例えば抽出した被写体画像を別画像に貼り付けて現実ではあり得ないような画像を生成する等の付加価値を得ることができる。 In a wide range of fields, there is a demand to extract an arbitrary region from an image. In a television station, a studio, or the like, a chroma key technology for extracting a subject region only by placing a subject on a green background is utilized. By extracting only the subject area, it is possible to obtain added value, for example, by pasting the extracted subject image to another image to generate an image that cannot be realized in reality.
被写体として競技中の選手、ライブ演奏中の演奏者、あるいはステージ上の役者等を想定してした場合、競技会場やイベント会場にクロマキー撮影用の特殊スクリーンを設置することは困難である。任意背景画像から被写体を抽出する技術として、セグメンテーションとアルファマッティングという手法が存在する(非特許文献1,2参照)。これらの手法は、前景であることが明確な前景領域、背景であることが明確な背景領域、及び前景であるか背景であるかを精緻に定める未知領域を処理対象の画像に対して与え、未知領域の前景を抽出するものである。 It is difficult to install a special screen for chroma key photographing in a competition venue or an event venue when it is assumed that a subject is a player in competition, a player performing live performance, an actor on the stage, or the like. As a technique for extracting a subject from an arbitrary background image, there are techniques called segmentation and alpha matting (see Non-Patent Documents 1 and 2). These methods provide a foreground region that is clear to be the foreground, a background region that is clear to be the background, and an unknown region that precisely defines whether the image is the foreground or the background to the image to be processed. The foreground of the unknown area is extracted.
非特許文献1のNearest Neighbor法を用いたセグメンテーション(以下、NNCLと称する)では、周囲の前景・背景画素を参照し、色および距離の観点で未知領域の画素を前景又は背景に分類する。セグメンテーションは、境界のコントラストやテクスチャによっては、実物の質感を再現するような精緻な境界を得にくいという問題がある。背景とのコントラストが弱い境界や髪の毛等のきわめて複雑な境界に対して被写体抽出を試みた場合に精度が低下することがある。このような境界に対しては、アルファマッティング手法などで境界部分に対してα値と呼ばれる透過度を与え、自然に見えるように工夫するポスト処理が行われる。 In the segmentation (hereinafter, referred to as NNCL) using the Nearest Neighbor method of Non-Patent Document 1, pixels in an unknown area are classified into foreground or background in terms of color and distance by referring to surrounding foreground and background pixels. The segmentation has a problem that it is difficult to obtain a fine boundary that reproduces the texture of the real object depending on the contrast and texture of the boundary. When an attempt is made to extract a subject from a boundary having a weak contrast with the background or an extremely complicated boundary such as a hair, accuracy may decrease. For such a boundary, post processing is performed to give a transparency called an α value to the boundary portion by an alpha matting method or the like, and to devise the boundary so that it looks natural.
アルファマッティングでは、未知領域の画素について、α値と呼ばれる透過度を与えることで、人の目にできるだけ自然に見えるよう被写体を抽出している。引用文献2のRobust Mattingは、カラーサンプリング手法と確率伝搬的手法の両方を用いてα値を求めている。カラーサンプリング手法とは、サンプルとして、すでに前景、背景とわかっている画素を集めることでα値を求める手法である。Robust Mattingでは、これらのアルゴリズムに対してより有効なサンプル組を作るために、間隔を開けてサンプルを取得する。確率伝搬的手法とは,α値は連続しているという仮定により、グラフのエネルギー最小化問題を解くことでα値を求める手法である。Robust Mattingでは、ランダムウォーク法を用いてグラフ問題を解いている。Robust Mattingは、比較的正確なα値を求めることができるが、処理に時間がかかるという問題がある。 In alpha matting, an object is extracted so as to look as natural as possible to human eyes by giving a transparency called an α value to pixels in an unknown area. In Robust Matching of the cited document 2, the α value is obtained by using both the color sampling method and the belief propagation method. The color sampling method is a method of obtaining an α value by collecting pixels that are already known as foreground and background as samples. In Robust Matching, samples are taken at intervals to create a more effective sample set for these algorithms. The belief propagation method is a method of obtaining the α value by solving the energy minimization problem of the graph on the assumption that the α value is continuous. In Robust Matching, a graph problem is solved using a random walk method. Robust Matching can obtain a relatively accurate α value, but has a problem that it takes time to process.
非特許文献3では、画素に対してα値を与える手法を高速化するために、α値の算出対象となる画素に対応する候補点を共有している。具体的には、対象画素に対してカラーサンプリング手法における候補点を策定するにあたり、未知領域内の画素を、隣接した画素の差などに基づきごく小さい集合に分類し、集合内の対象画素について放射線状に一定の角度の直線上の画素を候補点とし、策定した候補点を集合で共有することで、処理の回数を削減し、高速化を図っている。 Non-Patent Document 3 shares a candidate point corresponding to a pixel for which an α value is to be calculated in order to speed up a method of giving an α value to a pixel. Specifically, in formulating candidate points for the target pixel in the color sampling method, pixels in the unknown region are classified into a very small set based on the difference between adjacent pixels, and the radiation of the target pixel in the set is determined. Pixels on a straight line having a constant angle are set as candidate points, and the set of candidate points is shared as a set, thereby reducing the number of processes and increasing the speed.
しかしながら、この方法は、放射線状に候補点を走査するため、対象画素から物理的に離れた、本来のカラーサンプリング手法では選択されない輪郭上の画素も候補点として選択されてしまい、処理結果の精度が落ちるという問題がある。また、候補点を共有することによって生じる、当該画素へ不適切な透過度を与えることを防ぐ必要があり、非特許文献3においては、当該対象画素と隣接する画素との差分等にもとづいて、候補点の共有が可能かどうかの評価を行う処理が採用されている。この処理は複雑であり、処理速度を向上させにくいという問題がある。 However, in this method, since the candidate points are scanned in a radial pattern, pixels on the contour physically separated from the target pixel and not selected by the original color sampling method are also selected as candidate points, and the accuracy of the processing result is reduced. There is a problem that falls. In addition, it is necessary to prevent giving an inappropriate transmittance to the pixel caused by sharing the candidate point. In Non-Patent Document 3, based on the difference between the target pixel and an adjacent pixel, A process for evaluating whether the candidate points can be shared is adopted. This process is complicated and has a problem that it is difficult to improve the processing speed.
本発明は、上記に鑑みてなされたものであり、画像から任意の領域をより高速に精緻に抽出することを目的とする。 The present invention has been made in view of the above, and has as its object to extract an arbitrary region from an image more quickly and precisely.
第1の本発明に係る画像処理装置は、処理対象画像と前記処理対象画像を前景領域、背景領域、未知領域に分類した情報を入力する入力手段と、前記処理対象画像から得られる特徴量に基づいて前記未知領域を第1領域と第2領域に分類する領域判別手段と、前記第1領域に対してセグメンテーションを行い、前記第1領域の各画素を前記前景領域と前記背景領域に分類するセグメンテーション処理手段と、前記第2領域に対してアルファマッティングを行い、前記第2領域の各画素の透過度を求めるマッティング処理手段と、前記前景領域、前記背景領域、前記第1領域に対する処理結果と前記第2領域に対する処理結果を統合したマスク画像を用いて前記処理対象画像から前景画像を抽出する画像抽出手段と、を有することを特徴とする。 An image processing apparatus according to a first aspect of the present invention includes: an input unit configured to input a processing target image and information obtained by classifying the processing target image into a foreground area, a background area, and an unknown area; Area determining means for classifying the unknown area into a first area and a second area based on the first area; performing segmentation on the first area; and classifying each pixel of the first area into the foreground area and the background area A segmentation processing unit, a matting processing unit that performs alpha matting on the second region, and obtains a transmittance of each pixel in the second region, and a process on the foreground region, the background region, and the first region and having and an image extracting means for extracting a foreground image from the processed image using the result as a mask image obtained by integrating the processing result for the second region
第2の本発明に係る画像処理方法は、画像処理装置が実行する画像処理方法であって、処理対象画像と前記処理対象画像を前景領域、背景領域、未知領域に分類した情報を入力するステップと、前記処理対象画像から得られる特徴量に基づいて前記未知領域を第1領域と第2領域に分類するステップと、前記第1領域に対してセグメンテーションを行い、前記第1領域の各画素を前記前景領域と前記背景領域に分類するステップと、前記第2領域に対してアルファマッティングを行い、前記第2領域の各画素の透過度を求めるステップと、前記前景領域、前記背景領域、前記第1領域に対する処理結果と前記第2領域に対する処理結果を統合したマスク画像を用いて前記処理対象画像から前景画像を抽出するステップと、を有することを特徴とする。 An image processing method according to a second aspect of the present invention is an image processing method executed by an image processing apparatus, wherein a step of inputting a processing target image and information obtained by classifying the processing target image into a foreground area, a background area, and an unknown area. Classifying the unknown region into a first region and a second region based on a feature amount obtained from the processing target image; performing segmentation on the first region; Classifying the foreground area and the background area; performing alpha matting on the second area to determine the transmittance of each pixel in the second area; characterized in that it comprises the steps of extracting the foreground image from the processed image using the mask image which integrates the processing results for the second region and the processing result for the first area, the To.
第3の本発明に係る画像処理プログラムは、上記画像処理装置の各手段としてコンピュータを動作させることを特徴とする。 An image processing program according to a third aspect of the present invention is characterized by causing a computer to operate as each unit of the image processing apparatus.
本発明によれば、画像から任意の領域をより高速に精緻に抽出することができる。 ADVANTAGE OF THE INVENTION According to this invention, an arbitrary area | region can be extracted from an image more quickly and precisely.
以下、本発明の実施の形態について図面を用いて説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[画像処理装置の構成]
図1は、本実施形態の画像処理装置の構成を示す機能ブロック図である。同図に示す画像処理装置1は、入力部11、領域判別部12、セグメンテーション処理部13、マッティング処理部14、画像統合部15、及び出力部16を備える。画像処理装置1が備える各部は、演算処理装置、記憶装置等を備えたコンピュータにより構成して、各部の処理がプログラムによって実行されるものとしてもよい。このプログラムは画像処理装置1が備える記憶装置に記憶されており、磁気ディスク、光ディスク、半導体メモリ等の記録媒体に記録することも、ネットワークを通して提供することも可能である。
[Configuration of Image Processing Apparatus]
FIG. 1 is a functional block diagram illustrating a configuration of the image processing apparatus according to the present embodiment. The image processing apparatus 1 illustrated in FIG. 1 includes an input unit 11, an area determination unit 12, a segmentation processing unit 13, a matting processing unit 14, an image integration unit 15, and an output unit 16. Each unit included in the image processing apparatus 1 may be configured by a computer including an arithmetic processing unit, a storage device, and the like, and the processing of each unit may be executed by a program. This program is stored in a storage device included in the image processing apparatus 1, and can be recorded on a recording medium such as a magnetic disk, an optical disk, or a semiconductor memory, or can be provided through a network.
入力部11は、処理対象の元画像と、元画像の各画素に対して前景、背景、又は未知のラベルを付与したラベル画像(TRIMAP)を入力する。TRIMAPは、人が手作業で作成してもよいし、深度センサや温度センサなどのセンサによるセンシング結果とカメラ画像から自動で作成してもよい。 The input unit 11 inputs an original image to be processed and a label image (TRIMAP) in which foreground, background, or an unknown label is assigned to each pixel of the original image. TRIMAP may be created manually by a person, or automatically created from a camera image and a sensing result of a sensor such as a depth sensor or a temperature sensor.
図2に元画像の一部を示し、図3に図2の元画像に対応するTRIMAPの例を示す。図3のTRIMAPでは、前景のラベルが付与された画素を白、背景のラベルが付与された画素を黒、未知のラベルが付与された画素をグレーで示している。以下、前景のラベルが付与された画素の集合を前景領域F、背景のラベルが付与された画素の集合を背景領域B、未知のラベルが付与された画素の集合を未知領域Uとする。 FIG. 2 shows a part of the original image, and FIG. 3 shows an example of TRIMAP corresponding to the original image in FIG. In the TRIMAP of FIG. 3, pixels to which a foreground label is assigned are indicated by white, pixels to which a background label is assigned are indicated by black, and pixels to which an unknown label is assigned are indicated by gray. Hereinafter, a set of pixels with a foreground label is referred to as a foreground area F, a set of pixels with a background label is referred to as a background area B, and a set of pixels with an unknown label is referred to as an unknown area U.
領域判別部12は、元画像から取得できる特徴量に基づき、TRIMAPの未知領域Uを、部分領域ごとに、セグメンテーション処理を施すセグメンテーション処理領域USとマッティング処理を施すマッティング処理領域UMに分類し、前景領域F、背景領域B、セグメンテーション処理領域US、及びマッティング処理領域UMで構成されたQUADMAPを出力する。 Region discriminator 12, based on the feature quantity that can be acquired from the original image, an unknown region U trimap, for each partial region, a segmentation processing region U S and matting process for performing segmentation process performed on the matting treatment region U M classified, foreground region F, the background region B, and outputs the segmentation process area U S, and QUADMAP comprised of matting processing region U M.
図4にQUADMAPの例を示す。図4のQUADMAPでは、図3のTRIMAPの未知領域Uがセグメンテーション処理領域USとマッティング処理領域UMに分類されている。本実施形態では、領域判別部12は、前景領域Fの画素値を255、背景領域Bの画素値を0、セグメンテーション処理領域USと分類した領域の画素値を98、マッティング処理領域UMと分類した領域の画素値を170としたQUADMAPを出力する。 FIG. 4 shows an example of QUADMAP. In QUADMAP in FIG 4, the unknown region U TRIMAP of FIG. 3 is classified into the segmentation processing region U S and matting processing region U M. In the present embodiment, the region determination unit 12, 255 the pixel values of the foreground region F, 0 pixel values of the background region B, and the pixel values of the regions classified as segmentation processing region U S 98, matting processing region U M QUADMAP with the pixel value of the area classified as "170" as 170 is output.
領域判別部12が未知領域Uの分類に用いる特徴量としては、例えば画像の輝度の傾き(エッジ)、周波数成分などが考えられる。未知領域Uを単純な領域と複雑な領域に分けることができるものであれば、どのような特徴量を用いてもよい。単純な領域とはRobust Matting処理とセグメンテーション処理の処理結果の画像に違いが目立たない領域である。複雑な領域とは、一つの被写体において、Robust Matting処理後に前景と背景の境界において透過度がなだらかに変化する領域であり、セグメンテーション処理では精緻な境界を得られない領域である。 As the feature amount used by the area determination unit 12 to classify the unknown area U, for example, a gradient (edge) of luminance of an image, a frequency component, and the like can be considered. Any feature amount may be used as long as the unknown region U can be divided into a simple region and a complicated region. The simple region is a region in which the difference between the images obtained by the Robust Matching process and the segmentation process is inconspicuous. The complex area is an area in which the transparency of the subject changes gradually at the boundary between the foreground and the background after the Robust Matching processing, and a fine boundary cannot be obtained by the segmentation processing.
セグメンテーション処理部13は、元画像とQUADMAPを入力し、セグメンテーション処理領域USに対してセグメンテーションを行い、セグメンテーション処理領域USに含まれる画素に対して前景又は背景のラベルを付与する。セグメンテーション処理部13では、どのようなセグメンテーション技術を用いてもよいが、精緻さと高速さの面からNNCLを用いるとよい。 Segmentation processing section 13 inputs the original image and QUADMAP, performs segmentation against segmentation processing region U S, imparts a label foreground or background with respect to pixels included in the segmentation process area U S. Although any segmentation technique may be used in the segmentation processing unit 13, it is preferable to use NNCL in terms of precision and high speed.
マッティング処理部14は、元画像とQUADMAPを入力し、マッティング処理領域UMに対してRobust Matting法を用いたマッティング処理を行い、マッティング処理領域UMに含まれる画素のそれぞれの透過度(α値)を求める。 Matting processor 14 inputs the original image and QUADMAP, performs matting process using the Robust Matting method against matting processing region U M, each of the transmission of the pixels included in the matting treatment region U M Determine the degree (α value).
画像統合部15は、セグメンテーション処理部13とマッティング処理部14のそれぞれの処理結果を統合してマスク画像を生成し、生成したマスク画像を用いて元画像に対してマスク処理を行い、元画像から前景を切り出した前景画像を生成する。 The image integration unit 15 integrates the processing results of the segmentation processing unit 13 and the matting processing unit 14 to generate a mask image, performs mask processing on the original image using the generated mask image, A foreground image is generated by extracting the foreground from.
出力部16は、前景画像を出力する。 The output unit 16 outputs a foreground image.
[画像処理装置の処理の流れ]
次に、本実施形態の画像処理装置の処理の流れについて説明する。
[Processing Flow of Image Processing Apparatus]
Next, a flow of processing of the image processing apparatus according to the present embodiment will be described.
図5は、本実施形態の画像処理装置の処理の流れを示すフローチャートである。 FIG. 5 is a flowchart illustrating a flow of processing of the image processing apparatus according to the present embodiment.
入力部11は、元画像とTRIMAPを入力する(ステップS1)。 The input unit 11 inputs an original image and TRIMAP (step S1).
領域判別部12は、TRIMAPの未知領域Uをセグメンテーション処理領域USとマッティング処理領域UMに分類し、QUADMAPを出力する(ステップS2)。領域判別部12の処理の詳細については後述する。 Region discriminator 12 classifies the unknown region U TRIMAP segmentation processing region U S and matting processing region U M, and outputs the QUADMAP (step S2). Details of the processing of the area determination unit 12 will be described later.
セグメンテーション処理部13は、元画像とQUADMAPを入力し、QUADMAPのセグメンテーション処理領域USに対してセグメンテーションを行う(ステップS3)。本実施形態では、NNCLを用い、セグメンテーション処理領域USの各画素に対して前景(画素値が255)又は背景(画素値が0)のラベルを付与する。 Segmentation processing section 13 inputs the original image and QUADMAP, performs segmentation against segmentation processing region U S of QUADMAP (step S3). In the present embodiment, a NNCL, foreground for each pixel in the segmentation process area U S (pixel value 255) or a background (pixel value 0) to impart label.
マッティング処理部14は、元画像とQUADMAPを入力し、マッティング処理領域UMに対してRobust Matting法を用いたマッティング処理を行う(ステップS4)。マッティング処理部14の処理の詳細については後述する。マッティング処理部14は、のちにマスク処理する際に不具合が出ないように、セグメンテーション処理領域USとマッティング処理領域UMとの境目で、マッティング処理領域UMを2画素拡張する。 Matting processor 14 inputs the original image and QUADMAP, performs matting process using the Robust Matting method against matting processing region U M (step S4). Details of the processing of the matting processing unit 14 will be described later. Matting processing unit 14 later so as not to have trouble when the masking, at the boundary of the segmentation process region U S and matting processing region U M, extend two pixels matting treatment region U M.
なお、図5で示したように、セグメンテーション処理とマッティング処理を並列で行ってもよいし、セグメンテーション処理の後にマッティング処理を行ってもよい。また、マッティング処理の後にセグメンテーション処理を行ってもよい。 As shown in FIG. 5, the segmentation process and the matting process may be performed in parallel, or the matting process may be performed after the segmentation process. Further, a segmentation process may be performed after the matting process.
画像統合部15は、セグメンテーション処理部13とマッティング処理部14のそれぞれの処理結果を統合してマスク画像を生成し、元画像に対してマスク処理を施す(ステップS5)。具体的には、QUADMAPにおいて、前景領域Fの画素値を255、背景領域Bの画素値を0とし、セグメンテーション処理領域USについては、セグメンテーション処理部13の求めた画素値(0又は255)を用い、マッティング処理領域UMについては、マッティング処理部14の求めた画素値(0から255)を用いてマスク画像を生成する。生成したマスク画像を用いて元画像に対してマスク処理を行い、元画像から前景画像を切り出す。マスク処理では、マスク画像の画素値が1以上の画素が元画像から前景画像として切り出される。画素値が254以下の画素には画素値に応じた透過度が設定される。 The image integrating unit 15 generates a mask image by integrating the respective processing results of the segmentation processing unit 13 and the matting processing unit 14, and performs a mask process on the original image (step S5). Specifically, in QUADMAP, 255 the pixel values of the foreground region F, the pixel value of the background area B and 0, the segmentation processing region U S, calculated pixel values of the segmentation processing unit 13 (0 or 255) using, for matting processing region U M, to generate a mask image using the obtained pixel value of the matting unit 14 (0 to 255). Mask processing is performed on the original image using the generated mask image, and a foreground image is cut out from the original image. In the mask processing, pixels having a pixel value of 1 or more in the mask image are cut out from the original image as a foreground image. For a pixel having a pixel value of 254 or less, the transmittance according to the pixel value is set.
出力部16は、切り出された前景画像を出力する(ステップS6)。 The output unit 16 outputs the cut out foreground image (Step S6).
[領域判別処理]
次に、領域判別処理について説明する。
[Area determination processing]
Next, the area determination processing will be described.
図6は、領域判別処理の流れを示すフローチャートである。本実施形態では、元画像の輝度の傾きに基づいて未知領域Uを分類する。 FIG. 6 is a flowchart illustrating the flow of the area determination process. In the present embodiment, the unknown area U is classified based on the luminance gradient of the original image.
領域判別部12は、元画像を輝度画像に変換し(ステップS21)、輝度画像に微分フィルタをかけて微分画像を得る(ステップS22)。本実施形態では、微分フィルタとしてラプラシアンフィルタを用いてエッジを抽出する。図7に、微分画像の例を示す。 The area determination unit 12 converts the original image into a luminance image (Step S21), and obtains a differential image by applying a differential filter to the luminance image (Step S22). In the present embodiment, edges are extracted using a Laplacian filter as a differential filter. FIG. 7 shows an example of the differential image.
領域判別部12は、ステップS22で得られた微分画像から画素値が閾値以上の画素を抽出して閾値画像を得る(ステップS23)。具体的には、微分画像と同じ大きさで全ての画素の画素値が0の閾値画像を用意し、画素値が閾値Th0以上の微分画像の画素に対応する閾値画像の画素の画素値を255とする。この処理により、元画像においてエッジが強く表れた画素だけを分離する。図8に、閾値画像の例を示す。なお、図8内の枠は、以下の説明で用いる図9,10,11の範囲を示す枠である。 The area determination unit 12 extracts a pixel whose pixel value is equal to or larger than the threshold value from the differential image obtained in step S22 to obtain a threshold image (step S23). Specifically, the pixel values of all pixels in the same size as the differential image prepared threshold image of 0, the pixel values of the pixels in the threshold image pixel values corresponding to the pixels of the threshold value Th 0 or more differential image 255. By this processing, only the pixels whose edges appear strongly in the original image are separated. FIG. 8 shows an example of the threshold image. The frame in FIG. 8 is a frame indicating the range of FIGS. 9, 10, and 11 used in the following description.
領域判別部12は、ステップS23で得られた閾値画像を小領域に分割する(ステップS24)。図9に、図8の閾値画像の一部を小領域に分割した例を示す。本実施形態では、閾値画像を48×27の小領域に分割した。小領域の大きさはこれに限るものではなく、任意に設定できる。 The area determination unit 12 divides the threshold image obtained in step S23 into small areas (step S24). FIG. 9 shows an example in which a part of the threshold image of FIG. 8 is divided into small regions. In the present embodiment, the threshold image is divided into 48 × 27 small areas. The size of the small area is not limited to this, and can be set arbitrarily.
領域判別部12は、小領域ごとに、ステップS23で抽出された画素の数を数え、その画素数に基づいて未知領域Uをセグメンテーション処理領域US又はマッティング処理領域UMに分類する(ステップS25)。具体的には、閾値画像に設定した小領域ごとに画素値が255の画素の数を数え、画素の数が閾値Th1以上存在する小領域内の未知領域Uをセグメンテーション処理領域USとして、TRIMAPの対応する画素の画素値を98にする。また、画素の数が閾値Th1に満たない小領域内の未知領域Uをマッティング処理領域UMとして、TRIMAPの対応する画素の画素値を170にする。図10に、小領域ごとに未知領域Uをセグメンテーション処理領域USとマッティング処理領域UMに分類した例を示す。 Region discriminator 12, for each small region, counts the number of pixels extracted in step S23, to classify the unknown region U in the segmentation process area U S or matting process area U M based on the number of pixels (step S25). Specifically, counts the number of pixels of the pixel values in each small area set in the threshold image 255, an unknown region U in the small area where the number of pixels exist threshold Th 1 or more as the segmentation processing area U S, The pixel value of the corresponding pixel of TRIMAP is set to 98. Further, as unknown region U matting processing region U M in the small area where the number of pixels is less than the threshold value Th 1, the pixel values of corresponding pixels of TRIMAP to 170. Figure 10 shows an example of classifying the unknown region U segmentation processing region U S and matting processing region U M in each small region.
以上の処理により、前景領域Fと背景領域Bを含み、TRIMAPの未知領域Uをセグメンテーション処理領域USとマッティング処理領域UMに分類したQUADMAPが生成される。 By the above process, comprises a foreground region F and the background region B, QUADMAP classified unknown region U TRIMAP segmentation processing region U S and matting processing region U M is generated.
なお、上記のステップS24,S25では、閾値画像を小領域に分割し、小領域ごとに未知領域Uを分類したが、画素ごとに未知領域Uを分類してもよい。具体的には、ステップS23で閾値画像が得られた後、未知領域U内の画素を中心とする半径10ピクセルの円内に存在する画素値が255の画素数を数える。例えば、図11に示す円内に存在する白い画素の数を数える。数えた画素数に基づき、中心の画素をセグメンテーション処理領域US又はマッティング処理領域UMに分類する。以上の処理を未知領域U内の全ての画素について行う。この方法は小領域に分割する領域判別方法よりも正確に未知領域Uを分類できるが、画素ごとに領域を判別するので処理時間がかかる。 In the above steps S24 and S25, the threshold image is divided into small regions, and the unknown region U is classified for each small region. However, the unknown region U may be classified for each pixel. Specifically, after the threshold image is obtained in step S23, the number of pixels having a pixel value of 255 in a circle having a radius of 10 pixels centering on the pixels in the unknown area U is counted. For example, the number of white pixels existing in the circle shown in FIG. 11 is counted. Based on the number of pixels counted, to classify the center pixel in the segmentation process area U S or matting process area U M. The above processing is performed for all the pixels in the unknown area U. This method can classify the unknown area U more accurately than the area discrimination method of dividing into small areas, but it takes a long processing time because the area is discriminated for each pixel.
[マッティング処理]
次に、マッティング処理について説明する。
[Matting process]
Next, the matting process will be described.
図12は、マッティング処理の流れを示すフローチャートである。 FIG. 12 is a flowchart illustrating the flow of the matting process.
マッティング処理部14は、前景領域F及び背景領域Bのそれぞれから前景領域Fと背景領域Bの輪郭を示す輪郭線画素を抽出する(ステップS41)。 The matting processing unit 14 extracts a contour pixel indicating the contour of the foreground area F and the background area B from each of the foreground area F and the background area B (step S41).
ここで、輪郭線画素を抽出する処理を図13のフローチャートに従って説明する。 Here, the process of extracting the contour pixels will be described with reference to the flowchart of FIG.
マッティング処理部14は、QUADMAPを走査し、前景領域Fと未知領域Uとの境界、及び背景領域Bと未知領域Uとの境界にある変化点を探索する(ステップS411)。 The matting processing unit 14 scans the QUADMAP to search for a change point at the boundary between the foreground area F and the unknown area U and the boundary between the background area B and the unknown area U (step S411).
そして、変化点を輪郭線画素に含むか否か判断する(ステップS412)。変化点を輪郭線画素に含むか否かは、前に抽出した輪郭線画素との距離、角度、間隔などに基づいて判断してもよいが、本実施形態では、サンプリング係数を0.75とした確率に従ってランダムに決定する。 Then, it is determined whether or not the change point is included in the contour line pixel (step S412). Whether or not the change point is included in the contour pixel may be determined based on the distance, angle, interval, and the like with respect to the previously extracted contour pixel. In the present embodiment, the sampling coefficient is set to 0.75. Randomly determined according to the probability.
図14に背景領域Bと未知領域Uとの境界にある画素の例を示す。図15に背景領域Bの輪郭線画素として抽出された画素の例を示す。図15の画素b1,b2は、輪郭線画素として抽出されていない画素である。 FIG. 14 shows an example of pixels at the boundary between the background area B and the unknown area U. FIG. 15 shows an example of a pixel extracted as a contour line pixel of the background area B. The pixels b1 and b2 in FIG. 15 are pixels that have not been extracted as contour pixels.
輪郭線画素を抽出する別の方法としては、一定間隔ごとに輪郭線画素から画素を取り除いてもよい。例えば、QUADMAP全体を走査して前景領域Fと背景領域Bの輪郭線画素を抽出した後、輪郭線画素から所定の間隔ごとに画素を取り除く。これにより、等間隔で輪郭線を間引くことができ、精緻さに期待が持てる。 As another method of extracting the contour pixels, pixels may be removed from the contour pixels at regular intervals. For example, after scanning the entire QUADMAP to extract contour pixels of the foreground area F and the background area B, pixels are removed from the contour pixels at predetermined intervals. As a result, contour lines can be thinned out at equal intervals, and expectations can be placed on the precision.
図12に戻り、マッティング処理部14は、ステップS41で抽出した輪郭線画素から候補点を選出する(ステップS42)。マッティング処理部14は、マッティング処理領域UMに属する画素とステップS41で抽出した輪郭線画素との間のユークリッド距離に基づき、輪郭線画素から当該画素のカラーサンプリング手法のための候補点を選出する。例えば、マッティング処理領域UMに属する画素に近い順に前景領域Fの輪郭線画素と背景領域Bの輪郭線画素のそれぞれから10個の候補点を選出する。候補点の数は、カラーサンプリング手法に対して十分な精度を保つことができる個数でよい。 Returning to FIG. 12, the matting processing unit 14 selects a candidate point from the contour pixels extracted in step S41 (step S42). Matting processing unit 14, based on the Euclidean distance between the contour pixels extracted by the pixel and step S41 belonging to matting treatment region U M, the candidate points for color sampling method of the pixel from the contour pixel elect. For example, selects the 10 candidate points from each contour pixel matting processing region U M contour pixel and the background area of the foreground region F in order close to the pixel belonging to B. The number of candidate points may be a number that can maintain sufficient accuracy for the color sampling method.
なお、本実施形態では、近隣画素において候補点を共有することで、候補点を選出する際の距離計算回数を削減する。ここで、候補点の共有について図16のフローチャートに従って説明する。 In the present embodiment, the number of distance calculations when selecting a candidate point is reduced by sharing the candidate point between neighboring pixels. Here, sharing of candidate points will be described with reference to the flowchart of FIG.
マッティング処理部14は、マッティング処理領域UMにwindowを設定する(ステップS421)。図17に示すように、本実施形態では9×9画素の正方形のwindowを設定する。 Matting processor 14 sets the window to matting treatment region U M (step S421). As shown in FIG. 17, in the present embodiment, a square window of 9 × 9 pixels is set.
マッティング処理部14は、windowの中心画素pがマッティング処理領域UMに属するか否か判定する(ステップS421)。中心画素pがマッティング処理領域UMに属していない場合(ステップS421のNO)、マッティング処理部14は、window内で候補点を共有せずに、そのwindow内の中心画素p以外の画素qlm(∈UM, l,m=0,...,8)について候補点を求める(ステップS426)。 Matting processing unit 14, the central pixel p window determines whether belonging to the matting treatment region U M (step S421). If the center pixel p does not belong to the matting treatment region U M (NO in step S421), matting processing unit 14, without sharing the candidate points in the window, the pixels other than the center pixel p in the window q lm (∈U M, l, m = 0, ..., 8) determining a candidate point for (step S426).
中心画素pがマッティング処理領域UMに属する場合(ステップS421のYES)、中心画素pについて候補点を求める(ステップS423)。図17では、前景領域Fの輪郭線画素fの中から10個の候補点fsを求め、背景領域Bの輪郭線画素bの中から10個の候補点bsを求めている。 If the center pixel p belongs to the matting treatment region U M (YES in step S421), determining a candidate point for the central pixel p (step S423). In FIG. 17, ten candidate points fs are obtained from the contour pixels f of the foreground area F, and ten candidate points bs are obtained from the contour pixels b of the background area B.
マッティング処理部14は、中心画素pの候補点をwindow内の画素qlmと共有するか否か判断する(ステップS424)。候補点を共有するか否かの判断は、中心画素pと画素qlmの画素値などに基づいて判断できる。本実施形態では、同じwindow内では候補点を共有すると判断して、ステップS424は必ずYESに進む。 Matting processing unit 14 determines whether to share the candidate point of the center pixel p and the pixel q lm in window (step S424). The determination as to whether to share the candidate point can be made based on the pixel values of the center pixel p and the pixel qlm . In the present embodiment, it is determined that the candidate points are shared in the same window, and the process of step S424 always proceeds to YES.
マッティング処理部14は、画素qlmの候補点を中心画素pの候補点で共有する(ステップS425)。図17の例では、画素qlmの候補点を、中心画素pの候補点fs,bsと同じにする。 The matting processing unit 14 shares the candidate point of the pixel qlm with the candidate point of the center pixel p (step S425). In the example of FIG. 17, the candidate point of the pixel q lm is set to be the same as the candidate point fs, bs of the center pixel p.
マッティング処理領域UMに属する全ての画素について候補点を求めるまでステップS422〜S426までの処理を繰り返す(ステップS472)。 For all pixels belonging to the matting treatment region U M to determine the candidate point to repeat the processing from step S422~S426 (step S472).
なお、上記のステップS424において、中心画素pの画素値と画素qlmの画素値を比較し、画素値の差が閾値εより小さいときは中心画素pの候補点を画素qlmと共有すると判断し、画素値の差が閾値ε以上のときは候補点を共有しないと判断してもよい。画素の色が似ている場合、マスクに用いる透過度も似ていると考えられるため、候補点の共有による近似が正解値に近づく。画素値としてRGBなどの3チャンネルを用いてもよいし、画素の輝度を用いてもよい。 In the above step S424, determines that compares the pixel values of the pixel q lm of the central pixel p, when the difference between the pixel values is less than the threshold value ε share a candidate point of center pixel p and the pixel q lm However, when the pixel value difference is equal to or larger than the threshold value ε, it may be determined that the candidate points are not shared. When the colors of the pixels are similar, it is considered that the transmittance used for the mask is also similar, so that the approximation by sharing the candidate points approaches the correct value. Three channels such as RGB may be used as the pixel value, or the luminance of the pixel may be used.
図12に戻り、マッティング処理部14は、ステップS42で選出した前景領域Fの候補点と背景領域Bの候補点の全ての組み合わせに対してα値と信頼度f値を計算する(ステップS43)。本実施形態では、f値の高い3つのα値とf値を平均し、画素pijの初期α値と信頼度f値とする。 Returning to FIG. 12, the matting processing unit 14 calculates the α value and the reliability f value for all combinations of the candidate points of the foreground area F and the candidate points of the background area B selected in step S42 (step S43). ). In the present embodiment, three α values having high f values and the f value are averaged to obtain the initial α value and the reliability f value of the pixel p ij .
また、マッティング処理部14は、マッティング処理領域UMの全ての画素pijについて、画素pijの周辺を含めた9画素で平均と分散共分散行列を求め、重みWijを求める(ステップS44)。 Further, matting processing unit 14, for all the pixels p ij matting processing region U M, calculates the average and variance-covariance matrix in nine pixels including the peripheral pixels p ij, obtains the weight W ij (step S44).
マッティング処理部14は、画素pijに対し、f値の高いものは初期α値を用い、f値の低いものについては重みWijを用いてα値を更新する(ステップS45)。 The matting processing unit 14 updates the α value of the pixel p ij using the initial α value for a pixel having a high f value and using the weight W ij for a pixel having a low f value (step S45).
なお、上記ステップS43〜S45の処理は、非特許文献2に記載のものを利用できる。 Note that the processes in steps S43 to S45 described in Non-Patent Document 2 can be used.
マッティング処理部14は、ステップS45で求めたα値(0〜1.0)に255を乗算した値でマッティング処理領域UMの画素値を求めてマスク画像を生成する(ステップS46)。 Matting processing unit 14 obtains the pixel values of the matting process area U M with the value obtained by multiplying 255 to the α value obtained in step S45 (0 to 1.0) to generate the mask image (step S46).
以上の処理により、マッティング処理領域UMの各画素のα値を求めることができる。 By the above processing, it is possible to obtain the α value of each pixel of the matting treatment region U M.
以上説明したように、本実施形態では、入力部11が元画像と、元画像に対して前景領域Fと背景領域Bと未知領域Uのラベルを付与したラベル画像を入力し、領域判別部12が元画像から得られる特徴量に基づいて未知領域Uをセグメンテーション処理領域USとマッティング処理領域UMに分類し、セグメンテーション処理部13がセグメンテーション処理領域USの画素を前景と背景に分け、マッティング処理部14がマッティング処理領域UMの画素の透過度を求め、画像統合部15がセグメンテーション処理部13とマッティング処理部14の処理結果を統合してマスク画像を生成し、マスク画像を用いて元画像から被写体の写った前景画像を抽出する。本実施形態によれば、未知領域Uを、セグメンテーション処理を適用しても精緻さが損なわれないセグメンテーション処理領域USと精緻だが時間がかかるマッティング処理を適用するマッティング処理領域UMに分類することで、マッティング処理を適用する領域を少なくすることができるので、精緻さを保ちつつ、高速化を図ることができる。 As described above, in the present embodiment, the input unit 11 inputs an original image and a label image in which labels of the foreground area F, the background area B, and the unknown area U are added to the original image, and the area discriminating unit 12 There classifies unknown region U segmentation processing region U S and matting processing region U M based on the feature amount obtained from the original image, the segmentation processing unit 13 divides the pixels of the segmentation process area U S to the foreground and background, matting processor 14 obtains the transmittance of the pixels of the matting treatment region U M, the image integration unit 15 generates a mask image by integrating the processing result of the segmentation processing unit 13 and the matting unit 14, the mask image Is used to extract a foreground image in which the subject is captured from the original image. According to this embodiment, classifying the unknown region U, the matting treatment region U M but is refined and segmentation processing region U S intact sophistication be applied segmentation process of applying the matting process takes time By doing so, the area to which the matting process is applied can be reduced, so that high-speed operation can be achieved while maintaining precision.
本実施形態によれば、マッティング処理部14がカラーサンプリング手法を用いるにあたり、前景領域Fと背景領域Bの輪郭線画素を離散的に抽出することにより、マッティング処理領域UMの対象画素と輪郭線画素との距離計算回数を削減し、高速化を図ることができる。 According to this embodiment, when matting processor 14 uses the color sampling techniques, by discretely extracted contour pixels of the foreground region F and the background region B, a target pixel matting processing region U M It is possible to reduce the number of times of calculation of the distance to the contour pixel and increase the speed.
本実施形態によれば、マッティング処理部14がカラーサンプリング手法を用いるにあたり、マッティング処理領域UMの対象画素と輪郭線画素から選択した候補点との位置関係に基づいて透過度を求める処理において、近接する対象画素については候補点を共有することで、候補点の選択回数を削減し、高速化を図ることができる。 According to this embodiment, when matting processor 14 use a color sampling technique, seeking permeability based on the positional relationship between the candidate points selected from the target pixel and contour pixels matting processing region U M processing In, by sharing the candidate points for adjacent target pixels, the number of selections of the candidate points can be reduced and the speed can be increased.
1…画像処理装置
11…入力部
12…領域判別部
13…セグメンテーション処理部
14…マッティング処理部
15…画像統合部
16…出力部
DESCRIPTION OF SYMBOLS 1 ... Image processing apparatus 11 ... Input part 12 ... Area discrimination part 13 ... Segmentation processing part 14 ... Matting processing part 15 ... Image integration part 16 ... Output part
Claims (7)
前記処理対象画像から得られる特徴量に基づいて前記未知領域を第1領域と第2領域に分類する領域判別手段と、
前記第1領域に対してセグメンテーションを行い、前記第1領域の各画素を前記前景領域と前記背景領域に分類するセグメンテーション処理手段と、
前記第2領域に対してアルファマッティングを行い、前記第2領域の各画素の透過度を求めるマッティング処理手段と、
前記前景領域、前記背景領域、前記第1領域に対する処理結果と前記第2領域に対する処理結果を統合したマスク画像を用いて前記処理対象画像から前景画像を抽出する画像抽出手段と、
を有することを特徴とする画像処理装置。 Input means for inputting information that classifies the processing target image and the processing target image into a foreground area, a background area, and an unknown area;
Area determining means for classifying the unknown area into a first area and a second area based on a feature amount obtained from the processing target image;
Segmentation processing means for performing segmentation on the first area, and classifying each pixel of the first area into the foreground area and the background area;
Matting processing means for performing alpha matting on the second area to determine the transmittance of each pixel in the second area;
An image extraction unit that extracts a foreground image from the processing target image using a mask image obtained by integrating the processing result for the foreground region, the background region, and the first region with the processing result for the second region;
An image processing apparatus comprising:
処理対象画像と前記処理対象画像を前景領域、背景領域、未知領域に分類した情報を入力するステップと、
前記処理対象画像から得られる特徴量に基づいて前記未知領域を第1領域と第2領域に分類するステップと、
前記第1領域に対してセグメンテーションを行い、前記第1領域の各画素を前記前景領域と前記背景領域に分類するステップと、
前記第2領域に対してアルファマッティングを行い、前記第2領域の各画素の透過度を求めるステップと、
前記前景領域、前記背景領域、前記第1領域に対する処理結果と前記第2領域に対する処理結果を統合したマスク画像を用いて前記処理対象画像から前景画像を抽出するステップと、
を有することを特徴とする画像処理方法。 An image processing method executed by the image processing device,
Inputting information that classifies the processing target image and the processing target image into a foreground area, a background area, and an unknown area;
Classifying the unknown area into a first area and a second area based on a feature amount obtained from the processing target image;
Performing a segmentation on the first area to classify each pixel of the first area into the foreground area and the background area;
Performing alpha matting on the second area to determine the transmittance of each pixel in the second area;
Extracting a foreground image from the processing target image using a mask image obtained by integrating the processing result for the foreground region, the background region, and the first region with the processing result for the second region;
An image processing method comprising:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2017031325A JP6676563B2 (en) | 2017-02-22 | 2017-02-22 | Image processing apparatus, image processing method, and image processing program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2017031325A JP6676563B2 (en) | 2017-02-22 | 2017-02-22 | Image processing apparatus, image processing method, and image processing program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2018136789A JP2018136789A (en) | 2018-08-30 |
| JP6676563B2 true JP6676563B2 (en) | 2020-04-08 |
Family
ID=63365543
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2017031325A Active JP6676563B2 (en) | 2017-02-22 | 2017-02-22 | Image processing apparatus, image processing method, and image processing program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6676563B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110008832A (en) * | 2019-02-27 | 2019-07-12 | 西安电子科技大学 | Based on deep learning character image automatic division method, information data processing terminal |
| CN114926491B (en) * | 2022-05-11 | 2024-07-09 | 北京字节跳动网络技术有限公司 | Matting method and device, electronic equipment and storage medium |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8625888B2 (en) * | 2010-07-21 | 2014-01-07 | Microsoft Corporation | Variable kernel size image matting |
| JP6194692B2 (en) * | 2013-08-22 | 2017-09-13 | 大日本印刷株式会社 | Trimap generation device, Trimap generation method, and program |
| EP2869265A1 (en) * | 2013-10-30 | 2015-05-06 | Thomson Licensing | Method and apparatus for alpha matting |
| JP6355346B2 (en) * | 2014-01-29 | 2018-07-11 | キヤノン株式会社 | Image processing apparatus, image processing method, program, and storage medium |
-
2017
- 2017-02-22 JP JP2017031325A patent/JP6676563B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2018136789A (en) | 2018-08-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107862698B (en) | Light field foreground segmentation method and device based on K mean cluster | |
| TWI766201B (en) | Methods and devices for biological testing and storage medium thereof | |
| JP4898800B2 (en) | Image segmentation | |
| US10303983B2 (en) | Image recognition apparatus, image recognition method, and recording medium | |
| KR101670282B1 (en) | Video matting based on foreground-background constraint propagation | |
| KR101223046B1 (en) | Image segmentation device and method based on sequential frame imagery of a static scene | |
| CN108320294B (en) | An intelligent automatic replacement method for portrait background of second-generation ID card photos | |
| CN109214420A (en) | The high texture image classification method and system of view-based access control model conspicuousness detection | |
| CN110909724B (en) | A thumbnail generation method for multi-target images | |
| JP2002305667A (en) | Method and device for automatically correcting color defect | |
| CN107038719A (en) | Depth estimation method and system based on light field image angle domain pixel | |
| CN106295640A (en) | The object identification method of a kind of intelligent terminal and device | |
| CN103530638A (en) | Method for matching pedestrians under multiple cameras | |
| Zhang et al. | Detecting and extracting the photo composites using planar homography and graph cut | |
| CN114283103B (en) | A multi-depth fusion technology for ultra-high-definition panoramic images during AIT process of manned spacecraft | |
| CN105701813A (en) | Significance detection method of light field image | |
| CN108376409B (en) | A light field image registration method and system | |
| CN105184808A (en) | Automatic segmentation method for foreground and background of optical field image | |
| US8670609B2 (en) | Systems and methods for evaluating images | |
| JP6676563B2 (en) | Image processing apparatus, image processing method, and image processing program | |
| Reddy et al. | A comparative study on object detection using retinanet | |
| Ayub et al. | CNN and Gaussian Pyramid-Based Approach For Enhance Multi-Focus Image Fusion | |
| CN104778468B (en) | Image processing device, image processing method, and monitoring device | |
| Qin et al. | Enhanced depth estimation for hand-held light field cameras | |
| Sheng et al. | Dark channel prior-based altitude extraction method for a single mountain remote sensing image |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190220 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20200124 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20200204 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20200220 |
|
| 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: 20200310 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200312 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 6676563 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| S533 | Written request for registration of change of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313533 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |