JP5400573B2 - Image processing apparatus and imaging apparatus - Google Patents

Image processing apparatus and imaging apparatus Download PDF

Info

Publication number
JP5400573B2
JP5400573B2 JP2009256195A JP2009256195A JP5400573B2 JP 5400573 B2 JP5400573 B2 JP 5400573B2 JP 2009256195 A JP2009256195 A JP 2009256195A JP 2009256195 A JP2009256195 A JP 2009256195A JP 5400573 B2 JP5400573 B2 JP 5400573B2
Authority
JP
Japan
Prior art keywords
macroblock
pixel
search
pixels
image frame
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
JP2009256195A
Other languages
Japanese (ja)
Other versions
JP2011101305A (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.)
Sharp Corp
Original Assignee
Sharp 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 Sharp Corp filed Critical Sharp Corp
Priority to JP2009256195A priority Critical patent/JP5400573B2/en
Publication of JP2011101305A publication Critical patent/JP2011101305A/en
Application granted granted Critical
Publication of JP5400573B2 publication Critical patent/JP5400573B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、映像信号から動きベクトルや視差情報を検出する、画像処理装置および撮像装置に関し、特に、動きベクトルや視差情報の検出精度および検出処理速度の向上に関する。   The present invention relates to an image processing apparatus and an imaging apparatus that detect a motion vector and parallax information from a video signal, and more particularly to improvement in detection accuracy and detection processing speed of a motion vector and parallax information.

従来から、映像信号を圧縮する方法として動き補償が広く用いられている。これは、映像信号から抽出した連続する画像(映像)フレーム内のオブジェクト(要素)の移動方向、移動量を示す動きベクトルを検出し、この動きベクトル基づき画像フレームを圧縮するものであり、高圧縮率を実現する方法である。   Conventionally, motion compensation has been widely used as a method of compressing a video signal. This is to detect a motion vector indicating the moving direction and moving amount of an object (element) in a continuous image (video) frame extracted from a video signal, and compresses the image frame based on this motion vector. It is a way to realize the rate.

動きベクトルを検出する代表的な方法として、ブロックマッチングやステレオマッチングと呼ばれる方法が提案されている。以下に、このブロックマッチング処理を説明する。
まず、連続する第1画像フレーム、第2画像フレームにおいて、第1画像フレームに例えば縦16画素×横16画素からなる基準マクロブロックを設定(定義)する。更に、設定した基準マクロブロックと空間的に同位置にある第2画像フレームの画素ブロックに前記基準マクロブロックと同じ大きさの探索マクロブロックを設定する。
As typical methods for detecting a motion vector, methods called block matching and stereo matching have been proposed. Below, this block matching process is demonstrated.
First, in a continuous first image frame and second image frame, a reference macroblock consisting of, for example, 16 vertical pixels × 16 horizontal pixels is set (defined) in the first image frame. Further, a search macroblock having the same size as the reference macroblock is set in the pixel block of the second image frame that is spatially at the same position as the set reference macroblock.

その後、前記探索マクロブロックを1又は複数画素毎に上下左右に移動し、基準マクロブロックの画素の画素値と当該画素に対応する探索マクロブロックの画素の画素値との差分絶対値を算出し、ブロック内の全画素に対する前記差分絶対値の総和、すなわち、差分絶対値和が最小になる探索マクロブロックの位置を特定する。そして、この位置を基準マクロブロックの移動先のマクロブロックとみなし、基準マクロブロックの動きベクトルを得る。
前記画素値としては明るさに相当する値が用いられ、例えば、注目位置近傍の赤画素、緑画素、青画素の和を明るさ値としたり、決められた行列式によって輝度値を算出したりして求めることができる。
Thereafter, the search macroblock is moved up, down, left and right for every one or a plurality of pixels, and the absolute value of the difference between the pixel value of the pixel of the reference macroblock and the pixel value of the search macroblock corresponding to the pixel is calculated, The position of the search macro block that minimizes the sum of the absolute difference values for all the pixels in the block, that is, the absolute difference value sum is specified. Then, this position is regarded as a macroblock to which the reference macroblock is moved, and a motion vector of the reference macroblock is obtained.
As the pixel value, a value corresponding to brightness is used. For example, the sum of red pixels, green pixels, and blue pixels in the vicinity of the target position is used as a brightness value, or a brightness value is calculated using a predetermined determinant. Can be obtained.

なお、異なる視点位置に配置された撮像装置から同一の被写体を撮像すれば、視差情報に基づき視点位置から被写体までの距離を算出することができる。動きベクトルの検出では連続する2画像フレームに対してブロックマッチングを行うが、被写体までの距離を算出する場合には、例えば、異なる2つの視点位置に配置された2つの撮像装置が出力した同一被写体に係る2画像フレームに対してブロックマッチングを行い前記同一被写体に対する視差情報を検出すれば、撮像装置から被写体までの距離を求めることができる。   In addition, if the same subject is imaged from imaging devices arranged at different viewpoint positions, the distance from the viewpoint position to the subject can be calculated based on the parallax information. In motion vector detection, block matching is performed on two consecutive image frames. When calculating the distance to a subject, for example, the same subject output by two imaging devices arranged at two different viewpoint positions is used. By performing block matching on the two image frames and detecting parallax information for the same subject, the distance from the imaging device to the subject can be obtained.

ところで、撮像素子の各画素に対応してベイヤ配列状のR・G・Bフィルタが設けられている撮像装置が出力した画像フレームに基づき動きベクトルを検出することがある。この画像フレームは、デモザイク処理を行わないRAWデータ(生データ)である。   By the way, there is a case where a motion vector is detected based on an image frame output by an imaging device provided with a Bayer array R / G / B filter corresponding to each pixel of the imaging device. This image frame is RAW data (raw data) that is not subjected to demosaic processing.

そして、このような画像フレーム内のオブジェクトに対して高速に動きベクトルを検出する方法が様々提案されている。
例えば、特許文献1には、図16に示すように、R・G・Bフィルタ(色画素)と透明フィルタ(白色画素)とが周期的に配列されるベイヤ配列状のフィルタが設けられた撮像素子が出力する画像フレームから、白色画素(P画素)の輝度値を抽出し、この輝度値に基づき、ブロックマッチングを行い、高速に動きベクトルを検出する動きベクトル検出装置が開示されている。
Various methods for detecting a motion vector at high speed with respect to an object in such an image frame have been proposed.
For example, in Patent Document 1, as shown in FIG. 16, an imaging provided with a Bayer array filter in which R, G, B filters (color pixels) and transparent filters (white pixels) are periodically arrayed is provided. A motion vector detection device that extracts a brightness value of a white pixel (P pixel) from an image frame output from an element, performs block matching based on the brightness value, and detects a motion vector at high speed is disclosed.

特開2008−141706号公報JP 2008-141706 A

しかしながら、特許文献1に開示の手法では、白色画素の画素値(輝度値)に基づき、ブロックマッチングにより動きベクトルを検出すると誤検出が発生する可能性がある。例えば、明るさが同じである赤色の物体Xと青色の物体Yが第1画像フレームおよび第2画像フレームにあるとする。赤色物体Xの明るさと青色物体Yの明るさは同じであるので、両物体X、Yの画素の輝度値としては差がない。   However, in the method disclosed in Patent Document 1, if a motion vector is detected by block matching based on a pixel value (luminance value) of a white pixel, there is a possibility that erroneous detection occurs. For example, it is assumed that a red object X and a blue object Y having the same brightness are in the first image frame and the second image frame. Since the brightness of the red object X and the brightness of the blue object Y are the same, there is no difference in the luminance values of the pixels of both the objects X and Y.

それ故、第1画像フレームの赤色物体Xの領域に対応するマクロブロックMと、第2画像フレームの青色物体Yの領域に対応するマクロブロックMとの間で差分絶対値和を算出して両マクロブロックのマッチングを行うと、第2画像フレームの青色物体Yに対応するマクロブロックMが第1画像フレームの赤色物体Xに対応するマクロブロックMの移動先ブロックであると誤認識することがあり、動きベクトルの検出精度が大きく低下する。 Therefore, to calculate the macroblock M X corresponding to the area of the red object X of the first image frame, a sum of absolute differences between the macroblock M Y corresponding to the area of the blue object Y of the second image frame When performing matching of both macroblocks Te, misrecognized macroblock M Y corresponding to the blue object Y of the second image frame is the destination block of the macroblock M X corresponding to the red object X of the first image frame As a result, the accuracy of motion vector detection is greatly reduced.

