Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7479840B2 - Image processing device, image processing method, and program - Google Patents
[go: Go Back, main page]

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

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

Info

Publication number
JP7479840B2
JP7479840B2 JP2019238733A JP2019238733A JP7479840B2 JP 7479840 B2 JP7479840 B2 JP 7479840B2 JP 2019238733 A JP2019238733 A JP 2019238733A JP 2019238733 A JP2019238733 A JP 2019238733A JP 7479840 B2 JP7479840 B2 JP 7479840B2
Authority
JP
Japan
Prior art keywords
point
point cloud
image
information
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2019238733A
Other languages
Japanese (ja)
Other versions
JP2021107983A (en
Inventor
拓也 石橋
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 JP2019238733A priority Critical patent/JP7479840B2/en
Publication of JP2021107983A publication Critical patent/JP2021107983A/en
Application granted granted Critical
Publication of JP7479840B2 publication Critical patent/JP7479840B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Studio Devices (AREA)
  • Image Generation (AREA)

Description

本発明は、画像処理装置、画像処理方法およびプログラムに関する。 The present invention relates to an image processing device, an image processing method, and a program.

2つの撮像部を備え、立体視用の画像を撮像できるステレオカメラが知られている。ステレオカメラは、各撮像部によって同一の被写体を同時に撮像し、視差を有する第1の画像と第2の画像との2種類の画像を取得する。ステレオカメラは、視差を有する画像から画素毎の視差量を算出することで、カメラから被写体までの距離を算出することが可能である。この距離情報は、一般的にカメラ座標系で表され、座標変換により世界座標系での被写体の位置を有する点群に変換することができる。ステレオカメラは、仮想の光源を設定し、仮想の光源の位置と点群とを用いて、仮想の光源によって作り出される影の領域を算出し、影を付与した画像を生成することが可能である。 A stereo camera is known that has two imaging units and can capture images for stereoscopic vision. The stereo camera simultaneously captures images of the same subject using each imaging unit, and obtains two types of images, a first image and a second image, which have parallax. The stereo camera can calculate the distance from the camera to the subject by calculating the amount of parallax for each pixel from the images with parallax. This distance information is generally expressed in the camera coordinate system, and can be converted into a point cloud representing the position of the subject in the world coordinate system by coordinate transformation. The stereo camera can set a virtual light source, and use the position of the virtual light source and the point cloud to calculate the area of shadow created by the virtual light source and generate an image with a shadow added.

非特許文献1には、仮想の光源位置から手前側にある点群の各点までの距離と奥側にある点群の各点までの距離との距離差を求めて、奥側の点群の各点で距離差が閾値以上ある領域を影が付く領域とすることで、影の領域を算出する方法が開示されている。閾値が小さすぎるとシャドウアクネとよばれる不要な影が発生し、閾値が大きすぎると必要な影が付かなくなるため、閾値を適切に制御する方法が必要である。 Non-Patent Document 1 discloses a method for calculating a shadow area by calculating the difference in distance between the virtual light source position and each point in a point cloud on the front side and the distance to each point in a point cloud on the back side, and determining that an area where the distance difference between each point in the back side point cloud is equal to or exceeds a threshold value is a shadowed area. If the threshold value is too small, unnecessary shadows called shadow acne will occur, and if the threshold value is too large, necessary shadows will not be cast, so a method for appropriately controlling the threshold value is required.

特許文献1には、仮想の光源の光線方向ベクトルと影を付ける点群の法線方向ベクトルを参照し、両ベクトルの相違度が大きい場合は閾値を大きくし、両ベクトルの相違度が小さい場合は閾値を小さくすることで、影の領域の誤差を低減する方法が開示されている。 Patent document 1 discloses a method for reducing errors in shadow areas by referencing the ray direction vector of a virtual light source and the normal direction vector of the point cloud to be shaded, and increasing the threshold value when the degree of difference between the two vectors is large, and decreasing the threshold value when the degree of difference between the two vectors is small.

特表2012-522283号公報JP 2012-522283 A

Hang Dou,Yajie Yan,Ethan Kerzner,Zeng Dai,Chris Wyman,Washington University in St. Louis,SCI Institute University of Iowa,NVIDIA,“Adaptive Depth Bias for Shadow Maps”,Journal of Computer Graphics Techniques,Vol.3,No.4,2014Hang Dou, Yajie Yan, Ethan Kerzner, Zeng Dai, Chris Wyman, Washington University in St. Louis, SCI Institute University of Iowa, NVIDIA, "Adaptive Depth Bias for Shadow Maps", Journal of Computer Graphics Techniques, Vol. 3, No.4, 2014

従来技術では、被写体の位置は、コンピュータグラフィックスによって設計されたものであり、正確なものが取得できていることを前提とした場合に有効な方法となる。しかし、視差量を算出する方法によって取得した被写体の位置は、視差量算出時の誤差を含む可能性が高く、被写体の位置の誤差に起因した影領域の誤差を低減することができない。 In conventional technology, the subject's position is designed using computer graphics, and this method is effective on the assumption that it can be acquired accurately. However, the subject's position acquired using a method that calculates the amount of parallax is likely to include errors when calculating the amount of parallax, and it is not possible to reduce errors in the shadow area caused by errors in the subject's position.

本発明の目的は、被写体の位置に誤差がある場合に、影が付く領域の誤差を低減することができるようにすることである。 The objective of the present invention is to reduce the error in the shadowed area when there is an error in the position of the subject.

本発明の画像処理装置は、画像を基に被写体の位置と前記被写体の位置における局所領域の面の傾きとを情報として持つ点の集合を点群として取得する点群取得手段と、前記点群のうち、光源の位置を基準位置としたときに手前側にある点群を第1の点群とし、前記光源の位置を基準位置としたときに奥側にある点群を第2の点群とし、前記第1の点群の各点の前記局所領域の面の傾きと前記第2の点群の各点の前記局所領域の面の傾きとの差が大きいほど閾値が小さくなるように、閾値を設定する閾値設定手段と、前記第2の点群のうち、前記光源から前記第1の点群の各点までの距離と前記光源から前記第2の点群の各点までの距離との距離差が前記閾値以上である点を影が付く領域として設定する領域設定手段とを有する。 The image processing device of the present invention has a point cloud acquisition means for acquiring a set of points having information on the position of a subject and the surface inclination of a local area at the position of the subject as a point cloud based on an image; a threshold setting means for setting a threshold such that a larger difference between the surface inclination of the local area of each point of the first point cloud and the surface inclination of the local area of each point of the second point cloud is larger, the threshold being smaller; and an area setting means for setting points of the second point cloud where the difference in distance between the distance from the light source to each point of the first point cloud and the distance from the light source to each point of the second point cloud is equal to or greater than the threshold as a shaded area.

本発明によれば、被写体の位置に誤差がある場合に、影が付く領域の誤差を低減することができる。 According to the present invention, when there is an error in the position of the subject, it is possible to reduce the error in the shadowed area.

撮像装置と画像処理装置の構成例を示す図である。FIG. 1 is a diagram illustrating an example of the configuration of an imaging device and an image processing device. 画像処理装置の画像処理方法を示すフローチャートである。4 is a flowchart showing an image processing method of the image processing device. 点群の取得について説明するフローチャートである。11 is a flowchart illustrating acquisition of a point cloud. 位置情報の取得について説明するフローチャートである。11 is a flowchart illustrating acquisition of location information. 撮像部の画素配列構成について説明する図である。2 is a diagram illustrating a pixel array configuration of an imaging unit. FIG. 微小ブロックの設定について説明する図である。FIG. 13 is a diagram illustrating setting of minute blocks. 像ずれ量と相関値の関係について説明する図である。11A and 11B are diagrams illustrating the relationship between an image shift amount and a correlation value. 閾値設定方法について説明する図である。FIG. 11 is a diagram illustrating a threshold setting method. 影領域を算出する被写体について説明する図である。1A and 1B are diagrams illustrating an object for which a shadow region is calculated. 影領域算出を説明する図である。FIG. 11 is a diagram illustrating calculation of a shadow region. 基準となる閾値の設定方法について説明する図である。FIG. 13 is a diagram illustrating a method for setting a reference threshold value.

図1(a)は、本実施形態による画像処理装置100と撮像装置111の構成例を示すブロック図である。画像処理装置100は、制御部101、メモリ102、画像情報入力部105、パラメータ設定部106、点群取得部107、閾値設定部108、影領域算出部109、および影付画像生成部110を有する。撮像装置111は、制御部101、撮像部103、および発光部104を有する。 Fig. 1(a) is a block diagram showing an example of the configuration of an image processing device 100 and an imaging device 111 according to this embodiment. The image processing device 100 has a control unit 101, a memory 102, an image information input unit 105, a parameter setting unit 106, a point cloud acquisition unit 107, a threshold setting unit 108, a shadow region calculation unit 109, and a shadowed image generation unit 110. The imaging device 111 has a control unit 101, an imaging unit 103, and a light emission unit 104.

制御部101は、画像処理装置100と撮像装置111の構成要素間の情報のやり取りを制御する。メモリ102は、制御部101によって制御され、各構成要素での処理に必要な情報の読み出しと、各構成要素での処理結果の保存を行う。 The control unit 101 controls the exchange of information between the components of the image processing device 100 and the imaging device 111. The memory 102 is controlled by the control unit 101, and reads out information necessary for processing in each component and stores the processing results of each component.

撮像部103は、光電変換により、被写体の画像を撮像し、画像情報を出力する。制御部101は、撮像部103により撮像された画像情報を、画像情報入力部105と点群取得部107へ供給する。発光部104は、制御部101の制御により、撮像部103の撮像時に発光する。 The imaging unit 103 captures an image of a subject by photoelectric conversion and outputs image information. The control unit 101 supplies the image information captured by the imaging unit 103 to the image information input unit 105 and the point cloud acquisition unit 107. The light emitting unit 104 emits light when the imaging unit 103 captures an image under the control of the control unit 101.

画像情報入力部105は、撮像部103により撮像された画像情報、または撮像装置111以外で撮像された画像情報を入力し、メモリ102へ供給する。パラメータ設定部106は、ユーザによって画像処理装置100へ入力された各パラメータ情報を設定する。制御部101は、パラメータ設定部106により設定されたパラメータ情報をメモリ102に保存する。 The image information input unit 105 inputs image information captured by the imaging unit 103 or image information captured by a device other than the imaging device 111, and supplies it to the memory 102. The parameter setting unit 106 sets each piece of parameter information input by the user to the image processing device 100. The control unit 101 stores the parameter information set by the parameter setting unit 106 in the memory 102.

点群取得部107は、撮像部103により撮像された画像情報から点群を算出し、算出した点群の情報をメモリ102へ供給する。閾値設定部108は、点群取得部107により算出された点群から閾値を算出する。制御部101は、閾値設定部108により算出された閾値をメモリ102に保存する。 The point cloud acquisition unit 107 calculates a point cloud from image information captured by the imaging unit 103, and supplies the calculated point cloud information to the memory 102. The threshold setting unit 108 calculates a threshold from the point cloud calculated by the point cloud acquisition unit 107. The control unit 101 stores the threshold calculated by the threshold setting unit 108 in the memory 102.

影領域算出部109は、点群取得部107により算出された点群と閾値設定部108により算出された閾値から影領域を算出し、算出した影領域の情報をメモリ102へ供給する。影付画像生成部110は、影領域算出部109により算出された影領域に基づいて影を付加した画像を生成し、生成した画像をメモリ102へ供給する。 The shadow region calculation unit 109 calculates a shadow region from the point cloud calculated by the point cloud acquisition unit 107 and the threshold value calculated by the threshold setting unit 108, and supplies information on the calculated shadow region to the memory 102. The shadow-added image generation unit 110 generates an image to which a shadow has been added based on the shadow region calculated by the shadow region calculation unit 109, and supplies the generated image to the memory 102.

図1(b)は、撮像装置111の撮像部103が有する光学系を示す図である。撮像部103は、物体112から発せられた光をレンズ113により予定結像面114で結像し、センサ面115で受光する。撮像部103は、受光した情報を画像情報に変換する。 Figure 1 (b) is a diagram showing an optical system of the imaging unit 103 of the imaging device 111. The imaging unit 103 forms an image of light emitted from an object 112 on a planned imaging plane 114 using a lens 113, and receives the light on a sensor plane 115. The imaging unit 103 converts the received light information into image information.

図2は、画像処理装置100の画像処理方法を示すフローチャートである。ステップS201において、パラメータ設定部106は、パラメータを取得し、そのパラメータを設定する。パラメータは、少なくとも下記のパラメータを含む。 Figure 2 is a flowchart showing the image processing method of the image processing device 100. In step S201, the parameter setting unit 106 acquires parameters and sets the parameters. The parameters include at least the following parameters:

撮像装置111から被写体のピント位置までの距離・・・(a)
撮像部103の画素ピッチ・・・(b)
一対の測距瞳を通過する光束の重心の開き角の大きさによって決まる変換係数・・・(c)
F値・・・(d)
瞳距離・・・(e)
撮像装置111のレンズ113における像側主点からセンサ面115までの距離・・・(f)
撮像装置111のレンズ113における物側主点から被写体までの距離・・・(g)
撮像装置111の焦点位置・・・(h)
仮想光源位置・・・(i)
基準となる閾値・・・(j)
傾きの差に対して乗ずる任意の係数・・・(k)
Distance from the imaging device 111 to the focal position of the subject...(a)
Pixel pitch of the imaging unit 103...(b)
A conversion coefficient determined by the magnitude of the opening angle of the center of gravity of the light beam passing through a pair of distance measuring pupils...(c)
F value...(d)
Pupil distance...(e)
Distance from the image-side principal point of the lens 113 of the image pickup device 111 to the sensor surface 115 (f)
Distance from the object side principal point of the lens 113 of the imaging device 111 to the subject... (g)
Focus position of the imaging device 111...(h)
Virtual light source position...(i)
Reference threshold value...(j)
An arbitrary coefficient to multiply the difference in slope...(k)

パラメータは、デフォーカス量の算出や、三次元空間上での点群座標算出、影領域の算出に必要となる。 The parameters are required to calculate the defocus amount, calculate point cloud coordinates in three-dimensional space, and calculate shadow areas.

ステップS202において、画像情報入力部105は、画像情報を取得する。例えば、画像情報入力部105は、撮像装置111の撮像部103により撮像された画像情報、または撮像装置111以外で撮像された画像情報を取得する。 In step S202, the image information input unit 105 acquires image information. For example, the image information input unit 105 acquires image information captured by the imaging unit 103 of the imaging device 111, or image information captured by a device other than the imaging device 111.

ステップS203において、点群取得部107は、ステップS202で取得された画像情報を基に点群を取得する。「点群」とは、被写体の位置と被写体の位置における局所領域の面の傾きとを情報として持つ点の集合である。「被写体の位置」とは、被写体の空間内の位置であり、所定の位置から被写体までの距離を計測して求めることができる。「局所領域の面の傾き」とは、被写体形状の局所領域の面の傾きであり、局所領域の形状の変位量や面法線等の情報である。 In step S203, the point cloud acquisition unit 107 acquires a point cloud based on the image information acquired in step S202. A "point cloud" is a collection of points having information on the position of the subject and the surface inclination of the local area at the subject's position. The "position of the subject" is the position of the subject in space, and can be determined by measuring the distance from a specified position to the subject. The "surface inclination of the local area" is the surface inclination of the local area of the subject shape, and is information such as the amount of displacement of the shape of the local area and the surface normal.

図3は、図2のステップS203の詳細を示すフローチャートである。ステップS301において、点群取得部107は、ステップS202で取得された画像情報から被写体の位置の取得を行う。ステップS301については、図4を用いて説明する。 Figure 3 is a flowchart showing the details of step S203 in Figure 2. In step S301, the point cloud acquisition unit 107 acquires the position of the subject from the image information acquired in step S202. Step S301 will be described with reference to Figure 4.

図4は、図3のステップS301の詳細を示すフローチャートである。ステップS401において、点群取得部107は、ステップS202で取得された画像情報から一対の画像データを生成する。画像情報から一対の画像データを生成する方法について、図5(a)と図5(b)を用いて説明する。 Figure 4 is a flowchart showing the details of step S301 in Figure 3. In step S401, the point cloud acquisition unit 107 generates a pair of image data from the image information acquired in step S202. A method for generating a pair of image data from image information will be described with reference to Figures 5(a) and 5(b).

図5(a)は、画像を撮像する際に使用する撮像部103の画素512の配列の構成例を示す図である。図5(b)は、画素512を拡大した図である。撮像部103は、2次元行列状に配列された複数の画素512を有する。画素512は、マイクロレンズ511と、一対の瞳分割画素513A、514Bを有する。瞳分割画素513Aおよび514Bは、それぞれ、光電変換部であり、光電変換により画素信号を生成する。瞳分割画素513Aで撮像される画像がA像であり、瞳分割画素514Bで撮像される画像がB像である。また、A像とB像を合成した画像がAB像である。AB像は、撮像時にユーザが取得する画像である。点群取得部107は、画像処理を行うために必要な情報として複数枚の画像情報から、A像とB像を一対の画像データとして取得する。A像とB像は、光学系の異なる瞳領域を通過する被写体の光束に基づく一対の画像である。 Figure 5(a) is a diagram showing an example of the arrangement of pixels 512 of the imaging unit 103 used when capturing an image. Figure 5(b) is an enlarged view of the pixel 512. The imaging unit 103 has a plurality of pixels 512 arranged in a two-dimensional matrix. The pixel 512 has a microlens 511 and a pair of pupil division pixels 513A and 514B. The pupil division pixels 513A and 514B are each a photoelectric conversion unit, and generate a pixel signal by photoelectric conversion. The image captured by the pupil division pixel 513A is image A, and the image captured by the pupil division pixel 514B is image B. The image obtained by combining the images A and B is image AB. The image AB is an image acquired by the user at the time of capturing. The point cloud acquisition unit 107 acquires the image A and the image B as a pair of image data from the image information of a plurality of images as information necessary for image processing. The images A and B are a pair of images based on the light beams of the subject passing through different pupil regions of the optical system.

ステップS402において、点群取得部107は、ステップS401で生成されたA像とB像に対して微小ブロックを設定する。図6(a)は、ステップS402を説明する図である。点群取得部107は、A像601とB像602に対して、微小ブロック603を設定する。なお、点群取得部107は、入力画像が有する画素ごとに、微小ブロックの中心の着目画素を設定する。例えば、点群取得部107は、着目画素604に対して微小ブロック603を設定する。また、図6(b)は、微小ブロックの形状について説明する図である。点群取得部107は、A像601に対して、種々の形状またはサイズの微小ブロック605または微小ブロック606を設定することができる。微小ブロックのサイズまたは形状は、限定されない。 In step S402, the point cloud acquisition unit 107 sets minute blocks for the A and B images generated in step S401. FIG. 6A is a diagram for explaining step S402. The point cloud acquisition unit 107 sets minute blocks 603 for the A and B images 601 and 602. The point cloud acquisition unit 107 sets a pixel of interest at the center of the minute block for each pixel in the input image. For example, the point cloud acquisition unit 107 sets a minute block 603 for a pixel of interest 604. FIG. 6B is a diagram for explaining the shape of the minute block. The point cloud acquisition unit 107 can set minute blocks 605 or 606 of various shapes or sizes for the A image 601. The size or shape of the minute block is not limited.

ステップS403において、点群取得部107は、ステップS402で設定された微小ブロックに対して、相関演算処理を行い、A像とB像の各点の像ずれ量を算出する。相関演算は、微小ブロックにおける一対の画素データを、mをデータ数として、E(1)~E(m)とF(1)~F(m)として一般化して表現する。この場合、点群取得部107は、データ系列E(1)~E(m)に対してデータ系列F(1)~F(m)を相対的にずらしながら、式(1)により、2つのデータ列間のずらし量kにおける相関量C(k)を演算する。
C(k)=Σ|E(n)―F(n+k)| ・・・(1)
In step S403, the point cloud acquisition unit 107 performs correlation calculation processing on the minute block set in step S402 to calculate the image shift amount for each point in the images A and B. In the correlation calculation, a pair of pixel data in the minute block is generalized and expressed as E(1) to E(m) and F(1) to F(m), where m is the number of data. In this case, the point cloud acquisition unit 107 shifts the data series F(1) to F(m) relatively to the data series E(1) to E(m), and calculates the correlation amount C(k) at the shift amount k between the two data strings using formula (1).
C(k)=Σ|E(n)−F(n+k)| (1)

式(1)において、Σ演算は、nについて計算される。このΣ演算において、nとn+kの取る範囲は、1~mの範囲に限定される。また、ずらし量kは整数であり、一対の画像データの検出ピッチを単位とした相対的シフト量である。 In formula (1), the Σ operation is performed for n. In this Σ operation, the range of n and n+k is limited to the range of 1 to m. The shift amount k is an integer, and is the relative shift amount in units of the detection pitch of a pair of image data.

図7は、式(1)の演算結果の例として、横軸がすらし量k、縦軸が相関量C(k)を示すグラフである。図7より、一対のデータ系列の相関が高いずらし量kにおいて相関量C(k)が最小になる。そして、点群取得部107は、下記の式(2)~(5)による3点内挿の手法を用い、連続的な相関量に対する最小の相関量C(x)を与える像ずれ量xを求める。 Figure 7 is a graph showing an example of the calculation result of formula (1), with the horizontal axis representing the shift amount k and the vertical axis representing the correlation amount C(k). As can be seen from Figure 7, the correlation amount C(k) is minimum at a shift amount k where the correlation between a pair of data series is high. Then, the point cloud acquisition unit 107 uses a three-point interpolation method according to the following formulas (2) to (5) to find the image shift amount x that gives the minimum correlation amount C(x) for continuous correlation amounts.

x=kj+D/SLOP ・・・(2)
C(x)= C(kj)-|D| ・・・(3)
D=[C(kj-1)-C(kj+1)]/2 ・・・(4)
SLOP=MAX[C(kj+1)-C(kj),C(kj-1)-C(kj)]・・・(5)
x = kj + D / SLOP (2)
C(x)=C(kj)−|D| (3)
D = [C(kj-1) - C(kj+1)] / 2 ... (4)
SLOP=MAX[C(kj+1)-C(kj), C(kj-1)-C(kj)]... (5)

ここで、kjは、離散的な相関量C(k)が最小となるkである。点群取得部107は、式(2)により、一対の瞳分割画像における像ずれ量xを求める。なお、像ずれ量xの単位は、画素(pixel)とする。 Here, kj is k at which the discrete correlation amount C(k) is minimized. The point cloud acquisition unit 107 obtains the image shift amount x in a pair of pupil division images using equation (2). Note that the unit of the image shift amount x is pixels.

ステップS404において、点群取得部107は、式(2) により求めた像ずれ量x より、被写体像面の予定結像面114に対するデフォーカス量DEFを下記の式(6) により求める。
DEF= KX ・PY ・x ・・・(6)
In step S404, the point cloud acquisition unit 107 calculates a defocus amount DEF of the subject image plane with respect to the intended imaging plane 114 from the image shift amount x calculated by equation (2) using the following equation (6):
DEF = KX PY x ... (6)

式(6)において、PY は、撮像部103の画素ピッチ(撮像部103を構成する画素間距離) である。KX は、一対の測距瞳を通過する光束の重心の開き角の大きさによって決まる変換係数であり、単位が無次元である。点群取得部107は、このように着目画素位置を1画素ずつずらしながら繰り返し計算することで、各画素位置のデフォーカス量DEFを算出する。 In equation (6), PY is the pixel pitch of the image capture unit 103 (the distance between the pixels that make up the image capture unit 103). KX is a conversion coefficient determined by the magnitude of the opening angle of the center of gravity of the light beams passing through a pair of ranging pupils, and its unit is dimensionless. The point cloud acquisition unit 107 calculates the defocus amount DEF for each pixel position by repeatedly shifting the pixel position of interest by one pixel at a time in this manner.

ステップS405において、点群取得部107は、ステップS404で算出されたデフォーカス量DEFを用いて、撮像装置111の撮像部103のセンサ面115から被写体までの距離zを算出する。点群取得部107は、各点における距離zを、式(7)~(8)から算出する。 In step S405, the point cloud acquisition unit 107 calculates the distance z from the sensor surface 115 of the imaging unit 103 of the imaging device 111 to the subject using the defocus amount DEF calculated in step S404. The point cloud acquisition unit 107 calculates the distance z at each point using equations (7) to (8).

dist= 1/(1/(dist_d+DEF)-1/f) ・・・(7)
z=length-dist ・・・(8)
dist = 1 / (1 / (dist_d + DEF) - 1 / f) ... (7)
z = length - dist ... (8)

ここで、distは、撮像部103のレンズ113における物側主点から被写体までの距離である。dist_dは、撮像装置111の撮像部103のレンズ113における像側主点からセンサ面115までの距離である。fは焦点距離である。lengthは、撮像装置111のセンサ面115からピント位置までの距離である。 Here, dist is the distance from the object side principal point of the lens 113 of the imaging unit 103 to the subject. dist_d is the distance from the image side principal point of the lens 113 of the imaging unit 103 of the imaging device 111 to the sensor surface 115. f is the focal length. length is the distance from the sensor surface 115 of the imaging device 111 to the focus position.

撮像装置111のセンサ面115からピント位置までの距離lengthは、例えば、レーザ測距手段により、測定することが可能である。また、点群取得部107は、撮像時のレンズ位置とピント位置の関係をデータテーブルに持つことで、撮像時のレンズ位置に対応したピント位置までの距離を推定することが可能である。これにより、点群取得部107は、撮像装置111のセンサ面115からピント位置までの距離を測距する手間を低減できる。 The distance (length) from the sensor surface 115 of the imaging device 111 to the focal position can be measured, for example, by a laser distance measuring means. In addition, the point cloud acquisition unit 107 has a data table that stores the relationship between the lens position at the time of imaging and the focal position, and can estimate the distance to the focal position corresponding to the lens position at the time of imaging. This allows the point cloud acquisition unit 107 to reduce the effort required to measure the distance from the sensor surface 115 of the imaging device 111 to the focal position.

以上により、点群取得部107は、撮像装置111の撮像部103のセンサ面115から被写体までの距離zの算出を行うことができる。このように、点群取得部107は、1枚の画像から一対の画像データを生成することにより、距離zを算出できることから、撮像装置111は、複眼である必要はなく、単眼のカメラでよいため、撮像装置111の構成を簡易にすることができる。さらに、複数のカメラを設置する際のキャリブレーション処理も簡易、または不要とすることができる。これにより、点群取得部107は、距離zの算出精度を高くすることができる。 In this way, the point cloud acquisition unit 107 can calculate the distance z from the sensor surface 115 of the imaging unit 103 of the imaging device 111 to the subject. In this way, the point cloud acquisition unit 107 can calculate the distance z by generating a pair of image data from a single image, so the imaging device 111 does not need to be a compound eye, and a monocular camera will suffice, simplifying the configuration of the imaging device 111. Furthermore, calibration processing when installing multiple cameras can be simplified or eliminated. This allows the point cloud acquisition unit 107 to improve the accuracy of calculating the distance z.

撮像装置111の撮像部103のセンサ面115から被写体までの距離zは、ステップS301において撮像装置111で撮像した画像情報から画像処理装置100で算出することが可能である。このような方法以外にも、ステレオカメラによって距離zを算出する方法やLiDARのようなレーザの反射情報を取得し、距離zを算出することも可能である。また、これらの距離zの算出は、撮像装置111の外部装置で行い、画像処理装置100は、外部装置で算出された距離zを取得することも可能である。なお、距離zは、センサ面115からの距離に限定されるものではなく、レンズ先端から等の任意の位置からの距離でもよい。 The distance z from the sensor surface 115 of the imaging unit 103 of the imaging device 111 to the subject can be calculated by the image processing device 100 from the image information captured by the imaging device 111 in step S301. In addition to this method, it is also possible to calculate the distance z using a stereo camera or to obtain laser reflection information such as LiDAR and calculate the distance z. Furthermore, it is also possible to calculate these distances z by an external device of the imaging device 111, and for the image processing device 100 to obtain the distance z calculated by the external device. Note that the distance z is not limited to the distance from the sensor surface 115, and may be the distance from any position, such as the tip of the lens.

ステップS406において、点群取得部107は、ステップS405で算出された距離zに対して、カメラ座標系から世界座標系の点群に変換し、被写体の位置を取得する。なお、点群取得部107は、カメラ座標系から世界座標系に変換することで、被写体の位置を取得しているが、被写体の位置をカメラ座標系のままにして、カメラ座標系での距離情報を被写体の位置として使用してもよい。 In step S406, the point cloud acquisition unit 107 converts the distance z calculated in step S405 from the camera coordinate system to a point cloud in the world coordinate system, and acquires the position of the subject. Note that the point cloud acquisition unit 107 acquires the position of the subject by converting from the camera coordinate system to the world coordinate system, but the position of the subject may remain in the camera coordinate system, and distance information in the camera coordinate system may be used as the position of the subject.

ステップS302において、点群取得部107は、局所領域の面の傾きの取得を行う。局所領域の面の傾きは、照度差ステレオ法で取得することができる。点群取得部107は、照度差ステレオ法により高精度な法線情報を画素単位で取得し、その法線情報を局所領域の面の傾きとして使用する。また、点群取得部107は、ステップS301で算出された被写体の位置の隣接する各点の位置の変位量に基づいて、局所領域の面の傾きを算出することも可能である。例えば、各点がX、Y、Zの三次元空間座標で定義される場合に、X方向の位置の変位量、またはY方向の位置の変位量、またはX方向の位置の変位量とY方向の変位量の二乗和の平方根等を各点の局所領域の面の傾きとすることができる。この時、画像処理装置100やLiDAR等のセンサによって取得された位置は誤差を含むため、各点の変位量を求めると、変位量に誤差が発生する可能性が高くなる。このような場合は、点群取得部107は、局所領域に含まれる点群の位置を平均すること補正した位置を算出し、その補正した位置を用いて上記の変位量を算出することで、変位量の誤差を低減することが可能である。このようにすることで、法線を取得する装置がない場合でも、局所領域の面の傾きを取得することができる。以上により、点群取得部107は、局所領域の面の傾きを取得することができる。点群取得部107は、被写体の位置と局所領域の面の傾きを取得することにより、点群の取得が可能である。 In step S302, the point cloud acquisition unit 107 acquires the inclination of the surface of the local region. The inclination of the surface of the local region can be acquired by photometric stereo. The point cloud acquisition unit 107 acquires highly accurate normal information in pixel units by photometric stereo, and uses the normal information as the inclination of the surface of the local region. The point cloud acquisition unit 107 can also calculate the inclination of the surface of the local region based on the displacement amount of each point adjacent to the position of the subject calculated in step S301. For example, when each point is defined by three-dimensional spatial coordinates of X, Y, and Z, the displacement amount of the position in the X direction, or the displacement amount of the position in the Y direction, or the square root of the square sum of the displacement amount of the position in the X direction and the displacement amount in the Y direction, etc. can be used as the inclination of the surface of the local region of each point. At this time, since the position acquired by a sensor such as the image processing device 100 or LiDAR contains an error, when the displacement amount of each point is calculated, there is a high possibility that an error will occur in the displacement amount. In such a case, the point cloud acquisition unit 107 can reduce the error in the amount of displacement by calculating a corrected position by averaging the positions of the point clouds included in the local region, and then using the corrected position to calculate the above-mentioned amount of displacement. In this way, the inclination of the surface of the local region can be acquired even if there is no device for acquiring normal lines. In this way, the point cloud acquisition unit 107 can acquire the inclination of the surface of the local region. The point cloud acquisition unit 107 can acquire a point cloud by acquiring the position of the subject and the inclination of the surface of the local region.

ステップS204において、閾値設定部108は、閾値を設定する。閾値の設定方法については、図8を用いて説明する。図8は、図2のステップS204の詳細を示すフローチャートである。図8のフローチャートについて、図9を用いて説明する。 In step S204, the threshold setting unit 108 sets a threshold. The method for setting the threshold will be described with reference to FIG. 8. FIG. 8 is a flowchart showing the details of step S204 in FIG. 2. The flowchart in FIG. 8 will be described with reference to FIG. 9.

図9は、影領域を算出する被写体について説明する図である。点群取得部107は、撮像装置(カメラ)901で撮像した物体902の形状を画像処理によって、被写体の位置から点群903を求める。点群903に対して、仮想光源904を設定する。点群903のうち、仮想光源904の位置を基準位置としたときに手前側にある点群を第1の点群(点905と点906)とし、仮想光源904の位置を基準位置としたときに奥側にある点群を第2の点群(点907と点908)とする。仮想光源904の位置を基準位置としたときに手前側にある点は、仮想光源904から点群に向けて直線の光線を引いたときに光線上の一番手前にある点となり、奥側にある点は、光線上にある手前側にある点以外の点となる。このような仮想光源904の位置と点群の位置との関係から、第2の点群の各点が第1の点群の各点と仮想光源904の位置との関係により発生する影を付けられる領域であることを示す。これらの点905~点908は、それぞれ局所領域の面の傾き909~局所領域の面の傾き912を点群として持っている。また、点905と点907、点906と点908の距離差は、それぞれ距離差913、距離差914と定義できる。 FIG. 9 is a diagram illustrating a subject for which a shadow region is calculated. The point cloud acquisition unit 107 obtains a point cloud 903 from the position of the subject by image processing of the shape of an object 902 captured by an image capture device (camera) 901. A virtual light source 904 is set for the point cloud 903. Among the point cloud 903, the point cloud on the near side when the position of the virtual light source 904 is set as a reference position is set as a first point cloud (points 905 and 906), and the point cloud on the far side when the position of the virtual light source 904 is set as a reference position is set as a second point cloud (points 907 and 908). When the position of the virtual light source 904 is set as a reference position, the point on the near side is the point on the light ray that is drawn from the virtual light source 904 to the point cloud, and the point on the far side is a point other than the point on the light ray that is on the near side. Based on this relationship between the position of virtual light source 904 and the position of the point cloud, each point of the second point cloud is shown to be a region where a shadow is cast due to the relationship between each point of the first point cloud and the position of virtual light source 904. These points 905 to 908 each have local area surface slope 909 to local area surface slope 912 as a point cloud. In addition, the distance difference between points 905 and 907, and between points 906 and 908 can be defined as distance difference 913 and distance difference 914, respectively.

点905~点908は、正しい物体902の形状に対して誤差を含む。このような物体902の位置の誤差により距離差があると、本来、点906における物体902の形状は、点908における物体902の形状へ影を付ける形状ではないにも関わらず影を付ける領域と誤判定されてしまう。これに対して、点906と点908の距離差914を求め、距離差が閾値以上であれば、影を付ける領域とすることで、点908が影領域と判定されることを防ぐことができる。しかしながら、閾値を一律に決定してしまうと、点905と点907の関係のように、距離差が閾値以下であるが、影を付けるのが正しい場合でも影が付かない領域と誤判定されてしまう課題がある。この課題に対して、ステップS204とステップS205の処理を行うことにより、点908を影領域と判定しないようにしつつ、点907を影領域と判定することが可能である。 Points 905 to 908 include an error with respect to the correct shape of object 902. If there is a distance difference due to such an error in the position of object 902, the shape of object 902 at point 906 is erroneously determined to be a shadowed area even though it is not a shape that would cast a shadow on the shape of object 902 at point 908. In response to this, the distance difference 914 between points 906 and 908 is calculated, and if the distance difference is equal to or greater than a threshold, it is determined to be a shadowed area, thereby preventing point 908 from being determined to be a shadowed area. However, if the threshold is determined uniformly, there is a problem that, as in the relationship between points 905 and 907, even if the distance difference is equal to or less than the threshold but it is correct to cast a shadow, it is erroneously determined to be a non-shadowed area. In response to this problem, by performing the processing of steps S204 and S205, it is possible to determine point 907 as a shadowed area while preventing point 908 from being determined to be a shadowed area.

ステップS801において、閾値設定部108は、基準となる閾値を設定する。基準となる閾値は、ステップS201において、パラメータとして設定することが可能である。基準となる閾値は、後述する測定情報、撮像情報、画像情報から求める方法によって、算出することも可能である。 In step S801, the threshold setting unit 108 sets a reference threshold. The reference threshold can be set as a parameter in step S201. The reference threshold can also be calculated by a method of obtaining it from measurement information, imaging information, and image information, which will be described later.

ステップS802において、閾値設定部108は、仮想光源から第1の点群の各点までの距離と第1の点群の各点の局所領域の面の傾きを取得する。第1の点群の各点までの距離と第1の点群の各点の局所領域の面の傾きは、図9において、仮想光源904から点905と点906までのそれぞれの距離と対応する局所領域の面の傾き909、局所領域の面の傾き910を意味する。 In step S802, the threshold setting unit 108 acquires the distance from the virtual light source to each point of the first point group and the surface slope of the local area of each point of the first point group. The distance to each point of the first point group and the surface slope of the local area of each point of the first point group refer to the distance from the virtual light source 904 to point 905 and point 906, respectively, and the corresponding local area surface slope 909 and local area surface slope 910 in FIG. 9.

ステップS803において、閾値設定部108は、仮想光源から第2の点群の各点までの距離と第2の点群の各点の局所領域の面の傾きを取得する。第2の点群の各点までの距離と第2の点群の各点の局所領域の面の傾きは、図9において、仮想光源904から点907と点908までのそれぞれの距離と対応する局所領域の面の傾き911、局所領域の面の傾き912を意味する。 In step S803, the threshold setting unit 108 acquires the distance from the virtual light source to each point of the second point group and the surface slope of the local area of each point of the second point group. The distance to each point of the second point group and the surface slope of the local area of each point of the second point group refer to the distance from the virtual light source 904 to point 907 and point 908, respectively, and the corresponding local area surface slope 911 and local area surface slope 912 in FIG. 9.

ステップS804において、閾値設定部108は、第1の点群の各点の局所領域の面の傾きと第2の点群の各点の局所領域の面の傾きの差を算出する。局所領域の面の傾きの差は、2つの局所領域の面の傾きの相違度と考えてよい。相違度が大きい場合は、すなわち、局所的な形状の変位量が大きいか、もしくは形状の面の向いている方向が大きく異なることを示す。図9において、局所領域の面の傾き909と局所領域の面の傾き911は、差が大きいことを表している。これに対して、局所領域の面の傾き910と局所領域の面の傾き912は、差が小さいことを表している。 In step S804, the threshold setting unit 108 calculates the difference between the surface inclination of the local region for each point in the first point group and the surface inclination of the local region for each point in the second point group. The difference in the surface inclination of the local regions may be considered as the degree of dissimilarity between the surface inclinations of the two local regions. A large degree of dissimilarity indicates that the amount of local shape displacement is large or that the directions in which the shape surfaces are facing are significantly different. In FIG. 9, the surface inclination 909 of the local region and the surface inclination 911 of the local region indicate a large difference. In contrast, the surface inclination 910 of the local region and the surface inclination 912 of the local region indicate a small difference.

ステップS805において、閾値設定部108は、ステップS804で算出された第1の点群の各点の局所領域の面の傾きと第2の点群の各点の局所領域の面の傾きの差を基に、閾値を設定する。第1の点群の各点の局所領域の面の傾きと第2の点群の各点の局所領域の面の傾きの差を傾きの差N_diffと定義する。設定する閾値を閾値Th、基準となる閾値を基準閾値Th_be、傾きの差N_diffに対して乗ずる係数を係数qとして設定し、閾値設定部108は、式(9)により、閾値Thを算出できる。
Th=Th_be-q×N_diff ・・・(9)
In step S805, the threshold setting unit 108 sets a threshold based on the difference between the surface inclination of the local region of each point of the first point group calculated in step S804 and the surface inclination of the local region of each point of the second point group. The difference between the surface inclination of the local region of each point of the first point group and the surface inclination of the local region of each point of the second point group is defined as the inclination difference N_diff. The threshold to be set is set as the threshold Th, the reference threshold is set as the reference threshold Th_be, and the coefficient by which the inclination difference N_diff is multiplied is set as the coefficient q, and the threshold setting unit 108 can calculate the threshold Th by equation (9).
Th = Th_be-q × N_diff (9)

このとき、閾値ThがTh≧0となるように、係数qを決定する。ただし、q≧0とする。このように、閾値Thを定義することで、閾値Thは、0からTh_beまでの範囲で値を変更することが可能である。式(9)について、係数qをある定数とすると、差N_diffが大きくなるにつれて、閾値Thは小さくなる。これは、第1の点群の局所領域の面の傾きと第2の点群の局所領域の面の傾きの差が大きくなるにつれて、閾値Thが小さくなることを表している。 At this time, the coefficient q is determined so that the threshold Th satisfies Th≧0, where q≧0. By defining the threshold Th in this way, it is possible to change the value of the threshold Th within the range from 0 to Th_be. In equation (9), if the coefficient q is a certain constant, the threshold Th becomes smaller as the difference N_diff increases. This indicates that the threshold Th becomes smaller as the difference between the surface slope of the local region of the first point cloud and the surface slope of the local region of the second point cloud increases.

ステップS205において、影領域算出部109は、影領域を算出する。ステップS205の詳細は、図9と図10を用いて説明する。 In step S205, the shadow region calculation unit 109 calculates the shadow region. Details of step S205 will be described with reference to Figures 9 and 10.

図10は、図2のステップS205の詳細を示すフローチャートである。ステップS1001において、影領域算出部109は、仮想光源から第1の点群の各点までの距離と仮想光源から第2の点群の各点までの距離との距離差を算出する。図9において、距離差は、距離差913、距離差914に対応する。 Figure 10 is a flowchart showing the details of step S205 in Figure 2. In step S1001, the shadow region calculation unit 109 calculates the distance difference between the distance from the virtual light source to each point in the first point group and the distance from the virtual light source to each point in the second point group. In Figure 9, the distance difference corresponds to distance difference 913 and distance difference 914.

ステップS1002において、影領域算出部109は、式(10)のように、距離差DDが閾値Th以上であるか否かを判定する。
Th≦DD ・・・(10)
In step S1002, the shadow region calculation unit 109 determines whether the distance difference DD is equal to or greater than a threshold value Th, as in equation (10).
Th≦DD (10)

影領域算出部109は、距離差DDが閾値Th以上である場合、ステップS1003に進み、距離差DDが閾値Th未満である場合、ステップS1004に進む。点905と点907の局所領域の面の傾きの差は大きいため、閾値Thは基準となる閾値Th_beに対して小さい値とする。これにより、点905と点907については、式(10)を満たすため、影領域算出部109は、ステップS1003に進む。 If the distance difference DD is equal to or greater than the threshold value Th, the shadow region calculation unit 109 proceeds to step S1003, and if the distance difference DD is less than the threshold value Th, the shadow region calculation unit 109 proceeds to step S1004. Because the difference in the slope of the surfaces of the local regions of points 905 and 907 is large, the threshold value Th is set to a smaller value than the reference threshold value Th_be. As a result, equation (10) is satisfied for points 905 and 907, and the shadow region calculation unit 109 proceeds to step S1003.

これに対し、点906と点908の局所領域の面の傾きの差は小さいため、閾値Thは基準となる閾値Th_beに対して同じか近い値とする。これにより、点906と点908については、式(10)を満たさないため、影領域算出部109は、ステップS1004に進む。 In contrast, the difference in the surface inclination of the local regions of points 906 and 908 is small, so the threshold value Th is set to a value that is the same as or close to the reference threshold value Th_be. As a result, points 906 and 908 do not satisfy equation (10), so the shadow region calculation unit 109 proceeds to step S1004.

ステップS1003において、影領域算出部109は、領域設定部として機能し、第2の点群のうち、距離差DDが閾値Th以上となる点を影が付く領域として設定する。図9において、点907は、点905によって影が付く領域として設定される。 In step S1003, the shadow region calculation unit 109 functions as a region setting unit, and sets, among the second point group, points whose distance difference DD is equal to or greater than a threshold value Th as a shadowed region. In FIG. 9, point 907 is set as a region shaded by point 905.

ステップS1004において、影領域算出部109は、領域設定部として機能し、第2の点群のうち、距離差DDが閾値Th未満となる点を影が付かない領域として設定する。図9において、点908は、点906によって影が付かない領域として設定される。 In step S1004, the shadow region calculation unit 109 functions as a region setting unit, and sets points in the second point group whose distance difference DD is less than the threshold value Th as a region that is not shaded. In FIG. 9, point 908 is set as a region that is not shaded by point 906.

以上により、影領域算出部109は、影領域の設定を終了する。画像処理装置100は、局所領域の面の傾きを利用して閾値を設定する。これにより、画像処理装置100は、被写体の位置の誤差によって発生していた影が付く領域の誤判定を低減しつつ、一律の閾値を設けることによって本来は影が付く領域を影が付かない領域としていた誤判定を低減できる。 With the above, the shadow region calculation unit 109 finishes setting the shadow region. The image processing device 100 sets the threshold value using the inclination of the surface of the local region. This allows the image processing device 100 to reduce erroneous determinations of shadowed regions that occur due to errors in the position of the subject, while also reducing erroneous determinations of regions that should be shadowed as not being shadowed by setting a uniform threshold value.

次に、影が付く領域に基づいた影付処理を説明する。影付画像生成部110は、ステップS205において、設定された影が付く領域に基づいて、画像に影を付加する画像処理を行い、影を付けた画像を生成する。影付画像生成部110は、影が付く領域として設定された点群に対応した画像のRGB値を小さくすることで、仮想光源によって影が付加された画像を生成する。 Next, the shadowing process based on the shadowed area will be described. In step S205, the shadowed image generating unit 110 performs image processing to add a shadow to the image based on the set shadowed area, and generates a shadowed image. The shadowed image generating unit 110 generates an image to which a shadow has been added by a virtual light source by reducing the RGB values of the image corresponding to the point cloud set as the shadowed area.

次に、測定情報、撮像情報、画像情報から基準となる閾値を算出する方法を説明する。閾値設定部108は、ステップS801において、基準となる閾値を任意に設定したが、被写体の位置を測定した際の測定情報や、撮像時の撮像情報、撮像した画像の画像情報に基づいて、基準となる閾値を算出することが可能である。位置の誤差が大きいほど、影が付く領域の判定誤差も大きくなるため、基準となる閾値は高く設定することが好ましい。 Next, a method for calculating the reference threshold from the measurement information, imaging information, and image information will be described. In step S801, the threshold setting unit 108 arbitrarily set the reference threshold, but it is possible to calculate the reference threshold based on the measurement information obtained when the position of the subject was measured, the imaging information obtained at the time of imaging, and the image information of the captured image. The greater the position error, the greater the determination error in the shaded area, so it is preferable to set the reference threshold high.

閾値設定部108は、基準となる閾値Th_beを、測定情報から求めた基準閾値Th_aと撮像情報から求めた基準閾値Th_bと画像情報から求めた基準閾値Th_cから下記の式(11)または式(12)より求めることができる。 The threshold setting unit 108 can determine the reference threshold Th_be from the reference threshold Th_a determined from the measurement information, the reference threshold Th_b determined from the imaging information, and the reference threshold Th_c determined from the image information, using the following formula (11) or formula (12).

Th_be=Th_a+Th_b+Th_c ・・・(11)
Th_be=Th_a×Th_b×Th_c ・・・(12)
Th_be=Th_a+Th_b+Th_c (11)
Th_be=Th_a×Th_b×Th_c (12)

閾値設定部108は、基準となる閾値Th_beを、一例として各情報から算出した基準閾値の総和や積から求めているが、積と和の関係を変えてもよいし、各情報から算出した基準閾値に重みづけを行ってもよい。基準閾値Th_a、基準閾値Th_b、基準閾値Th_cについて、図11を用いて説明する。 The threshold setting unit 108 determines the reference threshold Th_be from, for example, the sum or product of the reference thresholds calculated from each piece of information, but the relationship between the product and the sum may be changed, or the reference thresholds calculated from each piece of information may be weighted. The reference thresholds Th_a, Th_b, and Th_c are described with reference to FIG. 11.

図11(a)~(b)は、測定情報から求めた基準閾値Th_aを算出する際に評価した各パラメータとその時の各パラメータの基準閾値を説明する図である。測定情報から求めた基準閾値Th_aは、局所領域の位置の標準偏差と、撮像装置111の撮像部103のデフォーカス量のいずれか1つ以上の情報から算出される。 Figures 11(a)-(b) are diagrams explaining the parameters evaluated when calculating the reference threshold value Th_a obtained from the measurement information and the reference threshold value of each parameter at that time. The reference threshold value Th_a obtained from the measurement information is calculated from one or more pieces of information on the standard deviation of the position of the local region and the defocus amount of the imaging unit 103 of the imaging device 111.

図11(a)は、局所領域の位置の標準偏差と局所領域の位置の標準偏差の基準閾値Apとの関係を示す図である。局所領域の位置の標準偏差を評価することで、被写体の位置のばらつきを評価する。標準偏差の値が大きいほど、ばらつきは大きくなる。任意の値Ab、Acと標準偏差の値Adから、標準偏差の値の基準閾値Apは、下記の式(13)で表される。ただし、Ab>0、Ac>0とする。
Ap=Ac×Ad+Ab ・・・(13)
11A is a diagram showing the relationship between the standard deviation of the position of a local region and the reference threshold value Ap of the standard deviation of the position of a local region. The standard deviation of the position of a local region is evaluated to evaluate the variation in the position of a subject. The larger the value of the standard deviation, the greater the variation. From arbitrary values Ab and Ac and the standard deviation value Ad, the reference threshold value Ap of the standard deviation value is expressed by the following formula (13), where Ab>0 and Ac>0.
Ap = Ac × Ad + Ab ... (13)

図11(b)は、撮像部103のデフォーカス量と撮像部103のデフォーカス量の基準閾値Bpとの関係を示す図である。撮像部103のデフォーカス量が大きい領域は、左右の視差画像の対称性が低くなるため、算出した被写体の位置のばらつきが大きくなる。任意の値Bb、Bcと撮像部103のデフォーカス量Bdから、撮像部103のデフォーカス量の基準閾値Bpは、下記の式(14)で表される。ただし、Bb>0、Bc>0とする。
Bp=Bc×Bd+Bb ・・・(14)
11B is a diagram showing the relationship between the defocus amount of the imaging unit 103 and the reference threshold value Bp of the defocus amount of the imaging unit 103. In an area where the defocus amount of the imaging unit 103 is large, the symmetry of the left and right parallax images is low, and the calculated position of the subject varies greatly. From arbitrary values Bb and Bc and the defocus amount Bd of the imaging unit 103, the reference threshold value Bp of the defocus amount of the imaging unit 103 is expressed by the following formula (14). However, Bb>0, Bc>0.
Bp = Bc × Bd + Bb ... (14)

閾値設定部108は、測定情報から求めた基準閾値Th_aを、式(15)により算出する。
Th_a=Ap+Bp ・・・(15)
The threshold setting unit 108 calculates the reference threshold Th_a from the measurement information using equation (15).
Th_a = Ap + Bp ... (15)

図11(c)~(e)は、撮像情報から求めた基準閾値Th_bを算出する際に評価した各パラメータとその時の各パラメータの基準閾値を説明する図である。撮像情報から求めた基準閾値Th_bは、撮像装置111の撮像部103の絞り値と、撮像装置111の撮像部103のピント位置までの距離と、撮像装置111の撮像部103の焦点距離のいずれか1つ以上の情報から算出される。 Figures 11(c) to (e) are diagrams explaining each parameter evaluated when calculating the reference threshold value Th_b obtained from the imaging information and the reference threshold value of each parameter at that time. The reference threshold value Th_b obtained from the imaging information is calculated from information on one or more of the aperture value of the imaging unit 103 of the imaging device 111, the distance to the focus position of the imaging unit 103 of the imaging device 111, and the focal length of the imaging unit 103 of the imaging device 111.

図11(c)は、撮像部103の絞り値と撮像部103の絞り値の基準閾値Cpとの関係を示す図である。撮像時に絞り値を大きくして撮像すると、ステップS501において算出した被写体の位置のばらつきが大きくなる。任意の値Cb、Ccと絞り値Cdから、絞り値の基準閾値Cpは、下記の式(16)で表される。ただし、Cb>0、Cc>0とする。
Cp=Cc×Cd+Cb ・・・(16)
11C is a diagram showing the relationship between the aperture value of the imaging unit 103 and the reference threshold value Cp of the aperture value of the imaging unit 103. If the aperture value is increased during imaging, the variation in the subject position calculated in step S501 increases. From arbitrary values Cb, Cc and the aperture value Cd, the reference threshold value Cp of the aperture value is expressed by the following formula (16), where Cb>0 and Cc>0.
Cp=Cc×Cd+Cb (16)

図11(d)は、撮像部103のピント位置までの距離と撮像部103のピント位置までの距離の基準閾値Dpとの関係を示す図である。撮像時にピント位置までの距離を大きくして撮像すると、被写体の位置のばらつきが大きくなる。これは被写体の位置の算出精度がピント位置までの距離の二乗に反比例しているためである。任意の値Db、Dcと撮像部103のピント位置までの距離Ddから、撮像部103のピント位置までの距離基準閾値Dpは、下記の式(17)で表される。ただし、Db>0、Dc>0とする。
Dp=Dc×Dd+Db ・・・(17)
11D is a diagram showing the relationship between the distance to the focus position of the imaging unit 103 and the reference threshold value Dp of the distance to the focus position of the imaging unit 103. When the distance to the focus position is increased during imaging, the variation in the position of the subject increases. This is because the calculation accuracy of the subject position is inversely proportional to the square of the distance to the focus position. From any values Db, Dc and the distance Dd to the focus position of the imaging unit 103, the reference threshold value Dp of the distance to the focus position of the imaging unit 103 is expressed by the following formula (17). However, Db>0, Dc>0.
Dp = Dc × Dd + Db ... (17)

図11(e)は、撮像部103の焦点距離と撮像部103の焦点距離の基準閾値Epとの関係を示す図である。撮像時に焦点距離を大きくして撮像すると、画角が狭くなるため、被写体の位置のばらつきが小さくなる。任意の値Eb、Ecと撮像部103の焦点距離Edから、撮像部103の焦点距離の基準閾値Epは、下記の式(18)で表される。ただし、Eb>0、Ec<0とする。
Ep=Ec×Ed+Eb ・・・(18)
11E is a diagram showing the relationship between the focal length of the imaging unit 103 and the reference threshold value Ep of the focal length of the imaging unit 103. When the focal length is increased during imaging, the angle of view becomes narrower, and the variation in the position of the subject becomes smaller. From arbitrary values Eb and Ec and the focal length Ed of the imaging unit 103, the reference threshold value Ep of the focal length of the imaging unit 103 is expressed by the following formula (18), where Eb>0 and Ec<0.
Ep = Ec × Ed + Eb (18)

閾値設定部108は、撮像情報から求めた基準閾値Th_bを、式(19)により算出する。
Th_b=Cp+Dp+Ep ・・・(19)
The threshold setting unit 108 calculates the reference threshold Th_b from the imaging information using equation (19).
Th_b=Cp+Dp+Ep... (19)

図11(f)~(g)は、画像情報から求めた基準閾値Th_cを算出する際に評価した各パラメータとその時の各パラメータの基準閾値を説明する図である。画像情報から求めた基準閾値Th_cは、画像のコントラストと、画像のSN比のいずれか1つ以上の情報から算出される。 Figures 11(f) to (g) are diagrams explaining the parameters evaluated when calculating the reference threshold value Th_c obtained from the image information and the reference threshold value for each parameter at that time. The reference threshold value Th_c obtained from the image information is calculated from one or more pieces of information on the image contrast and the image signal-to-noise ratio.

図11(f)は、画像のコントラストとコントラストの基準閾値Fpとの関係を示す図である。画像のコントラストが大きくなると、被写体の位置のばらつきが小さくなる。任意の値Fb、Fcと画像のコントラストFdから、画像のコントラストの基準閾値Fpは、下記の式(20)で表される。ただし、Fb>0、Fc<0とする。
Fp=Fc×Fd+Fb ・・・(20)
11F is a diagram showing the relationship between the image contrast and the reference contrast threshold value Fp. As the image contrast increases, the variation in the subject position decreases. From arbitrary values Fb, Fc and the image contrast Fd, the reference contrast threshold value Fp of the image is expressed by the following formula (20), where Fb>0 and Fc<0.
Fp = Fc × Fd + Fb ... (20)

図11(g)は、画像のSN比と画像のSN比の基準閾値Gpとの関係を示す図である。画像のSN比が大きいと、ノイズに対する信号の割合が大きくなることから、被写体の位置のばらつきが小さくなる。任意の値Gb、Gcと画像のSN比Gdから、画像のSN比の基準閾値Gpは、下記の式(21)で表される。ただし、Gb>0、Gc<0とする。
Gp=Gc×Gd+Gb ・・・(21)
11G is a diagram showing the relationship between the S/N ratio of an image and the standard threshold value Gp of the S/N ratio of an image. When the S/N ratio of an image is large, the ratio of signal to noise increases, and therefore the variation in the position of the subject decreases. From arbitrary values Gb, Gc and the S/N ratio Gd of an image, the standard threshold value Gp of the S/N ratio of an image is expressed by the following formula (21), where Gb>0 and Gc<0.
Gp = Gc × Gd + Gb ... (21)

閾値設定部108は、画像情報から求めた基準閾値Th_cを、式(22)により算出する。
Th_c=Fp+Gp ・・・(22)
The threshold setting unit 108 calculates the reference threshold Th_c from the image information using equation (22).
Th_c=Fp+Gp (22)

以上のように、閾値設定部108は、測定情報と撮像情報と画像情報のいずれか1つ以上の情報を基に、基準となる閾値Th_beを設定することが可能である。閾値設定部108は、基準となる閾値Th_beを決定することにより、被写体の位置の誤差の大きさに応じて閾値Thをより詳細に決定できるため、影が付く領域の判定の誤差をさらに低減することができる。 As described above, the threshold setting unit 108 can set the reference threshold Th_be based on one or more of the measurement information, the imaging information, and the image information. By determining the reference threshold Th_be, the threshold setting unit 108 can determine the threshold Th in more detail according to the magnitude of the error in the position of the subject, thereby further reducing the error in determining the shadowed area.

また、閾値設定部108は、撮像情報によって基準となる閾値Th_beを決定できるので、撮像前に基準となる閾値Th_beを決定することができる。さらに、閾値設定部108は、測定情報や画像情報によって基準となる閾値Th_beを決定できるので、撮像情報がわからない場合でも、基準となる閾値Th_beを決定することができる。 In addition, the threshold setting unit 108 can determine the reference threshold Th_be based on the imaging information, so it is possible to determine the reference threshold Th_be before imaging. Furthermore, the threshold setting unit 108 can determine the reference threshold Th_be based on the measurement information and image information, so it is possible to determine the reference threshold Th_be even if the imaging information is unknown.

撮像装置111は、デジタルカメラまたはビデオカメラの他、スマートフォン、タブレット、工業用カメラ、医療用カメラまたは車載カメラ等に適用可能である。 The imaging device 111 can be applied to digital cameras or video cameras, as well as smartphones, tablets, industrial cameras, medical cameras, or vehicle-mounted cameras.

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

なお、上記実施形態は、何れも本発明を実施するにあたっての具体化の例を示したものに過ぎず、これらによって本発明の技術的範囲が限定的に解釈されてはならないものである。すなわち、本発明はその技術思想、又はその主要な特徴から逸脱することなく、様々な形で実施することができる。 The above embodiments are merely examples of how the present invention can be implemented, and the technical scope of the present invention should not be interpreted in a limiting manner. In other words, the present invention can be implemented in various forms without departing from its technical concept or main features.

100 画像処理装置、101 制御部、102 メモリ、103 撮像部、104 発光部、105 画像情報入力部、106 パラメータ設定部、107 点群取得部、108 閾値設定部、109 影領域算出部、110 影付画像生成部、111 撮像装置 100 Image processing device, 101 Control unit, 102 Memory, 103 Imaging unit, 104 Light emission unit, 105 Image information input unit, 106 Parameter setting unit, 107 Point cloud acquisition unit, 108 Threshold setting unit, 109 Shadow region calculation unit, 110 Shadow image generation unit, 111 Imaging device

Claims (12)

画像を基に被写体の位置と前記被写体の位置における局所領域の面の傾きとを情報として持つ点の集合を点群として取得する点群取得手段と、
前記点群のうち、光源の位置を基準位置としたときに手前側にある点群を第1の点群とし、前記光源の位置を基準位置としたときに奥側にある点群を第2の点群とし、前記第1の点群の各点の前記局所領域の面の傾きと前記第2の点群の各点の前記局所領域の面の傾きとの差が大きいほど閾値が小さくなるように、閾値を設定する閾値設定手段と、
前記第2の点群のうち、前記光源から前記第1の点群の各点までの距離と前記光源から前記第2の点群の各点までの距離との距離差が前記閾値以上である点を影が付く領域として設定する領域設定手段と
を有することを特徴とする画像処理装置。
a point cloud acquisition means for acquiring a set of points having information on a position of an object and a surface inclination of a local area at the position of the object as a point cloud based on an image;
a threshold setting means for setting a threshold value such that a difference between a surface gradient of the local region of each point of the first point group and a surface gradient of the local region of each point of the second point group is larger, the threshold value being smaller; and
and an area setting means for setting, among the second point cloud, points where the difference in distance between the light source and each point of the first point cloud and the distance from the light source to each point of the second point cloud is equal to or greater than the threshold value as a shadowed area.
前記影が付く領域に基づいて影を付けた画像を生成する画像生成手段をさらに有することを特徴とする請求項1に記載の画像処理装置。 The image processing device according to claim 1, further comprising an image generating means for generating a shaded image based on the shaded area. 前記点群取得手段は、光学系の異なる瞳領域を通過する被写体の光束に基づく一対の画像を基に被写体までの距離を算出し、前記被写体までの距離を基に前記被写体の位置を取得することを特徴とする請求項1または2に記載の画像処理装置。 The image processing device according to claim 1 or 2, characterized in that the point cloud acquisition means calculates a distance to a subject based on a pair of images based on light beams of the subject passing through different pupil regions of an optical system, and acquires a position of the subject based on the distance to the subject. 前記点群取得手段は、照度差ステレオ法により法線情報を前記局所領域の面の傾きとして取得することを特徴とする請求項1~のいずれか1項に記載の画像処理装置。 4. The image processing device according to claim 1, wherein the point cloud acquisition means acquires normal information as a surface inclination of the local region by a photometric stereo method. 前記点群取得手段は、前記被写体の位置の隣接する各点の位置の変位量に基づいて、前記局所領域の面の傾きを取得することを特徴とする請求項1~のいずれか1項に記載の画像処理装置。 4. The image processing device according to claim 1 , wherein the point cloud acquisition means acquires a tilt of a surface of the local region based on an amount of displacement between positions of each point adjacent to a position of the subject. 前記点群取得手段は、前記局所領域に含まれる点群の位置を平均することで補正した位置を算出し、前記補正した位置を用いて前記変位量を算出することを特徴とする請求項に記載の画像処理装置。 The image processing device according to claim 5 , wherein the point cloud acquisition means calculates a corrected position by averaging positions of a point cloud included in the local region , and calculates the amount of displacement using the corrected position. 前記閾値設定手段は、測定情報と撮像情報と画像情報のいずれか1つ以上の情報を基に前記閾値を設定することを特徴とする請求項1~のいずれか1項に記載の画像処理装置。 7. The image processing apparatus according to claim 1 , wherein the threshold setting means sets the threshold based on at least one of measurement information, imaging information, and image information. 前記測定情報は、局所領域の位置の標準偏差と撮像装置のデフォーカス量のいずれか1つ以上の情報であることを特徴とする請求項に記載の画像処理装置。 8. The image processing apparatus according to claim 7 , wherein the measurement information is at least one of a standard deviation of a position of a local region and a defocus amount of an image capturing apparatus. 前記撮像情報は、撮像装置の絞り値と、撮像装置のピント位置までの距離と、撮像装置の焦点距離のいずれか1つ以上の情報であること特徴とする請求項に記載の画像処理装置。 8. The image processing device according to claim 7 , wherein the imaging information is at least one of an aperture value of the imaging device, a distance to a focus position of the imaging device, and a focal length of the imaging device. 前記画像情報は、前記画像のコントラストと画像のSN比のいずれか1つ以上の情報であることを特徴とする請求項に記載の画像処理装置。 8. The image processing apparatus according to claim 7 , wherein the image information is at least one of information on contrast of the image and information on an S/N ratio of the image. 画像を基に被写体の位置と前記被写体の位置における局所領域の面の傾きとを情報とし
て持つ点の集合を点群として取得する点群取得ステップと、
前記点群のうち、光源の位置を基準位置としたときに手前側にある点群を第1の点群とし、前記光源の位置を基準位置としたときに奥側にある点群を第2の点群とし、前記第1の点群の各点の前記局所領域の面の傾きと前記第2の点群の各点の前記局所領域の面の傾きとの差が大きいほど閾値が小さくなるように、閾値を設定する閾値設定ステップと、
前記第2の点群のうち、前記光源から前記第1の点群の各点までの距離と前記光源から前記第2の点群の各点までの距離との距離差が前記閾値以上である点を影が付く領域として設定する領域設定ステップと
を有することを特徴とする画像処理方法。
a point cloud acquisition step of acquiring, as a point cloud, a set of points having information on the position of an object and the inclination of a surface of a local area at the position of the object based on an image;
a threshold setting step of setting a threshold value such that a difference between a surface gradient of the local region of each point of the first point group and a surface gradient of the local region of each point of the second point group is larger, the threshold value being smaller; and
and a region setting step of setting, among the second point cloud, points where the difference in distance between the light source and each point of the first point cloud and the distance from the light source to each point of the second point cloud is equal to or greater than the threshold value as a shadowed region.
コンピュータを、請求項1~10のいずれか1項に記載された画像処理装置の各手段として機能させるためのプログラム。 A program for causing a computer to function as each of the means of the image processing device according to any one of claims 1 to 10 .
JP2019238733A 2019-12-27 2019-12-27 Image processing device, image processing method, and program Active JP7479840B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019238733A JP7479840B2 (en) 2019-12-27 2019-12-27 Image processing device, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019238733A JP7479840B2 (en) 2019-12-27 2019-12-27 Image processing device, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2021107983A JP2021107983A (en) 2021-07-29
JP7479840B2 true JP7479840B2 (en) 2024-05-09

Family

ID=76967926

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019238733A Active JP7479840B2 (en) 2019-12-27 2019-12-27 Image processing device, image processing method, and program

Country Status (1)

Country Link
JP (1) JP7479840B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012522283A (en) 2009-03-27 2012-09-20 トムソン ライセンシング Shading generation method for images
JP2018036884A (en) 2016-08-31 2018-03-08 Kddi株式会社 Light source estimation device and program
JP2019100995A (en) 2017-12-08 2019-06-24 株式会社トプコン Measurement image display control unit, measurement image display control method, and program for measurement image display control

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012522283A (en) 2009-03-27 2012-09-20 トムソン ライセンシング Shading generation method for images
JP2018036884A (en) 2016-08-31 2018-03-08 Kddi株式会社 Light source estimation device and program
JP2019100995A (en) 2017-12-08 2019-06-24 株式会社トプコン Measurement image display control unit, measurement image display control method, and program for measurement image display control

Also Published As

Publication number Publication date
JP2021107983A (en) 2021-07-29

Similar Documents

Publication Publication Date Title
JP5934929B2 (en) Image processing apparatus and image processing method
TWI393980B (en) The method of calculating the depth of field and its method and the method of calculating the blurred state of the image
JP6415179B2 (en) Image processing apparatus, image processing method, imaging apparatus, and control method thereof
US20160360081A1 (en) Control apparatus, image pickup apparatus, control method, and non-transitory computer-readable storage medium
CN112106105A (en) Method and system for generating three-dimensional image of object
CN102771128B (en) A kind of method and system of stereo-picture of the improvement for obtaining target
JP6786225B2 (en) Image processing equipment, imaging equipment and image processing programs
JP6071257B2 (en) Image processing apparatus, control method therefor, and program
US10713810B2 (en) Information processing apparatus, method of controlling information processing apparatus, and storage medium
US11347133B2 (en) Image capturing apparatus, image processing apparatus, control method, and storage medium
JP6353233B2 (en) Image processing apparatus, imaging apparatus, and image processing method
JP4843544B2 (en) 3D image correction method and apparatus
JP7213686B2 (en) Shape measuring device, control method and program
US11790600B2 (en) Image processing device, imaging apparatus, image processing method, and recording medium
JP6362070B2 (en) Image processing apparatus, imaging apparatus, image processing method, program, and storage medium
JP2017134561A (en) Image processing device, imaging apparatus and image processing program
JP7479840B2 (en) Image processing device, image processing method, and program
CN109923854B (en) Image processing apparatus, image processing method, and recording medium
US11468586B2 (en) Three-dimensional measurement apparatus, image capturing apparatus, control method, and recording medium
JP2023001950A (en) Information processing apparatus, imaging apparatus, image processing method, and program
CN119420890B (en) A defocused 3D camera
JP7256368B2 (en) ranging camera
JP7227454B2 (en) ranging camera
JP2023069386A (en) Image measurement device, method and program
JP2008286548A (en) Calibration method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20221219

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20231110

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20231128

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20231227

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20240326

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20240424

R150 Certificate of patent or registration of utility model

Ref document number: 7479840

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150