JP2010170219A - Apparatus, method and program for processing image, and printer - Google Patents
Apparatus, method and program for processing image, and printer Download PDFInfo
- Publication number
- JP2010170219A JP2010170219A JP2009010328A JP2009010328A JP2010170219A JP 2010170219 A JP2010170219 A JP 2010170219A JP 2009010328 A JP2009010328 A JP 2009010328A JP 2009010328 A JP2009010328 A JP 2009010328A JP 2010170219 A JP2010170219 A JP 2010170219A
- Authority
- JP
- Japan
- Prior art keywords
- area
- image
- face
- deformation
- enlargement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、画像処理装置、画像処理方法、画像処理プログラムおよび印刷装置に関する。 The present invention relates to an image processing apparatus, an image processing method, an image processing program, and a printing apparatus.
デジタル画像を対象に、画像を変形するための画像処理技術が知られている(特許文献1参照。)。特許文献1には、顔の画像上の一部の領域(頬の画像を表す領域)を補正領域として設定し、補正領域を所定のパターンに従い複数の小領域に分割し、小領域毎に設定された倍率で画像を拡大または縮小することにより、顔の形状を変形する画像処理が開示されている。
An image processing technique for deforming an image for a digital image is known (see Patent Document 1). In
またユーザーは、画像に顔を含む人物が写っている場合に、人物の体型が好みの体型(例えば、細身の体型)に変形された画像を得たいと望むことがある。このような要望に応える変形処理として、画像内に特定領域を設定してこの特定領域に対して一律な圧縮処理を施し、同時に、当該特定領域外の領域に対して一律な拡大処理を施す場合がある。しかし上記一律な変形(圧縮および拡大)処理を施すと、特定領域あるいは特定領域外に含まれる人物の顔も変形の影響を受け、その結果、顔の縦横比が大きく変化した画像が得られてしまう。このように顔の縦横比が大きく変化した人物の画像(例えば、顔が著しく横長になった画像)は、ユーザーに違和感を与えてしまう。 In addition, when a person including a face is captured in an image, the user may desire to obtain an image in which the figure of the person is transformed into a favorite figure (for example, a slim figure). As a deformation process that meets such demands, a specific area is set in an image and uniform compression processing is performed on the specific area, and at the same time, uniform enlargement processing is performed on an area outside the specific area. There is. However, when the uniform deformation (compression and enlargement) processing is performed, the face of the person included in the specific area or outside the specific area is also affected by the deformation, and as a result, an image in which the aspect ratio of the face is greatly changed is obtained. End up. In this way, an image of a person whose face aspect ratio has changed significantly (for example, an image in which the face is extremely long) gives the user a sense of discomfort.
本発明は上記課題に鑑みてなされたものであり、人物を含む画像について、より見栄えのよい変形結果を容易に得ることが可能な画像処理装置、画像処理方法、画像処理プログラムおよび印刷装置を提供することを目的とする。 The present invention has been made in view of the above problems, and provides an image processing apparatus, an image processing method, an image processing program, and a printing apparatus capable of easily obtaining a better-looking deformation result for an image including a person. The purpose is to do.
上記目的を達成するため、本発明の画像処理装置は、顔画像が含まれる対象画像において、対象画像内に圧縮領域と拡大領域とを設定する領域設定部と、所定の拡大率によって、上記拡大領域を特定方向に拡大する画像変形部と、上記顔画像の少なくとも一部が上記拡大領域に含まれている場合に、当該拡大領域に含まれている顔画像が上記特定方向に圧縮されるように、上記拡大率に応じて決定した圧縮量によって上記顔画像を変形する顔変形部とを備える。本発明によれば、顔変形部は、拡大領域に含まれる顔画像が、拡大領域の拡大率に応じて決定した圧縮量によって特定方向に圧縮されるように変形させる。そのため、画像変形部によって拡大領域が拡大されても、結果的に顔の縦横比は大きく崩れることが無い。よって、ユーザーに違和感を与えることの無い画像を得ることができる。なお、画像変形部による処理と顔変形部による処理の順番はどちらが先でも良い。 In order to achieve the above object, the image processing apparatus according to the present invention includes a region setting unit that sets a compression region and an enlargement region in a target image in a target image including a face image, and a predetermined enlargement ratio. When an image deforming unit that enlarges an area in a specific direction and at least a part of the face image are included in the enlarged area, the face image included in the enlarged area is compressed in the specific direction. And a face deformation unit that deforms the face image by a compression amount determined according to the enlargement ratio. According to the present invention, the face deforming unit deforms the face image included in the enlarged area so as to be compressed in a specific direction by the compression amount determined according to the enlargement ratio of the enlarged area. Therefore, even if the enlargement area is enlarged by the image deformation unit, the aspect ratio of the face does not collapse greatly as a result. Therefore, an image that does not give the user a sense of incongruity can be obtained. Note that the order of processing by the image deformation unit and processing by the face deformation unit may be first.
上記画像変形部は、所定の圧縮率によって上記圧縮領域を上記特定方向に圧縮し、上記顔変形部は、上記顔画像の少なくとも一部が上記圧縮領域に含まれている場合に、当該圧縮領域に含まれている顔画像が上記特定方向に拡大されるように、上記圧縮率に応じて決定した拡大量によって上記顔画像を変形するとしてもよい。当該構成によれば、拡大領域に含まれる顔画像は拡大領域における拡大効果をある程度打ち消すように圧縮されるという効果に加え、圧縮領域に含まれる顔画像は圧縮領域における圧縮効果をある程度打ち消すように拡大されるという効果も奏する。なお、圧縮領域と拡大領域とに跨る位置に存在する顔画像については、圧縮領域に含まれる範囲を特定方向に拡大し、拡大領域に含まれる範囲を特定方向に圧縮する。 The image deformation unit compresses the compression region in the specific direction at a predetermined compression rate, and the face deformation unit is configured to compress the compression region when at least a part of the face image is included in the compression region. The face image may be deformed by an enlargement amount determined according to the compression rate so that the face image included in the image is enlarged in the specific direction. According to this configuration, in addition to the effect that the face image included in the enlarged region is compressed so as to cancel the enlargement effect in the enlarged region to some extent, the face image included in the compressed region cancels the compression effect in the compressed region to some extent. There is also an effect that it is enlarged. For a face image that exists at a position straddling the compression area and the enlargement area, the range included in the compression area is expanded in a specific direction, and the range included in the expansion area is compressed in a specific direction.
上記顔変形部は、上記顔画像の上下方向と上記特定方向とがなす角度が所定の基準角度より大きい場合に、上記顔画像の変形を実行するとしてもよい。当該構成によれば、上下方向が特定方向と略平行な顔画像については変形対象から除外し、特定方向に対して上下方向がある程度立った(略垂直な)顔画像について、拡大領域(圧縮領域)における拡大率(圧縮率)に応じた変形を行なうことができる。 The face deformation unit may perform the deformation of the face image when an angle formed by the vertical direction of the face image and the specific direction is larger than a predetermined reference angle. According to this configuration, the face image whose vertical direction is substantially parallel to the specific direction is excluded from the deformation target, and the enlarged image (compressed region) of the face image whose vertical direction stands to some extent (substantially perpendicular) with respect to the specific direction. ) In accordance with the enlargement ratio (compression ratio).
上記顔変形部は、上記対象画像内に複数の顔画像が存在する場合に、少なくとも一部が互いに重なっている各顔画像を除いた顔画像に対して変形を実行するとしてもよい。当該構成によれば、互いに重なっている各顔画像について個々に変形を行なうことで却って画像が全体的に破綻してしまう、といった不都合を防止できる。 The face deforming unit may perform deformation on a face image excluding face images at least partially overlapping each other when a plurality of face images exist in the target image. According to this configuration, it is possible to prevent the inconvenience that the images collapse on the contrary by individually deforming the face images that overlap each other.
上記顔変形部は、上記拡大率が示す数値のうちの所定割合の数値に基づいて上記圧縮量を決定するとしてもよい。例えば、上記拡大率が20%であれば、当該20%という数値の何割かの数値を上記圧縮量とする。このように、拡大領域に対する拡大効果を完全に打ち消すような圧縮量を顔画像に適用するのではなく、拡大率が示す数値のうちの所定割合の数値に基づいて顔画像の圧縮量を決定することで、画像変形部による処理と顔変形部による処理の両方が終わった後において、拡大領域における顔と顔以外の部分とのバランスが最適となった画像を得ることができる。 The face deforming unit may determine the compression amount based on a predetermined ratio of the numerical values indicated by the enlargement ratio. For example, if the enlargement ratio is 20%, a numerical value that is a percentage of the numerical value of 20% is used as the compression amount. Thus, instead of applying a compression amount that completely cancels the enlargement effect on the enlargement region to the face image, the compression amount of the face image is determined based on a numerical value of a predetermined ratio of the numerical values indicated by the enlargement rate. Thus, after both the processing by the image deforming unit and the processing by the face deforming unit are finished, an image in which the balance between the face and the part other than the face in the enlarged region is optimal can be obtained.
これまでは、本発明の技術的思想を画像処理装置として説明したが、上述した画像処理装置が備える各手段に対応した各工程を備えた画像処理方法の発明や、上述した画像処理装置が備える各手段に対応した各機能をコンピューターに実行させる画像処理プログラムの発明をも把握することができる。また、上記の画像処理装置、画像処理方法および画像処理プログラムは具体的には、パーソナルコンピューターやサーバー等のハードウェアによって実現されてもよいし、画像入力装置としてのデジタルスチルカメラやスキャナー、あるいは、画像出力装置としてのプリンター(印刷装置)やプロジェクターやフォトヴューワー等、様々な製品によって実現することができる。 So far, the technical idea of the present invention has been described as an image processing apparatus. However, the invention of the image processing method including each process corresponding to each means included in the above-described image processing apparatus and the above-described image processing apparatus are included. It is also possible to grasp the invention of an image processing program that causes a computer to execute each function corresponding to each means. Further, the image processing device, the image processing method, and the image processing program may be specifically realized by hardware such as a personal computer or a server, or a digital still camera or scanner as an image input device, or It can be realized by various products such as a printer (printing device) as an image output device, a projector, and a photo viewer.
下記の順序に従って、本発明の実施形態を説明する。
1.画像処理装置の概略構成
2.画像補正処理
3.まとめ
The embodiments of the present invention will be described in the following order.
1. 1. Schematic configuration of
1.画像処理装置の概略構成
図1は、本発明にかかる画像処理装置の一例としてのプリンター100の構成を概略的に示す説明図である。プリンター100は、メモリーカードMC等の記録メディアから取得した画像データに基づき画像を印刷する、いわゆるダイレクトプリントに対応したカラーインクジェットプリンターである。プリンター100は、内部メモリー120と、CPU110と、操作部140と、表示部150と、プリンターエンジン160と、カードインターフェース(カードI/F)170と、カードスロット172とを備えている。
1. Schematic Configuration of Image Processing Device FIG. 1 is an explanatory diagram schematically showing the configuration of a
内部メモリー120は、ROMやRAMによって構成されており、機能ブロックとして、画像補正処理部200と、表示処理部310と、印刷処理部320とを備えている。画像補正処理部200は、所定のオペレーティングシステムの下で、後述する画像補正処理を実行するためのコンピュータープログラムである。画像補正処理部200は、プログラムモジュールとして、顔領域検出部210と、変形方向設定部220と、一方向変形部230とを有している。一方向変形部230は、RAMに設けられた一時記憶領域であるバッファ領域と、対応画素数テーブル410とを用いることにより、画像補正処理の一種としての一方向変形処理を実行する。一方向変形部230は、特許請求の範囲における領域設定部および画像変形部を兼ねている。さらに、画像補正処理部200は、プログラムモジュールとして、顔変形部240を含んでいる。顔変形部240は、分割点配置パターンテーブル420を用いて、画像補正処理の一種としての顔変形処理を実行する。これら各部の機能については後述する。
The
表示処理部310は、表示部150を制御して、表示部150上に処理メニューやメッセージや画像等を表示させるディスプレードライバーである。印刷処理部320は、画像データに対して所定の色変換処理やハーフトーン処理を施すことにより画素毎のインク量を規定した印刷データを生成し、プリンターエンジン160を制御して当該印刷データに基づいて画像の印刷を実行させるためのコンピュータープログラムである。印刷処理部320による色変換処理やハーフトーン処理の処理対象となる画像データには、例えば、画像補正処理部200によって画像補正処理が実行された後の画像を表す画像データが該当する。CPU110は、上述したこれらのプログラムを内部メモリー120から読み出して実行することにより、これら各部の機能をそれぞれ実現する。
The
操作部140は、ボタンやタッチパネルを備えておりユーザーによる指示等の入力を受け付ける。表示部150は、例えば液晶ディスプレーによって構成されている。プリンターエンジン160は、印刷処理部320から送信される印刷データに基づき印刷を行う印刷機構である。カードI/F170は、カードスロット172に挿入されたメモリーカードMCとの間でデータのやり取りを行うためのインターフェースである。プリンター100は、カードI/F170以外にも、他の機器(例えばデジタルスチルカメラやパーソナルコンピューター)とのデータ通信を行うためのインターフェースを備える構成とすることもできる。以上の各構成要素は、バスを介して互いに接続されている。
プリンター100は、人画像を含む画像に対して顔変形処理および一方向変形処理を実行することにより、人画像を全体的に細くあるいは太く変形させることができるとともに、人物の顔のバランス(顔の縦横比)を適正化することができる。
The
The
2.画像補正処理
図2は、プリンター100によって実行される画像補正処理をフローチャートにより示している。
ステップS(以下、ステップの表記を省略する。)100では、画像補正処理部200は、処理対象となる対象画像を設定(取得)する。例えば、カードスロット172にメモリーカードMCが挿入されると、表示処理部310は、メモリーカードMCに格納された画像の表示を含むユーザーインターフェース(UI)を表示部150に表示させる。そして、画像補正処理部200は、当該UIからの入力に従って対象画像を設定する。
2. Image Correction Process FIG. 2 is a flowchart showing the image correction process executed by the
In step S (hereinafter, step notation is omitted) 100, the image
図3は、表示部150に表示されるUIの一例を示している。例えば、UIは、画像表示欄IAと、2つの画像切替用ボタンB1,B2と、通常印刷ボタンB3と、補正印刷ボタンB4と、キャンセル用ボタンB5とを備えている。ユーザーは、画像表示欄IAを見ながら画像切替用ボタンB1,B2を操作して対象画像を選択し、通常印刷ボタンB3、補正印刷ボタンB4のいずれかを押下することで対象画像を設定できる。図3の例では、人物P1,P2が写った画像TIが対象画像として選択されており、この状態でユーザーが通常印刷ボタンB3、補正印刷ボタンB4のいずれかを押下することで、画像補正処理部200は、画像TIを対象画像として設定する。なおUIは、メモリーカードMC内の複数の画像を一覧表示する構成とすることもできる。
FIG. 3 shows an example of a UI displayed on the
ユーザーが補正印刷ボタンB4を押下すると、画像補正処理部200は、対象画像に対して後述するように顔変形処理および一方向変形処理を施す。プリンター100は、当該フローチャート終了後は、補正処理が実行された画像を印刷する。ただし、ユーザーが通常印刷ボタンB3を押下した場合には、プリンター100は、対象画像について顔変形処理および一方向変形処理を行なうことなく、通常通り印刷する。
When the user presses the correction print button B4, the image
S200では、画像補正処理部200は、上記UIのボタンに対するユーザーの操作によって、「補正印刷」の実行が指示されているか否か判断し、「補正印刷」が指示されている場合にはS300以下の処理に進み、「通常印刷」が指示されている場合には当該フローチャートを終了する。以下では、S100においてユーザーが補正印刷ボタンB4を押下げし「補正印刷」の実行指示をしたとして、説明を続ける。
In S200, the image
S300では、顔領域検出部210が、対象画像を表す画像データをメモリーカードMCから内部メモリー120に読み出すとともに、対象画像における顔領域の検出を行う。顔領域とは、対象画像内の顔画像の少なくとも一部を含む領域であって、少なくとも所定の顔器官(目や鼻や口)を含むと想定される領域である。顔領域検出部210は、対象画像を表す画像データを解析して当該顔器官を含むと想定される矩形の領域を顔領域として検出する。顔領域の検出は、例えばテンプレートを利用したパターンマッチングによる方法(特開2006‐279460参照)といった公知の検出方法を用いて実行される。顔領域検出部210は、上記パターンマッチングにも、顔領域を検出可能な手法であればあらゆる手法を採用することができる。例えば、顔領域検出部210は、対象画像内に設定した矩形領域(検出対象領域)単位で、画像の各種情報(例えば、輝度情報やエッジ量やコントラスト等。)を入力し検出対象領域が顔領域に該当するか否かを示す情報を出力する、予め学習されたニューラルネットワークを用いることにより、顔領域の検出を行なっても良いし、サポートベクタマシンを利用して検出対象領域毎に顔領域であるか否かを判断してもよい。
In S300, the face
図4は、S300における顔領域の検出結果の一例を示す説明図である。図4の例では、対象画像TIに2人の人物P1,P2の画像が含まれているため、人物P1,P2の顔画像に対応する顔領域Fd(Fd1,Fd2)が検出されている。つまり、対象画像内に複数の顔画像が存在する場合には、顔領域検出部210によってそれぞれの顔画像にかかる顔領域Fdが検出される。顔領域Fdは、対応する顔における両目と鼻と口の各画像をすべて含む矩形の領域である。顔領域検出部210は、顔領域Fdを、その領域の4つの頂点の座標により特定する。ただし、メモリーカードMCに格納された対象画像を表す画像データに、既に対象画像内の顔領域Fdの検出結果(画像内の顔領域の位置を特定する情報)が付属情報として存在している場合もある。例えば、対象画像の撮影に用いられたデジタルスチルカメラの機能によって既に対象画像から顔領域Fdが検出され、その検出結果を示した情報が画像データとともにメモリーカードMCに記録されている場合等である。このような場合には、顔領域検出部210は対象画像から顔領域Fdの検出を行なう必要はなく、上記付属情報に基づいて対象画像内の顔領域Fdを特定する。
FIG. 4 is an explanatory diagram showing an example of a face area detection result in S300. In the example of FIG. 4, since the images of two persons P1 and P2 are included in the target image TI, face areas Fd (Fd1 and Fd2) corresponding to the face images of the persons P1 and P2 are detected. That is, when there are a plurality of face images in the target image, the face
S400では、変形方向設定部220が、一方向変形処理のための変形方向を設定する。以下、「変形方向」と言った場合には、一方向変形処理のための変形方向を意味する。変形方向は、特許請求の範囲における特定方向に該当する。変形方向は、対象画像の横方向または縦方向のどちらかである。本実施形態では、対象画像の長辺方向を横方向とし、対象画像の短辺方向を縦方向として取り扱う。変形方向設定部220は、変形方向を外部からのユーザーの入力に応じて設定することも可能であるし、対象画像の解析結果によって設定することも可能である。
In S400, the deformation
変形方向をユーザーの入力に応じて設定する場合、変形方向設定部220は、表示処理部310に変形方向設定用のUIを表示する処理を実行することを指示し、表示処理部310は、当該指示に応じて、表示部150に変形方向設定用のUIを表示させる。ユーザーは、変形方向設定用のUIを介し、変形方向として「横方向」または「縦方向」のどちらを選択するかを入力する。変形方向設定部220は、ユーザーの入力によって選択された「横方向」または「縦方向」を、変形方向として設定する。なおユーザーは、表示部150に表示された対象画像を視認しながら、基本的には、対象画像の横方向と縦方向とのうち、対象画像内の顔の左右方向(顔の幅方向)となす角度が小さい方向を、変形方向として選択する。
When the deformation direction is set according to a user input, the deformation
変形方向を対象画像の解析結果によって設定する場合、変形方向設定部220は、対象画像中の顔の傾きに応じて横方向または縦方向のどちらかを変形方向として設定する。例えば、変形方向設定部220は、S300で顔領域検出部210が検出または特定した顔領域Fd内における、右目の画像を含む領域(右目領域)と左目を含む領域(左目領域)とを検出する。この器官領域(右目領域、左目領域)の検出は、顔領域の検出と同様に、例えばテンプレートを利用したパターンマッチングによる方法といった公知の検出方法を用いて実行することができる。
When the deformation direction is set according to the analysis result of the target image, the deformation
図5は、器官領域の検出結果の一例を示す説明図である。図5の例では、顔領域Fd1において、右目領域ERと左目領域ELとが検出されている。変形方向設定部220は、検出した右目領域ER、左目領域ELを、それぞれの領域の4つの頂点の座標によって特定することができる。変形方向設定部220は、右目領域ERの中心点CRと左目領域ELの中心点CLとを結ぶ線分L1に対して対象画像TI内で直交する線分L2を、顔の上下方向(顔の高さ方向)を規定する線分として扱い、線分L2の傾きを顔の傾きとする。例えば、変形方向設定部220は、対象画像TIの縦方向に対する線分L2の傾きが45°より小さい場合は、変形方向を「横方向」に設定する。一方、対象画像TIの縦方向に対する線分L2の傾きが45°より大きい場合は、変形方向を「縦方向」に設定する。線分L2の傾きが45°である場合、変形方向を予め定められた標準方向(例えば、横方向)に設定する。
FIG. 5 is an explanatory diagram showing an example of the detection result of the organ region. In the example of FIG. 5, the right eye area ER and the left eye area EL are detected in the face area Fd1. The deformation
対象画像に複数の顔が含まれている場合は、変形方向設定部220は、変形方向を、より大きい顔の傾きに応じて設定するとしてもよい。あるいは、対象画像に複数の顔が含まれている場合、対象画像の縦方向または横方向に対する傾きが最も小さい顔の傾きに応じて、変形方向を設定してもよいし、複数の顔の傾きの平均に応じて変形方向を設定してもよい。以下では、変形方向として横方向が設定されたものとして説明を続ける。
When the target image includes a plurality of faces, the deformation
S500では、顔変形部240が、対象画像内のある一つの顔領域Fdについて、その顔の高さ方向の傾きが後述の顔変形処理の対象となり得る傾きであるか否か判定する。具体的には、S400で設定された変形方向と、顔の高さ方向とがなす角度が基準角度より大きいか否か判定し、基準角度より大きい場合(Yes)にはS600(顔変形処理)に進み、基準角度以下である場合(No)にはS600をスキップしてS700に進む。ここで用いる基準角度としては、例えば45°が該当する。上述したようにS400では、対象画像内の顔の傾きを考慮して基本的にS500で“Yes”と判定されるような変形方向が設定されるものの、ユーザーの設定ミスや、顔が複数ある場合に一部の顔については変形方向に対して顔の高さ方向が寝ている(変形方向と顔の高さ方向との間の角度が45°以内。)事態もあり得る。そのためS500の判定を行う必要がある。
In S500, the
S500の判定を行なうために、画像補正処理部200は、S400でユーザーの入力に応じて変形方向を設定した場合であっても、顔の高さ方向を規定する線分L2の上記器官領域の検出に基づく特定を、顔毎に行なう。
S700では、顔変形部240は、対象画像内で検出された全ての顔領域Fdを一つずつ対象としたS500の判定を終えたか否か判定し、全ての顔領域FdについてS500の判定を終えている場合(Yes)にはS800に進み、終えていない場合(No)にはS500に戻り未判定の顔領域Fdを対象として処理を繰り返す。
In order to perform the determination of S500, the image
In S700, the
なお、図16に示すように、対象画像TI内において検出された複数の顔領域Fdが互いに重なっている場合もある。このように互いに重なっている各顔領域Fdについて顔変形処理の対象とした場合、一方の顔の変形結果が他方の顔に悪影響を与えるなど、かえって画像を破綻させてしまうこともあり得る。そのため本実施形態では、顔変形部240は、対象画像TIから複数の顔領域Fdが検出された場合には、一部分でも他の顔領域Fdと重なっている顔領域Fdについては顔変形処理の処理対象としない。つまりS500では、実質的に、変形方向と顔の高さ方向とがなす角度が基準角度以上かつ他の顔領域Fdと重なっていない顔領域Fdについて、“Yes”と判定する。
S600では、顔変形部240は、対象画像内の各顔画像を対象として、顔変形処理を実行する。
As shown in FIG. 16, a plurality of face regions Fd detected in the target image TI may overlap each other. In this way, when face regions Fd that overlap each other are subjected to face deformation processing, the result of deformation of one face may adversely affect the other face, and the image may be broken. Therefore, in the present embodiment, when a plurality of face areas Fd are detected from the target image TI, the
In S600, the
図6は、S600における顔変形処理の詳細をフローチャートにより示している。
S610では、顔変形部240は、顔領域Fd(直近のS500で判定の対象となった顔領域Fd)を基準にして変形領域を設定する。変形領域とは、対象画像内の顔領域Fdを含む領域であって顔変形処理の対象となる領域を意味する。変形領域は顔画像の全体をカバーする矩形領域であり、変形領域を顔画像として解釈してもよい。また上記では、顔領域Fd同士が重なるものについては、顔変形処理の対象から外すとしたが、変形領域同士が重なる各顔について顔変形処理の対象から外すとしてもよい。
FIG. 6 is a flowchart showing details of the face deformation process in S600.
In S610, the
図7は、変形領域の設定方法の一例を示す説明図である。図7において、実線の矩形TAは、顔領域Fdについて設定される変形領域TAを示す。基準線RLは、顔領域Fdの高さ方向(上下方向)を定義すると共に、顔領域Fdの幅方向(左右方向)の中心を示す線である。基準線RLは、矩形の顔領域Fdの重心を通り、顔領域Fdの高さ方向に沿った境界線に平行な直線である。基準線RLは線分L2と略平行な線であるとも言える。よって、上記S500の判定では、変形方向と線分L2との角度を調べる代わりに、変形方向と基準線RLとの角度を調べてもよい。変形領域TAは、顔領域Fdを基準線RLと平行な方向(高さ方向)および基準線RLに直交する方向(幅方向)に伸張した領域として設定される。具体的には、顔領域Fd1の高さ方向の長さをH1、幅方向の大きさをW1とすると、顔領域Fdを、上方向にk1・H1、下方向にk2・H1だけ伸ばすと共に、左右にそれぞれk3・W1だけ伸ばした領域が、変形領域TAとして設定される。k1,k2,k3は、所定の係数である。このように変形領域TAが設定されると、顔領域Fdの高さ方向の輪郭線に平行な直線である基準線RLは、変形領域TAの高さ方向の輪郭線にも平行な直線となる。また、基準線RLは、変形領域TAの幅を半分に分割する直線となる。 FIG. 7 is an explanatory diagram illustrating an example of a method for setting a deformation area. In FIG. 7, a solid-line rectangle TA indicates a deformation area TA set for the face area Fd. The reference line RL is a line that defines the height direction (vertical direction) of the face area Fd and indicates the center in the width direction (horizontal direction) of the face area Fd. The reference line RL is a straight line that passes through the center of gravity of the rectangular face area Fd and is parallel to the boundary line along the height direction of the face area Fd. It can be said that the reference line RL is a line substantially parallel to the line segment L2. Therefore, in the determination of S500, instead of examining the angle between the deformation direction and the line segment L2, the angle between the deformation direction and the reference line RL may be examined. The deformation area TA is set as an area obtained by extending the face area Fd in a direction parallel to the reference line RL (height direction) and a direction orthogonal to the reference line RL (width direction). Specifically, when the length in the height direction of the face region Fd1 is H1 and the size in the width direction is W1, the face region Fd is extended by k1 · H1 upward and k2 · H1 downward, A region extended by k3 · W1 to the left and right is set as the deformation region TA. k1, k2, and k3 are predetermined coefficients. When the deformation area TA is set in this way, the reference line RL, which is a straight line parallel to the contour line in the height direction of the face area Fd, becomes a straight line parallel to the contour line in the height direction of the deformation area TA. . The reference line RL is a straight line that divides the width of the deformation area TA in half.
図7に示すように、変形領域TAは、高さ方向に関しては、概ね顎から頭頂部までの画像を含み、幅方向に関しては、左右の頬の画像を含むような領域として設定される。すなわち本実施形態では、変形領域TAが概ねそのような範囲の画像を含む領域となるように、上述の係数k1,k2,k3を予め実験により求めて設定されている。
S620では、顔変形部240は、S610で設定された変形領域を複数の小領域に分割する。
As shown in FIG. 7, the deformation area TA is set as an area that generally includes an image from the jaw to the top of the head in the height direction and includes images of the left and right cheeks in the width direction. In other words, in the present embodiment, the above-described coefficients k1, k2, and k3 are set in advance through experiments so that the deformation area TA is an area that includes an image in such a range.
In S620, the
図8は、変形領域の小領域への分割方法の一例を示す説明図である。図8では、変形領域TAを記載している。顔変形部240は、変形領域TAに複数の分割点Dを配置し、分割点Dを結ぶ直線を用いて変形領域TAを複数の小領域に分割する。分割点Dの配置の態様(分割点Dの個数および位置)は、分割点配置パターンテーブル420により定義されている。顔変形部240は、分割点配置パターンテーブル420を参照して分割点Dを配置する。図8の例では、分割点Dは、水平分割線Lhと垂直分割線Lvとの交点と、水平分割線Lhおよび垂直分割線Lvと変形領域TAの外枠との交点とに配置される。水平分割線Lhおよび垂直分割線Lvは、変形領域TA内に分割点Dを配置するための基準となる線である。図8に示すように、本実施形態における分割点Dの配置では、基準線RLと直交する3本の水平分割線Lhと、基準線RLに平行な4本の垂直分割線Lvとが設定される。3本の水平分割線Lhを、変形領域TAの下方から順に、Lh1,Lh2,Lh3と呼ぶ。また、4本の垂直分割線Lvを、変形領域TAの左から順に、Lv1,Lv2,Lv3,Lv4と呼ぶ。
FIG. 8 is an explanatory diagram showing an example of a method of dividing the deformation area into small areas. FIG. 8 shows the deformation area TA. The
水平分割線Lh1は、変形領域TAにおいて、顎の画像より下方に配置され、水平分割線Lh2は、目の画像の下付近に配置され、水平分割線Lh3は、目の画像の上付近あるいは額の画像辺りに配置される。垂直分割線Lv1およびLv4は、頬のラインの画像の外側に配置され、垂直分割線Lv2およびLv3は、目尻の画像の外側に配置される。水平分割線Lhおよび垂直分割線Lvの配置は、水平分割線Lhおよび垂直分割線Lvと画像との位置関係が結果的に上述の位置関係となるように予め設定された変形領域TAの大きさとの対応関係に従い実行される。 The horizontal dividing line Lh1 is arranged below the chin image in the deformation area TA, the horizontal dividing line Lh2 is arranged near the bottom of the eye image, and the horizontal dividing line Lh3 is near the top of the eye image or the forehead. Around the image. The vertical division lines Lv1 and Lv4 are arranged outside the cheek line image, and the vertical division lines Lv2 and Lv3 are arranged outside the corner image. The horizontal dividing line Lh and the vertical dividing line Lv are arranged in accordance with the size of the deformation area TA set in advance so that the positional relationship between the horizontal dividing line Lh and the vertical dividing line Lv and the image is the above-described positional relationship. It is executed according to the correspondence relationship.
上述した水平分割線Lhと垂直分割線Lvとの配置に従い、水平分割線Lhと垂直分割線Lvとの交点と、水平分割線Lhおよび垂直分割線Lvと変形領域TAの外枠との交点とに、分割点Dが配置される。図8に示すように、水平分割線Lhi(i=1,2,3のいずれか)上に位置する分割点Dを、左から順に、D0i,D1i,D2i,D3i,D4i,D5iと呼ぶ。例えば、水平分割線Lh1上に位置する分割点Dは、D01,D11,D21,D31,D41,D51と呼ばれる。同様に、垂直分割線Lvj(j=1,2,3,4のいずれか)上に位置する分割点Dを、下から順に、Dj0,Dj1,Dj2,Dj3と呼ぶ。例えば、垂直分割線Lv1上に位置する分割点Dは、D10,D11,D12,D13と呼ばれる。本実施形態における分割点Dの配置は、基準線RLに対して対称の配置となっている。顔変形部240は、配置された分割点Dを結ぶ直線(水平分割線Lhおよび垂直分割線Lv)によって変形領域TAを複数の小領域に分割する。図8の例では、変形領域TAは、20個の矩形の小領域に分割されている。
According to the arrangement of the horizontal dividing line Lh and the vertical dividing line Lv described above, the intersection of the horizontal dividing line Lh and the vertical dividing line Lv, and the intersection of the horizontal dividing line Lh and the vertical dividing line Lv and the outer frame of the deformation area TA In addition, the dividing point D is arranged. As shown in FIG. 8, the division points D located on the horizontal division line Lhi (i = 1, 2, 3) are called D0i, D1i, D2i, D3i, D4i, D5i in order from the left. For example, the dividing points D located on the horizontal dividing line Lh1 are called D01, D11, D21, D31, D41, D51. Similarly, the dividing points D located on the vertical dividing line Lvj (j = 1, 2, 3, 4) are called Dj0, Dj1, Dj2, Dj3 in order from the bottom. For example, the division points D located on the vertical division line Lv1 are called D10, D11, D12, and D13. The arrangement of the dividing points D in the present embodiment is symmetrical with respect to the reference line RL. The
S630では、顔変形部240は、所定の分割点Dについての移動量を、一方向変形処理に用いる圧縮率あるいは拡大率に応じて決定する。ここで、後述の一方向変形処理(S800)では、対象画像内に圧縮領域および拡大領域を設定した状況下、圧縮領域については所定の圧縮率で圧縮し、拡大領域については所定の拡大率で拡大する。圧縮領域および拡大領域の設定は、一方向変形部230が行なう。具体的には、一方向変形部230は、対象画像を変形方向に垂直な分割線(水平分割線Lhおよび垂直分割線Lvとは異なる分割線)によって分割することにより、略中央位置の圧縮領域と、圧縮領域の左右に位置する拡大領域とに分けて設定する。
In S630, the
一方向変形部230による、当該変形方向に垂直な分割線による圧縮領域と拡大領域への分け方は様々であり、例えば、予め固定値として内部メモリー120等に設定されている圧縮領域と拡大領域との面積比によって分けてもよいし、操作部140および表示部150を介してユーザーが対象画像上に指定した分割線の位置によって分けてもよいし、あるいは、対象画像のより中央に位置する変形領域の全体を含む領域を圧縮領域として設定するとともに当該設定した圧縮領域の左右の領域を拡大領域として設定してもよい。以下では、単に「圧縮領域」と言った場合には一方向変形処理の為に対象領域内に設定された圧縮領域を意味し、単に「拡大領域」と言った場合には一方向変形処理の為に対象領域内に設定された拡大領域を意味する。
There are various ways of dividing the compression area and the expansion area by the dividing line perpendicular to the deformation direction by the
本実施形態では、一方向変形部230は、上記のような対象画像内における圧縮領域および拡大領域の設定を、少なくとも顔変形部240がS630の処理を開始する前に行なっておく。そして、S630では、顔変形部240は、対象画像内が圧縮領域と拡大領域とに分けられていることを前提として、S610で設定された変形領域が圧縮領域と拡大領域とのいずれに含まれているか判断し、圧縮領域に含まれている場合には当該圧縮領域に一方向変形処理で用いられる圧縮率に応じて上記移動量を決定し、拡大領域に含まれている場合には当該拡大領域に一方向変形処理で用いられる拡大率に応じて上記移動量を決定する。以下、単に「圧縮率」と表現した場合には、一方向変形処理の際に圧縮領域に適用される圧縮率を意味し、単に「拡大率」と表現した場合には、一方向変形処理の際に拡大領域に適用される拡大率を意味する。
In the present embodiment, the
圧縮率および拡大率は、予め固定値として内部メモリー120等に記憶されていてもよいし、操作部140等を介してユーザーによって入力された数値であってもよい。或いは、プリンター100は、一方向変形処理後の対象画像のサイズが変わり過ぎることを防止するために、UIを介して圧縮率と拡大率のいずれか一方のみをユーザーに入力させ、入力された圧縮率または拡大率の一方の値に応じて、入力されていない圧縮率または拡大率の値を決定するとしてもよい。
The compression rate and the enlargement rate may be stored in advance as fixed values in the
顔変形部240は、上述したように予め内部メモリー120に記憶されていた圧縮率および拡大率または、ユーザーによって入力された(あるいはユーザーの入力に従って決定された)圧縮率および拡大率を取得することができる。
ここではまず、顔変形部240が、変形領域は圧縮領域に含まれていると判断し、圧縮領域に適用される圧縮率として「30%」という値を取得した場合について説明する。30%の圧縮率とは、言い換えれば、一方向変形処理前の圧縮領域の変形方向における長さを一方向変形処理後に0.7倍の長さにするための倍率である。
The
Here, first, a case will be described in which the
顔変形部240は、変形領域が圧縮領域に含まれていると判断した場合、その変形領域にかかる顔画像の少なくとも一部が変形方向に拡大されるように、所定の分割点Dについて基準線RLから離れる向きへの移動量を圧縮率に応じて設定する。本実施形態では、顔変形部240は、各分割点Dのうち変形領域TAの枠よりも内側に存在する分割点D11,D12,D13,D21,D22,D23,D31,D32,D33,D41,D42,D43についての移動量を決定する。図8に示したように、基準線RLと直交する方向をH方向と呼び、基準線RLと平行な方向をV方向と呼ぶ。また、H方向については、向かって右側への移動量を正値(プラス)として表し、向かって左側への移動量を負値(マイナス)として表し、V方向については、上方への移動量を正値(プラス)として表し、下方への移動量を負値(マイナス)として表す。
When the
ここでは、変形方向とH方向とがなす角度は変形方向とV方向とがなす角度よりも小さいと言える。従って、所定の分割点Dについて、基準線RLから離れる向きへの移動量を圧縮率に基づいて設定し、設定した移動量に従って分割点Dを移動させれば、顔画像の一部は少なくとも変形方向にも拡大される。一例として、顔変形部240は、H方向における移動量として、基準線RLよりも左側の分割点D11,D21,D12,D22,D13,D23についてはマイナス側(左側)への移動量を設定し、基準線RLよりも右側の分割点D31,D41,D32,D42,D33,D43についてはプラス側(右側)への移動量を設定する。
Here, it can be said that the angle formed by the deformation direction and the H direction is smaller than the angle formed by the deformation direction and the V direction. Therefore, if a moving amount in a direction away from the reference line RL is set for a predetermined dividing point D based on the compression rate, and the dividing point D is moved according to the set moving amount, at least a part of the face image is deformed. It is also expanded in the direction. As an example, the
また顔変形部240は、V方向における移動量として、水平分割線Lh1上の分割点D11,D21,D31,D41についてはプラス側(上側)への移動量を設定し、水平分割線Lh3上の分割点D13,D23,D33,D43についてはマイナス側(下側)への移動量を設定する。このように水平分割線Lh1上の所定の分割点Dおよび水平分割線Lh3上の所定の分割点Dについて移動量を設定し、設定した移動量に従って分割点Dを移動させれば、顔画像の一部は少なくとも変形方向と直交する方向にも圧縮される。
Further, the
より具体的には、顔変形部240は、各分割点Dの移動量を設定する際、圧縮率が示す数値(30%)を、まず変形領域内の画像のH方向における変形量(拡大量)とV方向における変形量(圧縮量)とに所定割合で配分する。一例として、顔変形部240は、圧縮率が示す数値(30%)のうち7割(21%)をH方向における変形量(拡大量)に割り当て、圧縮率が示す数値(30%)から上記H方向における変形量(拡大量)を差し引いた残り(9%)を、V方向における変形量(圧縮量)に割り当てる。
More specifically, when the
顔変形部240は、H方向とV方向とに割り当てた変形量をさらに、各分割点Dへ移動量として配分する。一例として、顔変形部240は、H方向に割り当てた変形量(21%)の5割に当る数値(10.5%)を、各分割点D11,D12,D13,D21,D22,D23,D31,D32,D33,D41,D42,D43のH方向における移動量(基準線RLから離れる向きへの移動量)として設定し、V方向に割り当てた変形量(9%)の3割に当る数値(2.7%)を、水平分割線Lh1上の各分割点D11,D21,D31,D41のV方向プラス側への移動量として設定し、V方向に割り当てた変形量(9%)の7割に当る数値(6.3%)を、水平分割線Lh3上の各分割点D13,D23,D33,D43のV方向マイナス側への移動量として設定する。この結果、例えば、分割点D11については、H方向マイナス側への移動量として10.5%という数値が設定され、V方向プラス側への移動量として2.7%という数値が設定される。また、分割点D43については、H方向プラス側への移動量として10.5%という数値が設定され、V方向マイナス側への移動量として6.3%という数値が設定される。このように設定された分割点DのH方向、V方向への移動量は、変形領域TAのH方向、V方向の長さ(画素数)に対する割合を意味する。
The
上述したような、圧縮率が示す数値をH方向とV方向との変形量に配分する際の割合(配分比率)や、H方向の変形量やV方向の変形量を各分割点Dに配分する際の割合は、限られるものではない。また、顔変形部240は、分割点DのH方向、V方向の移動量について、分割点D毎に更なる変更を加えても良い。ただし、原則的には、各分割点Dの移動態様は、基準線RLを挟んで左右対称になるようにし、また、このように変形領域が圧縮領域に含まれている場合の顔変形処理においては、水平分割線Lh1上の各分割点D11,D21,D31,D41をV方向プラス側へ移動させる量よりも、水平分割線Lh3上の各分割点D13,D23,D33,D43をV方向マイナス側へ移動させる量を多くする。これは、水平分割線Lh1上の各分割点D11,D21,D31,D41をV方向プラス側へ大きく移動させることによって変形後の首の画像が長くなってしまうことを、防ぐためである。
As described above, the ratio (distribution ratio) when the numerical value indicated by the compression ratio is distributed to the deformation amount in the H direction and the V direction, the deformation amount in the H direction, and the deformation amount in the V direction are distributed to each division point D. The ratio when doing this is not limited. Further, the
図9は、顔変形部240が、上記のように圧縮率が示す数値をH方向とV方向との変形量に配分し、さらにH方向およびV方向の変形量を各分割点Dに配分して決定した移動量の一例を表によって示している。ただし図9では、上記のように圧縮率に応じて決定した各分割点Dの移動量を、さらに分割点Dの位置に応じて変更した後の移動量を示している。また図9では、各分割点Dの移動量を上記のようなn%といった表現ではなく、画素ピッチに換算した値によって示している。例えば、分割点D13については、H方向に沿って左側に画素ピッチの19倍の距離の移動量が設定され、V方向に沿って下方に画素ピッチの7倍の距離の移動量が設定されている。さらに、図9の例では、水平分割線Lh1上の分割点D11,D21,D31,D41および水平分割線Lh3上の分割点D13,D23,D33,D43に対してだけではなく、水平分割線Lh2上の分割点D12,D22,D32,D42に対しても、V方向における移動量を設定した例を示している。
S640では、顔変形部240は、S630で決定した分割点D毎の移動量に従い各分割点Dを移動して変形領域TA内で小領域を変形することによって、変形領域TA内の画像を変形させる。
In FIG. 9, the
In S640, the
図10は、図9に例示した分割点D毎の移動量に従って、各分割点Dの位置を移動させて変形領域TA内の画像を変形する際の具体的態様を示している。顔変形部240は、変形領域TAを構成する各小領域について、分割点Dの位置移動前の状態における小領域の画像が分割点Dの位置移動により新たに定義された小領域の画像となるように、画像の変形処理を行う。図10では比較の便宜のため、変形前の人物P1の顔の輪郭を鎖線で示し、変形後の人物P1の顔の輪郭を実線で示している。また図10では、移動後の分割点Dの符号には「’」を付し、移動前の分割点D(白丸)の符号には括弧を付している。例えば、分割点D11,D21,D22,D12を頂点とする小領域(ハッチングを付して示す小領域)の画像は、分割点D’11,D’21,D’22,D’12を頂点とする小領域の画像に変形される。この小領域画像の変形処理の詳細については後述する。
FIG. 10 shows a specific mode when the image in the deformation area TA is deformed by moving the position of each division point D according to the movement amount for each division point D illustrated in FIG. For each small area constituting the deformation area TA, the
図10に示すように、S640における分割点Dの移動の結果、基準線RLと平行な方向(V方向)に関し、水平分割線Lh1上に配置された分割点D11,D21,D31,D41の位置は上方に移動される一方、水平分割線Lh2,Lh3上に配置された分割点D12,D22,D32,D42,D13,D23,D33,D43の位置は下方に移動される。従って、水平分割線Lh1と水平分割線Lh3との間に位置する画像はV方向に関して圧縮され、その中でも特に水平分割線Lh1と水平分割線Lh2との間に位置する画像はV方向に関して強く圧縮される。 As shown in FIG. 10, as a result of the movement of the dividing point D in S640, the positions of the dividing points D11, D21, D31, D41 arranged on the horizontal dividing line Lh1 with respect to the direction (V direction) parallel to the reference line RL. Is moved upward, while the positions of the dividing points D12, D22, D32, D42, D13, D23, D33, D43 arranged on the horizontal dividing lines Lh2, Lh3 are moved downward. Therefore, an image located between the horizontal dividing line Lh1 and the horizontal dividing line Lh3 is compressed in the V direction, and among them, an image located between the horizontal dividing line Lh1 and the horizontal dividing line Lh2 is strongly compressed in the V direction. Is done.
基準線RLと直交する方向(H方向)に関しては、垂直分割線Lv1上に配置された分割点D11,D12,D13の位置は左方向に移動され、垂直分割線Lv4上に配置された分割点D41,D42,D43の位置は右方向に移動される。垂直分割線Lv2上に配置された分割点D21,D22,D23の位置は左方向に移動され、垂直分割線Lv3上に配置された分割点D31,D32,D33の位置は右方向に移動される。従って、垂直分割線Lv1より左側に位置する画像は、H方向に関して左側に圧縮され、垂直分割線Lv4より右側に位置する画像は、右側に圧縮される。また、垂直分割線Lv1と垂直分割線Lv2との間に位置する画像は、H方向に関して左側に移動しつつ拡大され、垂直分割線Lv3と垂直分割線Lv4との間に位置する画像は、H方向に関して右側に移動しつつ拡大される。さらに、垂直分割線Lv2と垂直分割線Lv3との間に位置する画像は、基準線RLを中心にH方向に関して拡大される。 With respect to the direction (H direction) orthogonal to the reference line RL, the positions of the dividing points D11, D12, D13 arranged on the vertical dividing line Lv1 are moved to the left, and the dividing points arranged on the vertical dividing line Lv4 The positions of D41, D42, and D43 are moved rightward. The positions of the dividing points D21, D22, D23 arranged on the vertical dividing line Lv2 are moved in the left direction, and the positions of the dividing points D31, D32, D33 arranged on the vertical dividing line Lv3 are moved in the right direction. . Accordingly, an image located on the left side of the vertical dividing line Lv1 is compressed to the left side in the H direction, and an image located on the right side of the vertical dividing line Lv4 is compressed to the right side. An image located between the vertical division line Lv1 and the vertical division line Lv2 is enlarged while moving to the left in the H direction, and an image located between the vertical division line Lv3 and the vertical division line Lv4 is H Enlarged while moving to the right with respect to direction. Further, the image located between the vertical dividing line Lv2 and the vertical dividing line Lv3 is enlarged with respect to the H direction around the reference line RL.
上述したように、水平分割線Lh1は顎の画像より下方に配置され、水平分割線Lh3は頭頂部の画像より上に配置され、垂直分割線Lv1およびLv4は、頬のラインの画像の外側に配置され、垂直分割線Lv2およびLv3は、目尻の画像の外側に配置される。そのため、このように変形領域が圧縮領域に含まれている場合の顔変形処理では、顔画像の内、顎から頭頂部にかけての部分の画像がV方向に縮小されるとともに、左右の頬と頬の間の顔画像が全体的にH方向に拡大される。以上のH方向およびV方向の変形態様を総合すると、かかる顔変形処理によって、変形領域TAに含まれる人物P1の顔の形状は、上下方向においてある程度押しつぶされ、幅方向に太った形状に変形される。 As described above, the horizontal dividing line Lh1 is arranged below the chin image, the horizontal dividing line Lh3 is arranged above the top image, and the vertical dividing lines Lv1 and Lv4 are outside the cheek line image. The vertical dividing lines Lv2 and Lv3 are arranged outside the image of the corner of the eye. Therefore, in the face deformation process when the deformation area is included in the compression area in this way, the image of the face image from the chin to the top of the head is reduced in the V direction, and the left and right cheeks and cheeks are also reduced. Is enlarged in the H direction as a whole. By combining the deformation modes in the H direction and the V direction, the face shape of the person P1 included in the deformation area TA is crushed to some extent in the vertical direction and deformed into a thick shape in the width direction by the face deformation process. .
なお顔変形部240は、S630において、圧縮率が示す数値を最終的に各分割点Dに配分して決定した各移動量に対して、さらに所定の補正係数を乗算し、当該補正係数を乗算して得られた各値を、各分割点Dの移動量としてもよい。ここで言う補正係数とは、例えば0以上1未満の数値であって、顔変形処理による顔の幅方向(H方向)における拡大の度合いおよび顔の高さ方向(V方向)における圧縮の度合いを抑制するための数値である。補正係数の具体値は、予め内部メモリー120に記憶されていてもよいし、ユーザーの入力に設定されてもよい。このような補正係数による変形度合いの抑制は、例えば、上記のように圧縮率に基づいて各分割点Dに配分した移動量を各分割点Dに適用して変形処理を施したときに、変形量が大きすぎて画像に破綻を生じさせる恐れがある場合等に行なう。
In step S630, the
図11は、S640において実行される小領域画像の変形処理を概念的に示す説明図である。図11では、分割点Dを黒丸で示している。また、説明を簡略化するために、4つの小領域について、左側に分割点Dの位置移動前の状態を、右側に分割点Dの位置移動後の状態を、それぞれ示している。図11の例では、中央の分割点Daが分割点Da’の位置に移動され、その他の分割点Dの位置は移動されない。これにより、例えば、分割点Dの移動前の分割点Da,Db,Dc,Ddを頂点とする矩形の小領域(以下「変形前注目小領域BSA」とも呼ぶ)の画像は、分割点Da’,Db,Dc,Ddを頂点とする矩形の小領域(以下「変形後注目小領域ASA」とも呼ぶ)の画像に変形される。 FIG. 11 is an explanatory diagram conceptually showing the small area image deformation process executed in S640. In FIG. 11, the dividing point D is indicated by a black circle. In order to simplify the description, for the four small regions, the state before the position movement of the dividing point D is shown on the left side, and the state after the position movement of the dividing point D is shown on the right side. In the example of FIG. 11, the central division point Da is moved to the position of the division point Da ′, and the positions of the other division points D are not moved. Thereby, for example, an image of a rectangular small area (hereinafter also referred to as “pre-deformation noticeable small area BSA”) having the vertices at the division points Da, Db, Dc, Dd before the movement of the division point D is obtained from the division point Da ′. , Db, Dc, and Dd are transformed into an image of a rectangular small area (hereinafter also referred to as “the noticed small area ASA after deformation”).
本実施形態では、矩形の小領域を小領域の重心CGを用いて4つの三角形領域に分割し、三角形領域単位で画像の変形処理を行っている。図11の例では、変形前注目小領域BSAが、変形前注目小領域BSAの重心CGを頂点の1つとする4つの三角形領域に分割される。同様に、変形後注目小領域ASAが、変形後注目小領域ASAの重心CG’を頂点の1つとする4つの三角形領域に分割される。そして、分割点Daの移動前後のそれぞれの状態において対応する三角形領域毎に、画像の変形処理が行われる。例えば、変形前注目小領域BSA中の分割点Da,Ddおよび重心CGを頂点とする三角形領域の画像が、変形後注目小領域ASA中の分割点Da’,Ddおよび重心CG’を頂点とする三角形領域の画像に変形される。 In the present embodiment, a rectangular small region is divided into four triangular regions using the center of gravity CG of the small region, and image deformation processing is performed in units of triangular regions. In the example of FIG. 11, the pre-deformation attention small area BSA is divided into four triangular areas having the centroid CG of the pre-deformation attention small area BSA as one vertex. Similarly, the post-deformation attention small area ASA is divided into four triangular areas having the centroid CG ′ of the post-deformation attention small area ASA as one vertex. Then, image deformation processing is performed for each corresponding triangular area in each state before and after the movement of the dividing point Da. For example, an image of a triangular area having vertices at the division points Da and Dd and the center of gravity CG in the attention small area BSA before deformation has a vertex at the division points Da ′ and Dd and the center of gravity CG ′ in the attention small area ASA after deformation. It is transformed into an image of a triangular area.
図12は、三角形領域における画像の変形処理方法の概念を示す説明図である。図12の例では、点s,t,uを頂点とする三角形領域stuの画像が、点s’,t’,u’を頂点とする三角形領域s’t’u’の画像に変形される。画像の変形は、変形後の三角形領域s’t’u’の画像中のある画素の位置が、変形前の三角形領域stuの画像中のどの位置に相当するかを算出し、算出された位置における変形前の画像における画素値を変形後の画像の画素値とすることにより行う。 FIG. 12 is an explanatory diagram showing the concept of an image deformation processing method in a triangular area. In the example of FIG. 12, the image of the triangular area stu with the points s, t, u as vertices is transformed into the image of the triangular area s′t′u ′ with the points s ′, t ′, u ′ as vertices. . For the deformation of the image, the position of a certain pixel in the image of the triangular area s't'u 'after the deformation corresponds to the position in the image of the triangular area stu before the deformation, and the calculated position This is performed by using the pixel value in the image before deformation in step S4 as the pixel value of the image after deformation.
例えば、図12において、変形後の三角形領域s’t’u’の画像中の注目画素p’の位置は、変形前の三角形領域stuの画像中の位置pに相当するものとする。位置pの算出は、以下のように行う。まず、注目画素p’の位置を、下記の式(1)のようにベクトルs’t’とベクトルs’u’との和で表現するための係数m1およびm2を算出する。 For example, in FIG. 12, the position of the pixel of interest p ′ in the image of the deformed triangular area s′t′u ′ corresponds to the position p in the image of the triangular area stu before deformation. The position p is calculated as follows. First, coefficients m1 and m2 for expressing the position of the target pixel p ′ by the sum of the vector s′t ′ and the vector s′u ′ as shown in the following equation (1) are calculated.
次に、算出された係数m1およびm2を用いて、下記の式(2)により、変形前の三角形領域stuにおけるベクトルstとベクトルsuとの和を算出することにより、位置pが求まる。 Next, by using the calculated coefficients m1 and m2, the position p is obtained by calculating the sum of the vector st and the vector su in the triangular area stu before deformation by the following equation (2).
変形前の三角形領域stuにおける位置pが、変形前の画像の画素中心位置に一致した場合には、当該画素の画素値が変形後の画像の画素値とされる。一方、変形前の三角形領域stuにおける位置pが、変形前の画像の画素中心位置からはずれた位置となった場合には、位置pの周囲の画素の画素値を用いたバイキュービック等の補間演算により、位置pにおける画素値を算出し、算出された画素値が変形後の画像の画素値とされる。 When the position p in the triangular area stu before deformation coincides with the pixel center position of the image before deformation, the pixel value of the pixel is set as the pixel value of the image after deformation. On the other hand, when the position p in the triangular area stu before deformation is shifted from the pixel center position of the image before deformation, an interpolation operation such as bicubic using the pixel values of the pixels around the position p. Thus, the pixel value at the position p is calculated, and the calculated pixel value is set as the pixel value of the image after deformation.
変形後の三角形領域s’t’u’の画像中の各画素について上述のように画素値を算出することにより、三角形領域stuの画像から三角形領域s’t’u’の画像への画像変形処理を行うことができる。このようにして、顔変形部240は、変形領域TAを構成する各小領域について、上述したように三角形領域を定義して変形処理を行う。
Image deformation from the image of the triangular area stu to the image of the triangular area s't'u 'by calculating the pixel value for each pixel in the image of the triangular area s't'u' after the deformation as described above Processing can be performed. In this way, the
次に、顔変形部240が、変形領域は拡大領域に含まれていると判断し、拡大領域に適用される拡大率を取得した場合について説明する。顔変形部240は、変形領域が拡大領域に含まれていると判断した場合には、変形領域にかかる顔画像の少なくとも一部が変形方向に圧縮されるように、所定の分割点Dについて基準線RLへ近づく向きへの移動量を拡大率に応じて設定する。この場合、変形領域が圧縮領域に含まれていたときと同様に、顔変形部240は、各分割点Dのうち変形領域TAの枠よりも内側に存在する分割点D11,D12,D13,D21,D22,D23,D31,D32,D33,D41,D42,D43についての移動量を決定する。これら所定の分割点Dについて、基準線RLに近づく向きへの移動量を拡大率に基づいて設定し、設定した移動量に従って分割点Dを移動させれば、顔画像の一部は少なくとも変形方向にも圧縮される。
Next, a case will be described in which the
また顔変形部240は、変形領域が拡大領域に含まれていると判断した場合、V方向における移動量として、水平分割線Lh1上の分割点D11,D21,D31,D41についてはマイナス側(下側)への移動量を設定し、水平分割線Lh3上の分割点D13,D23,D33,D43についてはプラス側(上側)への移動量を設定してもよい。このように水平分割線Lh1上の所定の分割点Dおよび水平分割線Lh3上の所定の分割点Dについて移動量を設定し、設定した移動量に従って分割点Dを移動させれば、顔画像の一部は少なくとも変形方向と直交する方向にも拡大される。
Further, when the
なお、顔変形部240は、変形領域が圧縮領域に含まれている場合と同様に、変形領域が拡大領域に含まれている場合の各分割点Dの移動量設定においても、拡大率が示す数値のうちの所定割合(例えば7割)の数値をH方向における変形量(圧縮量)に割り当てるとともに、拡大率が示す数値からこのH方向における変形量(圧縮量)を差し引いた残り(例えば3割)の数値を、V方向における変形量(拡大量)に割り当てる。さらに、顔変形部240は、変形領域が拡大領域に含まれている場合に上記のようにH方向とV方向とに割り当てた変形量を、変形領域が圧縮領域に含まれている場合と同様に、分割点D11,D12,D13,D21,D22,D23,D31,D32,D33,D41,D42,D43に対して所定の割合で分配して設定する。
Note that the
図17は、顔変形部240が、上記のように拡大率が示す数値をH方向とV方向との変形量に配分し、さらにH方向およびV方向の変形量を各分割点Dに配分して決定した移動量の一例を表によって示している。ただし図17では、上記のように拡大率に応じて決定した各分割点Dの移動量を、さらに分割点Dの位置に応じて変更した後の移動量を示している。また図17では図9と同様に、各分割点Dの移動量を画素ピッチに換算した値によって示している。図17の例では、水平分割線Lh1上の分割点D11,D21,D31,D41および水平分割線Lh3上の分割点D13,D23,D33,D43に対してだけではなく、水平分割線Lh2上の分割点D12,D22,D32,D42に対しても、V方向における移動量を設定した例を示している。
In FIG. 17, the
図18は、図17に例示した分割点D毎の移動量に従って、顔変形部240がS640において各分割点Dを移動して変形領域TA内の画像を変形する際の具体的態様を示している。図18でも図10と同様に、比較の便宜のため、変形前の人物P2の顔の輪郭を鎖線で示し、変形後の人物P2の顔の輪郭を実線で示している。また図18でも、移動後の分割点Dの符号に「’」を付し、移動前の分割点D(白丸)の符号には括弧を付している。
FIG. 18 shows a specific mode when the
図18に示すように、S640における分割点Dの移動の結果、V方向に関し、水平分割線Lh1上に配置された分割点D11,D21,D31,D41の位置は下方に移動される一方、水平分割線Lh2,Lh3上に配置された分割点D12,D22,D32,D42,D13,D23,D33,D43の位置は上方に移動される。従って、水平分割線Lh1と水平分割線Lh3との間に位置する画像はV方向に関して拡大され、その中でも特に水平分割線Lh1と水平分割線Lh2との間に位置する画像はV方向に関して強く拡大される。 As shown in FIG. 18, as a result of the movement of the dividing point D in S640, the positions of the dividing points D11, D21, D31, and D41 arranged on the horizontal dividing line Lh1 are moved downward with respect to the V direction. The positions of the dividing points D12, D22, D32, D42, D13, D23, D33, D43 arranged on the dividing lines Lh2, Lh3 are moved upward. Therefore, an image located between the horizontal dividing line Lh1 and the horizontal dividing line Lh3 is enlarged in the V direction, and among them, an image located between the horizontal dividing line Lh1 and the horizontal dividing line Lh2 is strongly enlarged in the V direction. Is done.
また図18では、H方向に関しては、垂直分割線Lv1,Lv2上に配置された分割点D11,D12,D13,D21,D22,D23の位置は右方向に移動され、垂直分割線Lv3,Lv4上に配置された分割点D31,D32,D33,D41,D42,D43の位置は左方向に移動される。従って、垂直分割線Lv1より左側に位置する画像は、H方向に関して右側に拡大され、垂直分割線Lv4より右側に位置する画像は、左側に拡大される。また、垂直分割線Lv1と垂直分割線Lv2との間に位置する画像は、H方向に関して右側に移動しつつ圧縮され、垂直分割線Lv3と垂直分割線Lv4との間に位置する画像は、H方向に関して左側に移動しつつ圧縮される。さらに、垂直分割線Lv2と垂直分割線Lv3との間に位置する画像は、基準線RLを中心にH方向に関して圧縮される。 In FIG. 18, with respect to the H direction, the positions of the dividing points D11, D12, D13, D21, D22, and D23 arranged on the vertical dividing lines Lv1 and Lv2 are moved to the right and on the vertical dividing lines Lv3 and Lv4. The positions of the division points D31, D32, D33, D41, D42, and D43 arranged at are moved to the left. Therefore, the image located on the left side of the vertical dividing line Lv1 is enlarged on the right side in the H direction, and the image located on the right side of the vertical dividing line Lv4 is enlarged on the left side. An image located between the vertical division line Lv1 and the vertical division line Lv2 is compressed while moving to the right in the H direction, and an image located between the vertical division line Lv3 and the vertical division line Lv4 is H Compressed while moving to the left with respect to direction. Furthermore, the image located between the vertical division line Lv2 and the vertical division line Lv3 is compressed in the H direction around the reference line RL.
上述したように、水平分割線Lh1は顎の画像より下方に配置され、水平分割線Lh3は頭頂部の画像より上に配置され、垂直分割線Lv1およびLv4は、頬のラインの画像の外側に配置され、垂直分割線Lv2およびLv3は、目尻の画像の外側に配置される。そのため、このように変形領域が拡大領域に含まれている場合の顔変形処理では、顔画像の内、顎から頭頂部にかけての部分の画像がV方向に拡大されるとともに、左右の頬と頬の間の顔画像が全体的にH方向において圧縮される。つまり変形領域が拡大領域に含まれている場合の顔変形処理では、変形領域TAに含まれる人物P2の顔の形状は、上下方向においてある程度伸長され、幅方向において細い形状に変形される。なお顔変形部240は、S630において、拡大率が示す数値を最終的に各分割点Dに配分して決定した各移動量に対してもさらに所定の補正係数を乗算し、この乗算によって得た各値を各分割点Dの移動量としてもよい。この場合の補正係数とは、例えば0以上1未満の数値であって、顔変形処理による顔の幅方向(H方向)における圧縮の度合いおよび顔の高さ方向(V方向)における拡大の度合いを抑制するための数値である。
As described above, the horizontal dividing line Lh1 is arranged below the chin image, the horizontal dividing line Lh3 is arranged above the top image, and the vertical dividing lines Lv1 and Lv4 are outside the cheek line image. The vertical dividing lines Lv2 and Lv3 are arranged outside the image of the corner of the eye. Therefore, in the face deformation process when the deformation area is included in the enlargement area in this way, the image of the face image from the chin to the top of the head is enlarged in the V direction, and the left and right cheeks and cheeks Are generally compressed in the H direction. That is, in the face deformation process when the deformation area is included in the enlarged area, the shape of the face of the person P2 included in the deformation area TA is elongated to some extent in the vertical direction and deformed into a narrow shape in the width direction. The
S800では、一方向変形部230が対象画像について一方向変形処理を実行する。上述したように、一方向変形部230は、一方向変形処理を行なうに際して変形方向に直交する分割線によって対象画像を圧縮領域と拡大領域とに分けている。
In S800, the
図13Aは、対象画像TIを圧縮領域ACと拡大領域AEとに分けた様子を例示している。図13Aでは、対象画像TIの中心を含む領域に圧縮領域ACが設定され、圧縮領域ACの左右両側に同一面積の拡大領域AE,AEが設定された例を示しており、圧縮領域ACには人物P1が、向かって左側の拡大領域AEには人物P2が含まれている。 FIG. 13A illustrates a state in which the target image TI is divided into a compressed area AC and an enlarged area AE. FIG. 13A shows an example in which a compression area AC is set in an area including the center of the target image TI, and enlarged areas AE and AE having the same area are set on both the left and right sides of the compression area AC. The person P1 is included in the enlarged area AE on the left side of the person P1.
図13Bは、対象画像TIに対して一方向変形処理を施した後の画像(変形済画像TI’と呼ぶ。)を例示している。つまり、一方向変形部230は、一方向変形処理を実行することにより、図13Bに示すように、圧縮領域ACを変形方向の長さが短縮された圧縮領域AC’に変形し、拡大領域AEを変形方向の長さが延長された拡大領域AE’に変形する。
FIG. 13B illustrates an image (referred to as a modified image TI ′) after the one-direction deformation process is performed on the target image TI. That is, the
図14は、S800において実行される一方向変形処理をフローチャートにより示している。
図15は、変形方向が横方向である場合の、一方向変形処理を模式的に示した説明図である。図15Aは、一方向変形処理が施される前の対象画像における画素の配置を示している。図15Bは、対応画素数テーブル410の一例を示している。図15Cは、一方向変形処理が施された画像(変形済画像)の画素の配置を示している。
FIG. 14 is a flowchart showing the unidirectional deformation process executed in S800.
FIG. 15 is an explanatory diagram schematically showing the unidirectional deformation process when the deformation direction is the horizontal direction. FIG. 15A shows an arrangement of pixels in the target image before the one-way deformation process is performed. FIG. 15B shows an example of the corresponding pixel number table 410. FIG. 15C illustrates an arrangement of pixels of an image (deformed image) that has been subjected to the unidirectional deformation process.
S810では、一方向変形部230は、S400において変形方向設定部220が設定した変形方向が横方向と縦方向とのいずれであるかを判断する。変形方向が横方向である場合、処理はS820に進む。一方、変形方向が縦方向である場合、処理はS850に進む。上述したように、本実施形態では横方向が変形方向であるため、S820に進む。
In S810, the
S820では、一方向変形部230は、対応画素数テーブル410を生成する。対応画素数テーブル410とは、対象画像の変形方向における各画素に対応する変形済画像の画素数を表すテーブルである。一方向変形部230は、圧縮領域および拡大領域それぞれについて既に設定されている倍率(圧縮率および拡大率)に基づいて、変形済画像の画素数(対応画素数)を決定する。そして、決定された対応画素数を対応画素数テーブル410に格納することにより、対応画素数テーブル410が生成される。
In S820, the
一方向変形部230は、対応画素数テーブル410の生成にあたっては、圧縮率や拡大率を倍率に変換する。例えば、上述したように圧縮率として「30%」という数値が設定されている場合には、この圧縮率を0.7倍という数値(倍率)に変換する。また、例えば、拡大率として30%という数値が設定されている場合には、この拡大率を1.3倍という数値(倍率)に変換する。一方向変形部230は、例えば、このような倍率の小数部についてハーフトーン処理による二値化を行って0と1との配列パターンを決定し、配列パターンの0または1の値に倍率の整数部を加えることによって、対象画像の画素毎の対応画素数を決定することができる。一方向変形部230は、対応画素数テーブル410の生成に当っては、ハーフトーン処理としては、ディザや誤差拡散などの周知の方法を用いることができる。また、倍率の小数部ごとに予め格納された配列パターンを用いてもよい。なおS820において、対応画素数テーブル410を生成するのに代えて、予め作成された対応画素数テーブルを用いてもよい。
In generating the corresponding pixel number table 410, the
図15Aでは、説明をごく簡単にするために、画像の横方向にそれぞれ5画素からなる領域1,2,3が存在し、領域1および領域3が拡大領域であり、領域2が圧縮領域である場合を想定して説明を行なう。ここでは、領域1の倍率が1.2倍、領域2の倍率が0.6倍、領域3の倍率が1.2倍であるとする。そのため、対応画素数テーブル(図15B)においては、領域1の5画素Px1〜Px5のうち、4つの画素Px1,Px2,Px3,Px5については、対応画素数が1に設定され、残り1つの画素Px4については、対応画素数が2に設定されている。また、領域2の5画素Px6〜Px10のうち、3つの画素Px6,Px8,Px10については、対応画素数が1に設定され、残り2つの画素Px7,Px9については、対応画素数が0に設定されている。また、領域3の5画素Px11〜Px15のうち、4つの画素Px11,Px12,Px13,Px15については、対応画素数が1に設定され、残り1つの画素Px14については、対応画素数が2に設定されている。
In FIG. 15A, for the sake of simplicity, there are
S830では、一方向変形部230は、対応画素数テーブルを参照し、内部メモリー120内のバッファ領域を用いて対象画像の1ライン分の画素の再配置を行なう。ここで、ラインとは、一方向変形処理における処理単位であり、長さが対象画像の横方向における全画素数分で、幅が1画素分の画像領域をいう。図15の例では、図15Cに示すように、領域1を構成する画素として、順次、対応画素数が1の画素Px1,Px2,Px3が1つずつ配置され、次に対応画素数が2の画素Px4が2つ配置され、次に対応画素数が1の画素Px5が1つ配置される。次いで、領域2を構成する画素として、対応画素数が1の画素Px6,Px8,Px10が順に1つずつ配置され、次に、領域3を構成する画素として、対応画素数が1の画素Px11,Px12,Px13が1つずつ配置され、対応画素数が2の画素Px14が2つ配置され、対応画素数が1の画素Px15が1つ配置される。このような1ライン分の画素の再配置を全ラインについて行なうことにより、対象画像の拡大領域はそれぞれ1.2倍に拡大され、圧縮領域は0.6倍に圧縮される。
In S830, the
S840では、一方向変形処理実行部230は、対象画像の全てのラインについて、画素の再配置が完了したか否かを判断する。全てのラインについて画素の再配置が完了している場合、一方向変形処理を終了し、その結果、図2のフローチャートが終了する。一方、画素の再配置が完了していない場合、処理はS830に戻され、全てのラインについて画素の再配置が完了するまで、S830,S840が繰り返し実行される。
In S840, the unidirectional deformation
一方向変形部230は、S850では、S820と同様に圧縮領域、拡大領域の各倍率を用いて対応画素数テーブル410を生成する。変形方向が縦方向の場合、対象画像の縦方向に並ぶ各画素についての対応画素数を規定した対応画素数テーブル410が生成される。対応画素数の決定方法はS820と同様であるので説明を省略する。
In S850, the
S860において、一方向変形部230は、対応画素数テーブルを参照して、上記バッファ領域に設けられた変形済画像の格納領域に、対象画像のラインを配置する。変形方向が横方向である場合には、画素単位でその画素に対応する対応画素数(0や1や2等)に応じた再配置を行なうが、変形方向が縦方向である場合には、ライン単位で、そのラインに対応する対応画素数に応じた配置を行なう。具体的には、上記バッファ領域の変形済画像の格納領域に、バッファ領域に格納された対象画像の1ラインを、当該1ラインに対応する対応画素数分のラインとして追加する。
In S860, the one-
S870では、一方向変形部230は、対象画像の全てのラインを対象としてS860の処理を完了したか否かを判断し、完了している場合は、一方向変形処理を終了し、その結果、図2のフローチャートが終了する。一方、完了していない場合は、処理はS860に戻され、対象画像の全てのラインを対象としてS860が行なわれるまで、S860,S870が繰り返し実行される。
In S870, the
3.まとめ
このように、S800の一方向変形処理により、対象画像において設定された圧縮領域は変形方向に圧縮され、拡大領域は変形方向に拡大される。そのため、図13Bに示したように、変形済画像TI’中の人物P1は、変形前の対象画像TI中の人物P1よりも全体的に細くなり(スリム化)、変形済画像TI’中の人物P2は、変形前の対象画像TI中の人物P2よりも全体的に太くなる。上述したように、S600の顔変形処理によって、圧縮領域に含まれていた顔の形状は上下方向に押しつぶされ幅方向に太った形状となっており、拡大領域に含まれていた顔の形状は、上下方向に伸長され幅方向にやせ細った形状となっている。そのため、顔変形処理および一方向変形処理が施された対象画像においては、圧縮領域に含まれていた人物画像は全体的にスリムな体型に変形し、かつ圧縮領域と拡大領域のいずれに含まれていた人物画像の顔も、縦横のバランスが違和感の無いものとなる。人間の体の中でも顔はユーザーにとって特に注意を引く部分であり、画像補正処理によって顔の縦横比が著しく変形していると、ユーザーは大きな違和感を覚えてしまう。本実施形態によれば、顔の縦横比については、処理前と比較して著しく変化することが抑制されるため、ユーザーは、見た目に違和感の無い画像を得ることができる。
3. Summary As described above, the compression area set in the target image is compressed in the deformation direction and the enlargement area is expanded in the deformation direction by the one-way deformation process in S800. Therefore, as shown in FIG. 13B, the person P1 in the transformed image TI ′ is generally thinner (slimmed) than the person P1 in the target image TI before transformation, and the person P1 in the transformed image TI ′ The person P2 is generally thicker than the person P2 in the target image TI before deformation. As described above, the face shape included in the compressed region is crushed in the vertical direction and thickened in the width direction by the face deformation process in S600, and the face shape included in the enlarged region is It is elongated in the vertical direction and thinned in the width direction. Therefore, in the target image that has undergone the face deformation process and the unidirectional deformation process, the human image included in the compressed area is deformed into a slim body as a whole and is included in either the compressed area or the enlarged area. The face of the person image that has been displayed also has no sense of incongruity between the vertical and horizontal balance. The face of the human body is a part that attracts particular attention to the user. If the aspect ratio of the face is significantly deformed by the image correction process, the user will feel a great sense of discomfort. According to the present embodiment, since the aspect ratio of the face is suppressed from being significantly changed as compared to before processing, the user can obtain an image that does not feel strange to the eye.
上記では、顔変形処理(S600)の後に一方向変形処理(S800)を実行する場合を例に説明を行なったが、これら2つの処理を行なう場合の処理の順序は問わず、一方向変形処理の後に顔変形処理を行なう(例えば、図2のフローチャートにおいて、S400とS500の間にS800を行なう)構成としてもよい。 In the above description, the case where the unidirectional deformation process (S800) is executed after the face deformation process (S600) has been described as an example. However, the unidirectional deformation process is performed regardless of the order of the processes when these two processes are performed. The face deformation process may be performed after (for example, S800 is performed between S400 and S500 in the flowchart of FIG. 2).
また、本実施形態では、対象画像中の顔の縦横比が変化し過ぎることを防止しつつも、全体的にバランスの良い画像を得るための種々の工夫をしている。上述したように、顔変形処理では、変形領域の画像のH方向における変形量として、一方向変形処理における圧縮率あるいは拡大率が示す数値をそのまま適用するのではなく、圧縮率あるいは拡大率が示す数値のうち所定割合分の数値を適用する。つまり、圧縮領域での圧縮をほぼ全て打ち消す程の拡大や、拡大領域での拡大をほぼ全て打ち消す程の圧縮を、顔変形処理で行なうと、顔と顔以外の体とのバランスが非常に悪い人物画像が得られてしまう恐れがある。そのため、あくまで顔変形処理における顔の幅方向の変形は、一方向変形処理による変形の効果がある程度勝るような度合いで行なうようにしている。 In the present embodiment, various measures are taken to obtain an image with a good overall balance while preventing the aspect ratio of the face in the target image from changing too much. As described above, in the face deformation process, the numerical value indicated by the compression ratio or enlargement ratio in the one-way deformation process is not applied as the deformation amount in the H direction of the image of the deformation area, but indicates the compression ratio or enlargement ratio. A numerical value corresponding to a predetermined ratio is applied. In other words, if the face deformation process is performed to enlarge enough to cancel almost all the compression in the compression area or almost all enlargement in the enlarged area, the balance between the face and the body other than the face is very poor. A person image may be obtained. For this reason, the deformation in the width direction of the face in the face deformation process is performed to such an extent that the effect of the deformation by the one-way deformation process is better to some extent.
上記の顔変形処理では、変形領域の全体が圧縮領域に含まれている場合(人物P1)、および変形領域の全体が拡大領域に含まれている場合(人物P2)の2つのケースについて説明を行なった。しかし、対象画像内での人物画像の位置や、圧縮領域および拡大領域の設定態様によっては、一つの変形領域が圧縮画像と拡大画像との境界を跨ぐ位置に設定されることもある。 In the face deformation process described above, two cases will be described: the case where the entire deformation area is included in the compression area (person P1) and the case where the entire deformation area is included in the enlargement area (person P2). I did it. However, depending on the position of the person image in the target image and the setting mode of the compression area and the enlargement area, one deformation area may be set at a position straddling the boundary between the compression image and the enlargement image.
図19Aは、ある人物の顔画像についての変形領域TAが、対象画像内の圧縮画像と拡大画像との境界(鎖線)を跨ぐ位置に設定された場合を例示している。このような場合、S630で顔変形部240は、変形領域TA内に上述したように配置した各分割点Dのうち圧縮領域に属する分割点Dに対しては、圧縮領域の圧縮率に基づいて(変形領域TA全体が圧縮領域に含まれていると想定して)上述のように算出した移動量を設定する。一方、変形領域TAの各分割点Dのうち拡大領域に属する分割点Dに対しては、拡大領域の拡大率に基づいて(変形領域TA全体が拡大領域に含まれていると想定して)上述のように算出した移動量を設定する。
FIG. 19A illustrates a case where the deformation area TA for a face image of a person is set at a position straddling the boundary (chain line) between the compressed image and the enlarged image in the target image. In such a case, in S630, the
このように各分割点Dの移動量を設定した後、S640において顔変形部240は、図19Bに示すように、変形領域TAを圧縮領域に属する変形領域TA1と拡大領域に属する変形領域TA2に分け、変形領域TA1内の画像については変形領域TA1内の分割点Dに設定した移動量に応じた変形を行ない、変形領域TA2内の画像については変形領域TA2内の分割点Dに設定した移動量に応じた変形を行なう。このような顔変形処理の結果、変形領域TA内の顔のうち、圧縮領域に属していた部分については変形方向において拡大され、拡大領域に属していた部分については変形方向において圧縮される。
After setting the movement amount of each division point D in this way, in S640, the
100…プリンター、110…CPU、120…内部メモリー、140…操作部、150…表示部、160…プリンターエンジン、170…カードI/F、172…カードスロット、200…画像補正処理部、210…顔領域検出部、220…変形方向設定部、230…一方向変形部、240…顔変形部、310…表示処理部、320…印刷処理部、410…対応画素数テーブル、420…分割点配置パターンテーブル
DESCRIPTION OF
Claims (8)
所定の拡大率によって、上記拡大領域を特定方向に拡大する画像変形部と、
上記顔画像の少なくとも一部が上記拡大領域に含まれている場合に、当該拡大領域に含まれている顔画像が上記特定方向に圧縮されるように、上記拡大率に応じて決定した圧縮量によって上記顔画像を変形する顔変形部とを備えることを特徴とする画像処理装置。 In a target image including a face image, an area setting unit that sets a compression area and an enlargement area in the target image;
An image deformation unit that enlarges the enlargement area in a specific direction with a predetermined enlargement ratio;
When at least a part of the face image is included in the enlargement area, the compression amount determined according to the enlargement ratio so that the face image included in the enlargement area is compressed in the specific direction. An image processing apparatus comprising: a face deforming unit that deforms the face image.
上記顔変形部は、上記顔画像の少なくとも一部が上記圧縮領域に含まれている場合に、当該圧縮領域に含まれている顔画像が上記特定方向に拡大されるように、上記圧縮率に応じて決定した拡大量によって上記顔画像を変形することを特徴とする請求項1に記載の画像処理装置。 The image transformation unit compresses the compression area in the specific direction by a predetermined compression rate,
The face deforming unit adjusts the compression rate so that the face image included in the compression area is enlarged in the specific direction when at least a part of the face image is included in the compression area. The image processing apparatus according to claim 1, wherein the face image is deformed by an enlargement amount determined accordingly.
所定の拡大率によって、上記拡大領域を特定方向に拡大する画像変形工程と、
上記顔画像の少なくとも一部が上記拡大領域に含まれている場合に、当該拡大領域に含まれている顔画像が上記特定方向に圧縮されるように、上記拡大率に応じて決定した圧縮量によって上記顔画像を変形する顔変形工程とを備えることを特徴とする画像処理方法。 In a target image including a face image, an area setting step for setting a compression area and an enlarged area in the target image;
An image transformation step of enlarging the enlargement area in a specific direction with a predetermined enlargement ratio;
When at least a part of the face image is included in the enlargement area, the compression amount determined according to the enlargement ratio so that the face image included in the enlargement area is compressed in the specific direction. And a face deformation step for deforming the face image.
所定の拡大率によって、上記拡大領域を特定方向に拡大する画像変形機能と、
上記顔画像の少なくとも一部が上記拡大領域に含まれている場合に、当該拡大領域に含まれている顔画像が上記特定方向に圧縮されるように、上記拡大率に応じて決定した圧縮量によって上記顔画像を変形する顔変形機能とをコンピューターに実行させることを特徴とする画像処理プログラム。 An area setting function for setting a compression area and an enlargement area in the target image in the target image including the face image;
An image transformation function for enlarging the enlargement area in a specific direction with a predetermined enlargement ratio;
When at least a part of the face image is included in the enlargement area, the compression amount determined according to the enlargement ratio so that the face image included in the enlargement area is compressed in the specific direction. An image processing program for causing a computer to execute a face deformation function for deforming the face image.
所定の拡大率によって、上記拡大領域を特定方向に拡大する画像変形部と、
上記顔画像の少なくとも一部が上記拡大領域に含まれている場合に、当該拡大領域に含まれている顔画像が上記特定方向に圧縮されるように、上記拡大率に応じて決定した圧縮量によって上記顔画像を変形する顔変形部とを備えることを特徴とする印刷装置。
In a target image including a face image, an area setting unit that sets a compression area and an enlargement area in the target image;
An image deformation unit that enlarges the enlargement area in a specific direction with a predetermined enlargement ratio;
When at least a part of the face image is included in the enlargement area, the compression amount determined according to the enlargement ratio so that the face image included in the enlargement area is compressed in the specific direction. A printing apparatus comprising: a face deformation unit that deforms the face image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009010328A JP2010170219A (en) | 2009-01-20 | 2009-01-20 | Apparatus, method and program for processing image, and printer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009010328A JP2010170219A (en) | 2009-01-20 | 2009-01-20 | Apparatus, method and program for processing image, and printer |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010170219A true JP2010170219A (en) | 2010-08-05 |
Family
ID=42702335
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009010328A Pending JP2010170219A (en) | 2009-01-20 | 2009-01-20 | Apparatus, method and program for processing image, and printer |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010170219A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013162451A (en) * | 2012-02-08 | 2013-08-19 | Tatsumi Denshi Kogyo Kk | Game photographing apparatus, game photographing method, and program |
WO2018193674A1 (en) * | 2017-04-20 | 2018-10-25 | シャープ株式会社 | Image processing device, image-capturing device, image printing device, control method of image processing device, and image processing program |
WO2018193677A1 (en) * | 2017-04-21 | 2018-10-25 | シャープ株式会社 | Image processing device, image capturing device, image printing device, control method of image processing device, and image processing program |
CN111080544A (en) * | 2019-12-09 | 2020-04-28 | Oppo广东移动通信有限公司 | Face distortion correction method and device based on image and electronic equipment |
-
2009
- 2009-01-20 JP JP2009010328A patent/JP2010170219A/en active Pending
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013162451A (en) * | 2012-02-08 | 2013-08-19 | Tatsumi Denshi Kogyo Kk | Game photographing apparatus, game photographing method, and program |
WO2018193674A1 (en) * | 2017-04-20 | 2018-10-25 | シャープ株式会社 | Image processing device, image-capturing device, image printing device, control method of image processing device, and image processing program |
WO2018193677A1 (en) * | 2017-04-21 | 2018-10-25 | シャープ株式会社 | Image processing device, image capturing device, image printing device, control method of image processing device, and image processing program |
CN110603565A (en) * | 2017-04-21 | 2019-12-20 | 夏普株式会社 | Image processing apparatus, imaging apparatus, image printing apparatus, control method for image processing apparatus, and image processing program |
US11069039B2 (en) | 2017-04-21 | 2021-07-20 | Sharp Kabushiki Kaisha | Image processing apparatus, imaging apparatus, image printing apparatus, method for controlling image processing apparatus, and image processing program |
CN111080544A (en) * | 2019-12-09 | 2020-04-28 | Oppo广东移动通信有限公司 | Face distortion correction method and device based on image and electronic equipment |
CN111080544B (en) * | 2019-12-09 | 2023-09-22 | Oppo广东移动通信有限公司 | Face distortion correction method and device based on image and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5115398B2 (en) | Image processing apparatus, image processing method, and image processing program | |
JP5239625B2 (en) | Image processing apparatus, image processing method, and image processing program | |
US8472751B2 (en) | Image processing device, image processing method, and image processing program | |
JP4973393B2 (en) | Image processing apparatus, image processing method, image processing program, and image processing system | |
US8224117B2 (en) | Image processing device, image processing method, and image processing program | |
KR101335755B1 (en) | Image transforming device, electronic device, image transforming method, image transforming program, and recording medium whereupon the program is recorded | |
JP5071162B2 (en) | Image processing apparatus, image processing method, and computer program for image processing | |
US8249312B2 (en) | Image processing device and image processing method | |
US20090028390A1 (en) | Image Processing for Estimating Subject Distance | |
JP2010170219A (en) | Apparatus, method and program for processing image, and printer | |
JP5256974B2 (en) | Image processing apparatus, image processing method, and program | |
US8031915B2 (en) | Image processing device and image processing method | |
JP6731073B2 (en) | Image processing apparatus, imaging apparatus, image printing apparatus, image processing apparatus control method, and image processing program | |
JP4930298B2 (en) | Specify image area | |
JP4501959B2 (en) | Image processing apparatus and image processing method | |
JP5003790B2 (en) | Image processing apparatus, image processing method, and computer program | |
JP2009217506A (en) | Image processor and image processing method | |
JP4816540B2 (en) | Image processing apparatus and image processing method | |
JP4946729B2 (en) | Image processing device | |
JP2009223566A (en) | Image processor, image processing method, and image processing program | |
JP2009110048A (en) | Setting of face area | |
JP2009055305A (en) | Image processing adding information to image | |
JP2009123101A (en) | Estimation of face image direction | |
JP2011141889A (en) | Image processing apparatus and method | |
JP2010003313A (en) | Image processor and image processing method |