また、輝度値を精度よく検出するために、特許文献1に開示されているように透明画素を配置すると、緑色画素の個数が減少し、色の解像度が減少して撮像装置により撮像した画像の画質が低下してしまう。さらに、透明画素のノイズの影響は低減することが可能だが、色画素の透過率は、透明画素の1/3程度しかないので光量も1/3となりノイズが増加してしまい、撮像装置で撮像した画像のノイズが増加して画質が低下してしまう。   In addition, when transparent pixels are arranged as disclosed in Patent Document 1 in order to detect luminance values with high accuracy, the number of green pixels is reduced, the color resolution is reduced, and the image captured by the imaging device is reduced. The image quality will deteriorate. Furthermore, although the influence of noise on transparent pixels can be reduced, the transmittance of color pixels is only about 1/3 that of transparent pixels, so the amount of light is also reduced to 1/3, and noise is increased, and imaging is performed by an imaging device. The image noise will increase and the image quality will deteriorate.

一方、赤色画素、緑色画素、青色画素の画素値をそのまま利用してブロックマッチングをすることも可能である。これにより色の違いによって誤検出の可能性を低減することができるが、計算量が増大してしまうという問題が発生する。すなわち、輝度を使ってブロックマッチングをするときには輝度チャネルの1チャネル分のマッチングであるが、赤色、緑色、青色の各チャネルを使うと3チャネル分のマッチングが必要となり、計算量は少なくとも3倍以上になってしまう。   On the other hand, it is possible to perform block matching using the pixel values of the red pixel, the green pixel, and the blue pixel as they are. This can reduce the possibility of erroneous detection due to the difference in color, but causes a problem that the amount of calculation increases. In other words, when performing block matching using luminance, matching is performed for one channel of the luminance channel, but using red, green, and blue channels requires matching for three channels, and the calculation amount is at least three times or more. Become.

なお、動きベクトルの検出だけではなく、視差情報の検出でも同様の問題が生じる。   The same problem occurs not only in motion vector detection but also in detection of parallax information.

本発明は、かかる実情に鑑みてなされたものであり、例えば撮像素子の各画素に対応してベイヤ配列状のR・G・Bフィルタが設けられている撮像装置が出力した画像フレームに基づき、ブロックマッチング法により動きベクトルや視差情報を検出する場合において、動きベクトルや視差情報を高精度、かつ、高速に検出する画像処理装置、当該装置を備えた撮像装置を提供することを目的とする。   The present invention has been made in view of such a situation, for example, based on an image frame output by an imaging device provided with a Bayer array R, G, B filter corresponding to each pixel of the imaging device, An object of the present invention is to provide an image processing apparatus that detects a motion vector and parallax information with high accuracy and at high speed when detecting a motion vector and parallax information by a block matching method, and an imaging apparatus including the apparatus.

第1の技術手段は、ベイヤ配列状の原色画素配置を有する第1画像フレームに基準マクロブロックを設定する基準マクロブロック設定部と、前記第1画像フレームに設定した基準マクロブロックのベイヤ配列状の原色画素配置と同じベイヤ配列状の原色画素配置になるように第2画像フレームに対して探索マクロブロックを設定する探索マクロブロック設定部とを備え、前記探索マクロブロック設定部は、前記基準マクロブロック設定部が前記第1画像フレームに設定した基準マクロブロックと空間的に同位置にある前記第2画像フレームの画素ブロックに前記基準マクロブロックと同じ大きさの探索マクロブロックを設定するものであり、前記探索マクロブロックを偶数画素毎に移動、再設定し、前記基準マクロブロックの任意の2つの位置で前記原色画素の色の重みが一定となるように、前記基準マクロブロックに含まれる前記原色画素の各色の画素数に応じて、前記原色画素の各色の重み付けを行うことにより、前記基準マクロブロックおよび前記探索マクロブロックに対してブロックマッチングを行うこと動きベクトル又は視差情報を算出することを特徴とする画像処理装置である。 The first technical means includes a reference macroblock setting unit that sets a reference macroblock in a first image frame having a Bayer array-like primary color pixel arrangement, and a Bayer array-like configuration of the reference macroblock set in the first image frame. A search macroblock setting unit configured to set a search macroblock for the second image frame so that the primary color pixel arrangement of the same Bayer arrangement as the primary color pixel arrangement is obtained, and the search macroblock setting unit includes the reference macroblock The block setting unit sets a search macroblock having the same size as the reference macroblock in the pixel block of the second image frame that is spatially located at the same position as the reference macroblock set in the first image frame. , Move and reset the search macroblock every even number of pixels, and any two of the reference macroblocks As the weight of the color of the primary color pixels in location it becomes constant, according to the number of pixels of each color of the primary color pixels included in the reference macroblock, by performing the color weighting of the primary colors pixel, the reference macro an image processing apparatus and calculates a motion vector or disparity information by performing block matching for a block and the search macro block.

の技術手段は、撮像素子の各画素に対応してベイヤ配列状のR・G・Bフィルタを備えた撮像装置において、第の前記画像処理装置を備え、前記撮像素子が生成したベイヤ配列状の原色画素配置を有する画像フレームを当該画像処理装置に出力することを特徴とする撮像装置である。
According to a second technical means, in the imaging apparatus provided with the R, G, B filters in a Bayer arrangement corresponding to each pixel of the imaging element, the first technical processing unit includes the first image processing apparatus, and the Bayer generated by the imaging element. An image pickup apparatus that outputs an image frame having an array of primary color pixel arrangements to the image processing apparatus.

本発明によれば、例えば撮像素子の各画素に対応してベイヤ配列状のR・G・Bフィルタが設けられている撮像装置が出力した画像フレームに基づき、ブロックマッチング法により動きベクトルや視差情報を検出する場合において、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が同じになるように、探索マクロブロックを設定するので、動きベクトルや視差情報を高精度、かつ、高速に検出することができる。   According to the present invention, for example, based on an image frame output from an imaging device provided with a Bayer array R, G, B filter corresponding to each pixel of the imaging device, a motion vector and disparity information are obtained by a block matching method. Since the search macroblock is set so that the Bayer array primary color pixel arrangement of the reference macroblock is the same as the Bayer array primary color pixel arrangement of the search macroblock, motion vectors and disparity information are detected. Can be detected with high accuracy and at high speed.

本発明の第1の実施形態に係る画像処理装置、撮像装置の機能ブロック図である。1 is a functional block diagram of an image processing apparatus and an imaging apparatus according to a first embodiment of the present invention. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 探索マクロブロックを示す図である。It is a figure which shows a search macroblock. 探索マクロブロックを示す図である。It is a figure which shows a search macroblock. 探索マクロブロックを示す図である。It is a figure which shows a search macroblock. 基準マクロブロック、探索マクロブロックの設定処理、動きベクトルの検出処理を説明するためのフロー図である。It is a flowchart for demonstrating the setting process of a reference | standard macroblock and a search macroblock, and the detection process of a motion vector. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 基準マクロブロックを示す図である。It is a figure which shows a reference | standard macroblock. 本発明の第2の実施形態に係る画像処理装置、撮像装置の機能ブロック図である。It is a functional block diagram of the image processing apparatus and imaging device which concern on the 2nd Embodiment of this invention. 探索マクロブロックを示す図である。It is a figure which shows a search macroblock. 画素配置を入れ替えた後の探索マクロブロックを示す図である。It is a figure which shows the search macroblock after replacing pixel arrangement. 従来技術を説明する図である。It is a figure explaining a prior art.

以下、図面を使って本発明の実施の形態を詳細に説明する。なお、各図における構成は理解しやすいように誇張して記載しており、実際の間隔や大きさとは異なる。
(実施形態1)
図1は、本発明の第1の実施形態に係る画像処理装置1および画像処理装置1に接続される撮像装置2の機能ブロック図である。
画像処理装置1は、動きベクトル検出部11を備え、撮像装置2は、撮像部21、画像フレームメモリ22を備える。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The configuration in each drawing is exaggerated for easy understanding, and is different from the actual interval and size.
(Embodiment 1)
FIG. 1 is a functional block diagram of an image processing apparatus 1 and an imaging apparatus 2 connected to the image processing apparatus 1 according to the first embodiment of the present invention.
The image processing device 1 includes a motion vector detection unit 11, and the imaging device 2 includes an imaging unit 21 and an image frame memory 22.

まず、撮像装置2の機能ブロックについて説明する。
撮像部21は、CCD、CMOS等の撮像素子を備え、撮像素子には光の波長を選択するR・G・Bフィルタが設けられている。R・G・Bフィルタは、ベイヤ配列状のR・G・Bフィルタから構成され、各色のフィルタが撮像素子の各画素に対応して設けられている。撮像部21は、各画素における光電変換により画像フレーム(画像データ)を生成し、画像フレームメモリ22に出力する。この画像フレームは、ベイヤ配列状の原色画素配置(ベイヤ配列状のR・G・B画素配置)を有するものである。
画像フレームメモリ22は、画像フレームを記憶するメモリで、少なくとも2つの画像フレームを記憶できる記憶容量を有している。
First, functional blocks of the imaging device 2 will be described.
The imaging unit 21 includes an imaging element such as a CCD or CMOS, and an R / G / B filter for selecting the wavelength of light is provided in the imaging element. The R, G, and B filters are composed of Bayer array R, G, and B filters, and filters of each color are provided corresponding to each pixel of the image sensor. The imaging unit 21 generates an image frame (image data) by photoelectric conversion in each pixel and outputs the image frame to the image frame memory 22. This image frame has a Bayer array primary color pixel arrangement (Bayer array R, G, B pixel arrangement).
The image frame memory 22 is a memory for storing image frames, and has a storage capacity capable of storing at least two image frames.

次に、画像処理装置1の機能ブロックについて説明する。
動きベクトル検出部11は、撮像装置2の画像フレームメモリ22に記憶されている画像フレームの画素(物体)に対して動きベクトルを検出する。なお、後述するように、動きベクトル検出部11は、動きベクトルだけなく、視差情報なども検出することができる。
画像フレームメモリ22には連続する2つの画像フレームである第1画像フレーム、第2画像フレームが記憶されているものとする。撮像部21が動いている被写体を撮像した場合には、被写体の画像内での位置が異なって撮像されている。
Next, functional blocks of the image processing apparatus 1 will be described.
The motion vector detection unit 11 detects a motion vector for a pixel (object) of an image frame stored in the image frame memory 22 of the imaging device 2. As will be described later, the motion vector detection unit 11 can detect not only a motion vector but also parallax information and the like.
Assume that the image frame memory 22 stores a first image frame and a second image frame, which are two consecutive image frames. When the imaging unit 21 captures a moving subject, the subject is captured at a different position in the image.

なお、視差情報を検出する場合、異なる2つの視点位置に配置された2つの撮像装置が出力した同一被写体に係る2画像フレームが第1画像フレーム、第2画像フレームとして、ベクトル検出部11に入力される。   When detecting disparity information, two image frames related to the same subject output by two imaging devices arranged at two different viewpoint positions are input to the vector detection unit 11 as a first image frame and a second image frame. Is done.

動きベクトル検出部11の基準マクロブロック設定部11aは、画像フレームメモリ22の第1画像フレームに対して基準マクロブロックを設定(定義)する。
すなわち、撮像素子(撮像部21)の各画素に対応してベイヤ配列状のR・G・Bフィルタが設けられている撮像装置2が出力した、ベイヤ配列状の原色画素配置を有する第1画像フレームに基準マクロブロックを設定する。
The reference macroblock setting unit 11 a of the motion vector detection unit 11 sets (defines) a reference macroblock for the first image frame in the image frame memory 22.
That is, the first image having the Bayer array primary color pixel arrangement output from the imaging device 2 provided with the Bayer array R, G, B filter corresponding to each pixel of the image sensor (imaging unit 21). Set the reference macroblock in the frame.

探索マクロブロック設定部11bは、基準マクロブロック設定部11aが第1画像フレームに設定した基準マクロブロックのベイヤ配列状の原色画素配置と同じベイヤ配列状の原色画素配置になるように第2画像フレーム(次画像フレーム)に対して探索マクロブロックを設定する。なお、第2画像フレームもベイヤ配列状の原色画素配置を有する。   The search macroblock setting unit 11b sets the second image frame so that the Bayer arrangement primary color pixel arrangement of the reference macroblock set by the reference macroblock setting unit 11a in the first image frame is the same as the Bayer arrangement primary color pixel arrangement. A search macroblock is set for (next image frame). The second image frame also has a primary color pixel arrangement in a Bayer array.

差分絶対値和算出部11cは、基準マクロブロックの画素の画素値と当該画素に対応する探索マクロブロックの画素の画素値との差分絶対値を算出し、ブロック内の全画素に対する前記差分絶対値の総和、すなわち、差分絶対値和を算出し、差分絶対値和評価部11dに出力する。このとき、基準マクロブロック、探索マクロブロックの座標情報も差分絶対値和評価部11dに出力する。座標情報は、例えば、撮像素子における各マクロブロックの左上のxy座標、撮像素子における各マクロブロックの中心のxy座標、基準マクロブロックを原点とした相対座標、メモリ上のアドレスなどでよい。   The difference absolute value sum calculation unit 11c calculates an absolute difference between the pixel value of the pixel of the reference macroblock and the pixel value of the pixel of the search macroblock corresponding to the pixel, and the difference absolute value for all the pixels in the block Is calculated, that is, the difference absolute value sum is calculated and output to the difference absolute value sum evaluation unit 11d. At this time, the coordinate information of the reference macro block and the search macro block is also output to the difference absolute value sum evaluation unit 11d. The coordinate information may be, for example, an xy coordinate at the upper left of each macroblock in the image sensor, an xy coordinate at the center of each macroblock in the image sensor, a relative coordinate with the reference macroblock as the origin, an address on the memory, or the like.

差分絶対値和評価部11dは、差分絶対値和算出部11cから入力された各マクロブロックの差分絶対値和を比較し、差分絶対値和が最小になる探索マクロブロックの位置を特定する。   The difference absolute value sum evaluation unit 11d compares the difference absolute value sums of the macroblocks input from the difference absolute value sum calculation unit 11c, and specifies the position of the search macroblock that minimizes the difference absolute value sum.

以下に、本発明の動きベクトル検出処理の詳細について説明する。
図2は、撮像部21の撮像素子が出力する画像フレームの一部分を示している。
図2のマトリクスで示される画素の上段に記載された文字のR・G・Bがそれぞれ赤色画素・緑色画素・青色画素を示し、同下段に記載された4桁の数値は、画素の位置情報を示し、上2桁が列番号、下2桁が行番号を示している。
図2のベイヤ配列は、縦横2画素(計4画素)を一組とする画素ブロックにおいて、2画素のG画素が斜めに、また、1画素のR画素、1画素のB画素が斜めに配置されている配列である。
Details of the motion vector detection process of the present invention will be described below.
FIG. 2 shows a part of an image frame output by the image sensor of the imaging unit 21.
The letters R, G, and B described in the upper part of the pixel shown in the matrix of FIG. 2 indicate the red pixel, the green pixel, and the blue pixel, respectively, and the four-digit numerical value described in the lower part is pixel position information. The upper two digits indicate the column number, and the lower two digits indicate the row number.
In the Bayer array of FIG. 2, two G pixels are diagonally arranged, and one R pixel and one B pixel are diagonally arranged in a pixel block having a set of two vertical and horizontal pixels (total of four pixels). Array.

まず、基準マクロブロック設定部11aは、図2に示すように、第1画像フレームに対して基準マクロブロックを設定する。本実施形態では、基準マクロブロックの大きさは、縦8画素、横8画素であるとする。
さらに、探索マクロブロック設定部11bは、図3に示すように、基準マクロブロック設定部11aが第1画像フレームに設定した基準マクロブロックと空間的に同位置にある第2画像フレームの画素ブロックに前記基準マクロブロックと同じ大きさの探索マクロブロックを設定する。
First, the reference macroblock setting unit 11a sets a reference macroblock for the first image frame as shown in FIG. In the present embodiment, the size of the reference macroblock is assumed to be 8 pixels vertically and 8 pixels horizontally.
Further, as shown in FIG. 3, the search macroblock setting unit 11b applies the pixel block of the second image frame spatially located at the same position as the reference macroblock set by the reference macroblock setting unit 11a to the first image frame. A search macroblock having the same size as the reference macroblock is set.

探索マクロブロックの設定が終了すると、差分絶対値和算出部11cは、基準マクロブロックの画素の画素値(以下、基準マクロブロックの画素値と略記する)と当該画素に対応する探索マクロブロックの画素の画素値(以下、探索マクロブロックの画素値と略記する)との差分絶対値を算出し、ブロック内の全画素に対する差分絶対値和Sを算出する。   When the setting of the search macroblock is completed, the difference absolute value sum calculation unit 11c sets the pixel value of the pixel of the reference macroblock (hereinafter abbreviated as the pixel value of the reference macroblock) and the pixel of the search macroblock corresponding to the pixel. The absolute value of the difference between the pixel value (hereinafter abbreviated as the pixel value of the search macroblock) is calculated, and the sum of absolute differences S for all the pixels in the block is calculated.

例えば、基準マクロブロックの画素値をP、探索マクロブロックの画素値をP’として、マクロブロック内での位置を縦方向i、横方向jとすると、差分絶対値和Sは、(式1)により算出される。
S=ΣΣ|Pij−P’ij|……(式1)
For example, assuming that the pixel value of the reference macroblock is P, the pixel value of the search macroblock is P ′, and the position in the macroblock is the vertical direction i and the horizontal direction j, the difference absolute value sum S is given by (Expression 1) Is calculated by
S = ΣΣ | P ij −P ′ ij | (Formula 1)

図2の基準マクロブロックと図3の探索マクロブロックとから差分絶対値和を求める場合、図2の基準マクロブロック左上G0101の画素値と、図3の探索マクロブロック左上G’0101の画素値の差、同B0201の画素値と同B’0201の画素値の差、同R0102の画素値と同R’0102の画素値の差のようにブロック内の全画素に対して画素値の差を算出し、その総和を算出する。
すなわち、図2の基準マクロブロックの画素値と図3の探索マクロブロックの画素値との差分算出においては、互いに同じ色の画素値の差分を算出する。
When obtaining the sum of absolute differences from the reference macroblock of FIG. 2 and the search macroblock of FIG. 3, the pixel value of the upper left G0101 of the reference macroblock of FIG. 2 and the pixel value of the upper left G′0101 of the search macroblock of FIG. The difference in pixel value is calculated for all pixels in the block, such as the difference, the difference between the pixel value of B0201 and the pixel value of B'0201, and the difference of the pixel value of R0102 and the pixel value of R'0102. And the sum is calculated.
That is, in calculating the difference between the pixel value of the reference macroblock in FIG. 2 and the pixel value of the search macroblock in FIG. 3, the difference between the pixel values of the same color is calculated.

図2の基準マクロブロックの画素値と図3の探索マクロブロックの画素値による差分絶対値和Sの算出が終了すると、差分絶対値和算出部11cは、算出結果を差分絶対値和評価部11dに出力する。   When the calculation of the sum of absolute differences S based on the pixel values of the reference macroblock in FIG. 2 and the pixel values of the search macroblock in FIG. 3 is completed, the difference absolute value sum calculation unit 11c displays the calculation result as the difference absolute value sum evaluation unit 11d. Output to.

差分絶対値和評価部11dは、差分絶対値和算出部11cから入力された各マクロブロックの差分絶対値和を比較し、その最小値を記憶する。   The difference absolute value sum evaluation unit 11d compares the difference absolute value sums of the macroblocks input from the difference absolute value sum calculation unit 11c, and stores the minimum value.

次に、探索マクロブロック設定部11bは、第2画像フレームに設定した探索マクロブロックを移動し、再設定するが、このとき、図4に示すように、図3に示す探索マクロブロックから右に1画素分移動し、再設定するとする。
このとき、図2に示す基準マクロブロックのベイヤ配列状の原色画素配置と、図4に示す探索マクロブロックのベイヤ配列状の原色画素配置は異なる。例えば、図2の基準マクロブロック左上G0101、その右B0201、その下R0102は、それぞれ、図4の探索マクロブロック左上B’0201、G’0301、G’0202と対応し、両マクロブロックのベイヤ配列状の原色画素配置は異なっている。
Next, the search macroblock setting unit 11b moves and resets the search macroblock set in the second image frame. At this time, as shown in FIG. 4, the search macroblock setting unit 11b moves rightward from the search macroblock shown in FIG. It is assumed that the pixel is moved by one pixel and reset.
At this time, the Bayer array primary color pixel arrangement of the reference macroblock shown in FIG. 2 is different from the Bayer array primary color pixel arrangement of the search macroblock shown in FIG. For example, the upper left G0101, the right B0201, and the lower R0102 of the reference macroblock in FIG. 2 correspond to the upper left B′0201, G′0301, and G′0202 in FIG. The primary color pixel arrangement is different.

このような異なる色の画素値に基づいて算出した両マクロブロックの差分絶対値和Sは、差分絶対値和が最小となっても異なる色を比較しているため、誤検出である可能性が高くなる。
そこで、本発明の探索マクロブロック設定部11bは、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が同じになるように、探索マクロブロックを第2画像フレームに設定する。
上記の例では、探索マクロブロック設定部11bは、図3に示す探索マクロブロックから横方向に2画素(偶数画素)ずらした図5の探索マクロブロックを第2画像フレームに設定する。
Since the difference absolute value sum S of both macroblocks calculated based on the pixel values of different colors compares different colors even when the difference absolute value sum is minimized, there is a possibility that it is a false detection. Get higher.
Therefore, the search macroblock setting unit 11b according to the present invention sets the second search macroblock so that the Bayer array primary color pixel layout of the reference macroblock is the same as the Bayer array primary color pixel layout of the search macroblock. Set to image frame.
In the above example, the search macroblock setting unit 11b sets the search macroblock of FIG. 5 shifted by two pixels (even pixels) in the horizontal direction from the search macroblock shown in FIG. 3 in the second image frame.

このとき、図2の基準マクロブロック左上G0101、その右B0201、その下R0102は、ぞれぞれ、図5の探索マクロブロック左上G’0301、B’0401、R’0302と対応し、両マクロブロックのベイヤ配列状の原色画素配置は同じになる。
この探索マクロブロックの設定が終了すると、差分絶対値和算出部11cは、図2の基準マクロブロックの画素値の画素値と図5の探索マクロブロックの画素値による差分絶対値和Sを算出する。
At this time, the reference macroblock upper left G0101, its right B0201, and its lower R0102 in FIG. 2 correspond to the search macroblock upper left G′0301, B′0401, and R′0302 in FIG. The primary color pixel arrangement in the Bayer array of blocks is the same.
When the setting of the search macroblock is completed, the difference absolute value sum calculation unit 11c calculates the difference absolute value sum S based on the pixel value of the reference macroblock in FIG. 2 and the pixel value of the search macroblock in FIG. .

以後、探索マクロブロック設定部11bは、第1画像フレームに設定された基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が同じになるように、探索マクロブロックを第2画像フレームに設定する。上記の例では、探索マクロブロックを偶数画素毎に移動、再設定する。   Thereafter, the search macroblock setting unit 11b performs a search so that the Bayer array primary color pixel arrangement of the reference macroblock set in the first image frame is the same as the Bayer array primary color pixel arrangement of the search macroblock. Set the macroblock to the second image frame. In the above example, the search macroblock is moved and reset every even pixel.

上記に説明した、基準マクロブロック、探索マクロブロックの設定処理、動きベクトルの検出処理の一例を図6のフロー図を用いて説明する。なお、図6のフロー図で説明する動きベクトルの検出処理は、例えばソフトウエアを用いて本発明に係る動きベクトル検出処理を実行することを前提としており、ハードウエアを用いて本発明に係る動きベクトル検出処理を実行する場合には、前記動きベクトルの検出処理は並列処理で実行してもよい。   An example of the reference macroblock and search macroblock setting processing and motion vector detection processing described above will be described with reference to the flowchart of FIG. The motion vector detection process described in the flowchart of FIG. 6 is based on the assumption that the motion vector detection process according to the present invention is executed using software, for example, and the motion according to the present invention is performed using hardware. When performing vector detection processing, the motion vector detection processing may be executed in parallel.

基準マクロブロック設定部11aは、撮像装置2の画像フレームメモリ22に記憶されている第1画像フレームに基準マクロブロックを設定する(ステップS1)。   The reference macroblock setting unit 11a sets a reference macroblock in the first image frame stored in the image frame memory 22 of the imaging device 2 (step S1).

次に、探索マクロブロック設定部11bは、第1画像フレームの次画像フレーム(第2画像フレーム)に対して、第1画像フレームに設定された基準マクロブロックと空間的に同位置にある第2画像フレームの画素ブロックに前記基準マクロブロックと同じ大きさの探索マクロブロックを設定する(ステップS2)。なお、探索マクロブロックと基準マクロブロックは、空間的に同位置にあるので各ブロックの色配置は同じである。   Next, the search macroblock setting unit 11b has a second position that is spatially the same as the reference macroblock set in the first image frame with respect to the next image frame (second image frame) of the first image frame. A search macroblock having the same size as the reference macroblock is set in the pixel block of the image frame (step S2). Since the search macro block and the reference macro block are spatially at the same position, the color arrangement of each block is the same.

差分絶対値和算出部11cは、基準マクロブロックの画素値と探索マクロブロックの画素値との差分絶対値和Sを算出し、算出結果を各マクロブロックの座標情報と共に差分絶対値和評価部11dに出力する(ステップS3)。   The difference absolute value sum calculation unit 11c calculates a difference absolute value sum S between the pixel value of the reference macroblock and the pixel value of the search macroblock, and the difference absolute value sum evaluation unit 11d along with the coordinate information of each macroblock. (Step S3).

次に、探索マクロブロック設定部11bは、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が同じになるように、設定した探索マクロブロックを例えば左から右に偶数画素毎(上から下に偶数画素)移動し、再設定する(ステップS4)。   Next, the search macroblock setting unit 11b sets the search macroblock that has been set so that, for example, the Bayer array primary color pixel arrangement of the reference macroblock is the same as the Bayer array primary color pixel arrangement of the search macroblock. To the right by every even pixel (even pixel from top to bottom) and reset (step S4).

そして、探索マクロブロックの設定後、ステップ3で説明したように、基準マクロブロックの画素値と探索マクロブロックの画素値との差分絶対値和Sを算出し、算出結果を各マクロブロックの座標情報と共に差分絶対値和評価部11dに出力する。   Then, after setting the search macroblock, as described in step 3, the sum of absolute differences S between the pixel value of the reference macroblock and the pixel value of the search macroblock is calculated, and the calculation result is used as the coordinate information of each macroblock. At the same time, it is output to the difference absolute value sum evaluation unit 11d.

第2画像フレームの所定領域に対して、ステップS4で説明した探索マクロブロックの設定処理、差分絶対値和Sの算出処理を繰り返し実行し(ステップS3〜ステップS5)、第2画像フレームの所定領域に対する当該設定処理、算出処理が終了すると(ステップS5/YES)、ステップS6の処理を実行する。なお、前記所定領域は、アルゴリズムや精度、処理量などに基づき決定され、例えば、フレーム間の移動距離が最大32画素となる物体まで探索する場合、注目画素に対して±32画素の範囲を所定領域とすればよい。設定処理が終了しない場合(ステップS5/NO)、ステップS3に戻る。   The search macroblock setting process and the difference absolute value sum calculation process described in step S4 are repeatedly executed for the predetermined area of the second image frame (steps S3 to S5), and the predetermined area of the second image frame is determined. When the setting process and the calculation process are completed (step S5 / YES), the process of step S6 is executed. The predetermined area is determined based on an algorithm, accuracy, processing amount, and the like. For example, when searching for an object having a maximum moving distance of 32 pixels between frames, a range of ± 32 pixels is predetermined with respect to the target pixel. A region may be used. If the setting process is not completed (step S5 / NO), the process returns to step S3.

ステップS6で、差分絶対値和評価部11dは、最小の差分絶対値和に対応する探索マクロブロックを特定する。そして、動きベクトル検出部11は、前記特定された探索マクロブロックが基準マクロブロックの移動先マクロブロックとみなし、当該基準マクロブロックの座標情報と、前記特定された、最小差分絶対値和の探索マクロブロックの座標情報に基づき、当該基準マクロブロックの動きベクトルを検出する。   In step S6, the difference absolute value sum evaluation unit 11d specifies a search macroblock corresponding to the minimum difference absolute value sum. Then, the motion vector detection unit 11 regards the specified search macroblock as a destination macroblock of the reference macroblock, and sets the coordinate information of the reference macroblock and the specified minimum difference absolute value search macro Based on the block coordinate information, the motion vector of the reference macroblock is detected.

第1画像フレームの所定領域に対して、基準マクロブロックの設定処理が終了すると(ステップS7/YES)、処理を終了する。なお、次は、第2画像フレームに対して基準マクロブロックを設定し、第3画像フレームに対して探索マクロブロックを設定することになる。   When the reference macroblock setting process is completed for the predetermined area of the first image frame (step S7 / YES), the process ends. In the next step, a reference macro block is set for the second image frame, and a search macro block is set for the third image frame.

第1画像フレームの所定領域に対して、基準マクロブロックの設定処理が終了しない場合(ステップS7/NO)、ステップS1に戻る。このステップでは、第1画像フレームに設定した基準マクロブロックを例えば左から右に1画素分(上から下に1画素分)移動し、再設定する。なお、基準マクロブロックの移動量(移動画素)は、撮像された映像の画角、撮像素子の解像度、必要とする動きベクトル解像度などによって適切に決められる。   If the reference macroblock setting process is not completed for the predetermined area of the first image frame (step S7 / NO), the process returns to step S1. In this step, the reference macroblock set in the first image frame is moved by, for example, one pixel from left to right (one pixel from top to bottom) and reset. Note that the movement amount (moving pixel) of the reference macroblock is appropriately determined depending on the angle of view of the captured image, the resolution of the image sensor, the required motion vector resolution, and the like.

ステップS4で説明したように、基準マクロブロックの画素の色と、当該基準マクロブロックに対応する探索マクロブロックの画素の色とを同色にして動きベクトルを検出すると、輝度情報を使ったときと同じ処理量でありながら、検出精度を向上させることが可能である。   As described in step S4, when a motion vector is detected with the color of the pixel of the reference macroblock and the color of the pixel of the search macroblock corresponding to the reference macroblock being the same color, the same as when using luminance information. It is possible to improve the detection accuracy while maintaining the processing amount.

また、探索マクロブロックを誤検出となる可能性が高い位置に移動せず、画素の色が同じになるように移動させるので、動きベクトル検出時の計算量が半分以下となる効果もある。   Further, since the search macroblock is not moved to a position where there is a high possibility of erroneous detection but is moved so that the pixel colors are the same, there is also an effect that the calculation amount at the time of detecting the motion vector becomes half or less.

次に、マクロブロックの大きさについて説明する。図2で説明した基準マクロブロックの大きさは縦8画素、横8画素であったが、他にも様々な大きさの基準マクロブロックを設定することができる。
例えば、図7、図8に示すように、基準マクロブロックの大きさを縦8画素、横7画素とすることができる。しかし、この場合、下記のような問題が生じるので差分絶対値和の算出において補正処理を実行する。
Next, the size of the macroblock will be described. Although the size of the reference macroblock described in FIG. 2 is 8 pixels in the vertical direction and 8 pixels in the horizontal direction, reference macroblocks of various sizes can be set.
For example, as shown in FIGS. 7 and 8, the size of the reference macroblock can be set to 8 pixels vertically and 7 pixels horizontally. However, in this case, the following problem occurs, and thus correction processing is executed in calculating the sum of absolute differences.

図7に示す基準マクロブロックの大きさは縦8画素、横7画素である。このとき、図8に示す基準マクロブロックと図7に示す基準マクロブロックとを比較する。図8に示す基準マクロブロックは、図7に示す基準マクロブロックを横に1画素ずらした基準マクロブロックである。   The size of the reference macroblock shown in FIG. 7 is 8 pixels vertically and 7 pixels horizontally. At this time, the reference macroblock shown in FIG. 8 is compared with the reference macroblock shown in FIG. The reference macroblock shown in FIG. 8 is a reference macroblock obtained by shifting the reference macroblock shown in FIG. 7 horizontally by one pixel.

図7の基準マクロブロック内の緑画素の個数は28個、同赤画素の個数は16個、同青画素の個数は12個である。同じく、図8の基準マクロブロック内の緑画素の個数は28個、赤画素の個数は12個、青画素の個数は16個である。
したがって、前述したように、基準マクロブロック内の各画素の画素値と当該基準マクロブロックに対応する探索マクロブロック内の各画素の画素値を用いて差分絶対値和を算出すると、図7の基準マクロブロックは図8の基準マクロブロックに比べて緑画素が同数で、赤画素が多く、青画素が少ないので、赤画素に重み付けされていることになる。
すなわち、隣接する基準マクロブロックであっても、重み付けが異なる差分絶対値和が算出され、基準マクロブロックの動きベクトルの検出結果が異なる可能性がある。
The number of green pixels in the reference macroblock in FIG. 7 is 28, the number of red pixels is 16, and the number of blue pixels is 12. Similarly, the number of green pixels in the reference macroblock of FIG. 8 is 28, the number of red pixels is 12, and the number of blue pixels is 16.
Therefore, as described above, if the sum of absolute differences is calculated using the pixel value of each pixel in the reference macroblock and the pixel value of each pixel in the search macroblock corresponding to the reference macroblock, the reference in FIG. Since the macroblock has the same number of green pixels, more red pixels, and fewer blue pixels than the reference macroblock in FIG. 8, the red pixels are weighted.
That is, even for adjacent reference macroblocks, the sum of absolute differences with different weights is calculated, and the detection result of the motion vector of the reference macroblock may be different.

このような基準マクロブロックと当該基準マクロブロックに対応する探索マクロブロックに基づいて動きベクトルを検出した場合、動きベクトルは正しく検出されているように思えるが、実際には、特に、隣接する基準マクロブロックの画素値が同じような値を取る場合、動きベクトルを正しく検出することができず、全体として見ると値にばらつきのある誤検出に似た状態となる。   When a motion vector is detected based on such a reference macroblock and a search macroblock corresponding to the reference macroblock, the motion vector seems to be detected correctly. When the pixel values of the blocks take similar values, the motion vector cannot be detected correctly, and a state similar to false detection with a variation in values is seen as a whole.

基準マクロブロックの縦の画素数が奇数、横の画素数が偶数でも同様で、例えば、縦の画素数が9画素、横の画素数が8画素である、図9、図10に示す基準マクロブロックを比較する。
図9の基準マクロブロック内の緑画素の個数は36個、赤画素の個数は16個、青画素の個数は20個である。図10の基準マクロブロック内の緑画素の個数は36個、赤画素の個は16個、青画素の個数は20個である。したがって、緑色に対する赤色および青色の重み付けが異なることになる。
This is the same even if the number of vertical pixels in the reference macroblock is odd and the number of horizontal pixels is even. For example, the reference macro shown in FIGS. 9 and 10 has 9 vertical pixels and 8 horizontal pixels. Compare blocks.
The number of green pixels in the reference macroblock in FIG. 9 is 36, the number of red pixels is 16, and the number of blue pixels is 20. The number of green pixels in the reference macroblock in FIG. 10 is 36, the number of red pixels is 16, and the number of blue pixels is 20. Therefore, the red and blue weights for green are different.

基準マクロブロックの縦の画素数が奇数、横の画素数が奇数でも同様で、例えば、縦の画素数が7画素、横の画素数が7画素である図11、図12に示す基準マクロブロックを比較する。
図11の基準マクロブロック内の緑画素の個数は25個、赤画素の個数は12個、青画素の個数は12個である。図12の基準マクロブロック内の緑画素の個数は24個、赤画素の個数は9個、青画素の個数は16個である。したがって、全ての色での重み付けが異なることになる。
This is the same even if the number of vertical pixels in the reference macroblock is odd and the number of horizontal pixels is odd. For example, the reference macroblock shown in FIGS. 11 and 12 has 7 vertical pixels and 7 horizontal pixels. Compare
The number of green pixels in the reference macroblock of FIG. 11 is 25, the number of red pixels is 12, and the number of blue pixels is 12. The number of green pixels in the reference macroblock in FIG. 12 is 24, the number of red pixels is 9, and the number of blue pixels is 16. Therefore, the weights for all colors are different.

以上より、全ての色で重み付けが変わらない基準マクロブロックの大きさは、縦横の画素数が偶数の場合であることがわかる。したがって、基準マクロブロックを縦横が偶数画素となるように設定することで、基準マクロブロックの設定の仕方によって色の重み付けが変化せず、良好な算出結果を得ることができる。   From the above, it can be seen that the size of the reference macroblock whose weighting does not change for all colors is the case where the number of vertical and horizontal pixels is an even number. Therefore, by setting the reference macroblock so that the vertical and horizontal pixels are even pixels, the color weighting does not change depending on how the reference macroblock is set, and a good calculation result can be obtained.

しかしながら、基準マクロブロックを設定するときに、画像フレームの注目画素に対して基準マクロブロックの縦横幅を対称(当該注目画素に基準マクロブロックの中心画素をあわせる)にしたい場合など、奇数の画素数により構成したい場合も存在する。
そこで、マクロブロックの縦の画素数、横の画素数が奇数である場合には色画素の個数を考慮して、差分絶対値の算出結果に補正計算処理を実行することで、差分絶対値和を算出する。
例えば、縦が7画素、横が7画素である図11、図12に示す基準マクロブロックで説明すると、図11に示す基準マクロブロックの場合、差分絶対値和算出部11cは、緑画素の差分絶対値算出結果をブロック内緑画素数(25)で除算、赤画素の差分絶対値算出結果をブロック内赤画素数(12)で除算、青画素の差分絶対値算出結果をブロック内青画素数(12)で除算して、各除算値の和を算出する。
However, when setting the reference macroblock, if you want the vertical and horizontal widths of the reference macroblock to be symmetrical with respect to the target pixel of the image frame (the center pixel of the reference macroblock is aligned with the target pixel), etc. There is also a case where it is desired to configure.
Therefore, if the number of vertical and horizontal pixels in the macroblock is odd, the difference absolute value sum is calculated by executing the correction calculation process on the difference absolute value calculation result in consideration of the number of color pixels. Is calculated.
For example, the reference macroblock shown in FIGS. 11 and 12 having 7 pixels in the vertical direction and 7 pixels in the horizontal direction will be described. In the case of the reference macroblock shown in FIG. 11, the difference absolute value sum calculation unit 11c calculates the difference between the green pixels. The absolute value calculation result is divided by the number of green pixels in the block (25), the difference absolute value calculation result of the red pixel is divided by the number of red pixels in the block (12), and the difference absolute value calculation result of the blue pixel is calculated as the number of blue pixels in the block. Divide by (12) to calculate the sum of each division value.

また、図12に示す基準マクロブロックの場合、差分絶対値和算出部11cは、緑画素の差分絶対値算出結果を24で除算、赤画素の差分絶対値算出結果を9で除算、青画素の差分絶対値算出結果を16で除算して、各除算値の和を算出する。このようにすることで、各色の重み付けを均一にすることができ、基準マクロブロックの大きさによって色の重み付けが変化せず、良好な算出結果を得ることができる。   In the case of the reference macroblock shown in FIG. 12, the difference absolute value sum calculation unit 11c divides the difference absolute value calculation result of the green pixel by 24, divides the difference absolute value calculation result of the red pixel by 9, The difference absolute value calculation result is divided by 16 to calculate the sum of the divided values. By doing so, the weighting of each color can be made uniform, and the color weighting does not change depending on the size of the reference macroblock, and a good calculation result can be obtained.

なお、マクロブロックの縦横の画素数をそれぞれ偶数になるように探索マクロブロック設定すれば、色の重み付けが変化せず良好な算出が可能である。   If search macroblocks are set so that the number of vertical and horizontal pixels of a macroblock is an even number, color weighting does not change and good calculation is possible.

(実施形態2)
次に、本発明の第2の実施形態について図面を参照しながら説明する。なお、第1の実施の形態と同様の機能を有する部分については同一の符号を付して、その説明を省略している。
図13は、本発明の第2の実施形態に係る画像処理装置1’および画像処理装置1’に接続される撮像装置2の機能ブロック図である。
(Embodiment 2)
Next, a second embodiment of the present invention will be described with reference to the drawings. Note that portions having the same functions as those of the first embodiment are denoted by the same reference numerals, and description thereof is omitted.
FIG. 13 is a functional block diagram of the image processing device 1 ′ and the imaging device 2 connected to the image processing device 1 ′ according to the second embodiment of the present invention.

第1の実施形態に係る画像処理装置1の探索マクロブロック設定部11bは、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が同じになるように、探索マクロブロックを第2画像フレームに設定した。   The search macroblock setting unit 11b of the image processing apparatus 1 according to the first embodiment is configured so that the Bayer array primary color pixel layout of the reference macroblock is the same as the Bayer array primary color pixel layout of the search macroblock. The search macroblock was set to the second image frame.

しかし、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が異なる場合でも、設定した探索マクロブロックの画素の配置を入れ替えることで、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置とを同じにすることができる。   However, even if the Bayer array primary color pixel arrangement of the reference macroblock is different from the Bayer array primary color pixel arrangement of the search macroblock, the reference macroblock Bayer of the reference macroblock can be changed by switching the arrangement of the set search macroblock pixels. The primary color pixel arrangement in the array and the Bayer array primary color pixel arrangement of the search macroblock can be made the same.

探索マクロブロック設定部11b’は、基準マクロブロック設定部11aが第1画像フレームに設定した基準マクロブロックと空間的に同位置にある第2画像フレームの画素ブロックに基準マクロブロックと同じ大きさの探索マクロブロックを設定し、当該探索マクロブロックを1画素または奇数画素毎に移動、再設定する。
このとき、第1の実施形態とは異なり、第1画像フレームに設定された基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置は異なってもよい。
The search macroblock setting unit 11b ′ has the same size as the reference macroblock in the pixel block of the second image frame spatially located at the same position as the reference macroblock set by the reference macroblock setting unit 11a in the first image frame. A search macroblock is set, and the search macroblock is moved and reset every pixel or odd pixel.
At this time, unlike the first embodiment, the Bayer array primary color pixel arrangement of the reference macroblock set in the first image frame may be different from the Bayer array primary color pixel arrangement of the search macroblock.

例えば、本発明の第2の実施形態に係る画像処理装置1’の探索マクロブロック設定部11b’は、図2に示す基準マクロブロックに対応する探索マクロブロックを図14に示すように第2画像フレームに設定するとする。この場合、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置とは異なる。   For example, the search macroblock setting unit 11b ′ of the image processing device 1 ′ according to the second embodiment of the present invention sets the search macroblock corresponding to the reference macroblock shown in FIG. 2 as the second image as shown in FIG. Suppose you set it to a frame. In this case, the Bayer array primary color pixel arrangement of the reference macroblock is different from the Bayer array primary color pixel arrangement of the search macroblock.

そこで、本発明の画像処理装置1’の画素配置入れ替え部11eは、設定(再設定)した探索マクロブロックのベイヤ配列状の原色画素配置と基準マクロブロックのベイヤ配列状の原色画素配置とが異なることを検出すると、探索マクロブロックの原色画素配置を入れ替えることで、探索マクロブロックのベイヤ配列状の原色画素配置を基準マクロブロックのベイヤ配列状の原色画素配置と同じにする。   Therefore, the pixel arrangement replacement unit 11e of the image processing apparatus 1 ′ of the present invention differs between the set (re-set) Bayer arrangement primary color pixel arrangement of the search macroblock and the Bayer arrangement primary color pixel arrangement of the reference macroblock. If this is detected, the primary color pixel arrangement of the search macroblock is made the same as the primary color pixel arrangement of the search macroblock Bayer array.

なお、探索マクロブロックが、基準マクロブロックから奇数画素分移動したことを検出することにより、両マクロブロックの原色画素配置が異なるとみなすことができる。   Note that, by detecting that the search macroblock has moved by an odd number of pixels from the reference macroblock, it can be considered that the primary color pixel arrangement of both macroblocks is different.

図14の例では、画素配置入れ替え部11eは、探索マクロブロックの赤画素と青画素とを入れ替える。   In the example of FIG. 14, the pixel arrangement replacing unit 11e replaces the red pixel and the blue pixel of the search macro block.

図15は、図14の探索マクロブロックの赤画素と青画素とを入れ替えた場合の探索マクロブロックを示している。図15に示す探索マクロブロックは、図2に示す基準マクロブロックの赤画素の画素配置と青画素の画素配置に対応するように、R’0302とB’0203を入れ替えている。同じく、R’0502とB’0403、R’0702とB’0603を入れ替えている。   FIG. 15 shows a search macroblock when the red and blue pixels of the search macroblock in FIG. 14 are replaced. In the search macroblock shown in FIG. 15, R′0302 and B′0203 are interchanged so as to correspond to the pixel arrangement of red pixels and the pixel arrangement of blue pixels of the reference macroblock shown in FIG. Similarly, R′0502 and B′0403 and R′0702 and B′0603 are interchanged.

以後、前述したように、動きベクトル検出部11’は、基準マクロブロックおよび探索マクロブロックに対してブロックマッチングを行うことにより動きベクトルを検出する。   Thereafter, as described above, the motion vector detection unit 11 ′ detects a motion vector by performing block matching on the reference macroblock and the search macroblock.

このようにすることで、基準マクロブロックと探索マクロブロックの画素の色が互いに同じになり、差分絶対値和が正しく算出される。
このように、基準マクロブロックに対して縦に奇数画素、横に奇数画素ずれた探索マクロブロックにおいて、各マクロブロックの画素の色が互いに同じになるように原色画素配置を変えることで、正しく差分絶対値和が算出できるようになる。
By doing in this way, the color of the pixel of a reference | standard macroblock and a search macroblock becomes mutually the same, and a difference absolute value sum is correctly calculated.
In this way, in the search macro block in which the odd-numbered pixels are shifted vertically and the odd-numbered pixels are shifted from the reference macro-block, the primary color pixel arrangement is changed so that the colors of the pixels of each macro-block are the same, so that the correct difference is obtained. The absolute value sum can be calculated.

実施形態2の画像処理装置では、緑画素の位置を変化させずに、赤画素と青画素の位置を入れ替えている。前述したように、赤画素数と青画素数が異なると、差分絶対値和に誤差が生じることになるので、マクロブロック内の赤色画素数と青色画素数とが同数になるように基準マクロブロックの大きさ、探索マクロブロックの大きさを決定することが好ましい。   In the image processing apparatus according to the second embodiment, the positions of the red pixel and the blue pixel are switched without changing the position of the green pixel. As described above, if the number of red pixels is different from the number of blue pixels, an error occurs in the sum of absolute differences. Therefore, the reference macroblock has the same number of red pixels and blue pixels in the macroblock. It is preferable to determine the size of the search macroblock.

実施形態2の画像処理装置によれば、基準マクロブロックのベイヤ配列状の原色画素配置と、探索マクロブロックのベイヤ配列状の原色画素配置が異なっていても、差分絶対値和を正しく算出できる。   According to the image processing apparatus of the second embodiment, the difference absolute value sum can be correctly calculated even when the Bayer array primary color pixel layout of the reference macroblock is different from the Bayer array primary color pixel layout of the search macroblock.

また、実施形態2の画像処理装置によれば、動きベクトルや視差の分解能を向上させることができる。実施形態1では、探索マクロブロックを偶数画素毎に移動させたが、この場合、探索マクロブロックの最小移動量は縦横2画素分の距離となる。一方、本実施形態では探索マクロブロックの最小移動量は縦横1画素分の距離である。したがって、探索マクロブロック間距離を√2とすることができる。よって、探索マクロブロックの移動が細かくなり、動きベクトルや視差などの算出分解能を向上させることができる。   Further, according to the image processing apparatus of the second embodiment, the resolution of motion vectors and parallax can be improved. In the first embodiment, the search macroblock is moved every even number of pixels. In this case, the minimum movement amount of the search macroblock is a distance of two pixels in the vertical and horizontal directions. On the other hand, in this embodiment, the minimum movement amount of the search macroblock is a distance of one pixel in the vertical and horizontal directions. Therefore, the distance between search macroblocks can be set to √2. Therefore, the movement of the search macroblock becomes finer, and the calculation resolution of motion vectors, parallax, etc. can be improved.

本実施形態では差分絶対値和(ΣΣ|Pij−P’ij|)を利用して動きベクトルを検出したが、差分二乗和(ΣΣ(Pij−P’ij)を利用して動きベクトルを検出してもよい。 In this embodiment, the motion vector is detected using the sum of absolute differences (ΣΣ | P ij −P ′ ij |), but the motion is calculated using the sum of squares of differences (ΣΣ (P ij −P ′ ij ) 2 ). Vectors may be detected.

本実施形態では動きベクトルの検出について説明したが、本発明は、ブロックマッチングを使用するあらゆる処理に適用することができる。
例えば、視差情報に基づき被写体から撮像装置までの距離を算出する際に本発明を適用してもよい。この場合、例えば、異なる2つの視点位置に配置された2つの撮像装置が出力した同一被写体に係る2画像フレームに対して、本発明のブロックマッチングを行えば前記同一被写体に対する視差を検出することができ、被写体から撮像装置までの距離を求めることができる。
なお、視差の検出は、従来から提案されている様々な方法を用いることができる。
In the present embodiment, motion vector detection has been described, but the present invention can be applied to any processing that uses block matching.
For example, the present invention may be applied when calculating the distance from the subject to the imaging device based on the parallax information. In this case, for example, if block matching according to the present invention is performed on two image frames related to the same subject output by two imaging devices arranged at two different viewpoint positions, the parallax with respect to the same subject can be detected. The distance from the subject to the imaging device can be obtained.
In addition, various methods proposed conventionally can be used for detection of parallax.

また、通常の撮像装置では、撮像素子に光を導くための光学系が備えられており、これにより撮像素子での照度ムラが発生する場合には、シェーディング補正などの処理を画像データに対して行った後に、ブロックマッチングを行うことで検出精度を向上させることができる。さらに、撮像素子の画素間のムラや傷欠陥などの補正処理を行った後に、ブロックマッチングを行うことで検出精度を向上させることができる。   In addition, an ordinary image pickup apparatus is provided with an optical system for guiding light to the image pickup device. When uneven illuminance occurs in the image pickup device, processing such as shading correction is performed on the image data. After being performed, detection accuracy can be improved by performing block matching. Furthermore, detection accuracy can be improved by performing block matching after performing correction processing such as unevenness between pixels of the image sensor and a flaw defect.

撮像素子2と画像処理装置1とを一体にしてもよい。この場合、撮像装置2は、画像処理装置1を備え、撮像装置2の撮像部21が生成したベイヤ配列状の原色画素配置を有する画像フレームを画像処理装置1に出力することになる。なお、撮像素子2と画像処理装置1’とを一体にしてもよい。
また、撮像装置22のフレームメモリ22を、画像処理装置1,1’に設けてもよい。
The image sensor 2 and the image processing apparatus 1 may be integrated. In this case, the imaging device 2 includes the image processing device 1, and outputs an image frame having a Bayer array-like primary color pixel arrangement generated by the imaging unit 21 of the imaging device 2 to the image processing device 1. Note that the image sensor 2 and the image processing apparatus 1 ′ may be integrated.
Further, the frame memory 22 of the imaging device 22 may be provided in the image processing devices 1 and 1 ′.

1,1’…画像処理装置、11,11’…動きベクトル検出部、11a…基準マクロブロック設定部、11b…探索マクロブロック設定部、11c…差分絶対値和算出部、11d…差分絶対値和評価部、11e…画素配置入れ替え部、2…撮像装置、21…撮像部、22…画像フレームメモリ。 DESCRIPTION OF SYMBOLS 1,1 '... Image processing apparatus 11, 11' ... Motion vector detection part, 11a ... Reference | standard macroblock setting part, 11b ... Search macroblock setting part, 11c ... Difference absolute value sum calculation part, 11d ... Difference absolute value sum Evaluation part, 11e ... Pixel arrangement replacement part, 2 ... Imaging device, 21 ... Imaging part, 22 ... Image frame memory.

Claims (2)

ベイヤ配列状の原色画素配置を有する第1画像フレームに基準マクロブロックを設定する基準マクロブロック設定部と、
前記第1画像フレームに設定した基準マクロブロックのベイヤ配列状の原色画素配置と同じベイヤ配列状の原色画素配置になるように第2画像フレームに対して探索マクロブロックを設定する探索マクロブロック設定部とを備え、
前記探索マクロブロック設定部は、前記基準マクロブロック設定部が前記第1画像フレームに設定した基準マクロブロックと空間的に同位置にある前記第2画像フレームの画素ブロックに前記基準マクロブロックと同じ大きさの探索マクロブロックを設定するものであり、前記探索マクロブロックを偶数画素毎に移動、再設定し、
前記基準マクロブロックの任意の2つの位置で前記原色画素の色の重みが一定となるように、前記基準マクロブロックに含まれる前記原色画素の各色の画素数に応じて、前記原色画素の各色の重み付けを行うことにより、前記基準マクロブロックおよび前記探索マクロブロックに対してブロックマッチングを行うこと動きベクトル又は視差情報を算出することを特徴とする画像処理装置。
A reference macroblock setting unit for setting a reference macroblock in a first image frame having a Bayer array-like primary color pixel arrangement;
To be the same Bayer arrangement shaped primary color pixels arranged as Bayer array shaped primary color pixel arrangement of the reference macro-blocks set in the first image frame, the search macro block setting for setting a search macroblock with respect to the second image frame With
The search macroblock setting unit has the same size as the reference macroblock in the pixel block of the second image frame spatially located at the same position as the reference macroblock set by the reference macroblock setting unit in the first image frame. The search macroblock is set, and the search macroblock is moved and reset every even pixel,
According to the number of pixels of each color of the primary color pixels included in the reference macroblock, each color of the primary color pixel is set so that the color weight of the primary color pixel is constant at any two positions of the reference macroblock. by performing the weighting, an image processing apparatus characterized by calculating a motion vector or disparity information by performing block matching on the reference macro block and the search macro block.
撮像素子の各画素に対応してベイヤ配列状のR・G・Bフィルタを備えた撮像装置において、
請求項に記載の前記画像処理装置を備え、前記撮像素子が生成したベイヤ配列状の原色画素配置を有する画像フレームを当該画像処理装置に出力することを特徴とする撮像装置。
In an imaging apparatus provided with a Bayer array R, G, B filter corresponding to each pixel of the imaging element,
An image pickup apparatus comprising the image processing apparatus according to claim 1 , wherein an image frame having a Bayer array primary color pixel arrangement generated by the image pickup device is output to the image processing apparatus.
JP2009256195A 2009-11-09 2009-11-09 Image processing apparatus and imaging apparatus Expired - Fee Related JP5400573B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009256195A JP5400573B2 (en) 2009-11-09 2009-11-09 Image processing apparatus and imaging apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009256195A JP5400573B2 (en) 2009-11-09 2009-11-09 Image processing apparatus and imaging apparatus

Publications (2)

Publication Number Publication Date
JP2011101305A JP2011101305A (en) 2011-05-19
JP5400573B2 true JP5400573B2 (en) 2014-01-29

Family

ID=44192103

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009256195A Expired - Fee Related JP5400573B2 (en) 2009-11-09 2009-11-09 Image processing apparatus and imaging apparatus

Country Status (1)

Country Link
JP (1) JP5400573B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6016424B2 (en) * 2012-04-10 2016-10-26 キヤノン株式会社 Imaging apparatus and image processing method
JP6395398B2 (en) * 2014-03-05 2018-09-26 キヤノン株式会社 Image processing apparatus and image processing method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4605582B2 (en) * 2004-06-02 2011-01-05 富士重工業株式会社 Stereo image recognition apparatus and method
JP4630174B2 (en) * 2005-11-14 2011-02-09 日本放送協会 Motion vector detection device

Also Published As

Publication number Publication date
JP2011101305A (en) 2011-05-19

Similar Documents

Publication Publication Date Title
JP5589146B2 (en) Imaging device and imaging apparatus
JP6027777B2 (en) Pixel information management device and imaging device using the same
CN101272503B (en) Gridding noise elimination method and device for remaining image definition
JP6372983B2 (en) FOCUS DETECTION DEVICE, ITS CONTROL METHOD, AND IMAGING DEVICE
US20080239121A1 (en) Imaging apparatus including noise suppression circuit
US7760255B2 (en) Method and apparatus for interpolation of interlaced CMYG color format
JPWO2012117616A1 (en) Imaging apparatus and defective pixel correction method
JPWO2019092844A1 (en) Image processing apparatus, image processing method, and image processing program
US20140125847A1 (en) Image processing apparatus and control method therefor
US8749668B2 (en) Adaptive pixel compensation method
CN111225135B (en) Image sensor, imaging device, electronic apparatus, image processing system, and signal processing method
US20210067689A1 (en) Image processing apparatus, image processing method, and program
JP4649171B2 (en) Magnification Chromatic Aberration Correction Device, Magnification Chromatic Aberration Correction Method, and Magnification Chromatic Aberration Correction Program
JP5997541B2 (en) Image signal processing apparatus and control method thereof
JP5456206B2 (en) IMAGING DEVICE, IMAGING DEVICE CONTROL PROGRAM, AND IMAGING DEVICE CONTROL METHOD
JP5600812B2 (en) Imaging device
JP5400573B2 (en) Image processing apparatus and imaging apparatus
JP2015122576A (en) Pixel interpolation processing apparatus, imaging apparatus, program and integrated circuit
JP4605582B2 (en) Stereo image recognition apparatus and method
CN103002230B (en) Adaptability pixel compensation method
CN101834975B (en) Method of generating interlaced preview from image sensor and method for inserting scan lines
JP4779904B2 (en) Stereo video processing apparatus and stereo video processing method program
US20150365594A1 (en) Electronic device, method for generating an image and filter arrangement
JP2014110507A (en) Image processing device and image processing method
JP5607267B2 (en) IMAGING DEVICE, IMAGING DEVICE CONTROL METHOD, AND CONTROL PROGRAM

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120223

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121210

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121218

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130214

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131025

R150 Certificate of patent or registration of utility model

Ref document number: 5400573

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees