JP7329964B2 - Image processing device, image processing method and program - Google Patents
Image processing device, image processing method and program Download PDFInfo
- Publication number
- JP7329964B2 JP7329964B2 JP2019095535A JP2019095535A JP7329964B2 JP 7329964 B2 JP7329964 B2 JP 7329964B2 JP 2019095535 A JP2019095535 A JP 2019095535A JP 2019095535 A JP2019095535 A JP 2019095535A JP 7329964 B2 JP7329964 B2 JP 7329964B2
- Authority
- JP
- Japan
- Prior art keywords
- image data
- image
- optical flow
- color
- subject
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Image Analysis (AREA)
- Image Processing (AREA)
Description
本発明は、オプティカルフローを用いた画像処理技術に関するものである。 The present invention relates to image processing technology using optical flow.
近年、画像間の画素の対応付けを行う技術の重要性が高まっている。ここで言う対応とは、着目画像の画素と同一であるとみなす参照画像の画素の関係であり、二点の座標で表現できる。ステレオや多視点画像を入力した場合は、画素の対応関係から被写体の奥行きを算出できるため、3次元画像処理に応用することも可能である。また、時間的に連続して撮像された画像(動画)を入力し、その対応関係を相対座標として表現すれば、それは動きベクトルとなる。このように動きベクトルを求めることを動き検出という。複数の画素の動き検出を行って、得た動きベクトルの集合をオプティカルフローと呼ぶ(狭義には画素に対応する動きベクトルをマップ化した情報をオプティカルフローと呼ぶ)。オプティカルフローを利用することによって、動体追跡、動画の防振、フレーム補間などが可能となる。 In recent years, the importance of techniques for associating pixels between images has increased. The correspondence referred to here is the relationship between the pixels of the reference image that are considered to be the same as the pixels of the image of interest, and can be expressed by the coordinates of two points. When a stereo or multi-viewpoint image is input, the depth of the object can be calculated from the pixel correspondence relationship, so it can be applied to three-dimensional image processing. In addition, if images (moving images) captured in a temporally continuous manner are input and their corresponding relationships are expressed as relative coordinates, they become motion vectors. Obtaining a motion vector in this way is called motion detection. A set of motion vectors obtained by motion detection of a plurality of pixels is called an optical flow (in a narrow sense, information obtained by mapping motion vectors corresponding to pixels is called an optical flow). By using optical flow, it becomes possible to track moving objects, stabilize moving images, frame interpolation, and so on.
オプティカルフローを取得する代表的な手法としては勾配法とテンプレートマッチングがある。勾配法は、画素の時空間の輝度変化の方向と大きさから、オプティカルフローを算出する。基本的な勾配法の考え方は、着目画素を中心とするパッチ(以下着目領域)の画素の平均的な時空間の輝度変化から動きベクトルを算出する。代表的な方法には、Lucas Kanade法(以下、LK法,非特許文献1)が知られている。 Gradient method and template matching are typical methods for obtaining optical flow. The gradient method calculates the optical flow from the direction and magnitude of spatiotemporal luminance change of pixels. The basic idea of the gradient method is to calculate a motion vector from the average spatio-temporal luminance change of pixels in a patch centered on a pixel of interest (hereinafter referred to as a region of interest). Lucas Kanade method (hereinafter referred to as LK method, Non-Patent Document 1) is known as a representative method.
テンプレートマッチングは、着目領域に対し、参照画像上に様々な位置にパッチ(以下、参照領域)を複数設定して、着目領域の参照領域の相関を算出し、相関が最も高い参照領域の相対位置を動きベクトルを得る。これを動き探索と呼ぶ。着目画素を走査しながら、動き探索を行って、各画素の動きベクトルを算出することによって、オプティカルフローを算出する。一般的なテンプレートマッチングでは、相関値算出にSSDやSAD(Sum of Absolute Difference)を用いることが多い。 In template matching, a plurality of patches (hereinafter referred to as reference regions) are set at various positions on the reference image for the region of interest, the correlation between the reference regions of the region of interest is calculated, and the relative position of the reference region with the highest correlation is calculated. to get the motion vector. This is called motion search. The optical flow is calculated by performing motion search while scanning the pixel of interest and calculating the motion vector of each pixel. In general template matching, SSD and SAD (Sum of Absolute Difference) are often used for correlation value calculation.
オプティカルフローを可視化するには、動きベクトルを矢印として画像に重畳したり(特許文献1)、画素の動きベクトルの方向を色相、長さを彩度としてHSV値を計算し、それをRGBに変換した画像を生成したりして、記録、表示する方法もある(非特許文献2)。 To visualize the optical flow, a motion vector is superimposed on the image as an arrow (Patent Document 1), or the HSV value is calculated with the direction of the motion vector of the pixel as the hue and the length as the saturation, and converted to RGB. There is also a method of generating, recording, and displaying an image (Non-Patent Document 2).
オプティカルフローの概形と被写体形状との相関を確認できるオプティカルフローの可視化画像を生成できなかった。 It was not possible to generate a visualized image of the optical flow that can confirm the correlation between the outline of the optical flow and the shape of the subject.
この課題を解決するため、例えば本発明の画像処理装置は以下の構成を備える。すなわち、
被写体を含む表示用画像データを生成する画像処理装置であって、
被写体を含む第1の画像データを取得する第1の取得手段と、
前記第1の画像データの画素毎の動きベクトルを表すオプティカルフローを第2の画像データとして取得する第2の取得手段と、
該第2の取得手段で取得したオプティカルフローを、カラー画像の成分を表すデータに変換する変換手段と、
前記第1の取得手段で取得した前記第1の画像データと、前記変換手段で得た成分とを合成することで、表示用の第3の画像データを生成する合成手段とを有し、
前記第1の取得手段は、前記被写体を含むカラー画像データから、予め設定された値に従って色差を弱めたカラー画像データに変換し、当該変換で得たカラー画像データを前記第1の画像データとして取得し、
前記合成手段は、前記第1の取得手段で取得した前記第1の画像データの各成分値と、前記変換手段で得た色相、彩度とから合成画像データを生成し、当該合成画像データからRGBの成分値で表すカラー画像データを前記第3の画像データとして生成することを特徴とする。
In order to solve this problem, for example, the image processing apparatus of the present invention has the following configuration. i.e.
An image processing device that generates display image data including a subject,
a first acquisition means for acquiring first image data including a subject;
a second obtaining means for obtaining, as second image data, an optical flow representing a motion vector for each pixel of the first image data;
conversion means for converting the optical flow acquired by the second acquisition means into data representing components of a color image;
synthesizing means for synthesizing the first image data obtained by the first obtaining means and the components obtained by the converting means to generate third image data for display ;
The first obtaining means converts the color image data including the subject into color image data in which the color difference is weakened according to a preset value, and uses the color image data obtained by the conversion as the first image data. Acquired,
The synthesizing means generates synthetic image data from each component value of the first image data acquired by the first acquiring means and the hue and saturation obtained by the converting means. Color image data represented by RGB component values is generated as the third image data .
本発明によれば、オプティカルフローの概形と被写体形状との相関を確認できるオプティカルフローの可視化画像を生成できる。 According to the present invention, it is possible to generate an optical flow visualized image that allows confirmation of the correlation between the outline of the optical flow and the shape of the subject.
以下、添付図面を参照して実施形態を詳しく説明する。尚、以下の実施形態は特許請求の範囲に係る発明を限定するものでない。実施形態には複数の特徴が記載されているが、これらの複数の特徴の全てが発明に必須のものとは限らず、また、複数の特徴は任意に組み合わせられてもよい。さらに、添付図面においては、同一若しくは同様の構成に同一の参照番号を付し、重複した説明は省略する。 Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. It should be noted that the following embodiments do not limit the invention according to the scope of claims. Although multiple features are described in the embodiments, not all of these multiple features are essential to the invention, and multiple features may be combined arbitrarily. Furthermore, in the accompanying drawings, the same or similar configurations are denoted by the same reference numerals, and redundant description is omitted.
[第1の実施形態]
図1は、第1の実施形態におけるオプティカルフローを可視化する画像処理装置のブロック構成図である。
[First embodiment]
FIG. 1 is a block configuration diagram of an image processing apparatus that visualizes optical flow according to the first embodiment.
本装置は、バス101、CPU102と、メモリ103と、不揮発メモリ104、表示部108、操作部109、及び、画像取得部110を有する。バス101は各モジュール間のデータ伝送を行う。CPU102は、各構成を統括的に制御し、計算処理、画像処理を実行するプロセッサである。メモリ103は、CPU102の主メモリ、ワークエリアとして機能する。不揮発メモリ104は画像処理プログラムや、処理対象の各種データやパラメータ等を格納するメモリである。CPU102は、メモリ103をワークエリアとして不揮発メモリ104に格納されたプログラムを実行し、不揮発メモリ104に格納された各種データを読み出し、後述する画像処理を行う。不揮発メモリ104は、典型的にはHDD(ハードディスクドライブ)であるが、他の記憶媒体であっても構わない。表示部108は、各種メニューの表示や、処理結果である画像を表示する。操作部109は、キーボード、マウス、タッチパネル等を含み、ユーザからの指示入力を受け付ける。そして、表示部108及び操作部109により、ユーザインタフェースを構成することになる。画像取得部110は画像を取得する。本画像処理装置をカメラとする場合には、センサーにあたる。
This apparatus has a
実施形態における不揮発性メモリ104には、既に1枚の静止画像の画像ファイル、並びに、当該静止画像(以下、対象画像という)に対応するオプティカルフローのファイルが既に格納されているものとする。静止画像は、例えばデジタルカメラの連写モードで撮影された画像である。また、オプティカルフローはその静止画と時間的に離接する画像とから求めた、画素単位の動きベクトルである。動きベクトルは、水平、垂直成分で表されているものとする。
Assume that the
本実施形態におけるCPU102が実行する画像処理を、図2のフローチャートを参照して以下に説明する。なお、同図に係るプログラムは、不揮発性メモリ104に格納されており、実行時にメモリ103に読み出され、CPU102により実行されるものである。
Image processing executed by the
S2000にて、CPU102は、不揮発性メモリ104に格納されている画像ファイルから被写体の写った静止画像を読み出す。そして、CPU102は、読み出した静止画像がカラー画像データの場合には、明度(もしくは輝度)の1成分のみで構成されるモノクロ画像データへ変換する。
At S<b>2000 ,
S2010にて、CPU102は、不揮発性メモリ103に格納されている、対応するオプティカルフローファイルから、オプティカルフローを読み出す。オプティカルフローは、事前に生成されたもの、本ステップの処理としてオプティカルフロー生成サブルーチンを呼び出し生成したもの、いずれでも構わない。
In S<b>2010 ,
S2020にて、CPU102は、オプティカルフローの画素に相当するベクトルを、向きと長さに変換する。この向きは、例えば水平右方向を0度とし、反時計回りの角度とする。具体的には、arctan{y成分値/x成分値}を求めることで得られる。また長さは、ベクトルのx成分値、y成分値の二乗和の平方根を求めればよい。CPU102は、オプティカルフローの全ベクトルについて、この処理を行う。
In S2020,
S2030にて、CPU102は、上記S2020で求めたベクトルの向き及び長さを、色空間における色相、彩度に変換する。これを全画素に対して実施する。
At S2030,
ここで、オプティカルフローにおける或るベクトルをv=(vx,vy)とし、色相をH,彩度をSとしたとき、CPU102は次式(1)、(2)に従って演算処理を行うことになる。 Let v=(vx, vy) be a vector in the optical flow, H be the hue, and S be the saturation. .
なお、本実施例では色相、および、その計算は度数とする。だたし、Vがゼロベクトル、もしくは、限りなくゼロベクトルに近い場合、HにNaN(Not A Number)を設定するものとする。ゼロベクトルに近いことを判定する条件としてvx,vyがそれぞれ、εより小さいか否かを判定している。本実施形態ではεは0.01とするがこの値に限定はない。εはオプティカルフローの画素精度以下で、十分0に近い値を設定すればよい。画素単位の動き探索を行う場合、精度は1である。また、勾配法を利用した場合は、少数精度まで算出可能であるが一般な同被写体をターゲットした場合、0.01画素以下の精度を得ることは難しいため、本実施形態ではε=0.01とした。なお、色相Hは、色相環の角度として定義できるが、基準となる角度0をどの色相に割り当てるかはユーザが自由に設定できるようにしてもよい。 In the present embodiment, the hue and its calculation are assumed to be frequencies. However, if V is a zero vector or infinitely close to a zero vector, H is set to NaN (Not A Number). As a condition for judging that the vector is close to the zero vector, it is judged whether or not each of vx and vy is smaller than ε. Although ε is set to 0.01 in this embodiment, there is no limitation to this value. ε may be set to a value sufficiently close to 0, which is equal to or less than the pixel precision of the optical flow. The precision is 1 when performing a pixel-by-pixel motion search. Further, when the gradient method is used, it is possible to calculate to a fractional precision, but when the same subject is generally targeted, it is difficult to obtain a precision of 0.01 pixel or less. and The hue H can be defined as an angle of the hue circle, but the user may be allowed to freely set to which hue the reference angle 0 is assigned.
また、彩度Sの強さを決める係数はrで表す。rは、画像内の最大の動きベクトルの長さが最終的に飽和しないようにするか、あるいは、表現したい動きの長さのレンジに決められる。具体的には、画像上のベクトル長の最大値が100画素の場合、r=1/100とする。または、表現したい動きの長さのレンジが0から10画素の場合は、r=1/10とする。このときは、最終的に可視化したオプティカルフローの彩度は飽和することになる。 A coefficient that determines the strength of the saturation S is represented by r. r is determined either so that the length of the largest motion vector in the image does not eventually saturate, or to the range of motion lengths we wish to represent. Specifically, when the maximum vector length on the image is 100 pixels, r=1/100. Alternatively, if the motion length to be expressed ranges from 0 to 10 pixels, then r=1/10. At this time, the saturation of the finally visualized optical flow is saturated.
上記の結果、静止画像から得たモノクロ画像データの成分値である明度、オプティカルフローから得た色相及び彩度が得られることになる。つまり、カラー画像の各画素の3つの成分(もしくは属性)「明度、色相、彩度」が揃うことになる。 As a result of the above, the lightness, which is the component value of the monochrome image data obtained from the still image, and the hue and saturation obtained from the optical flow are obtained. In other words, the three components (or attributes) “brightness, hue, and saturation” of each pixel of the color image are aligned.
そこで、CPU102は、S2040にて、明度、色相、彩度からRGB値への変換を画素毎に実行し、可視化するための表示用の画像データを生成する。[明度、色相、彩度]→「R,G,B」への変換は、例えば次式(3)乃至(5)に示す演算を行えばよい。
Therefore, in S2040, the
ここで、式(3)から式(5)が、先に示した式(1)と式(2)で算出したHSV値をRGB値に変換する式になる。式中の“mod”は剰余を表し、本実施形態では小数点以下の値が算出されるものとする。“clamp”は、第二引数を上限、第三引数を下限として、第一引数を上限、下限の閉区間内に制限した値を返す関数を表す。 Here, equations (3) to (5) are equations for converting the HSV values calculated by equations (1) and (2) shown above into RGB values. "mod" in the formula represents a remainder, and in this embodiment, the value after the decimal point is calculated. "clamp" represents a function that returns a value restricted within a closed interval between the first argument, the upper limit and the lower limit, with the second argument as the upper limit and the third argument as the lower limit.
次式(6)は、上式で算出されたRGB値に対し、モノクロ画像の明度Lを掛けて、可視化画像のRGB画素値(R',G',B')を生成する式を示している。 The following formula (6) is a formula for generating the RGB pixel values (R', G', B') of the visualized image by multiplying the RGB values calculated by the above formula by the brightness L of the monochrome image. there is
式(6)は、モノクロ画像にオプティカルフローを重畳する式を表しているとも言える。ここで、gainとoffsetは、可視化画像の色合いを決める要素で、本実施形態では、それぞれ1.0と0.0とするが、これらの値はユーザが操作部109により適宜修正しても構わない。CPU102は、全画素についてこの上記式(3)乃至(6)を実行することで、表示用の画像データを生成する。
Equation (6) can be said to represent an equation for superimposing optical flow on a monochrome image. Here, gain and offset are elements that determine the color tone of the visualized image, and in this embodiment, they are set to 1.0 and 0.0, respectively. do not have. The
S2050にて、CPU102は、S2040で生成された表示用画像データを表示部108に出力する。ユーザにしてみれば、オプティカルフローが可視化され、且つ、オリジナルの画像の被写体とオプティカルフローとの関係も直感的に把握可能な画像が表示されることになる。
At S<b>2050 ,
以上の通り、本実施形態によれば、モノクロ画像に対し、色差(色相、彩度)でオプティカルフロー、つまり、動きを表現した画像を重畳したかのようなオプティカフローの可視化画像を生成することができる。この画像では、矢印を重畳した画像や、単純なオプティカルフローを可視化画像と違い、被写体細部の動きの有無、動きの大きさと方向を確認できることになる。とくに、高密度に動きを表現できるため、被写体境界部分の動きや、小さい被写体の動きの可視化に適していると言える。逆に、オプティカルフローの算出精度が低い場合には、オプティカルフローの概形と被写体形状とが一致するかの確認にも役立つ。 As described above, according to the present embodiment, it is possible to generate an optical flow visualized image as if an image expressing motion is superimposed on a monochrome image using optical flow with color difference (hue, saturation). can be done. In this image, unlike images with superimposed arrows or images that visualize simple optical flow, the presence or absence of movement in the details of the subject, and the magnitude and direction of movement can be confirmed. In particular, since motion can be expressed with high density, it can be said that it is suitable for visualizing motion at subject boundaries and motion of small subjects. Conversely, when the optical flow calculation accuracy is low, it is also useful for confirming whether the general shape of the optical flow and the shape of the subject match.
ここで、上記処理の理解を容易にするため、図6を参照して説明する。 Here, in order to facilitate understanding of the above processing, description will be made with reference to FIG.
図6における参照符号150は、図2のS2000で取得される、被写体(図示の場合は旅客機)が写ったモノクロ画像(明度成分)の例である。参照符号151は、図2のS2010で取得するオプティカルフローファイルから読み出されるオプティカルフローである。そして、参照符号152は、図2のS2030にて得られる、オプティカルフローのベクトルからの変換で得た色相、彩度を可視化した画像を示している。そして、参照符号153は、図2のS2040で得られる、明度成分、色相、彩度成分からRGB空間への変換で得た表示用画像を示している。特許図面では、カラー画像を図面として示すことができなので、図示の画像そのものが表示されるものではない点に注意されたい。 Reference numeral 150 in FIG. 6 is an example of a monochrome image (brightness component) of a subject (an airliner in the illustrated case) acquired in S2000 of FIG. Reference numeral 151 denotes an optical flow read from the optical flow file acquired in S2010 of FIG. Reference numeral 152 denotes an image in which the hue and saturation obtained by conversion from the optical flow vector obtained in S2030 of FIG. 2 are visualized. Reference numeral 153 denotes a display image obtained by converting the lightness, hue, and saturation components obtained in S2040 of FIG. 2 into the RGB space. It should be noted that in the patent drawings, color images may be shown as drawings, and the illustrated images themselves may not be displayed.
なお、本実施では、オプティカルフローの可視化をHSV表色系で表現したが、これに限定されない。ITU-R Recommendation BT.709に代表される色空間を用いて、オプティカルフローの水平、垂直成分をそれぞれ、輝度と、青成分の色差、赤成分の色差にマップングをした上で、モノクロ画像を合成してもよい。 In addition, although the visualization of the optical flow is represented by the HSV color system in this embodiment, it is not limited to this. ITU-R Recommendation BT. 709, the horizontal and vertical components of the optical flow may be mapped to the luminance, the color difference of the blue component, and the color difference of the red component, respectively, and then synthesized into a monochrome image.
本実施形態例では、各ステップの処理を画像単位で行うものとして説明したが、これに限定されず、各ステップの処理を画素単位で行い、一連のフローを全画素に対して行う構成であってもよい。 In this embodiment, the processing of each step is performed for each image, but the present invention is not limited to this, and the processing of each step is performed for each pixel, and a series of flows is performed for all pixels. may
本実施形態では、gainとoffsetは、それぞれ1.0と0.0としたが、これに限定されない。例えば、それぞれ、0.5,0.5としてよい。これは、画像内の被写体形状が判別さえできれば、可視化画像の輝度成分が入力画像に対し必ずしも一致する必要がないことを示している。 In this embodiment, gain and offset are set to 1.0 and 0.0, respectively, but are not limited to this. For example, they may be 0.5 and 0.5, respectively. This indicates that the luminance component of the visualized image does not necessarily have to match the input image as long as the shape of the subject in the image can be discriminated.
HSV表色系において、入力したモノクロ画像が暗いと生成した可視化画像も、鮮やかにならない、gainとoffsetを調整することによって、HSV値としての輝度が大きくなり、可視化したときにより鮮やかな可視化画像が得られる。本実施形態では、オプティカルフローの動きベクトルの向きを、色相で表現したが、動きの速さのみ可視化してもよい。このためには、例えば、H=0として、式3から式6を計算すればよい。 In the HSV color system, if the input monochrome image is dark, the generated visualized image will not be bright. By adjusting the gain and offset, the luminance as an HSV value will increase, and the visualized image will become more vivid when visualized. can get. In this embodiment, the direction of the motion vector of the optical flow is represented by hue, but only the speed of motion may be visualized. For this purpose, for example, formulas 3 to 6 can be calculated with H=0.
本実施形態では、式1から式6で計算される、変換処理やオプティカルフロー生成をCPU102が行うものとして説明したがそれに限定されない。例えば、図1(b)のような構成をとり、専用モジュールが計算する構成をとってよもよい。図1(b)における変換部105は、動きベクトルの画像化や色変換など式1から式5の計算を行う。オプティカルフロー生成部106は、取得した画像と時間的に前後する画像からオプティカルフローを生成する。画像合成部107は、式6の計算処理を行う。データの入出力は、図4で説明したフローと同じである。このような構成であっても、オプティカルフローの可視化画像を生成できる。
In the present embodiment, it is assumed that the
本実施形態では、揮発性メモリ104から画像を取得する構成を説明したが、それに限定されず、本画像処理装置をカメラとみなした場合、画像取得部110をから画像を逐次取得し、リアルタイムに動画として可視化画像を表示部108に表示する構成をとってもよい。
In the present embodiment, a configuration for acquiring an image from the
[第2の実施形態]
次に、本第2の実施形態における処理手順を説明する。なお、特別な説明ない限り、装置構成は第1の実施形態と同じであるものとし、その説明は省略する。
[Second embodiment]
Next, a processing procedure in the second embodiment will be described. Unless otherwise specified, the configuration of the device is assumed to be the same as that of the first embodiment, and the description thereof will be omitted.
図3のフローチャートは、本第2の実施形態におけるCPU102が実行する処理手順を示している。図2との違いは、S2010の後にS3015が追加されている点であり、それ以外は図2と同じであるため、同参照符号を付し、その説明は省略する。
The flowchart of FIG. 3 shows the processing procedure executed by the
S3015にて、CPU102は、モノクロ画像データからエッジの度合いを示す画像(エッジ画像データ)を生成する。本実施形態では水平、垂直のSobelフィルタ値の二乗和平方根とする。得られるエッジ画像データは1成分で表される画像である。それ故、このエッジ度を明度と見立てれば、上記第1の実施形態と同様に合成画像データを生成できる。なお、一般に、エッジ画像データは、エッジの度合いが高いほど大きな値を割り当てている。本実施形態で生成するエッジ画像データのエッジ度と明度との関係は、エッジの度合いが高いほどその暗く、エッジ度が低いほど明るい画像データとして生成するものとする。それ故、エッジ画像データが8ビットであれば、最大値が255であるので、実施形態では「255-エッジ度」を、エッジ画像データとして生成するものとする。この結果、エッジの度合いが高いほど黒い線として協調されるようになり、且つ、非エッジ部では明るくなるのでオプティカルフローから得た色相、彩度が色として知覚し易くできる。なお、モノクロ画像からエッジ画像の画素値L’を得る式は次式’(7)で与えられる。
In S3015,
S3040にて、色相、彩度、エッジ画像の画素値をRGB値に変換し、可視化画像を生成する。実施例1のS2040の説明において、式(6)が次式(8)に変更されている以外は、同じ処理になる。 At S3040, the pixel values of the hue, saturation, and edge image are converted into RGB values to generate a visualized image. The processing is the same as in the explanation of S2040 in the first embodiment, except that the expression (6) is changed to the following expression (8).
本第2の実施形態によれば、第1の実施形態と同様に、オプティカルフローの概形と被写体形状が一致する可視化画像を静止することができる。特に、グラデーションがある被写体の場合は、第1の実施形態では、可視化画像上の色の変化が動きによるものか、被写体そのものの輝度変化によるものかの判別が難しくなる。これに対し、本第2の実施形態によれば、画像のエッジを抽出し、そのエッジ成分を明度のモノクロ画像と見立てて、そこにオプティカルフローを重畳することによって、2つの判別の容易な可視化画像を生成することができる。 According to the second embodiment, similarly to the first embodiment, it is possible to freeze a visualized image in which the outline of the optical flow matches the shape of the subject. In particular, in the case of a subject with gradation, in the first embodiment, it becomes difficult to determine whether the change in color on the visualized image is due to movement or due to brightness change of the subject itself. On the other hand, according to the second embodiment, the edge of the image is extracted, the edge component is regarded as a monochrome image of brightness, and the optical flow is superimposed thereon to visualize the two easily distinguishable. Images can be generated.
なお、本第2の実施形態では、モノクロ画像を取得して、エッジ画像を生成したが、直接エッジ画像を入力する構成であってもよい。 In the second embodiment, a monochrome image is acquired to generate an edge image, but the edge image may be directly input.
本第2の実施形態では、エッジ画像の生成にSobelフィルタを用いたが、これに限定されず、ラプラシアンフィルタやCanny法など他のエッジ抽出法を用いてもよい。また、エッジ強調処理を行った画像からRGB値を作っても良い。例えば、中心を9,他を-1とする3×3のカーネルでフィルタを掛けたエッジ強調画像の画素値をL”とすると、可視化画像のRGB値は、式8の代わりに次式(9)で計算できる。 In the second embodiment, the Sobel filter is used to generate the edge image, but the present invention is not limited to this, and other edge extraction methods such as the Laplacian filter and the Canny method may be used. Alternatively, RGB values may be generated from an image subjected to edge enhancement processing. For example, if the pixel value of an edge-enhanced image filtered by a 3×3 kernel with 9 at the center and −1 at the others is L″, the RGB values of the visualized image are expressed by the following equation (9 ).
[第3の実施形態]
次に、本第3の実施形態における処理手順を説明する。なお、特別な説明ない限り、装置構成は第1の実施形態と同じであるものとし、その説明は省略する。
[Third embodiment]
Next, a processing procedure in the third embodiment will be described. Unless otherwise specified, the configuration of the device is assumed to be the same as that of the first embodiment, and the description thereof will be omitted.
図4のフローチャートは、本第3の実施形態におけるCPU102が実行する処理手順を示している。図2との違いは、S4015、S4016がS2010の後に追加されている点であり、それ以外については図2と同じであるため説明は省略する。
The flowchart of FIG. 4 shows the processing procedure executed by the
S4015にて、CPU101は、グローバルモーションベクトル(GMV)を取得する。GMVは、画面全体の動きを代表する二次元のベクトルである。GMVの算出方法は特に問わないが、一例として、オプティカルフローからも算出する方法を説明する。オプティカルフローにおける全動きベクトルから、水平成分と、垂直成分をそれぞれ、一画素単位でその頻度を示すヒストグラムを生成する。水平成分と垂直成分のヒストグラムそれぞれの最頻値を、それぞれ水平成分と垂直成分の動きベクトルとし、それをGMVとする。
In S4015,
S4016にて、CPU102は、オプティカルフローの各動きベクトルから、上記で求めたGMVを減じ、補正後のベクトルVを求める。本実施形態において、オプティカルフローの各画素位置の動きベクトルをv’とすると、補正後のベクトルvは、次式(10)で表現される。
In S4016,
以後、補正後の動きベクトルvを持つオプティカルフローとして処理がなされる。 Thereafter, processing is performed as an optical flow having the motion vector v after correction.
動く被写体に追従するようにカメラをパンしながら撮影して得た画像は、その画面上は背景が動き、被写体が画角に対し相対的に静止するようになる。動きベクトルからGMVを引き、それを全画素分実施することにより、背景部分がとまり被写体が動くオプティカルフローを作ることができる。 In an image obtained by panning the camera so as to follow a moving subject, the background moves on the screen and the subject remains relatively still with respect to the angle of view. By subtracting the GMV from the motion vector and executing it for all pixels, it is possible to create an optical flow in which the background portion stops and the subject moves.
オプティカルフローは、一般に画面に対する相対速度で表現される。本第3の実施形態によればGMVを取得し、オプティカルフローの各動きベクトルからGMVを引くことにより、相対速度でなく、絶対速度を得ることができる。つまり、本第3の実施形態によれば、絶対速度で、動きを可視化する画像を生成することができる。 Optical flow is generally represented by a relative speed with respect to the screen. According to the third embodiment, by obtaining the GMV and subtracting the GMV from each motion vector of the optical flow, not the relative velocity but the absolute velocity can be obtained. In other words, according to the third embodiment, it is possible to generate an image that visualizes motion with absolute velocity.
なお、本第3の実施形態でGMVを、オプティカルフローの画素が表すベクトルから減じることで得た差分のベクトルから、色差、彩度を求める点は、上記第1、第2の実施形態、並びに、以下に説明する第4の実施形態にも適用できるものである。 In the third embodiment, the color difference and saturation are obtained from the difference vector obtained by subtracting the GMV from the vector represented by the pixel of the optical flow. , can also be applied to the fourth embodiment described below.
[第4の実施形態]
次に、本第4の実施形態における処理手順を説明する。なお、特別な説明ない限り、装置構成は第1の実施形態と同じであるものとし、その説明は省略する。
[Fourth embodiment]
Next, a processing procedure in the fourth embodiment will be described. Unless otherwise specified, the configuration of the device is assumed to be the same as that of the first embodiment, and the description thereof will be omitted.
図5のフローチャートは、本第4の実施形態におけるCPU102が実行する処理手順を示している。第1の実施形態(図2)に対し、S2000がS5000、S2040がS5040に変更され、S2010の次にS5015が追加された点が異なり、それ以外については図2と同じであるため説明は省略する。
The flowchart of FIG. 5 shows the processing procedure executed by the
上記第1乃至第3の実施形態では、被写体の存在を示す画像として単一成分で表現されるモノクロ画像、もしくはエッジ画像を用いる例であったが、本第4の実施形態では被写体が写っているカラー画像を用いる点が異なる。 In the first to third embodiments, a monochrome image represented by a single component or an edge image is used as an image indicating the presence of a subject. The difference is that a color image is used.
S5010にて、CPU102は、被写体が写っているオリジナルのカラー画像データを入力する。なお、次のS2010で取得するオプティカルフローは、このオリジナル画像に対応したものになる。
At S5010,
S5015にて、CPU102は、オリジナルのカラー画像データの色差成分を弱めた第2のカラー画像データを生成する。本実施形態では、以下の式(11)、(12)、(13)で色差成分を弱めるものとする。
In S5015,
S5040にて、CPU102は、オプティカルフローから求めた色相、彩度と、第2のカラー画像の画素値に適用し、表示用の可視化画像を生成する。ここでは第1の実施形態で説明した式(6)の代わりに以下の式(14)を使って、RGB値が算出されることになる。式(14)における(R',G',B')が、表示用の可視化画像の画素値になる。なお、式中の“○”は、ベクトルの要素毎の積であるアダマール積の計算を示すものとする。
In S5040,
CPU102は、これらの処理を全画素に対して実施することで、RGB値で構成される可視化画像を生成する。
The
本第4の実施形態によれば、オプティカルフローを重畳する画像がモノクロ画像でなくとも、色の成分を弱めることにより、オプティカルフローを重畳し、可視化画像を作ることができる。なお、本第4の実施形態では、色差成分を弱めるためにYUV表色系を用いて、色差を弱めたがこれに限定されない。RGBをHSV表色系に変換して、彩度を弱めてからRGBに戻す構成であってもよい。 According to the fourth embodiment, even if the image on which the optical flow is superimposed is not a monochrome image, it is possible to superimpose the optical flow and create a visualized image by weakening the color component. In the fourth embodiment, the YUV color system is used to weaken the color difference components, but the present invention is not limited to this. A configuration may be used in which RGB is converted to the HSV color system, the saturation is weakened, and then returned to RGB.
(その他の実施例)
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other examples)
The present invention supplies a program that implements one or more functions of the above-described embodiments to a system or device via a network or a storage medium, and one or more processors in the computer of the system or device reads and executes the program. It can also be realized by processing to It can also be implemented by a circuit (for example, ASIC) that implements one or more functions.
発明は上記実施形態に制限されるものではなく、発明の精神及び範囲から離脱することなく、様々な変更及び変形が可能である。従って、発明の範囲を公にするために請求項を添付する。 The invention is not limited to the embodiments described above, and various modifications and variations are possible without departing from the spirit and scope of the invention. Accordingly, the claims are appended to make public the scope of the invention.
101…バス、102…CPU、103…メモリ、104…不揮発メモリ、105…変換部、106…オプティカルフロー生成部、107…画像合成部
107 画像合成部
101
Claims (9)
被写体を含む第1の画像データを取得する第1の取得手段と、
前記第1の画像データの画素毎の動きベクトルを表すオプティカルフローを第2の画像データとして取得する第2の取得手段と、
該第2の取得手段で取得したオプティカルフローを、カラー画像の成分を表すデータに変換する変換手段と、
前記第1の取得手段で取得した前記第1の画像データと、前記変換手段で得た成分とを合成することで、表示用の第3の画像データを生成する合成手段とを有し、
前記第1の取得手段は、前記被写体を含むカラー画像データから、予め設定された値に従って色差を弱めたカラー画像データに変換し、当該変換で得たカラー画像データを前記第1の画像データとして取得し、
前記合成手段は、前記第1の取得手段で取得した前記第1の画像データの各成分値と、前記変換手段で得た色相、彩度とから合成画像データを生成し、当該合成画像データからRGBの成分値で表すカラー画像データを前記第3の画像データとして生成する
ことを特徴とする画像処理装置。 An image processing device that generates display image data including a subject,
a first acquisition means for acquiring first image data including a subject;
a second obtaining means for obtaining, as second image data, an optical flow representing a motion vector for each pixel of the first image data;
conversion means for converting the optical flow acquired by the second acquisition means into data representing components of a color image;
synthesizing means for synthesizing the first image data obtained by the first obtaining means and the components obtained by the converting means to generate third image data for display ;
The first obtaining means converts the color image data including the subject into color image data in which the color difference is weakened according to a preset value, and uses the color image data obtained by the conversion as the first image data. Acquired,
The synthesizing means generates synthetic image data from each component value of the first image data acquired by the first acquiring means and the hue and saturation obtained by the converting means. generating color image data represented by RGB component values as the third image data;
An image processing apparatus characterized by:
ことを特徴とする請求項1又は2に記載の画像処理装置。 The first acquisition means converts color image data including the subject into monochrome image data composed only of brightness components, and acquires the monochrome image data obtained by the conversion as the first image data. 3. The image processing apparatus according to claim 1 or 2.
ことを特徴とする請求項1又は2に記載の画像処理装置。 The first acquisition means converts monochrome image data including the subject into edge image data representing edge strength, and acquires the edge image data obtained by the conversion as the first image data. 3. The image processing device according to claim 1 or 2.
ことを特徴とする請求項4に記載の画像処理装置。 5. The image data of claim 4, wherein the first image data acquired by the first acquisition means is image data having a smaller value as the degree of edge is higher and a larger value as the degree of edge is lower. The described image processing device.
前記合成手段は、前記第1の取得手段で取得した前記第1の画像データの画素値を明度、前記変換手段で得た色相、彩度とから合成画像データを生成し、当該合成画像データからRGBの成分値で表すカラー画像を前記第3の画像データとして生成する
ことを特徴とする請求項1乃至5のいずれか1項に記載の画像処理装置。 The conversion means converts the direction and magnitude of the vector represented by the optical flow into values indicating hue and saturation in a color space,
The synthesizing means generates synthesized image data from the pixel values of the first image data obtained by the first obtaining means and the hue and saturation obtained by the converting means. The image processing apparatus according to any one of claims 1 to 5, wherein a color image represented by RGB component values is generated as the third image data.
前記オプティカルフローの各画素に相当するベクトルから、前記グローバルモーションベクトルを減じることで得た差分のベクトルを、前記カラー画像の成分を表すデータに変換する
ことを特徴とする請求項1乃至6のいずれか1項に記載の画像処理装置。 said transforming means obtains histograms of horizontal and vertical components of all vectors of said optical flow, and extracts each most frequent component value as a component value of a global motion vector;
7. A differential vector obtained by subtracting the global motion vector from a vector corresponding to each pixel of the optical flow is converted into data representing components of the color image. 1. The image processing apparatus according to claim 1.
第1の取得手段が、被写体を含む第1の画像データを取得する第1の取得工程と、
第2の取得手段が、前記第1の画像データの画素毎の動きベクトルを表すオプティカルフローを第2の画像データとして取得する第2の取得工程と、
変換手段が、前記第2の取得工程で取得したオプティカルフローを、カラー画像の成分を表すデータに変換する変換工程と、
合成手段が、前記第1の取得工程で取得した前記第1の画像データと、前記変換工程で得た成分とを合成することで、表示用の第3の画像データを生成する合成工程とを有し、
前記第1の取得工程では、前記被写体を含むカラー画像データから、予め設定された値に従って色差を弱めたカラー画像データに変換し、当該変換で得たカラー画像データを前記第1の画像データとして取得し、
前記合成工程では、前記第1の取得工程で取得した前記第1の画像データの各成分値と、前記変換工程で得た色相、彩度とから合成画像データを生成し、当該合成画像データからRGBの成分値で表すカラー画像データを前記第3の画像データとして生成する
ことを特徴とする画像処理装置の制御方法。 A control method for an image processing device that generates display image data including a subject, comprising:
a first obtaining step in which the first obtaining means obtains first image data including the subject;
a second acquiring step of acquiring, as second image data, an optical flow representing a motion vector for each pixel of the first image data;
a conversion step in which the conversion means converts the optical flow acquired in the second acquisition step into data representing components of a color image;
a synthesizing step of synthesizing the first image data obtained in the first obtaining step and the components obtained in the converting step to generate third image data for display; have
In the first obtaining step, the color image data including the subject is converted into color image data in which the color difference is weakened according to a preset value, and the color image data obtained by the conversion is used as the first image data. Acquired,
In the synthesizing step, synthesized image data is generated from each component value of the first image data obtained in the first obtaining step and the hue and saturation obtained in the converting step, and from the synthesized image data generating color image data represented by RGB component values as the third image data;
A control method for an image processing apparatus, characterized by:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019095535A JP7329964B2 (en) | 2019-05-21 | 2019-05-21 | Image processing device, image processing method and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019095535A JP7329964B2 (en) | 2019-05-21 | 2019-05-21 | Image processing device, image processing method and program |
Publications (3)
| Publication Number | Publication Date |
|---|---|
| JP2020190903A JP2020190903A (en) | 2020-11-26 |
| JP2020190903A5 JP2020190903A5 (en) | 2022-05-18 |
| JP7329964B2 true JP7329964B2 (en) | 2023-08-21 |
Family
ID=73453773
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2019095535A Active JP7329964B2 (en) | 2019-05-21 | 2019-05-21 | Image processing device, image processing method and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP7329964B2 (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008046761A (en) | 2006-08-11 | 2008-02-28 | Sumitomo Electric Ind Ltd | Mobile object image processing system, apparatus and method |
| JP2012085214A (en) | 2010-10-14 | 2012-04-26 | Fujitsu Ltd | Data compression method and data compression device |
| JP2017207818A (en) | 2016-05-16 | 2017-11-24 | キヤノン株式会社 | Image processing apparatus, image processing method and program |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0720274B2 (en) * | 1988-06-08 | 1995-03-06 | 沖電気工業株式会社 | Motion vector display method |
| KR101946256B1 (en) * | 2018-07-09 | 2019-02-11 | 이노뎁 주식회사 | method of processing compressed video for visual presentation of motion vectors of the same |
-
2019
- 2019-05-21 JP JP2019095535A patent/JP7329964B2/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008046761A (en) | 2006-08-11 | 2008-02-28 | Sumitomo Electric Ind Ltd | Mobile object image processing system, apparatus and method |
| JP2012085214A (en) | 2010-10-14 | 2012-04-26 | Fujitsu Ltd | Data compression method and data compression device |
| JP2017207818A (en) | 2016-05-16 | 2017-11-24 | キヤノン株式会社 | Image processing apparatus, image processing method and program |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2020190903A (en) | 2020-11-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CA2745380C (en) | Devices and methods for processing images using scale space | |
| JP5487610B2 (en) | Image processing apparatus and method, and program | |
| JP6786850B2 (en) | Image processing equipment, image processing methods, image processing systems and programs | |
| JP2020129276A (en) | Image processing apparatus, image processing method, and program | |
| JP6635799B2 (en) | Image processing apparatus, image processing method, and program | |
| KR101821285B1 (en) | Apparatus and method for thermal image enhancement | |
| JP7207957B2 (en) | Image processing device, image processing method, and program | |
| WO2017163384A1 (en) | Data processing device, data processing method, and data processing program | |
| JP2020061080A (en) | Image processing device, imaging device, and image processing method | |
| JP6904842B2 (en) | Image processing device, image processing method | |
| KR20140121711A (en) | Method of image proccessing, Computer readable storage medium of recording the method and a digital photographing apparatus | |
| JP7329964B2 (en) | Image processing device, image processing method and program | |
| JP2005182232A (en) | Luminance correction apparatus and luminance correction method | |
| JP6854629B2 (en) | Image processing device, image processing method | |
| JP2020181399A (en) | Image processing device and its control method and program | |
| JP7134766B2 (en) | Image processing device, image processing method and program | |
| JP5903315B2 (en) | Image processing apparatus and image processing program | |
| JP2016201771A (en) | Image processing apparatus, image processing method, and program | |
| JP7012457B2 (en) | Image processing device, image processing method | |
| JP7034690B2 (en) | Information processing equipment, information processing methods and programs | |
| WO2016111239A1 (en) | Image processing device, image processing method and program recording medium | |
| JP2021022263A (en) | Image processing program, image processing device, image processing system, and image processing method | |
| JP2016110354A (en) | Image processor, image processing method, and program | |
| JP7366689B2 (en) | Image processing device, image processing method and program | |
| US20240013361A1 (en) | Image processing device and method for image processing |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20210103 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20210113 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20220509 |
|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220509 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230124 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20230203 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230403 |
|
| 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: 20230710 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230808 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 7329964 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |