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

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

Info

Publication number
JP2019101978A
JP2019101978A JP2017235293A JP2017235293A JP2019101978A JP 2019101978 A JP2019101978 A JP 2019101978A JP 2017235293 A JP2017235293 A JP 2017235293A JP 2017235293 A JP2017235293 A JP 2017235293A JP 2019101978 A JP2019101978 A JP 2019101978A
Authority
JP
Japan
Prior art keywords
illumination
dimensional shape
shape data
image processing
subject
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
Application number
JP2017235293A
Other languages
Japanese (ja)
Inventor
哲 鳥居
Satoru Torii
哲 鳥居
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2017235293A priority Critical patent/JP2019101978A/en
Publication of JP2019101978A publication Critical patent/JP2019101978A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)

Abstract

To prevent the reproduction of an unnatural shadow, when generating an image in which a shadow under a virtual illumination condition is reproduced on the basis of the three-dimensional shape data of a subject.SOLUTION: An image processing device relating to one embodiment of this invention which adds a shadow effect by virtual illumination to a captured image on the basis of three-dimensional shape data corresponding to the captured image includes extraction means for a subject area which extracts the three-dimensional shape data of the subject area from the three-dimensional shape data and movable range setting means which sets the movable range of the virtual illumination on the basis of the loss of the three-dimensional shape data, when the three-dimensional shape data of the subject area has a loss.SELECTED DRAWING: Figure 3

Description

本発明は、撮像画像に、所望の照明条件下で撮影したかのような陰影効果を付加する画像処理装置、画像処理方法、及びプログラムに関する。   The present invention relates to an image processing apparatus, an image processing method, and a program for adding a shadow effect as if captured under a desired illumination condition to a captured image.

撮像装置で被写体を撮影する場合、被写体に対する照明(光)の当たり方によって撮像画像は大きく変わる。例えば、人物である被写体に対して斜めから光が当たっているような照明条件下では、顔の陰影が強調され立体的な印象の撮像画像が得られる。しかしながら、被写体の後方から光が当たっているような強い逆光などの照明条件下では、被写体の一部あるいは全体が陰になり、暗くなった撮像画像になってしまう。そこで、撮像画像に、ユーザが所望する照明条件下で撮影したかのような陰影効果を付加する方法が、特許文献1及び2には開示されている。特許文献1には、被写体の3次元形状データを用いて、仮想的な照明条件下での陰影を再現した画像を生成し、撮像画像と合成する方法が開示されている。また、特許文献2には、被写体のサイズや曲率半径などの形状に応じて、仮想照明の照明位置の可動範囲を設定する方法が開示されている。   When the subject is photographed by the imaging device, the photographed image largely changes depending on how the illumination (light) strikes the subject. For example, under an illumination condition in which light is obliquely applied to a subject that is a person, the shadow of the face is enhanced, and a captured image of a three-dimensional impression can be obtained. However, under an illumination condition such as strong backlighting where light is coming from behind the subject, a part or the whole of the subject is shaded, resulting in a dark captured image. Thus, Patent Documents 1 and 2 disclose methods of adding a shading effect to a captured image as if captured under illumination conditions desired by the user. Patent Document 1 discloses a method of using a three-dimensional shape data of an object to generate an image that reproduces a shadow under virtual illumination conditions and combining the image with a captured image. Further, Patent Document 2 discloses a method of setting the movable range of the illumination position of the virtual illumination in accordance with the size of the subject, the radius of curvature, and the like.

尚、以下では、特許文献1及び2のように、撮影後に被写体の3次元形状データに基づいて仮想的な照明条件下での陰影を再現した画像を生成する処理を、ライティング処理と称する。   In the following, as in Patent Documents 1 and 2, processing for generating an image that reproduces a shadow under virtual illumination conditions based on three-dimensional shape data of an object after shooting is referred to as lighting processing.

特開2013−125292号公報JP, 2013-125292, A 特開2015−201839号公報Unexamined-Japanese-Patent No. 2015-201839

上記の特許文献1及び2には、被写体の3次元形状データに基づいてライティング処理を行うことが開示されている。しかしながら、被写体の3次元形状データは、必ずしも被写体の正確な3次元形状を表しているとは限らない。例えば、3次元形状データが、被写体の全周の3次元形状を取得できておらず、3次元形状に欠損が存在する場合がある。また、3次元形状データの取得精度が低く、被写体の表面に本来は存在しない凸凹が存在する場合もある。このように、3次元形状データは、被写体の本来の3次元形状を正確に表していないことがあり、このような3次元形状データに基づいてライティング処理を行うと、不自然な陰影が再現されてしまうことがある。   Patent Documents 1 and 2 above disclose that lighting processing is performed based on three-dimensional shape data of a subject. However, the three-dimensional shape data of the subject does not necessarily represent the accurate three-dimensional shape of the subject. For example, the three-dimensional shape data may not acquire the three-dimensional shape of the entire circumference of the subject, and a defect may exist in the three-dimensional shape. In addition, the accuracy of obtaining three-dimensional shape data may be low, and there may be unevenness that is not originally present on the surface of the subject. As described above, the three-dimensional shape data may not accurately represent the original three-dimensional shape of the subject. When lighting processing is performed based on such three-dimensional shape data, unnatural shadows are reproduced. There are times when

本発明は、このような問題に鑑みてなされたものであり、その目的とするところは、被写体の3次元形状データに基づいて、仮想的な照明条件下での陰影を再現した画像を生成する際に、不自然な陰影が再現されないようにすることにある。   The present invention has been made in view of such problems, and an object thereof is to generate an image that reproduces a shadow under virtual illumination conditions based on three-dimensional shape data of an object. In order to prevent unnatural shadows from being reproduced.

本発明の一実施形態に係る画像処理装置は、撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置であって、前記3次元形状データから、被写体領域の3次元形状データを抽出する前記被写体領域の抽出手段と、前記被写体領域の3次元形状データに欠損が存在する場合に、前記3次元形状データの前記欠損に基づいて、前記仮想照明の可動範囲を設定する可動範囲設定手段とを有することを特徴とする。   An image processing apparatus according to an embodiment of the present invention is an image processing apparatus that adds a shading effect by virtual illumination to the captured image based on three-dimensional shape data corresponding to the captured image, and the three-dimensional shape data From the object region extraction means for extracting three-dimensional shape data of the object region, and when there is a defect in the three-dimensional shape data of the object region, the virtual is based on the loss of the three-dimensional shape data. And moving range setting means for setting the moving range of the illumination.

また、本発明の一実施形態に係る画像処理装置は、撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置であって、前記3次元形状データから、被写体領域の3次元形状データを抽出する前記被写体領域の抽出手段と、前記被写体領域の3次元形状データの取得精度が低い場合に、前記3次元形状データの前記取得精度に基づいて、前記仮想照明の照明サイズの設定可能範囲を設定する照明サイズ範囲設定手段とを有することを特徴とする。   In addition, an image processing apparatus according to an embodiment of the present invention is an image processing apparatus that adds a shading effect by virtual illumination to the captured image based on three-dimensional shape data corresponding to the captured image, Based on the acquisition accuracy of the three-dimensional shape data, when the acquisition accuracy of the three-dimensional shape data of the object region is low, the extraction unit of the object region extracts the three-dimensional shape data of the object region from shape data. And illumination size range setting means for setting the settable range of the illumination size of the virtual illumination.

本発明によると、被写体の3次元形状データに基づいて、仮想的な照明条件下での陰影を再現した画像を生成する際に、不自然な陰影が再現されないようにすることができる。   According to the present invention, it is possible to prevent unnatural shadows from being reproduced when generating an image that reproduces shadows under virtual illumination conditions based on three-dimensional shape data of a subject.

実施形態1に係る画像処理装置の外観を示す図である。FIG. 1 is a view showing an appearance of an image processing apparatus according to a first embodiment. 実施形態1に係る撮像装置の内部構成を示す図である。FIG. 1 is a diagram showing an internal configuration of an imaging device according to Embodiment 1. 実施形態1に係る画像処理部の構成を示す機能ブロック図である。FIG. 2 is a functional block diagram showing the configuration of an image processing unit according to the first embodiment. 実施形態1に係る仮想照明の照明位置を表すパラメータを示す図である。FIG. 7 is a diagram showing parameters representing the illumination position of virtual illumination according to the first embodiment. 実施形態1に係る画像処理の流れを示すフローチャートである。5 is a flowchart showing the flow of image processing according to the first embodiment. 実施形態1に係る3次元形状データの欠損を説明する図である。FIG. 5 is a diagram for explaining loss of three-dimensional shape data according to the first embodiment. 実施形態1に係る照明位置の可動範囲の設定方法を示す図である。FIG. 6 is a diagram showing a method of setting a movable range of the illumination position according to the first embodiment. 実施形態1に係る照明位置の可動範囲の表示例を示す図である。FIG. 6 is a view showing a display example of a movable range of the illumination position according to the first embodiment. 実施形態1に係る照明位置に対する警告の表示例を示す図である。FIG. 7 is a view showing a display example of a warning for the illumination position according to Embodiment 1. 実施形態1に係るライティング処理部の構成を示す機能ブロック図である。FIG. 2 is a functional block diagram showing a configuration of a lighting processing unit according to Embodiment 1. 実施形態1に係るライティング処理部の処理の流れを示すフローチャートである。5 is a flowchart showing a flow of processing of a lighting processing unit according to the first embodiment. 実施形態1に係る陰影画像データの例を示す図である。FIG. 5 is a diagram showing an example of shadow image data according to the first embodiment. 実施形態1に係るライティング画像データの例を示す図である。FIG. 6 is a diagram showing an example of lighting image data according to the first embodiment. 実施形態1に係る効果を説明する図である。FIG. 6 is a diagram for explaining the effect according to the first embodiment. 実施形態2に係る画像処理部の構成を示す機能ブロック図である。FIG. 7 is a functional block diagram showing the configuration of an image processing unit according to a second embodiment. 実施形態2に係る処理の流れを示すフローチャートである。7 is a flowchart showing the flow of processing according to the second embodiment. 実施形態2に係る照明位置の可動範囲の設定方法を示す図である。FIG. 7 is a view showing a method of setting a movable range of the illumination position according to the second embodiment. 実施形態3に係る画像処理部の構成を示す機能ブロック図である。FIG. 13 is a functional block diagram showing the configuration of an image processing unit according to a third embodiment. 実施形態3に係る照明条件の設定操作とパラメータを説明する図である。FIG. 14 is a view for explaining setting operation of illumination conditions and parameters according to the third embodiment. 実施形態3に係る画像処理の流れを示フローチャートである。15 is a flowchart showing the flow of image processing according to the third embodiment. 実施形態3に係る形状データの法線を説明する模式図である。FIG. 18 is a schematic view illustrating normals of shape data according to the third embodiment. 実施形態3に係る照明サイズの設定可能範囲の設定方法を説明する図である。FIG. 14 is a diagram for explaining a method of setting a settable range of the illumination size according to the third embodiment. 実施形態3に係る照明サイズの設定可能範囲の表示例を示す図である。FIG. 14 is a view showing a display example of a settable range of the illumination size according to the third embodiment. 実施形態3に係る照明サイズに対する警告の表示例を示す図である。FIG. 14 is a view showing a display example of a warning for the illumination size according to the third embodiment. 実施形態3に係るライティング処理部の構成を示す機能ブロック図である。FIG. 13 is a functional block diagram showing the configuration of a lighting processing unit according to a third embodiment. 実施形態3に係るライティング処理部の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process of the lighting process part which concerns on Embodiment 3. FIG. 実施形態4に係る撮像システムの構成を示す図である。FIG. 14 is a diagram showing a configuration of an imaging system according to a fourth embodiment. 実施形態4に係る撮像装置の内部構成を示す図である。FIG. 16 is a diagram showing an internal configuration of an imaging device according to a fourth embodiment. 実施形態4に係る画像処理部の構成を示す機能ブロック図である。FIG. 18 is a functional block diagram showing the configuration of an image processing unit according to a fourth embodiment. 実施形態4に係る画像処理の流れを示すフローチャートである。15 is a flowchart illustrating the flow of image processing according to a fourth embodiment.

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

[実施形態1]
<撮像装置の外観>
図1は、本実施形態に適用可能な画像処理装置の外観を示す図である。本実施形態では、画像処理装置の例として、撮像装置であるデジタルカメラを示すが、画像処理装置はこれに限定されない。例えば、画像処理装置は、携帯電話やタブレットデバイス、パーソナルコンピュータなどの情報処理装置であっても良いし、カメラ付き携帯電話等の撮像装置として構成されても良い。
Embodiment 1
<Appearance of Imaging Device>
FIG. 1 is a view showing the appearance of an image processing apparatus applicable to the present embodiment. In the present embodiment, a digital camera that is an imaging device is shown as an example of the image processing device, but the image processing device is not limited to this. For example, the image processing apparatus may be an information processing apparatus such as a mobile phone, a tablet device, a personal computer or the like, or may be configured as an imaging apparatus such as a camera-equipped mobile phone.

図1(a)は、本実施形態における画像処理装置の正面の外観を示し、図1(b)は、背面の外観を示している。画像処理装置の例として示された撮像装置101は、カラー画像撮像部102、撮像ボタン103、距離画像取得部104、表示部105、及び操作ボタン106を有する。   FIG. 1A shows the appearance of the front of the image processing apparatus according to this embodiment, and FIG. 1B shows the appearance of the back. An imaging apparatus 101 illustrated as an example of an image processing apparatus includes a color image imaging unit 102, an imaging button 103, a distance image acquisition unit 104, a display unit 105, and an operation button 106.

カラー画像撮像部102は、ズームレンズ、フォーカスレンズ、ブレ補正レンズ、絞り、シャッター、及びカラー撮像素子部によって構成され、被写体の光情報を取得する。尚、カラー画像撮像部102の構成は、これに限定されるものではない。撮像ボタン103は、ユーザが撮像の開始を撮像装置101に指示するためのボタンである。距離画像取得部104は、ユーザからの撮像指示に応じて被写体までの距離を記録した距離画像データを取得する。尚、本実施形態では、撮像装置101の筺体の中にカラー画像撮像部102と距離画像取得部104が含まれるが、これに限定されるものではなく、カラー画像撮像部102と距離画像取得部104が独立した構成であってもよい。また、本実施形態における距離画像取得部104は、距離画像取得部104を基準とした距離画像取得部104の光軸方向の距離を取得し、カラー画像撮像部102を基準としたカラー画像撮像部102の光軸方向の距離へ変換し、保存する。尚、予め距離画像取得部104とカラー画像撮像部102の両者の位置、光軸方向を取得し、キャリブレーションすることで、距離画像取得部104を基準とした距離画像データを、カラー画像撮像部102を基準とした距離画像データへ変換することができる。以下では、距離画像取得部104が取得する距離画像データDは、画素D(i,j)で表現する。また、距離画像データDの各画素は、カラー画像データIの各画素と対応付けられているとする。具体的には、カラー画像データIの画素I(i,j)は、距離画像データDの画素D(i,j)と1対1で対応しているものとする。距離画像取得部104における、距離画像取得部104を基準とした距離の取得に用いる方式としては、既存のどのような方式を用いてもよい。例えば、発光した光が被写体に反射し戻ってくるまでの時間から距離を算出するタイムオブフライト方式や、2以上の複数の場所から撮影した画像から三角測量によって距離を算出する多視点ステレオ方式などを用いることができる。   The color image capturing unit 102 includes a zoom lens, a focus lens, a shake correction lens, an aperture, a shutter, and a color imaging device unit, and acquires light information of a subject. The configuration of the color image capturing unit 102 is not limited to this. The imaging button 103 is a button for the user to instruct the imaging apparatus 101 to start imaging. The distance image acquisition unit 104 acquires distance image data in which the distance to the subject is recorded according to the imaging instruction from the user. In the present embodiment, the color image pickup unit 102 and the distance image acquisition unit 104 are included in the housing of the image pickup apparatus 101, but the present invention is not limited to this. The color image pickup unit 102 and the distance image acquisition unit 104 may be an independent configuration. Further, the distance image acquiring unit 104 in the present embodiment acquires the distance in the optical axis direction of the distance image acquiring unit 104 based on the distance image acquiring unit 104, and a color image capturing unit based on the color image capturing unit 102. Convert to a distance in the optical axis direction of 102 and save. The position of the distance image acquisition unit 104 and the color image pickup unit 102 in advance and the optical axis direction are obtained and calibrated to obtain distance image data based on the distance image acquisition unit 104 as a color image pickup unit. It can be converted into distance image data based on 102. Hereinafter, the distance image data D acquired by the distance image acquisition unit 104 is expressed by the pixel D (i, j). Further, it is assumed that each pixel of the distance image data D is associated with each pixel of the color image data I. Specifically, it is assumed that the pixels I (i, j) of the color image data I correspond to the pixels D (i, j) of the distance image data D on a one-to-one basis. Any existing method may be used as a method used to acquire the distance based on the distance image acquisition unit 104 in the distance image acquisition unit 104. For example, a time-of-flight method that calculates the distance from the time until the emitted light is reflected back to the subject, a multi-view stereo method that calculates the distance by triangulation from images taken from two or more multiple locations, etc. Can be used.

表示部105は、液晶ディスプレイなどで構成され、撮像装置101による撮影時のライブビュー画像の表示や、撮影後に撮像画像の表示を行うことができる。また、本実施形態では、表示部105は、撮像画像に対して仮想照明の位置をユーザが指定する際のライティング処理のプレビュー画像の表示や、ライティング処理を実施した後の処理結果画像の表示を行う。また、表示部105は、撮像装置101の設定メニューの表示を行うことも可能である。   The display unit 105 is configured of a liquid crystal display or the like, and can display a live view image at the time of shooting by the imaging device 101, and can display a captured image after shooting. Further, in the present embodiment, the display unit 105 displays the preview image of the lighting process when the user designates the position of the virtual illumination on the captured image, and the display of the processing result image after the lighting process is performed. Do. The display unit 105 can also display a setting menu of the imaging apparatus 101.

操作ボタン106は、撮像装置101がユーザ操作を取得するためのボタンである。具体的には、操作ボタン106は、表示部105が表示する設定メニューに対して、撮像モードの切り換えや、撮像時の各種パラメータの設定などをユーザが撮像装置101に指示するためのボタンである。ユーザは、操作ボタン106、あるいは撮像ボタン103を用いて、照明パラメータの設定や、被写体領域の選択等を、撮像装置101に指示することができる。尚、表示部105がタッチスクリーン機能を有しても良く、撮像装置101は、タッチスクリーンを介したユーザ指示を、操作ボタン106の入力として扱うことも可能である。   The operation button 106 is a button for the imaging device 101 to acquire a user operation. Specifically, the operation button 106 is a button for the user to instruct the imaging apparatus 101 to switch the imaging mode or set various parameters at the time of imaging with respect to the setting menu displayed by the display unit 105. . The user can use the operation button 106 or the imaging button 103 to instruct the imaging device 101 to set illumination parameters, select a subject area, and the like. Note that the display unit 105 may have a touch screen function, and the imaging device 101 can also handle a user instruction via the touch screen as an input of the operation button 106.

<撮像装置の内部構成>
図2は、本実施形態における撮像装置101の内部構成を示すブロック図である。
<Internal Configuration of Imaging Device>
FIG. 2 is a block diagram showing an internal configuration of the imaging apparatus 101 in the present embodiment.

CPU202は、ROM(Read Only Memory)203や、RAM(Rondom Access Memory)204に格納された命令を順に読み込み、解釈し、その結果に従って各構成の処理を実行する。すなわち、命令とは、コンピュータプログラムである。システムバス212は、データを送受信するためのバスである。   The CPU 202 sequentially reads and interprets instructions stored in a ROM (Read Only Memory) 203 and a RAM (Rondom Access Memory) 204, and executes processing of each configuration according to the result. That is, an instruction is a computer program. The system bus 212 is a bus for transmitting and receiving data.

光学系制御部205は、カラー画像撮像部102に対して、フォーカスを合わせる、シャッターを開く、絞りを調整するなどの、CPU202から指示された制御を行う。   The optical system control unit 205 performs, for the color image capturing unit 102, control instructed by the CPU 202 such as focusing, opening a shutter, adjusting an aperture, and the like.

制御部206は、撮像ボタン103や操作ボタン106からのユーザ指示によって、撮像、被写体領域の選択、仮想照明の照明位置の設定などを制御する。仮想照明の照明位置の設定に際し、制御部206は後述の照明位置を表す複数のパラメータのうちどのパラメータを更新するかを表す照明位置更新モードと、照明位置が決定しているかどうかを示す照明位置決定フラグの制御を行う。照明位置更新モードは、照明位置を表す複数のパラメータのうち、照明位置の方位角及び仰角を更新する場合は0、照明位置の半径を更新する場合は1がそれぞれ設定される。照明位置決定フラグは、照明位置が未決定である場合は0、照明位置が決定されている場合は1がそれぞれ設定される。尚、照明位置更新モードと照明位置決定フラグは、共に0が初期値として与えられる。   The control unit 206 controls imaging, selection of an object area, setting of an illumination position of virtual illumination, and the like according to user instructions from the imaging button 103 and the operation button 106. When setting the illumination position of the virtual illumination, the control unit 206 performs an illumination position update mode indicating which parameter is to be updated among a plurality of parameters indicating the illumination position described later, and an illumination position indicating whether the illumination position is determined Control the decision flag. In the illumination position update mode, among a plurality of parameters representing the illumination position, 0 is set to update the azimuth and elevation angle of the illumination position, and 1 is set to update the radius of the illumination position. The illumination position determination flag is set to 0 when the illumination position is undecided and 1 when the illumination position is decided. Both the illumination position update mode and the illumination position determination flag are given 0 as an initial value.

キャラクタージェネレーション部207は、文字やグラフィックなどを生成する。生成された文字やグラフィックは、画像処理部209によって生成されたライティング画像に重畳して表示部105に表示される。   A character generation unit 207 generates characters, graphics, and the like. The generated characters and graphics are superimposed on the lighting image generated by the image processing unit 209 and displayed on the display unit 105.

A/D変換部208は、カラー画像撮像部102が検知した被写体の光量をデジタル信号値に変換して、RAW画像データを生成する。尚、本実施形態では、同時刻に撮像した距離画像データとRAW画像データが取得可能であるものとする。   The A / D conversion unit 208 converts the light amount of the subject detected by the color image capturing unit 102 into a digital signal value to generate RAW image data. In the present embodiment, it is assumed that distance image data and RAW image data captured at the same time can be acquired.

画像処理部209は、上記のRAW画像データに対して現像処理を行って生成したカラー画像データに対して、各種画像処理を実行する。本実施形態において、画像処理部209は、カラー画像データ及び距離画像データに基づいてライティング処理を行い、カラー画像データからライティング画像データを生成する。画像処理部209の内部構造は、後に詳述する。   The image processing unit 209 performs various types of image processing on color image data generated by performing development processing on the above-described RAW image data. In the present embodiment, the image processing unit 209 performs lighting processing based on color image data and distance image data, and generates lighting image data from the color image data. The internal structure of the image processing unit 209 will be described in detail later.

エンコーダ部210は、画像処理部209が処理したカラー画像データやライティング処理によって生成されたライティング画像データを含む各種画像データを、Jpegなどのファイルフォーマットに変換する変換処理を行う。   The encoder unit 210 performs conversion processing of converting various image data including color image data processed by the image processing unit 209 and lighting image data generated by the lighting processing into a file format such as Jpeg.

メディアI/F211は、PC/メディア213(例えば、ハードディスク、メモリカード、CFカード、SDカードなど)と画像データを送受信するためのインタフェースである。   The media I / F 211 is an interface for transmitting and receiving image data to and from the PC / media 213 (for example, a hard disk, a memory card, a CF card, an SD card, etc.).

<画像処理部209の構成>
図3は、本実施形態における画像処理部209の構成を示す機能ブロック図である。以下では、画像処理部209が本実施形態におけるライティング処理を行うための機能の詳細を説明する。
<Configuration of Image Processing Unit 209>
FIG. 3 is a functional block diagram showing the configuration of the image processing unit 209 in the present embodiment. In the following, details of functions for the image processing unit 209 to perform the lighting process in the present embodiment will be described.

画像処理部209は、A/D変換部208よりRAW画像データ、距離画像取得部104より距離画像データ、そして制御部206より仮想照明の照明位置がそれぞれ入力される。画像処理部209は、距離画像データと照明位置に基づいて、RAW画像データに対してライティング処理を行う。そして、画像処理部209は、ライティング処理結果である出力画像を、(エンコーダ部210からメディアI/F211を介して)PC/メディア213へ、または表示部105へ出力する。   The image processing unit 209 receives raw image data from the A / D conversion unit 208, distance image data from the distance image acquisition unit 104, and an illumination position of virtual illumination from the control unit 206. The image processing unit 209 performs lighting processing on the RAW image data based on the distance image data and the illumination position. Then, the image processing unit 209 outputs an output image, which is the result of the writing process, to the PC / media 213 (from the encoder unit 210 via the media I / F 211) or to the display unit 105.

以下に、画像処理部209の各機能ブロックについて説明する。   Each functional block of the image processing unit 209 will be described below.

画像取得部301は、A/D変換部208からRAW画像データを取得する。現像部302は、RAW画像データに対してデモザイク処理を施し、カラー画像データを生成する。生成したカラー画像データは、表示部105へ出力して表示したり、RAM204やPC/メディア213などの記憶装置に記憶したりすることができる。尚、本実施形態において、カラー画像データIを構成する画素I(i,j)には、RGB値が画素値として格納されているものとする。カラー画像データの各画素に格納されたRGB値はそれぞれIr(i,j)、Ig(i,j)、Ib(i,j)と表す。また、以下ではカラー画像データの水平方向の画素数をW、カラー画像データの垂直方向の画素数をHと表記する。   The image acquisition unit 301 acquires RAW image data from the A / D conversion unit 208. The developing unit 302 performs demosaicing processing on the RAW image data to generate color image data. The generated color image data can be output to the display unit 105 for display or can be stored in a storage device such as the RAM 204 or the PC / media 213. In the present embodiment, it is assumed that RGB values are stored as pixel values in the pixels I (i, j) constituting the color image data I. The RGB values stored in each pixel of the color image data are denoted as Ir (i, j), Ig (i, j), Ib (i, j). Further, hereinafter, the number of pixels in the horizontal direction of color image data is denoted as W, and the number of pixels in the vertical direction of color image data is denoted as H.

形状取得部303は、被写体を含む撮影シーン(以下、単にシーンとも称する)の3次元形状データを取得する。また、本実施形態では、距離画像取得部104が取得する距離画像データを3次元形状データへ変換することで、3次元形状データを得る。本実施形態における3次元形状データは、ポリゴンとも呼ばれ、3次元空間上の多数の頂点と、3または4などの複数の頂点を結んで構成される面から成るデータである。ポリゴン中のn番目(n≦N、Nは頂点数)の頂点は、3次元空間上の位置を表す3次元座標Vn=(Xn、Yn、Zn)を保持する。尚、3次元形状データの形式は限定されるものではなく、他の形式を用いてもよい。   The shape acquisition unit 303 acquires three-dimensional shape data of a photographed scene (hereinafter, also simply referred to as a scene) including a subject. In the present embodiment, three-dimensional shape data is obtained by converting the distance image data acquired by the distance image acquisition unit 104 into three-dimensional shape data. The three-dimensional shape data in the present embodiment is also referred to as a polygon, and is data consisting of a surface formed by connecting a large number of vertices in a three-dimensional space and a plurality of vertices such as 3 or 4. The n-th (n ≦ N, N is the number of vertices) vertices in the polygon hold three-dimensional coordinates Vn = (Xn, Yn, Zn) representing positions in the three-dimensional space. The format of the three-dimensional shape data is not limited, and other formats may be used.

照明位置設定部304は、制御部206から入力された照明位置を変更するためのユーザ操作を受け付け、ユーザからの指示に応じて仮想照明の照明位置を設定する。本実施形態では、タッチスクリーン機能を有した表示部105にカラー画像データを表示し、表示画面に対するドラッグ操作によって得られるユーザからの指示に応じて、仮想照明の照明位置を受け付ける。図4に示すように、本実施形態における仮想照明の照明位置は、回転の中心位置C=(Cx、Cy、Cz)、中心位置Cの周りの回転半径r、Y軸周りの回転角θ、Z軸周りの回転角φの4つの変数を用いて表す。以下では、Y軸周りの回転角θを方位角、Z軸周りの回転角φを仰角と表記する。これらの4つの変数C、r、θ、φを使用して、照明位置の3次元座標L=(Lx、Ly、Lz)は、下記式(1)によって求めることができる。   The illumination position setting unit 304 receives a user operation for changing the illumination position input from the control unit 206, and sets the illumination position of the virtual illumination in accordance with an instruction from the user. In the present embodiment, color image data is displayed on the display unit 105 having a touch screen function, and the illumination position of the virtual illumination is received according to an instruction from the user obtained by a drag operation on the display screen. As shown in FIG. 4, the illumination position of the virtual illumination in this embodiment is the center position of rotation C = (Cx, Cy, Cz), the rotation radius r around the center position C, the rotation angle θ around the Y axis This is expressed using four variables of the rotation angle φ around the Z axis. Hereinafter, the rotation angle θ around the Y axis is referred to as an azimuth angle, and the rotation angle φ around the Z axis is referred to as an elevation angle. Using these four variables C, r, θ, and φ, the three-dimensional coordinate L = (Lx, Ly, Lz) of the illumination position can be obtained by the following equation (1).

尚、照明位置の表現方法はこれに限定されるものではなく、他の形式で表してもよい。   Note that the method of expressing the illumination position is not limited to this, and may be represented in another form.

撮像装置位置・姿勢算出部305は、カラー画像データと3次元形状データから、カラー画像データを撮影した際の撮像装置101の位置及び姿勢を算出する。ここで、撮像装置101の位置とは、撮像装置101の光学中心の三次元位置を表す。また、撮像装置101の姿勢とは、撮像装置101の光軸の方向を表す。尚、撮像装置101の位置及び姿勢は、被写体と撮像装置101との相対的な位置関係を算出すればよい。   The imaging device position / posture calculation unit 305 calculates the position and orientation of the imaging device 101 when the color image data is captured from the color image data and the three-dimensional shape data. Here, the position of the imaging device 101 represents the three-dimensional position of the optical center of the imaging device 101. Further, the attitude of the imaging device 101 represents the direction of the optical axis of the imaging device 101. The position and orientation of the imaging device 101 may be calculated by calculating the relative positional relationship between the subject and the imaging device 101.

ライティング処理部306は、カラー画像データ、3次元形状データ、撮像装置101の位置・姿勢、及び仮想照明の照明位置を用いて、ライティング処理及び色変換処理を行う。ライティング処理部306は、ライティング処理によってカラー画像データ(すなわち、撮像画像)に陰影効果を追加し、ライティング画像データを生成する。さらに、ライティング処理部306は、生成したライティング画像データに対してホワイトバランス処理、ガンマ処理等の色変換処理を施し、最終的な出力画像データを生成する。   The lighting processing unit 306 performs lighting processing and color conversion processing using color image data, three-dimensional shape data, the position / posture of the imaging device 101, and the illumination position of the virtual illumination. The lighting processing unit 306 adds shading effect to color image data (that is, a captured image) by lighting processing to generate lighting image data. Furthermore, the lighting processing unit 306 performs color conversion processing such as white balance processing and gamma processing on the generated lighting image data to generate final output image data.

画像出力部307は、ライティング処理部306から受け取った出力画像データを、表示部105や、エンコーダ部210を介してPC/メディア213へ出力する。   The image output unit 307 outputs the output image data received from the writing processing unit 306 to the PC / media 213 via the display unit 105 or the encoder unit 210.

被写体領域抽出部308は、カラー画像データ及び3次元形状データから、3次元形状データのうち注目被写体の領域を特定し、被写体領域の3次元形状データを抽出する。以下、3次元形状データのうち注目被写体の領域を、単に被写体領域と称する。また、3次元形状データのうち注目被写体以外の領域を、背景領域と称する。   The subject region extraction unit 308 specifies the region of the subject of interest among the three-dimensional shape data from the color image data and the three-dimensional shape data, and extracts the three-dimensional shape data of the subject region. Hereinafter, the area of the subject of interest in the three-dimensional shape data is simply referred to as a subject area. Further, an area other than the target subject in the three-dimensional shape data is referred to as a background area.

形状判断部309は、被写体領域の3次元形状データに、欠損が存在するか判断を行う。処理の詳細は後述する。   The shape determination unit 309 determines whether there is a defect in the three-dimensional shape data of the subject area. Details of the process will be described later.

照明位置可動範囲設定部310は、被写体領域の3次元形状データに欠損が存在すると判断された場合に、被写体領域の3次元形状データの欠損に基づいて仮想照明の照明位置の可動範囲を設定する。具体的には、仮想照明の照明位置を表す各パラメータに対して可動範囲を設定する。本実施形態では、照明位置を表わすパラメータのうち方位角θ、仰角φに対し、可動範囲を設定する。尚、照明位置を表わすパラメータのうち中心位置C、半径rに対して可動範囲を設定してもよい。   The illumination position movable range setting unit 310 sets the movable range of the illumination position of the virtual illumination based on the loss of the three-dimensional shape data of the subject region when it is determined that the loss exists in the three-dimensional shape data of the subject region. . Specifically, the movable range is set for each parameter representing the illumination position of the virtual illumination. In the present embodiment, the movable range is set for the azimuth angle θ and the elevation angle φ among the parameters representing the illumination position. The movable range may be set with respect to the central position C and the radius r among the parameters representing the illumination position.

照明位置可動範囲出力部311は、照明位置可動範囲設定部310によって設定された仮想照明の照明位置の可動範囲を表示部105へ出力し、ユーザに提示する。   The illumination position movable range output unit 311 outputs the movable range of the illumination position of the virtual illumination set by the illumination position movable range setting unit 310 to the display unit 105 and presents it to the user.

照明位置評価部312は、照明位置設定部304によって設定されたユーザ指定の照明位置が、照明位置可動範囲設定部310によって設定された照明位置の可動範囲内に含まれるか評価を行う。   The illumination position evaluation unit 312 evaluates whether the user-specified illumination position set by the illumination position setting unit 304 is included in the movable range of the illumination position set by the illumination position movable range setting unit 310.

警告出力部313は、照明位置評価部312によって、ユーザ指定の照明位置が可動範囲内に含まれないと評価された場合に、警告を表示部105へ出力する。   The warning output unit 313 outputs a warning to the display unit 105 when the lighting position evaluation unit 312 evaluates that the lighting position designated by the user is not included in the movable range.

以上説明したように、本実施形態における画像処理部209は、ライティング処理を行うための機能を有する。   As described above, the image processing unit 209 in the present embodiment has a function for performing the lighting process.

<画像処理部209の処理フロー>
続いて、本実施形態における画像処理部209の各部によるライティング処理の処理フローを説明する。図5は、本実施形態におけるライティング処理のフローチャートを示す。フローチャートにおける各ステップの処理は、CPU202がROM203やRAM204に格納されたプログラムを読み出して実行することにより実施される。
<Processing Flow of Image Processing Unit 209>
Subsequently, the processing flow of the lighting processing by each unit of the image processing unit 209 in the present embodiment will be described. FIG. 5 shows a flowchart of the lighting process in the present embodiment. The processing of each step in the flowchart is implemented by the CPU 202 reading out and executing a program stored in the ROM 203 or the RAM 204.

まず、ステップS501において、画像取得部301は、A/D変換部208から、撮像装置101によって撮影されたRAW画像データを取得する。   First, in step S501, the image acquisition unit 301 acquires RAW image data captured by the imaging apparatus 101 from the A / D conversion unit 208.

次に、ステップS502において、現像部302は、RAW画像データを現像し、カラー画像データを生成する。一般に、RAW画像データの現像処理には、デモザイキングを始め、ホワイトバランス調整、ガンマ補正、ノイズ除去など各種処理が含まれるが、本実施形態では、デモザイキングとノイズ除去のみが行われる。カラー画像データの各画素のRGB値Ir(i,j)、Ig(i,j)、Ib(i,j)には、画素が受光した放射輝度に比例した値が格納されていることが望ましい。   Next, in step S502, the developing unit 302 develops the RAW image data to generate color image data. Generally, development processing of RAW image data includes various processing such as white balance adjustment, gamma correction, noise removal and the like including demosaicing, but in the present embodiment, only demosaicing and noise removal are performed. It is desirable that the RGB values Ir (i, j), Ig (i, j), Ib (i, j) of each pixel of the color image data store a value proportional to the radiance received by the pixel. .

次に、ステップS503において、形状取得部303は、被写体を含む撮影シーンの3次元形状データであるポリゴンを取得する。本実施形態では、形状取得部303は、距離画像取得部104が取得した距離画像データの各画素に対応する3次元点を頂点とし、各頂点を結んで面とすることで、ポリゴンを生成する。以下に、形状取得部303による処理の詳細を説明する。   Next, in step S503, the shape acquisition unit 303 acquires polygons that are three-dimensional shape data of a photographed scene including a subject. In the present embodiment, the shape acquiring unit 303 generates polygons by using, as vertices, three-dimensional points corresponding to respective pixels of the distance image data acquired by the distance image acquiring unit 104 and connecting the vertices as surfaces. . The details of the process performed by the shape acquisition unit 303 will be described below.

まず、形状取得部303は、距離画像データDの各画素に対応する3次元点Vnの位置を算出する。具体的には、距離画像データDのうち座標(i,j)の画素から、3次元点の位置Vn=(Xn、Yn、Zn)は、下記式(2)によって算出される。   First, the shape acquisition unit 303 calculates the position of the three-dimensional point Vn corresponding to each pixel of the distance image data D. Specifically, from the pixel at coordinates (i, j) in the distance image data D, the position Vn = (Xn, Yn, Zn) of the three-dimensional point is calculated by the following equation (2).

ここで、cxd、cydは、距離画像取得部104の主点と呼ばれる光学的な中心を、距離画像中の座標で表した値である。fdは、距離画像取得部104の焦点距離を距離画像データの画素換算で表した値である。Wは、距離画像データの横方向の画素数を表す。上記式(1)で得られる3次元位置は、撮像装置101のカラー画像撮像部102の光学的な中心を原点として、撮像装置に水平な方向をX軸、撮像装置に垂直な方向をY軸、撮像装置の光軸方向をZ軸とする3次元空間における位置を表している。尚、nと(i,j)は、1対1で対応していればよく、上式以外の式でnと(i,j)を関係づけてもよい。また、式(1)は、距離画像データDの2次元座標(i,j)から3次元点の位置Vnを計算する式であるが、この式を逆に解くことによって、3次元点の位置Vnに対応する距離画像データDの2次元座標(i,j)を算出することもできる。   Here, cxd and cyd are values representing an optical center called a principal point of the distance image acquisition unit 104 by coordinates in the distance image. fd is a value representing the focal length of the distance image acquisition unit 104 in pixel conversion of distance image data. W represents the number of pixels in the horizontal direction of the distance image data. The three-dimensional position obtained by the above equation (1) takes an optical center of the color image pickup unit 102 of the image pickup apparatus 101 as an origin, a direction horizontal to the image pickup apparatus X axis, and a direction perpendicular to the image pickup apparatus Y axis 3 represents a position in a three-dimensional space in which the optical axis direction of the imaging device is taken as the Z axis. Note that n and (i, j) may be in one-to-one correspondence, and n and (i, j) may be related by an equation other than the above equation. Moreover, although Formula (1) is a formula which calculates position Vn of a three-dimensional point from two-dimensional coordinates (i, j) of distance image data D, the position of a three-dimensional point is solved by solving this formula in reverse. The two-dimensional coordinates (i, j) of the distance image data D corresponding to Vn can also be calculated.

続いて、形状取得部303は、複数の3次元点を結び、面を構成することで、ポリゴンを生成する。本実施形態では、等間隔の格子状に配置された距離画像データから3次元点を生成するため、この格子上の隣接点を結ぶことで面を構成することができる。また、例えばドロネー三角分割などの既存の手法を用いることで、3次元点を結び、面を構成することも可能である。   Subsequently, the shape acquisition unit 303 connects a plurality of three-dimensional points to form a surface, thereby generating a polygon. In this embodiment, in order to generate three-dimensional points from distance image data arranged in a grid pattern at equal intervals, a plane can be configured by connecting adjacent points on this grid. Further, it is also possible to connect three-dimensional points to form a surface by using an existing method such as Delaunay triangulation.

次に、ステップS504において、撮像装置位置・姿勢算出部305は、3次元形状データとカラー画像データとから、カラー画像データを撮影した際の撮像装置の相対的な位置・姿勢データを算出する。本実施形態では、撮像装置の光学的な中心の3次元座標、撮像装置の水平方向、撮像装置の垂直方向、及び撮像装置の光軸方向を表す4つの変数を、撮像装置の位置・姿勢データとする。   Next, in step S504, the imaging device position and orientation calculation unit 305 calculates relative position and orientation data of the imaging device when capturing color image data from the three-dimensional shape data and the color image data. In the present embodiment, position / orientation data of the imaging device are represented by three variables representing the three-dimensional coordinates of the optical center of the imaging device, the horizontal direction of the imaging device, the vertical direction of the imaging device, and the optical axis direction of the imaging device. I assume.

次に、ステップS505において、被写体領域抽出部308は、カラー画像データ及び3次元形状データから、被写体領域の3次元形状データを抽出する。本実施形態では、被写体領域抽出部308は、まずカラー画像データIにおいて注目被写体を抽出し、その後に3次元形状データからカラー画像データIの注目被写体に対応する領域を得る。カラー画像データIにおいて注目被写体を抽出する方法は、公知の手法を用いればよい。例えば、画像認識技術を利用することで、注目被写体を自動的に抽出してもよい。この場合、例えば被写体が人物の場合は、人物認識技術や顔認識技術が利用可能である。また、制御部206を通じて、ユーザが注目する領域を手動で選択してもよい。カラー画像データIのうち被写体領域として抽出された2次元座標の集合をOIとする。本実施形態では、前述のようにカラー画像データIと距離画像データDは、同じ座標の画素が対応している。そのため、カラー画像データIのうち被写体領域を表す座標群OIは、距離画像データDにおいても被写体領域を表している。上記式(1)を用いることで、3次元形状データのうち、2次元座標群OIの各座標に対応する3次元点Vnを算出することができる。以下では、3次元形状データのうち被写体領域に含まれる点をOとする。また、3次元形状データの被写体領域の重心の3次元位置OCは、下記式(3)で算出することができる。   Next, in step S505, the subject region extraction unit 308 extracts three-dimensional shape data of the subject region from the color image data and the three-dimensional shape data. In the present embodiment, the subject area extraction unit 308 first extracts the subject of interest in the color image data I, and thereafter obtains the area corresponding to the subject of interest of the color image data I from the three-dimensional shape data. A known method may be used as a method of extracting a subject of interest in the color image data I. For example, a subject of interest may be extracted automatically by using an image recognition technology. In this case, for example, when the subject is a person, person recognition technology or face recognition technology can be used. In addition, the control unit 206 may manually select a region of interest to the user. A set of two-dimensional coordinates extracted as a subject area in the color image data I is taken as OI. In the present embodiment, as described above, the color image data I and the distance image data D correspond to pixels at the same coordinates. Therefore, in the color image data I, the coordinate group OI representing the subject area also represents the subject area in the distance image data D. By using the equation (1), it is possible to calculate a three-dimensional point Vn corresponding to each coordinate of the two-dimensional coordinate group OI among the three-dimensional shape data. In the following, it is assumed that a point included in the subject region in the three-dimensional shape data is O. Further, the three-dimensional position OC of the center of gravity of the subject region of the three-dimensional shape data can be calculated by the following equation (3).

ここで、|O|は集合Oに含まれる点の数を表している。   Here, | O | represents the number of points included in the set O.

次に、ステップS506において、照明位置可動範囲設定部310は、仮想照明の照明位置の可動範囲の初期化を行う。照明位置可動範囲設定部310は、照明位置に対し、回転中心位置Cを、上述の被写体領域の重心の3次元位置OCとし、照明位置を表すパラメータである中心位置C、半径r、方位角θ、仰角φのうちの方位角θ、仰角φに対し、可動範囲を設定する。尚、本実施形態では、θ1、θ2、φ1、φ2を用いて、方位角θ、仰角φそれぞれの可動範囲は、下記の式(4)で表されるものとする。 Next, in step S506, the illumination position movable range setting unit 310 initializes the movable range of the illumination position of the virtual illumination. With respect to the illumination position, the illumination position movable range setting unit 310 sets the rotation center position C as the three-dimensional position OC of the center of gravity of the subject region described above, and is a parameter representing the illumination position: center position C, radius r, azimuth angle θ The movable range is set for the azimuth angle θ and the elevation angle φ of the elevation angle φ. In the present embodiment, the movable range of each of the azimuth angle θ and the elevation angle φ is expressed by the following equation (4) using θ 1 , θ 2 , φ 1 and φ 2 .

可動範囲の初期値として、θ1、θ2のそれぞれには、下記式(5)で示す値が設定される。 As the initial value of the movable range, a value represented by the following equation (5) is set to each of θ 1 and θ 2 .

同様に、φ1、φ2のそれぞれには、下記式(6)で示すように初期値が設定される。 Similarly, initial values are set to φ 1 and φ 2 as shown in the following equation (6).

次に、ステップS507において、形状判断部309は、被写体領域の3次元形状データに欠損が存在するか判断を行う。本実施形態において3次元形状データの欠損とは、3次元形状データを被写体の全周にわたって取得できていない状態を表す。距離画像取得部104のように被写体形状を一方向のみから取得する場合、被写体の前面の3次元形状データは取得できるが、背面の3次元形状データは取得することができない。したがって、被写体の全周の3次元形状データが取得できないため、形状判断部309は、被写体の3次元形状データに欠損が存在すると判断する。図6は、本実施形態における3次元形状データの欠損を説明する図である。図6(a)に示すように、ここでは、3次元形状データの欠損について、撮像装置101を用いて被写体601と被写体以外の背景領域602とから成るシーンを撮影する場合を例に説明する。尚、被写体601として人物を撮影する場合で説明するが、被写体は人物に限定されるものではない。図6(b)は、撮像装置101、被写体601、及び背景領域602を上方から見た図である。距離画像取得部104から見え、距離データを取得可能な部分を実線603、605で表し、距離画像取得部104からは見えず、距離データを取得不可能な部分を点線604、606で表している。このように、点線604、606で表される距離データが取得できない部分については、被写体の3次元形状データの欠損となってしまう。図6(c)は、この場合のカラー画像データの例610を示す。   Next, in step S507, the shape determination unit 309 determines whether there is a defect in the three-dimensional shape data of the subject region. In the present embodiment, the loss of three-dimensional shape data indicates a state in which three-dimensional shape data can not be acquired all around the subject. When the subject shape is acquired from only one direction as in the distance image acquisition unit 104, the three-dimensional shape data of the front of the subject can be acquired, but the three-dimensional shape data of the back can not be acquired. Therefore, since the three-dimensional shape data of the entire circumference of the subject can not be acquired, the shape determination unit 309 determines that there is a defect in the three-dimensional shape data of the subject. FIG. 6 is a diagram for explaining loss of three-dimensional shape data in the present embodiment. As shown in FIG. 6A, a case of capturing a scene consisting of a subject 601 and a background area 602 other than the subject using the imaging device 101 will be described as an example for the loss of three-dimensional shape data. Although the case of photographing a person as the subject 601 will be described, the subject is not limited to the person. FIG. 6B is a view of the imaging apparatus 101, the subject 601, and the background area 602 as viewed from above. The portions visible from the distance image acquisition unit 104 and capable of acquiring distance data are indicated by solid lines 603 and 605, and the portions invisible from the distance image acquisition unit 104 and impossible to acquire distance data are indicated by dotted lines 604 and 606. . As described above, with respect to a portion where the distance data represented by dotted lines 604 and 606 can not be acquired, the three-dimensional shape data of the subject is lost. FIG. 6C shows an example 610 of color image data in this case.

本ステップS507では、被写体領域の3次元形状データに欠損が存在する場合はステップS508に移行する。一方、3次元形状データに欠損が存在しないと判断された場合は、ステップS510へ移行する。   In the present step S507, when there is a defect in the three-dimensional shape data of the subject area, the process proceeds to step S508. On the other hand, if it is determined that no defect exists in the three-dimensional shape data, the process proceeds to step S510.

尚、3次元形状データの欠損の有無は、以下のように判断することが可能である。例えば、形状判断部309は、被写体領域を構成するポリゴンが、開曲面であるか、または閉曲面であるかを判断することで、欠損の有無を判断することができる。形状判断部309は、ポリゴンが開曲面である場合には、欠損が存在すると判断する。尚、場合によっては、正しい3次元形状データ(すなわち、ポリゴン)が開曲面であることもある。そのため、例えば、カラー画像データへの既存の画像認識技術の適用結果を組み合わせることも可能である。すなわち、画像認識技術によってどのような被写体であるかを判断することにより、本来の3次元形状データが開曲面であるか、それとも開曲面であるかを知ることができる。その上で、本来は3次元形状データが閉曲面であるべきだが、取得した3次元形状データが開曲面であれば、取得した3次元形状データに欠損が存在すると判断する。また、形状データが存在しない部分の3次元形状データの予測結果と、取得できている3次元形状データとを比較し、差がある場合に、開曲面が欠損であるか判断することもできる。形状データが存在しない部分の3次元形状データの予測手法としては、上記の画像認識技術でどのような被写体なのか認識できた場合に、その被写体の平均的な形状データを本来の3次元形状データとして使用する方法がある。その他にも、3次元形状データが取得できている領域の曲率半径を算出し、その曲率によって3次元形状データを補完してもよい。また、その他の欠損の有無を判断する方法として、被写体の3次元形状データの取得に用いるデバイスによって一律に判断してもよい。例えば、距離画像取得部104のように、一方向からのみの3次元形状データを取得するデバイスを用いる場合は、3次元形状データに欠損が存在すると判断してもよい。一方、被写体を全周から取り囲んだ多視点カメラを用いる場合は、3次元形状データに欠損は存在しないと判断してもよい。尚、欠損の有無を判断する方法は、限定されるものではなく、その他の方法を用いてもよい。   The presence or absence of loss of three-dimensional shape data can be determined as follows. For example, the shape determination unit 309 can determine the presence or absence of a loss by determining whether a polygon forming the subject region is an open surface or a closed surface. If the polygon is an open surface, the shape determination unit 309 determines that a defect exists. In some cases, the correct three-dimensional shape data (i.e., a polygon) may be an open surface. Therefore, for example, it is also possible to combine the application results of existing image recognition technology to color image data. That is, it is possible to know whether the original three-dimensional shape data is an open curved surface or an open curved surface by determining what kind of subject the image recognition technology is. Furthermore, although the three-dimensional shape data should originally be a closed surface, if the acquired three-dimensional shape data is an open surface, it is determined that a defect exists in the acquired three-dimensional shape data. Further, the predicted result of the three-dimensional shape data of the portion where the shape data does not exist may be compared with the acquired three-dimensional shape data, and if there is a difference, it may be determined whether the open surface is a defect. As a method of predicting three-dimensional shape data of a portion where shape data does not exist, when it is possible to recognize what kind of subject it is by the above-mentioned image recognition technology, average shape data of the subject is used as original three-dimensional shape data There is a way to use it. Besides, the radius of curvature of the area in which the three-dimensional shape data can be acquired may be calculated, and the three-dimensional shape data may be complemented by the curvature. Further, as another method of determining the presence or absence of a defect, the determination may be made uniformly depending on the device used for acquiring the three-dimensional shape data of the subject. For example, when using a device that acquires three-dimensional shape data from only one direction as in the distance image acquisition unit 104, it may be determined that a defect exists in the three-dimensional shape data. On the other hand, in the case of using a multi-viewpoint camera in which the subject is surrounded from the entire circumference, it may be determined that no defect exists in the three-dimensional shape data. The method of determining the presence or absence of a defect is not limited, and other methods may be used.

次に、ステップS508において、照明位置可動範囲設定部310は、被写体の3次元形状データに欠損が存在する場合に、3次元形状データの被写体領域に基づいて照明位置可動範囲の更新を行う。本実施形態では、まず、被写体の3次元形状データのうち形状データを取得できている領域の範囲を求める。本実施形態における被写体形状の範囲の求め方について、図7を参照して説明する。図7は、図6(b)と同様に、撮像装置101と被写体701を上方から見た模式図である。尚、被写体701の3次元形状データには欠損が存在し、図7には、3次元形状データが取得できている領域のみが示されている。図7において、702は、ステップS505において算出した3次元形状データの被写体領域の重心OCを表す。線分703は、撮像装置101と被写体領域の重心OCを結んだ線分である。点704、705は、3次元形状データの被写体領域と非被写体領域の境界に当たる3次元点である。これらの点の求め方としては、まず、ステップS505のカラー画像データIの被写体領域から、被写体の輪郭を形成する画素を抽出する。そして、式(1)を用いて2次元座標を3次元形状データへ逆投影することで、カラー画像データIの輪郭画素に対応する3次元点を求めることができる。図7において、線分706は、重心702と点704を結んだ線分である。同様に、線分707は、重心702と点705を結んだ線分である。そして、線分703と線分706が成す角度θ1と、線分703と線分707が成す角度θ2との2つの角度を算出する。この2つの角度θ1及びθ2を、本実施形態では被写体形状の範囲として扱う。尚、図7では、2次元での被写体形状の範囲として角度(方位角)θ1及びθ2を示したが、実際には被写体701は3次元の形状データを有している。そのため、同様に被写体の側面側から見た場合の被写体形状の範囲として角度(仰角)φ1及びφ2を算出する。 Next, in step S508, when there is a defect in the three-dimensional shape data of the subject, the illumination position movable range setting unit 310 updates the illumination position movable range based on the subject region of the three-dimensional shape data. In the present embodiment, first, a range of an area in which shape data can be acquired among three-dimensional shape data of a subject is determined. A method of determining the range of the subject shape in the present embodiment will be described with reference to FIG. FIG. 7 is a schematic view of the imaging device 101 and the subject 701 as viewed from above, as in FIG. 6B. It should be noted that there is a defect in the three-dimensional shape data of the subject 701, and FIG. 7 shows only the area where the three-dimensional shape data can be acquired. In FIG. 7, reference numeral 702 denotes the center of gravity OC of the subject region of the three-dimensional shape data calculated in step S505. A line segment 703 is a line connecting the imaging device 101 and the center of gravity OC of the subject region. Points 704 and 705 are three-dimensional points corresponding to the boundary between the subject area and the non-subject area in the three-dimensional shape data. As a method of obtaining these points, first, pixels forming an outline of the subject are extracted from the subject region of the color image data I in step S505. Then, a three-dimensional point corresponding to the outline pixel of the color image data I can be obtained by back-projecting the two-dimensional coordinates to the three-dimensional shape data by using the equation (1). In FIG. 7, a line segment 706 is a line segment connecting the center of gravity 702 and the point 704. Similarly, a line segment 707 is a line segment connecting the center of gravity 702 and the point 705. Then, it calculates the angle theta 1 which the line segment 703 and line segment 706 forms the two angles between the angle theta 2 which the line segment 703 and line segment 707 forms. The two angles theta 1 and theta 2, in the present embodiment deals with a range of subject shape. In FIG. 7, the angles (azimuth angles) θ 1 and θ 2 are shown as a range of the subject shape in two dimensions, but in fact, the subject 701 has three-dimensional shape data. Therefore, angles (elevation angles) φ 1 and φ 2 are similarly calculated as the range of the subject shape when viewed from the side of the subject.

続いて、上述の形状データを取得できている領域の範囲に基づいて、新たな仮想照明の照明位置に対する可動範囲を算出する。上述の角度θ1、θ2と変数αを用いて下記式(7)に示すように、可動範囲(方位角)θ1、θ2を更新する。 Then, the movable range with respect to the illumination position of a new virtual illumination is calculated based on the range of the area | region which can acquire the above-mentioned shape data. As shown in the following equation (7), the movable ranges (azimuth angles) θ 1 and θ 2 are updated using the above-mentioned angles θ 1 and θ 2 and the variable α.

同様に、角度φ1、φ2と変数βを用いて、可動範囲(仰角)φ1、φ2を下記式(8)に示すように更新する。 Similarly, the movable ranges (elevation angles) φ 1 and φ 2 are updated as shown in the following equation (8) using the angles φ 1 and φ 2 and the variable β.

ここで、変数α及びβは、0<α、β≦1の範囲の実数を取る変数であり、これらの値は予め設定しておいてもよいし、撮像装置101のユーザが設定してもよい。このようにして、照明位置可動範囲設定部310は、被写体の3次元形状データに欠損が存在する場合に、3次元形状データの被写体領域に基づいて照明位置可動範囲の更新を行う。   Here, the variables α and β are variables taking real numbers in the range of 0 <α, β ≦ 1, and these values may be set in advance, or may be set by the user of the imaging apparatus 101. Good. Thus, the illumination position movable range setting unit 310 updates the illumination position movable range based on the subject region of the three-dimensional shape data when there is a defect in the three-dimensional shape data of the subject.

次に、ステップS509において、照明位置可動範囲出力部311は、照明位置の可動範囲を出力し、表示部105に表示する。照明位置の可動範囲の表示は、図や文字を用いて行われる。例えば、撮像部で撮影したカラー画像データIに対し、照明位置の可動範囲に当たる領域を網掛け表示によって表示することができる。逆に、照明位置の可動範囲外の領域を網掛け表示してもよい。図8は、表示部105への照明位置の可動範囲の表示例を示す。まず、図8(a)を用いて照明位置の可動範囲の表示位置、サイズについて説明する。図8(a)において、照明位置の可動範囲の境界線801の内側が、照明位置の可動範囲である。境界線801は、点802を中心として表示される。点802は、先述の被写体領域の3次元形状データの重心位置OCに対応するカラー画像データの座標である。点802は、重心位置OCの3次元座標から式(1)を基に算出することができる。点803は、3次元形状データの被写体領域の重心位置OCを中心としたθ=θ1、φ=0°の照明位置のカラー画像データ上の位置を表している。半径rは任意の値を設定することができ、予め設定しておいてもよいし、ユーザが設定してもよい。点804は、重心位置OCを中心とした任意の半径rにおけるθ=θ2、φ=0°で表される3次元位置に対応するカラー画像データ上の位置を表している。点803、点804は、水平方向の照明位置の可動範囲を表している。同様に、点805は、重心位置OCを中心とした任意の半径rにおけるθ=0°、φ=φ1で表される3次元位置に対応するカラー画像データ上の位置を表している。点806は、重心位置OCを中心とした任意の半径rにおけるθ=0°、φ=φ2で表される3次元位置に対応するカラー画像データ上の位置を表している。点805、点806は、垂直方向の照明位置の可動範囲を表している。これらの4つの点803、804、805、及び806を結んだ曲線が、照明位置の可動範囲の境界線801である。図8(b)は、ユーザが、カラー画像データの被写体807に対して、ライティング処理の照明位置809を設定する際の画面の例を示す。本画面では、上述のようにして位置、サイズを決定した照明位置809の可動範囲の境界線801が、カラー画像データに重畳表示されている。メッセージ808は、ライティング処理を行うための照明位置の設定中であることを示す。ユーザは、照明位置809をドラッグ操作等により移動させることで、照明位置809の設定を行う。本実施形態では、照明位置809の設定中に、照明位置809の可動範囲を示す。尚、照明位置の可動範囲の外の領域を網掛け表示することで、その領域には照明位置を設定することができないことを視覚的に分かりやすく表してもよい。また、照明位置の可動範囲は、表示部105内に文字810として表示してもよい。 Next, in step S 509, the illumination position movable range output unit 311 outputs the movable range of the illumination position and displays the movable range on the display unit 105. The display of the movable range of the illumination position is performed using figures and characters. For example, an area corresponding to the movable range of the illumination position can be displayed by hatching with respect to the color image data I captured by the imaging unit. Conversely, an area outside the movable range of the illumination position may be shaded. FIG. 8 shows a display example of the movable range of the illumination position on the display unit 105. First, the display position and the size of the movable range of the illumination position will be described with reference to FIG. In FIG. 8A, the inside of the boundary 801 of the movable range of the illumination position is the movable range of the illumination position. The boundary line 801 is displayed centered on the point 802. A point 802 is coordinates of color image data corresponding to the barycentric position OC of the three-dimensional shape data of the subject area described above. The point 802 can be calculated from the three-dimensional coordinates of the center-of-gravity position OC based on the equation (1). A point 803 represents the position on the color image data of the illumination position at θ = θ 1 and φ = 0 ° centering on the gravity center position OC of the object region of the three-dimensional shape data. The radius r can be set to any value, and may be set in advance or may be set by the user. A point 804 represents a position on color image data corresponding to a three-dimensional position represented by θ = θ 2 and φ = 0 ° at an arbitrary radius r around the barycentric position OC. Points 803 and 804 indicate the movable range of the illumination position in the horizontal direction. Similarly, a point 805 represents a position on color image data corresponding to a three-dimensional position represented by θ = 0 ° and φ = φ 1 at an arbitrary radius r around the barycentric position OC. A point 806 represents a position on color image data corresponding to a three-dimensional position represented by θ = 0 ° and φ = φ 2 at an arbitrary radius r around the barycentric position OC. Point 805 and point 806 represent the movable range of the illumination position in the vertical direction. A curve connecting these four points 803, 804, 805, and 806 is a boundary 801 of the movable range of the illumination position. FIG. 8B illustrates an example of a screen when the user sets the illumination position 809 of the lighting process on the subject 807 of color image data. In this screen, the boundary line 801 of the movable range of the illumination position 809 whose position and size are determined as described above is displayed superimposed on the color image data. A message 808 indicates that the setting of the illumination position for performing the lighting process is in progress. The user moves the illumination position 809 by a drag operation or the like to set the illumination position 809. In the present embodiment, the movable range of the illumination position 809 is indicated during setting of the illumination position 809. Note that by shading the area outside the movable range of the illumination position, it may be visually shown that the illumination position can not be set in that area. In addition, the movable range of the illumination position may be displayed as characters 810 in the display unit 105.

次に、ステップS510において、照明位置設定部304は、照明位置の初期値として、照明の回転中心位置C、半径r、方位角θ、仰角φの4つ変数のそれぞれに対して、初期値を設定する。照明の回転中心位置Cとしては、3次元形状データの被写体領域の重心OCを設定する。半径r、方位角θ、仰角φについては、先に定めた照明位置の可動範囲内であれば任意の位置を設定可能である。例えば、被写体を正面から照らす照明の位置を初期値として設定する。そのためには、半径rには被写体領域の重心OCのZ成分の値を設定し、方位角θ、及び仰角φにはそれぞれ0°を設定する。尚、被写体領域の重心OCのZ成分は、撮像装置101から被写体までの距離を表している。   Next, in step S510, the illumination position setting unit 304 sets an initial value for each of the illumination rotation center position C, radius r, azimuth angle θ, and elevation angle φ as initial values of the illumination position. Set As the rotation center position C of the illumination, the center of gravity OC of the subject region of the three-dimensional shape data is set. As for the radius r, the azimuth angle θ, and the elevation angle φ, any position can be set within the movable range of the illumination position previously determined. For example, the position of illumination that illuminates the subject from the front is set as an initial value. For that purpose, the value of the Z component of the center of gravity OC of the object region is set to the radius r, and 0 ° is set to each of the azimuth angle θ and the elevation angle φ. The Z component of the center of gravity OC of the subject area represents the distance from the imaging apparatus 101 to the subject.

次に、ステップS511において、ライティング処理部306は、カラー画像データ、3次元形状データ、撮像装置位置・姿勢データ、照明位置を使用してライティング処理を行い、さらに色変換処理を行うことで、出力画像データを生成する。ライティング処理の詳細については後述する。   Next, in step S511, the lighting processing unit 306 performs lighting processing using color image data, three-dimensional shape data, imaging device position / posture data, and illumination position, and further performs color conversion processing to output Generate image data. Details of the writing process will be described later.

次に、ステップS512において、画像出力部307は、出力画像データを表示部105へ出力し、ライティング処理結果のプレビュー表示を行う。ユーザは、プレビュー表示されたライティング処理結果を見て、所望の陰影が再現できていると判断した場合は操作ボタン106を押下し、照明位置を決定する。その際、制御部206は、照明位置決定フラグを1へ更新する。   Next, in step S512, the image output unit 307 outputs the output image data to the display unit 105, and performs preview display of the lighting processing result. The user looks at the lighting processing result displayed as a preview, and if it is determined that the desired shade is reproduced, the user depresses the operation button 106 to determine the lighting position. At this time, the control unit 206 updates the illumination position determination flag to one.

次に、ステップS513において、画像出力部307は、照明位置が決定されたか判断する。具体的には、画像出力部307は、照明位置決定フラグを参照し、その値が決定を表す1であればステップS514へ移行し、未決定を表す0であればステップS515へ移行する。   Next, in step S513, the image output unit 307 determines whether the illumination position has been determined. Specifically, the image output unit 307 refers to the illumination position determination flag, and if the value is 1 representing determination, the process proceeds to step S514, and if 0 indicating undetermined, the process proceeds to step S515.

ステップS514において、画像出力部307は、出力画像データをPC/メディア213へ出力し、保存する。   In step S514, the image output unit 307 outputs the output image data to the PC / media 213 for storage.

ステップS515において、照明位置設定部304は、ユーザのドラッグ操作に応じて照明位置の更新を行う。照明位置更新モードが0の場合は、照明位置の方位角θ及び仰角φの更新を行う。ユーザによるドラッグ操作のカラー画像データ上の押下開始座標をPs=(is、js)、押下終了座標をPe=(ie、je)として、下記式(9)を用いてθ’及びφ’を算出し、それぞれ方位角θ、仰角φへ代入し更新する。 In step S515, the illumination position setting unit 304 updates the illumination position in accordance with the user's drag operation. When the illumination position update mode is 0, the azimuth θ and the elevation angle φ of the illumination position are updated. Assuming that the pressing start coordinate on the color image data of the drag operation by the user is P s = (i s , j s ) and the pressing end coordinate is P e = (i e , j e ), θ using the following equation (9) 'And φ' are calculated, and substituted into azimuth angle θ and elevation angle φ, respectively, and updated.

ここで、A、Bは、撮像装置101の水平方向の画角をu、垂直方向の画角をvとして下記式(10)で表される。尚、前述のようにWはカラー画像データの水平方向、Hはカラー画像データの垂直方向の画素数をそれぞれ表している。   Here, A and B are represented by the following formula (10), where u is the angle of view in the horizontal direction of the imaging apparatus 101 and v is the angle of view in the vertical direction. As described above, W indicates the horizontal direction of color image data, and H indicates the number of pixels in the vertical direction of color image data.

一方、照明位置更新モードが1の場合は、照明位置の半径rの更新を行う。ここでは、ユーザによるドラッグ操作のうち水平方向の移動量を用いて新たな半径rを算出する。具体的にはドラッグ操作の押下開始座標Ps、押下終了座標Peから下記式(11)を使用して半径r’を算出し、これを半径rへ代入し更新する。 On the other hand, when the illumination position update mode is 1, the radius r of the illumination position is updated. Here, a new radius r is calculated using the amount of movement in the horizontal direction of the drag operation by the user. Specifically, the radius r ′ is calculated from the pressing start coordinate P s of the drag operation and the pressing end coordinate P e using the following equation (11), and this is substituted into the radius r and updated.

次に、ステップS516において、照明位置評価部312は、ユーザによって指定された照明位置が、前述の照明位置可動範囲内に含まれるかどうか判定を行う。ここでは、照明位置を表す方位角θ、仰角φを照明位置可動範囲と比較し、ユーザによって指定された照明位置が可動範囲内に含まれるか判定する。方位角θについては、照明位置可動範囲を示す角度θ1、θ2と比較を行う。仰角φについては、照明位置可動範囲を表す角度φ1、φ2と比較を行う。方位角θ、仰角φが共に照明位置可動範囲内に含まれる場合は、ステップS511へ移行する。一方、方位角θ、仰角φの一方でも照明位置可動範囲内に含まれない場合は、ステップS517へ移行する。 Next, in step S516, the illumination position evaluation unit 312 determines whether the illumination position designated by the user is included in the above-described illumination position movable range. Here, the azimuth angle θ representing the illumination position and the elevation angle φ are compared with the illumination position movable range to determine whether the illumination position designated by the user is included in the movable range. The azimuth angle θ is compared with the angles θ 1 and θ 2 indicating the illumination position movable range. The elevation angle φ is compared with the angles φ 1 and φ 2 representing the illumination position movable range. If both the azimuth angle θ and the elevation angle φ are included in the illumination position movable range, the process proceeds to step S511. On the other hand, when one of the azimuth angle θ and the elevation angle φ is not included in the illumination position movable range, the process proceeds to step S517.

ステップS517において、警告出力部313は、ユーザが指定した照明位置が、照明位置可動範囲に含まれないことを表すメッセージ(すなわち、文字情報)や図から成る警告を表示部105へ出力し、表示する。図9は、本実施形態における警告表示の例を示す。図9では、照明位置を表すアイコン901が照明位置可動範囲の外に設定されている。このように照明位置が可動範囲の外に設定された場合に、警告出力部313は警告メッセージ902を表示する。また、警告メッセージ902を表示する以外に、照明位置を表すアイコン901の色を変えてもよい。アイコン901の色を変える場合は、照明位置可動範囲の内・外の2種類で色を切り替えるほか、照明位置可動範囲内であっても、照明位置可動範囲の境界近傍に近づくと徐々にアイコンの色を変化させてもよい。尚、警告の表示方法はこれらに限定されるものではない。   In step S517, the warning output unit 313 outputs a message (that is, character information) indicating that the illumination position specified by the user is not included in the illumination position movable range or a warning including a figure to the display unit 105, and displays it. Do. FIG. 9 shows an example of a warning display in the present embodiment. In FIG. 9, an icon 901 representing the illumination position is set outside the illumination position movable range. When the illumination position is thus set outside the movable range, the warning output unit 313 displays a warning message 902. In addition to displaying the warning message 902, the color of the icon 901 representing the illumination position may be changed. When changing the color of the icon 901, the color is switched between two types of illumination position movable range inside and outside of the illumination position movable range, and even within the illumination position movable range, when approaching the boundary of the illumination position movable range The color may be changed. The warning display method is not limited to these.

以上説明したように、本実施形態における画像処理部209はライティング処理を行なう。本処理によって、撮影済みのカラー画像データに対し仮想的な照明効果を付与したライティング画像が生成される。   As described above, the image processing unit 209 in the present embodiment performs the lighting process. By this processing, a lighting image in which a virtual lighting effect is added to the photographed color image data is generated.

<ライティング処理部306の動作>
以下では、本実施形態におけるライティング処理部306の動作について、詳細に説明する。ライティング処理部306は、前述のように、カラー画像データ、3次元形状データ、撮像装置位置・姿勢データ、及び照明位置を使用してライティング処理を実施し、さらに色変換処理を実施することで、出力画像データを生成する。
<Operation of Lighting Processing Unit 306>
The operation of the lighting processing unit 306 in the present embodiment will be described in detail below. As described above, the lighting processing unit 306 performs lighting processing using color image data, three-dimensional shape data, imaging device position / posture data, and illumination position, and further performs color conversion processing. Generate output image data.

図10は、本実施形態におけるライティング処理部306の構成を示す。ライティング処理部306は、法線算出部1001、陰影画像生成部1002、画像合成部1003、及び色変換処理部1004を有する。法線算出部1001は、3次元形状データ(すなわち、ポリゴン)から形状の面の向きを表す法線データを算出する。陰影画像生成部1002は、3次元形状データ、法線データ、照明位置、及び撮像装置位置・姿勢データから、仮想的な照明でシーンを照らした際の陰影を算出し、陰影画像データを生成する。画像合成部1003は、陰影画像データと、現像部302が出力するカラー画像データを合成し、ライティング画像データを生成する。色変換処理部1004は、ライティング画像データに対しホワイトバランス処理やガンマ変換処理などの各種処理を施し、最終的な出力画像データを生成する。   FIG. 10 shows the configuration of the lighting processing unit 306 in the present embodiment. The lighting processing unit 306 includes a normal calculation unit 1001, a shadow image generation unit 1002, an image combining unit 1003, and a color conversion processing unit 1004. The normal line calculation unit 1001 calculates normal line data representing the direction of the surface of the shape from the three-dimensional shape data (i.e., a polygon). A shadow image generation unit 1002 generates shadow image data by calculating a shadow when the scene is illuminated with virtual illumination from the three-dimensional shape data, the normal data, the illumination position, and the imaging device position / posture data. . The image combining unit 1003 combines the shadow image data and the color image data output from the developing unit 302 to generate lighting image data. The color conversion processing unit 1004 performs various processing such as white balance processing and gamma conversion processing on the lighting image data to generate final output image data.

図11は、本実施形態におけるライティング処理部306による出力画像データの生成処理のフローチャートを示す。   FIG. 11 shows a flowchart of a process of generating output image data by the lighting processing unit 306 in the present embodiment.

まず、ステップS1101において、法線算出部1001は、3次元形状データを基に、シーン中の全点に対する面の向きを表す法線データを算出する。法線データは、3次元形状データであるポリゴンの面を構成する各頂点の3次元座標から算出された面の向きに基づいて、算出することができる。尚、法線データの算出方法は限定されるものではなく、他の方法を用いてもよい。   First, in step S1101, the normal line calculation unit 1001 calculates normal line data representing the orientation of the surface with respect to all points in the scene based on the three-dimensional shape data. The normal line data can be calculated based on the direction of the surface calculated from the three-dimensional coordinates of each vertex constituting the surface of the polygon which is three-dimensional shape data. The method of calculating the normal line data is not limited, and other methods may be used.

次に、ステップS1102において、陰影画像生成部1002は、ユーザによって設定された照明位置に仮想的な照明が存在する場合にシーンに生じる陰影を、コンピュータグラフィックス(CG)の技法を用いて画像データとして算出する。この陰影を表す画像データを陰影画像データと称する。陰影画像生成部1002は、陰影画像データの生成に先立ち、シャドウ画像データとシェード画像データの2種類の画像データを生成する。   Next, in step S1102, the shadow image generation unit 1002 generates image data using computer graphics (CG) techniques for shadows that occur in a scene when virtual illumination is present at the illumination position set by the user. Calculated as Image data representing this shadow is referred to as shadow image data. The shadow image generation unit 1002 generates two types of image data of shadow image data and shade image data prior to generation of shadow image data.

図12(a)は、図6と同様のシーンにおいて生成されたシャドウ画像1210の例を示す。シャドウ画像1210では、図6の被写体601によって照明からの光が遮られることで、被写体以外の領域(すなわち、背景領域)602にシャドウ1211が生じている。シャドウは、注目点と照明との経路の間にある物体によって照明からの光が遮られることで、注目点が暗くなる現象である。シャドウ画像データは、シーンの3次元形状データと照明位置とから生成される。シャドウ画像データの生成には既存の各種CG技法が適用可能であり、例えばシャドウマッピングと呼ばれる手法を用いることができる。   FIG. 12A shows an example of a shadow image 1210 generated in the same scene as FIG. In the shadow image 1210, a shadow 1211 is generated in an area other than the subject (that is, a background area) 602 by blocking the light from the illumination by the subject 601 in FIG. Shadowing is a phenomenon in which a point of interest is darkened because the light from the illumination is blocked by an object between the path of the point of interest and the light. Shadow image data is generated from the three-dimensional shape data of the scene and the illumination position. Various existing CG techniques can be applied to the generation of shadow image data, and for example, a technique called shadow mapping can be used.

図12(b)は、図6と同様のシーンにおいて生成されたシェード画像1220の例を示す。シェード画像1220では、図6の被写体601の領域や被写体以外の領域602において、面の向きに応じた明暗(すなわち、シェード)が生じている。シェードは、注目点に照明からの光が当たる場合に、照明からの光の注目点への入射角に応じて生じる明暗のことである。シェード画像データは、シーンの法線データと照明位置とから生成される。シェード画像データの生成にも既存の各種CG技法が適用可能であり、例えばフォンの反射モデルを用いることができる。   FIG. 12B shows an example of a shade image 1220 generated in the same scene as FIG. In the shade image 1220, light and shade (that is, shade) according to the orientation of the surface is generated in the area of the subject 601 and the area 602 other than the subject in FIG. A shade is the light and shade that occurs depending on the angle of incidence of light from the illumination to the point of interest when the light from the illumination falls on the point of interest. Shade image data is generated from the scene normal data and the illumination position. Various existing CG techniques can be applied to the generation of shade image data, and for example, a reflection model of Phong can be used.

そして、陰影画像生成部1002は、シャドウ画像データIshadow(i,j)、及びシェード画像データIshade(i,j)を用いて、下記式(12)によって陰影画像データIS(i,j)を算出する。尚、陰影画像データIS、シャドウ画像データIshadow、シェード画像データIshadeの各画素には、RGB値が画素値として格納されている。 Then, using the shadow image data I shadow (i, j) and the shade image data I shade (i, j), the shadow image generation unit 1002 generates shadow image data I S (i, j) according to the following equation (12). Calculate). RGB values are stored as pixel values in each pixel of the shadow image data I S , the shadow image data I shadow and the shade image data I shade .

図12(c)は、図12(a)のシャドウ画像1210と、図12(b)のシェード画像1220から生成された陰影画像1230の例を示す。   FIG. 12C shows an example of a shadow image 1230 generated from the shadow image 1210 of FIG. 12A and the shade image 1220 of FIG. 12B.

次に、ステップS1103において、画像合成部1003は、カラー画像データと陰影画像データから、ライティング画像データの合成を行う。ライティング画像データIL(i,j)は、カラー画像データI(i,j)と陰影画像データIS(i,j)を使用して、下記式(13)に基づいて算出される。 Next, in step S1103, the image combining unit 1003 combines lighting image data from color image data and shadow image data. The lighting image data I L (i, j) is calculated based on the following equation (13) using the color image data I (i, j) and the shading image data I s (i, j).

図13は、先述の図6(c)に示したカラー画像と図12(c)に示した陰影画像1230から生成されたライティング画像1301の例を示す。本実施形態によると、図13に示すように、カラー画像に対し、仮想的な照明による陰影効果を付加することができる。   FIG. 13 shows an example of a lighting image 1301 generated from the color image shown in FIG. 6C and the shaded image 1230 shown in FIG. 12C. According to this embodiment, as shown in FIG. 13, it is possible to add a shadow effect by virtual illumination to a color image.

次に、ステップS1104において、色変換処理部1004は、ライティング画像データに対し各種色変換処理を実施し、最終的な出力画像データを生成する。本ステップでは、色変換処理としてホワイトバランス調整、エッジ強調、及びガンマ補正などの処理が実施される。各種色変換処理が施された画像データは、出力画像データとして画像出力部307へ出力される。   Next, in step S1104, the color conversion processing unit 1004 performs various color conversion processing on the lighting image data to generate final output image data. In this step, processing such as white balance adjustment, edge enhancement, and gamma correction is performed as color conversion processing. The image data subjected to the various color conversion processing is output to the image output unit 307 as output image data.

以上説明したように、ライティング処理部306によるライティング処理が行われ、カラー画像データに対し仮想照明による陰影効果が付加された出力画像データが生成される。   As described above, the lighting processing by the lighting processing unit 306 is performed, and output image data in which a shading effect by virtual illumination is added to color image data is generated.

<本実施形態の効果>
本実施形態によれば、撮影後の画像データに対し仮想的なライティング効果を付加する場合に、被写体形状の範囲に基づいて照明位置の可動範囲を設定することが可能となる。すなわち、被写体の3次元形状データに存在する欠損を考慮して、仮想照明の位置を設定することが可能となる。
<Effect of this embodiment>
According to the present embodiment, when a virtual lighting effect is added to image data after shooting, it is possible to set the movable range of the illumination position based on the range of the object shape. That is, it is possible to set the position of the virtual illumination in consideration of the defect existing in the three-dimensional shape data of the subject.

まず、ライティング処理によって、撮影後に照明効果、特にシャドウの効果を付与する場合に被写体領域の欠損によって生じる課題について説明する。シャドウは、前述のように照明から出射した光が物体で遮ぎられることで生じる。被写体の3次元形状が正しく取得できている場合(すなわち、被写体の3次元形状データに欠損領域が存在しない場合)は、仮想照明から出射した光がどこで遮られ、どこにシャドウが生じるかを正しく算出することが可能である。しかし、被写体の3次元形状に欠損領域が存在する場合は、シャドウを正しく算出することができず、本来生じるはずだったシャドウを再現することができない。図14は、被写体の3次元形状の欠損領域の有無によるシャドウの再現性の違いを示す。図14(a)は、撮像装置101、仮想照明1401、被写体1402、及び背景領域1403を上方から見た図を示している。図14(a)では、被写体1402の3次元形状は正しく取得できていて、欠損領域が存在しない。この場合、仮想照明1401から出射した光が被写体1402によって遮られることで、背景領域1403上の領域1404にシャドウが生じる。図14(b)は、この場合に生成されるライティング画像の例を示す。図示されるように、欠損領域が存在しない3次元形状を用いることで、シャドウが正しく再現されたライティング画像を生成することが可能である。続いて、図14(c)、(d)を参照して、被写体の3次元形状に欠損領域が存在する場合の例を説明する。図14(c)では、被写体の3次元形状1405は欠損領域を含む。この場合、仮想照明1401から出射した光は、欠損領域では遮られることなく背景領域1403に到達する。その結果、背景領域1403上には、被写体の3次元形状1405が取得できている領域によって光が遮られる領域1406のみにシャドウが生じる。図14(d)は、この場合に生成されるライティング画像の例を示す。この場合、図示されるように、3次元形状1405に欠損領域が存在するため、本来生じるはずだったシャドウを正しく再現することができず、不自然なシャドウを含むライティング画像が生成されてしまう。このような不自然なシャドウは、仮想照明が3次元形状の欠損領域を照射することで生じる。一方、被写体の3次元形状に欠損領域が存在していても、仮想照明が、3次元形状を取得できている領域のみを照射し、欠損領域を照射しない場合は、不自然なシャドウは生じない。そこで、本実施形態では、被写体の3次元形状が正しく取得できている領域のみを照射するように、仮想照明の照射位置可動範囲を設定することで、不自然なシャドウを生じにくくさせることが可能である。そして、ユーザが仮想照明の位置を設定する際に、その照明位置可動範囲を提示することで、不自然なシャドウが生じる位置に仮想照明の位置が設定されることを防ぐことが可能となる。   First, the problem caused by the loss of the subject region when the lighting effect, in particular the shadow effect, is given after the shooting by the lighting process will be described. The shadow is caused by the fact that the light emitted from the illumination is blocked by the object as described above. If the three-dimensional shape of the subject can be acquired correctly (that is, if there is no missing area in the three-dimensional shape data of the subject), the light emitted from the virtual illumination is correctly intercepted where the shadow occurs It is possible. However, if there is a missing area in the three-dimensional shape of the subject, the shadow can not be calculated correctly, and the shadow that would otherwise occur can not be reproduced. FIG. 14 shows the difference in the reproducibility of shadows depending on the presence or absence of a three-dimensional defect area of a subject. FIG. 14A illustrates the imaging device 101, the virtual illumination 1401, the subject 1402, and the background area 1403 as viewed from above. In FIG. 14A, the three-dimensional shape of the subject 1402 can be correctly acquired, and there is no missing area. In this case, the light emitted from the virtual illumination 1401 is blocked by the subject 1402 to generate a shadow in the area 1404 on the background area 1403. FIG. 14B shows an example of the lighting image generated in this case. As illustrated, it is possible to generate a lighting image in which the shadow is correctly reproduced by using a three-dimensional shape in which there is no missing area. Subsequently, with reference to FIGS. 14 (c) and 14 (d), an example where there is a missing area in the three-dimensional shape of the subject will be described. In FIG. 14C, the three-dimensional shape 1405 of the subject includes a defect area. In this case, the light emitted from the virtual illumination 1401 reaches the background area 1403 without being blocked in the missing area. As a result, on the background area 1403, a shadow is generated only in an area 1406 in which light is blocked by an area in which the three-dimensional shape 1405 of the subject can be acquired. FIG. 14D shows an example of the lighting image generated in this case. In this case, as shown in the figure, since a three-dimensional shape 1405 has a missing area, it is not possible to correctly reproduce the originally supposed shadow, and a lighting image including an unnatural shadow is generated. Such unnatural shadows are caused by the virtual illumination illuminating the three-dimensional defect area. On the other hand, even if there is a defect area in the three-dimensional shape of the subject, the virtual illumination only illuminates the area where the three-dimensional shape can be acquired, and if the defect area is not irradiated, unnatural shadows do not occur. . Therefore, in the present embodiment, it is possible to make an unnatural shadow less likely to occur by setting the irradiation position movable range of the virtual illumination so as to irradiate only the area where the three-dimensional shape of the subject can be correctly acquired. It is. Then, when the user sets the position of the virtual illumination, it is possible to prevent the setting of the position of the virtual illumination at the position where the unnatural shadow occurs by presenting the illumination position movable range.

[実施形態2]
実施形態1では、ライティング処理に利用する3次元形状データのうち被写体形状の範囲に基づいて、仮想照明の照明位置の可動範囲を設定する場合について説明した。しかしながら、実施形態1では、被写体領域によってシャドウが生成される背景領域を考慮していないため、不自然なシャドウの生成を正確に予測することはできなかった。すなわち、仮想照明の照射位置可動範囲を正確に設定することはできなかった。そこで、本実施形態では、被写体形状の範囲に加えて、撮像装置、被写体、及び背景領域のそれぞれの位置に基づいて、仮想照明の照明位置の可動範囲を設定する場合について説明する。本実施形態では、より正確にシャドウの生成位置を予測することができ、より正確に照明位置の可動範囲を設定することができるため、不自然なシャドウの生成をさらに抑えることが可能となる。
Second Embodiment
The first embodiment has described the case where the movable range of the illumination position of the virtual illumination is set based on the range of the subject shape among the three-dimensional shape data used for the lighting process. However, in the first embodiment, since the background area in which the shadow is generated by the subject area is not considered, the generation of the unnatural shadow can not be accurately predicted. That is, the irradiation position movable range of the virtual illumination could not be set accurately. Thus, in the present embodiment, the movable range of the illumination position of the virtual illumination is set based on the positions of the imaging device, the subject, and the background area in addition to the range of the subject shape. In the present embodiment, since the generation position of the shadow can be predicted more accurately and the movable range of the illumination position can be set more accurately, generation of the unnatural shadow can be further suppressed.

尚、以下では、実施形態1と同様の構成や動作についての説明は省略し、実施形態1と異なる構成や動作について主に説明する。   In the following, descriptions of configurations and operations similar to those of the first embodiment will be omitted, and configurations and operations different from the first embodiment will be mainly described.

<画像処理装置の外観及び内部構成>
本実施形態における撮像装置101(すなわち、画像処理装置)の外観及び内部構成は、図1及び図2を参照して上述した実施形態1の撮像装置101の外観及び内部構成と同様である。よって、説明は省略する。
<Appearance and Internal Configuration of Image Processing Device>
The appearance and internal configuration of the imaging apparatus 101 (that is, the image processing apparatus) in the present embodiment are the same as the appearance and internal configuration of the imaging apparatus 101 of the first embodiment described above with reference to FIGS. Therefore, the description is omitted.

<画像処理部209の構成>
図15は、本実施形態における画像処理部209の構成を示す機能ブロック図である。以下では、図15に示す機能ブロックのうち、実施形態1と比較して動作が異なる被写体領域抽出部1501、及び照明位置可動範囲設定部1502について主に説明する。その他の機能ブロックについては実施形態1と同様の動作を行うため、説明は省略する。
<Configuration of Image Processing Unit 209>
FIG. 15 is a functional block diagram showing a configuration of the image processing unit 209 in the present embodiment. In the following, among the functional blocks shown in FIG. 15, a subject region extraction unit 1501 and an illumination position movable range setting unit 1502 which are different in operation from the first embodiment will be mainly described. The other functional blocks perform the same operations as in the first embodiment, and thus the description thereof is omitted.

本実施形態における被写体領域抽出部1501は、カラー画像データ及びシーンの3次元形状データを、被写体領域と背景領域に分離し、被写体領域と背景領域のそれぞれの3次元形状データを抽出する。また、本実施形態における照明位置可動範囲設定部1502は、被写体の3次元形状データに欠損が存在すると判断された場合に、被写体領域と背景領域のそれぞれの3次元形状データに基づいて、仮想照明の照明位置について可動範囲を設定する。   The subject region extraction unit 1501 in this embodiment separates color image data and three-dimensional shape data of a scene into a subject region and a background region, and extracts three-dimensional shape data of each of the subject region and the background region. Further, the illumination position movable range setting unit 1502 according to the present embodiment determines virtual illumination based on three-dimensional shape data of each of the subject area and the background area when it is determined that there is a defect in the three-dimensional shape data of the subject. Set the movable range for the lighting position of.

<画像処理部209の処理フロー>
続いて、本実施形態における画像処理部209の各部によるライティング処理の処理フローを説明する。図16は、本実施形態におけるライティング処理のフローチャートを示す。尚、処理フローのうち、実施形態1と動作が異なるのは、ステップS1601における被写体領域の抽出処理と、ステップS1602における照明位置可動範囲の更新処理の2処理である。その他の処理については実施形態1と同様であるため説明は省略し、上記2処理について以下に説明する。
<Processing Flow of Image Processing Unit 209>
Subsequently, the processing flow of the lighting processing by each unit of the image processing unit 209 in the present embodiment will be described. FIG. 16 shows a flowchart of the lighting process in the present embodiment. In the processing flow, the operation is different from that of the first embodiment in two processes of extraction processing of a subject region in step S1601 and update processing of the illumination position movable range in step S1602. The other processes are the same as in the first embodiment, and therefore the description thereof is omitted, and the above two processes will be described below.

ステップS1601において、被写体領域抽出部1501は、カラー画像データ及びシーンの3次元形状データから、シーンの3次元形状データを被写体領域と背景領域とに分離し、被写体領域と背景領域のそれぞれの3次元形状データを抽出する。シーンの3次元形状データから被写体領域を抽出する方法は、実施形態1と同様の処理を適用可能である。   In step S 1601, the subject region extraction unit 1501 separates the three-dimensional shape data of the scene into the subject region and the background region from the color image data and the three-dimensional shape data of the scene. Extract shape data. The same processing as that of the first embodiment can be applied to a method of extracting a subject region from three-dimensional shape data of a scene.

ステップS1602では、照明位置可動範囲設定部1502は、被写体領域の3次元形状データに欠損領域が存在する場合に、被写体領域と背景領域のそれぞれの3次元形状データに基づいて、照明位置可動範囲の更新を行う。本実施形態では、被写体領域の3次元形状データに加え、背景領域の3次元形状データを用いる点が、実施形態1の照明位置可動範囲の更新処理と異なる。   In step S1602, the illumination position movable range setting unit 1502 sets the illumination position movable range based on the three-dimensional shape data of each of the subject region and the background region when there is a missing region in the three-dimensional shape data of the subject region. Make an update. The present embodiment differs from the update processing of the illumination position movable range of the first embodiment in that three-dimensional shape data of a background area is used in addition to three-dimensional shape data of a subject area.

以下に、本実施形態における照明位置可動範囲の更新処理について、詳細に説明する。図17は、撮像装置101及びシーンを上方より見た様子を表わす模式図である。図17(a)において、シーンは、被写体領域1701と背景領域1702とを含む。被写体領域1701の3次元形状のうち、点1703及び点1704は、被写体領域のうちの被写体領域と背景領域との境界に当たる3次元点である。この境界の3次元点の算出方法は、実施形態1と同様の方法を用いることが可能である。直線1705は、撮像装置101と点1703を通る直線である。点1706は、背景領域1702と直線1705との交点に当たる3次元点である。同様に、直線1707は、撮像装置101と点1704を通る直線であり、直線1707と背景領域1702との交点が、点1708である。さらに、直線1709は、点1703と点1708とを結ぶ直線であり、直線1710は、点1704と点1706とを結ぶ直線である。尚、撮像装置101の3次元位置、及び点1703、点1704、点1706、点1708の3次元位置が与えられれば、直線1709、直線1710を表す直線の式は算出することができる。   Hereinafter, the process of updating the illumination position movable range in the present embodiment will be described in detail. FIG. 17 is a schematic view showing the image pickup apparatus 101 and the scene as viewed from above. In FIG. 17A, the scene includes a subject area 1701 and a background area 1702. Of the three-dimensional shape of the subject area 1701, points 1703 and 1704 are three-dimensional points corresponding to the boundary between the subject area and the background area in the subject area. A method similar to that of Embodiment 1 can be used to calculate the three-dimensional point of this boundary. A straight line 1705 is a straight line passing through the imaging device 101 and the point 1703. A point 1706 is a three-dimensional point corresponding to an intersection of the background area 1702 and the straight line 1705. Similarly, a straight line 1707 is a straight line passing the imaging device 101 and the point 1704, and an intersection point of the straight line 1707 and the background region 1702 is a point 1708. Further, a straight line 1709 is a straight line connecting the point 1703 and the point 1708, and a straight line 1710 is a straight line connecting the point 1704 and the point 1706. If the three-dimensional position of the imaging apparatus 101 and the three-dimensional positions of the point 1703, the point 1704, the point 1706, and the point 1708 are given, a straight line equation representing the straight line 1709 and the straight line 1710 can be calculated.

本実施形態では、被写体領域1701、直線1709、直線1710で囲まれた領域を、仮想照明の照明位置の可動範囲とする。ただし、本実施形態では、仮想照明の3次元座標は、前述のように回転中心位置C、半径r、方位角θ、仰角φの4変数で表し、このうち方位角θ、仰角φの2変数に対して可動範囲を設定している。そこで、被写体領域1701、直線1709、直線1710で囲まれた領域内の座標を、前述の照明位置を表わす回転中心位置C、半径r、方位角θ、仰角φの4変数で表す。   In this embodiment, an area surrounded by the subject area 1701, the straight line 1709, and the straight line 1710 is set as the movable range of the illumination position of the virtual illumination. However, in the present embodiment, the three-dimensional coordinates of the virtual illumination are represented by four variables of the rotation center position C, radius r, azimuth angle θ, elevation angle φ as described above, and among these, two variables of azimuth angle θ and elevation angle φ The movable range is set for. Therefore, the coordinates in the area surrounded by the subject area 1701, the straight line 1709, and the straight line 1710 are represented by four variables of the rotation center position C representing the illumination position described above, the radius r, the azimuth angle θ, and the elevation angle φ.

続いて、図17(b)を参照して、仮想照明の照明位置の可動範囲の設定方法について説明する。点1711は、照明位置の回転中心位置Cを表わしている。本実施形態では回転中心位置Cとして、前述のように被写体領域1701の重心OCが設定されている。孤1712は、点1711を中心とした半径rの孤である。半径rの値は、前述の照明位置設定部304によって設定されている。点1713は、直線1709と孤1712との交点を表し、点1714は、直線1710と孤1712との交点を表す。点1716は、点1711と撮像装置101とを結ぶ直線1715と、孤1712との交点である。角度1717は、点1713、点1711、点1716の3点が成す角度であり、角度1718は、点1714、点1711、点1716の3点が成す角度である。尚、撮像装置101の3次元位置、及び点1703、点1704、点1706、点1708の3次元位置が与えられれば、上記の点の3次元位置や直線の式、及び角度を算出することが可能である。   Subsequently, a method of setting the movable range of the illumination position of the virtual illumination will be described with reference to FIG. A point 1711 represents the rotation center position C of the illumination position. In the present embodiment, the center of gravity OC of the subject region 1701 is set as the rotation center position C as described above. The arc 1712 is an arc of radius r centered on the point 1711. The value of the radius r is set by the illumination position setting unit 304 described above. A point 1713 represents an intersection of a straight line 1709 and the arc 1712, and a point 1714 represents an intersection of the straight line 1710 and the arc 1712. A point 1716 is an intersection point of a straight line 1715 connecting the point 1711 and the imaging device 101 with the arc 1712. The angle 1717 is an angle formed by three points 1713, 1711, and 1716. The angle 1718 is an angle formed by three points 1714, 1711, and 1716. If the three-dimensional position of the imaging apparatus 101 and the three-dimensional positions of the point 1703, the point 1704, the point 1706, and the point 1708 are given, it is possible to calculate the equation of the three-dimensional position of the point and the straight line, and the angle. It is possible.

ここで、孤1712上の点1713から点1714までが、上記の半径rの場合の仮想照明の照明位置が取り得る可動範囲位置である。すなわち、角度1717及び角度1718が、方位角θの可動範囲となる。そのため、方位角θの可動範囲を表わす式(4)のうち角度θ1が角度1717となり、角度θ2が角度1718となる。 Here, points 1713 to 1714 on the arc 1712 are movable range positions that can be taken by the illumination position of the virtual illumination in the case of the radius r described above. That is, the angle 1717 and the angle 1718 are movable ranges of the azimuth angle θ. Therefore, the angle theta 1 of the formula (4) representing the movable range of the azimuth angle theta is next angle 1717, the angle theta 2 is at an angle 1718.

尚、上記では、被写体や撮像部を上側から見た図17を用いて、方位角θの可動範囲について説明を行った。しかし、被写体や仮想照明は3次元空間上で表現されるため、仰角φについても方位角θと同様に可動範囲φ1、φ2を算出する。 In the above, the movable range of the azimuth angle θ has been described using FIG. 17 in which the subject and the imaging unit are viewed from the upper side. However, since the subject and virtual illumination are expressed in a three-dimensional space, the movable ranges φ 1 and φ 2 are calculated for the elevation angle φ as well as the azimuth angle θ.

以上説明したように、ステップS1602での照明位置可動範囲の更新処理が行われる。   As described above, the process of updating the illumination position movable range in step S1602 is performed.

上記で説明したように本実施形態においては、3次元形状データのうち被写体領域だけではなく、背景領域まで参照し照明位置の可動範囲を設定する。これによって、より正確にシャドウの生成位置を予測することができるため、不自然なシャドウの生成をさらに抑えることが可能となる。   As described above, in the present embodiment, the movable range of the illumination position is set by referring to not only the subject region of the three-dimensional shape data but also the background region. This makes it possible to more accurately predict the shadow generation position, thereby further suppressing the generation of unnatural shadows.

[実施形態3]
実施形態1及び2では、被写体の3次元形状データの欠損によって生じる不自然なシャドウの発生を抑制するために、仮想照明の照明位置の可動範囲を設定した。これに対して、本実施形態では、被写体の3次元形状データの取得精度と仮想照明の照明サイズに応じて生じる不自然なシャドウの発生を抑制するために、仮想照明の照明サイズの設定可能範囲を設定する。例えば、照明サイズの小さな点光源と、照明サイズの大きな面光源とでは、被写体に対するライティング効果が異なり、照明サイズによっては、不自然なシャドウが発生してしまうことがある。また、3次元形状データの取得精度が低く、被写体の表面に本来は存在しない凸凹が存在する場合、本来は発生し得ないような不自然なシャドウが再現されてしまうことがある。そこで、本実施形態では、3次元形状データの取得精度に応じて仮想照明の照明サイズの設定可能範囲を設定することで、不自然なシャドウの発生を抑制する。
Third Embodiment
In the first and second embodiments, the movable range of the illumination position of the virtual illumination is set in order to suppress the generation of the unnatural shadow caused by the loss of the three-dimensional shape data of the subject. On the other hand, in the present embodiment, the setting range of the illumination size of the virtual illumination is to suppress generation of unnatural shadows that occur depending on the acquisition accuracy of the three-dimensional shape data of the object and the illumination size of the virtual illumination. Set For example, the lighting effect on the subject is different between a point light source with a small illumination size and a surface light source with a large illumination size, and an unnatural shadow may be generated depending on the illumination size. In addition, when the acquisition accuracy of the three-dimensional shape data is low, and there are irregularities that are not originally present on the surface of the subject, unnatural shadows that would otherwise not occur may be reproduced. Therefore, in the present embodiment, generation of an unnatural shadow is suppressed by setting the settable range of the illumination size of the virtual illumination in accordance with the acquisition accuracy of the three-dimensional shape data.

尚、以下では、実施形態1と同様の構成や動作についての説明は省略し、実施形態1と異なる構成や動作について主に説明する。   In the following, descriptions of configurations and operations similar to those of the first embodiment will be omitted, and configurations and operations different from the first embodiment will be mainly described.

<画像処理装置の外観及び内部構成>
本実施形態における撮像装置101(すなわち、画像処理装置)の外観及び内部構成は、図1及び図2を参照して上述した実施形態1の撮像装置101の外観及び内部構成と同様である。
<Appearance and Internal Configuration of Image Processing Device>
The appearance and internal configuration of the imaging apparatus 101 (that is, the image processing apparatus) in the present embodiment are the same as the appearance and internal configuration of the imaging apparatus 101 of the first embodiment described above with reference to FIGS.

尚、本実施形態における制御部206は、仮想照明の照明位置に加えて、仮想照明の照明サイズを含む照明条件の設定を制御する。具体的には、本実施形態における制御部206は、照明条件の設定に際し、後述する照明条件を表す複数のパラメータのうち、どのパラメータを更新するかを示す照明条件更新モードと、照明条件が決定しているかどうかを示す照明条件決定フラグの制御を行う。照明条件更新モードは、照明サイズを更新する場合は0、照明位置を更新する場合は1がそれぞれ設定される。照明条件決定フラグは、照明条件が未決定の場合は0、照明条件が決定されている場合は1がそれぞれ設定される。尚、照明条件更新モードと照明条件決定フラグは共に0が初期値として与えられる。   In addition to the illumination position of the virtual illumination, the control unit 206 in the present embodiment controls the setting of the illumination condition including the illumination size of the virtual illumination. Specifically, when setting the illumination condition, the control unit 206 in the present embodiment determines an illumination condition update mode that indicates which parameter is to be updated among a plurality of parameters representing the illumination condition described later, and the illumination condition is determined. Control of the lighting condition determination flag indicating whether or not it is done. In the illumination condition update mode, 0 is set when the illumination size is updated, and 1 is set when the illumination position is updated. The illumination condition determination flag is set to 0 when the illumination condition is undecided and 1 when the illumination condition is decided. Both the illumination condition update mode and the illumination condition determination flag are given 0 as an initial value.

<画像処理部209の構成>
図18は、本実施形態における画像処理部209の構成を示す機能ブロック図である。本実施形態における画像処理部209は、A/D変換部208よりRAW画像データ、距離画像取得部104より距離画像データ、そして制御部206より仮想照明の照明条件がそれぞれ入力される。画像処理部209は、距離画像データと照明条件に基づいて、RAW画像データに対してライティング処理を行う。そして、画像処理部209は、ライティング処理結果である出力画像を、(エンコーダ部210からメディアI/F211を介して)PC/メディア213へ、または表示部105へ出力する。
<Configuration of Image Processing Unit 209>
FIG. 18 is a functional block diagram showing a configuration of the image processing unit 209 in the present embodiment. The image processing unit 209 in the present embodiment receives raw image data from the A / D conversion unit 208, distance image data from the distance image acquisition unit 104, and illumination conditions of virtual illumination from the control unit 206. The image processing unit 209 performs lighting processing on the RAW image data based on the distance image data and the illumination condition. Then, the image processing unit 209 outputs an output image, which is the result of the writing process, to the PC / media 213 (from the encoder unit 210 via the media I / F 211) or to the display unit 105.

以下では、図18に示す機能ブロックのうち、実施形態1と異なる機能ブロックについて主に説明する。   In the following, among the functional blocks shown in FIG. 18, the functional blocks different from the first embodiment will be mainly described.

照明条件設定部1804は、制御部206から入力されたユーザ操作に応じて、少なくとも照明サイズを含む仮想照明の照明条件を設定する。尚、本実施形態では、照明条件として、仮想照明の照明サイズと照明位置の2つの情報を設定する。図19は、本実施形態における照明条件の設定操作とパラメータを説明する図である。図19(a)に示すように、撮像装置101の表示部105の表示画面には、ライティング処理の対象となる撮像画像1901が表示され、撮像画像1901に対し仮想照明を表すアイコン1902が重畳表示されている。ユーザは、表示部105に対するドラッグ操作によって、仮想照明を表すアイコン1902の照明サイズ及び照明位置を設定する。また、図19(b)に示すように、本実施形態では仮想照明1903は球で表し、仮想照明1903のサイズは球の半径Rsで表す。また、仮想照明1903の位置は、仮想照明1903の回転中心位置C=(Cx、Cy、Cz)、回転中心位置Cの周りの仮想照明1903の回転半径Rp、Y軸周りの回転角θ、Z軸周りの回転角φの4変数を用いて表す。以下では、Y軸周りの回転角θを方位角、Z軸周りの回転角φを仰角と証する。これらの4変数によって、仮想照明の照明位置の3次元座標L=(Lx、Ly、Lz)は、下記式(14)を使用して求めることができる。 The illumination condition setting unit 1804 sets illumination conditions of virtual illumination including at least the illumination size according to the user operation input from the control unit 206. In the present embodiment, as the illumination condition, two pieces of information of the illumination size of the virtual illumination and the illumination position are set. FIG. 19 is a diagram for explaining the setting operation of illumination conditions and parameters in the present embodiment. As shown in FIG. 19A, a captured image 1901 to be subjected to lighting processing is displayed on the display screen of the display unit 105 of the imaging device 101, and an icon 1902 representing virtual illumination is superimposed on the captured image 1901. It is done. The user sets the illumination size and illumination position of the icon 1902 representing virtual illumination by a drag operation on the display unit 105. Further, as shown in FIG. 19B, in the present embodiment, the virtual illumination 1903 is represented by a sphere, and the size of the virtual illumination 1903 is represented by the radius Rs of the sphere. Further, the position of the virtual illumination 1903 is the rotation center position C of the virtual illumination 1903 C = (Cx, Cy, Cz), the rotation radius R p of the virtual illumination 1903 around the rotation center position C, the rotation angle θ around the Y axis, This is expressed using four variables of the rotation angle φ around the Z axis. Hereinafter, the rotation angle θ about the Y axis is referred to as an azimuth angle, and the rotation angle φ about the Z axis is referred to as an elevation angle. With these four variables, the three-dimensional coordinates L = (Lx, Ly, Lz) of the illumination position of the virtual illumination can be determined using the following equation (14).

尚、仮想照明の照明サイズ及び照明位置の表現方法は、上記に限られるものではなく、他の方法を用いてもよい。   The method of expressing the illumination size and the illumination position of the virtual illumination is not limited to the above, and other methods may be used.

撮像装置条件取得部1805は、撮像装置101の撮影条件を取得する。撮像装置101の撮影条件には、レンズの焦点距離、カラー画像データの水平方向の画素数W及び垂直方向の画素数H、並びに、カラー画像データの撮影時の撮像装置101の位置及び姿勢が含まれる。撮像装置101の位置及び姿勢は、実施形態1において上述したように、カラー画像データと3次元形状データから算出される。   The imaging device condition acquisition unit 1805 acquires imaging conditions of the imaging device 101. The imaging conditions of the imaging apparatus 101 include the focal length of the lens, the number W of horizontal pixels of the color image data and the number H of vertical pixels of the color image data, and the position and orientation of the imaging apparatus 101 at the time of capturing color image data. Be The position and orientation of the imaging device 101 are calculated from color image data and three-dimensional shape data as described above in the first embodiment.

形状判断部1809は、被写体領域の3次元形状データの取得精度を取得し、所定の精度以上であるかどうか判断を行う。以下では、取得精度が所定値以上である場合を高精度とし、所定値未満である場合を低精度とする。本ブロックの処理の詳細は後述する。   The shape determination unit 1809 acquires the acquisition accuracy of the three-dimensional shape data of the subject region, and determines whether the accuracy is equal to or more than a predetermined accuracy. In the following, the case where the acquisition accuracy is equal to or more than a predetermined value is regarded as high accuracy, and the case where the acquisition accuracy is less than the predetermined value is regarded as low accuracy. Details of processing of this block will be described later.

照明サイズ範囲設定部1810は、被写体領域の3次元形状データが低精度であると判断された場合に、被写体領域の3次元形状データの取得精度に基づいて仮想照明の照明サイズに対し設定可能範囲を設定する。具体的には、照明サイズを表すパラメータである半径Rsに対し、下記式(15)で表されるように下限値rminを設定する。 The illumination size range setting unit 1810 can set the illumination size of the virtual illumination based on the acquisition accuracy of the three-dimensional shape data of the subject region when it is determined that the three-dimensional shape data of the subject region is low accuracy. Set Specifically, for the radius Rs, which is a parameter representing the illumination size, the lower limit value r min is set as represented by the following equation (15).

本実施形態では、照明サイズの範囲として下限値を設定するが、上限値を併せて設定してもよい。下限値rminの設定方法については後述する。 In the present embodiment, the lower limit value is set as the illumination size range, but the upper limit value may be set together. The method of setting the lower limit value r min will be described later.

照明サイズ範囲出力部1811は、照明サイズ範囲設定部1810で設定された照明サイズの設定可能範囲を表示部105へ出力し、ユーザに提示する。   The illumination size range output unit 1811 outputs the setting range of the illumination size set by the illumination size range setting unit 1810 to the display unit 105 and presents the range to the user.

照明サイズ評価部1812は、照明条件設定部1804で設定されたユーザ指定の照明サイズが、照明サイズ範囲設定部1810で設定された照明サイズの設定可能範囲内に含まれるか評価を行う。   The illumination size evaluation unit 1812 evaluates whether the user-specified illumination size set by the illumination condition setting unit 1804 is included in the settable range of the illumination size set by the illumination size range setting unit 1810.

尚、本実施形態における警告出力部313は、照明サイズ評価部1812において、ユーザ指定の照明サイズが、照明サイズ範囲設定部1810で設定された照明サイズの設定可能範囲内に含まれないと評価された場合に、警告を表示部105へ出力する。   The warning output unit 313 in this embodiment is evaluated by the illumination size evaluation unit 1812 not to include the illumination size specified by the user within the settable range of the illumination size set by the illumination size range setting unit 1810. If it does, the warning is output to the display unit 105.

以上説明したように、本実施形態における画像処理部209は、少なくとも照明サイズを含む仮想照明の照明条件に基づいて、ライティング処理を行うための機能を有する。   As described above, the image processing unit 209 in the present embodiment has a function for performing lighting processing based on the lighting condition of virtual lighting including at least the lighting size.

<画像処理部209の処理フロー>
続いて、本実施形態における画像処理部209の各部によるライティング処理の処理フローを説明する。図20は、本実施形態におけるライティング処理のフローチャートを示す。フローチャートにおける各ステップの処理は、CPU202がROM203やRAM204に格納されたプログラムを読み出して実行することにより実施される。尚、以下では、処理フローのうち、実施形態1と動作が異なるステップの処理について主に説明する。
<Processing Flow of Image Processing Unit 209>
Subsequently, the processing flow of the lighting processing by each unit of the image processing unit 209 in the present embodiment will be described. FIG. 20 shows a flowchart of the lighting process in the present embodiment. The processing of each step in the flowchart is implemented by the CPU 202 reading out and executing a program stored in the ROM 203 or the RAM 204. Note that, in the following, among the processing flows, processing of steps having operations different from those of Embodiment 1 will be mainly described.

まず、ステップS2001において、画像取得部301がRAW画像データを取得し、ステップS2002において、現像部302がRAW画像データを現像して、カラー画像データを生成する。さらに、ステップS2003において、形状取得部303が、撮像シーンの3次元形状データ(すなわち、ポリゴン)を取得する。ステップS2001〜S2003の処理は、実施形態1と同様である。   First, in step S2001, the image acquisition unit 301 acquires RAW image data, and in step S2002, the development unit 302 develops the RAW image data to generate color image data. Furthermore, in step S2003, the shape acquisition unit 303 acquires three-dimensional shape data (that is, polygons) of the imaging scene. The processes of steps S2001 to S2003 are the same as in the first embodiment.

次に、ステップS2004において、撮像装置条件取得部1805は、撮像装置101の撮影条件を取得する。前述のように、撮像装置101の撮影条件は、レンズの焦点距離、カラー画像データの水平方向及び垂直方向のそれぞれの画素数、並びに撮像装置101の位置・姿勢を含む。撮像装置条件取得部1805は、撮像装置101の位置として撮像装置の光学的な中心の3次元座標、撮像装置101の姿勢として撮像装置の水平方向、撮像装置の垂直方向、及び撮像装置の光軸方向の各値を算出する。本実施形態では、距離画像取得部104で取得した距離値から3次元形状データを算出しているため、撮像装置101の位置は原点(0、0、0)、撮像装置の水平方向は(1、0、0)、垂直方向は(0、1、0)、光軸の方向は(0、0、1)である。   Next, in step S2004, the imaging apparatus condition acquisition unit 1805 acquires imaging conditions of the imaging apparatus 101. As described above, the imaging conditions of the imaging device 101 include the focal length of the lens, the number of pixels in each of the horizontal and vertical directions of color image data, and the position and orientation of the imaging device 101. The imaging device condition acquisition unit 1805 is a position of the imaging device 101, three-dimensional coordinates of an optical center of the imaging device, a posture of the imaging device 101 in the horizontal direction of the imaging device, a vertical direction of the imaging device, and an optical axis of the imaging device. Calculate each value of direction. In this embodiment, since the three-dimensional shape data is calculated from the distance value acquired by the distance image acquisition unit 104, the position of the imaging device 101 is the origin (0, 0, 0), and the horizontal direction of the imaging device is (1 , 0, 0), the vertical direction is (0, 1, 0), and the direction of the optical axis is (0, 0, 1).

次に、ステップS2005において、被写体領域抽出部308が、被写体領域の3次元形状データを抽出し、ステップS2006に進む。   Next, in step S2005, the subject region extraction unit 308 extracts three-dimensional shape data of the subject region, and the process proceeds to step S2006.

ステップS2006では、照明サイズ範囲設定部1810が、照明条件のうちの照明サイズに対し設定可能範囲の初期化を行う。具体的には、前述の式(15)の照明サイズの下限値rminに対し、下記式(16)のように初期値を与える。 In step S2006, the illumination size range setting unit 1810 initializes the settable range for the illumination size among the illumination conditions. Specifically, an initial value is given to the lower limit value r min of the illumination size of the above-mentioned equation (15) as shown by the following equation (16).

ステップS2007において、形状判断部1809は、形状取得部303で取得した3次元形状データの取得精度を求め、取得精度が所定値未満であるか判定を行う。本実施形態において、3次元形状データの取得精度とは、3次元形状データの各頂点の3次元位置が、どの程度正しく取得できているかを表す指標である。取得精度は、形状が既知の3次元形状データに対し、正解3次元形状データ(すなわち、本来の3次元形状データ)と形状取得部303で取得した3次元形状データとを比較することで算出される。本実施形態では、正解の3次元形状データと取得した3次元形状データのそれぞれについて、法線の方向を比較し、その平均誤差を取得精度とする。   In step S2007, the shape determination unit 1809 obtains the acquisition accuracy of the three-dimensional shape data acquired by the shape acquisition unit 303, and determines whether the acquisition accuracy is less than a predetermined value. In the present embodiment, the acquisition accuracy of three-dimensional shape data is an index indicating how correctly the three-dimensional position of each vertex of the three-dimensional shape data can be acquired. The acquisition accuracy is calculated by comparing the correct three-dimensional shape data (that is, the original three-dimensional shape data) with the three-dimensional shape data acquired by the shape acquisition unit 303 with respect to the three-dimensional shape data whose shape is known. Ru. In the present embodiment, the direction of the normal is compared for each of the correct three-dimensional shape data and the acquired three-dimensional shape data, and the average error is taken as the acquisition accuracy.

以下に、図21を参照しながら本実施形態における取得精度の算出方法を説明する。図21は、形状が既知の正解3次元形状データ2101、形状取得部303で取得した3次元形状データ2102を示す。本実施形態では、各3次元形状データを分割した小領域2103、2104の構成単位として、前述のポリゴンを用いる。各3次元形状データの各ポリゴンは、法線2105、2106を含む。法線は、面に垂直な方向を示し、3次元ベクトルとして表現される。法線2105、2106は、ポリゴンの中心位置を始点とした矢印で方向を表現する。n番目のポリゴンにおいて正解3次元形状データの法線Nr(n)と、取得した3次元形状データの法線Na(n)について、2つのベクトルが成す角度ψ(n)は、下記式(17)によって求められ、これをポリゴンにおける法線方向の誤差とする。   Hereinafter, a method of calculating acquisition accuracy in the present embodiment will be described with reference to FIG. FIG. 21 shows correct three-dimensional shape data 2101 whose shape is known, and three-dimensional shape data 2102 acquired by the shape acquiring unit 303. In the present embodiment, the above-described polygon is used as a constituent unit of the small areas 2103 and 2104 obtained by dividing each three-dimensional shape data. Each polygon of each three-dimensional shape data includes normals 2105 and 2106. The normal indicates a direction perpendicular to the surface and is expressed as a three-dimensional vector. The normals 2105 and 2106 represent directions by arrows starting from the center position of the polygon. The angle ψ (n) formed by the two vectors with respect to the normal Nr (n) of the correct three-dimensional shape data and the normal Na (n) of the acquired three-dimensional shape data in the nth polygon is And the error in the normal direction of the polygon.

そして、被写体領域に含まれる各ポリゴンにおいて法線方向の誤差を算出し、その平均誤差ψを下記式(18)によって求める。   Then, an error in the normal direction is calculated for each polygon included in the subject region, and the average error ψ is obtained by the following equation (18).

Nは、被写体領域に含まれるポリゴン数を表わす。本実施形態では、各ポリゴンにおける法線方向の平均誤差ψを、取得精度を表す指標として利用し、平均誤差ψが大きい場合は取得精度が低く、平均誤差ψが小さい場合は取得精度が高いものとする。   N represents the number of polygons included in the subject area. In this embodiment, the average error ψ in the normal direction of each polygon is used as an index indicating acquisition accuracy, and the acquisition accuracy is low when the average error 大 き い is large, and the acquisition accuracy is high when the average error 小 さ い is small. I assume.

取得精度を判定するための所定値は、距離画像取得部104に利用されるデバイスや手法などに対応する取得精度の値を予めROM203に記憶しておき、本ステップの処理時に読み出すことで取得してもよい。距離画像取得部104に対応する取得精度は、距離画像取得部104の設計値を基に数式を用いて理論的に求める方法も考えられる。また、基準となる取得精度は、製造時や任意のタイミングで、3次元形状が既知の被写体の3次元形状データを距離画像取得部104によって測定することによって得ることもできる。   The predetermined value for determining the acquisition accuracy is acquired by storing in advance the value of the acquisition accuracy corresponding to the device or method used by the distance image acquisition unit 104 in the ROM 203 and reading it at the time of the processing of this step. May be The acquisition accuracy corresponding to the distance image acquisition unit 104 may be theoretically determined using a mathematical expression based on the design value of the distance image acquisition unit 104. The reference acquisition accuracy can also be obtained by measuring three-dimensional shape data of a subject whose three-dimensional shape is known by the distance image acquisition unit 104 at the time of manufacture or at any timing.

また、別の方法として、ライティング処理に用いる3次元形状データに対し何らかの処理を行うことによって、取得精度を取得する方法もある。ただし、この場合は各ポリゴンの法線方向の誤差を算出する際に正確な法線の方向がわからないため、注目ポリゴンの周辺のポリゴンにおける平均の法線方向を疑似的に正解法線として扱い、取得精度を算出する。   As another method, there is also a method of acquiring acquisition accuracy by performing some processing on three-dimensional shape data used for lighting processing. However, in this case, when calculating the error in the normal direction of each polygon, since the correct normal direction is not known, the average normal direction in the polygons around the polygon of interest is treated as a pseudo normal. Calculate the acquisition accuracy.

そして、上述のようにして取得した3次元形状データの平均誤差を、予めROM203に記憶しておいた所定の角度と比較し、取得精度が所定値未満であるか判定を行う。すなわち、平均誤差が所定の角度以上である場合の取得精度は、低精度であると判定し、一方、平均誤差が所定の角度未満である場合の取得精度は、高精度であると判断する。そして、取得精度が低精度であると判定された場合は、ステップS2008へ移行する。一方、取得精度が高精度であると判定された場合は、ステップS2010へ移行する。   Then, the average error of the three-dimensional shape data acquired as described above is compared with a predetermined angle stored in advance in the ROM 203 to determine whether the acquisition accuracy is less than a predetermined value. That is, the acquisition accuracy in the case where the average error is equal to or more than the predetermined angle is determined to be low, while the acquisition accuracy in the case where the average error is less than the predetermined angle is determined to be high. When it is determined that the acquisition accuracy is low, the process proceeds to step S2008. On the other hand, when it is determined that the acquisition accuracy is high, the process proceeds to step S2010.

ステップS2008において、照明サイズ範囲設定部1810は、3次元形状データの取得精度が低い場合に、被写体領域の3次元形状データから照明サイズの設定可能範囲の更新を行う。   In step S2008, when the acquisition accuracy of the three-dimensional shape data is low, the illumination size range setting unit 1810 updates the settable range of the illumination size from the three-dimensional shape data of the subject region.

本実施形態では、照明サイズ範囲設定部1810は、法線方向の平均誤差から照明サイズの下限値を算出し、照明サイズの設定可能範囲を更新する。具体的には、図22に示すように、仮想照明の回転中心位置Cから仮想照明を見込む角度が、ステップS2007で求めた法線方向の平均誤差ψとなる照明サイズを、下限値rminとする。そのため、法線方向の平均誤差ψから照明サイズの下限値rminの更新値は、下記式(19)を使用して算出することができる。 In the present embodiment, the illumination size range setting unit 1810 calculates the lower limit value of the illumination size from the average error in the normal direction, and updates the settable range of the illumination size. Specifically, as shown in FIG. 22, the lower limit r min is the illumination size at which the angle at which the virtual illumination is viewed from the rotation center position C of the virtual illumination is the average error 法線 in the normal direction determined in step S2007. Do. Therefore, the update value of the lower limit value r min of the illumination size can be calculated using the following equation (19) from the average error ψ in the normal direction.

次に、ステップS2009において、照明サイズ範囲出力部1811は、照明サイズの設定可能範囲を出力し、表示部105に表示する。照明サイズの設定可能範囲の表示は、図や文字を用いて行われる。例えば、図23に示すように、撮像画像1901に重畳表示された仮想照明を表すアイコン1902について、照明の下限サイズを表わす点線2301を表示する。点線2301は、現在の設定値での仮想照明を表すアイコン1902と中心の位置が同じ同心円として表示できる。また、照明サイズの設定可能範囲は、例えば、表示部105内に文字2302として表示してもよい。   Next, in step S2009, the illumination size range output unit 1811 outputs the setting range of the illumination size, and displays the range on the display unit 105. The display of the settable range of the illumination size is performed using figures and characters. For example, as shown in FIG. 23, a dotted line 2301 representing the lower limit size of illumination is displayed for an icon 1902 representing virtual illumination superimposed on the captured image 1901. The dotted line 2301 can be displayed as a concentric circle whose center position is the same as the icon 1902 representing virtual illumination at the current setting value. Further, the settable range of the illumination size may be displayed as characters 2302 in the display unit 105, for example.

次に、ステップS2010において、照明条件設定部1804は、仮想照明の照明条件、すなわち、仮想照明の照明サイズ及び照明位置について初期値を設定する。仮想照明のサイズについては仮想照明の半径Rsに初期値を設定する。仮想照明のサイズの初期値は、3次元形状データの取得精度が低い場合、ステップS2008で設定した仮想照明サイズの設定可能範囲内の値であればよい。仮想照明の位置については、仮想照明の回転中心位置Cと、半径r、方位角θ、仰角φの4変数に対しそれぞれ初期値を設定する。仮想照明の回転中心位置Cとしては、3次元形状データの被写体領域の重心OCを設定する。半径r、方位角θ、仰角φについては、照明位置の可動範囲内であれば任意の位置を設定可能である。例えば、被写体を正面から照らす照明の位置を、初期置として設定する。そのためには、半径rには被写体領域の重心OCのZ成分の値を設定し、方位角θ、仰角φにはそれぞれ0°を設定する。尚、被写体領域の重心OCのZ成分は、撮像装置101から被写体までの距離を表している。   Next, in step S2010, the illumination condition setting unit 1804 sets initial values for the illumination condition of the virtual illumination, that is, the illumination size and illumination position of the virtual illumination. For the size of the virtual illumination, an initial value is set to the radius Rs of the virtual illumination. The initial value of the virtual illumination size may be a value within the settable range of the virtual illumination size set in step S2008 when the acquisition accuracy of the three-dimensional shape data is low. As for the position of the virtual illumination, initial values are set for each of four variables of the rotation center position C of the virtual illumination, radius r, azimuth angle θ, and elevation angle φ. As the rotation center position C of the virtual illumination, the center of gravity OC of the subject region of the three-dimensional shape data is set. The radius r, the azimuth angle θ, and the elevation angle φ can be set to any position within the movable range of the illumination position. For example, the position of the illumination that illuminates the subject from the front is set as the initial setting. For that purpose, the value of the Z component of the center of gravity OC of the subject area is set to the radius r, and 0 ° is set to each of the azimuth angle θ and the elevation angle φ. The Z component of the center of gravity OC of the subject area represents the distance from the imaging apparatus 101 to the subject.

次に、ステップS2011で、ライティング処理部306がライティング処理を行い、出力画像データを生成する。本実施形態では、仮想照明の照明条件に基づいてライティング処理が行われる。詳細は後述する。   Next, in step S2011, the lighting processing unit 306 performs lighting processing to generate output image data. In the present embodiment, the lighting process is performed based on the illumination condition of the virtual illumination. Details will be described later.

次に、ステップS2012で、画像出力部307は、実施形態1と同様に、生成された出力画像データを表示部105へ出力し、ライティング処理結果のプレビュー表示を行う。ユーザは、プレビュー表示されたライティング処理結果を見て所望の陰影が再現できていると判断した場合は操作ボタン106を押下する。本実施形態では、照明条件が決定される。その際、制御部206は、照明条件決定フラグを1へ更新する。   Next, in step S2012, the image output unit 307 outputs the generated output image data to the display unit 105 as in the first embodiment, and performs preview display of the lighting processing result. The user depresses the operation button 106 when judging that the desired shade can be reproduced by looking at the lighting processing result displayed as a preview. In the present embodiment, the lighting conditions are determined. At this time, the control unit 206 updates the lighting condition determination flag to one.

次いで、ステップS2013で、画像出力部307は、照明条件が決定されたか判断する。具体的には、画像出力部307は、照明条件決定フラグを参照し、その値が決定を表す1であればステップS2014へ移行し、未決定を表す0であればステップS2015へ移行する。   Next, in step S2013, the image output unit 307 determines whether the illumination condition has been determined. Specifically, the image output unit 307 refers to the illumination condition determination flag, and proceeds to step S2014 if the value is 1 representing determination, and proceeds to step S2015 if 0 representing undetermined.

ステップS2014で、画像出力部307は、実施形態1と同様に、出力画像データをPC/メディア213へ出力し、保存する。   In step S2014, the image output unit 307 outputs the output image data to the PC / media 213 for storage as in the first embodiment.

ステップS2015では、照明条件設定部1804は、照明条件として仮想照明のサイズと照明位置の2つの情報を設定する。照明条件設定部1804は、照明条件更新モードが1の場合は、仮想照明のサイズを表わす照明の半径Rsの更新を行う。ここでは、ユーザによるドラッグ操作のうち、水平方向の移動量を用いて新たな半径Rsを算出する。具体的には、ドラッグ操作の押下開始座標Ps、押下終了座標Peから下記式(20)を用いてRs’を算出し、半径Rsへ代入し更新する。   In step S2015, the illumination condition setting unit 1804 sets two pieces of information of the size of the virtual illumination and the illumination position as the illumination condition. When the illumination condition update mode is 1, the illumination condition setting unit 1804 updates the radius Rs of the illumination indicating the size of the virtual illumination. Here, a new radius Rs is calculated using the amount of movement in the horizontal direction of the drag operation by the user. Specifically, Rs' is calculated from the pressing start coordinate Ps of the drag operation and the pressing end coordinate Pe using the following equation (20), and substituted into the radius Rs for update.

尚、Wはカラー画像データの水平方向の画素数を表す。   W represents the number of pixels in the horizontal direction of color image data.

一方、照明条件更新モードが0の場合は、照明条件設定部1804は、仮想照明の位置を表わす方位角θ及び仰角φの更新を行う。画像データ上の押下開始座標をPs=(is、js)、押下終了座標をPe=(ie、je)として、下記式(21)を用いてθ’及びφ’を算出し、それぞれ方位角θ、仰角φへ代入し更新する。 On the other hand, when the illumination condition update mode is 0, the illumination condition setting unit 1804 updates the azimuth angle θ and the elevation angle φ representing the position of the virtual illumination. Pressing the start coordinates on the image data Ps = (i s, j s ), as the pressing end coordinate Pe = (i e, j e ), calculates the theta 'and phi' using the following equation (21), The azimuth angle θ and the elevation angle φ are respectively substituted and updated.

ここで、A、Bは、撮像装置101の水平方向の画角をu、垂直方向の画角をvとして下記式(22)で表される。尚、前述のようにWはカラー画像データの水平方向、Hはカラー画像データの垂直方向の画素数をそれぞれ表している。   Here, A and B are expressed by the following equation (22), where u is the horizontal angle of view of the imaging device 101 and v is the vertical angle of view. As described above, W indicates the horizontal direction of color image data, and H indicates the number of pixels in the vertical direction of color image data.

次に、ステップS2016において、照明サイズ評価部1812は、ユーザによって指定された仮想照明のサイズが、前述の照明サイズの設定可能範囲内に含まれるかどうか判定を行う。ここでは、照明サイズを表す照明の半径Rsを、ステップS2008で設定した半径の下限値rminと比較することで、設定可能範囲内に含まれるか判定する。半径Rsが下限値rmin以上である場合は、ステップS2011へ移行する。一方、半径Rsが下限値rmin未満である場合は、ステップS2017へ移行する。 Next, in step S2016, the illumination size evaluation unit 1812 determines whether the size of the virtual illumination specified by the user is included in the settable range of the illumination size described above. Here, it is determined whether the radius Rs of the illumination representing the illumination size is included in the settable range by comparing it with the lower limit value r min of the radius set in step S2008. If the radius Rs is equal to or greater than the lower limit value r min , the process proceeds to step S2011. On the other hand, when the radius Rs is less than the lower limit value r min , the process moves to step S2017.

ステップS2017において、警告出力部313は、ユーザが指定した照明サイズが、下限値未満であることを表すメッセージ(すなわち、文字情報)や図から成る警告を表示部105へ出力し、表示する。図24は、本実施形態における警告表示の例を示す。図24では、仮想照明を表すアイコン1902が照明の下限サイズを表す点線2301の内側にあり、下限値未満の照明サイズが設定されている場合を示す。このような場合に、警告メッセージ2401が表示される。また、警告メッセージ2401を表示する以外に、アイコン1902の色を変えてもよい。アイコン1902の色を変える場合は、照明の下限サイズの範囲の内・外の2種類で色を切り替えるほか、照明の下限サイズの範囲内であっても境界近傍に近づくに従い徐々にアイコン1902の色を変えてもよい。尚、警告の表示方法については、これらに限定されるものではない。   In step S2017, the warning output unit 313 outputs a message (that is, character information) indicating that the illumination size specified by the user is less than the lower limit value or a warning including a diagram to the display unit 105 and displays it. FIG. 24 shows an example of a warning display in the present embodiment. FIG. 24 shows the case where the icon 1902 representing virtual illumination is inside the dotted line 2301 representing the lower limit size of illumination, and the illumination size smaller than the lower limit is set. In such a case, a warning message 2401 is displayed. In addition to displaying the warning message 2401, the color of the icon 1902 may be changed. When changing the color of the icon 1902, the color is switched between two types inside and outside the lower limit of the illumination size, and the color of the icon 1902 gradually approaches the border even within the illumination lower limit. You may change the The warning display method is not limited to these.

以上説明したように、本実施形態における画像処理部209はライティング処理を行なう。本処理によって、撮影済みのカラー画像データに対し仮想的な照明効果を付与したライティング画像が生成される。   As described above, the image processing unit 209 in the present embodiment performs the lighting process. By this processing, a lighting image in which a virtual lighting effect is added to the photographed color image data is generated.

<ライティング処理部306の動作>
以下では、本実施形態におけるライティング処理部306の動作について、詳細に説明する。ライティング処理部306は、前述のように、カラー画像データ、3次元形状データ、撮像装置位置・姿勢データ、及び仮想照明の照明条件を使用してライティング処理を実施し、さらに色変換処理を実施することで、出力画像データを生成する。尚、前述のように照明条件には仮想照明のサイズと照明位置が含まれる。
<Operation of Lighting Processing Unit 306>
The operation of the lighting processing unit 306 in the present embodiment will be described in detail below. As described above, the lighting processing unit 306 performs lighting processing using color image data, three-dimensional shape data, imaging device position / posture data, and illumination conditions of virtual lighting, and further performs color conversion processing. To generate output image data. As described above, the illumination conditions include the size of the virtual illumination and the illumination position.

図25は、本実施形態におけるライティング処理部306の構成を示す。本実施形態におけるライティング処理部306は、陰影画像生成部1002が、照明条件設定部1804及び撮像装置条件取得部1805から出力された照明条件及び撮像装置条件を用いて陰影画像データを生成する点で、実施形態1と異なる。詳細は、以下に説明する。   FIG. 25 shows the configuration of the lighting processing unit 306 in the present embodiment. The lighting processing unit 306 in the present embodiment generates shadow image data using the illumination condition and the imaging device condition output from the illumination condition setting unit 1804 and the imaging device condition acquiring unit 1805 in the shading image generation unit 1002. , Different from the first embodiment. Details will be described below.

図26は、本実施形態におけるライティング処理部306による出力画像データの生成処理のフローチャートを示す。全体的な処理フローは、実施形態1において図11を参照して説明した処理フローと同様であるが、ステップS2601からステップS2604のうち、ステップS2602の陰影画像生成部1002による処理が異なる。よって、以下では、主にステップS2602の処理について詳細に説明する。   FIG. 26 is a flowchart of a process of generating output image data by the lighting processing unit 306 in the present embodiment. The overall processing flow is the same as the processing flow described with reference to FIG. 11 in the first embodiment, but the processing by the shadow image generation unit 1002 in step S2602 is different among steps S2601 to S2604. Therefore, the process of step S2602 will be mainly described in detail below.

まず、ステップS2601において、法線算出部1001が、3次元形状データを基にシーン中の全点に対する面の向きを表す法線データを算出した後、ステップS2602に進む。   First, in step S 2601, the normal vector calculation unit 1001 calculates normal vector data representing the orientation of the surface with respect to all points in the scene based on the three-dimensional shape data, and then the process proceeds to step S 2602.

ステップS2602では、陰影画像生成部1002は、ユーザによって設定された仮想的な照明(すなわち、仮想照明)によってシーンに生じる陰影を、CG技法を用いて画像データとして生成する。本実施形態では、この陰影を表わす画像データ(すなわち、陰影画像データ)は、3次元形状データ、撮像装置条件、及び照明条件から生成される。   In step S2602, the shadow image generation unit 1002 generates, as image data, a shadow generated in a scene by virtual illumination (that is, virtual illumination) set by the user, using CG technology. In the present embodiment, image data representing this shadow (that is, shadow image data) is generated from three-dimensional shape data, imaging device conditions, and illumination conditions.

CG技法による陰影は、図12を参照して上述したように、一般にシェードとシャドウの2種類が存在する。シェードは、注目点に照明からの光が当たる場合に、照明からの光の注目点への入射角に応じて生じる明暗のことである。一方、シャドウは、注目点と照明との経路の間にある物体によって照明からの光が遮られることで注目点が暗くなる現象である。本実施形態では、少なくともシェードによる陰影を生成すればよい。   There are generally two types of shades by CG techniques, as described above with reference to FIG. 12: shades and shadows. A shade is the light and shade that occurs depending on the angle of incidence of light from the illumination to the point of interest when the light from the illumination falls on the point of interest. On the other hand, the shadow is a phenomenon in which the point of interest is darkened by the light from the illumination being blocked by the object between the path of the point of interest and the illumination. In the present embodiment, at least a shade of shade may be generated.

まず、図12(b)に示したような、本実施形態におけるシェード画像について説明する。本実施形態では、シェード画像データは、シーンの法線データと、仮想照明の照明位置と、仮想照明の照明サイズとから算出される。例えば、フォンの反射モデルを用いると、仮想照明が点光源の場合、シェード画像Ishade(i、j)は下記式(23)で算出することができる。 First, the shade image in the present embodiment as shown in FIG. 12 (b) will be described. In the present embodiment, the shade image data is calculated from the normal data of the scene, the illumination position of the virtual illumination, and the illumination size of the virtual illumination. For example, when the reflection model of Phong is used and the virtual illumination is a point light source, the shade image I shade (i, j) can be calculated by the following equation (23).

ここで、Lは仮想照明の3次元位置、P(i,j)は、座標(i,j)に対応する3次元形状データの位置、N(i、j)は、被写体位置P(i,j)における面の法線の方向、αは仮想照明の明るさをそれぞれ表す。本実施形態では、仮想照明は点光源ではなく半径Rsのサイズを持つため、照明の様々な場所から発せられる光によるシェードを算出するために上記式(23)を変更した下記式(24)を用いて、Ishade(i、j)を算出する。 Here, L is a three-dimensional position of virtual illumination, P (i, j) is a position of three-dimensional shape data corresponding to coordinates (i, j), N (i, j) is a subject position P (i, j). The direction of the surface normal in j), α, represents the brightness of the virtual illumination. In this embodiment, the virtual illumination is not a point light source but has a size of radius Rs, so the following equation (24) obtained by modifying the above equation (23) to calculate the shade by light emitted from various places of illumination Calculate I shade (i, j).

上記式(24)によって、半径Rsのサイズを持つ仮想照明の全域から被写体位置P(i,j)に入射する光によるシェードを算出することができる。   According to the above equation (24), it is possible to calculate the shade of light incident on the subject position P (i, j) from the entire area of the virtual illumination having the size of the radius Rs.

図12(b)に示したシェード画像データでは、被写体領域や背景領域において面の向きに応じた明暗が生じている。   In the shade image data shown in FIG. 12B, light and shade corresponding to the direction of the surface occur in the subject area and the background area.

次に、図12(a)に示したような、本実施形態におけるシャドウ画像について説明する。本実施形態では、シャドウ画像データは、シーンの3次元形状データと、仮想照明の照明サイズと、仮想照明の照明位置とから算出される。尚、前述のように本実施形態では、シャドウ画像データは必ずしも生成する必要はない。シャドウ画像データの生成には、例えばシャドウマッピングと呼ばれる手法が適用可能である。図12(a)に示したシャドウ画像データでは、被写体よって光が遮られることで、被写体以外の領域へシャドウが生じている様子を示している。   Next, a shadow image in the present embodiment as shown in FIG. 12A will be described. In the present embodiment, the shadow image data is calculated from the three-dimensional shape data of the scene, the illumination size of the virtual illumination, and the illumination position of the virtual illumination. As described above, in the present embodiment, the shadow image data need not necessarily be generated. For example, a method called shadow mapping can be applied to generation of shadow image data. The shadow image data shown in FIG. 12A shows that shadows are generated in areas other than the subject as light is blocked by the subject.

そして、陰影画像生成部1002は、実施形態1と同様に、上記式(12)を使用して、シェード画像データIshade(i,j)と、シャドウ画像データIshadow(i,j)とから、陰影画像データIS(i,j)を算出する。 Then, as in the first embodiment, the shadow image generation unit 1002 uses the equation (12) and uses the shade image data I shade (i, j) and the shadow image data I shadow (i, j). The shadow image data I s (i, j) is calculated.

次に、ステップS2603において、画像合成部1003は実施形態1と同様に、カラー画像データと陰影画像データからライティング画像データの合成を行う。すなわち、実施形態1の図13に示したように、カラー画像データに対し、仮想的な照明による陰影効果を付加することができる。   Next, in step S2603, the image combining unit 1003 combines lighting image data from color image data and shadow image data as in the first embodiment. That is, as shown in FIG. 13 of the first embodiment, it is possible to add a shadow effect by virtual illumination to color image data.

次に、ステップS2604において、色変換処理部1004は実施形態1と同様に、上述のライティング画像データに対し各種色変換処理を実施し、最終的な出力画像データを生成する。各種色変換処理が施された画像データは、出力画像データとして画像出力部307へ出力される。   Next, in step S2604, the color conversion processing unit 1004 performs various color conversion processing on the above-described lighting image data as in the first embodiment, and generates final output image data. The image data subjected to the various color conversion processing is output to the image output unit 307 as output image data.

以上説明したように、ライティング処理部306によるライティング処理が行われ、カラー画像データに対し仮想照明による陰影効果が付加された出力画像が生成される。   As described above, lighting processing is performed by the lighting processing unit 306, and an output image is generated in which a shading effect by virtual lighting is added to color image data.

<本実施形態の効果>
本実施形態によれば、撮影後の画像データに対し仮想的なライティング効果を付加する場合に、被写体形状の取得精度に基づいて照明サイズの設定可能範囲を設定することが可能となる。すなわち、被写体の3次元形状データの取得精度に応じて、仮想照明のサイズを設定することが可能となる。
<Effect of this embodiment>
According to the present embodiment, when a virtual lighting effect is added to image data after shooting, it is possible to set the settable range of the illumination size based on the acquisition accuracy of the subject shape. That is, it is possible to set the size of the virtual illumination in accordance with the acquisition accuracy of the three-dimensional shape data of the subject.

従来、低精度な被写体の3次元形状データを用いてライティング処理を行う場合に、本来の被写体にはないが、取得した3次元形状データに含まれる凹凸による不自然な陰影効果が生じてしまうことがあった。ライティング処理による陰影は、図26のステップS2602で式(24)を参照して説明したように、仮想照明のすべての領域から発せられる光による陰影を足し合わせることで算出される。そのため、仮想照明のサイズによって陰影による効果は変化する。例えば、仮想照明のサイズが小さい場合は、加算される陰影が少ないため、シャープではっきりした陰影が生じる。一方、仮想照明のサイズが大きい場合は、様々な位置から発せられた光による陰影が加算されるため、ぼけた陰影が生じる。そのため、3次元形状データに含まれる凹凸による陰影効果も、仮想照明のサイズが小さい場合ははっきりと目立つため、不自然な陰影になってしまう。一方、仮想照明のサイズが大きい場合はぼけて目立たなくなるため、不自然な陰影になりにくい。そこで、本実施形態では、被写体の3次元形状データの取得精度に応じて、仮想照明のサイズに下限を設けることで、不自然な陰影を生じにくくさせることが可能である。そして、ユーザが仮想照明のサイズを設定する際に、設定可能なサイズの範囲を提示することで、不自然な陰影が生じるサイズの仮想照明を設定してしまうことを防ぐことが可能となる。   Conventionally, when performing lighting processing using low-accuracy three-dimensional shape data of an object, an unnatural shading effect occurs due to the unevenness included in the acquired three-dimensional shape data although it is not the original object. was there. The shading by the lighting process is calculated by adding up the shading by the light emitted from all the regions of the virtual illumination as described with reference to equation (24) in step S2602 of FIG. Therefore, the shadow effect changes depending on the size of the virtual illumination. For example, if the size of the virtual illumination is small, sharp and clear shadows will occur because less shadows are added. On the other hand, when the size of the virtual illumination is large, shadows due to light emitted from various positions are added, resulting in blurred shadows. Therefore, the shading effect due to the unevenness included in the three-dimensional shape data also becomes unnatural shading because it is clearly visible when the size of the virtual illumination is small. On the other hand, when the size of the virtual illumination is large, it is blurred and inconspicuous, so it is hard to be an unnatural shadow. Therefore, in the present embodiment, it is possible to make unnatural shadows less likely to occur by setting a lower limit on the size of the virtual illumination according to the acquisition accuracy of the three-dimensional shape data of the subject. Then, when the user sets the size of the virtual illumination, it is possible to prevent setting of the virtual illumination of the size causing the unnatural shadow by presenting the range of the size that can be set.

[実施形態4]
実施形態3では、撮像装置101の筺体の中に画像撮像部102と距離画像取得部104が含まれる場合について説明したが、本実施形態では、画像撮像部102と距離画像取得部104が互いに独立した構成である場合について説明する。本実施形態では、カラー画像データと3次元形状データをそれぞれ独立した構成で取得するため、ライティング画像の解像度と被写体のポリゴンの解像度が対応していないことがある。そのため、例えば高い解像度で3次元形状データが取得されている場合、ライティング画像の1画素に多数のポリゴンが対応することとなる。その場合、実施形態3のように、3次元形状データのポリゴン単位で法線の誤差を算出すると、ライティング画像の1画素より細かい解像度での凹凸による法線の誤差によって、取得精度が必要以上に低く見積もられてしまうことがあった。そこで、本実施形態では、画像撮像部102と距離画像取得部104が互いに独立した構成であり、3次元形状データの解像度とカラー画像データの解像度が対応していない場合の仮想照明の照明サイズの設定可能範囲を設定する方法について説明する。
Fourth Embodiment
In the third embodiment, the case where the image pickup unit 102 and the distance image acquisition unit 104 are included in the housing of the image pickup apparatus 101 has been described, but in the present embodiment, the image pickup unit 102 and the distance image acquisition unit 104 are independent of each other The case where the configuration is the same will be described. In this embodiment, the color image data and the three-dimensional shape data may be acquired independently of each other, so the resolution of the lighting image may not correspond to the resolution of the polygon of the subject. Therefore, for example, when three-dimensional shape data is acquired at high resolution, a large number of polygons correspond to one pixel of the lighting image. In that case, if the error of the normal is calculated in polygon units of the three-dimensional shape data as in the third embodiment, the acquisition accuracy is more than necessary due to the error of the normal due to unevenness at a resolution finer than one pixel of the lighting image. It could have been underestimated. Therefore, in the present embodiment, the image capturing unit 102 and the distance image acquiring unit 104 are independent of each other, and the illumination size of the virtual illumination when the resolution of the three-dimensional shape data and the resolution of the color image data do not correspond. The method of setting the settable range will be described.

以下では、実施形態3と同様の構成や動作についての説明は省略し、実施形態3と異なる構成や動作について説明する。   In the following, descriptions of configurations and operations similar to those of the third embodiment will be omitted, and configurations and operations different from those of the third embodiment will be described.

<撮像システムの構成>
図27は、本実施形態における撮像システムの構成を示す。本実施形態における撮像システムは、カラー画像撮像部(すなわち、カラー画像撮像装置)2701と、形状測定部(すなわち、形状測定装置)2702が互いに独立して構成され、被写体2703をそれぞれが撮影する。形状測定部2702は、タイムオブフライト方式や多視点カメラ方式、光切断方式などの方式を用いて、被写体2703の3次元形状データを測定するものとする。3次元形状データは、3次元空間中の点と、複数の3次元点を結んだ面から構成されるポリゴンとする。また、形状測定部2702は、被写体2703の周囲を動きながら測定した3次元形状データをスティッチすることで、広範囲の3次元形状データを取得してもよい。
<Configuration of Imaging System>
FIG. 27 shows a configuration of an imaging system in the present embodiment. In the imaging system in the present embodiment, a color image capturing unit (that is, a color image capturing apparatus) 2701 and a shape measuring unit (that is, a shape measuring apparatus) 2702 are configured independently of each other, and each image a subject 2703. The shape measurement unit 2702 measures three-dimensional shape data of the subject 2703 using a time-of-flight method, a multi-viewpoint camera method, a light cutting method, or the like. The three-dimensional shape data is a polygon composed of a point in a three-dimensional space and a surface connecting a plurality of three-dimensional points. The shape measuring unit 2702 may acquire three-dimensional shape data in a wide range by stitching three-dimensional shape data measured while moving around the subject 2703.

<カラー画像撮像部の内部構成>
図28は、本実施形態におけるカラー画像撮像部2701の内部構成を示すブロック図である。カラー画像撮像部2701は、図2に示した撮像装置101と比較して、距離画像取得部104が形状測定部2702として外部に存在することを除き、撮像装置101と同様の構成を有する。形状測定部2702は、有線または無線のネットワークを介して、3次元形状データをカラー画像撮像部2701に送信する。或いは、取り外し可能な記憶媒体を介して、3次元形状データを渡してもよい。本実施形態における画像処理部209は、形状測定部2702が取得した3次元形状データを利用して、画像処理を行う。画像処理の詳細は後述する。
<Internal Configuration of Color Image Pickup Unit>
FIG. 28 is a block diagram showing an internal configuration of the color image pickup unit 2701 in the present embodiment. The color image pickup unit 2701 has a configuration similar to that of the image pickup apparatus 101 except that the distance image acquisition unit 104 exists outside as the shape measurement unit 2702 as compared with the image pickup apparatus 101 shown in FIG. The shape measuring unit 2702 transmits three-dimensional shape data to the color image capturing unit 2701 via a wired or wireless network. Alternatively, three-dimensional shape data may be passed via a removable storage medium. The image processing unit 209 in the present embodiment performs image processing using the three-dimensional shape data acquired by the shape measurement unit 2702. Details of the image processing will be described later.

<画像処理部209の構成>
図29は、本実施形態における画像処理部209の構成を示す機能ブロック図である。以下では、図29に示す機能ブロックのうち、実施形態3と異なる機能ブロックについて主に説明する。
<Configuration of Image Processing Unit 209>
FIG. 29 is a functional block diagram showing the configuration of the image processing unit 209 in the present embodiment. In the following, among the functional blocks shown in FIG. 29, the functional blocks different from the third embodiment will be mainly described.

本実施形態における形状取得部2903は、形状測定部2702によって測定された被写体2703の3次元形状データを取得する。撮像装置条件取得部2905は、カラー画像撮像部2701の撮影条件を取得する。本実施形態における撮影条件とは、カラー画像撮像部2701のレンズの焦点距離、カラー画像データの水平方向、垂直方向それぞれの画素数、及び、カラー画像撮像部2701の被写体2703に対する3次元位置・姿勢である。形状判断部2909は、被写体領域の3次元形状データと撮像装置条件から、解像度の違いを考慮して3次元形状データの取得精度を算出し、所定の取得精度以上かどうか判断を行う。   The shape acquisition unit 2903 in the present embodiment acquires three-dimensional shape data of the subject 2703 measured by the shape measurement unit 2702. The imaging apparatus condition acquisition unit 2905 acquires imaging conditions of the color image imaging unit 2701. The shooting conditions in the present embodiment include the focal length of the lens of the color image pickup unit 2701, the number of pixels in each of the horizontal and vertical directions of color image data, and the three-dimensional position / attitude of the color image pickup unit 2701 with respect to the subject 2703 It is. The shape determination unit 2909 calculates the acquisition accuracy of the three-dimensional shape data in consideration of the difference in resolution from the three-dimensional shape data of the subject region and the imaging device condition, and determines whether it is equal to or more than a predetermined acquisition accuracy.

<画像処理部209の処理フロー>
続いて、本実施形態における画像処理部209の各部によるライティング処理の処理フローを説明する。図30は、本実施形態におけるライティング処理のフローチャートを示す。フローチャートにおける各ステップの処理は、CPU202がROM203やRAM204に格納されたプログラムを読み出して実行することにより実施される。尚、以下では、処理フローのうち、実施形態3と動作が異なるステップの処理について主に説明する。
<Processing Flow of Image Processing Unit 209>
Subsequently, the processing flow of the lighting processing by each unit of the image processing unit 209 in the present embodiment will be described. FIG. 30 shows a flowchart of the lighting process in the present embodiment. The processing of each step in the flowchart is implemented by the CPU 202 reading out and executing a program stored in the ROM 203 or the RAM 204. In the following, among the processing flows, the processing of the steps whose operation is different from that of the third embodiment will be mainly described.

まず、実施形態3と同様に、ステップS2001において、画像取得部301がRAW画像データを取得し、ステップS2002において、現像部302がRAW画像データを現像して、カラー画像データを生成する。   First, as in the third embodiment, in step S2001, the image acquisition unit 301 acquires RAW image data, and in step S2002, the development unit 302 develops the RAW image data to generate color image data.

次に、ステップS3003において、形状取得部2903は、形状測定部2702から被写体の3次元形状データを取得する。前述のように、ここでは、被写体の3次元形状データは、被写体表面のポリゴンデータとする。   Next, in step S3003, the shape acquisition unit 2903 acquires three-dimensional shape data of a subject from the shape measurement unit 2702. As described above, here, the three-dimensional shape data of the subject is polygon data of the subject surface.

次に、ステップS3004において、撮像装置条件取得部2905は、カラー画像撮像部2701の撮影条件を取得する。前述のように、撮像装置であるカラー画像撮像部2701の撮影条件は、レンズの焦点距離、カラー画像データの水平方向、垂直方向それぞれの画素数、及びカラー画像撮像部2701の位置・姿勢を含む。撮像装置条件取得部2905は、カラー画像撮像部2701の位置・姿勢を表わす情報として、カメラの回転行列R、並進ベクトルTを取得する。ここで、被写体2703に対する3次元位置・姿勢は、SfM(Structure from Motion)と呼ばれる異なる視点位置から撮影された複数の画像データからカメラの位置・姿勢を算出する技術によって得ることができる。これは、カラー画像データと3次元形状データから探索した複数の対応する点から、カメラでの撮影による射影変換行列を求める技術である。そして、求めた射影変換行列からカメラの回転行列R、並進ベクトルT、すなわち、カラー画像撮像部2701の位置・姿勢を算出することができる。SfMについては公知の技術であり、本発明の主眼でないため説明は省略する。   Next, in step S3004, the imaging apparatus condition acquisition unit 2905 acquires the imaging conditions of the color image imaging unit 2701. As described above, the photographing conditions of the color image pickup unit 2701 which is an image pickup apparatus include the focal length of the lens, the number of pixels in each of the horizontal direction and the vertical direction of color image data, and the position / attitude of the color image pickup unit 2701 . The imaging apparatus condition acquisition unit 2905 acquires a rotation matrix R and a translation vector T of the camera as information representing the position and orientation of the color image pickup unit 2701. Here, the three-dimensional position / posture with respect to the subject 2703 can be obtained by a technique called SfM (Structure from Motion) which calculates the position / posture of the camera from a plurality of image data captured from different viewpoint positions. This is a technique for obtaining a projection transformation matrix by photographing with a camera from a plurality of corresponding points searched from color image data and three-dimensional shape data. Then, the rotation matrix R and translation vector T of the camera, that is, the position / orientation of the color image pickup unit 2701 can be calculated from the projective transformation matrix obtained. SfM is a well-known technology and is not the main point of the present invention, so the description is omitted.

次に、実施形態3と同様に、ステップS2005において、被写体領域抽出部308が被写体領域の3次元形状データを抽出し、ステップS2006において、照明サイズ範囲設定部1810が照明条件のうちの照明サイズに対し設定可能範囲の初期化を行う。   Next, as in the third embodiment, in step S2005, the subject area extraction unit 308 extracts three-dimensional shape data of the subject area, and in step S2006, the illumination size range setting unit 1810 sets the illumination size to one of the illumination conditions. Perform initialization of the settable range.

次に、ステップS3007において、形状判断部2909は、3次元形状データと撮像装置条件から3次元形状データの取得精度を算出し、取得精度が所定値未満であるか判定を行う。本実施形態においては、カラー画像データと3次元形状データをそれぞれ独立した構成で取得するため、ライティング画像と被写体のポリゴンの解像度が対応していないことがある。そのため、例えば、より高い解像度で3次元形状データが取得されている場合、ライティング画像の1画素に多数のポリゴンが対応することとなる。その場合、実施形態3のように形状データのポリゴン単位で法線の誤差の算出を行うと、ライティング画像の1画素より細かい解像度での凹凸による法線の誤差によって、取得精度が必要以上に低く見積もられてしまう。そこで、本実施形態における形状判断部2909は、ライティング画像の各画素に対応する領域を3次元形状データから抽出し、その領域の法線と正解3次元形状データが持つ法線が成す角度から3次元形状データの取得精度の算出を行う。   Next, in step S3007, the shape determination unit 2909 calculates the acquisition accuracy of the three-dimensional shape data from the three-dimensional shape data and the imaging device condition, and determines whether the acquisition accuracy is less than a predetermined value. In the present embodiment, the color image data and the three-dimensional shape data may be acquired independently of each other, so that the resolution of the lighting image may not correspond to the resolution of the polygon of the subject. Therefore, for example, when three-dimensional shape data is acquired at a higher resolution, a large number of polygons correspond to one pixel of the lighting image. In that case, if the error of the normal is calculated in polygon units of shape data as in the third embodiment, the accuracy of acquisition is lower than necessary due to the error of the normal due to unevenness at a resolution finer than one pixel of the lighting image. It will be estimated. Therefore, the shape determination unit 2909 in the present embodiment extracts a region corresponding to each pixel of the lighting image from the three-dimensional shape data, and the angle between the normal of the region and the normal of the correct three-dimensional shape data forms 3 Calculate the acquisition accuracy of dimensional shape data.

そのために、まず、形状判断部2909は、ライティング画像の各画素と対応する3次元形状データの領域の検出を行う。ライティング画像の画素(i、j)と対応する3次元形状データの領域を検出するには、以下の式(25)〜(28)のそれぞれによって表される4つの直線l1〜l4と、3次元形状データとの交点を求めればよい。式(25)〜(28)は、カラー画像撮像部2701のレンズの焦点距離fx、fy、カラー画像データの水平方向及び垂直方向の画素数W、H、カラー画像撮像部2701の位置・姿勢を表す回転行列R、並進ベクトルTを用いて表される。 For that purpose, first, the shape determination unit 2909 detects an area of three-dimensional shape data corresponding to each pixel of the lighting image. Writing image pixel (i, j) to detect an area of the three-dimensional shape data corresponding to the four straight lines l 1 to l 4, represented by each of the following equation (25) to (28), The point of intersection with the three-dimensional shape data may be determined. Formulas (25) to (28) are the focal lengths f x and f y of the lens of the color image pickup unit 2701, the numbers W and H of pixels of the color image data in the horizontal and vertical directions, the position of the color image pickup unit 2701 It is expressed using a rotation matrix R representing a posture and a translation vector T.

ここで、fx、fyはカラー画像撮像部2701の画素の単位で表された焦点距離である。l1〜l4は、媒介変数sを用いた直線を表わしている。直線l1〜l4と3次元形状データとの交点は、CG技法におけるレイ・トレーシング(光線追跡法)で利用されるポリゴンと直線との衝突判定を用いて求めることができる。この場合、3次元形状データに含まれるポリゴンの中から、直線l1〜l4と交点を持つポリゴンが探索される。これら4つの交点が作る面を、カラー画像データの画素に対応する領域とする。 Here, f x and f y are focal lengths expressed in pixel units of the color image pickup unit 2701. l 1 to l 4 represent straight lines using the parameter s. The intersections of the straight lines l 1 to l 4 and the three-dimensional shape data can be determined using collision determination between a polygon and a straight line used in ray tracing in the CG technique. In this case, among the polygons included in the three-dimensional shape data, a polygon having an intersection with the straight lines l 1 to l 4 is searched. A plane formed by these four intersections is taken as an area corresponding to a pixel of color image data.

次に、形状判断部2909は、カラー画像データの画素に対応する領域の面の法線を算出する。尚、4点の交点が必ずしも1つの平面上に存在するわけではないため、最適化によって求めた4点に最も近い平面の法線を算出してもよい。或いは、4点から成る四角形を、対角線で切った2つの三角形に分割し、各三角形の平面に対する法線の平均値を4点が作る平面の法線として扱ってもよい。尚、カラー画像データの被写体領域の全ての画素について、3次元形状データから対応する領域を検出し、その法線を算出する。   Next, the shape determination unit 2909 calculates the normal to the surface of the area corresponding to the pixel of the color image data. In addition, since the intersection of four points does not necessarily exist on one plane, the normal line of the plane closest to the four points obtained by optimization may be calculated. Alternatively, a quadrilateral of four points may be divided into two diagonal triangles, and the average value of the normals to the plane of each triangle may be treated as the normal of the plane that the four points make. A corresponding area is detected from the three-dimensional shape data for all the pixels in the subject area of the color image data, and the normal is calculated.

次に、形状判断部2909は、上記のカラー画像データの各画素に対応する領域の面の法線と正解3次元形状データ中の同一場所の法線が成す角度を算出する。2つの法線の成す角度は、実施形態3の上記式(18)を用いて算出することができる。この角度を、カラー画像データの画素に対応する領域における法線方向の誤差とする。尚、正解3次元形状データを持たない場合、注目領域の周辺領域の平均の法線方向を疑似的に正解法線として扱い、取得精度を算出する。そして、カラー画像データの被写体領域に含まれる画素に対応する領域において算出した法線方向の誤差の平均値ψを、取得精度を表す指標として利用する。実施形態3と同様に、平均誤差が大きい場合は取得精度が低く、平均誤差が小さい場合は取得精度が高いものとする。   Next, the shape determination unit 2909 calculates an angle formed by the normal to the surface of the area corresponding to each pixel of the color image data and the normal to the same place in the correct three-dimensional shape data. The angle between the two normals can be calculated using the above equation (18) of the third embodiment. This angle is an error in the normal direction in the area corresponding to the pixel of the color image data. When the correct three-dimensional shape data is not included, the normal direction of the average of the peripheral area of the attention area is treated as a pseudo normal to calculate the acquisition accuracy. Then, the average value 誤差 of the errors in the normal direction calculated in the area corresponding to the pixel included in the subject area of the color image data is used as an index indicating acquisition accuracy. As in the third embodiment, when the average error is large, the acquisition accuracy is low, and when the average error is small, the acquisition accuracy is high.

そして、形状判断部2909は、上述のようにして取得した3次元形状データの取得精度を、予めROM203に記憶しておいた所定の角度と比較し、取得精度が所定値未満であるか判断を行う。すなわち、平均誤差が所定の角度以上である場合、取得精度は低精度であると判断し、ステップS2008へ移行する。一方、平均誤差が所定の角度未満である場合、取得精度は高精度であると判断し、ステップS2010へ移行する。   Then, the shape determination unit 2909 compares the acquisition accuracy of the three-dimensional shape data acquired as described above with a predetermined angle stored in advance in the ROM 203, and determines whether the acquisition accuracy is less than a predetermined value. Do. That is, when the average error is equal to or more than the predetermined angle, it is determined that the acquisition accuracy is low, and the process proceeds to step S2008. On the other hand, if the average error is less than the predetermined angle, it is determined that the acquisition accuracy is high, and the process proceeds to step S2010.

その他のステップは、実施形態3と同様である。   The other steps are the same as in the third embodiment.

以上説明したように、本実施形態にライティング処理では、実施形態3と比較して、ステップS3003、ステップS3004、及び、ステップS3007における処理が異なる。   As described above, in the writing process according to this embodiment, the processes in step S3003, step S3004, and step S3007 are different from those in the third embodiment.

上記で説明したように本実施形態においては、画像撮像部102と距離画像取得部104とが独立した構成の場合における仮想照明のサイズの設定可能範囲を設定する方法を説明した。本実施形態では、3次元形状データの解像度とカラー画像データの解像度が対応していない場合であっても、仮想照明のサイズに対して適切な設定可能範囲を設定することが可能となる。   As described above, in the present embodiment, the method of setting the settable range of the size of the virtual illumination in the case where the image pickup unit 102 and the distance image acquisition unit 104 are independent has been described. In the present embodiment, even when the resolution of the three-dimensional shape data and the resolution of the color image data do not correspond to each other, it is possible to set an appropriate settable range for the size of the virtual illumination.

[その他の実施形態]
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
Other Embodiments
The present invention supplies a program that implements one or more functions of the above-described embodiments to a system or apparatus via a network or storage medium, and one or more processors in a computer of the system or apparatus read and execute the program. Processing is also feasible. It can also be implemented by a circuit (eg, an ASIC) that implements one or more functions.

101 画像処理装置
105 表示部
209 画像処理部
301 画像取得部
302 現像部
303 形状取得部
304 照明位置設定部
305 撮像装置位置・姿勢算出部
306 ライティング処理部
307 画像出力部
308 被写体領域抽出部
309 形状判断部
310 照明位置可動範囲設定部
311 照明位置可動範囲出力部
312 照明位置評価部
313 警告出力部
101 image processing apparatus 105 display unit 209 image processing unit 301 image acquisition unit 302 development unit 303 shape acquisition unit 304 illumination position setting unit 305 imaging device position / attitude calculation unit 306 writing processing unit 307 image output unit 308 object area extraction unit 309 shape Judgment unit 310 Illumination position movable range setting unit 311 Illumination position movable range output unit 312 Illumination position evaluation unit 313 Warning output unit

Claims (23)

撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置であって、
前記3次元形状データから、被写体領域の3次元形状データを抽出する前記被写体領域の抽出手段と、
前記被写体領域の3次元形状データに欠損が存在する場合に、前記3次元形状データの前記欠損に基づいて、前記仮想照明の可動範囲を設定する可動範囲設定手段と
を有することを特徴とする画像処理装置。
An image processing apparatus that adds a shadow effect by virtual illumination to the captured image based on three-dimensional shape data corresponding to the captured image,
Extracting means of the subject area for extracting three-dimensional shape data of the subject area from the three-dimensional shape data;
An image characterized by comprising movable range setting means for setting a movable range of the virtual illumination based on the loss of the three-dimensional shape data when there is a loss in the three-dimensional shape data of the subject region Processing unit.
前記可動範囲設定手段は、前記3次元形状データにおける前記被写体領域の重心と、前記欠損に対応する前記被写体領域と背景領域との境界に基づいて、前記可動範囲を設定することを特徴とする請求項1に記載の画像処理装置。   The movable range setting means sets the movable range based on the center of gravity of the subject region in the three-dimensional shape data and the boundary between the subject region and the background region corresponding to the defect. An image processing apparatus according to Item 1. 前記可動範囲設定手段は、前記被写体領域の3次元形状データに加え、背景領域の3次元形状データ及び撮像装置の3次元位置に基づいて、前記可動範囲を設定することを特徴とする請求項1に記載の画像処理装置。   The movable range setting means sets the movable range based on three-dimensional shape data of a background area and a three-dimensional position of an imaging device in addition to the three-dimensional shape data of the subject area. The image processing apparatus according to claim 1. 前記被写体領域の3次元形状データに前記欠損が存在するかどうかを判断する形状判断手段を更に有することを特徴とする請求項1乃至3のいずれか1項に記載の画像処理装置。   The image processing apparatus according to any one of claims 1 to 3, further comprising shape determination means for determining whether or not the defect exists in the three-dimensional shape data of the subject region. 前記形状判断手段は、前記被写体領域の3次元形状データを被写体の全周にわたって取得できていない場合に、前記欠損が存在すると判断することを特徴とする請求項4に記載の画像処理装置。   5. The image processing apparatus according to claim 4, wherein the shape determination unit determines that the defect exists when the three-dimensional shape data of the subject region can not be acquired over the entire circumference of the subject. 前記形状判断手段は、前記被写体領域を構成するポリゴンが、閉曲面であるか、または開曲面であるかを判断することで、前記欠損が存在するかどうかを判断することを特徴とする請求項4に記載の画像処理装置。   The shape determination means determines whether or not the defect exists by determining whether a polygon forming the subject area is a closed surface or an open surface. The image processing apparatus according to 4. 前記形状判断手段は、前記被写体領域の3次元形状データと、前記撮像画像に画像認識技術を適用して得られた結果を用いて、前記欠損が存在するかどうかを判断することを特徴とする請求項4に記載の画像処理装置。   The shape determination means may determine whether the defect exists by using three-dimensional shape data of the subject region and a result obtained by applying an image recognition technique to the captured image. The image processing apparatus according to claim 4. 前記仮想照明の照明位置の可動範囲を表示する表示手段を更に有することを特徴とする請求項1乃至7のいずれか1項に記載の画像処理装置。   The image processing apparatus according to any one of claims 1 to 7, further comprising display means for displaying a movable range of the illumination position of the virtual illumination. 前記表示手段は、前記仮想照明の照明位置と、前記仮想照明の照明位置の可動範囲とを比較し、前記仮想照明の照明位置が前記仮想照明の照明位置の可動範囲の境界近傍、または、前記可動範囲の外に設定された場合に、ユーザに警告を提示することを特徴とする請求項8に記載の画像処理装置。   The display means compares the illumination position of the virtual illumination with the movable range of the illumination position of the virtual illumination, and the illumination position of the virtual illumination is near the boundary of the movable range of the illumination position of the virtual illumination or 9. The image processing apparatus according to claim 8, wherein a warning is presented to the user when it is set outside the movable range. 前記表示手段は、前記警告のための文字情報を表示すること、または、前記仮想照明の照明位置を表すアイコンの色を変化させることの少なくとも一方によって、前記ユーザへの警告を提示することを特徴とする請求項9に記載の画像処理装置。   The display means presents a warning to the user by displaying character information for the warning, or changing the color of an icon representing the illumination position of the virtual illumination. The image processing apparatus according to claim 9, wherein コンピュータを、請求項1乃至10のいずれか1項に記載の画像処理装置として機能させるためのプログラム。   A program for causing a computer to function as the image processing apparatus according to any one of claims 1 to 10. 撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置による画像処理方法であって、
前記3次元形状データから、被写体領域の3次元形状データを抽出するステップと、
前記被写体領域の3次元形状データに欠損が存在する場合に、前記3次元形状データの前記欠損に基づいて、前記仮想照明の可動範囲を設定するステップと
を含むことを特徴とする画像処理方法。
An image processing method by an image processing apparatus, which adds a shadow effect by virtual illumination to a captured image based on three-dimensional shape data corresponding to the captured image,
Extracting three-dimensional shape data of a subject area from the three-dimensional shape data;
And setting a movable range of the virtual illumination based on the loss of the three-dimensional shape data, when there is a loss in the three-dimensional shape data of the subject region.
撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置であって、
前記3次元形状データから、被写体領域の3次元形状データを抽出する前記被写体領域の抽出手段と、
前記被写体領域の3次元形状データの取得精度が低い場合に、前記3次元形状データの前記取得精度に基づいて、前記仮想照明の照明サイズの設定可能範囲を設定する照明サイズ範囲設定手段と
を有することを特徴とする画像処理装置。
An image processing apparatus that adds a shadow effect by virtual illumination to the captured image based on three-dimensional shape data corresponding to the captured image,
Extracting means of the subject area for extracting three-dimensional shape data of the subject area from the three-dimensional shape data;
Illumination size range setting means for setting the settable range of the illumination size of the virtual illumination based on the acquisition accuracy of the three-dimensional shape data when the acquisition accuracy of the three-dimensional shape data of the subject region is low An image processing apparatus characterized by
前記3次元形状データの取得精度は、前記被写体領域の3次元形状データにおける法線と、本来の3次元形状データにおける法線とが成す角度に基づいて算出されることを特徴とする請求項13に記載の画像処理装置。   The acquisition accuracy of the three-dimensional shape data is calculated based on an angle formed by a normal line in the three-dimensional shape data of the subject region and a normal line in the original three-dimensional shape data. The image processing apparatus according to claim 1. 前記撮像画像の解像度より、前記被写体領域の3次元形状データの解像度が高い場合、前記被写体領域の3次元形状データにおける法線は、前記撮像画像の画素に対応する領域の法線であることを特徴とする請求項13に記載の画像処理装置。   When the resolution of the three-dimensional shape data of the subject region is higher than the resolution of the captured image, the normal in the three-dimensional shape data of the subject region is the normal to the region corresponding to the pixel of the captured image. The image processing apparatus according to claim 13, characterized in that 前記3次元形状データの取得精度は、前記被写体領域の3次元形状データにおける注目領域の法線と、前記注目領域の周辺領域における平均の法線方向を有する法線とが成す角度に基づいて算出されることを特徴とする請求項13に記載の画像処理装置。   The acquisition accuracy of the three-dimensional shape data is calculated based on an angle formed by the normal line of the attention area in the three-dimensional shape data of the subject area and the normal line having the average normal direction in the peripheral area of the attention area. The image processing apparatus according to claim 13, characterized in that: 前記3次元形状データの取得精度が所定値より低いかどうかを判断する形状判断手段を更に有することを特徴とする請求項13乃至16のいずれか1項に記載の画像処理装置。   The image processing apparatus according to any one of claims 13 to 16, further comprising shape determination means for determining whether the acquisition accuracy of the three-dimensional shape data is lower than a predetermined value. 前記照明サイズ範囲設定手段は、前記被写体領域の重心から前記仮想照明を見込む角度が、前記取得精度を表す角度となる場合の前記照明サイズを表す半径を下限として、前記照明サイズの前記設定可能範囲を設定することを特徴とする請求項13乃至17のいずれか1項に記載の画像処理装置。   The illumination size range setting means may set the illumination size setting range with a radius representing the illumination size as a lower limit when the angle from which the virtual illumination is viewed from the center of gravity of the subject area is an angle representing the acquisition accuracy. The image processing apparatus according to any one of claims 13 to 17, wherein 前記仮想照明の照明サイズの設定可能範囲を表示する表示手段を更に有することを特徴とする請求項13乃至18のいずれか1項に記載の画像処理装置。   The image processing apparatus according to any one of claims 13 to 18, further comprising display means for displaying the settable range of the illumination size of the virtual illumination. 前記表示手段は、前記仮想照明の照明サイズと、前記仮想照明の照明サイズの設定可能範囲とを比較し、前記仮想照明の照明サイズが前記仮想照明の照明サイズの設定可能範囲の境界近傍、または、前記設定可能範囲の外に設定された場合に、ユーザに警告を提示することを特徴とする請求項19に記載の画像処理装置。   The display means compares the illumination size of the virtual illumination with the setting range of the illumination size of the virtual illumination, and the illumination size of the virtual illumination is near the boundary of the setting range of the illumination size of the virtual illumination or 20. The image processing apparatus according to claim 19, wherein a warning is presented to the user when being set outside the settable range. 前記表示手段は、前記警告のための文字情報を表示すること、または、前記仮想照明の照明サイズを表すアイコンの色を変化させることの少なくとも一方によって、前記ユーザへの警告を提示することを特徴とする請求項20に記載の画像処理装置。   The display means presents a warning to the user by displaying text information for the warning, or changing the color of an icon representing the size of illumination of the virtual illumination. 21. The image processing apparatus according to claim 20, wherein コンピュータを、請求項13乃至21のいずれか1項に記載の画像処理装置として機能させるためのプログラム。   A program for causing a computer to function as the image processing apparatus according to any one of claims 13 to 21. 撮像画像に対応する3次元形状データに基づいて、仮想照明による陰影効果を前記撮像画像に付加する画像処理装置による画像処理方法であって、
前記3次元形状データから、被写体領域の3次元形状データを抽出するステップと、
前記被写体領域の3次元形状データの取得精度が低い場合に、前記3次元形状データの前記取得精度に基づいて、前記仮想照明の照明サイズの設定可能範囲を設定するステップと
を含むことを特徴とする画像処理方法。
An image processing method by an image processing apparatus, which adds a shadow effect by virtual illumination to a captured image based on three-dimensional shape data corresponding to the captured image,
Extracting three-dimensional shape data of a subject area from the three-dimensional shape data;
And setting the setting range of the illumination size of the virtual illumination based on the acquisition accuracy of the three-dimensional shape data when the acquisition accuracy of the three-dimensional shape data of the subject region is low. Image processing method.
JP2017235293A 2017-12-07 2017-12-07 Image processing device, image processing method, and program Pending JP2019101978A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017235293A JP2019101978A (en) 2017-12-07 2017-12-07 Image processing device, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017235293A JP2019101978A (en) 2017-12-07 2017-12-07 Image processing device, image processing method, and program

Publications (1)

Publication Number Publication Date
JP2019101978A true JP2019101978A (en) 2019-06-24

Family

ID=66973884

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017235293A Pending JP2019101978A (en) 2017-12-07 2017-12-07 Image processing device, image processing method, and program

Country Status (1)

Country Link
JP (1) JP2019101978A (en)

Similar Documents

Publication Publication Date Title
CN111164647B (en) Estimating depth using a single camera
JP6625745B2 (en) Image processing device
JP4220470B2 (en) A reality-based lighting environment for digital imaging in cinema
JP6685827B2 (en) Image processing apparatus, image processing method and program
US8941750B2 (en) Image processing device for generating reconstruction image, image generating method, and storage medium
CN114245905A (en) Depth aware photo editing
JP6045378B2 (en) Information processing apparatus, information processing method, and program
KR100834157B1 (en) Method for Light Environment Reconstruction for Image Synthesis and Storage medium storing program therefor.
JP2010109783A (en) Electronic camera
JP2008033189A (en) Image display device, image display method, and image display program
Přibyl et al. Feature point detection under extreme lighting conditions
JP2019100995A (en) Measurement image display control unit, measurement image display control method, and program for measurement image display control
CN109523622A (en) A kind of non-structured light field rendering method
TW201921318A (en) Apparatus and method for generating a tiled three-dimensional image representation of a scene
US20230062973A1 (en) Image processing apparatus, image processing method, and storage medium
JP5361758B2 (en) Image generation method, image generation apparatus, and program
JP6552266B2 (en) Image processing apparatus, image processing method, and program
US20130194254A1 (en) Image processing apparatus, image processing method and program
US11880940B1 (en) Systems and methods for the continuous presentation of point clouds
CN114945943A (en) Estimating depth based on iris size
JP2017181114A (en) Radiation intensity distribution measurement system and method
KR101817756B1 (en) PTM making system based on 3D model with interactive viewpoint control and method using the same
JP2019101978A (en) Image processing device, image processing method, and program
JP2014164497A (en) Information processor, image processing method and program
JP6181549B2 (en) Image generation method, image generation apparatus, and image generation program