JP2015186224A - Image processing device, image processing method, and program - Google Patents

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

Info

Publication number
JP2015186224A
JP2015186224A JP2014063846A JP2014063846A JP2015186224A JP 2015186224 A JP2015186224 A JP 2015186224A JP 2014063846 A JP2014063846 A JP 2014063846A JP 2014063846 A JP2014063846 A JP 2014063846A JP 2015186224 A JP2015186224 A JP 2015186224A
Authority
JP
Japan
Prior art keywords
region
area
pixel
trimap
image
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
JP2014063846A
Other languages
Japanese (ja)
Other versions
JP6343998B2 (en
Inventor
靖寿 松葉
Yasuhisa Matsuba
靖寿 松葉
セドリック オドラ
Audras Cedric
セドリック オドラ
河合 直樹
Naoki Kawai
直樹 河合
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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2014063846A priority Critical patent/JP6343998B2/en
Publication of JP2015186224A publication Critical patent/JP2015186224A/en
Application granted granted Critical
Publication of JP6343998B2 publication Critical patent/JP6343998B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Studio Circuits (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a try-map generating device and so on for fully automatically generating a try-map for appropriately performing chroma key processing.SOLUTION: A try-map generating section 13 for an image processing device 100: accepts an input of an original image resulting from photographing a subject (S101); accepts an input of the position of a subject (S102); generates a silhouette image of the original image (S103); generates a try-map on the basis of the silhouette image (S104); then performs threshold processing on color space, thereby updating the try-map (S105); updates the inside of the breast area of the try-map to a foreground region (S106); subsequently, performs jaw lower line update processing (S107); updates the undetermined area of an area below the jaw lower line, to a foreground region (S108); then performs in-matrix counter processing and expansion processing (S109, S110); and generates a try-map used by the alpha mask generating section 14.

Description

本発明は、被写体画像から被写体領域を抜き出して所望の画像に合成する画像処理装置等に関するものであり、更に詳しくは、被写体画像を前景領域と背景領域と未確定領域とに自動的に分類して画像合成するためのトライマップを生成する画像処理装置等に関するものである。   The present invention relates to an image processing apparatus that extracts a subject area from a subject image and combines it with a desired image. More specifically, the subject image is automatically classified into a foreground area, a background area, and an undetermined area. The present invention relates to an image processing device that generates a trimap for image synthesis.

証明写真ボックスのサービスには、撮影した画像を対象にした様々な画像加工サービス(背景合成、美肌補正等)が存在し、その1つとしてクロマキー処理がある。クロマキー処理とは、単色の背景で撮影した被写体画像から被写体画像領域(以下、前景領域と表記)を抽出して、任意の背景画像に合成する処理である。   The ID photo box service includes various image processing services (background synthesis, skin softening correction, etc.) for captured images, and one of them is chroma key processing. The chroma key processing is processing for extracting a subject image region (hereinafter referred to as a foreground region) from a subject image photographed with a single color background and combining it with an arbitrary background image.

クロマキー処理には、色情報に基づく前景領域抽出手法が適用されるのが一般的である。色情報に基づく前景領域抽出手法として、非特許文献1〜3に記載の技術が知られている。   For chroma key processing, a foreground region extraction method based on color information is generally applied. Techniques described in Non-Patent Documents 1 to 3 are known as foreground region extraction methods based on color information.

非特許文献1には、グレー画像を対象にして、所望の画像領域に前景領域を表すマーカー、及びそれ以外の領域(背景領域)を表すマーカーを予めユーザが付与し、付与されたマーカーに基づいて、グラフカット(Graph Cuts)により前景領域を抽出する技術が記載されている。   In Non-Patent Document 1, for a gray image, a user assigns a marker representing a foreground region and a marker representing another region (background region) in a desired image region in advance, and based on the given marker Thus, a technique for extracting a foreground region by Graph Cuts is described.

非特許文献2には、カラー画像を対象にして、グラフカットを応用して前景領域を抽出する技術が記載されている。   Non-Patent Document 2 describes a technique for extracting a foreground region by applying a graph cut to a color image.

非特許文献3には、原画像を前景領域、背景領域、前景領域と背景領域のいずれに属すか不明の未確定領域の3つの領域に分類したマップ(以下、トライマップと表記)を予め作成し、未確定領域における前景画像領域の画素、背景領域の画素の混合比率(以下、α値と表記)を推定することで、前景領域を抽出する技術が記載されている。   Non-Patent Document 3 creates in advance a map (hereinafter referred to as a trimap) in which an original image is classified into three areas: a foreground area, a background area, and an indeterminate area that is unknown whether it belongs to a foreground area or a background area. A technique for extracting a foreground area by estimating a mixture ratio of pixels in a foreground image area and pixels in a background area (hereinafter referred to as α value) in an undetermined area is described.

Y.Boykov, M. Jolly, “Interactive graph cuts for optimal boundary and regionsegmentation of objects in N-Dimages”, ICCV, 2001Y. Boykov, M. Jolly, “Interactive graph cuts for optimal boundary and region segmentation of objects in N-Dimages”, ICCV, 2001 C.Rother, V. Kolmogorov, A. Blake, “Grabcut - interactive foreground extractionusing iterated graph cuts”,SIGGRAPH, 2004C.Rother, V. Kolmogorov, A. Blake, “Grabcut-interactive foreground extractionusing iterated graph cuts”, SIGGRAPH, 2004 C.Rhemann, C. Rother, A. Rav-Acha, T. Sharp, “High Resolution Matting viaInteractive Trimap Segmentation”,CVPR, 2008C. Rhemann, C. Rother, A. Rav-Acha, T. Sharp, “High Resolution Matting via Interactive Trimap Segmentation”, CVPR, 2008

しかしながら、非特許文献1〜3に記載の技術では、前景領域、背景領域等の領域指定を手作業で入力する必要があり、証明写真ボックス等の無人機器へそのまま適用するのは困難である。   However, in the techniques described in Non-Patent Documents 1 to 3, it is necessary to manually input region designations such as the foreground region and the background region, and it is difficult to directly apply to unmanned devices such as ID photo boxes.

また、仮に自動でトライマップを作成するとしても、前景領域に背景色に類似する色が含まれている場合にその領域が背景領域と判定されることや、被写体の髪の毛の間やレース等の透け感のある洋服に背景が混ざる場合に前景領域と背景領域の区別が困難であることがあった。   Even if a trimap is automatically created, if the foreground area contains a color similar to the background color, the area is determined to be a background area, and the subject's hair, lace, etc. When the background is mixed with transparent clothes, it may be difficult to distinguish the foreground area from the background area.

本発明は、前述した問題点に鑑みてなされたもので、その目的とすることは、適切にクロマキー処理を実行するためのトライマップを全自動で生成する画像処理装置等を提供することである。   The present invention has been made in view of the above-described problems, and an object of the present invention is to provide an image processing apparatus that automatically generates a trimap for appropriately executing chroma key processing. .

前述の課題を解決するために第1の発明は、被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理装置であって、前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定手段と、前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定手段と、前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定手段と、前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定手段と、を備えることを特徴とする画像処理装置である。
第1の発明の画像処理装置によれば、原画像の前景領域中に、背景と類似する色が存在する場合や、背景が透き通る領域が存在する場合においても、適切にクロマキー合成処理を実行することが可能なトライマップを自動的に生成することができる。
In order to solve the above-described problem, the first invention is configured such that each pixel constituting an original image obtained by photographing the upper body of a subject includes a background region, a foreground region that is a portion of the subject, and the background region or the foreground region. An image processing apparatus for generating a trimap that is a ternary image classified into an uncertain area that is unknown to which of the above, a silhouette specifying unit that binarizes the original image and specifies the silhouette of the subject; , Specifying pixels outside the silhouette as pixels in the background region, specifying pixels within the silhouette as pixels in the undetermined region, and selecting pixels in the skin color region of the subject among the pixels in the undetermined region Skin area specifying means for updating to a foreground area to generate the trimap, and specifying a breast area by specifying a neck position of the subject, and a pixel corresponding to the breast area is set to the front area Chest area specifying means for updating the area, color histogram determination means for determining the hair length of the subject, generating a color histogram in different ranges, and updating the trimap using the color histogram, An image processing apparatus comprising:
According to the image processing apparatus of the first invention, the chroma key composition process is appropriately executed even when a color similar to the background exists in the foreground area of the original image or an area where the background is transparent exists. The possible tri-map can be automatically generated.

また、前記シルエット特定手段は、背景色を基に生成した2値化画像と、前記原画像を輪郭抽出処理して生成したエッジ画像とから、シルエットを特定することが望ましい。
これにより、被写体の髪の毛が背景色と混合しているような原画像に対しても、適切にトライマップを生成することができる。
Further, it is preferable that the silhouette specifying means specifies a silhouette from a binarized image generated based on a background color and an edge image generated by performing contour extraction processing on the original image.
Thereby, it is possible to appropriately generate a trimap even for an original image in which the subject's hair is mixed with the background color.

また、前記肌領域特定手段の特定した前記未確定領域の画素を前記背景色に基づいて、前記被写体の顎下ラインより上の領域と下の領域とでそれぞれ異なる閾値を用いて前記トライマップを更新する閾値判定手段を更に備えることが望ましい。
これにより、被写体の顔や髪の毛の領域である顎下ラインより上の領域と、被写体の洋服の領域である顎下ラインより下の領域とに分けて、未確定領域の画素を分類することができるため、背景との区別が困難な領域(原画像上で、背景画素と前景画素がミックスされている状態)については、未確定画素のままとすることが可能となる。従って、トライマップ(3値画像)生成後の背景画像との合成処理において、違和感のない合成が期待できる。もし、背景との区別が困難な領域において、背景画素もしくは前景画素として判定した場合、急激な色の変化により、合成後の結果に違和感が生じることとなる。
Further, the trimap is determined by using different threshold values for the region above and below the lower jaw line of the subject based on the background color of the pixels of the undefined region specified by the skin region specifying unit. It is desirable to further include a threshold determination means for updating.
As a result, the pixels of the undetermined region can be classified into a region above the submandibular line that is the region of the subject's face and hair and a region below the submandibular line that is the region of the subject's clothes. Therefore, an area that is difficult to distinguish from the background (a state in which background pixels and foreground pixels are mixed on the original image) can be left as undetermined pixels. Therefore, in the synthesis process with the background image after the generation of the trimap (ternary image), synthesis without a feeling of strangeness can be expected. If it is determined as a background pixel or a foreground pixel in a region that is difficult to distinguish from the background, a sudden color change may cause a sense of incongruity in the combined result.

また、前記胸元領域特定手段は、首元探索領域を設定し、X軸方向における前記前景領域の画素数と前記未確定領域の画素数を比較することで前記首元位置を特定することが望ましい。
これにより、首元の位置を正確に特定できるため、服の領域に背景色に類似する色(例えば、ネクタイの色)が含まれる場合であっても、前景領域に特定することができる。
In addition, it is preferable that the chest area specifying unit sets a neck search area, and specifies the neck position by comparing the number of pixels in the foreground area and the number of pixels in the undetermined area in the X-axis direction. .
Thereby, since the position of the neck can be specified accurately, even if the clothes area includes a color similar to the background color (for example, the color of the tie), it can be specified as the foreground area.

また、前記色ヒストグラム判定手段は、判定した髪の長さにより前記被写体の前記顎下ラインを特定し、特定した前記顎下ライン以下の領域の前記前景領域に対応する前記原画像の各画素値の色ヒストグラムを生成する色ヒストグラム生成手段と、前記トライマップの前記顎下ライン以下の領域の前記未確定領域に対応する前記原画像の各画素値について、前記色ヒストグラム上に存在する色番号と近似または一致するか否かを判定する判定手段と、近似または一致する場合は、前記トライマップにおいて前記未確定領域を構成する当該画素を前記前景領域に更新する第1の更新手段と、を備えることが望ましい。
これにより、顎下ラインより下の領域の未確定領域の画素の中で、被写体の人物の洋服の色に近似または一致する色を持つ画素を、前景領域とすることができる。また、背景との区別が困難な領域(原画像上で、髪の長い被写体によく見られる背景画素と前景画素がミックスされている領域)については、未確定画素のままとすることが可能となる。従って、トライマップ(3値画像)生成後の背景画像との合成処理において、違和感のない合成が期待できる。もし、背景との区別が困難な領域において、背景画素もしくは前景画素として判定した場合、急激な色の変化により、合成後の結果に違和感が生じることとなる。
Further, the color histogram determination unit specifies the submandibular line of the subject based on the determined hair length, and each pixel value of the original image corresponding to the foreground region of the region below the specified submandibular line. Color histogram generation means for generating a color histogram, and for each pixel value of the original image corresponding to the undetermined region below the submandibular line of the trimap, a color number existing on the color histogram, and A determination unit that determines whether or not to approximate or match; and a first update unit that updates the pixel constituting the undetermined region to the foreground region in the trimap when it approximates or matches. It is desirable.
As a result, among the pixels in the undetermined area in the area below the submandibular line, a pixel having a color that approximates or matches the color of the clothes of the subject person can be set as the foreground area. In addition, it is possible to leave undecided pixels in regions that are difficult to distinguish from the background (regions in which background pixels and foreground pixels that are often found in subjects with long hair are mixed on the original image). Become. Therefore, in the synthesis process with the background image after the generation of the trimap (ternary image), synthesis without a feeling of strangeness can be expected. If it is determined as a background pixel or a foreground pixel in a region that is difficult to distinguish from the background, a sudden color change may cause a sense of incongruity in the combined result.

また、前記色ヒストグラム生成手段は、生成した色ヒストグラム上に存在する色番号のうち、当該色番号に属する画素数の少ない色番号を、前記色ヒストグラムから除外することが望ましい。
これにより、当該原画像中の前景領域に存在するノイズを除外する効果が期待できる。
Further, it is preferable that the color histogram generation means excludes color numbers having a small number of pixels belonging to the color number from the color histogram among color numbers existing on the generated color histogram.
Thereby, an effect of excluding noise existing in the foreground region in the original image can be expected.

また、前記色ヒストグラム判定手段が更新した前記トライマップに対して、前記未確定領域を構成する各画素を中心とした所定の大きさのマトリクスを生成し、生成された前記マトリクス内に存在する画素を、前記前景領域、前記背景領域、及び前記未確定領域のいずれに属するかを判定して、それぞれの領域ごとの画素数をカウントするマトリクス内カウンタ手段と、前記マトリクス内カウンタ手段によりカウントされた前記前景領域の画素数が、カウントされた前記未確定領域の画素数より多い場合に、前記トライマップにおいて、当該マトリクスの中心の画素を前記前景領域に更新する第2の更新手段と、を更に備えることが望ましい。
これにより、前景領域に囲まれた(内部にある)未確定領域を前景領域とすることができる。
In addition, for the trimap updated by the color histogram determination means, a matrix having a predetermined size centered on each pixel constituting the uncertain region is generated, and pixels existing in the generated matrix Is counted by the in-matrix counter means for determining whether the pixel belongs to the foreground area, the background area, or the undetermined area, and counting the number of pixels for each area. Second updating means for updating, in the trimap, a pixel at the center of the matrix to the foreground area when the number of pixels in the foreground area is larger than the counted number of pixels in the uncertain area; It is desirable to provide.
As a result, an undetermined area surrounded by (inside) the foreground area can be set as the foreground area.

また、前記第2の更新手段は、前記マトリクス内カウンタ手段の生成した前記マトリクス内において、前記背景領域に属する画素が1以上カウントされた場合には、当該マトリクスの中心画素を前記未確定領域と特定することが望ましい。
これにより、背景領域に接する未確定領域は、背景との区別が困難な領域(原画像上で、背景画素と前景画素がミックスされている領域)であり、この領域を未確定画素のままとすることが可能となる。従って上述の効果が得られる。
Further, when the number of pixels belonging to the background area is counted one or more in the matrix generated by the in-matrix counter means, the second update means sets the center pixel of the matrix as the undetermined area. It is desirable to specify.
As a result, the undetermined area in contact with the background area is an area that is difficult to distinguish from the background (the area where the background pixels and foreground pixels are mixed on the original image). It becomes possible to do. Therefore, the above-described effect can be obtained.

第2の発明は、被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理方法であって、前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定ステップと、前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定ステップと、前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定ステップと、前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定ステップと、を含むことを特徴とする画像処理方法である。
第2の発明の画像処理方法によれば、原画像の前景領域中に、背景と類似する色が存在する場合や、背景が透き通る領域が存在する場合においても、適切にクロマキー合成処理を実行することが可能なトライマップを自動的に生成することができる。
According to a second aspect of the present invention, each pixel constituting an original image obtained by photographing the upper body of a subject is assigned to a background region, a foreground region that is a part of the subject, and whether the background region or the foreground region is unknown. An image processing method for generating a trimap that is a ternary image classified into a fixed region, wherein the original image is binarized to specify a silhouette of the subject, and a pixel outside the silhouette is selected from the silhouette A pixel in the background area, a pixel in the silhouette is specified as a pixel in the undefined area, and a pixel in the skin color area of the subject is updated to the foreground area among the pixels in the undefined area. A skin region specifying step for generating a map, a chest region is specified by specifying the neck position of the subject, and a pixel corresponding to the chest region is updated to the foreground region. A region specifying step; and a color histogram determining step of determining a hair length of the subject, generating a color histogram in different ranges, and updating the trimap using the color histogram. This is an image processing method.
According to the image processing method of the second invention, the chroma key composition process is appropriately executed even when a color similar to the background exists in the foreground area of the original image or an area where the background is transparent exists. The possible tri-map can be automatically generated.

第3の発明は、コンピュータを、被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理装置として機能させるためのプログラムであって、前記コンピュータを前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定手段、前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定手段、前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定手段、前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定手段、として機能させるためのプログラムである。
第3の発明のプログラムによれば、原画像の前景領域中に、背景と類似する色が存在する場合や、背景が透き通る領域が存在する場合においても、適切にクロマキー合成処理を実行することが可能なトライマップを自動的に生成することができる。
According to a third aspect of the invention, the computer constitutes each pixel constituting the original image obtained by photographing the upper body of the subject, belonging to the background region, the foreground region that is the portion of the subject, the background region, or the foreground region. A program for causing a computer to function as an image processing apparatus that generates a trimap that is a ternary image classified into an unknown uncertain region, and specifying the silhouette of the subject by binarizing the original image Silhouette specifying means, specifying a pixel outside the silhouette as a pixel in the background area, specifying a pixel in the silhouette as a pixel in the undetermined area, and out of the pixels in the undetermined area in the skin color area of the subject Skin region specifying means for generating a trimap by updating pixels to the foreground region; specifying a chest region by specifying a neck position of the subject; Chest area specifying means for updating the pixel corresponding to the breast area to the foreground area, determining the hair length of the subject, generating color histograms in different ranges, and using the color histogram, the trimap Is a program for functioning as color histogram determination means for updating the image.
According to the program of the third invention, the chroma key composition processing can be appropriately executed even when a color similar to the background exists in the foreground area of the original image or an area where the background is transparent exists. Possible trimaps can be automatically generated.

本発明によって、適切にクロマキー処理を実行するためのトライマップを全自動で生成する画像処理装置等を提供することができる。   According to the present invention, it is possible to provide an image processing apparatus or the like that automatically generates a trimap for appropriately executing chroma key processing.

本実施形態に係る画像処理装置のハードウエアの構成例を示すブロック図1 is a block diagram showing an example of the hardware configuration of an image processing apparatus according to the present embodiment. 本実施形態に係る画像処理装置の機能構成例を示すブロック図1 is a block diagram illustrating an example of a functional configuration of an image processing apparatus according to the present embodiment. 画像処理装置の記憶部が保持するデータの一例An example of data held by the storage unit of the image processing apparatus トライマップ生成処理の流れを示すフローチャートFlow chart showing the flow of trimap generation processing 原画像を説明する図Illustration explaining the original image シルエット画像生成処理の流れを示すフローチャートFlow chart showing the flow of silhouette image generation processing 原画像31にシルエット画像生成処理を施して生成された画像を示す図The figure which shows the image produced | generated by performing the silhouette image production | generation process to the original image 31 原画像36にシルエット画像生成処理を施して生成された画像を示す図The figure which shows the image produced | generated by performing a silhouette image production | generation process to the original image 36 前景領域特定処理の流れを示すフローチャートFlow chart showing the flow of foreground area specifying processing 前景領域特定処理によって生成されたトライマップを示す図The figure which shows the tri map produced | generated by the foreground area | region specific process 色空間上の閾値処理の流れを示すフローチャートA flowchart showing the flow of threshold processing in a color space 色空間上の閾値処理を説明する図A diagram for explaining threshold processing in a color space 首元領域特定処理の流れを示すフローチャートFlow chart showing the flow of the neck area specifying process 首元領域特定処理を説明する図The figure explaining neck area specific processing 顎下ライン更新処理の流れを示すフローチャートFlow chart showing the flow of submandibular line update processing 顎下ライン更新処理を説明する図The figure explaining submandibular line update processing 色ヒストグラム判定処理の流れを示すフローチャートFlow chart showing the flow of color histogram determination processing 色ヒストグラム判定処理後のトライマップを示す図The figure which shows the trimap after color histogram determination processing マトリクス内カウンタ処理の流れを示すフローチャートFlow chart showing flow of counter processing in matrix マトリクス内カウンタ処理を説明する図Diagram explaining counter processing in matrix 膨張処理実行後のトライマップを示す図The figure which shows the tri map after execution of the expansion process アルファマッティング処理を説明する図Diagram explaining alpha matting process アルファマスクを示す図Diagram showing alpha mask

以下、図面に基づいて、本発明の好適な実施形態について詳細に説明する。   Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings.

図1は、本発明の実施形態に係る画像処理装置100を実現するコンピュータのハードウエア構成図である。コンピュータは、図1に示すように、例えば、制御部21、記憶部22、メディア入出力部23、通信制御部24、入力部25、表示部26、周辺機器I/F部27等が、バス28を介して接続されて構成される。   FIG. 1 is a hardware configuration diagram of a computer that realizes an image processing apparatus 100 according to an embodiment of the present invention. As shown in FIG. 1, the computer includes, for example, a control unit 21, a storage unit 22, a media input / output unit 23, a communication control unit 24, an input unit 25, a display unit 26, a peripheral device I / F unit 27, etc. 28 is connected and configured.

制御部21は、CPU(Central
Processing Unit)、ROM(Read Only Memory)、RAM(Random Access Memory)等により構成される。
CPUは、記憶部22、ROM、記憶媒体等に格納されるプログラムをRAM上のワークメモリ領域に呼び出して実行し、バス28を介して接続された各装置を駆動制御し、画像処理装置100が行う後述する処理を実現する。ROMは、不揮発性メモリであり、コンピュータのブートプログラムやBIOS等のプログラム、データ等を恒久的に保持する。RAMは、揮発性メモリであり、ロードしたプログラムや、データ等を一時的に保持すると共に、制御部21が各処理を行うために使用するワークエリアを備える。
The control unit 21 is a CPU (Central
A processing unit (ROM), a read only memory (ROM), a random access memory (RAM), and the like.
The CPU calls a program stored in the storage unit 22, ROM, storage medium, etc. to a work memory area on the RAM and executes it, and drives and controls each device connected via the bus 28. The process to be described later is realized. The ROM is a non-volatile memory and permanently holds a computer boot program, a program such as BIOS, data, and the like. The RAM is a volatile memory, and temporarily stores a loaded program, data, and the like, and includes a work area used by the control unit 21 to perform each process.

記憶部22は、HDD(Hard
Disk Drive)等であり、制御部21が実行するアプリケーションプログラムや、プログラム実行に必要なデータ、OS(Operating System)等が格納されている。これらのプログラムコードは、制御部21により必要に応じて読み出されてRAMに移され、CPUに読み出されて実行される。
The storage unit 22 is an HDD (Hard
The application program executed by the control unit 21, data necessary for program execution, an OS (Operating System), and the like are stored. These program codes are read by the control unit 21 as necessary, transferred to the RAM, and read and executed by the CPU.

メディア入出力部23は、例えば、CDドライブ、DVDドライブ、MOドライブ、フロッピー(登録商標)ディスクドライブ、等のメディア入出力装置であり、原画像等のデータの入出力を行う。
通信制御部24は、通信制御装置、通信ポート等を有し、コンピュータとネットワーク間の通信を媒介する通信インターフェースであり、ネットワークを介して、他の装置間との通信制御を行う。
The media input / output unit 23 is a media input / output device such as a CD drive, a DVD drive, an MO drive, and a floppy (registered trademark) disk drive, and inputs / outputs data such as original images.
The communication control unit 24 includes a communication control device, a communication port, and the like, and is a communication interface that mediates communication between the computer and the network, and controls communication with other devices via the network.

入力部25は、データ入力を行い、例えば、キーボード、マウスなどのポインティングデバイス、テンキーなどの入力装置を有する。入力されたデータを制御部21へ出力する。
表示部26は、例えば、CRTモニタ、液晶パネル等のディスプレイ装置と、ディスプレイ装置と連携して表示処理を実行するための論理回路(ビデオアダプタ等)で構成され、制御部21の制御により入力された表示情報をディスプレイ装置上に表示させる。
尚、入力部25と表示部26は、それらの機能が一体化した、例えば、タッチパネル付ディスプレイであっても良い。
The input unit 25 performs data input and includes, for example, a keyboard, a pointing device such as a mouse, and an input device such as a numeric keypad. The input data is output to the control unit 21.
The display unit 26 includes, for example, a display device such as a CRT monitor or a liquid crystal panel, and a logic circuit (video adapter or the like) for executing display processing in cooperation with the display device, and is input by the control of the control unit 21. The displayed display information is displayed on the display device.
The input unit 25 and the display unit 26 may be, for example, a display with a touch panel in which those functions are integrated.

周辺機器I/F部(インターフェース)27は、コンピュータに周辺機器を接続させるためのポートであり、周辺機器I/F部27を介してコンピュータは周辺機器とのデータの送受信を行う。周辺機器I/F部27は、USBやIEEE1394やRS−232C等で構成されており、通常複数の周辺機器I/Fを有する。周辺機器との接続形態は、有線、無線を問わない。
バス28は、各装置間の制御信号、データ信号等の授受を媒介する経路である。
The peripheral device I / F unit (interface) 27 is a port for connecting a peripheral device to the computer, and the computer transmits and receives data to and from the peripheral device via the peripheral device I / F unit 27. The peripheral device I / F unit 27 is configured by USB, IEEE 1394, RS-232C, or the like, and usually includes a plurality of peripheral devices I / F. The connection form with the peripheral device may be wired or wireless.
The bus 28 is a path that mediates transmission / reception of control signals, data signals, and the like between the devices.

図2は、本実施形態における画像処理装置100の機能構成例を示すブロック図である。図2に示すように、画像処理装置100は、原画像入力部11、被写体の位置入力部12、トライマップ生成部13、アルファマスク生成部14、背景画像合成部15、画像出力部16等で構成される。   FIG. 2 is a block diagram illustrating a functional configuration example of the image processing apparatus 100 according to the present embodiment. As shown in FIG. 2, the image processing apparatus 100 includes an original image input unit 11, a subject position input unit 12, a trimap generation unit 13, an alpha mask generation unit 14, a background image synthesis unit 15, an image output unit 16, and the like. Composed.

画像処理装置100は、トライマップ生成部13によって原画像入力部11から入力された原画像のトライマップを生成し、アルファマスク生成部14によってアルファマスクと前景画像を生成し、背景画像合成部15によって合成画像を生成する。   The image processing apparatus 100 generates a trimap of the original image input from the original image input unit 11 by the trimap generation unit 13, generates an alpha mask and a foreground image by the alpha mask generation unit 14, and a background image synthesis unit 15. To generate a composite image.

原画像入力部11は、例えば、ブルーバック、グリーンバック等の概ね単一色の背景で被写体を撮影した原画像を画像処理装置100に入力する。
原画像は、証明写真ボックス等の撮影場所で人物等の被写体を撮影することによって得られ、メディア入出力部23や入力部25、ネットワークを介して通信制御部24から入力されてもよく、その方法は問わない。
The original image input unit 11 inputs, to the image processing apparatus 100, an original image obtained by photographing a subject with a substantially single color background such as a blue background or a green background.
The original image is obtained by photographing a subject such as a person at a photographing place such as an ID photo box, and may be input from the communication input / output unit 23, the input unit 25, or the communication control unit 24 via the network. It doesn't matter how.

被写体の位置入力部12は、入力された原画像に基づいて、主に入力部25により、被写体の頭頂部、顎、及び、顔の左右の中心の位置の座標値等の情報が入力される。   Based on the input original image, the subject position input unit 12 is input mainly by the input unit 25 with information such as coordinate values of the positions of the top of the subject, the chin, and the center of the left and right sides of the face. .

トライマップ生成部13は、原画像入力部11により入力された原画像に対して、被写体の位置入力部12により入力された情報、記憶部22に記憶されているデータ(図3参照)等を使用して、原画像の各画素を背景領域、前景領域、未確定領域のいずれかに分類したトライマップを生成する。トライマップ生成部13の実行するトライマップ生成処理の詳細は、後述する。   The trimap generation unit 13 receives the information input by the subject position input unit 12, the data stored in the storage unit 22 (see FIG. 3), and the like for the original image input by the original image input unit 11. A trimap is generated by classifying each pixel of the original image into one of a background area, a foreground area, and an undetermined area. Details of the trimap generation processing executed by the trimap generation unit 13 will be described later.

アルファマスク生成部14は、原画像入力部11により入力された原画像と、トライマップ生成部13から取得したトライマップを元に、原画像の各画素のα値を算出し、アルファマスクと前景画像とを生成する。アルファマスク生成部14の実行する処理は、非特許文献4に記載の処理に基づくものである。詳細は後述する。
<非特許文献4> Eduardo
S.L.Gastal, Manuel M.Oliveira, Shared Sampli-ng for Real-Time Alpha Matting,
Computer Graphics Forum Volume 29(2010),
November 2
Proceedings of Eurographics 2010, pp.575-584
The alpha mask generation unit 14 calculates an alpha value of each pixel of the original image based on the original image input by the original image input unit 11 and the trimap acquired from the trimap generation unit 13, and the alpha mask and the foreground Generate an image. The process executed by the alpha mask generation unit 14 is based on the process described in Non-Patent Document 4. Details will be described later.
<Non-Patent Document 4> Eduardo
SLGastal, Manuel M. Oliveira, Shared Sampli-ng for Real-Time Alpha Matting,
Computer Graphics Forum Volume 29 (2010),
November 2
Proceedings of Eurographics 2010, pp.575-584

背景画像合成部15は、アルファマスク生成部14から取得した前景画像と、記憶部22に記憶されている背景画像を、アルファマスク生成部14により生成されたアルファマスクに応じて合成し、合成画像を生成する。背景画像合成部15の実行する処理は、後述する。   The background image synthesizing unit 15 synthesizes the foreground image acquired from the alpha mask generating unit 14 and the background image stored in the storage unit 22 according to the alpha mask generated by the alpha mask generating unit 14, and combines the synthesized image. Is generated. Processing executed by the background image composition unit 15 will be described later.

画像出力部16は、画像合成部16にて合成された合成画像を、表示部26等により出力する。   The image output unit 16 outputs the composite image synthesized by the image synthesis unit 16 by the display unit 26 or the like.

なお、本発明に係る画像処理装置は、本実施形態における画像処理装置100の機能における少なくとも原画像入力部11、被写体の位置入力部12、トライマップ生成部13の機能によって実現されるものである。   The image processing apparatus according to the present invention is realized by at least the functions of the original image input unit 11, the subject position input unit 12, and the trimap generation unit 13 in the functions of the image processing apparatus 100 in the present embodiment. .

図3は、画像処理装置100の記憶部22が保持するデータの一例を示す図である。   FIG. 3 is a diagram illustrating an example of data stored in the storage unit 22 of the image processing apparatus 100.

記憶部22が保持するデータとして、例えば、原画像入力部11から入力される原画像の画像データ22a、原画像の背景色22b、後述するトライマップ生成処理にて使用するソーベルフィルタ22c、マトリクスサイズ22d及び未確定領域の膨張処理回数22e、トライマップ生成部13により生成されるトライマップ22f、アルファマスク生成部14により生成されるアルファマスク22g及び前景画像22h、背景画像合成部15にて使用する背景画像22i、トライマップ生成部13及びアルファマスク生成部14が実行する処理にて使用する各種パラメータ22jである。   As data held by the storage unit 22, for example, image data 22a of an original image input from the original image input unit 11, a background color 22b of the original image, a Sobel filter 22c used in a trimap generation process described later, a matrix Used by the size 22d and the number of uncertain region expansion processes 22e, the trimap 22f generated by the trimap generator 13, the alpha mask 22g and foreground image 22h generated by the alpha mask generator 14, and the background image synthesizer 15. These are various parameters 22j used in processing executed by the background image 22i, the trimap generation unit 13 and the alpha mask generation unit 14.

背景色22bとは、原画像の背景として使用されるブルーバック等の背景の代表色であり、RGB値あるいはHSV表色系等の色相/彩度/明度の組み合わせで指定される。   The background color 22b is a representative color of a background such as a blue background used as the background of the original image, and is specified by a combination of hue / saturation / lightness such as an RGB value or an HSV color system.

[トライマップ生成処理]
続いて、画像処理装置100の制御部21(トライマップ生成部13)が実行するトライマップ生成処理について、図4〜図21を参照して説明する。トライマップ生成処理とは、原画像のトライマップを自動で生成する処理である。
[Trimap generation processing]
Next, trimap generation processing executed by the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 will be described with reference to FIGS. The trimap generation process is a process for automatically generating a trimap of the original image.

図4は、トライマップ生成処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、原画像入力部11から原画像の入力を受付ける(ステップS101)。
FIG. 4 is a flowchart showing the flow of the trimap generation process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 receives the input of the original image from the original image input unit 11 (step S101).

図5は、原画像30、31の例を示す図である。
図5の(a)に示すように、原画像30はブルーバック等を背景30bとした被写体(人物)30aの上半身を撮影した写真の画像データである。ここでは、写真を全体に漫画化してある。背景30bの代表色(背景色22b)は、記憶部22に記憶されている。
FIG. 5 is a diagram illustrating an example of the original images 30 and 31.
As shown in FIG. 5A, the original image 30 is image data of a photograph of the upper body of a subject (person) 30a with a blue background or the like as a background 30b. Here, the entire photo is cartoonized. The representative color (background color 22b) of the background 30b is stored in the storage unit 22.

ここで、被写体30aの一部(例えば、破線で囲む部分30c)に背景30bと類似の色が含まれているとする。その場合、従来手法ではトライマップのその領域が背景領域と判定されてしまい、生成された合成画像の被写体の一部の色が抜けてしまうことがあった。本実施形態のトライマップ生成処理を実行することで、前景領域(被写体30a)内の背景30bに類似する色領域においても、前景領域と判定してトライマップを生成することが可能であり、これにより適切な合成画像を得ることができる。   Here, it is assumed that a color similar to the background 30b is included in a part of the subject 30a (for example, a portion 30c surrounded by a broken line). In that case, in the conventional method, the region of the trimap is determined as the background region, and the color of a part of the subject of the generated composite image may be lost. By executing the trimap generation process of the present embodiment, it is possible to determine a foreground area and generate a trimap even in a color area similar to the background 30b in the foreground area (subject 30a). Thus, an appropriate composite image can be obtained.

図5の(b)に、原画像31の別の例を示す。原画像31は、ブルーバック等を背景31bに撮影した被写体(人物)31aの画像データである。ここでは、写真を全体に漫画化してある。   FIG. 5B shows another example of the original image 31. The original image 31 is image data of a subject (person) 31a obtained by photographing a blue background or the like on a background 31b. Here, the entire photo is cartoonized.

ここで、被写体31aの髪の毛の中(例えば、破線で囲む部分31c、31d)から背景31bが透けて見えるとする。その場合、従来手法ではトライマップのその領域が前景領域と判定されてしまい、生成された合成画像の被写体31aの一部に背景31bの色が残ってしまうことがあった。本実施形態のトライマップ生成処理を実行することで、前景領域(被写体31a)内に背景31bが混ざる領域においても、前景領域、背景領域、未確定領域を適切に分類してトライマップを生成することが可能であり、これにより適切な合成画像を得ることができる。   Here, it is assumed that the background 31b can be seen through the hair of the subject 31a (for example, portions 31c and 31d surrounded by a broken line). In that case, in the conventional method, the region of the trimap is determined to be the foreground region, and the color of the background 31b may remain in a part of the subject 31a of the generated composite image. By executing the tri-map generation process of the present embodiment, a tri-map is generated by appropriately classifying the foreground area, the background area, and the undetermined area even in the area where the background 31b is mixed in the foreground area (subject 31a). This makes it possible to obtain an appropriate composite image.

図4の説明に戻る。画像処理装置100の制御部21(トライマップ生成部13)は、被写体の位置入力部12から、被写体の頭頂部、顎、及び、顔の左右の中心の位置の座標値の入力を受付ける(ステップS102)。   Returning to the description of FIG. The control unit 21 (tri-map generating unit 13) of the image processing apparatus 100 receives input of coordinate values of the positions of the subject's top, chin, and right and left centers of the face from the subject position input unit 12 (step). S102).

画像処理装置100の制御部21(トライマップ生成部13)は、シルエット画像生成処理を実行する(ステップS103)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes a silhouette image generation process (step S103).

シルエット画像生成処理とは、原画像30、31の各画素の色と背景色22bとを比較して生成された2値マスク画像と、原画像30、31を輪郭抽出処理して生成されたエッジ画像とを合成してシルエット画像を生成する処理である。詳細は後述する。   The silhouette image generation process is a binary mask image generated by comparing the color of each pixel of the original images 30 and 31 with the background color 22b, and an edge generated by contour extraction processing of the original images 30 and 31. This is a process of generating a silhouette image by combining the image. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、前景領域特定処理を実行する(ステップS104)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes a foreground region specifying process (step S104).

前景領域特定処理とは、ステップS103にて生成されたシルエット画像からトライマップの未確定領域と背景領域とを特定し、原画像30、31の被写体30a、31aの肌の色から肌マスクを生成し、未確定領域内の肌マスク領域内の画素を前景領域に更新してトライマップを生成する処理である。詳細は後述する。   The foreground area specifying process specifies an undefined area and background area of the trimap from the silhouette image generated in step S103, and generates a skin mask from the skin color of the subjects 30a and 31a of the original images 30 and 31. In this process, the pixels in the skin mask area in the undetermined area are updated to the foreground area to generate a trimap. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、色空間上の閾値処理を実行する(ステップS105)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes threshold processing on the color space (step S105).

色空間上の閾値処理とは、ステップS104にて生成されたトライマップ上の未確定領域に対応する原画像30、31の画素を入力し、各画素の色が、背景色22bと近似していれば当該画素を未確定領域のまま更新せず、背景色22bと近似していなければ当該画素を前景領域に更新する処理である。詳細は後述する。   In the threshold processing in the color space, the pixels of the original images 30 and 31 corresponding to the undetermined region on the trimap generated in step S104 are input, and the color of each pixel approximates the background color 22b. In this case, the pixel is not updated in the undetermined region, and if the pixel is not approximated with the background color 22b, the pixel is updated to the foreground region. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、首元領域特定処理を実行する(ステップS106)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes a neck region specifying process (step S106).

首元領域特定処理とは、ステップS105にて更新されたトライマップ上で被写体の首元の位置を特定し、特定された位置を上端として設定される胸元領域内の画素を全て前景領域に更新する処理である。詳細は後述する。   The neck area specifying process specifies the position of the subject's neck on the trimap updated in step S105, and updates all the pixels in the breast area set with the specified position as the upper end to the foreground area. It is processing to do. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、顎下ライン更新処理を実行する(ステップS107)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes a submandibular line update process (step S107).

顎下ライン更新処理とは、被写体の髪の毛の長さに応じてステップS105にて設定された被写体の顎下ラインを更新する処理である。詳細は後述する。   The submandibular line update process is a process of updating the submandibular line of the subject set in step S105 according to the length of the subject's hair. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、色ヒストグラム判定処理を実行する(ステップS108)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 performs color histogram determination processing (step S108).

色ヒストグラム判定処理とは、ステップS106にて更新されたトライマップの顎下ラインより下の領域内の前景領域の各画素の画素値に基づいて色ヒストグラムを生成し、当該領域内の未確定領域の各画素の画素値が色ヒストグラム上に存在するか否かを判定し、存在する場合には当該画素を前景領域に更新する処理である。詳細は後述する。   The color histogram determination process generates a color histogram based on the pixel value of each pixel in the foreground area in the area below the submandibular line of the trimap updated in step S106, and the undefined area in the area In this process, it is determined whether or not the pixel value of each pixel is on the color histogram, and if it exists, the pixel is updated to the foreground region. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、マトリクス内カウンタ処理を実行する(ステップS109)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes the in-matrix counter process (step S109).

マトリクス内カウンタ処理とは、ステップS108にて更新されたトライマップ内の未確定領域の各画素に対し、当該画素を中心としたマトリクスサイズ22d(図3参照)のマトリクスを配置し、マトリクス内において、前景領域の画素数の占める割合が未確定領域の画素数の占める割合よりも多ければ、当該画素を前景領域に更新する処理である。詳細は後述する。   In the matrix counter process, a matrix having a matrix size 22d (see FIG. 3) centering on the pixel is arranged for each pixel in the undefined region in the trimap updated in step S108. If the ratio of the number of pixels in the foreground area is larger than the ratio of the number of pixels in the undefined area, the pixel is updated to the foreground area. Details will be described later.

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS109にて生成されたトライマップ内の未確定領域の画素に対して、膨張処理を実行してトライマップを生成し(ステップS110)、生成したトライマップを記憶部22に記憶して、処理を終了する。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 generates a trimap by executing dilation processing on the pixels in the undetermined area in the trimap generated in step S109 (step S109). S110), the generated trimap is stored in the storage unit 22, and the process is terminated.

膨張処理とは、未確定領域の画素の周辺の、背景領域又は前景領域の画素を未確定領域とする処理であり、例えば、未確定領域の各画素を中心として、任意の定数によって囲まれる画素領域(例えば、3×3画素、5×5画素)内の画素を、未確定領域とする処理である。   The expansion process is a process in which the pixels in the background area or the foreground area around the pixels in the undetermined area are set as the undetermined area. In this process, pixels in a region (for example, 3 × 3 pixels, 5 × 5 pixels) are set as undefined regions.

画像処理装置100の制御部21(トライマップ生成部13)は、記憶部22に記憶される未確定領域の膨張処理回数22eに応じて、所定回数膨張処理を繰り返す。尚、膨張回数の値が大きい程、演算時間が増大し、高精度な結果が得られる。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 repeats the expansion process a predetermined number of times in accordance with the expansion process count 22e of the undetermined area stored in the storage unit 22. In addition, the calculation time increases as the value of the number of expansions increases, and a highly accurate result can be obtained.

以上の様に、画像処理装置100は、原画像30、31の入力を受付け、シルエット画像生成処理を実行してシルエット画像を生成する。そして、前景領域特定処理を実行して、原画像を前景領域、背景領域、未確定領域に分類するトライマップを生成する。続いて、画像処理装置100は、生成されたトライマップに対して色空間上の閾値処理、首元領域特定処理、顎下ライン更新処理、色ヒストグラム判定処理、マトリクス内カウンタ処理を実行することで、トライマップ内の未確定領域に属する画素を前景領域に更新し、膨張処理を施してトライマップを生成する。   As described above, the image processing apparatus 100 receives the input of the original images 30 and 31 and executes a silhouette image generation process to generate a silhouette image. Then, a foreground area specifying process is executed to generate a trimap that classifies the original image into a foreground area, a background area, and an undetermined area. Subsequently, the image processing apparatus 100 performs threshold processing on the color space, neck area specifying processing, submandibular line update processing, color histogram determination processing, and intra-matrix counter processing on the generated trimap. Then, the pixels belonging to the undetermined area in the trimap are updated to the foreground area, and the expansion process is performed to generate the trimap.

これにより、原画像の前景領域中に、背景と類似する色が存在する場合や、背景が透き通る領域が存在する場合においても、適切にクロマキー合成処理を実行することが可能なトライマップを自動的に生成することができる。   As a result, even if there is a color similar to the background in the foreground area of the original image or there is an area where the background is transparent, a trimap that can execute the chroma key composition processing automatically is automatically generated. Can be generated.

[シルエット画像生成処理]
続いて、画像処理装置100が、図4のステップS103にて実行するシルエット画像生成処理の詳細について、図6〜図8を参照して説明する。尚、ここでは、シルエット画像生成処理を実行して図5の(b)に示す原画像31から図7の(c)に示すシルエット画像35を生成する例について説明する。
[Silhouette image generation processing]
Next, details of the silhouette image generation process performed by the image processing apparatus 100 in step S103 of FIG. 4 will be described with reference to FIGS. Here, an example in which the silhouette image generation process is executed to generate the silhouette image 35 shown in FIG. 7C from the original image 31 shown in FIG. 5B will be described.

図6は、シルエット画像生成処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、原画像31の画素の画素値(色)を入力する(ステップS201)。
FIG. 6 is a flowchart showing a flow of silhouette image generation processing.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the pixel value (color) of the pixel of the original image 31 (step S201).

画像処理装置100の制御部21(トライマップ生成部13)は、入力された画素の色が背景色22bに近似するか否かを判定する(ステップS202)。色の近似性は、例えば、色空間上の距離によって判断される。背景領域とみなす色範囲の許容量は予め設定されている。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not the input pixel color approximates the background color 22b (step S202). The color approximation is determined by, for example, a distance in the color space. The allowable amount of the color range regarded as the background area is set in advance.

近似する場合には(ステップS202のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、入力画素の画素値を0(黒)に特定する(ステップS203)。近似しない場合には(ステップS202のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS204に進む。   In the case of approximation (YES in step S202), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 specifies the pixel value of the input pixel as 0 (black) (step S203). If not approximated (NO in step S202), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 proceeds to step S204.

画像処理装置100の制御部21(トライマップ生成部13)は、原画像31の全ての画素が入力されたか否かを判定する(ステップS204)。入力済みでない場合には(ステップS204のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS201に戻る。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not all the pixels of the original image 31 have been input (step S204). If it has not been input (NO in step S204), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S201.

入力済みの場合には(ステップS204のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、入力された原画像31の各画素の内、ステップS203にて画素値を特定されなかった画素の画素値を255(白)として、2値マスク画像33を生成する(ステップS205)。   If it has been input (YES in step S204), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 specifies a pixel value in step S203 among the pixels of the input original image 31. A binary mask image 33 is generated with the pixel value of the pixel that has not been set as 255 (white) (step S205).

図7の(a)に、原画像31から生成された2値マスク画像33を示す。ステップS203にて背景色22bに近似していると判定された画素を黒で表し、近似していると判定されなかった画素を白で表している。   FIG. 7A shows a binary mask image 33 generated from the original image 31. Pixels determined to be close to the background color 22b in step S203 are represented by black, and pixels that are not determined to be approximate are represented by white.

画像処理装置100の制御部21(トライマップ生成部13)は、原画像31にソーベルフィルタ22cを適用して、エッジ画像34を生成する(ステップS206)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 applies the Sobel filter 22c to the original image 31 to generate the edge image 34 (step S206).

具体的には、原画像31をグレースケール化し、グレースケール化された画像に対してソーベルフィルタ22cを用いて処理し、画像を生成する。生成された画像の画素値を濃淡に応じて2値化し、各画素が255(白)または0(黒)を有するエッジ画像34を生成する。ここで、2値化の際に用いる閾値はなるべく多くのエッジを検出するために、0(黒)に近い方が好ましい。尚、原画像31のエッジ画像34を生成する方法としては、原画像31のエッジを検出可能な方法であれば特に手段を問わない。   Specifically, the original image 31 is converted into a gray scale, and the gray scaled image is processed using the Sobel filter 22c to generate an image. The pixel value of the generated image is binarized according to the density, and an edge image 34 in which each pixel has 255 (white) or 0 (black) is generated. Here, the threshold used for binarization is preferably close to 0 (black) in order to detect as many edges as possible. The method for generating the edge image 34 of the original image 31 is not particularly limited as long as it is a method capable of detecting the edge of the original image 31.

図7の(b)に、原画像31から生成されたエッジ画像34を示す。検出された輪郭を白で示す。   FIG. 7B shows an edge image 34 generated from the original image 31. The detected contour is shown in white.

画像処理装置100の制御部21(トライマップ生成部13)は、2値マスク画像33とエッジ画像34とを合成したシルエット画像35を生成して(ステップS207)して、処理を終了する。シルエット画像35とは、2値マスク画像33またはエッジ画像34において画素値が255(白)を有する画素の画素値を255(白)とし、更に、エッジ画像34のエッジと2値マスク画像33の輪郭に囲まれる領域の画素の画素値を255(白)とし、それ以外の領域の画素の画素値を0(黒)として生成された画像である。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 generates a silhouette image 35 obtained by combining the binary mask image 33 and the edge image 34 (step S207), and ends the process. The silhouette image 35 means that the pixel value of a pixel having a pixel value of 255 (white) in the binary mask image 33 or the edge image 34 is 255 (white), and the edge of the edge image 34 and the binary mask image 33 This is an image generated by setting the pixel value of the pixel in the region surrounded by the outline to 255 (white) and the pixel value of the pixel in the other region to 0 (black).

図7の(c)に、原画像31から生成されたシルエット画像35を示す。
ここで、原画像31の破線で囲む部分31c(図5参照)で髪の毛が被写体31aから飛び出しているが、2値マスク画像33では対応する部分33aにおいてその髪の毛がとぎれてしまい被写体31aの領域として抽出できていない。しかしながら、エッジ画像34の対応する部分34aでは髪の毛がエッジとして検出できているため、シルエット画像35の対応する部分35aでは、その髪の毛も含めた被写体31aの領域が抽出できている。
FIG. 7C shows a silhouette image 35 generated from the original image 31.
Here, the hair protrudes from the subject 31a in the portion 31c (see FIG. 5) surrounded by the broken line of the original image 31, but in the binary mask image 33, the hair is cut off in the corresponding portion 33a and is used as the region of the subject 31a. It has not been extracted. However, since the hair can be detected as an edge in the corresponding portion 34a of the edge image 34, the region of the subject 31a including the hair can be extracted from the corresponding portion 35a of the silhouette image 35.

図8に、別の原画像36にシルエット画像生成処理を適用した例を示す。
図8の(a)に示す原画像36で、被写体36aは背景色に近似した色のストラップを首に下げている(破線で囲まれる部分36b)。このような場合、図8の(b)に示すようにストラップの部分の画素の画素値が0(黒)に特定された2値マスク画像37が生成されてしまう(破線で囲まれる部分37b)。しかしながら、原画像36から生成されたエッジ画像(図示せず)と2値マスク画像37とを合成することで、図8の(c)に示すようにストラップの部分も被写体36aの領域として抽出されたシルエット画像38を生成することができる(破線で囲まれる部分38b)。
FIG. 8 shows an example in which the silhouette image generation process is applied to another original image 36.
In the original image 36 shown in FIG. 8A, the subject 36a has a strap of a color approximating the background color hung around the neck (portion 36b surrounded by a broken line). In such a case, as shown in FIG. 8B, a binary mask image 37 in which the pixel value of the pixel in the strap portion is specified as 0 (black) is generated (portion 37b surrounded by a broken line). . However, by combining the edge image (not shown) generated from the original image 36 and the binary mask image 37, the strap portion is also extracted as the region of the subject 36a as shown in FIG. 8C. A silhouette image 38 can be generated (portion 38b surrounded by a broken line).

以上の様に、画像処理装置100はシルエット画像生成処理を実行して、原画像31の2値マスク画像33とエッジ画像34とを生成し、これらを合成してシルエット画像35を生成する。これにより、背景領域である部分を確実に背景領域に特定し、被写体に含まれる可能性の領域を十分に抽出することができる。シルエット画像35の生成にエッジ画像34を用いることで、被写体領域に髪の毛等の細い部分が含まれる場合や、背景色に近い部分が混ざっている場合があっても、その部分及び周辺部分が背景領域に指定されることなく、被写体領域(前景領域+未確定領域)として抽出できる。   As described above, the image processing apparatus 100 executes the silhouette image generation process, generates the binary mask image 33 and the edge image 34 of the original image 31, and combines them to generate the silhouette image 35. As a result, it is possible to reliably identify the portion that is the background region as the background region and sufficiently extract the region that may be included in the subject. By using the edge image 34 to generate the silhouette image 35, even if a thin part such as hair is included in the subject area or a part close to the background color is mixed, the part and the peripheral part are the background. Without being designated as a region, it can be extracted as a subject region (foreground region + undetermined region).

[前景領域特定処理]
続いて、画像処理装置100が、図4のステップS104にて実行する前景領域特定処理の詳細について、図9と図10を参照して説明する。尚、ここでは、前景領域特定処理を実行して図5の(a)に示す原画像30と原画像30のシルエット画像(図示せず)から図10のトライマップ39を生成する例について説明する。
[Foreground area identification processing]
Next, details of the foreground area specifying process executed by the image processing apparatus 100 in step S104 of FIG. 4 will be described with reference to FIGS. Here, an example in which the foreground area specifying process is executed to generate the trimap 39 of FIG. 10 from the original image 30 and the silhouette image (not shown) of the original image 30 shown in FIG. .

図9は、前景領域特定処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS103にて生成されたシルエット画像のシルエットの内側領域を未確定領域(灰)に特定し、シルエット画像のシルエットの外側領域を背景領域(黒)に特定する(ステップS301)。
FIG. 9 is a flowchart showing the flow of the foreground area specifying process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 identifies the silhouette inner region of the silhouette image generated in step S103 as an undetermined region (gray), and determines the silhouette outer region of the silhouette image. A background area (black) is specified (step S301).

画像処理装置100の制御部21(トライマップ生成部13)は、原画像30の被写体30aの肌の代表色を特定する(ステップS302)。画像処理装置100は、被写体30aの目の位置を元に鼻領域付近を推定し、その領域を肌の代表色とする(その領域の平均値を肌の代表色としてもよい)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 identifies the representative color of the skin of the subject 30a of the original image 30 (step S302). The image processing apparatus 100 estimates the vicinity of the nose region based on the eye position of the subject 30a, and sets the region as the representative color of the skin (the average value of the region may be the representative color of the skin).

画像処理装置100の制御部21(トライマップ生成部13)は、肌の代表色と原画像30の未確定領域内の各画素の画素値のマハラノビス距離を測定し、距離が所定値以内の画素を、被写体30aの肌色部分である肌マスクとして抽出する(ステップS303)。肌マスクを抽出する処理の詳細は、特許文献1に記載されている。
<特許文献1> 特許第5029545号
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 measures the Mahalanobis distance between the representative color of the skin and the pixel value of each pixel in the undetermined region of the original image 30, and the distance is within a predetermined value. Are extracted as a skin mask which is the skin color portion of the subject 30a (step S303). Details of the process of extracting the skin mask are described in Patent Document 1.
<Patent Document 1> Japanese Patent No. 5029545

画像処理装置100の制御部21(トライマップ生成部13)は、未確定領域内の肌マスクの肌領域を前景領域(白)に特定する(ステップS304)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 identifies the skin region of the skin mask in the unconfirmed region as the foreground region (white) (step S304).

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS301及びステップS304にて特定された情報に基づいて、原画像30の各画素が背景領域、未確定領域、前景領域のいずれかに分類されたトリマップ39を生成し、処理を終了する。   Based on the information specified in step S301 and step S304, the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether each pixel of the original image 30 is a background region, an undefined region, or a foreground region. The trimap 39 classified into the crab is generated, and the process ends.

図10に、前景領域特定処理によって生成された原画像30のトライマップ39を示す。トライマップ39の前景領域を白、未確定領域を灰色、背景領域を黒で示す。   FIG. 10 shows a trimap 39 of the original image 30 generated by the foreground area specifying process. The foreground area of the trimap 39 is shown in white, the unconfirmed area in gray, and the background area in black.

以上の様に、画像処理装置100は前景領域特定処理を実行して、原画像30のシルエット画像によって背景領域と未確定領域とを特定し、原画像30の肌マスクによって前景領域を特定して、トライマップ39を生成する。これにより、被写体30aの顔の肌部分を前景領域としたトライマップ39を生成することができる。   As described above, the image processing apparatus 100 executes the foreground region specifying process, specifies the background region and the uncertain region by the silhouette image of the original image 30, and specifies the foreground region by the skin mask of the original image 30. Then, a trimap 39 is generated. Thereby, it is possible to generate the trimap 39 having the skin portion of the face of the subject 30a as the foreground region.

[色空間上の閾値処理]
続いて、画像処理装置100が、図4のステップS105にて実行する色空間上の閾値処理の詳細について、図11と図12を参照して説明する。尚、ここでは、色空間上の閾値処理を実行して図12の(a)に示す原画像30(図5の(a)に示す原画像30と同じ)とステップS104にて生成されたトライマップ39とから、図12の(b)に示すトライマップ40を生成する例について説明する。
[Threshold processing in color space]
Next, details of threshold processing in the color space executed by the image processing apparatus 100 in step S105 of FIG. 4 will be described with reference to FIGS. Here, threshold processing in the color space is executed, and the original image 30 shown in FIG. 12A (same as the original image 30 shown in FIG. 5A) and the trie generated in step S104. An example of generating the trimap 40 shown in FIG. 12B from the map 39 will be described.

図9は、前景領域特定処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS104にて生成されたトライマップ39の未確定領域に対応する原画像30の各画素の画素値(色)をLUVの色空間に変換する(ステップS401)。LUVの色空間に変換することでステップS404及びステップS409で実行する判別処理に使用するパラメータの設定が容易となるが、他の色空間を使用してステップS402以降の処理を実行しても良い。
FIG. 9 is a flowchart showing the flow of the foreground area specifying process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 sets the pixel value (color) of each pixel of the original image 30 corresponding to the undetermined region of the trimap 39 generated in step S104 to the LUV color. The space is converted (step S401). Conversion to the LUV color space facilitates the setting of parameters used for the discrimination processing executed in step S404 and step S409, but the processing after step S402 may be executed using another color space. .

画像処理装置100の制御部21(トライマップ生成部13)は、原画像30の顎下ライン30gを設定する(ステップS402)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 sets the submandibular line 30g of the original image 30 (step S402).

図12の(a)を用いて、原画像30の顎下ライン30gの設定例について説明する。原画像30にステップS102にて入力を受け付けた頭頂部位置30eと顎位置30fを示す。頭頂部位置30eから顎位置30fまでの距離を顔幅30hとして、顎の位置30fから顔幅30hの8パーセント分の距離(顎幅31i)下げた位置に顎下ライン30gを設定する。上記方法は設定の一例であり、例えば、顎位置30fから所定のピクセル数下げた位置に顎下ライン30gを設定する方法であっても良い。   A setting example of the submandibular line 30g of the original image 30 will be described with reference to FIG. The original image 30 shows the parietal position 30e and the jaw position 30f that received the input in step S102. The distance from the top position 30e to the chin position 30f is set as the face width 30h, and the submandibular line 30g is set at a position lower than the chin position 30f by a distance corresponding to 8% of the face width 30h (chin width 31i). The above method is an example of setting, and for example, a method of setting the submandibular line 30g at a position lower than the jaw position 30f by a predetermined number of pixels may be used.

画像処理装置100の制御部21(トライマップ生成部13)は、顎下ライン30gより上側の領域で未確定領域に対応する原画像30の画素の画素値(色)を入力する(ステップS403)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the pixel value (color) of the pixel of the original image 30 corresponding to the undetermined region in the region above the submandibular line 30g (step S403). .

画像処理装置100の制御部21(トライマップ生成部13)は、入力された画素の色が背景色22bと近似するか否かを判定する(ステップS404)。色の近似性は、例えば、色空間上の距離によって判断される。前景領域または未確定領域とみなす色範囲の許容量は予め設定されている。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not the input pixel color approximates the background color 22b (step S404). The color approximation is determined by, for example, a distance in the color space. The allowable amount of the color range that is regarded as the foreground area or the undetermined area is set in advance.

近似する場合には(ステップS404のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、入力画素を更新しない(ステップS405)。近似しない場合には(ステップS404のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、入力画素を前景領域(白)に更新する(ステップS406)。   In the case of approximation (YES in step S404), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 does not update the input pixel (step S405). If not approximated (NO in step S404), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 updates the input pixel to the foreground region (white) (step S406).

画像処理装置100の制御部21(トライマップ生成部13)は、顎下ライン30gより上側の領域で未確定領域に対応する原画像30の全ての画素を入力したか否かを判定する(ステップS407)。入力済みでない場合には(ステップS407のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS403に戻る。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not all the pixels of the original image 30 corresponding to the undetermined region in the region above the submandibular line 30g have been input (step). S407). If it has not been input (NO in step S407), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S403.

入力済みの場合には(ステップS407のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、顎下ライン30gより下側の領域で未確定領域に対応する原画像30の画素の画素値(色)を入力する(ステップS408)。   When the input has been completed (YES in step S407), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 reads the original image 30 corresponding to the undetermined region in the region below the submandibular line 30g. The pixel value (color) of the pixel is input (step S408).

画像処理装置100の制御部21(トライマップ生成部13)は、入力された画素の色が背景色22bと近似するか否かを判定する(ステップS409)。色の近似性は、例えば、色空間上の距離によって判断される。前景領域または未確定領域とみなす色範囲の許容量は予め設定されている。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not the input pixel color approximates the background color 22b (step S409). The color approximation is determined by, for example, a distance in the color space. The allowable amount of the color range that is regarded as the foreground area or the undetermined area is set in advance.

ステップS409の判定処理に用いる色の閾値や許容範囲の設定値は、ステップS404の判定処理に用いる設定値と異なることが好ましい。顎下ライン30gより上側の領域は被写体30aの顔や髪の毛部分を多く含み、顎下ライン30gより下側の領域は被写体30aの洋服部分を多く含む。領域ごとに異なる設定値を用いることで、未確定領域に属する可能性のある画素を確実に未確定領域のままに残すことができる。   It is preferable that the set value of the color threshold and the allowable range used in the determination process in step S409 is different from the set value used in the determination process in step S404. The region above the submandibular line 30g includes many faces and hair portions of the subject 30a, and the region below the submandibular line 30g includes many clothing portions of the subject 30a. By using different setting values for each region, it is possible to reliably leave pixels that may belong to the undetermined region as the undetermined region.

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS405〜ステップS407と同様の処理を実行して、トライマップ40を生成し(ステップS410〜ステップS412)、処理を終了する。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 executes the same processes as in steps S405 to S407, generates the trimap 40 (steps S410 to S412), and ends the process.

図12の(b)に色空間上の閾値処理によって生成された原画像30のトライマップ40を示す。   FIG. 12B shows a trimap 40 of the original image 30 generated by threshold processing on the color space.

以上の様に、画像処理装置100は色空間上の閾値処理を実行して、原画像30を顎下ラインの上側領域と下側領域に分割し、分割した領域ごとに未確定領域の画素を背景色22bとの近似性に基づいて前景領域に更新し、トライマップ40を生成する。   As described above, the image processing apparatus 100 performs the threshold processing on the color space, divides the original image 30 into the upper region and the lower region of the submandibular line, and sets the pixels in the undetermined region for each divided region. The trie map 40 is generated by updating to the foreground area based on the closeness to the background color 22b.

[首元領域特定処理]
続いて、画像処理装置100が、図4のステップS106にて実行する首元領域特定処理の詳細について、図13と図14を参照して説明する。尚、ここでは、首元領域特定処理を実行して、ステップS105にて生成されたトライマップ40から、図14の(c)に示すトライマップ49を生成する例について説明する。
[Neck area identification process]
Next, details of the neck area specifying process executed by the image processing apparatus 100 in step S106 of FIG. 4 will be described with reference to FIGS. Here, an example will be described in which the neck region specifying process is executed to generate the trimap 49 shown in FIG. 14C from the trimap 40 generated in step S105.

図13は、首元領域特定処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS105にて生成されたトライマップ40を入力し(ステップS501)、首元探索領域42を設定する(ステップS502)。
FIG. 13 is a flowchart showing the flow of the neck area specifying process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the trimap 40 generated in step S105 (step S501), and sets the neck search area 42 (step S502).

図14の(a)に基づいて、トライマップ40の首元探索領域42の設定例について説明する。図14の(a)は、ステップS102にて入力を受け付けた被写体30aの中心ライン41cと顎位置30fと、色空間上の閾値処理(図11)のステップS402にて設定した顎下ライン30gとを示すトライマップ40である。中心ライン41cから原画像30の横幅の8分の1を左右に拡げたラインを探索終了ライン41a、41bとする。ここで、顎位置30f、顎下ライン30g、探索終了ライン41a、41bによって囲まれる領域を首元探索領域42と設定する。
上記方法は設定の一例であり、例えば、中心ライン41cから所定のピクセル数分左右に拡げた位置を探索終了ライン41a、41bとする方法であっても良い。
A setting example of the neck search area 42 of the trimap 40 will be described based on FIG. FIG. 14A shows the center line 41c and jaw position 30f of the subject 30a that has received the input in step S102, and the submandibular line 30g set in step S402 of the threshold processing (FIG. 11) on the color space. Is a trimap 40 showing Search end lines 41a and 41b are lines obtained by expanding one-eighth the width of the original image 30 from the center line 41c to the left and right. Here, a region surrounded by the jaw position 30f, the submandibular line 30g, and the search end lines 41a and 41b is set as a neck search region 42.
The above method is an example of setting, and for example, a method of setting the search end lines 41a and 41b at positions expanded from the center line 41c to the left and right by a predetermined number of pixels may be used.

図14の(b)に首元探索領域42を拡大した図を示す。中心ライン41cと顎下ライン30gの交点を探索開始点43とする。以降、探索開始点43を原点(0、0)とし、画像右方向をX軸方向、画像上方向をY軸方向とするXY座標空間上で説明する。中心ライン41cと顎位置30fの交点を探索終了点44とし、座標値を(0、k)とする。探索終了点44とは、探索開始点43からY軸方向にkピクセル分移動した点である。   FIG. 14B shows an enlarged view of the neck search area 42. The intersection of the center line 41 c and the submandibular line 30 g is set as a search start point 43. Hereinafter, description will be made on an XY coordinate space where the search start point 43 is the origin (0, 0), the right direction of the image is the X-axis direction, and the upward direction of the image is the Y-axis direction. Let the intersection of the center line 41c and the jaw position 30f be the search end point 44, and the coordinate value be (0, k). The search end point 44 is a point moved from the search start point 43 by k pixels in the Y-axis direction.

画像処理装置100の制御部21(トライマップ生成部13)は、i=0と設定する(ステップS503)。
画像処理装置100の制御部21(トライマップ生成部13)は、首元探索領域内の1行目にて、探索開始点43からX軸正(負)方向に前景画素から未確定画素に変わった最初の位置を首元位置候補の初期値としてセット(記憶)する(ステップS504)。
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 sets i = 0 (step S503).
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 changes from the foreground pixel to the uncertain pixel in the X-axis positive (negative) direction from the search start point 43 in the first row in the neck search region. The first position is set (stored) as an initial value of the neck position candidate (step S504).

画像処理装置100の制御部21(トライマップ生成部13)は、探索始点(0、i)を入力する(ステップS505)。図14の(b)に、探索始点43aの一例を示す。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the search start point (0, i) (step S505). FIG. 14B shows an example of the search start point 43a.

続いて、画像処理装置100の制御部21(トライマップ生成部13)は、探索始点43a(0、i)からX軸正(負)方向に探索終点(m、i)まで走査し、前景領域の画素(以下、前景画素と表記)と未確定領域の画素(以下、未確定画素と表記)の画素数を1行ごとにカウントする(ステップS506)。図14の(b)に、探索終点44aの一例を示す。   Subsequently, the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 scans from the search start point 43a (0, i) to the search end point (m, i) in the X-axis positive (negative) direction, and foreground area. The number of pixels (hereinafter referred to as foreground pixels) and the pixels in the undetermined region (hereinafter referred to as undetermined pixels) are counted for each row (step S506). FIG. 14B shows an example of the search end point 44a.

画像処理装置100の制御部21(トライマップ生成部13)は、探索始点43a(0、i)〜探索終点44a(m、i)に存在する前景画素の画素数と未確定画素の画素数とを特定する(ステップS507)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines the number of foreground pixels and the number of unconfirmed pixels existing at the search start point 43a (0, i) to the search end point 44a (m, i). Is identified (step S507).

画像処理装置100の制御部21(トライマップ生成部13)は、特定された前景画素の画素数と未確定画素の画素数を3倍にした値とを比較する(ステップS508)。   The control unit 21 (the trimap generation unit 13) of the image processing apparatus 100 compares the number of identified foreground pixels with a value obtained by tripling the number of undetermined pixels (step S508).

前景画素数が未確定画素数の3倍以下の場合には(ステップS508のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS510に進む。
前景画素数が未確定画素数の3倍より大きい場合には(ステップS508のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS506にて走査された画素の座標値(前景画素から未確定画素に変わった最初の座標値)を首元位置候補として制御部21のRAM等に記憶する(ステップS509)。
When the number of foreground pixels is three times or less than the number of undetermined pixels (NO in step S508), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 proceeds to step S510.
When the number of foreground pixels is larger than three times the number of undetermined pixels (YES in step S508), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 coordinates the pixel scanned in step S506. The value (first coordinate value changed from the foreground pixel to the undetermined pixel) is stored in the RAM or the like of the control unit 21 as a neck position candidate (step S509).

画像処理装置100の制御部21(トライマップ生成部13)は、探索始点43aを1ピクセル分Y軸方向に(図14の(b)に示す白抜き矢印の方向に)移動させて(ステップS510)、新たに設定された探索始点43aのY座標値(i)と探索終了点44のY座標値(k)とを比較する(ステップS511)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 moves the search start point 43a by one pixel in the Y-axis direction (in the direction of the white arrow shown in FIG. 14B) (step S510). ) The newly set Y coordinate value (i) of the search start point 43a is compared with the Y coordinate value (k) of the search end point 44 (step S511).

i<kの場合には(ステップS511のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS505に戻る。
i≧kの場合には(ステップS511のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、記憶済みの首元位置候補のうち、探索終了ライン41bに最も近い前景画素の座標値を、首元位置45aとして特定する
(ステップS512)。
If i <k (YES in step S511), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S505.
When i ≧ k (NO in step S511), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 selects the foreground pixel closest to the search end line 41b among the stored neck position candidates. Is specified as the neck position 45a.
(Step S512).

画像処理装置100の制御部21(トライマップ生成部13)は、X軸負方向の首元位置45bも同様に特定する。
図14の(b)に首元位置45a、45bの一例を示す。
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 similarly specifies the neck position 45b in the X-axis negative direction.
FIG. 14B shows an example of neck positions 45a and 45b.

画像処理装置100の制御部21(トライマップ生成部13)は、首元位置45a、45bを上底とする胸元領域48を設定する(ステップS513)。
図14の(c)に基づいて、トライマップ49(トライマップ40)における胸元領域48の設定例について説明する。画像の下部において中心ライン41cを中心とした顔幅30hの8割分の長さの線分47a、47bを下底とし、首元位置45a、45bを結ぶ線分を上底として囲まれる領域を胸元領域48と設定する。上記方法は設定の一例である。首元位置45a、45bは左右方向でそれぞれ特定されるため、首元位置45a、45b(X座標値、Y座標値)は左右で異なることとなる。
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 sets the chest region 48 with the neck positions 45a and 45b as the upper base (step S513).
A setting example of the chest region 48 in the trimap 49 (trimap 40) will be described with reference to FIG. A region surrounded by a line segment 47a, 47b having a length corresponding to 80% of the face width 30h centered on the center line 41c at the bottom of the image and a line segment connecting the neck positions 45a, 45b as the upper base. The chest area 48 is set. The above method is an example of setting. Since the neck positions 45a and 45b are specified in the left-right direction, the neck positions 45a and 45b (X coordinate value and Y coordinate value) are different on the left and right.

画像処理装置100の制御部21(トライマップ生成部13)は、トライマップ40のうち胸元領域48内を前景領域に更新して、トライマップ49を生成し(ステップS514)、処理を終了する。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 updates the chest area 48 in the trimap 40 to the foreground area, generates the trimap 49 (step S514), and ends the process.

以上の様に、画像処理装置100は首元領域特定処理を実行して、被写体30aの首元の位置を正確に特定することで、被写体30aの下部領域(服の領域)に対して、できるだけ広い範囲を前景領域とすることができる。これにより服の領域に背景色に類似する色(例えば、ネクタイの色)が含まれる場合であっても、前景領域に特定することができる。   As described above, the image processing apparatus 100 executes the neck region specifying process and accurately specifies the position of the neck of the subject 30a, so that it can be applied to the lower region (clothing region) of the subject 30a as much as possible. A wide range can be used as the foreground region. As a result, even if the clothes area includes a color similar to the background color (for example, the color of the tie), the area can be specified as the foreground area.

[顎下ライン更新処理]
続いて、画像処理装置100が、図4のステップS107にて実行する顎下ライン更新処理の詳細について、図15と図16を参照して説明する。尚、ここでは、ステップS106にて生成されたトライマップ49において顎下ライン更新処理を実行する例について説明する。
[Submandibular line update process]
Next, details of the submandibular line update process performed by the image processing apparatus 100 in step S107 of FIG. 4 will be described with reference to FIGS. 15 and 16. Here, an example in which the submandibular line update process is executed on the trimap 49 generated in step S106 will be described.

図15は、顎下ライン更新処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS106にて生成されたトライマップ49を入力し(ステップS601)、髪の毛判定領域50を設定する(ステップS602)。
FIG. 15 is a flowchart showing the flow of the submandibular line update process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the trimap 49 generated in step S106 (step S601), and sets the hair determination region 50 (step S602).

図16の(a)に基づいて、トライマップ49の髪の毛判定領域50の設定例について説明する。図16の(a)は、ステップS102にて入力を受け付けた被写体30aの頭頂部位置30eと顎位置30fと、色空間上の閾値処理(図11)のステップS402にて設定した顎下ライン30gとを示すトライマップ49である。頭頂部位置30eから顔幅30hの6割分の距離を下げた位置を判定終了ライン48とし、顎下ライン30gと判定終了ライン48とによって挟まれる領域を髪の毛判定領域50とする。
上記方法は設定の一例であり、例えば、頭頂部位置30eから所定のピクセル数下げた位置を判定終了ライン48とする方法であっても良い。
A setting example of the hair determination area 50 of the trimap 49 will be described with reference to FIG. FIG. 16A shows the position 30e and chin position 30f of the subject 30a that has received the input in step S102, and the submandibular line 30g set in step S402 of the threshold processing (FIG. 11) on the color space. Is a tri-map 49 showing A position where the distance corresponding to 60% of the face width 30h is lowered from the top position 30e is defined as a determination end line 48, and a region sandwiched between the submandibular line 30g and the determination end line 48 is defined as a hair determination region 50.
The above method is an example of setting. For example, a method in which a position that is a predetermined number of pixels lower than the top position 30e is used as the determination end line 48 may be used.

図16の(a)に示すように、顎下ライン30gの右端を判定開始点51とする。以降、判定開始点51を原点(0、0)とし、画像左方向をX軸方向、画像上方向をY軸方向とするXY座標空間上で説明する。判定終了ライン48の右端を判定終了点52とし、座標値を(0、k)とする。判定終了点52は、判定開始点51からY軸方向にkピクセル分移動した点である。   As shown in FIG. 16A, the right end of the submandibular line 30g is set as the determination start point 51. Hereinafter, description will be made on an XY coordinate space where the determination start point 51 is the origin (0, 0), the left direction of the image is the X-axis direction, and the upward direction of the image is the Y-axis direction. The right end of the determination end line 48 is a determination end point 52, and the coordinate value is (0, k). The determination end point 52 is a point moved from the determination start point 51 by k pixels in the Y-axis direction.

画像処理装置100の制御部21(トライマップ生成部13)は、初めにi=0を設定して(ステップS603)、探索始点(0、i)を入力する(ステップS604)。画像処理装置100の制御部21(トライマップ生成部13)は、探索始点から左方向に画像の右端から左端までの未確定画素を探索し(ステップS605)、検知された未確定画素の画素数と予め設定された画素数とを比較する(ステップS606)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 first sets i = 0 (step S603) and inputs the search start point (0, i) (step S604). The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 searches for undefined pixels from the right end to the left end of the image in the left direction from the search start point (step S605), and the number of detected undefined pixels. Are compared with a preset number of pixels (step S606).

検知された未確定画素の画素数の方が少ない場合には(ステップS606のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、処理を終了する。
検知された未確定画素の画素数の方が多い場合には(ステップS606のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、探索始点を1ピクセル分Y軸方向に(図16の(a)に示す白抜き矢印の方向に)移動させて(ステップS607)、新たに設定された探索始点のY座標値(i)と判定終了点52のY座標値(k)とを比較する(ステップS608)。
When the detected number of unconfirmed pixels is smaller (NO in step S606), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 ends the process.
If the number of detected uncertain pixels is larger (YES in step S606), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 sets the search start point by one pixel in the Y-axis direction. It is moved (in the direction of the white arrow shown in FIG. 16A) (step S607), the newly set Y coordinate value (i) of the search start point and the Y coordinate value (k) of the determination end point 52 Are compared (step S608).

i<kの場合には(ステップS608のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS604に戻る。
i≧kの場合には(ステップS608のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、顎下ライン30gを数ピクセル(例えば、50ピクセル)下げた位置を新たな顎下ラインに更新して(ステップS609)、処理を終了する。
If i <k (YES in step S608), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S604.
When i ≧ k (NO in step S608), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 newly sets a position where the submandibular line 30g is lowered by several pixels (for example, 50 pixels). The line is updated to the submandibular line (step S609), and the process ends.

図16の(b)に、原画像31の首元領域特定処理(ステップS106)後のトライマップ60を示す。原画像31の被写体31aはロングヘアーで、顎下ライン62と判定終了ライン61とによって囲まれる髪の毛判定領域64の全域に髪の毛が含まれる。このような場合には、ステップS609にて顎下ラインは更新されることとなる(更新後の顎下ライン63)。一方、図16の(a)に示すトライマップ49において被写体はショートヘアーであり、このような場合には顎下ライン30gは更新されない。   FIG. 16B shows the trimap 60 after the neck region specifying process (step S106) of the original image 31. FIG. The subject 31a of the original image 31 is long hair, and hair is included in the entire hair determination region 64 surrounded by the submandibular line 62 and the determination end line 61. In such a case, the submandibular line is updated in step S609 (updated submandibular line 63). On the other hand, in the trimap 49 shown in FIG. 16A, the subject has short hair, and in such a case, the submandibular line 30g is not updated.

以上の様に、画像処理装置100は顎下ライン更新処理を実行して、髪の毛判定領域内の未確定領域が常に大きい場合には被写体がロングヘアーであると判定し、ロングヘアーの場合には顎下ラインを数ピクセル下げて、次に説明する色ヒストグラム判定処理を実行する。被写体がロングヘアーである場合には、顎や肩の周辺に背景と髪の毛が混合する未確定領域を多く含むことがある。そのような領域に色ヒストグラム判定処理が実行されて前景領域に更新されてしまうことを事前に妨げることができる。   As described above, the image processing apparatus 100 executes the submandibular line update process, and determines that the subject is long hair when the undetermined area in the hair determination area is always large, and in the case of long hair. The submandibular line is lowered by several pixels, and the color histogram determination process described below is executed. When the subject is long hair, there may be many uncertain areas where the background and hair are mixed around the chin and shoulder. It can be prevented in advance that the color histogram determination process is performed on such an area and the area is updated to the foreground area.

尚、本実施形態では、頭頂部位置30eから顔幅30hの6割分の距離を下げた位置を判定終了ライン48とする例について説明したが、これを判定開始ラインとしても良い。その場合、画像処理装置100の制御部21(トライマップ生成部13)は、判定開始ラインからY軸負方向に(図16(a)の白抜き矢印逆方向に)移動しながら未確定画素を探索する。   In the present embodiment, the example in which the position where the distance corresponding to 60% of the face width 30h is lowered from the top position 30e is used as the determination end line 48 has been described, but this may be used as the determination start line. In that case, the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 moves the undetermined pixels while moving in the negative Y-axis direction (in the reverse direction of the white arrow in FIG. 16A) from the determination start line. Explore.

[色ヒストグラム判定処理]
次に、画像処理装置100が、図4のステップS108にて実行する色ヒストグラム判定処理について、図17から図18を参照して説明する。尚、ここでは、色ヒストグラム判定処理を実行して、ステップS106にて生成されたトライマップ60(図16の(b))から、図18の(a)に示すトライマップ70、または図18の(b)に示すトライマップ71を生成する例について説明する。
[Color histogram judgment processing]
Next, the color histogram determination process executed by the image processing apparatus 100 in step S108 of FIG. 4 will be described with reference to FIGS. Here, the color histogram determination process is executed, and from the trimap 60 (FIG. 16B) generated in step S106, the trimap 70 shown in FIG. An example of generating the trimap 71 shown in (b) will be described.

図17は、色ヒストグラム判定処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS106にて生成されたトライマップ60を入力し(ステップS701)、顎下ライン63の位置から下の領域に対して、前景領域に属する画素を抽出する(ステップS702)。
FIG. 17 is a flowchart showing the flow of the color histogram determination process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the trimap 60 generated in step S106 (step S701), and the foreground with respect to the region below the position of the submandibular line 63. Pixels belonging to the region are extracted (step S702).

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS702にて抽出した画素に対応する原画像31の画素の画素値を入力して、色ヒストグラムを生成する(ステップS703)。
ここで画素値とは、原画像の各画素の色を表す値であり、例えば、RGB値あるいはHSV表色系等の色相/彩度/明度の組み合わせで表される。色ヒストグラムの横軸は色のレベルを示す色番号であり、例えば、輝度レベルを0〜255で表し、縦軸はそのレベルに存在する画素数(度数)を示す。
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the pixel value of the pixel of the original image 31 corresponding to the pixel extracted in step S702, and generates a color histogram (step S703).
Here, the pixel value is a value representing the color of each pixel of the original image, and is represented by a combination of hue / saturation / lightness such as RGB value or HSV color system. The horizontal axis of the color histogram is a color number indicating a color level. For example, the luminance level is represented by 0 to 255, and the vertical axis indicates the number of pixels (frequency) existing in the level.

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS703にて生成した色ヒストグラムから、度数の少ない色番号を除去する(ステップS704)。除去するか否か判断するための度数の閾値は、予め設定されている。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 removes a color number with less frequency from the color histogram generated in step S703 (step S704). A frequency threshold for determining whether or not to remove is set in advance.

画像処理装置100の制御部21(トライマップ生成部13)は、入力されたトライマップ60のうち、顎下ライン63の位置から下の領域の未確定画素に対応する原画像31の画素の画素値を入力する(ステップS705)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 includes pixels of the original image 31 corresponding to undefined pixels in the region below the position of the submandibular line 63 in the input trimap 60. A value is input (step S705).

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS705にて入力した画素の画素値が、ステップS704にて生成した色ヒストグラム上に存在する色番号と一致するか否かを判定する(ステップS706)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not the pixel value of the pixel input in step S705 matches the color number existing on the color histogram generated in step S704. Determination is made (step S706).

一致する場合は(ステップS706のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、トライマップ60に対し、入力した画素を前景領域に更新する(ステップS707)。一致しない場合は(ステップS706のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS708に進む。   If they match (YES in step S706), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 updates the input pixel to the foreground area in the trimap 60 (step S707). If they do not match (NO in step S706), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 proceeds to step S708.

画像処理装置100の制御部21(トライマップ生成部13)は、トライマップ60のうち、顎下ライン63から下の領域における未確定画素を全て入力済みであるか否かを判定する(ステップS708)。入力済みでない場合には(ステップS708のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS705に戻る。入力済みである場合には(ステップS708のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、処理を終了する。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not all the undetermined pixels in the region below the submandibular line 63 have been input in the trimap 60 (step S708). ). If it has not been input (NO in step S708), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S705. If the input has been completed (YES in step S708), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 ends the process.

尚、前述の色ヒストグラム判定処理のステップS706において、入力した画素の画素値が、生成した色ヒストグラム上に存在する色番号と一致するか否か判定するとしたが、色番号と類似する(色番号の近傍にある)か否かを判定してもよい。   In step S706 of the color histogram determination process described above, it is determined whether or not the pixel value of the input pixel matches the color number existing on the generated color histogram, but it is similar to the color number (color number It is also possible to determine whether or not

図18に、色ヒストグラム判定処理実行後のトライマップ70、71を示す。
色ヒストグラム判定処理実行前のトライマップ60と比較すると、トライマップ60は、被写体31aの洋服部分に未確定領域を示す灰色部分が多いのに対し、トライマップ70、71は、被写体31aの洋服部分に前景領域を示す白色部分が多い。これにより、被写体31a領域のうち首元領域特定処理によって前景領域に更新された画素の色と類似する未確定画素が、色ヒストグラム判定処理を実行することで前景領域に更新されたことがわかる。
FIG. 18 shows the trimaps 70 and 71 after the color histogram determination process is executed.
Compared with the tri-map 60 before the color histogram determination process is performed, the tri-map 60 has many gray portions indicating uncertain areas in the clothing portion of the subject 31a, whereas the tri-maps 70 and 71 have the clothing portion of the subject 31a. There are many white portions indicating the foreground area. As a result, it can be seen that an undetermined pixel similar to the color of the pixel updated to the foreground area by the neck area specifying process in the subject 31a area is updated to the foreground area by executing the color histogram determination process.

図18の(a)に示す画像は、顎下ライン更新処理を実行しないでステップS106にて生成されたトライマップ60に色ヒストグラム判定処理を実行して生成されたトライマップ70であり、図18の(b)に示す画像は、顎下ライン更新処理実行後にトライマップ60に色ヒストグラム判定処理を実行して生成されたトライマップ71である。   The image shown in FIG. 18A is a trimap 70 generated by executing the color histogram determination process on the trimap 60 generated in step S106 without executing the submandibular line update process. The image shown in (b) is a trimap 71 generated by executing color histogram determination processing on the trimap 60 after execution of the submandibular line update processing.

トライマップ70では更新前の顎下ライン62より下の領域について色ヒストグラム判定処理が実行されるために、髪の毛の中に背景が混合する領域(破線で囲まれる領域71a)についても前景領域に更新されてしまう。一方、トライマップ71では顎下ライン63が更新前の顎下ライン62より下にあるため、髪の毛の中に背景が混合する領域(破線で囲まれる領域71b)については色ヒストグラム判定処理が実行されず、未確定領域のままに残すことができる。   In the trimap 70, since the color histogram determination process is executed for the area below the submandibular line 62 before update, the area where the background is mixed in the hair (area 71a surrounded by a broken line) is also updated to the foreground area. Will be. On the other hand, in the trimap 71, the submandibular line 63 is below the pre-updated submandibular line 62, so the color histogram determination process is executed for the region where the background is mixed in the hair (region 71b surrounded by the broken line). Instead, it can be left as an undetermined area.

以上の様に、画像処理装置100は色ヒストグラム判定処理を実行して、顎下ラインより下の領域内の前景領域の画素の色に基づいて、顎下ラインより下の領域内の未確定画素を前景領域の画素に更新する。これにより、髪の長い被写体によく見られるような背景領域の画素と前景領域の画素とが混合した領域を未確定領域のままに残すことができ、適切なアルファマスクを生成することができる。   As described above, the image processing apparatus 100 executes the color histogram determination process, and based on the color of the pixel in the foreground area in the area below the submandibular line, the undefined pixel in the area below the submandibular line. Are updated to pixels in the foreground area. As a result, it is possible to leave an area in which the pixels in the background area and the pixels in the foreground area, which are often seen in subjects with long hair, are left as undetermined areas, and an appropriate alpha mask can be generated.

[マトリクス内カウンタ処理]
次に、画像処理装置100が、図4のステップS109にて実行するマトリクス内カウンタ処理について、図19から図21を参照して説明する。
[In-matrix counter processing]
Next, the in-matrix counter process executed by the image processing apparatus 100 in step S109 of FIG. 4 will be described with reference to FIGS.

図19は、マトリクス内カウンタ処理の流れを示すフローチャートである。
画像処理装置100の制御部21(トライマップ生成部13)は、ステップS108にて生成されたトライマップを入力し(ステップS801)、未確定画素を入力する(ステップS802)。
FIG. 19 is a flowchart showing the flow of the in-matrix counter process.
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the trimap generated in step S108 (step S801), and inputs an undetermined pixel (step S802).

画像処理装置100の制御部21(トライマップ生成部13)は、入力されたトライマップ上に、ステップS802にて入力された画素を中心とした記憶部22に記憶するマトリクスサイズ(ピクセルサイズ)22dのマトリクスを生成する(ステップS803)。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 stores the matrix size (pixel size) 22d stored in the storage unit 22 centered on the pixel input in step S802 on the input trimap. Is generated (step S803).

図20の(a)に、注目画素80を中心とした3×3ピクセルサイズのマトリクスの例を示す。ピクセル内の“F”は、前景領域の画素であることを示し、ピクセル内の“U”は、未確定領域の画素であることを示す。注目画素80とは、ステップS802にて入力した画素である。   FIG. 20A shows an example of a 3 × 3 pixel size matrix centered on the target pixel 80. “F” in the pixel indicates a pixel in the foreground area, and “U” in the pixel indicates a pixel in the undetermined area. The target pixel 80 is a pixel input in step S802.

画像処理装置100の制御部21(トライマップ生成部13)は、ステップS803にて生成したマトリクス内に、背景領域の画素があるか否かを判定する(ステップS804)。背景領域の画素がある場合には(ステップS804のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS808に進む。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not there is a background region pixel in the matrix generated in step S803 (step S804). If there is a pixel in the background area (YES in step S804), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 proceeds to step S808.

背景領域の画素がない場合には(ステップS804のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS803にて生成したマトリクス内の未確定領域(U)の画素数(ピクセル数)と前景領域(F)の画素数(ピクセル数)をカウントする(ステップS805)。   If there is no pixel in the background area (NO in step S804), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 performs the pixel in the undefined area (U) in the matrix generated in step S803. The number (number of pixels) and the number of pixels (number of pixels) in the foreground area (F) are counted (step S805).

図20の(a)に示す例では、マトリクス内の未確定領域(U)の画素数は3ピクセルであり、前景領域(F)の画素数は6ピクセルである。   In the example shown in FIG. 20A, the number of pixels in the undefined area (U) in the matrix is 3 pixels, and the number of pixels in the foreground area (F) is 6 pixels.

画像処理装置100の制御部21(トライマップ生成部13)は、未確定領域(U)の画素数と前景領域(F)の画素数を比較し(ステップS806)、未確定領域(U)の画素数の方が多い、または同数の場合には(ステップS806のNO)、ステップS808に進む。
前景領域(F)の画素数の方が多い場合には(ステップS806のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS802にて入力した画素(注目画素80)を前景領域(F)に更新する(ステップS807)。
The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 compares the number of pixels in the unconfirmed region (U) with the number of pixels in the foreground region (F) (step S806), and the unconfirmed region (U). If the number of pixels is greater or equal (NO in step S806), the process proceeds to step S808.
When the number of pixels in the foreground area (F) is larger (YES in step S806), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 inputs the pixel (target pixel 80) in step S802. ) Is updated to the foreground area (F) (step S807).

図20の(a)に示す例では、前景領域(F)の方が多いので、図20の(b)に、注目画素80を未確定領域(U)から前景領域(F)に更新した後のマトリクスを示す。   In the example shown in FIG. 20A, since the foreground area (F) is larger, the pixel of interest 80 is updated from the undetermined area (U) to the foreground area (F) in FIG. 20B. The matrix of is shown.

画像処理装置100の制御部21(トライマップ生成部13)は、トライマップの未確定領域に属する全ての画素を入力済みであるか否かを判定する(ステップS808)。入力済みで無い場合には(ステップS808のNO)、画像処理装置100の制御部21(トライマップ生成部13)は、ステップS802に戻る。入力済みである場合には(ステップS808のYES)、画像処理装置100の制御部21(トライマップ生成部13)は、処理を終了する。   The control unit 21 (trimap generation unit 13) of the image processing apparatus 100 determines whether or not all the pixels belonging to the undetermined region of the trimap have been input (step S808). If it has not been input (NO in step S808), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 returns to step S802. If the input has been completed (YES in step S808), the control unit 21 (trimap generation unit 13) of the image processing apparatus 100 ends the process.

図21は、マトリクス内カウンタ処理実行後のトライマップに、膨張処理(図4のステップS110)を施した原画像30のトライマップ85を示す図である。トライマップ85は、アルファマスク生成部14にて使用される。   FIG. 21 is a diagram showing a trimap 85 of the original image 30 obtained by performing the expansion process (step S110 in FIG. 4) on the trimap after execution of the in-matrix counter process. The trimap 85 is used by the alpha mask generator 14.

[アルファマッティング処理]
続いて、画像処理装置100のアルファマスク生成部14が実行するアルファマッティング処理(非特許文献4参照)について、図22を参照して説明する。
[Alpha matting process]
Next, an alpha matting process (see Non-Patent Document 4) executed by the alpha mask generation unit 14 of the image processing apparatus 100 will be described with reference to FIG.

アルファマッティング処理とは、原画像30と、原画像30のトライマップ85から、原画像30の前景画像と、原画像30のアルファマスクとを生成する処理である。   The alpha matting process is a process for generating a foreground image of the original image 30 and an alpha mask of the original image 30 from the original image 30 and the trimap 85 of the original image 30.

画像処理装置100のアルファマスク生成部14は、原画像30を、トライマップ85に基づいて、前景領域と背景領域と未確定領域とに分割する。原画像30における未確定領域の各画素の色は、アルファマッティング処理によって特定された前景領域の画素の色と背景領域の画素の色が混合した色によってモデル化される。未確定領域の画素における混合比率のうち、前景領域の画素の色の比率をα値(0≦α≦1)で表す。以下、前景領域をTf、前景領域に属する画素をFと表記し、背景領域をTb、背景領域に属する画素をBと表記し、未確定領域をTuと表記することとする。   The alpha mask generation unit 14 of the image processing apparatus 100 divides the original image 30 into a foreground area, a background area, and an undetermined area based on the trimap 85. The color of each pixel in the undetermined area in the original image 30 is modeled by a color obtained by mixing the color of the pixel in the foreground area and the color of the pixel in the background area specified by the alpha matting process. Of the mixture ratios in the pixels in the undefined area, the color ratio of the pixels in the foreground area is represented by an α value (0 ≦ α ≦ 1). Hereinafter, the foreground area is denoted by Tf, the pixels belonging to the foreground area are denoted by F, the background area is denoted by Tb, the pixels belonging to the background area are denoted by B, and the undetermined area is denoted by Tu.

画像処理装置100のアルファマスク生成部14は、未確定領域の各画素に対して、当該画素近傍の前景領域の画素と、当該画素近傍の背景領域の画素をサンプリングし、次式(1)に代入することで、サンプリングされた(F、B)の組み合わせの中から、原画像における当該画素の画素値と最も近い値となったα値を採用する。   The alpha mask generation unit 14 of the image processing apparatus 100 samples, for each pixel in the undetermined area, the foreground area pixel in the vicinity of the pixel and the background area pixel in the vicinity of the pixel. By substituting, the α value that is the closest to the pixel value of the pixel in the original image is adopted from the sampled combinations of (F, B).

Figure 2015186224
Figure 2015186224

画像処理装置100のアルファマスク生成部14は、前景画像とアルファマスクを生成する。前景画像とは、前景領域の画素の色成分と、未確定領域の各画素において選択された前景領域の画素の色成分を有する画像である。アルファマスクとは、前景領域に属する画素に対応する画素に対して「1」をラベル付し、背景領域に属する画素に対応する画素に対して「0」をラベル付し、未確定領域に属する画素に対応する画素に対して算出されたα値(0≦α≦1)をラベル付した画像である。   The alpha mask generation unit 14 of the image processing apparatus 100 generates a foreground image and an alpha mask. The foreground image is an image having the color components of the pixels in the foreground area and the color components of the pixels in the foreground area selected for each pixel in the undefined area. The alpha mask labels “1” for the pixels corresponding to the pixels belonging to the foreground area, labels “0” for the pixels corresponding to the pixels belonging to the background area, and belongs to the indeterminate area. It is an image labeled with an α value (0 ≦ α ≦ 1) calculated for a pixel corresponding to the pixel.

まず、画素p∈Tuに対して、画素pの近傍の背景領域の画素と前景領域の画素をサンプリングする。画素pを起点として、任意のサンプリング回数(以下、kgとも表記)に対応するFと、kgに対応するBを探索する。画素p∈Tuに対して、サンプリングされたFとBの組合せの中から、画素pに対する最適なFとBの組合せを選択することとなる。   First, for the pixel pεTu, the background region pixel and the foreground region pixel in the vicinity of the pixel p are sampled. Starting from the pixel p, F corresponding to an arbitrary number of samplings (hereinafter also referred to as kg) and B corresponding to kg are searched. For the pixel pεTu, the optimum combination of F and B for the pixel p is selected from the sampled combinations of F and B.

図22に示す画素p∈Tuを起点とする矢印90a、90b、90c、90dは、画素pに対する前景領域と背景領域のサンプルを探索する経路である。探索された前景領域の画素を黒塗りの四画形で表し、背景領域の画素を黒塗りの丸印で表す。
矢印90a、90b、90c、90d上に存在する前景領域の画素と背景領域の画素の中で、画素pから最短距離となる前景領域の1つの画素と、画素pから最短距離となる背景領域の1つの画素とがサンプリングされる。
Arrows 90a, 90b, 90c, and 90d starting from the pixel pεTu shown in FIG. 22 are paths for searching for foreground and background area samples for the pixel p. The searched foreground region pixels are represented by a black four-drawn shape, and the background region pixels are represented by a black circle.
Among the pixels in the foreground area and the background area existing on the arrows 90a, 90b, 90c, and 90d, one pixel in the foreground area that is the shortest distance from the pixel p and the background area that is the shortest distance from the pixel p One pixel is sampled.

図22に示すように、画素pを起点として、2π/kgに対応する角度毎に、前景領域と背景領域のサンプルが探索される。kgの値が大きい程、サンプリング回数が増大する。そのため、画素pに対して最終的に選択される前景領域の画素と背景領域の組み合わせ(F、B)の精度が高まるが、演算時間が増大する。   As shown in FIG. 22, samples of the foreground area and the background area are searched for each angle corresponding to 2π / kg starting from the pixel p. The larger the value of kg, the greater the number of samplings. Therefore, although the accuracy of the combination (F, B) of the foreground region pixel and the background region finally selected for the pixel p is increased, the calculation time is increased.

同様にして、図22に示す画素q∈Tuを起点とする矢印91a、91b、91c、91dは、画素qに対する前景領域と背景領域のサンプルを探索する経路である。探索された前景領域の画素を白抜きの四画形で表し、背景領域の画素を白抜きの丸印で表す。   Similarly, arrows 91a, 91b, 91c, and 91d starting from the pixel qεTu shown in FIG. 22 are paths for searching for foreground and background samples for the pixel q. The searched foreground region pixels are represented by white four-drawing shapes, and the background region pixels are represented by white circles.

続いて、画像処理装置100のアルファマスク生成部14は、サンプリングされた前景領域の画素と背景領域の画素の様々な組み合わせを、様々な混合比率で混合する。そして、画素pの色をモデル化するのに最も適当な前景領域の画素(色成分)と背景領域の画素(色成分)の組み合わせと混合比率を選択する。   Subsequently, the alpha mask generation unit 14 of the image processing apparatus 100 mixes various combinations of the sampled pixels in the foreground area and the pixels in the background area at various mixing ratios. Then, the most suitable foreground region pixel (color component) and background region pixel (color component) combination and mixing ratio for selecting the color of the pixel p are selected.

画像処理装置100のアルファマスク生成部14は、背景領域の各画素のα値を0とし、前景領域の各画素のα値を1とし、未確定領域の各画素のα値を選択した混合比率とし、α値を画素値とする画像であるアルファマスクを生成する。   The alpha mask generation unit 14 of the image processing apparatus 100 sets the α value of each pixel in the background region to 0, sets the α value of each pixel in the foreground region to 1, and selects the α value of each pixel in the undefined region. Then, an alpha mask that is an image having an α value as a pixel value is generated.

図23に、アルファマッティング処理によって生成された原画像30のアルファマスク95を示す。アルファマスク95は、α=0である画素を黒色、α=1である画素を白色、0<α<1である画素を中間色で示す。   FIG. 23 shows an alpha mask 95 of the original image 30 generated by the alpha matting process. The alpha mask 95 indicates pixels with α = 0 as black, pixels with α = 1 as white, and pixels with 0 <α <1 as intermediate colors.

画像処理装置100のアルファマスク生成部14は、前景領域の画素の色成分と、未確定領域の各画素に選択された前景領域の画素の色成分を有する画像である前景画像を生成する。   The alpha mask generation unit 14 of the image processing apparatus 100 generates a foreground image that is an image having the color components of the pixels in the foreground area and the color components of the pixels in the foreground area selected for each pixel in the undetermined area.

[背景合成処理]
画像処理装置100の背景画像合成部15は、アルファマッティング処理によって生成された前景画像とアルファマスク95とから、前景画像領域を切り抜いて、所望の背景画像22iに合成する。画像処理装置100の背景画像合成部15は、各画素(各色成分)において、P=α・F+(1−α)・Bを算出して、画素値を決定する。Pとは合成後画像の画素値であり、αとはアルファマスク画像のα値であり、Fとは前景画像の画素値であり、Bとは所望の背景画像22iの画素値である。背景画像合成部15は、生成された合成画像を画像出力部16に出力する。
[Background composition processing]
The background image synthesis unit 15 of the image processing apparatus 100 cuts out the foreground image area from the foreground image generated by the alpha matting process and the alpha mask 95, and synthesizes the desired background image 22i. The background image composition unit 15 of the image processing apparatus 100 calculates P = α · F + (1−α) · B for each pixel (each color component) to determine a pixel value. P is the pixel value of the synthesized image, α is the α value of the alpha mask image, F is the pixel value of the foreground image, and B is the pixel value of the desired background image 22i. The background image composition unit 15 outputs the generated composite image to the image output unit 16.

以上説明したように、画像処理装置100は、原画像の被写体領域中に、背景と類似する色が存在する場合や、被写体の髪の毛に背景が混合する領域が存在する場合においても、正確に領域指定されたトライマップを自動で生成し、これにより、適切な合成画像を生成することが可能となる。   As described above, the image processing apparatus 100 can accurately detect a region even when a color similar to the background exists in the subject region of the original image or a region where the background is mixed with the hair of the subject. It is possible to automatically generate a specified trimap, thereby generating an appropriate composite image.

人手を介してトライマップを生成する必要が無いため、例えば、証明写真ボックスなどの無人機器において、利用者を被写体とする原画像と、利用者の所望の背景画像を自動的にクロマキー合成して提供することが可能となる。   Since it is not necessary to generate a trimap manually, for example, an unattended device such as an ID photo box automatically synthesizes a chroma key between the original image of the user and the desired background image of the user. It becomes possible to provide.

以上、添付図面を参照しながら、本発明に係る画像処理装置100等の好適な実施形態について説明したが、本発明はかかる例に限定されない。当業者であれば、本願で開示した技術的思想の範疇内において、各種の変更例又は修正例に想到し得ることは明らかであり、それらについても当然に本発明の技術的範囲に属するものと了解される   The preferred embodiments of the image processing apparatus 100 and the like according to the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to such examples. It will be apparent to those skilled in the art that various changes or modifications can be conceived within the scope of the technical idea disclosed in the present application, and these naturally belong to the technical scope of the present invention. Understood

100………画像処理装置
11………原画像入力部
12………被写体の位置入力部
13………トライマップ生成部
14………アルファマスク生成部
15………背景画像合成部
16………画像出力部
21………制御部
22………記憶部
23………メディア入出力部
24………通信制御部
25………入力部
26………表示部
27………周辺機器I/F部
30、31、36………原画像
33、37………2値マスク画像
34………エッジ画像
35、38………シルエット画像
DESCRIPTION OF SYMBOLS 100 ......... Image processing apparatus 11 ......... Original image input part 12 ......... Subject position input part 13 ......... Tri-map generation part 14 ......... Alpha mask generation part 15 ......... Background image composition part 16 ... ...... Image output unit 21 ......... Control unit 22 ......... Storage unit 23 ......... Media input / output unit 24 ......... Communication control unit 25 ......... Input unit 26 ......... Display unit 27 ......... Peripheral equipment I / F part 30, 31, 36 ......... Original image 33, 37 ......... Binary mask image 34 ......... Edge image 35, 38 ......... Silhouette image

Claims (10)

被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理装置であって、
前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定手段と、
前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定手段と、
前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定手段と、
前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定手段と、
を備えることを特徴とする画像処理装置。
Each pixel constituting the original image obtained by photographing the upper body of the subject is classified into a background region, a foreground region that is a part of the subject, and an uncertain region that is unknown whether it belongs to the background region or the foreground region. An image processing apparatus that generates a trimap that is a ternary image,
Silhouette specifying means for binarizing the original image and specifying the silhouette of the subject;
A pixel outside the silhouette is specified as a pixel in the background area, a pixel in the silhouette is specified as a pixel in the undetermined area, and a pixel in the skin color area of the subject is selected from the pixels in the undetermined area. Skin region specifying means for updating the region to generate the trimap,
A chest region specifying means for specifying a chest region by specifying a neck position of the subject, and updating a pixel corresponding to the chest region to the foreground region;
Color histogram determination means for determining hair length of the subject and generating color histograms in different ranges, and updating the trimap using the color histogram;
An image processing apparatus comprising:
前記シルエット特定手段は、
背景色を基に生成した2値化画像と、前記原画像を輪郭抽出処理して生成したエッジ画像とから、シルエットを特定する
ことを特徴とする請求項1に記載の画像処理装置。
The silhouette specifying means is:
The image processing apparatus according to claim 1, wherein a silhouette is specified from a binarized image generated based on a background color and an edge image generated by performing contour extraction processing on the original image.
前記肌領域特定手段の特定した前記未確定領域の画素を前記背景色に基づいて、前記被写体の顎下ラインより上の領域と下の領域とでそれぞれ異なる閾値を用いて前記トライマップを更新する閾値判定手段
を更に備えることを特徴とする請求項1又は請求項2に記載の画像処理装置。
Based on the background color, the trimap is updated by using different threshold values for the area above and below the submandibular line of the subject based on the background color of the pixels of the undefined area specified by the skin area specifying means. The image processing apparatus according to claim 1, further comprising a threshold determination unit.
前記胸元領域特定手段は、
首元探索領域を設定し、X軸方向における前記前景領域の画素数と前記未確定領域の画素数を比較することで前記首元位置を特定する
ことを特徴とする請求項1乃至請求項3のいずれかに記載の画像処理装置。
The chest region specifying means includes
4. A neck search area is set, and the neck position is identified by comparing the number of pixels in the foreground area and the number of pixels in the undetermined area in the X-axis direction. An image processing apparatus according to any one of the above.
前記色ヒストグラム判定手段は、
判定した髪の長さにより前記被写体の前記顎下ラインを特定し、特定した前記顎下ライン以下の領域の前記前景領域に対応する前記原画像の各画素値の色ヒストグラムを生成する色ヒストグラム生成手段と、
前記トライマップの前記顎下ライン以下の領域の前記未確定領域に対応する前記原画像の各画素値について、前記色ヒストグラム上に存在する色番号と近似または一致するか否かを判定する判定手段と、
近似または一致する場合は、前記トライマップにおいて前記未確定領域を構成する当該画素を前記前景領域に更新する第1の更新手段と、を備える
ことを特徴とする請求項1乃至請求項4のいずれかに記載の画像処理装置。
The color histogram determination means includes
Color histogram generation that identifies the submandibular line of the subject according to the determined hair length and generates a color histogram of each pixel value of the original image corresponding to the foreground region below the identified submandibular line Means,
Determination means for determining whether or not each pixel value of the original image corresponding to the undetermined area below the submandibular line of the trimap approximates or matches a color number existing on the color histogram. When,
5. The method according to claim 1, further comprising: a first updating unit configured to update the pixel constituting the undetermined region to the foreground region in the trimap when the two approximate or coincide with each other. An image processing apparatus according to claim 1.
前記色ヒストグラム生成手段は、
生成した色ヒストグラム上に存在する色番号のうち、当該色番号に属する画素数の少ない色番号を、前記色ヒストグラムから除外する
ことを特徴とする請求項5に記載の画像処理装置。
The color histogram generation means includes
The image processing apparatus according to claim 5, wherein color numbers having a small number of pixels belonging to the color number among color numbers existing on the generated color histogram are excluded from the color histogram.
前記色ヒストグラム判定手段が更新した前記トライマップに対して、前記未確定領域を構成する各画素を中心とした所定の大きさのマトリクスを生成し、生成された前記マトリクス内に存在する画素を、前記前景領域、前記背景領域、及び前記未確定領域のいずれに属するかを判定して、それぞれの領域ごとの画素数をカウントするマトリクス内カウンタ手段と、
前記マトリクス内カウンタ手段によりカウントされた前記前景領域の画素数が、カウントされた前記未確定領域の画素数より多い場合に、前記トライマップにおいて、当該マトリクスの中心の画素を前記前景領域に更新する第2の更新手段と、を更に備える
ことを特徴とする請求項1乃至請求項6のいずれかに記載の画像処理装置。
For the trimap updated by the color histogram determination means, a matrix having a predetermined size centered on each pixel constituting the uncertain region is generated, and pixels existing in the generated matrix are In-matrix counter means for determining whether it belongs to the foreground area, the background area, or the undefined area, and counting the number of pixels for each area;
When the number of pixels in the foreground area counted by the in-matrix counter means is larger than the counted number of pixels in the undetermined area, the center pixel of the matrix is updated to the foreground area in the trimap. The image processing apparatus according to claim 1, further comprising: a second update unit.
前記第2の更新手段は、
前記マトリクス内カウンタ手段の生成した前記マトリクス内において、前記背景領域に属する画素が1以上カウントされた場合には、当該マトリクスの中心画素を前記未確定領域と特定する
ことを特徴とする請求項8に記載の画像処理装置。
The second updating means includes
The center pixel of the matrix is specified as the undetermined area when one or more pixels belonging to the background area are counted in the matrix generated by the matrix counter means. An image processing apparatus according to 1.
被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理方法であって、
前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定ステップと、
前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定ステップと、
前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定ステップと、
前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定ステップと、
を含むことを特徴とする画像処理方法。
Each pixel constituting the original image obtained by photographing the upper body of the subject is classified into a background region, a foreground region that is a part of the subject, and an uncertain region that is unknown whether it belongs to the background region or the foreground region. An image processing method for generating a trimap which is a ternary image,
A silhouette specifying step of binarizing the original image to specify the silhouette of the subject;
A pixel outside the silhouette is specified as a pixel in the background area, a pixel in the silhouette is specified as a pixel in the undetermined area, and a pixel in the skin color area of the subject is selected from the pixels in the undetermined area. A skin region specifying step of updating to a region and generating the trimap;
A chest region specifying step of specifying a chest region by specifying a neck position of the subject, and updating a pixel corresponding to the chest region to the foreground region;
A color histogram determination step of determining the hair length of the subject to generate color histograms in different ranges, and updating the trimap using the color histogram;
An image processing method comprising:
コンピュータを、被写体の上半身を撮影した原画像を構成する各画素を、背景領域と、前記被写体の部分である前景領域と、前記背景領域又は前記前景領域のいずれに属するか不明の未確定領域とに分類した3値画像であるトライマップを生成する画像処理装置として機能させるためのプログラムであって、
前記コンピュータを
前記原画像を2値化して前記被写体のシルエットを特定するシルエット特定手段、
前記シルエット外の画素を前記背景領域の画素に特定し、前記シルエット内の画素を前記未確定領域の画素に特定し、前記未確定領域の画素のうち前記被写体の肌色領域内の画素を前記前景領域に更新して前記トライマップを生成する肌領域特定手段、
前記被写体の首元位置を特定することによって胸元領域を特定し、前記胸元領域に対応する画素を前記前景領域に更新する胸元領域特定手段、
前記被写体の髪の長さを判定してそれぞれ異なる範囲にて色ヒストグラムを生成し、前記色ヒストグラムを用いて前記トライマップを更新する色ヒストグラム判定手段、
として機能させるためのプログラム。
Computer, each pixel constituting the original image obtained by photographing the upper body of the subject, a background region, a foreground region that is a part of the subject, an uncertain region that is unknown whether it belongs to the background region or the foreground region A program for functioning as an image processing device for generating a trimap which is a ternary image classified into
Silhouette specifying means for binarizing the original image and specifying the silhouette of the subject;
A pixel outside the silhouette is specified as a pixel in the background area, a pixel in the silhouette is specified as a pixel in the undetermined area, and a pixel in the skin color area of the subject is selected from the pixels in the undetermined area. Skin region specifying means for updating the region to generate the trimap,
A chest region specifying means for specifying a chest region by specifying a neck position of the subject and updating a pixel corresponding to the chest region to the foreground region;
Color histogram determination means for determining the length of the hair of the subject and generating color histograms in different ranges, and updating the trimap using the color histogram;
Program to function as.
JP2014063846A 2014-03-26 2014-03-26 Image processing apparatus, image processing method, and program Active JP6343998B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014063846A JP6343998B2 (en) 2014-03-26 2014-03-26 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014063846A JP6343998B2 (en) 2014-03-26 2014-03-26 Image processing apparatus, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2015186224A true JP2015186224A (en) 2015-10-22
JP6343998B2 JP6343998B2 (en) 2018-06-20

Family

ID=54352279

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014063846A Active JP6343998B2 (en) 2014-03-26 2014-03-26 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP6343998B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022528294A (en) * 2019-07-15 2022-06-09 グーグル エルエルシー Video background subtraction method using depth
JP7309132B1 (en) * 2023-02-07 2023-07-18 株式会社ヘミボーラ Image Synthesis Method in Chroma Key Processing

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7103608B2 (en) 2020-08-27 2022-07-20 テクニカ合同株式会社 Manufacturing method of recycled material using unused ready-mixed concrete

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010066802A (en) * 2008-09-08 2010-03-25 Sony Corp Image processing apparatus and method, and program
JP2012124873A (en) * 2010-12-10 2012-06-28 Canon Inc Image processing system and image processing method
JP2012133607A (en) * 2010-12-22 2012-07-12 Casio Comput Co Ltd Image processing apparatus, image processing method and program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010066802A (en) * 2008-09-08 2010-03-25 Sony Corp Image processing apparatus and method, and program
JP2012124873A (en) * 2010-12-10 2012-06-28 Canon Inc Image processing system and image processing method
JP2012133607A (en) * 2010-12-22 2012-07-12 Casio Comput Co Ltd Image processing apparatus, image processing method and program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022528294A (en) * 2019-07-15 2022-06-09 グーグル エルエルシー Video background subtraction method using depth
JP7110502B2 (en) 2019-07-15 2022-08-01 グーグル エルエルシー Image Background Subtraction Using Depth
US11727577B2 (en) 2019-07-15 2023-08-15 Google Llc Video background subtraction using depth
JP7309132B1 (en) * 2023-02-07 2023-07-18 株式会社ヘミボーラ Image Synthesis Method in Chroma Key Processing

Also Published As

Publication number Publication date
JP6343998B2 (en) 2018-06-20

Similar Documents

Publication Publication Date Title
CN105590312B (en) Foreground image dividing method and device
EP2980755B1 (en) Method for partitioning area, and inspection device
JP6194692B2 (en) Trimap generation device, Trimap generation method, and program
CN108537239B (en) Method for detecting image saliency target
JP5298831B2 (en) Image processing apparatus and program
US20100066761A1 (en) Method of designating an object in an image
CN111563908B (en) Image processing method and related device
US10991104B2 (en) Image processing device, image processing method, and program
WO2019197021A1 (en) Device and method for instance-level segmentation of an image
JP2019207535A (en) Information processing apparatus, information processing method, and program
JP6343998B2 (en) Image processing apparatus, image processing method, and program
JP2021517281A (en) Multi-gesture fine division method for smart home scenes
JP2018206252A (en) Image processing system, evaluation model construction method, image processing method, and program
CN109255792A (en) A kind of dividing method of video image, device, terminal device and storage medium
EP3291179B1 (en) Image processing device, image processing method, and image processing program
JP6546385B2 (en) IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, AND PROGRAM
JP7208479B2 (en) Information processing device, information processing method, and program
JP2013097584A (en) Image processor, image processing method and program
Lindblad et al. Exact linear time euclidean distance transforms of grid line sampled shapes
JP2016081472A (en) Image processing device, and image processing method and program
Hanbury How do superpixels affect image segmentation?
Csillik Superpixels: The end of pixels in obia. A comparison of stat-of-the-art superpixel methods for remote sensing data
Kim et al. Depth guided selection of adaptive region of interest for GrabCut-based image segmentation
Cheng et al. Interactive exploration of microstructural features in gigapixel microscopy images
JP2016045744A (en) Image processor, image processing method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170130

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170925

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20171024

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20171130

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180507

R150 Certificate of patent or registration of utility model

Ref document number: 6343998

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150