JP4155401B2 - 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium - Google Patents

3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium Download PDF

Info

Publication number
JP4155401B2
JP4155401B2 JP2003273658A JP2003273658A JP4155401B2 JP 4155401 B2 JP4155401 B2 JP 4155401B2 JP 2003273658 A JP2003273658 A JP 2003273658A JP 2003273658 A JP2003273658 A JP 2003273658A JP 4155401 B2 JP4155401 B2 JP 4155401B2
Authority
JP
Japan
Prior art keywords
image
pixel
dimensional
value
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.)
Expired - Fee Related
Application number
JP2003273658A
Other languages
Japanese (ja)
Other versions
JP2005033731A (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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2003273658A priority Critical patent/JP4155401B2/en
Publication of JP2005033731A publication Critical patent/JP2005033731A/en
Application granted granted Critical
Publication of JP4155401B2 publication Critical patent/JP4155401B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Testing, Inspecting, Measuring Of Stereoscopic Televisions And Televisions (AREA)
  • Image Analysis (AREA)

Description

本発明は、3次元画像生成方法及び3次元画像生成装置、ならびに3次元画像生成プログラム及び記録媒体に関し、特に、映像産業、通信産業等の分野における立体画像通信において使用される3次元画像生成方法及び3次元画像生成装置に適用して有効な技術に関するものである。   The present invention relates to a three-dimensional image generation method, a three-dimensional image generation apparatus, a three-dimensional image generation program, and a recording medium, and more particularly, to a three-dimensional image generation method used in stereoscopic image communication in fields such as the video industry and communication industry. And a technique effective when applied to a three-dimensional image generation apparatus.

近年、携帯電話やPDA(Personal Digital Assistant)等の携帯器機でも立体画像(3次元画像)の表示が行われるようになってきており、前記立体画像の入力手段として、小型、低コスト、低消費電カ、計測環境や計測範囲に制限のない3次元形状計測装置が求められている。   In recent years, mobile devices such as mobile phones and PDAs (Personal Digital Assistants) have been displaying stereoscopic images (three-dimensional images), and as a means for inputting the stereoscopic images, small size, low cost, and low consumption. There is a need for a three-dimensional shape measuring apparatus that is not limited in electrical power, measurement environment, or measurement range.

ところが、物体の3次元画像の入力方法及び入力装置は、現在発展途上の技術であり、今のところ、携帯器機に組み込めるような3次元形状入力装置はまだ実用化されていない。   However, an input method and an input device for a three-dimensional image of an object are currently developing technologies, and a three-dimensional shape input device that can be incorporated into a portable device has not yet been put into practical use.

また、前記携帯器機等で立体画像を表示する場合、表示された物体の立体感を得られれば良いことが多く、必ずしも正確な3次元形状を求める必要はない。つまり、何等かの方法で撮影物体の3次元形状を擬似的に生成しても、その形状を立体表示装置で表示したときに、視覚的に自然で、立体感が感じられれば十分実用に供する。   When displaying a stereoscopic image with the portable device or the like, it is often sufficient to obtain a stereoscopic effect of the displayed object, and it is not always necessary to obtain an accurate three-dimensional shape. In other words, even if the three-dimensional shape of the photographic object is generated in a pseudo manner by any method, it is sufficiently practical if the shape is visually natural and a stereoscopic effect is felt when displayed on the stereoscopic display device. .

また、立体画像を生成して表示するための3次元画像表示装置が種々提案されているが、奥行き方向の表現能カは必ずしも水平または垂直方向の表現能力と同じではない。ここで、前記奥行き方向の表現能力に関して、3次元画像表示装置の一種であるDFD方式表示装置(例えば、非特許文献1を参照。)を例に挙げて説明する。   Various three-dimensional image display apparatuses for generating and displaying a stereoscopic image have been proposed, but the expression capability in the depth direction is not necessarily the same as the expression capability in the horizontal or vertical direction. Here, the expression capability in the depth direction will be described by taking a DFD display device (for example, see Non-Patent Document 1) as an example of a three-dimensional image display device as an example.

前記DFD方式は、2枚の表示画面を重ねて表示することによって3次元画像を表示する方法であり、奥行き方向の表示可能範囲は前面の表示画面から後面の表示画面の間に限られる。そのため、前記携帯器機のように薄型化の要求が高く、前記2枚の表示画面の距離を十分に取れない場合、奥行き方向の表示可能範囲が著しく限定される。   The DFD method is a method of displaying a three-dimensional image by overlapping and displaying two display screens, and the displayable range in the depth direction is limited between the front display screen and the rear display screen. For this reason, when there is a high demand for thickness reduction as in the portable device and the distance between the two display screens cannot be sufficiently secured, the displayable range in the depth direction is remarkably limited.

このような表示装置で正確な3次元形状を表示させようとすると、一部の奥行き範囲しか立体表示できない。また、全てを表示させるため奥行き方向に3次元形状を圧縮して表示させることが考えられるが、単純に圧縮すると立体感に乏しい画像となる問題が生じる。そこで、例えば硬貨の表面の絵柄に見られるレリーフ調の立体表現に3次元形状を変換すれば、奥行き方向の表示可能範囲の小さい3次元画像表示装置を用いても立体感ある表示が可能となる。   If an accurate three-dimensional shape is to be displayed with such a display device, only a part of the depth range can be stereoscopically displayed. In addition, it is conceivable to display a compressed three-dimensional shape in the depth direction in order to display all, but if it is simply compressed, there is a problem that an image with poor stereoscopic effect is generated. Therefore, for example, if a three-dimensional shape is converted into a relief-like three-dimensional expression that can be seen on a pattern on the surface of a coin, a three-dimensional display can be achieved even with a three-dimensional image display device having a small displayable range in the depth direction. .

しかしながら、この方法では、3次元画像を生成する処理に、3次元計測とレリーフ調立体形状変換の2つのステップが必要となり計算コストが増大する。そのため、特に、処理能力の小さい携帯器機組み込みCPUではこの問題が深刻である。   However, in this method, two steps of three-dimensional measurement and relief-like three-dimensional shape conversion are required for the process of generating a three-dimensional image, and the calculation cost increases. For this reason, this problem is particularly serious in a portable device embedded CPU having a small processing capability.

これらの問題を解決する既存の3次元形状入力技術としては、1枚の画像から立体形状を生成する技術が提案されている(例えば、特許文献1を参照。)。しかしながら、前記特許文献1等に記載された技術は、画像中心は遠景、画像周辺は近景であるという前提に基づいて立体形状を生成する。そのため、元々そのような距離分布の画像でない限り、意味のある立体形状を生成できず、適用範囲が限られる欠点があった。   As an existing three-dimensional shape input technique for solving these problems, a technique for generating a three-dimensional shape from one image has been proposed (see, for example, Patent Document 1). However, the technique described in Patent Document 1 or the like generates a three-dimensional shape based on the premise that the image center is a distant view and the image periphery is a close view. Therefore, unless it was originally an image of such a distance distribution, a meaningful three-dimensional shape could not be generated, and there was a drawback that the application range was limited.

また、この問題を解決する3次元形状入力技術として、遠景と近景の2値化距離画像から立体形状を擬似的に生成する技術も提案されている(例えば、特願2002−275471を参照。)。しかしながら、前記立体形状を擬似的に生成する技術は、近景領域を1つの領域としてカマボコ形状に立体形状を生成するため、奥行き方向の凹凸のディテールがほとんどない形状しか生成できないという問題がある。   As a three-dimensional shape input technique for solving this problem, a technique for artificially generating a three-dimensional shape from a binary distance image of a distant view and a close view has also been proposed (see, for example, Japanese Patent Application No. 2002-275471). . However, the technology for generating the three-dimensional shape in a pseudo manner has a problem that only a shape having almost no depth unevenness in the depth direction can be generated because the three-dimensional shape is generated in a kamaboko shape using the foreground region as one region.

S. Suyama, M. Date and H. Takeda, "Three-Dimensional Display System with Dual-Frequency Liquid-Crystal Varifocal Lens", Jpn. J. Appl. Phys., 39(Pt. 1, 2A), 480(2000)S. Suyama, M. Date and H. Takeda, "Three-Dimensional Display System with Dual-Frequency Liquid-Crystal Varifocal Lens", Jpn. J. Appl. Phys., 39 (Pt. 1, 2A), 480 (2000 ) 特開平10−307926JP-A-10-307926

前記背景技術の欄で説明したように、従来の3次元画像生成装置は、小型化、低消費電力化、低コスト化等が難しく、小型、薄型の携帯器機に組み込むことが難しいという問題があった。   As described in the background section, the conventional three-dimensional image generation apparatus has a problem that it is difficult to reduce the size, reduce the power consumption, reduce the cost, etc., and it is difficult to incorporate it into a small and thin portable device. It was.

また、例えば、前記DFD方式を適用した従来の3次元画像生成装置は、2枚の表示画面の間の距離が小さいと奥行き方向の表現能力が低い。そのため、前記携帯器機に適用することが難しいという問題があった。   In addition, for example, a conventional three-dimensional image generation apparatus to which the DFD method is applied has a low representation capability in the depth direction when the distance between two display screens is small. Therefore, there was a problem that it was difficult to apply to the portable device.

また、従来の3次元画像生成装置は、高い計算処理能力が要求されるという問題もあり、小型化、薄型化が進んだ携帯器機への適用、組み込みが難しいという問題があった。   In addition, the conventional three-dimensional image generation apparatus has a problem that a high calculation processing capability is required, and there is a problem that it is difficult to apply and embed to a portable device that has been reduced in size and thickness.

また、その他にも、あらかじめ想定している距離分布と異なる場合に正確な立体画像を生成できないという問題や、奥行き方向の表現能力が低いという問題もあった。   In addition, there are problems that an accurate stereoscopic image cannot be generated when the distance distribution is different from the assumed distance distribution, and that the ability to express in the depth direction is low.

本発明は、3次元形状生成に必要な補助情報のみを取得し、該補助情報を元に撮影物体の3次元形状を生成することによって実現性の高い3次元形状入力手段を提供することを目的とする。補助情報のみの取得であれば、正確な3次元形状を求める場合と比較して、小型、低コストで信頼性の高い3次元画像生成の実現が容易なので、携帯器機に組み込み可能な小型で低コストの3次元画像生成装置を実現することができる。   It is an object of the present invention to provide a highly feasible three-dimensional shape input means by acquiring only auxiliary information necessary for generating a three-dimensional shape and generating a three-dimensional shape of a photographic object based on the auxiliary information. And If only the auxiliary information is acquired, it is easy to realize small-sized, low-cost and highly reliable 3D image generation compared with the case of obtaining an accurate 3D shape. A cost-effective three-dimensional image generation apparatus can be realized.

また、本発明は、正確な3次元形状を求めてからレリーフ調立体形状変換する2ステップの処理ではなく、直接レリーフ調立体形状を生成することによって計算コストの問題を解決することを目的とする。これによって、奥行き方向の表示可能範囲が小さい3次元画像表示装置でも使用可能なレリーフ調の3次元形状を、少ない計算コストで効率的に生成でき、携帯器機に組み込まれる処理性能の低いCPUでも、十分な立体感を得られる画像を容易に生成することができる。   Another object of the present invention is to solve the problem of calculation cost by directly generating a relief-like solid shape, rather than a two-step process of converting a relief-like solid shape after obtaining an accurate three-dimensional shape. . As a result, a relief-like 3D shape that can be used even in a 3D image display device with a small displayable range in the depth direction can be efficiently generated at a low calculation cost, and even with a CPU with low processing performance incorporated in a portable device, An image capable of obtaining a sufficient stereoscopic effect can be easily generated.

また、本発明は、撮影時の照明によって影のできない画像を同時に生成することによって3次元形状情報生成と同時に高品質な色画像を提供することを目的とする。   Another object of the present invention is to provide a high-quality color image simultaneously with the generation of three-dimensional shape information by simultaneously generating an image that cannot be shaded by illumination during photographing.

本発明の3次元画像生成方法及び3次元画像生成装置では、補助情報を元に立体形状(立体画像)を生成する。そのため、画像内における遠景領域と近景領域の分布に依存することなく、意味のある立体形状を生成することが出来る。また、本発明は近景領域内においても前後関係のある物体は遠近の区別がつけられるため、よりディテールに富んだ立体形状が生成できる。   In the three-dimensional image generation method and the three-dimensional image generation apparatus of the present invention, a three-dimensional shape (three-dimensional image) is generated based on auxiliary information. Therefore, a meaningful three-dimensional shape can be generated without depending on the distribution of the distant view area and the foreground area in the image. Further, according to the present invention, objects in the context can be distinguished from each other even in the foreground area, so that a three-dimensional shape with more details can be generated.

本発明の前記ならびにその他の目的と新規な特徴は、本明細書の記述及び添付図面によって明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

本願において開示される発明の概要を説明すれば、以下の通りである。
(1) 撮影手段から水平方向に所定距離離れた位置から照明して撮影した第1画像、及び前記撮影手段から前記水平方向と反対方向に所定距離離れた位置から照明して撮影した第2画像を取得する第1のステップと、前記第1画像と第2画像の差分画像を生成する第2のステップと、前記差分画像上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を、水平ライン毎に抽出する第3のステップと、前記右端の画素より右側の領域、及び前記左端の画素より左側の領域にあらかじめ定めた距離関数に従って距離を与える操作を、水平ライン毎に行って距離画像を生成する第4のステップと、前記距離画像を垂直方向に平滑化する第5のステップとを有する3次元画像生成方法である。
The outline of the invention disclosed in the present application will be described as follows.
(1) A first image taken by illuminating from a position away from the photographing means by a predetermined distance in the horizontal direction, and a second image taken by illuminating from a position away from the photographing means by a predetermined distance in the direction opposite to the horizontal direction. A second step of generating a difference image between the first image and the second image, and a right end of an area having a pixel value equal to or greater than a certain positive threshold k1 on the difference image. A third step of extracting a pixel and a pixel at the left end of a region having a negative threshold value −k1 or less for each horizontal line, a region on the right side of the right end pixel, and a left side of the left end pixel A fourth step of generating a distance image by performing an operation for giving a distance to the region according to a predetermined distance function for each horizontal line, and a fifth step of smoothing the distance image in the vertical direction 3. Dimensional image It is a generation method.

(2) 前記(1)の手段における前記第2のステップと前記第3のステップの間に、前記差分画像の各画素値の絶対値が、あらかじめ定められた閾値k2より大きい場合には、差分量の絶対値を閾値k2と置き換えるステップAと、前記差分画像の各水平ライン毎に画素値の分布形状を近似するようにあらかじめ定められた近似式のパラメータを決定するステップB1と、各画素毎に画素値からその画素位置における近似値を減ずるステップB2とを有し、前記ステップA,前記ステップB1,前記ステップB2の順、または前記ステップB1,前記ステップB2,前記ステップAの順に、1回または反復の度にk2を小さくしていきながら複数回行うことによって新たな差分画像を生成するステップとを有する3次元画像生成方法である。   (2) If the absolute value of each pixel value of the difference image is larger than a predetermined threshold value k2 between the second step and the third step in the means of (1), a difference A step A in which the absolute value of the quantity is replaced with a threshold value k2, a step B1 in which a parameter of an approximate expression determined in advance to approximate the distribution shape of the pixel value is approximated for each horizontal line of the difference image, and each pixel Step B2 for subtracting the approximate value at the pixel position from the pixel value, and once in the order of Step A, Step B1, Step B2, or Step B1, Step B2, and Step A. Or a step of generating a new difference image by performing a plurality of times while decreasing k2 for each iteration.

) 前記(1)または)の手段における前記第3のステップと前記第4のステップの間に、前記第3のステップで求めた画像内の右端の画素と左端の画素の各々について、画素が垂直方向には大局的には連続して存在し局部的に途切れが存在する場合に、途切れた部分を上下の画素より補間して右端の画素または左端の画素とすることによって、途切れを解消するステップを有する3次元画像生成方法である。 ( 3 ) Between the third step and the fourth step in the means (1) or ( 2 ), for each of the rightmost pixel and the leftmost pixel in the image obtained in the third step. When pixels are continuously present in the vertical direction and there is a local discontinuity, the discontinuous portion is interpolated from the upper and lower pixels to form the right end pixel or the left end pixel. It is a three-dimensional image generation method which has a step which cancels.

) 前記(1)から()の手段における前記第1のステップの後に、前記第1画像と前記第2画像の同位置の画素を比較し、輝度値の大きな画素を選択することによって撮影物体の色画像を生成するステップを有する3次元画像生成方法である。 ( 4 ) After the first step in the means of (1) to ( 3 ), by comparing pixels at the same position in the first image and the second image and selecting a pixel having a large luminance value A three-dimensional image generation method including a step of generating a color image of a photographing object.

) 撮影手段から水平方向に所定距離離れた位置から照明して撮影した第1画像、及び前記撮影手段から前記水平方向と反対方向に所定距離離れた位置から照明して撮影した第2画像を取得する画像取得手段と、前記画像取得手段で取得した前記第1画像及び前記第2画像を用いて3次元形状を生成する3次元形状生成手段とを備え、前記3次元形状生成手段は、前記第1画像と第2画像の差分画像を生成する差分画像生成手段と、前記差分画像上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を、水平ライン毎に抽出する画素抽出手段と、前記右端の画素より右側の領域、及び前記左端の画素より左側の領域にあらかじめ定めた距離関数に従って距離を与える操作を、水平ライン毎に行って距離画像を生成する距離画像生成手段と、前記距離画像を垂直方向に平滑化する平滑化手段とを備える3次元画像生成装置である。 ( 5 ) A first image that is photographed by illuminating from a position that is a predetermined distance in the horizontal direction from the photographing means, and a second image that is photographed by illuminating from a position that is a predetermined distance away from the photographing means in the direction opposite to the horizontal direction. An image acquisition means for acquiring a three-dimensional shape using the first image and the second image acquired by the image acquisition means, the three-dimensional shape generation means, Difference image generating means for generating a difference image between the first image and the second image, a rightmost pixel of a region having a pixel value equal to or larger than a certain positive threshold k1 on the difference image, and a certain negative threshold −k1 The pixel extraction means for extracting the leftmost pixel of the region having the following pixel values for each horizontal line, and the distance according to a predetermined distance function in the region on the right side of the rightmost pixel and the region on the left side of the leftmost pixel Give The operation that is a three-dimensional image generating apparatus comprising: a distance image generating means for generating distance image by performing for each horizontal line, and a smoothing means for smoothing said range image in the vertical direction.

) 前記()の手段における3次元形状生成手段は、前記各手段に加え、前記差分画像の各水平ライン毎に画素値の分布形状を変換して新たな差分画像を生成する差分画像変換手段を備える3次元画像生成装置である。 ( 6 ) The three-dimensional shape generation means in the means of ( 5 ), in addition to the means, a difference image that generates a new difference image by converting a distribution shape of pixel values for each horizontal line of the difference image. A three-dimensional image generation apparatus including a conversion unit.

) 前記()または()の手段において、画像内の右端の画素と左端の画素の各々について、画素が垂直方向には大局的には連続して存在し局部的に途切れが存在する場合に、途切れた部分を上下の画素より補間する画素補間手段を備える3次元画像生成装置である。 ( 7 ) In the means of ( 5 ) or ( 6 ), for each of the rightmost pixel and the leftmost pixel in the image, the pixels are continuously present in the vertical direction and are locally discontinuous. In this case, the three-dimensional image generation apparatus includes a pixel interpolation unit that interpolates the interrupted portion from the upper and lower pixels.

) 前記()から()の手段において、前記第1画像と前記第2画像の同位置の画素を比較し、輝度値の大きな画素を選択することによって撮影物体の色画像を生成する色画像生成手段を備える3次元画像生成装置である。 ( 8 ) In the means of ( 5 ) to ( 7 ), the pixels at the same position in the first image and the second image are compared, and a color image of the photographing object is generated by selecting a pixel having a large luminance value. A three-dimensional image generation apparatus including color image generation means for performing the above-described operation.

) 前記()から()の手段のいずれかの3次元画像生成方法の各ステップをコンピュータに実行させる3次元画像生成プログラムである。 ( 9 ) A three-dimensional image generation program for causing a computer to execute each step of the three-dimensional image generation method according to any one of the means ( 1 ) to ( 4 ).

(1) 前記()の3次元画像生成プログラムが、コンピュータで読み取り可能な状態で記録された記録媒体である。 (1 0 ) A recording medium on which the three-dimensional image generation program of ( 9 ) is recorded in a computer-readable state.

本発明の3次元画像生成方法は、前記(1)の手段のようにすることで、簡潔、低コストで信頼性の高いレリーフ調立体形状入力が可能となる。このとき、従来のように正確な3次元形状を求めてからレリーフ調立体形状に変換する2ステップの処理ではなく、直接レリーフ調立体形状を生成するので、計算コストも小さて済む。そのため、特に、計算処理能力の低い携帯器機に組み込む3次元画像生成方法として優れる。   The three-dimensional image generation method according to the present invention can provide relief-like solid shape input that is simple, low-cost, and highly reliable by using the means (1). At this time, a relief three-dimensional shape is directly generated instead of a two-step process of obtaining an accurate three-dimensional shape and converting it to a relief three-dimensional shape as in the prior art, so that the calculation cost can be reduced. Therefore, it is particularly excellent as a three-dimensional image generation method incorporated in a portable device having a low calculation processing capability.

また、前記(2)の手段を用いることによって、照度ムラのある照明下で撮影された画像からでも、安定したレリーフ調立体形状入力が可能となり、信頼性の高い3次元画像を生成することができる。   Further, by using the means (2), it is possible to input a stable relief-like three-dimensional shape even from an image taken under illumination with uneven illumination, and to generate a highly reliable three-dimensional image. it can.

また、前記()の手段を用いることによって、ノイズ等の要因によって画像中の物体(被写体)の輪郭線がきれいに取得できない場合であっても、安定して高品質なレリーフ調立体形状を生成可能となり、信頼性の高い3次元画像を生成することができる。 In addition, by using the means ( 3 ), even when the contour line of the object (subject) in the image cannot be clearly acquired due to factors such as noise, a stable and high-quality relief-like solid shape can be generated. This makes it possible to generate a highly reliable three-dimensional image.

また、前記()の手段を用いることによって、色画像も同時に取得する場合に、照明による影付の起きない高品質の色画像入力が可能となる。 Further, by using the means ( 4 ), it is possible to input a high-quality color image that is not shaded by illumination when a color image is also acquired.

また、前記()から()の手段の3次元画像生成装置は、前記(1)から()の手段の各ステップを実行する手段を有する装置である。そのため、小型、低コストで信頼性にも優れた3次元画像生成装置を提供することができる。 Further, the three-dimensional image generation apparatus of the means ( 5 ) to ( 8 ) is an apparatus having means for executing each step of the means (1) to ( 4 ). Therefore, it is possible to provide a three-dimensional image generation apparatus that is small in size, low in cost, and excellent in reliability.

また、前記()の手段のように、前記(1)から()の手段の各ステップをコンピュータに実行させるプログラムにすれば、専用の3次元画像生成装置に限らず、既存の携帯電話やPDA等の携帯器機でも、信頼性に優れた3次元画像を容易に生成することができる。 Further, as in the above-mentioned means ( 9 ), if a program for causing the computer to execute each step of the means (1) to ( 4 ) is not limited to a dedicated three-dimensional image generation apparatus, an existing mobile phone Even portable devices such as PDAs can easily generate highly reliable three-dimensional images.

また、前記(1)の手段のように、前記()の手段の3次元画像生成プログラムを、例えば、CD-ROM等の記録媒体に記録すれば、前記プログラムを容易に提供することができる。また、前記3次元画像生成プログラムは、前記記録媒体に限らず、例えば、ネットワーク上の端末に前記プログラムを記録しておき、インターネット等を利用して提供することも可能である。 Further, if the three-dimensional image generation program of the means ( 9 ) is recorded on a recording medium such as a CD-ROM, as in the means (1 0 ), the program can be easily provided. it can. The three-dimensional image generation program is not limited to the recording medium, and can be provided by recording the program on a terminal on a network and using the Internet or the like.

本発明の3次元画像生成方法は、撮影手段から水平方向に所定距離離れた位置から照明して撮影した第1画像、及び前記撮影手段から前記水平方向と反対方向に所定距離離れた位置から照明して撮影した第2画像を取得する第1のステップと、前記第1画像と第2画像の差分画像を生成する第2のステップと、前記差分画像上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を、水平ライン毎に抽出する第3のステップと、前記右端の画素より右側の領域、及び前記左端の画素より左側の領域にあらかじめ定めた距離関数に従って距離を与える操作を、水平ライン毎に行って距離画像を生成する第4のステップと、前記距離画像を垂直方向に平滑化する第5のステップとを有する。   The three-dimensional image generation method of the present invention includes a first image that is photographed by being illuminated from a position that is a predetermined distance in the horizontal direction from the photographing means, and a light that is illuminated from a position that is a predetermined distance from the photographing means in the direction opposite to the horizontal direction. A first step of acquiring a second image photographed in a second step, a second step of generating a difference image between the first image and the second image, and a pixel on the difference image that is equal to or greater than a certain positive threshold k1 A third step of extracting, for each horizontal line, a pixel at the right end of the region having a value and a pixel at the left end of the region having a pixel value equal to or less than a certain negative threshold −k1, a region on the right side of the right end pixel, And a fourth step of generating a distance image by performing an operation for giving a distance to a region on the left side of the leftmost pixel according to a predetermined distance function for each horizontal line, and a step of smoothing the distance image in the vertical direction. 5 steps And a flop.

図1は、本発明の3次元画像生成方法の原理を説明するための模式図である。   FIG. 1 is a schematic diagram for explaining the principle of the three-dimensional image generation method of the present invention.

本発明の3次元画像生成方法では、まず、前記第1のステップにおいて、図1に示すように、前記第1画像101及び前記第2画像102の2枚の画像を取得する。このとき、前記第1画像101は、撮影手段(カメラ)の右側に配置した照明器具で撮影物体(被写体)を照らして撮影した画像である。そのため、前記第1画像101では、図1に示したように、撮影物体103の左側に照明の影104が生じる。また、前記第2画像102は、前記撮影手段(カメラ)の左側に配置した照明器具で撮影物体を照らして撮影した画像である。そのため、前記第2画像102は、図1に示したように、撮影物体103の右側に照明の影104が生じる。   In the three-dimensional image generation method of the present invention, first, in the first step, two images of the first image 101 and the second image 102 are acquired as shown in FIG. At this time, the first image 101 is an image photographed by illuminating a photographing object (subject) with a lighting device arranged on the right side of the photographing means (camera). For this reason, in the first image 101, as shown in FIG. The second image 102 is an image obtained by illuminating a photographic object with a lighting fixture arranged on the left side of the photographing means (camera). Therefore, as shown in FIG. 1, the second image 102 has an illumination shadow 104 on the right side of the photographed object 103.

次の前記第2のステップでは、図1に示すように、前記第1画像101と前記第2画像102の差分画像105を生成する。ここでは、前記差分画像105の各画素の値(画素値)は、前記第2画像102の画素値から前記第1画像101の画素値を減じて求めるものとする。このとき、前記差分画像105上で、前記第1画像101及び前記第2画像102ともに照明が当たっている領域に相当する領域106は、前記各画像101,102上の画素がほぼ同じ輝度値である。そのため、差分の画素値はほとんど0(零)である。一方、前記差分画像105上で、前記第1画像101の影104に相当する領域17は、正の画素値を持つ領域となる。また、前記第2画像102の影104に相当する領域108は、負の画素値を持つ領域となる。つまり、図1に示したように、前記差分画像105の水平ライン109の各画素の画素値を走査(スキャン)すると、画素値グラフ110のようになる。 In the next second step, as shown in FIG. 1, a difference image 105 between the first image 101 and the second image 102 is generated. Here, the value (pixel value) of each pixel of the difference image 105 is obtained by subtracting the pixel value of the first image 101 from the pixel value of the second image 102. At this time, on the difference image 105, an area 106 corresponding to an area where both the first image 101 and the second image 102 are illuminated is such that the pixels on the images 101 and 102 have substantially the same luminance value. is there. Therefore, the difference pixel value is almost 0 (zero). On the other hand, on the difference image 105, an area 10 07 corresponding to the shadow 104 of the first image 101 is an area having a positive pixel value. An area 108 corresponding to the shadow 104 of the second image 102 is an area having a negative pixel value. That is, as shown in FIG. 1, when the pixel value of each pixel of the horizontal line 109 of the difference image 105 is scanned, a pixel value graph 110 is obtained.

次の前記第3のステップでは、図1に示すように、前記差分画像105上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を水平ライン毎に抽出する。このとき、例えば、前記差分画像105に示した前記水平ライン109の画素値を抽出すると、前記画素値グラフ110に示すようになっている。そのため、前記画素値グラフ110に示した前記水平ライン109では、ある正の閾値k1以上の画素値を有する領域、すなわち前記第1画像101の影104に相当する領域107の右端の画素111と、ある負の閾値−k1以下の画素値を有する領域、すなわち前記第2画像102の影104に相当する領域108の左端の画素112が抽出される。この処理を、前記差分画像105の全水平ラインに対して行い、それらをまとめると、図1に示したような画像113が得られる。   In the next third step, as shown in FIG. 1, on the difference image 105, the rightmost pixel of a region having a pixel value greater than or equal to a certain positive threshold value k1 and a pixel equal to or less than a certain negative threshold value −k1. The pixel at the left end of the area having a value is extracted for each horizontal line. At this time, for example, when the pixel value of the horizontal line 109 shown in the difference image 105 is extracted, the pixel value graph 110 is shown. Therefore, in the horizontal line 109 shown in the pixel value graph 110, a region having a pixel value greater than or equal to a certain positive threshold k1, that is, the rightmost pixel 111 of the region 107 corresponding to the shadow 104 of the first image 101, A region having a pixel value equal to or less than a certain negative threshold value −k1, that is, the leftmost pixel 112 of the region 108 corresponding to the shadow 104 of the second image 102 is extracted. When this process is performed for all the horizontal lines of the difference image 105 and these are combined, an image 113 as shown in FIG. 1 is obtained.

次の前記第4のステップでは、前記第3のステップで得られた画像113において、前記抽出した右端の画素111より右側、及び前記抽出した左端の画素112より左側の領域に、あらかじめ定義した距離関数に従って距離を与える操作を、水平ライン毎に行う。この処理により、図1に示したような距離画像114が得られる。このとき、例えば、前記右端の画素111から右側に、前記左端の画素112あるいは他の右端の画素が現れるまでの範囲をあらかじめ定義した距離関数に従って蒲鉾状に盛り上げ、次に、前記左端の画素112から左側に、前記右端の画素110または他の左端の画素が現れるまでの範囲をあらかじめ定義した距離関数に従って蒲鉾状に重ねて盛り上げることで、前記撮影物体103のレリーフ調立体形状115を生成する。この距離画像114の生成操作の詳細な手続きは後の実施例にて説明する。   In the next fourth step, in the image 113 obtained in the third step, a distance defined in advance to the right side of the extracted right end pixel 111 and the left side of the extracted left end pixel 112 is determined. The operation for giving the distance according to the function is performed for each horizontal line. By this processing, the distance image 114 as shown in FIG. 1 is obtained. At this time, for example, a range from the right end pixel 111 to the right side until the left end pixel 112 or another right end pixel appears is raised according to a predefined distance function, and then the left end pixel 112 The relief solid three-dimensional shape 115 of the photographic object 103 is generated by superimposing and enlarging the range until the rightmost pixel 110 or other leftmost pixel appears on the left side from the left side in accordance with a predefined distance function. The detailed procedure for generating the distance image 114 will be described in a later embodiment.

なお、前記第4のステップにおける距離関数の定義式や距離関数の適用ルールには様々なバリエーションがあり、前記距離画像114の生成方法は、上記の例に限定するものではなく、本発明の趣旨を逸脱しない範囲の処理であるなら全て含まれるものとする。   Note that there are various variations in the distance function definition formula and distance function application rules in the fourth step, and the generation method of the distance image 114 is not limited to the above example, and the gist of the present invention. Any processing that does not deviate from the above is included.

次の前記第5のステップでは、図1に示したように、前記第4のステップで得られた距離画像114を垂直方向に平滑化し、3次元画像116を生成する。本発明の3次元画像生成方法では、撮影物体の距離変化が連続的であっても、前記第4のステップで得られた距離画像114は、異なる水平ライン間で距離が不連続に変化することがある。これは視覚的に大きな画質劣化を知覚させる要因である。そのため、垂直方向に平滑化することによって不連続な変化をなくし、視覚的な画質劣化を抑えるのが前記第5のステップの作用効果である。一方、前記第5のステップで生成される3次元画像116は、撮影物体の垂直方向の距離変化が不連続な部分も、連続的に変化するように生成されるが、この視覚的な影響は本来連続的な距離変化が不連続になってしまう場合と比較して軽微なので、総合的に見ると前記第5のステップは視覚的により品質の高い距離画像に変換する効果をもたらす。   In the next fifth step, as shown in FIG. 1, the distance image 114 obtained in the fourth step is smoothed in the vertical direction to generate a three-dimensional image 116. In the three-dimensional image generation method of the present invention, the distance image 114 obtained in the fourth step discontinuously changes between different horizontal lines even if the distance change of the photographed object is continuous. There is. This is a factor that visually perceives large image quality degradation. Therefore, the effect of the fifth step is to eliminate the discontinuous change by smoothing in the vertical direction and suppress visual image quality deterioration. On the other hand, the three-dimensional image 116 generated in the fifth step is generated so that a portion where the distance change in the vertical direction of the photographing object is discontinuous also changes continuously. The fifth step has an effect of visually converting to a higher-quality distance image when viewed comprehensively because the continuous distance change is inherently less discontinuous.

なお、前記第5のステップにおける平滑化の方法には様々な種類バリエーションがあり、本発明は特定の関数を用いた平滑化に限定するものではない。   There are various kinds of variations in the smoothing method in the fifth step, and the present invention is not limited to smoothing using a specific function.

図2及び図3は、本発明の3次元画像生成方法の原理を説明するための模式図であり、生成する3次元画像の信頼性を向上させるための方法の一例を説明するための図である。また、図2において、2は撮影物体(被写体)、3は撮影手段(カメラ)、4Aは第1照明手段、4Bは第2照明手段、5は背面である。   2 and 3 are schematic diagrams for explaining the principle of the three-dimensional image generation method of the present invention, and are diagrams for explaining an example of a method for improving the reliability of the generated three-dimensional image. is there. In FIG. 2, reference numeral 2 denotes a photographing object (subject), 3 denotes photographing means (camera), 4A denotes first illumination means, 4B denotes second illumination means, and 5 denotes a back surface.

前記第1のステップで取得する第1画像101及び第2画像102を撮影するときには、例えば、図2(a)に示すように、前記撮影物体2を撮影する撮影手段3の右側に第1照明手段4Aを配置し、前記撮影手段2の左側に第2照明手段4Bを配置しておく。そして、前記第1画像101を撮影するときには前記第1照明手段4Aで前記撮影物体2を照明しておき、前記第2画像102を撮影するときは、前記第2照明手段4Bで前記撮影物体2を照明しておく。   When photographing the first image 101 and the second image 102 acquired in the first step, for example, as shown in FIG. 2A, the first illumination is provided on the right side of the photographing means 3 for photographing the photographing object 2. The means 4A is arranged, and the second illumination means 4B is arranged on the left side of the photographing means 2. When the first image 101 is photographed, the photographing object 2 is illuminated by the first illumination means 4A, and when the second image 102 is photographed, the photographing object 2 is photographed by the second illumination means 4B. Illuminate.

このとき、前記第1照明手段4A及び第2照明手段4Bが、例えば、図2(b)に示すように、照射方向中心の照度が大きく、照射方向が中心から離れるにつれて照度が低下する場合、照射方向中心から離れた部分の照明は暗くなる。そのため、このような照明手段4A,4Bを用い、図2(a)に示したような配置で撮影して得られる前記第1画像101及び第2画像102は、前記撮影物体の輪郭部の影の他に、低照度のために暗くなった領域が生じる。このとき、前記暗くなった領域は、互いに反対方向に発生し、例えば、図2(c)に示すように、第1画像101は画面左側に暗くなった領域117が発生し、第2画像102は画面右側に暗くなった領域117が発生する。そのため、前記第1画像101及び前記第2画像102から差分画像105を求めると、図2(c)に示したように、前記差分画像105は、本来の、本発明の3次元画像生成方法で必要な撮影物体の輪郭部の影に相当する領域107,108だけでなく、低照度のために暗くなった領域に相当する領域118も抽出された画像になってしまう。このように、前記差分画像105に、3次元画像の生成に必要な前記撮影物体の輪郭部の影に相当する領域以外の領域が抽出されていると、後のステップで、その領域にも物体があるかのような処理を行ってしまうので、生成した3次元画像の信頼性が低下する。そこで、そのような問題が生じないよう、以下のような処理を行う。   At this time, when the first illuminating means 4A and the second illuminating means 4B are, for example, as shown in FIG. 2B, the illuminance at the center of the irradiation direction is large, and the illuminance decreases as the irradiation direction moves away from the center, The illumination in the part away from the center of the irradiation direction becomes dark. For this reason, the first image 101 and the second image 102 obtained by photographing using such illumination means 4A and 4B with the arrangement shown in FIG. 2A are shadows of the contour of the photographing object. In addition to this, an area darkened due to low illumination occurs. At this time, the darkened areas are generated in opposite directions. For example, as shown in FIG. 2C, a darkened area 117 is generated on the left side of the screen as shown in FIG. Produces a darkened area 117 on the right side of the screen. Therefore, when the difference image 105 is obtained from the first image 101 and the second image 102, as shown in FIG. 2 (c), the difference image 105 is the original three-dimensional image generation method of the present invention. In addition to the areas 107 and 108 corresponding to the shadows of the outline of the necessary photographic object, an area 118 corresponding to the area darkened due to low illumination is also extracted. As described above, when a region other than the region corresponding to the shadow of the contour portion of the photographed object necessary for generating the three-dimensional image is extracted from the difference image 105, the object is also included in the region in a later step. As a result, the reliability of the generated three-dimensional image is reduced. Therefore, the following processing is performed so that such a problem does not occur.

まず、図3に示すように、前記第1のステップにおいて、照度分布が図2(b)に示したような照明手段4A,4Bの下で撮影された第1画像101と第2画像102を取得する。このとき、前記第1画像101のある水平ライン119aに沿ってスキャンした画素値は画素値グラフ120のようになる。また、前記第2画像102の、前記第1画像101の水平ライン109aと同じ高さの水平ライン109bに沿ってスキャンした画素値は画素値グラフ121のようになる。このとき、前記第1画像101と第2画像102から求めた差分画像105における、前記水平ライン109a,109bと同じ高さの水平ラインの画素の値は、例えば、図3に示した画素値グラフ122のようになり、撮影物体の輪郭部の影に相当する領域107,108を除く領域123の画素値が、画面左端から右端に向かって増加していくような変化を示す。   First, as shown in FIG. 3, in the first step, the first image 101 and the second image 102 in which the illuminance distribution is photographed under the illumination means 4A and 4B as shown in FIG. get. At this time, the pixel value scanned along the horizontal line 119 a in which the first image 101 is present becomes a pixel value graph 120. Further, the pixel value scanned along the horizontal line 109 b of the second image 102 that is the same height as the horizontal line 109 a of the first image 101 becomes a pixel value graph 121. At this time, the pixel values of the horizontal lines having the same height as the horizontal lines 109a and 109b in the difference image 105 obtained from the first image 101 and the second image 102 are, for example, the pixel value graph shown in FIG. 122, indicating a change in which the pixel value of the region 123 excluding the regions 107 and 108 corresponding to the shadow of the contour portion of the photographic object increases from the left end of the screen toward the right end.

このように、撮影物体の輪郭部の影に相当する領域以外の領域123の画素が、大きな画素値を持つと、生成した3次元画像の信頼性が低下する。そのため、前記第3のステップを行う前に、図3に示した画素値グラフ122における、撮影物体の輪郭部の影に相当する領域以外の領域123の画素の値を、図1に示した画素値グラフ110のように、ほぼ0にするような処理を行い、前記差分画像122上の不要な成分を除去することが好ましい。   Thus, if the pixels in the region 123 other than the region corresponding to the shadow of the contour portion of the photographic object have a large pixel value, the reliability of the generated three-dimensional image is lowered. Therefore, before performing the third step, the pixel values in the region 123 other than the region corresponding to the shadow of the contour of the photographic object in the pixel value graph 122 shown in FIG. It is preferable to remove the unnecessary components on the difference image 122 by performing a process of making the value almost 0 as in the value graph 110.

前記差分画像122上の不要な成分を除去する処理では、まず、ステップAとして、差分画像122の各画素値の絶対値があらかじめ指定された閾値k2より大きい場合には、差分量の絶対値を閾値k2と置き換えることによって、前記画素値グラフ122を画素値グラフ124のように置き換える。これは±k2の範囲でクリッピング処理を行うことを意味する。   In the process of removing unnecessary components on the difference image 122, first, as Step A, when the absolute value of each pixel value of the difference image 122 is larger than a predetermined threshold value k2, the absolute value of the difference amount is calculated. The pixel value graph 122 is replaced like a pixel value graph 124 by replacing with the threshold value k2. This means that clipping processing is performed within a range of ± k2.

前記ステップAの作用の効果を説明する。以降に続くステップBは、本来差分量が0であるはずの領域を0に近づける処理であるが、閾値を超えた領域は元々差分量が0ではない影である可能性が高い領域なので、この領域まで含めてステップBの処理を行うと十分な精度で処理ができない。前記ステップAは、閾値を超えた領域の画素値の大きさを抑えることによってこの悪影響を小さくする効果を有する。   The effect of step A will be described. The subsequent step B is a process of bringing the area where the difference amount should originally be 0 close to 0, but the area exceeding the threshold is an area that is likely to be a shadow whose difference amount is not 0. If the process of step B including the region is performed, the process cannot be performed with sufficient accuracy. The step A has an effect of reducing this adverse effect by suppressing the size of the pixel value in the region exceeding the threshold value.

次に、ステップBとして、差分画像の各水平ラインに対して、以下で述べるステップB1及びステップB2の2つのステップによる処理を行う。   Next, as step B, the process according to the two steps of step B1 and step B2 described below is performed on each horizontal line of the difference image.

前記ステップB1では、前記差分画像105の各水平ラインの画素値の分布形状を近似するように、あらかじめ指定された近似式のパラメータを決定する。このとき、例えば、前記近似式がy=ax+bの直線である場合、パラメータa,bを前記画素値グラフ124の画素値の並び(分布形状)から、最小二乗法で求めることによって近似式125を生成する。なお、この近似は、直線近似以外にも様々なバリエーションがあり、本発明の3次元画像生成方法で用いる近似は、直線近似または後の実施例で示す移動直線近似に限定するものではない。   In step B1, a parameter of an approximate expression designated in advance is determined so as to approximate the distribution shape of pixel values of each horizontal line of the difference image 105. At this time, for example, when the approximate expression is a straight line of y = ax + b, the approximate expression 125 is obtained by obtaining the parameters a and b by the least square method from the arrangement (distribution shape) of the pixel values of the pixel value graph 124. Generate. This approximation has various variations other than the linear approximation, and the approximation used in the three-dimensional image generation method of the present invention is not limited to the linear approximation or the moving linear approximation shown in the following embodiments.

また、前記ステップB2では、前記水平ラインの画素毎に、画素値からその画素位置における近似値を減ずる。この結果、図3に示したように、3次元画像の生成に不要な領域、すなわち撮影物体の輪郭部の影に相当する領域107,108以外の領域123の画素値が0に近い画素値グラフ126が得られる。前記ステップB(B1,B2)の作用によって、前記照明手段4A,4Bの照度ムラの影響を除去することが可能となる。   In Step B2, the approximate value at the pixel position is subtracted from the pixel value for each pixel on the horizontal line. As a result, as shown in FIG. 3, a pixel value graph in which the pixel value of the region 123 other than the regions 107 and 108 corresponding to the shadow of the outline of the photographic object is close to 0, as is unnecessary for generating the three-dimensional image. 126 is obtained. By the action of the step B (B1, B2), it becomes possible to remove the influence of the illuminance unevenness of the illumination means 4A, 4B.

ここで説明した、前記ステップA,前記ステップB1,前記ステップB2の一連の処理を1ステップとして、前記差分画像105の全ての水平ラインに対して処理を行うことによって、低照度のために暗くなった領域117がある第1画像101及び第2画像102から生成した差分画像105を、照度ムラの影響を除去した差分画像に置換することができる。この後は、前記第3のステップ以降を実行していけば、信頼性の高い3次元画像を生成することができる。   The series of processing of Step A, Step B1, and Step B2 described here is set as one step, and the processing is performed on all the horizontal lines of the difference image 105, thereby darkening due to low illuminance. The difference image 105 generated from the first image 101 and the second image 102 having the region 117 can be replaced with a difference image from which the influence of illuminance unevenness is removed. Thereafter, if the third and subsequent steps are executed, a highly reliable three-dimensional image can be generated.

なお、図3では、1回の処理で前記画素値グラフ127が求まるように示しているが、前記照明手段4A,4Bの照度ムラが大きく、例えば、前記画素値グラフ122における領域123の傾斜が大きい場合、または照明の光量が小さく前記画素値グラフ122における撮影物体の輪郭部の影に相当する領域107,108の画素値の大きさが十分でない場合には、あらかじめ大きな閾値k2を与えて前記ステップA,前記ステップB1,前記ステップB2の一連の処理を反復し、反復する毎に閾値k2の値を小さくすることによって前記画素値グラフ126のようになる差分画像を求める。また、反復する場合には、1ステップ内での前記各ステップの実行順序は、ステップA,ステップB1,ステップB2の順でも、ステップB1,ステップB2,ステップAの順でも構わない。   In FIG. 3, the pixel value graph 127 is shown to be obtained in one process. However, the illumination means 4A and 4B have large illuminance unevenness. For example, the slope of the region 123 in the pixel value graph 122 is If the pixel value of the areas 107 and 108 corresponding to the shadow of the contour portion of the photographic object in the pixel value graph 122 is not sufficient in the case where the amount of illumination is small or the pixel value graph 122 is small, a large threshold k2 is given in advance. A series of processes of Step A, Step B1, and Step B2 are repeated, and a difference image that looks like the pixel value graph 126 is obtained by decreasing the value of the threshold value k2 each time it is repeated. In the case of repetition, the execution order of the steps within one step may be the order of step A, step B1, step B2, or the order of step B1, step B2, step A.

このような方法によって、照度ムラのある照明下で撮影された画像を取得した場合でも、差分画像105の不要な成分を取り除くことができる。そのため、後のステップで信頼性の高い距離画像(3次元画像)を生成することができる。   With such a method, even when an image taken under illumination with uneven illumination is acquired, unnecessary components of the difference image 105 can be removed. Therefore, a reliable distance image (three-dimensional image) can be generated in a later step.

また、前記差分画像105の不要な成分を取り除く処理は、前記ステップA,前記ステップB1,前記ステップB2による処理に限らず、別の処理であってもよい。   Further, the process of removing unnecessary components from the difference image 105 is not limited to the process by the step A, the step B1, and the step B2, and may be another process.

は、本発明の3次元画像生成方法の原理を説明するための模式図であり、ノイズの影響を除去する方法の一例を説明するための図である。 FIG. 4 is a schematic diagram for explaining the principle of the three-dimensional image generation method of the present invention, and is a diagram for explaining an example of a method for removing the influence of noise.

本発明の3次元画像生成方法では、前記第3のステップにおいて生成された画像113は、図(a)に示すように、撮影物体の左側の輪郭に相当する領域111の画素と右側の輪郭に相当する領域112の画素が抽出される。このとき、前記撮影物体の左側の輪郭に相当する領域111に抽出された画素は、主に、図(b)に示すように、画像139の撮影物体103の左側に生じた影104aに相当する領域の右端の画素である。また、前記撮影物体の右側の輪郭に相当する領域112に抽出された画素は、主に、図(b)に示した画像139上の撮影物体103の右側に生じた影104bに相当する領域の左端の画素である。そのため、本来なら、前記各領域111,112の画素は、垂直方向に連続して並ぶはずであるが、ノイズの影響などによって、例えば、図(a)に示したように、局所的な途切れ140が生じ、部分的に欠落することがある。 The three-dimensional image generation method of the present invention, the third image 113 generated in step, as shown in FIG. 4 (a), pixel and right of the contour of a region 111 corresponding to the left side of the contour of the shooting object Pixels in the region 112 corresponding to are extracted. At this time, the left side of the pixels extracted in the area 111 corresponding to the contour of the shooting object is mainly, as shown in FIG. 4 (b), corresponds to a shadow 104a occurring on the left side of the imaging object 103 in the image 139 This is the pixel at the right end of the area to be processed. Also, the right side of the pixels extracted in the area 112 corresponding to the contour of the shooting object is mainly equivalent to the shadow 104b caused the right side of the imaging object 103 in the image 139 shown in FIG. 4 (b) region Is the leftmost pixel. Therefore, if the original pixel of the respective regions 111 and 112, but it should continuously lined up in the vertical direction, the influence of noise, for example, as shown in FIG. 4 (a), a local break 140 may occur and may be partially missing.

そこで、部分的な欠落を解消するために、前記第3のステップで求めた画像113内の右端の画素と左端の画素の各々について、大局的には垂直方向につながっている画素の集まり111と112において局部的な途切れ140が存在する場合に、途切れた部分を上下の画素により補間して右端の画素または左端の画素とする処理を行う。この結果、例えば、図4(c)に示すように、ノイズの影響が除去された画像141が生成される。そのため、ノイズが存在する場合であっても、品質の高い3次元画像を生成できる。 Therefore, in order to eliminate the partial omission, for each of the rightmost pixel and the leftmost pixel in the image 113 obtained in the third step, a collection 111 of pixels that are generally connected in the vertical direction; When a local discontinuity 140 exists at 112, the discontinuous portion is interpolated by the upper and lower pixels to perform processing to obtain a right end pixel or a left end pixel. As a result, for example, as shown in FIG. 4C, an image 141 from which the influence of noise is removed is generated. Therefore, even when noise is present, a high-quality three-dimensional image can be generated.

前記第3のステップで求めた画像内の途切れた部分を補間する方法の詳細は、後の実施例で説明するが、本発明は、途切れた部分を補間する方法を限定するものではなく、途切れた部分を上下の画素より補間する方法であるならば、どのような方法であってもよい。   The details of the method for interpolating the interrupted portion in the image obtained in the third step will be described in a later embodiment. However, the present invention does not limit the method for interpolating the interrupted portion, and the interrupted portion is not limited. Any method may be used as long as it is a method of interpolating the portion from the upper and lower pixels.

は、本発明の3次元画像生成方法の原理を説明するための模式図であり、色画像の生成方法を説明するための図である。 FIG. 5 is a schematic diagram for explaining the principle of the three-dimensional image generation method of the present invention, and is a diagram for explaining the color image generation method.

本発明の3次元画像生成方法では、前記第1のステップにおいて、撮影手段から水平方向に一定距離離れた位置から照明して撮影した第1画像101を取得するとともに、撮影手段から前記水平方向と反対方向に一定距離離れた位置から照明して撮影した第2画像102を取得する。   In the three-dimensional image generation method of the present invention, in the first step, the first image 101 obtained by illuminating from a position that is a certain distance in the horizontal direction from the photographing unit is obtained, and the horizontal direction is obtained from the photographing unit. A second image 102 obtained by illuminating from a position separated by a certain distance in the opposite direction is acquired.

一般に、3次元画像を生成する場合、前記第1のステップで、同時に撮影物体の色情報を撮影することが多く、実際に3次元画像を表示するときには、図(a)に示すように、前記撮影物体の色情報を用いた色画像142を生成し、それを立体化して表示する。しかしながら、前記第1画像101あるいは前記第2画像102の色情報をそのまま使うと、撮影物体103の右側あるいは左側が、影104できつく縁取られた画像になってしまう。また、単に第1画像101と第2画像102の平均を求める、あるいは二つの照明を同時に使用して撮影する方法では、図(b)に示すように、影の部分104cが薄く残った色画像143になってしまい、影を完全に除去することが出来ない。また、一般の撮影のように広範囲な位置から複数の間接照明を当てて影を目立たなくする方法では、照明手段の小型化、携帯化を実現することが出来ない。 In general, when generating a three-dimensional image, in the first step, often taking a color information of the photographing object at the same time, when actually displaying three-dimensional images, as shown in FIG. 5 (a), A color image 142 using the color information of the photographed object is generated, and is displayed in a three-dimensional form. However, if the color information of the first image 101 or the second image 102 is used as it is, the right side or the left side of the photographic object 103 becomes an image with a sharp border 104. Furthermore, just in the method of imaging using the first image 101 obtains an average of the second image 102, or two lighting simultaneously, as shown in FIG. 5 (b), shaded portions 104c remained thin color It becomes an image 143, and the shadow cannot be completely removed. In addition, the method of making a shadow inconspicuous by applying a plurality of indirect illuminations from a wide range of positions as in general photography cannot achieve downsizing and portability of illumination means.

そこで、前記第1のステップで取得した第1画像101と前記第2画像102の同位置の画素を比較して、輝度値が大きいほうの画素を選択することによって撮影物体の色画像141を生成する。このとき、例えば、どちらかの画像において影となっている位置の画素については、常に輝度値の大きい画素が選択されるので生成される画像142は影の映らない画像となる。つまり、例えば、図(a)に示したように、第1画像101の領域144aの画素の輝度値と、前記領域144aに相当する第2画像102の領域144bの画素の輝度値を比較した場合、影になっている第1画像101の画素の輝度値よりも、照明が当たっている第2画像102上の画素の方が輝度値が大きいので、前記色画像142の領域145の画素の輝度値には、前記第2画像102上の画素の輝度値が採用される。そのため、影のない色画像を容易に生成することができる。 Therefore, the color image 141 of the shooting object is generated by comparing the pixels at the same position in the first image 101 and the second image 102 acquired in the first step and selecting the pixel having the larger luminance value. To do. At this time, for example, for a pixel in a shadowed position in either image, a pixel having a large luminance value is always selected, so that the generated image 142 is an image without a shadow. That is, for example, as shown in FIG. 5 (a), was compared with the luminance value of the pixel area 144a of the first image 101, the luminance value of the pixels in the region 144b of the second image 102 corresponding to the area 144a In this case, since the luminance value of the pixel on the second image 102 that is illuminated is larger than the luminance value of the pixel of the first image 101 that is in shadow, the pixel of the region 145 of the color image 142 As the luminance value, the luminance value of the pixel on the second image 102 is adopted. Therefore, a color image without a shadow can be easily generated.

なお、この処理は、本発明の3次元画像生成方法と組み合わせると、同じ画像を利用できるので効率が良いが、単独で普通の画像撮影に用いても有用である。   This process is efficient when combined with the three-dimensional image generation method of the present invention because the same image can be used, but it is also useful when used alone for normal image shooting.

は、本発明の3次元画像生成装置の概略構成を示す模式図である。また、図において、2は撮影物体、3は撮影手段(カメラ)、4Aは撮影手段の右側水平方向に一定距離離れた位置にある第1照明手段(第1ライト)、4Bは第1照明手段とは反対方向(左側水平方向)に一定距離離れた位置にある第2照明手段(第2ライト)、6は3次元画像生成装置、601は画像取得手段、602は3次元形状生成手段、603はカメラ/ライト制御手段、7は画像表示手段である。 FIG. 6 is a schematic diagram showing a schematic configuration of the three-dimensional image generation apparatus of the present invention. In FIG. 6 , reference numeral 2 denotes a photographic object, 3 denotes a photographic means (camera), 4A denotes a first illuminating means (first light) located at a fixed distance in the right horizontal direction of the photographic means, and 4B denotes a first illumination. Second illumination means (second light) located at a fixed distance in the opposite direction (left horizontal direction) to the means, 6 is a three-dimensional image generation device, 601 is an image acquisition means, 602 is a three-dimensional shape generation means, Reference numeral 603 denotes camera / light control means, and 7 denotes image display means.

本発明の3次元画像生成方法を実現する3次元画像生成装置6は、例えば、図に示すように、撮影手段(カメラ)3で撮影した画像を取得する画像取得手段601と、前記画像取得手段601で取得した画像を用いて、画像に写っている撮影物体2の3次元形状を生成する3次元形状生成手段と、前記撮影手段3及び前記撮影手段3の左右に配置された第1照明手段4A及び第2照明手段4Bを制御するカメラ/ライト制御手段603とを備える。 For example, as shown in FIG. 6 , the 3D image generation apparatus 6 that implements the 3D image generation method of the present invention includes an image acquisition unit 601 that acquires an image captured by an imaging unit (camera) 3, and the image acquisition unit. Using the image acquired by the means 601, a three-dimensional shape generating means for generating a three-dimensional shape of the photographed object 2 shown in the image, and a first illumination arranged on the left and right of the photographing means 3 and the photographing means 3 And a camera / light control means 603 for controlling the means 4A and the second illumination means 4B.

このとき、前記照明手段は、前記撮影手段の右側に一定距離離れた位置に第1照明手段4A、前記第1照明手段4Bとは反対側(左側)に一定距離離れた位置に第2照明手段4Bを配置しており、前記カメラ/ライト制御手段603によって、どちらか一方が点灯するように制御される。   At this time, the illuminating means includes a first illuminating means 4A at a position separated by a certain distance on the right side of the photographing means and a second illuminating means at a position separated by a certain distance on the opposite side (left side) from the first illuminating means 4B. 4B is arranged and is controlled by the camera / light control means 603 so that one of them is lit.

また、前記撮影手段3は、通常のカメラであり、前記カメラ/ライト制御手段603によって前記第1照明手段4Aまたは第2照明手段4Bのどちらかを点灯して撮影物体2を照らした状態で前記撮影物体を撮影し、撮影した画像を前記画像取得手段601に転送する。   The photographing means 3 is a normal camera, and the camera / light control means 603 lights the photographing object 2 in a state where either the first illumination means 4A or the second illumination means 4B is turned on. The photographed object is photographed, and the photographed image is transferred to the image acquisition means 601.

また、前記3次元形状生成手段602は、前記図1乃至図に沿って説明したような方法で、前記画像取得手段601で取得した画像に写っている撮影物体2の3次元形状を求め、3次元画像を生成する手段である。前記3次元形状生成手段602で生成した3次元画像は、例えば、液晶ディスプレイ等の画像表示手段7に表示される。 Further, the three-dimensional shape forming unit 602, FIG. 1 to in the manner described with reference to FIG. 5, we obtain a three-dimensional shape of the imaging object 2 is reflected in the image acquired by the image acquisition unit 601, A means for generating a three-dimensional image. The three-dimensional image generated by the three-dimensional shape generation unit 602 is displayed on the image display unit 7 such as a liquid crystal display, for example.

前記3次元画像生成装置6は、撮影手段3、第1照明手段4A、第2照明手段4Bの3つの手段を用いて撮影した2枚の画像から3次元画像を生成することができる。そのため、極めて低コストかつ小型に構成することができ、携帯型端末への搭載も容易である利点がある。また、照明もレーザ等の特殊な光源を必要としないため安全性が高い利点も有する。   The three-dimensional image generation apparatus 6 can generate a three-dimensional image from two images captured using the three units of the imaging unit 3, the first illumination unit 4A, and the second illumination unit 4B. Therefore, there is an advantage that it can be configured to be extremely low cost and small and can be easily mounted on a portable terminal. Moreover, since illumination does not require a special light source such as a laser, it has an advantage of high safety.

以下、本発明の3次元画像生成方法及び3次元画像生成装置に関する実施例を説明する。   Embodiments relating to a 3D image generation method and a 3D image generation apparatus according to the present invention will be described below.

乃至図1は、本発明による実施例1の3次元画像生成方法を説明するための模式図であり、図は全体の処理手順を示すフロー図、図は図のステップ803の処理の具体例を示すフロー図、図乃至図1は図のステップ805の処理の具体例を示すフロー図、図1及び図1はステップ805の作用を説明するための図である。 7 to 1 3 is a schematic diagram for explaining the three-dimensional image generation method of Example 1 according to the present invention, FIG. 7 is a flow diagram showing an overall processing procedure, Figure 8 is step 803 of FIG. 7 flow diagram showing a specific example of the process of the flow diagram FIG. 9 to FIG. 1 1 is showing a specific example of the processing of step 805 of FIG. 7, diagram for explaining the operation of Figure 1 2 and 1 3 step 805 It is.

本実施例1の3次元画像生成方法は、図に示すように、第1画像P1及び第2画像P2を取得するステップ801と、前記第1画像P1(101)と前記第2画像P2(102)の差分画像P3(105)を生成するステップ802と、前記差分画像P3の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左側の画素を、水平ライン毎に抽出するステップ803と、画素値を0に初期化した画像P4を用意するステップ804と、前記ステップ803で抽出した前記右端の画素よりも右側の領域、及び前記左端の画素よりも左側の領域に、あらかじめ定義した距離関数に従って距離を与える処理を、水平ライン毎に行って距離画像を生成するステップ805と、前記距離画像を垂直方向に平滑化して3次元画像を生成するステップ806とを有する。ここで、前記ステップ801は前記第1のステップに相当し、前記ステップ802は前記第2のステップに相当し、前記ステップ803は前記第3のステップに相当し、前記ステップ805は前記第4のステップに相当し、前記ステップ806は前記第5のステップに相当する。 As shown in FIG. 7 , the three-dimensional image generation method according to the first embodiment includes a step 801 for acquiring a first image P1 and a second image P2, a first image P1 (101), and a second image P2 ( 102) for generating the difference image P3 (105) in step 102, the rightmost pixel of the region having a pixel value greater than or equal to a certain positive threshold value k1, and a pixel value equal to or less than a certain negative threshold value −k1. Step 803 for extracting the pixel on the left side of the region having the pixel value for each horizontal line, Step 804 for preparing the image P4 with the pixel value initialized to 0, and the pixel on the right side of the pixel on the right side extracted in Step 803 A step 805 of generating a distance image by performing a process for giving a distance to the region and a region on the left side of the leftmost pixel according to a predefined distance function for each horizontal line; and the distance image And a step 806 of generating a 3-dimensional image is smoothed in a vertical direction. Here, the step 801 corresponds to the first step, the step 802 corresponds to the second step, the step 803 corresponds to the third step, and the step 805 corresponds to the fourth step. Step 806 corresponds to the fifth step.

以下、前記各ステップの処理について、詳細な説明をする。なお、前記各画像のサイズはX行Y列とする。また、以下の説明では、各画像Pr(r=1,2,3,…,n)上の座標(x,y)の画素値は、Pr(x,y)と記述し、画像Prのある水平方向のライン画像をLr、ライン画像Lrのx座標の画素値をLr(x)と記述する。この定義よりy列目のライン画像上の画素値Lr(x)はPr(x,y)に等しい。また、本実施例1では、モノクロ画像を対象とし、画素値はスカラー値であるとする。   Hereinafter, the processing of each step will be described in detail. The size of each image is X rows and Y columns. In the following description, the pixel value of the coordinates (x, y) on each image Pr (r = 1, 2, 3,..., N) is described as Pr (x, y), and there is an image Pr. The horizontal line image is described as Lr, and the pixel value of the x coordinate of the line image Lr is described as Lr (x). From this definition, the pixel value Lr (x) on the line image in the y-th column is equal to Pr (x, y). In the first embodiment, it is assumed that a monochrome image is a target and the pixel value is a scalar value.

まず、前記ステップ801において、撮影手段から水平方向に一定距離離れた位置から照明して撮影した第1画像P1を取得する。このとき、前記撮影手段から取得する第1画像P1は、モノクロ画像でもRGB形式のカラー画像でもよいが、前記カラー画像を取得した場合は、下記数式1に従ってモノクロ画像に変換する。   First, in step 801, a first image P1 obtained by illuminating from a position that is a certain distance in the horizontal direction from the photographing means is obtained. At this time, the first image P1 acquired from the photographing unit may be a monochrome image or an RGB color image. However, when the color image is acquired, the first image P1 is converted into a monochrome image according to Equation 1 below.

Figure 0004155401
Figure 0004155401

ここで、P(x,y)Red,P(x,y)Green,P(x,y)Blueはそれぞれ、前記カラー画像の各画素に記録されたカラー情報である。   Here, P (x, y) Red, P (x, y) Green, and P (x, y) Blue are color information recorded in each pixel of the color image.

また、前記第1画像P1を取得したら、続けて、前記撮影手段から前記水平方向と反対方向に一定距離離れた位置から照明して撮影した第2画像P2を取得する。取得する前記第2画像P2も、前記第1画像P1と同様、モノクロ画像でもカラー画像でもよいが、前記カラー画像を取得した場合は、前記数式1に従ってモノクロ画像に変換する。   In addition, when the first image P1 is acquired, the second image P2 captured by illuminating from a position away from the imaging unit by a certain distance in the direction opposite to the horizontal direction is acquired. Similarly to the first image P1, the second image P2 to be acquired may be a monochrome image or a color image. However, when the color image is acquired, it is converted into a monochrome image according to the equation 1.

次に、ステップ802において、前記第1画像P1と前記第2画像P2から、下記数式2に従って差分画像P3を生成する。   Next, in step 802, a difference image P3 is generated from the first image P1 and the second image P2 according to the following mathematical formula 2.

Figure 0004155401
Figure 0004155401

次に、前記ステップ803において、前記差分画像P3の各水平ラインに対して、図に示すような処理を行う。ここでは、画像Pのyライン目のライン画像Lのx座標の画素値をL(x)と記述する。このとき、L(x)=P(x,y)である。 Next, in step 803, a process as shown in FIG. 8 is performed on each horizontal line of the difference image P3. Here, the pixel value of the x coordinate of the line image L of the y-th line of the image P is described as L (x). At this time, L (x) = P (x, y).

前記ステップ803の処理では、まず、図に示すように、前記差分画像P3の水平ラインL3に関するパラメータ(y)を初期化する(ステップ803a)。 In the process of step 803, first, as shown in FIG. 8 , the parameter (y) relating to the horizontal line L3 of the difference image P3 is initialized (step 803a).

次に、水平ラインL3の各画素の値を、下記数式3にしたがって変換し、ライン画像L31を生成する(ステップ803b)。   Next, the value of each pixel of the horizontal line L3 is converted according to the following mathematical formula 3 to generate a line image L31 (step 803b).

Figure 0004155401
Figure 0004155401

ここで、k1はあらかじめ与えられた正の値の閾値である。   Here, k1 is a positive threshold value given in advance.

次に、前記ステップ803bで生成したライン画像L31の各画素の値を、下記数式4にしたがって変換し、ライン画像L32を生成する(ステップ803c)。   Next, the value of each pixel of the line image L31 generated in the step 803b is converted according to the following mathematical formula 4 to generate a line image L32 (step 803c).

Figure 0004155401
Figure 0004155401

前記数式4の作用の結果、正の閾値k1以上の画素値を有する画素列の右端の画素が値1、ある負の閾値−k1以下の画素値を有する画素列の左端の画素が値−1として抽出される。   As a result of the operation of Equation 4, the rightmost pixel of the pixel column having a pixel value greater than or equal to the positive threshold value k1 has a value of 1, and the leftmost pixel of the pixel column having a pixel value of a certain negative threshold value −k1 or less has a value of −1. Extracted as

前記水平ラインL3に対するライン画像L32を生成したら、水平ラインL3のパラメータ(y)を更新し(ステップ803d)、全ての水平ラインで前記ライン画像L32を生成する処理を行ったかどうかの判定する(ステップ803e)。ここで、未処理の水平ラインL3があれば、前記ステップ803bに戻って処理を繰り返す。また、全ての水平ラインL3に対する処理が済んでいれば、前記差分画像P3の各水平ラインL3を前記ライン画像L32に置き換えて(ステップ803f)、前記ステップ803の処理を終了する。前記ステップ803の処理を行った結果、図1に示した画像113のような画像が得られる。   When the line image L32 for the horizontal line L3 is generated, the parameter (y) of the horizontal line L3 is updated (step 803d), and it is determined whether or not the process of generating the line image L32 for all horizontal lines has been performed (step). 803e). If there is an unprocessed horizontal line L3, the process returns to step 803b and the process is repeated. If all the horizontal lines L3 have been processed, each horizontal line L3 in the difference image P3 is replaced with the line image L32 (step 803f), and the process in step 803 is terminated. As a result of the processing in step 803, an image such as the image 113 shown in FIG. 1 is obtained.

次に、前記ステップ804において、全ての画素値を0とした距離画像P4を用意する。ここで、画素値0は最も遠い距離を表し、距離が小さくなるにつれて画素値は大きくなるものとする。   Next, in step 804, a distance image P4 with all pixel values set to 0 is prepared. Here, the pixel value 0 represents the farthest distance, and the pixel value increases as the distance decreases.

次に、前記ステップ805において、ライン画像L32に置換した差分画像P3(以下、画像P32とする)の各水平ラインのライン画像L32に対して、図乃至図1に示したような処理を行う。 Next, in Step 805, the difference image P3 (hereinafter, the image P32 to) substituted on the line image L32 to the line image L32 of each horizontal line of the processing shown in FIGS. 9 to 1 1 Do.

前記ステップ805では、まず、図に示すように、前記画像P32のライン画像L32に関するパラメータ(y)を初期化する(ステップ805a)。 In step 805, first, as shown in FIG. 9 , the parameter (y) relating to the line image L32 of the image P32 is initialized (step 805a).

次に、前記ライン画像L32の左端の画素から順に画素値を調べ、L32(i)=1である画素が現れたら、その座標iを記録する(ステップ805b)。   Next, pixel values are examined in order from the leftmost pixel of the line image L32, and when a pixel with L32 (i) = 1 appears, its coordinate i is recorded (step 805b).

その後、引き続き前記ライン画像L32の座標iの右側の画素の画素値を調べ、L32(j)≠0である画素が現れたら、その座標jを記録する(ステップ805c)。   Subsequently, the pixel value of the pixel on the right side of the coordinate i in the line image L32 is checked, and when a pixel with L32 (j) ≠ 0 appears, the coordinate j is recorded (step 805c).

次に、前記距離画像P4の、前記ライン画像L32と同じ高さの水平ライン上のライン画像L4の座標iから座標jまでの画素の画素値に、下記数式5で与えられる距離値z(x)を加算する(ステップ805d)。   Next, the distance value z (x) given by the following equation 5 is added to the pixel value of the pixel from the coordinate i to the coordinate j of the line image L4 on the horizontal line having the same height as the line image L32 of the distance image P4. ) Are added (step 805d).

Figure 0004155401
Figure 0004155401

ここで、k(0<k<1)とz0は、あらかじめ与えられたパラメータである。   Here, k (0 <k <1) and z0 are parameters given in advance.

前記数式5によって生成される距離画像P4のライン画像L4の画素値の一例を図1(a)に示す。図1(a)は、前記数式5に従って生成される距離画像P4のライン画像L4であり、z0は手前へ飛び出す大きさ、kは飛び出し中心の位置を表す。なお、距離関数は前記数式5以外にも様々な式を適用することが可能であり、本発明は、前記距離関数を前記数式5に限定するものではない。 An example pixel values of the line image L4 range image P4 generated by the Equation 5 shown in FIG. 1 2 (a). Figure 1 2 (a) is a line image L4 range image P4 which is generated in accordance with Equation 5, z0 is sized to pop out to the front, k represents the position of the center jump out. Note that various formulas other than the formula 5 can be applied to the distance function, and the present invention does not limit the distance function to the formula 5.

次に、前記ライン画像L32の右端の画素まで調べ終わったか判定し(ステップ805e)、前記ライン画像L32の右端の画素まで調べ終わっていない場合は、L32(j)=1であるか判定し(ステップ805f)。ここで、L32(j)=1であるなら、i=jとして(ステップ805g)、前記ステップ805dに戻る。また、前記ステップ805fの判定でL32(j)≠1であるならステップ805cに戻る。   Next, it is determined whether the right end pixel of the line image L32 has been examined (step 805e). If the right end pixel of the line image L32 has not been examined, it is determined whether L32 (j) = 1 ( Step 805f). If L32 (j) = 1, i = j is set (step 805g), and the process returns to step 805d. On the other hand, if L32 (j) ≠ 1 in the determination in step 805f, the process returns to step 805c.

また、前記ステップ805eで、ライン画像L32の右端まで調べたと判定された場合は、図1に示すステップ805hに進む。 Further, in step 805e, if it is determined that the examined and the right edge of the line image L32, the process proceeds to step 805h shown in FIG. 1 0.

前記ステップ805hでは、前記ライン画像L32の右端の画素から順に画素値を調べ、L32(i)=−1である画素が現れたら、その座標iを記録する。その後、引き続き前記ライン画像L32の座標iの左側の画素の画素値を調べ、L32(j)≠0である画素が現れたら、座標jを記録する(ステップ805i)。   In step 805h, pixel values are examined in order from the rightmost pixel of the line image L32, and when a pixel with L32 (i) = − 1 appears, its coordinate i is recorded. Thereafter, the pixel value of the pixel on the left side of the coordinate i of the line image L32 is checked, and when a pixel with L32 (j) ≠ 0 appears, the coordinate j is recorded (step 805i).

次に、前記距離画像P4の、前記ライン画像L32と同じ高さの水平ライン上のライン画像L4の座標iから座標jまでの画素の画素値に、前記数式5で与えられる距離値z(x)を加算する(ステップ805j)。このとき、生成される距離画像P4のライン画像L4の各画素に加算される距離値z(x)は、例えば、図1(b)に示すようになる。 Next, the distance value z (x) given by the equation 5 is added to the pixel value of the pixel from the coordinate i to the coordinate j of the line image L4 on the horizontal line having the same height as the line image L32 in the distance image P4. ) Are added (step 805j). The distance value z is added to each pixel of the line image L4 range image P4 generated (x) is, for example, as shown in FIG. 1 2 (b).

次に、前記ライン画像L32の左端の画素まで調べ終わったか判定し(ステップ805k)、前記ライン画像L32の右端の画素まで調べ終わっていない場合は、L32(j)=1であるか判定し(ステップ805l)。ここで、L32(j)=1であるなら、i=jとして(ステップ805m)、前記ステップ805jに戻る。また、前記ステップ805mの判定でL32(j)≠1であるならステップ805iに戻る。   Next, it is determined whether the leftmost pixel of the line image L32 has been checked (step 805k). If the rightmost pixel of the line image L32 has not been checked, it is determined whether L32 (j) = 1 ( Step 805l). If L32 (j) = 1, i = j is set (step 805m) and the process returns to step 805j. On the other hand, if L32 (j) ≠ 1 in the determination in step 805m, the process returns to step 805i.

また、前記ステップ805kで、ライン画像L32の右端まで調べたと判定された場合は、図1に示すステップ805nに進む。 Further, in step 805K, if it is determined that the examined and the right edge of the line image L32, the process proceeds to step 805n shown in FIG 1.

前記ステップ805nでは、前記画像P32のライン画像L32を更新し、その後、全てのライン画像L32で処理を行ったか判定する(ステップ805o)。ここで、未処理のライン画像L32があれば、ステップ805bに戻り、前記各ステップの処理を実行する。   In step 805n, the line image L32 of the image P32 is updated, and then it is determined whether all the line images L32 have been processed (step 805o). Here, if there is an unprocessed line image L32, the process returns to step 805b to execute the processing of each step.

また、前記ステップ805oで、全てのライン画像L32に対する処理を行ったと判定したら、前記距離画像4の各水平ラインのライン画像を、前記ライン画像L32から生成したライン画像L4に置き換え、例えば、図1に示したような距離画像114を生成し(ステップ805p)、前記ステップ805を終了する。   If it is determined in step 805o that all the line images L32 have been processed, the line image of each horizontal line in the distance image 4 is replaced with the line image L4 generated from the line image L32, for example, FIG. Is generated (step 805p), and the step 805 is terminated.

前記ステップ805では、前記ステップ805bからステップ805mの処理を全水平ラインに行うことによって距離画像P4を求め、前記第4のステップの処理が実現することになる。しかしながら、本実施例1で説明した前記各ステップによる処理は、前記第4のステップを実現する具体的な一例に過ぎない。したがって、ここで説明したアルゴリズム(処理手順)以外のアルゴリズムであっても、本実施例1で説明したような、前記右端の画素より右側の領域、及び前記左端の画素より左側の領域に、あらかじめ定義した距離関数に従って距離を与える作用をもたらすアルゴリズムであるならよい。   In step 805, the distance image P4 is obtained by performing the processing from step 805b to step 805m on all horizontal lines, and the processing in the fourth step is realized. However, the processing by each step described in the first embodiment is only a specific example for realizing the fourth step. Therefore, even if an algorithm other than the algorithm (processing procedure) described here is used, an area on the right side of the rightmost pixel and an area on the left side of the leftmost pixel as described in the first embodiment are preliminarily provided. Any algorithm that provides an effect of giving a distance according to a defined distance function may be used.

前記ステップ805によって生成される距離画像P4について、図1に示す画像146を例に挙げてもう少し詳しく説明する。前記画像146の、ある水平ライン147上に着目すると、前記ステップ803の処理を行うことにより、前記水平ライン147におけるライン画像L32の各画素の画素値は画素値グラフ148のようになる。 For range image P4 generated by the step 805 will be described in more detail by way of example image 146 illustrated in FIG 3. When attention is paid to a certain horizontal line 147 in the image 146, the pixel value of each pixel of the line image L 32 in the horizontal line 147 becomes a pixel value graph 148 by performing the processing in step 803.

次に、前記ステップ805bからステップ805dの処理により、全ての画素値が0の状態の距離画像P4のライン画像L4に、図1のライン画像L4の距離値グラフ149に白領域で示した距離値150が加算される。また、前記ステップ805hからステップ805jの処理により、前記距離値150が加算された画素値グラフ149に、ハッチングされた領域で示した距離値150が加算される。その結果、太線で示したような距離分布152が得られる。前記距離分布152は、前記画像146をレリーフ調立体形状で表現したときの前記水平ライン147における距離画像であることがわかる。 Distance Next, the process of step 805d from the step 805b, shown in line image L4 of the distance image P4 of all pixel values of the zero state, the distance value graph 149 line image L4 in FIG 3 by a white area The value 150 is added. In addition, the distance value 150 indicated by the hatched area is added to the pixel value graph 149 to which the distance value 150 has been added by the processing from Step 805h to Step 805j. As a result, a distance distribution 152 as shown by a bold line is obtained. It can be seen that the distance distribution 152 is a distance image in the horizontal line 147 when the image 146 is expressed in a relief solid shape.

前記ステップ805の処理により、前記距離画像P4を生成したら、図あるいは図1に示したように、前記距離画像P4を垂直方向に平滑化する(ステップ806)。前記ステップ806では、距離画像P5を用意し、下記数式6に従って前記距離画像P5の各画素の画素値を決定する。そして、それらの画素値からなる距離画像P5を3次元画像として出力し、液晶ディスプレイ等の画像表示手段7で表示する。 The processing at step 805, After generating the range image P4, as shown in FIG. 7 or 1 1, smoothing the range image P4 in the vertical direction (step 806). In step 806, a distance image P5 is prepared, and the pixel value of each pixel of the distance image P5 is determined according to the following formula 6. Then, the distance image P5 composed of these pixel values is output as a three-dimensional image and displayed on the image display means 7 such as a liquid crystal display.

Figure 0004155401
Figure 0004155401

なお、前記数式6では、P4(x,−2)=P4(x,0),P4(x,−1)=P4(x,0),P4(x,Y)=P4(x,Y−1),P4(x,Y+1)=P4(x,Y−1)とする。また、前記数式6は、5つの画素の単純平均による平滑化フィルタであるが、これは一例であり、本発明は平滑化フィルタの種類や平滑化の範囲を前記数式6に限定するものではない。   In Equation 6, P4 (x, -2) = P4 (x, 0), P4 (x, -1) = P4 (x, 0), P4 (x, Y) = P4 (x, Y− 1), P4 (x, Y + 1) = P4 (x, Y−1). Moreover, although the said Numerical formula 6 is a smoothing filter by the simple average of five pixels, this is an example and this invention does not limit the kind and smoothing range of a smoothing filter to the said Numerical formula 6. .

以上説明したように、本実施例1の3次元画像生成方法によれば、撮影手段の右側から照明をあてた第1画像P1と、前記撮影手段の左側から照明をあてた第2画像P2の2枚の画像から3次元画像を生成することができる。そのため、視覚的な画像劣化が少ない3次元画像を容易に生成することができる。またこのとき、従来のような正確な3次元形状を求めてからレリーフ調立体形状に変換するような2ステップの処理ではなく、直接レリーフ調立体形状(距離画像P4)を生成することができるので、計算コストを低減することができる。そのため、特に、計算処理能力の低い携帯器機に組み込む3次元画像生成方法として優れている。   As described above, according to the three-dimensional image generation method of the first embodiment, the first image P1 illuminated from the right side of the imaging unit and the second image P2 illuminated from the left side of the imaging unit. A three-dimensional image can be generated from two images. Therefore, it is possible to easily generate a three-dimensional image with little visual image degradation. Further, at this time, a relief three-dimensional shape (distance image P4) can be directly generated, instead of a two-step process in which an accurate three-dimensional shape is obtained and then converted into a relief three-dimensional shape. The calculation cost can be reduced. Therefore, it is particularly excellent as a three-dimensional image generation method incorporated in a portable device having a low calculation processing capability.

図1は、本発明による実施例2の3次元画像生成方法を説明するためのフロー図である。 Figure 1 4 is a flowchart for explaining the three-dimensional image generation method according to a second embodiment of the present invention.

前記実施例1で説明した3次元画像生成方法では、図2(a)及び図2(b)に示したような照明手段4A,4Bの配置、照度の特性であり、取得した第1画像101(P1)及び第2画像102(P2)に、図2(c)に示したような低照度のために暗くなった領域117が生じると、前記差分画像105(P3)に、3次元画像の生成に不要な成分118が生じる。本実施例2では、図3に示したような手順で、前記差分画像P3上の不要な成分を除去する場合の具体的な処理方法の一例を説明する。   In the three-dimensional image generation method described in the first embodiment, the arrangement of the illumination units 4A and 4B and the illuminance characteristics as shown in FIGS. When a region 117 darkened due to low illuminance as shown in FIG. 2C occurs in (P1) and the second image 102 (P2), the difference image 105 (P3) has a three-dimensional image. A component 118 is generated that is unnecessary for production. In the second embodiment, an example of a specific processing method in the case where unnecessary components on the difference image P3 are removed by the procedure shown in FIG. 3 will be described.

なお、本実施例2で説明する処理は、前記実施例1で説明した3次元画像生成方法において、前記差分画像P3を生成するステップ802と、その次のステップ803の間で行う処理である。そのため、以下の説明では、前記実施例1で説明した各ステップと同じ処理を行う部分については説明を省略し、前記差分画像P3上の不要な部分を除去する処理に関するステップのみを説明をする。   The process described in the second embodiment is a process performed between step 802 for generating the difference image P3 and the next step 803 in the three-dimensional image generation method described in the first embodiment. Therefore, in the following description, the description of the portion that performs the same process as each step described in the first embodiment will be omitted, and only the step related to the process of removing the unnecessary portion on the difference image P3 will be described.

まず、前記実施例1で説明したように、前記第1画像P1及び前記第2画像P2を取得した後、前記第1画像P1と第2画像P2の差分画像P3を生成する(ステップ801,802)。このとき、前記差分画像P3は、例えば、図2(c)に示したような画像105のようになっているとする。   First, as described in the first embodiment, after obtaining the first image P1 and the second image P2, a difference image P3 between the first image P1 and the second image P2 is generated (steps 801 and 802). ). At this time, it is assumed that the difference image P3 is, for example, an image 105 as shown in FIG.

次に、図1に示すような処理により、前記差分画像P3上の不要な成分を除去する。このとき、まず、あらかじめ指定された閾値k2をKに代入する(ステップ807a)。 Then, the processing shown in FIG. 1 4, removes unnecessary components on the difference image P3. At this time, first, a predetermined threshold value k2 is substituted for K (step 807a).

次に、前記差分画像P3の水平ラインに関するパラメータを初期化する(ステップ807b)。   Next, parameters relating to the horizontal line of the difference image P3 are initialized (step 807b).

次に、前記差分画像P3の水平ラインのライン画像L3に対して、次のステップ807cからステップ807eの処理を行う。   Next, the processing from the next step 807c to step 807e is performed on the horizontal line image L3 of the difference image P3.

前記ステップ807cでは、前記ライン画像L3の各画素L3(x)に対して、区間x−M/2から区間x+M/2における画素値の分布を線形近似する近似式y=a(x)・x+b(x)のパラメータa(x),b(x)を、下記数式7及び数式8を用いて決定する。   In step 807c, for each pixel L3 (x) of the line image L3, an approximate expression y = a (x) · x + b for linearly approximating the distribution of pixel values from the section x−M / 2 to the section x + M / 2. The parameters a (x) and b (x) of (x) are determined using Equation 7 and Equation 8 below.

Figure 0004155401
Figure 0004155401

Figure 0004155401
Figure 0004155401

ここで、前記数式7及び数式8における加算範囲は、以下のように規定する。   Here, the addition range in the formulas 7 and 8 is defined as follows.

(1)x-M/2<0であるなら、Σの加算範囲:i=0からx+M/2:M'=x+M/2
(2)x-M/2≧0かつx+M/2<Xであるなら、Σの加算範囲:i=x-M/2からx+M/2:M'=M
(3)x+M/2≧Xであるなら、Σの加算範囲:i=x-M/2からX:M'=X-x-M/2
(1) If xM / 2 <0, Σ addition range: i = 0 to x + M / 2: M ′ = x + M / 2
(2) If xM / 2 ≧ 0 and x + M / 2 <X, the addition range of Σ: i = xM / 2 to x + M / 2: M ′ = M
(3) If x + M / 2 ≧ X, addition range of Σ: from i = xM / 2 to X: M ′ = XxM / 2

なお、いずれの場合も、xi=i,yi=L3(i)とする。   In either case, xi = i and yi = L3 (i).

前記ステップ807cの処理を行うことによって、前記ステップB1の処理が実現される。なお、本実施例2では、1次式を用いた移動平均の近似式を用いているが、画素値の分布形状を近似するような近似式であるならばよく、本発明は、そのような近似式の求め方を限定するものではない。   By performing the processing in step 807c, the processing in step B1 is realized. In the second embodiment, a moving average approximation expression using a linear expression is used. However, an approximation expression that approximates a distribution shape of pixel values may be used. The method for obtaining the approximate expression is not limited.

次に、ステップ807dにおいて、前記ライン画像L3の各画素の値を、下記数式9にしたがって変換し、ライン画像L31を生成する。   Next, in step 807d, the value of each pixel of the line image L3 is converted in accordance with the following formula 9 to generate a line image L31.

Figure 0004155401
Figure 0004155401

前記ステップ807dの処理を行うことによって、前記ステップB2の処理が実現される。   By performing the processing in step 807d, the processing in step B2 is realized.

次に、ステップ807eにおいて、前記ライン画像L31の各画素の値を、下記数式10にしたがって変換し、ライン画像L32を生成する。   Next, in step 807e, the value of each pixel of the line image L31 is converted according to the following formula 10, and a line image L32 is generated.

Figure 0004155401
Figure 0004155401

前記ステップ807eの処理を行うことによって、前記ステップAの処理が実現される。   By performing the process of step 807e, the process of step A is realized.

以上、ステップ807cからステップ807eの処理を全水平ラインに行うことによって、図3に示したような処理が実現される。このとき、前記ライン画像L32は、図3に示したように、3次元画像の生成には不要な領域、すなわち撮影物体の輪郭部の影の領域に相当する領域以外の画素の値がほぼ0になる。   As described above, the processing shown in FIG. 3 is realized by performing the processing from step 807c to step 807e on all horizontal lines. At this time, as shown in FIG. 3, in the line image L32, the values of pixels other than the area unnecessary for generating the three-dimensional image, that is, the area corresponding to the shadow area of the outline of the photographing object are almost zero. become.

次に、前記ライン画像L3を更新し(ステップ807f)、全ての水平ラインのライン画像で処理を行ったか判定する(ステップ807g)。このとき、未処理のライン画像L3があれば、前記ステップ807cに戻り、処理を繰り返す。全てのライン画像L3で処理を行っていれば、元の差分画像P3のライン画像L3を、前記ライン画像L32で置き換えて、新たな差分画像P3を生成する(ステップ807h)。   Next, the line image L3 is updated (step 807f), and it is determined whether or not processing has been performed for all horizontal line line images (step 807g). At this time, if there is an unprocessed line image L3, the process returns to step 807c and the process is repeated. If processing has been performed for all the line images L3, the line image L3 of the original difference image P3 is replaced with the line image L32 to generate a new difference image P3 (step 807h).

その後、反復終了の判定を行い(ステップ807i)、反復終了と判定されれば前記ステップ803に進む。未終了と判定されれば、下記数式11を用いてKの値を更新(ステップ807j)した後、前記ステップ807bに戻る。   Thereafter, it is determined whether or not the iteration is completed (step 807i). If it is determined that the iteration is terminated, the process proceeds to step 803. If it is determined that the process has not been completed, the value of K is updated using the following formula 11 (step 807j), and then the process returns to step 807b.

Figure 0004155401
Figure 0004155401

ここで、前記数式11の演算記号%は、Kを2で除算したときに、小数点以下を切り捨てて整数部分のみを取り出す演算を表す。   Here, the operation symbol% in the equation 11 represents an operation in which, when K is divided by 2, the decimal part is rounded down to extract only the integer part.

なお、前記ステップ807i,ステップ807jは、Kを現在の値より小さな値に更新する処理であればよく、前記数式11に限定するものではない。   The steps 807i and 807j may be processes that update K to a value smaller than the current value, and are not limited to the equation 11.

また、前記ステップ807iの判定では、例えば、以下の条件のいずれか、または、複数の条件の組み合わせを満たしたときに、反復終了と判定する。   In the determination in step 807i, for example, it is determined that the iteration is completed when any of the following conditions or a combination of a plurality of conditions is satisfied.

(条件1)ある反復回数を越える。
(条件2)Kの値がある値以下になる。
(条件3)ステップ807eでL31(x)≠L32(x)となる画素の数がある値以上になる。
(条件4)ステップ807eでL31(x)≠L32(x)となる画素で、つながっている画素列は画素数1とする数え方において、画素の数がある値以上になる。
(Condition 1) A certain number of iterations is exceeded.
(Condition 2) The value of K falls below a certain value.
(Condition 3) In step 807e, the number of pixels satisfying L31 (x) ≠ L32 (x) is greater than or equal to a certain value.
(Condition 4) In the method of counting pixels where L31 (x) ≠ L32 (x) in step 807e and the number of connected pixel columns is 1, the number of pixels is greater than a certain value.

前記ステップ807bからステップ807hの処理を反復した場合、反復回数が増す毎に、差分画像の画素値はしだいに0に近づくが、0か否かの判定基準Kも小さくなるので、等しくない画素の数は徐々に増えていく。そして、画像のノイズレベルにKの値が近づくと等しくない画素の数は急激に増え始める。よって、前記反復終了の条件3及び条件4は、Kの値が画像のノイズレベルに近づいたら終了とするということを実質的に表している。そのため、前記反復終了の条件3または条件4を用いることにより、事前に画像のノイズレベルを知ることなく、自動的に処理できるという利点がある。   When the processing from step 807b to step 807h is repeated, each time the number of iterations increases, the pixel value of the difference image gradually approaches 0, but the criterion K for determining whether or not it is 0 also becomes smaller. The number gradually increases. Then, as the value of K approaches the noise level of the image, the number of unequal pixels starts to increase rapidly. Therefore, the conditions 3 and 4 for the end of the repetition substantially represent that the end is made when the value of K approaches the noise level of the image. Therefore, by using the condition 3 or condition 4 for the end of repetition, there is an advantage that the processing can be automatically performed without knowing the noise level of the image in advance.

前記ステップ807iで、反復終了と判定された場合は、その直前のステップで生成した新たな差分画像P3を用い、前記実施例1で説明したステップ803、すなわち前記第3のステップ以降の処理を行う。   If it is determined in step 807i that the iteration has ended, the new difference image P3 generated in the immediately preceding step is used to perform step 803 described in the first embodiment, that is, the processing after the third step. .

以上説明したように、本実施例2の3次元画像生成方法によれば、前記第1のステップで取得した第1画像P1及び第2画像P2に、照明手段の照度の特性により暗くなった領域が存在した場合でも、差分画像P3から前記暗くなった領域に相当する領域の成分を除去することができる。そのため、照度ムラのある照明下で撮影した画像からでも、安定した3次元画像の生成が可能となる。   As described above, according to the three-dimensional image generation method of the second embodiment, the first image P1 and the second image P2 acquired in the first step are darkened due to the illuminance characteristics of the illumination unit. Even in the case where there is, the component of the region corresponding to the darkened region can be removed from the difference image P3. Therefore, a stable three-dimensional image can be generated even from an image taken under illumination with uneven illumination.

15及び図16は、本発明による実施例の3次元画像生成方法を説明するための模式図であり、図15は局所的な途切れを補間する処理のフロー図、図16は補間方法を説明するための図である。 15 and 16 are schematic diagrams for explaining the three-dimensional image generation method according to a third embodiment of the present invention, FIG. 15 is a flow diagram of a process of interpolating a local break, 16 an interpolation method It is a figure for demonstrating.

前記実施例1および前記実施例で説明した3次元画像生成方法では、前記第3のステップ(ステップ803)で生成した画像上の、撮影物体の輪郭部に相当する領域の右端の画素や左端の画素が連続的に抽出されているとして説明している。しかしながら、実際の画像生成処理では、取得した第1画像P1及び第2画像P2や、前記差分画像P3に生じたノイズの影響で、図(a)に示したように、前記第3のステップで生成した画像113上で、本来なら連続的である部分に局所的な途切れ140が生じることがある。そこで、本実施例では、図(a)に示したような局所的な途切れ140を補間する処理について説明する。 In the three-dimensional image generation method described in the first embodiment and the second embodiment, the right end pixel and the left end of the region corresponding to the contour of the photographic object on the image generated in the third step (step 803). It is assumed that the pixels are extracted continuously. However, in actual image generation processing, first, image P1 and the second image P2 obtained, the influence of noise generated in the difference image P3, as shown in FIG. 4 (a), the third step In the image 113 generated in step 1, a local discontinuity 140 may occur in a portion that is originally continuous. Therefore, in the third embodiment, the process of interpolating a local discontinuity 140 such as shown in FIG. 4 (a) will be described.

なお、前記局所的な途切れ140を補間する処理は、前記第3のステップ(ステップ803)と前記第4のステップ(ステップ805)の間で行う処理である。そのため、以下の説明では、前記実施例1および前記実施例2で説明した各ステップについては説明を省略し、局所的な途切れ140を補間する処理のみを説明する。 The process for interpolating the local break 140 is a process performed between the third step (step 803) and the fourth step (step 805). Therefore, in the following description, description of each step described in the first embodiment and the second embodiment is omitted, and only processing for interpolating the local break 140 is described.

また、前記第3のステップで生成された画像は距離画像P33と記述する。またこのとき、前記距離画像P33のサイズはX画素×Y画素であるとする。   The image generated in the third step is described as a distance image P33. At this time, the size of the distance image P33 is assumed to be X pixels × Y pixels.

本実施例の3次元画像生成方法では、前記実施例1または前記実施例で説明したような手順で前記画像P33を生成した後、図1に示すように、X画素×Y画素の画像P34、及び変数x,yを用意する(ステップ809a)。 The three-dimensional image generation method of the third embodiment, after generating the image P33 in the procedure as described in Example 1 or Example 2, as shown in FIG. 1 5, the X pixel × Y pixels An image P34 and variables x and y are prepared (step 809a).

次に、ステップ809bにおいて、前記距離画像P33の四辺に隣接する全ての画素の画素値を、前記画像P34の同位置にコピーし、y=1とする。   Next, in step 809b, the pixel values of all the pixels adjacent to the four sides of the distance image P33 are copied to the same position of the image P34, and y = 1 is set.

次に、ステップ809cにおいて、x=1とする。   Next, in step 809c, x = 1 is set.

本実施例で説明する処理は、画像周辺の1画素幅の領域には適用できない。それは、本実施例で説明する処理が、注目する画素とその近傍の画素を用いて行う処理であるからで、変数xまたはyの座標値が0の画素は、近傍画素の一部がないので処理ができない。そのため、本実施例の処理では、変数xおよびyの初期値を1としている。 The processing described in the third embodiment cannot be applied to an area having a width of one pixel around the image. This is because the processing described in the third embodiment is performed using the pixel of interest and its neighboring pixels, and a pixel whose coordinate value of the variable x or y is 0 has no part of the neighboring pixels. So it can not be processed. Therefore, in the processing of the third embodiment, the initial values of the variables x and y are set to 1.

次に、ステップ809dにおいて、画像P34の各画素P34(x,y)の値を、下記数式1に記載した条件式に基づいて決定する。 Then, in step 809D, each pixel P34 (x, y) of the image P34 value of is determined based on the condition set forth in Equation 1 below 2.

Figure 0004155401
Figure 0004155401

ただし、前記数式1の各々の条件式において、vは全て1か−1のどちらかの値をとるものとする。 However, in the equation 1 2 of each of the conditional expressions, v is assumed to take the values of either all 1 or -1.

前記数式1の各々の条件式が示す幾何的な意味は、以下の通りである。まず、1番目の条件式は、例えば、図1(a)に示すように、前記距離画像P33の中心画素P33(x,y)の下の画素P33(x,y+1)の値と左上の画素P33(x−1,y−1)の値がともにvであるなら、前記画像P34の画素P34(x,y)の値をvとすることを表す。同様に、2番目の条件式は、図1(b)に示すように、距離画像P33の中心画素P33(x,y)の下の画素P33(x,y+1)の値と上の画素P33(x,y−1)の値がともにvであるなら、前記画像P34の画素P34(x,y)の値をvとすることを表す。以下、3番目から5番目の条件式も同様の操作を意味し、前記5つの条件式を満たさない場合は、6番目の条件式P34(x,y)=P33(x,y)とする。 Geometric meaning the conditional expression shown in each of Equation 1 2 is as follows. First, for example, as shown in FIG. 16 (a), the first conditional expression is the value of the pixel P33 (x, y + 1) below the center pixel P33 (x, y) of the distance image P33 and the upper left. If both the values of the pixel P33 (x-1, y-1) are v, this indicates that the value of the pixel P34 (x, y) of the image P34 is v. Similarly, the second condition, as shown in FIG. 1 6 (b), the center pixel of the distance image P33 P33 (x, y) pixel under P33 (x, y + 1) pixel of the upper-value P33 If the values of (x, y−1) are both v, it means that the value of the pixel P34 (x, y) of the image P34 is v. Hereinafter, the third to fifth conditional expressions mean the same operation, and when the five conditional expressions are not satisfied, the sixth conditional expression P34 (x, y) = P33 (x, y) is set.

前記数式1を用いて、前記画像P34の画素P34(x,y)の画素値を決めれば、前記画像P34上では、前記距離画像P33上の連続する線分中に存在する1画素の欠けが修復される。 Using Equation 1 2, pixel P34 (x, y) of the image P34 be determined pixel values, on the image P34 is lacking of one pixel present in the segment of consecutive on the distance image P33 Is repaired.

なお、前記数式1に挙げた条件式では、図1(c)のように、前記距離画像P33の中心画素P33(x,y)の上の画素P33(x,y−1)の値と右下の画素P33(x+1,y+1)の値がvである場合は、前記中心画素P34(x,y)は修復されない。しかしながら、これは、図1(d)に示すように、隣の画素を中心画素P33(x,y)としたときに、図1(a)で示した位置関係になるので必ず処理される。つまり、図1(c)に示したような配列は、処理の重複を省くため前記数式1には入れていない。また、前記数式1に挙げた条件式では、図1(e)のように、中心画素P33(x,y)の右側の画素P33(x+1,y)の値及び左側の画素P33(x−1,y)の値がvの場合も処理されないが、これは、前記第4のステップ(ステップ805)において、水平方向は補間処理によって距離を算出するので、傾きが水平に近い線分は連続させる必要性があまりないため行わなくてもよい。しかしながら、計算コストを重視しない場合、図1(c)や図1(e)のような場合にも処理する条件式を前記数式1に加えても構わない。 In the conditional expression mentioned Equation 1 2, as shown in FIG. 1 6 (c), the value of the central pixel P33 of the range image P33 (x, y) pixel on the P33 (x, y-1) When the value of the lower right pixel P33 (x + 1, y + 1) is v, the center pixel P34 (x, y) is not restored. However, this is as shown in FIG. 1 6 (d), around the neighboring pixel pixel P33 (x, y) when a is always processed because a positional relationship shown in FIG. 1 6 (a) The In other words, the sequence as shown in FIG. 1 6 (c), the not put in Equation 1 2 To save duplication of processing. Also, in the conditional expression listed in Equation 1 2, as shown in FIG. 1 6 (e), the central pixel P33 (x, y) right pixel of P33 (x + 1, y) values and the left pixel P33 (x −1, y) is not processed even when the value of v is v. However, in the fourth step (step 805), the distance in the horizontal direction is calculated by interpolation processing. Since there is not much necessity to make it continuous, it is not necessary to carry out. However, if you do not focus on computational cost, it may be added to the conditional expression to be processed in case of FIG. 1 6 (c) and FIG. 1 6 (e) in Equation 1 2.

また、前記ステップ809dは、前記数式1に示した条件式のかわりに、参照テーブルを事前に作成しておき、周辺画素の分布状態から参照アドレスを生成して参照テーブルを引くことによって前記数式1と同等の処理を行うことも可能である。このステップにおいて、前記距離画像P33上の途切れた部分を上下の画素より補間して右端の画素または左端の画素とすることによって、局所的な途切れを解消する作用を与える式であるならば前記数式1に限定するものではない。 Further, the step 809d, the formula in place of the conditional expression shown in Equation 1 2, advance to create a lookup table in advance, by subtracting the reference table to generate a reference address from the distribution of the peripheral pixels it is also possible to perform 1 2 equivalent process. In this step, if the discontinuous portion on the distance image P33 is interpolated from the upper and lower pixels to be the right end pixel or the left end pixel, the expression is given if it is an expression that eliminates the local discontinuity. It is not limited to 1 or 2 .

次に、変数xを更新してx=x+1とし(ステップ809e)、x<X−1であるか判定する(ステップ809f)。ここで、x<X−1であるならばステップ809dに戻る。   Next, the variable x is updated to x = x + 1 (step 809e), and it is determined whether x <X−1 (step 809f). If x <X-1, the process returns to step 809d.

また、x=X−1であれば、変数yを更新してy=y+1とし(ステップ809g)、y<Y−1であるか判定する(ステップ809h)。ここで、y<Y−1ならば、ステップ809cに戻り、処理を繰り返す。   If x = X-1, the variable y is updated to y = y + 1 (step 809g), and it is determined whether y <Y-1 (step 809h). If y <Y-1, the process returns to step 809c and the process is repeated.

前記ステップ809hでy=Y−1と判定されれば、前記距離画像P33を、前記ステップ809dで画素値を決定した画素P34(x,y)からなる画像P34で置き換え(ステップ809i)、処理を終了する。その後は、前記第4のステップ(ステップ805)及び第5のステップ(ステップ806)を実行する。   If it is determined in step 809h that y = Y−1, the distance image P33 is replaced with an image P34 including the pixel P34 (x, y) whose pixel value has been determined in step 809d (step 809i), and processing is performed. finish. Thereafter, the fourth step (step 805) and the fifth step (step 806) are executed.

以上説明したように、本実施例の3次元画像生成方法によれば、前記第3のステップで生成した画像上で、撮影物体の輪郭部を表す画素が連続的である部分に生じた、局所的な途切れを補間することができる。そのため、生成した3次元画像の視覚的な精度の低下を防ぐことができる。 As described above, according to the three-dimensional image generation method of the third embodiment, on the third image generated in step, pixels representing the contour of the shooting object is caused in the portion which is continuous, Local breaks can be interpolated. Therefore, it is possible to prevent a reduction in visual accuracy of the generated three-dimensional image.

17は、本発明による実施例の3次元画像生成方法を説明するためのフロー図である。 FIG. 17 is a flowchart for explaining the three-dimensional image generation method according to the fourth embodiment of the present invention.

前記実施例1から前記実施例まででは、前記第1画像P1及び第2画像P2として、モノクロ画像を用いて3次元画像を生成する方法について説明したが、一般に、3次元画像を生成する場合には、前記第1画像P1及び第2画像P2を取得するときに、同時に撮影物体の色情報を撮影することが多く、実際に3次元画像を生成し、表示するときには、前記撮影物体の色情報を用いた色画像を立体化して表示する。しかしながら、従来の色画像の生成方法では、前記撮影物体の輪郭部の影が残り、視覚的な精度を劣化させる要因となる。そこで、本実施例では、視覚的な精度の劣化を防ぐ色画像の生成方法について説明する。 In the above Examples 1 to Example 3, as the first image P1 and the second image P2, has been described a method for generating a 3-dimensional image by using a monochrome image, In general, when generating a three-dimensional image In many cases, when the first image P1 and the second image P2 are acquired, the color information of the photographing object is often photographed at the same time, and when the three-dimensional image is actually generated and displayed, the color of the photographing object is often obtained. A color image using information is three-dimensionally displayed. However, in the conventional color image generation method, the shadow of the contour portion of the photographed object remains, which causes deterioration in visual accuracy. In the fourth embodiment, a method for generating a color image that prevents deterioration in visual accuracy will be described.

なお、本実施例で説明する色画像の生成処理は、前記実施例1で説明した3次元画像生成方法において、前記第1画像P1及び第2画像P2を取得するステップ801の後に行う処理である。そのため、以下の説明では、前記実施例1から前記実施例までで説明した各ステップについては説明を省略し、色画像を生成する処理に関するステップのみを説明する。 The color image generation process described in the fourth embodiment is a process performed after step 801 for acquiring the first image P1 and the second image P2 in the three-dimensional image generation method described in the first embodiment. is there. Therefore, in the following description, each step described in the above Example 1 to Example 3 will be omitted of description, only the steps relating to processing for generating a color image.

また、本実施例では、処理対象となる前記第1のステップで取得する画像を、前記第1画像P1及び第2画像P2と区別するために、それぞれ第1色画像C1、第2色画像C2とする。また、本実施例の方法で生成される画像を生成色画像C3とする。なお、前記第1色画像C1、第2色画像C2、生成色画像C3のサイズはそれぞれ、X画素×Y画素であるとする。 In the fourth embodiment, the first color image C1 and the second color image are used to distinguish the image acquired in the first step to be processed from the first image P1 and the second image P2, respectively. Let C2. An image generated by the method of the fourth embodiment is a generated color image C3. The sizes of the first color image C1, the second color image C2, and the generated color image C3 are each assumed to be X pixels × Y pixels.

前記第1色画像C1及び第2色画像C2を取得したら、まず、ステップ810aにおいて、x=0,y=0とする。   When the first color image C1 and the second color image C2 are acquired, first, x = 0 and y = 0 are set in step 810a.

次に、ステップ810bにおいて、下記数式1にしたがって、前記生成色画像C3上の各画素C3(x,y)の画素値を算出する。 Next, at step 810b, in accordance with the following Equation 1 3, and calculates the pixel value of each pixel C3 (x, y) on the generated color image C3.

Figure 0004155401
Figure 0004155401

ここで、前記数式1における右辺の関数MAXは、引数のうち大きい方の値を選択する関数を意味するものとする。 Here, the function MAX of the right side in Equation 1 3 is intended to mean a function that selects the larger value of the argument.

次に、変数xを更新してx=x+1とし(ステップ810c)、x<Xであるか判定する(ステップ810d)。ここで、x<Xならばステップ810bに戻り、処理を繰り返す。   Next, the variable x is updated to x = x + 1 (step 810c), and it is determined whether x <X (step 810d). If x <X, the process returns to step 810b and the process is repeated.

また、x=Xであれば、次に、変数yを更新してy=y+1とし(ステップ810e)、y<Yであるか判定する(ステップ810f)。ここで、y<Yであるならば、x=0(ステップ810g)としてから前記ステップ810bに戻り、処理を繰り返す。   If x = X, then the variable y is updated to y = y + 1 (step 810e), and it is determined whether y <Y (step 810f). Here, if y <Y, x = 0 (step 810g) and then the process returns to step 810b to repeat the process.

前記ステップ810fの判定で、y=Yと判定されたら、C3(x,y)からなる画像C3を生成して処理を終了する。   If it is determined in step 810f that y = Y, an image C3 composed of C3 (x, y) is generated, and the process ends.

以上の処理によって、図4(c)に示したように、照明によって生じる影の除去された色画像画像141(C3)が生成される。 The above process, as shown in FIG. 4 (c), color picture 141 (C3) removed shadow caused by the illumination is generated.

なお、前記色画像C3は、前記実施例1から前記実施例までで説明した3次元画像を生成する際には直接必要としない画像である。そのため、図17に示したような処理は、前記第1のステップが終了した後、どの段階で行ってもよい。またこのとき、本実施例の処理を、前記第2のステップ以降の処理と並列して行えば、処理時間の増加を防げる。 Incidentally, the color image C3 is, when generating a three-dimensional image described in the first embodiment to the third embodiment is an image that does not directly necessary. Therefore, the processing as shown in FIG. 17 may be performed at any stage after the first step is completed. At this time, if the processing of the fourth embodiment is performed in parallel with the processing after the second step, an increase in processing time can be prevented.

以上説明したように、本実施例の3次元画像生成方法によれば、前記撮影物体の色画像も同時に取得する場合に、照明による影のない、高品質の色画像を生成することができる。 As described above, according to the three-dimensional image generation method of the fourth embodiment, when a color image of the photographic object is also acquired at the same time, a high-quality color image without shadows due to illumination can be generated. .

なお、本実施例で説明した色画像の生成処理手順は、前記実施例1から前記実施例までで説明した3次元画像生成方法と組み合わせるのが最も効果的であるが、これに限らず、単独で、通常の画像撮影に用いても有用である。 The generation processing procedure of the color image described in the fourth embodiment, although the combination with the three-dimensional image generation method described in the above Example 1 to Example 3 is the most effective, not limited to this It is also useful when used alone for normal image photography.

18は、本発明による実施例の3次元画像生成装置の概略構成を示す模式図である。 FIG. 18 is a schematic diagram illustrating a schematic configuration of the three-dimensional image generation apparatus according to the fifth embodiment of the present invention.

18において、2は撮影物体、3は撮影カメラ、4Aは第1照明手段(右側照明)、4Bは第2照明手段(左側照明)、6は3次元画像生成装置、6Aは画像入力メモリ、6BはCPU、6Cは3次元形状記録メモリ、6Dは色画像記録メモリである。 In FIG. 18 , 2 is a photographic object, 3 is a photographic camera, 4A is first illumination means (right illumination), 4B is second illumination means (left illumination), 6 is a three-dimensional image generation device, 6A is an image input memory, 6B is a CPU, 6C is a three-dimensional shape recording memory, and 6D is a color image recording memory.

本実施例の3次元画像生成装置6は、例えば、コンピュータのような装置を用いることが可能であり、図1に示すように、撮影カメラで撮影した画像を取得して保存する画像入力メモリ6Aと、前記画像入力メモリ6Aに保存された画像を用いて3次元画像を生成する処理を行うCPU6Bと、前記CPU6Bで処理して得られた3次元形状(距離画像)及び色画像を記録、保存する3次元形状記録メモリ6C及び色画像記録メモリ6Dとを備える。このとき、前記画像入力メモリ6A、3次元形状記録メモリ6C、色画像記録メモリ6Dは、例えば、DRAMやEEPROMのような物理的には同一の半導体メモリをソフト的に分割して使うことによって実現しても構わない。 As the three-dimensional image generation apparatus 6 of the fifth embodiment, for example, an apparatus such as a computer can be used. As shown in FIG. 18 , an image input that acquires and stores an image captured by the imaging camera. A memory 6A, a CPU 6B that performs processing for generating a three-dimensional image using an image stored in the image input memory 6A, and a three-dimensional shape (distance image) and a color image obtained by the processing by the CPU 6B are recorded. A three-dimensional shape recording memory 6C and a color image recording memory 6D to be stored. At this time, the image input memory 6A, the three-dimensional shape recording memory 6C, and the color image recording memory 6D are realized by using physically divided semiconductor memories such as DRAM and EEPROM, for example. It doesn't matter.

また、図示は省略するが、前記3次元画像生成装置は、前記実施例1から前記実施例までで説明した各ステップを前記CPU6Bで実行することが可能なプログラムが記録されたメモリを有し、前記CPU6Bは、前記プログラムに従って前記距離画像及び色画像を生成する。 Although not shown, the three-dimensional image generating device has the possible program to the steps described in Examples 1 to Example 4 run on the CPU6B is recorded memory The CPU 6B generates the distance image and the color image according to the program.

また、前記CPU6Bは、前記撮影カメラ3で撮影するタイミングや、照明手段4A,4Bの切り替え等の制御も行うものとする。   Further, the CPU 6B also performs control such as timing of photographing with the photographing camera 3 and switching of the illumination means 4A and 4B.

本実施例の3次元画像生成装置を用いて画像を生成するときには、前記CPU6Bの制御により第1照明手段4Aを点灯し、撮影カメラ3で撮影物体2を撮影して画像入力メモリ6Aに画像を入力する。この画像を第1画像P1(101)とする。 When an image is generated using the three-dimensional image generation apparatus according to the fifth embodiment, the first illumination unit 4A is turned on under the control of the CPU 6B, the shooting object 3 is shot with the shooting camera 3, and the image is stored in the image input memory 6A. Enter. This image is defined as a first image P1 (101).

次に、CPU6Bは第1照明手段4Aを消灯し、第2照明手段4Bを点灯し、撮影カメラ3で撮影物体2を撮影して画像入力メモリ6Aに画像を入力する。この画像を第2画像P2(102)とする。以上の動作が、前記実施例1で説明した第1のステップ(ステップ801)に相当する。   Next, the CPU 6B turns off the first illuminating means 4A, turns on the second illuminating means 4B, shoots the photographic object 2 with the photographic camera 3, and inputs an image to the image input memory 6A. This image is defined as a second image P2 (102). The above operation corresponds to the first step (step 801) described in the first embodiment.

次に、CPU6Bは第1画像P1と第2画像P2から、前記実施例1から前記実施例までで説明したような方法を用いて距離画像(3次元画像)を生成し、3次元形状記録メモリ6Cに記録する。 Then, CPU 6b generates a distance image (3-dimensional image) using the method described in the first image P1 from the second image P2, to said third embodiment from the first embodiment, the three-dimensional shape recording Record in the memory 6C.

また、撮影物体の色画像も同時に取得する場合は、第1画像P1と第2画像P2から前記実施例で説明した方法を用いて色画像C3を生成し、色画像記録メモリ6Dに記録する。 When acquiring a color image of the photographic object at the same time, a color image C3 is generated from the first image P1 and the second image P2 using the method described in the fourth embodiment, and is recorded in the color image recording memory 6D. .

前記距離画像記録メモリ6Cに記録された距離画像(3次元画像)及び色画像記録メモリ6Dに記録された色画像は、前記3次元画像生成装置6の利用者の操作等により、読み出され、液晶ディスプレイ等の表示手段(図示しない)に表示される。   The distance image (three-dimensional image) recorded in the distance image recording memory 6C and the color image recorded in the color image recording memory 6D are read by the operation of the user of the three-dimensional image generation device 6, etc. It is displayed on display means (not shown) such as a liquid crystal display.

このとき、前記CPU6Bにて行う前記距離画像(3次元画像)の生成処理は、前記実施例1から前記実施例までで説明したように、2枚の画像を用いて生成するので、計算コストが低く、かつ、信頼性の高い3次元画像を生成することができる。そのため、処理能力の高い専用の計算機(コンピュータ)に限らず、汎用型のコンピュータやPDA、携帯電話等を用いても、視覚的な信頼性が十分に高い3次元画像を生成し、表示させることができる。 In this case, generation processing of the distance image performed by the CPU 6b (3-dimensional image), as described in the Example 1 to Example 3, since generated using two images, calculation cost And a highly reliable three-dimensional image can be generated. Therefore, not only a dedicated computer (computer) with high processing capability but also a general-purpose computer, PDA, mobile phone, etc. can be used to generate and display a three-dimensional image with sufficiently high visual reliability. Can do.

また、本発明の3次元画像生成方法では、前記実施例1で説明したように、撮影手段(カメラ)の右側から照明した第1画像と、前記撮影手段の左側から照明した第2画像の2枚の画像から3次元画像を生成するので、取得する画像を撮影するための撮影手段(カメラ)及び照明手段を前記3次元画像生成装置に組み込むことが容易である。そのため、例えば、携帯電話機やPDAのような小型の携帯器機に、前記撮影手段及び照明手段を組み込めば、小型、低コストであり、かつ、信頼性に優れた3次元画像生成装置を提供することができる。   In the three-dimensional image generation method of the present invention, as described in the first embodiment, the first image illuminated from the right side of the photographing means (camera) and the second image illuminated from the left side of the photographing means are two. Since a three-dimensional image is generated from a single image, it is easy to incorporate a photographing means (camera) and an illuminating means for photographing an acquired image into the three-dimensional image generation apparatus. Therefore, for example, if the photographing means and the illumination means are incorporated into a small portable device such as a mobile phone or a PDA, a small, low-cost and highly reliable three-dimensional image generation apparatus is provided. Can do.

また、前記実施例1から前記実施例までで説明したような処理をプログラム化することで、専用の装置でなくても、前記プログラムを実行可能な装置であれば、信頼性に優れた3次元画像を容易に生成することができるようになる。またこのとき、前記プログラムを、例えば、CD−ROM等の記録媒体に記録したり、ネットワーク上の端末に記録すれば、特定の利用者の装置に限らず、多くの利用者の装置で利用することが可能となる。 Moreover, the process as described in Examples 1 to Example 4 by programmed, not be a dedicated device, as long as practicable device the program, excellent reliability 3 A dimensional image can be easily generated. At this time, if the program is recorded on a recording medium such as a CD-ROM or recorded on a terminal on a network, it is used not only by a specific user device but also by many user devices. It becomes possible.

以上、本発明を、前記実施例に基づき具体的に説明したが、本発明は、前記実施例に限定されるものではなく、その要旨を逸脱しない範囲において、種々変更可能であることはもちろんである。   The present invention has been specifically described above based on the above-described embodiments. However, the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the scope of the present invention. is there.

本発明の3次元画像生成方法の原理を説明するための模式図である。It is a schematic diagram for demonstrating the principle of the three-dimensional image generation method of this invention. 本発明の3次元画像生成方法の原理を説明するための模式図であり、生成する3次元画像の信頼性を向上させるための方法の一例を説明するための図である。It is a schematic diagram for demonstrating the principle of the three-dimensional image generation method of this invention, and is a figure for demonstrating an example of the method for improving the reliability of the three-dimensional image to produce | generate. 本発明の3次元画像生成方法の原理を説明するための模式図であり、生成する3次元画像の信頼性を向上させるための方法の一例を説明するための図である。It is a schematic diagram for demonstrating the principle of the three-dimensional image generation method of this invention, and is a figure for demonstrating an example of the method for improving the reliability of the three-dimensional image to produce | generate. 本発明の3次元画像生成方法の原理を説明するための模式図であり、ノイズの影響を除去する方法の一例を説明するための図である。It is a schematic diagram for demonstrating the principle of the three-dimensional image generation method of this invention, and is a figure for demonstrating an example of the method of removing the influence of noise. 本発明の3次元画像生成方法の原理を説明するための模式図であり、色画像の生成方法を説明するための図である。It is a schematic diagram for demonstrating the principle of the three-dimensional image generation method of this invention, and is a figure for demonstrating the generation method of a color image. 本発明の3次元画像生成装置の概略構成を示す模式図である。It is a schematic diagram which shows schematic structure of the three-dimensional image generation apparatus of this invention. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、全体の処理手順を示すフロー図である。It is a schematic diagram for demonstrating the three-dimensional image generation method of Example 1 by this invention, and is a flowchart which shows the whole process sequence. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、図のステップ803の処理の具体例を示すフロー図である。Is a schematic diagram for explaining the three-dimensional image generation method of Example 1 according to the present invention, it is a flow diagram showing a specific example of the processing of step 803 in FIG. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、図のステップ805の処理の具体例を示すフロー図である。Is a schematic diagram for explaining the three-dimensional image generation method of Example 1 according to the present invention, it is a flow diagram showing a specific example of the processing of step 805 in FIG. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、図のステップ805の処理の具体例を示すフロー図である。Is a schematic diagram for explaining the three-dimensional image generation method of Example 1 according to the present invention, it is a flow diagram showing a specific example of the processing of step 805 in FIG. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、図のステップ805の処理の具体例を示すフロー図である。Is a schematic diagram for explaining the three-dimensional image generation method of Example 1 according to the present invention, it is a flow diagram showing a specific example of the processing of step 805 in FIG. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、ステップ805の作用を説明するための図である。It is a schematic diagram for demonstrating the three-dimensional image generation method of Example 1 by this invention, and is a figure for demonstrating the effect | action of step 805. FIG. 本発明による実施例1の3次元画像生成方法を説明するための模式図であり、ステップ805の作用を説明するための図である。FIG. 6 is a schematic diagram for explaining the three-dimensional image generation method according to the first embodiment of the present invention, and is a diagram for explaining the operation of Step 805. 本発明による実施例2の3次元画像生成方法を説明するためのフロー図である。It is a flowchart for demonstrating the three-dimensional image generation method of Example 2 by this invention. 本発明による実施例の3次元画像生成方法を説明するための模式図であり、局所的な途切れを補間する処理のフロー図である。It is a schematic diagram for demonstrating the three-dimensional image generation method of Example 3 by this invention, and is a flowchart of the process which interpolates a local interruption. 本発明による実施例の3次元画像生成方法を説明するための模式図であり、補間方法を説明するための図である。It is a schematic diagram for demonstrating the three-dimensional image generation method of Example 3 by this invention, and is a figure for demonstrating the interpolation method. 本発明による実施例の3次元画像生成方法を説明するためのフロー図である。It is a flowchart for demonstrating the three-dimensional image generation method of Example 4 by this invention. 本発明による実施例の3次元画像生成装置の概略構成を示す模式図である。It is a schematic diagram which shows schematic structure of the three-dimensional image generation apparatus of Example 5 by this invention.

符号の説明Explanation of symbols

101,P1…第1画
102,P2…第2画
105,P3…差分画
2…撮影物
3…撮影手段(カメラ)
4A…第1照明手
4B…第2照明手
6…3次元画像生成装
601…画像取得手
602…3次元形状生成手
603…カメラ/ライト制御手
6A…画像入力メモ
6B…CP
6C…3次元形状記録メモ
6D…色画像記録メモ
7…画像表示手
101, P1 ... first Ima <br/> 102, P2 ... second Ima <br/> 105, P3 ... differential picture image 2 ... shooting object body 3 ... photographing means (camera)
4A ... first illumination hand stage 4B ... second illumination hand stage 6 ... 3-dimensional image generating equipment 601 ... image acquisition hand stage 602 ... three-dimensional shape generation hand stage 603 ... camera / write control hand stage 6A ... image input memory 6B ... CP U
6C ... 3-dimensional shape recording memory 6D ... color image recording memory 7 ... image display hand stage

Claims (10)

撮影手段から水平方向に所定距離離れた位置から照明して撮影した第1画像、及び前記撮影手段から前記水平方向と反対方向に所定距離離れた位置から照明して撮影した第2画像を取得する第1のステップと、
前記第1画像と第2画像の差分画像を生成する第2のステップと、
前記差分画像上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を、水平ライン毎に抽出する第3のステップと、
前記右端の画素より右側の領域、及び前記左端の画素より左側の領域にあらかじめ定めた距離関数に従って距離を与える操作を、水平ライン毎に行って距離画像を生成する第4のステップと、
前記距離画像を垂直方向に平滑化する第5のステップとを有することを特徴とする3次元画像生成方法。
A first image that is illuminated and photographed from a position that is a predetermined distance in the horizontal direction from the photographing means and a second image that is illuminated and photographed from a position that is a predetermined distance in the opposite direction to the horizontal direction from the photographing means are acquired. A first step;
A second step of generating a difference image between the first image and the second image;
A pixel on the right side of a region having a pixel value greater than or equal to a certain positive threshold value k1 and a pixel on the left end of a region having a pixel value equal to or less than a certain negative threshold value −k1 are extracted for each horizontal line. 3 steps,
A fourth step of generating a distance image by performing an operation for giving a distance according to a predetermined distance function to a region on the right side of the right end pixel and a region on the left side of the left end pixel for each horizontal line;
And a fifth step of smoothing the distance image in the vertical direction.
前記第2のステップと前記第3のステップの間に、前記差分画像の各画素値の絶対値が、あらかじめ定められた閾値k2より大きい場合には、差分量の絶対値を閾値k2と置き換えるステップAと、
前記差分画像の各水平ライン毎に画素値の分布形状を近似するようにあらかじめ定められた近似式のパラメータを決定するステップB1と、
各画素毎に画素値からその画素位置における近似値を減ずるステップB2とを有し、
前記ステップA,前記ステップB1,前記ステップB2の順、または前記ステップB1,前記ステップB2,前記ステップAの順に、1回または反復の度にk2を小さくしていきながら複数回行うことによって新たな差分画像を生成するステップとを有することを特徴とする請求項1に記載の3次元画像生成方法。
If the absolute value of each pixel value of the difference image is greater than a predetermined threshold value k2 between the second step and the third step, the absolute value of the difference amount is replaced with the threshold value k2. A and
A step B1 of determining a parameter of an approximate expression determined in advance so as to approximate a distribution shape of pixel values for each horizontal line of the difference image;
Subtracting the approximate value at the pixel position from the pixel value for each pixel, and step B2.
A new value is obtained by repeating the steps A, B1, B2, or the steps B1, B2, and A for a number of times while decreasing k2 once or repeatedly. The three-dimensional image generation method according to claim 1, further comprising a step of generating a difference image.
前記第3のステップと前記第4のステップの間に、前記第3のステップで求めた画像内の右端の画素と左端の画素の各々について、画素が垂直方向には大局的には連続して存在し局部的に途切れが存在する場合に、途切れた部分を上下の画素より補間して右端の画素または左端の画素とすることによって、途切れを解消するステップを有することを特徴とする請求項1または請求項に記載の3次元画像生成方法。 Between the third step and the fourth step, for each of the rightmost pixel and the leftmost pixel in the image obtained in the third step, the pixels are continuously continuously in the vertical direction. 2. The method according to claim 1, further comprising the step of eliminating the discontinuity by interpolating the discontinuous portion from the upper and lower pixels into a right end pixel or a left end pixel when there is a discontinuity locally. Or the three-dimensional image generation method of Claim 2 . 前記第1のステップの後に、前記第1画像と前記第2画像の同位置の画素を比較し、輝度値の大きな画素を選択することによって撮影物体の色画像を生成するステップを有することを特徴とする請求項1乃至請求項のいずれか1項に記載の3次元画像生成方法。 After the first step, there is a step of comparing the pixels at the same position in the first image and the second image and generating a color image of the photographic object by selecting a pixel having a large luminance value. The three-dimensional image generation method according to any one of claims 1 to 3 . 撮影手段から水平方向に所定距離離れた位置から照明して撮影した第1画像、及び前記撮影手段から前記水平方向と反対方向に所定距離離れた位置から照明して撮影した第2画像を取得する画像取得手段と、
前記画像取得手段で取得した前記第1画像及び前記第2画像を用いて3次元形状を生成する3次元形状生成手段とを備え、
前記3次元形状生成手段は、前記第1画像と第2画像の差分画像を生成する差分画像生成手段と、前記差分画像上の、ある正の閾値k1以上の画素値を有する領域の右端の画素と、ある負の閾値−k1以下の画素値を有する領域の左端の画素を、水平ライン毎に抽出する画素抽出手段と、前記右端の画素より右側の領域、及び前記左端の画素より左側の領域にあらかじめ定めた距離関数に従って距離を与える操作を、水平ライン毎に行って距離画像を生成する距離画像生成手段と、前記距離画像を垂直方向に平滑化する平滑化手段とを備えることを特徴とする3次元画像生成装置。
A first image that is illuminated and photographed from a position that is a predetermined distance in the horizontal direction from the photographing means and a second image that is illuminated and photographed from a position that is a predetermined distance in the opposite direction to the horizontal direction from the photographing means are acquired. Image acquisition means;
Three-dimensional shape generation means for generating a three-dimensional shape using the first image and the second image acquired by the image acquisition means,
The three-dimensional shape generation means includes a difference image generation means for generating a difference image between the first image and the second image, and a rightmost pixel of a region having a pixel value equal to or greater than a certain positive threshold k1 on the difference image. And a pixel extraction means for extracting a leftmost pixel of a region having a pixel value equal to or less than a certain negative threshold value −k1 for each horizontal line, a region on the right side of the rightmost pixel, and a region on the left side of the leftmost pixel A distance image generating means for generating a distance image by performing an operation for giving a distance in accordance with a predetermined distance function for each horizontal line, and a smoothing means for smoothing the distance image in the vertical direction. A three-dimensional image generating apparatus.
前記3次元形状生成手段は、前記各手段に加え、前記差分画像の各水平ライン毎に画素値の分布形状を変換して新たな差分画像を生成する差分画像変換手段を備えることを特徴とする請求項5に記載の3次元画像生成装置。 The three-dimensional shape generation means includes difference image conversion means for converting the distribution shape of pixel values for each horizontal line of the difference image to generate a new difference image in addition to the means described above. The three-dimensional image generation apparatus according to claim 5 . 前記3次元形状生成手段は、前記各手段に加え、画像内の右端の画素と左端の画素の各々について、画素が垂直方向には大局的には連続して存在し局部的に途切れが存在する場合に、途切れた部分を上下の画素より補間する画素補間手段を備えることを特徴とする請求項または請求項に記載の3次元画像生成装置。 In addition to the above-described means, the three-dimensional shape generation means has pixels that are continuously present in the vertical direction in each of the rightmost pixel and the leftmost pixel in the image and are locally discontinuous. If the three-dimensional image generating apparatus according to claim 5 or claim 6, characterized in that it comprises a pixel interpolating means for interruption portion interpolated from upper and lower pixels. 前記各手段に加えて、前記第1画像と前記第2画像の同位置の画素を比較し、輝度値の大きな画素を選択することによって撮影物体の色画像を生成する色画像生成手段を備えることを特徴とする請求項乃至請求項のいずれか1項に記載の3次元画像生成装置。 In addition to the above means, a color image generating means for comparing the pixels at the same position in the first image and the second image and generating a color image of the photographing object by selecting a pixel having a large luminance value is provided. The three-dimensional image generation apparatus according to any one of claims 5 to 7 . 前記請求項1乃至請求項のいずれか1項に記載の3次元画像生成方法の各ステップをコンピュータに実行させる3次元画像生成プログラム。 A three-dimensional image generation program for causing a computer to execute each step of the three-dimensional image generation method according to any one of claims 1 to 4 . 前記請求項に記載の3次元画像生成プログラムが、コンピュータで読み取り可能な状態で記録された記録媒体。 A recording medium on which the three-dimensional image generation program according to claim 9 is recorded in a computer-readable state.
JP2003273658A 2003-07-11 2003-07-11 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium Expired - Fee Related JP4155401B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003273658A JP4155401B2 (en) 2003-07-11 2003-07-11 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003273658A JP4155401B2 (en) 2003-07-11 2003-07-11 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium

Publications (2)

Publication Number Publication Date
JP2005033731A JP2005033731A (en) 2005-02-03
JP4155401B2 true JP4155401B2 (en) 2008-09-24

Family

ID=34210833

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003273658A Expired - Fee Related JP4155401B2 (en) 2003-07-11 2003-07-11 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium

Country Status (1)

Country Link
JP (1) JP4155401B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100856756B1 (en) 2007-10-08 2008-09-10 (주)다우텔레콤 Unmanned monitering device using the 3 dimension camera module device
US20130100266A1 (en) * 2011-10-25 2013-04-25 Kenneth Edward Salsman Method and apparatus for determination of object topology
JP6576083B2 (en) * 2015-04-15 2019-09-18 キヤノン株式会社 Image processing apparatus, image processing method, and program

Also Published As

Publication number Publication date
JP2005033731A (en) 2005-02-03

Similar Documents

Publication Publication Date Title
Zhang et al. Nerfactor: Neural factorization of shape and reflectance under an unknown illumination
US9591237B2 (en) Automated generation of panning shots
Banterle et al. Inverse tone mapping
RU2368006C1 (en) Method and system for adaptive reformatting of digital images
CN114245905A (en) Depth aware photo editing
CN111476737A (en) Image processing method, intelligent device and computer readable storage medium
JP7333467B2 (en) Learning-Based Lens Flare Removal
Nguyen et al. Depth image-based rendering from multiple cameras with 3D propagation algorithm
JP7390497B2 (en) Image processing methods, apparatus, computer programs, and electronic devices
JP2018508898A (en) Digital zoom method and system
CN112652046B (en) Game picture generation method, device, equipment and storage medium
CN112561777A (en) Method and device for adding light spots to image
CN109214996A (en) A kind of image processing method and device
JP3988879B2 (en) Stereo image generation method, stereo image generation apparatus, stereo image generation program, and recording medium
JP2017091298A (en) Image processing device, image processing method and image processing program
Conde et al. Lens-to-lens bokeh effect transformation. NTIRE 2023 challenge report
JP2004200973A (en) Apparatus and method of inputting simple stereoscopic image, program, and recording medium
KR20160016812A (en) Image edits propagation to underlying video sequence via dense motion fields
CN112184609B (en) Image fusion method and device, storage medium and terminal
JP6292968B2 (en) Pseudo HDR image estimation apparatus and method
JP4155401B2 (en) 3D image generation method, 3D image generation apparatus, 3D image generation program, and recording medium
JP2004133919A (en) Device and method for generating pseudo three-dimensional image, and program and recording medium therefor
KR20170097745A (en) Apparatus and method for generating extrapolated images using recursive hierarchical processes
JP4541397B2 (en) Pseudo three-dimensional image generation apparatus, pseudo three-dimensional image generation method, and pseudo three-dimensional image generation program
WO2016026072A1 (en) Method, apparatus and computer program product for generation of extended dynamic range color images

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050719

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080327

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080401

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080602

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080702

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110718

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120718

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130718

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees