JP2018055621A - Computer program, moving body detection method and moving body detection device - Google Patents
Computer program, moving body detection method and moving body detection device Download PDFInfo
- Publication number
- JP2018055621A JP2018055621A JP2016194392A JP2016194392A JP2018055621A JP 2018055621 A JP2018055621 A JP 2018055621A JP 2016194392 A JP2016194392 A JP 2016194392A JP 2016194392 A JP2016194392 A JP 2016194392A JP 2018055621 A JP2018055621 A JP 2018055621A
- Authority
- JP
- Japan
- Prior art keywords
- moving object
- image
- brightness
- processing target
- target image
- 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.)
- Granted
Links
Images
Landscapes
- Image Analysis (AREA)
- Studio Devices (AREA)
Abstract
Description
本発明は、画像から動体を検出するためのコンピュータプログラム、動体検出方法、及び動体検出装置に関する。 The present invention relates to a computer program, a moving object detection method, and a moving object detection device for detecting a moving object from an image.
カメラで撮影された動画又は繰り返し撮影された画像等の画像には、樹木又は建物等の静止した物体からなる背景と背景に対して移動する人又は自動車等の動体とが写されている。従来、撮影された画像から動体を検出するニーズがある。例えば、監視カメラで撮影された動画に動体が検出された場合に動画の録画を開始することが行われる。画像から動体を検出するには、一般的に、背景差分という方法が用いられる。背景差分とは、事前に撮影された画像と新しく撮影された画像とを比較し、事前に撮影された画像に含まれていない部分を新しく撮影された画像から動体として抽出する方法である。 In images such as moving images taken with a camera or images taken repeatedly, a background consisting of a stationary object such as a tree or a building and a moving object such as a person or a car moving relative to the background are shown. Conventionally, there is a need to detect moving objects from captured images. For example, recording of a moving image is started when a moving object is detected in the moving image captured by the surveillance camera. In general, a method called background difference is used to detect a moving object from an image. Background difference is a method of comparing a previously captured image with a newly captured image and extracting a portion not included in the previously captured image as a moving object from the newly captured image.
背景差分には、本来背景である部分を動体として誤検出することがあるという問題がある。例えば、照明環境が変化したことによる局所的な明るさ変動、又は樹木の揺動若しくは水面の変動等の局所的な背景の変化が動体として誤検出されることがある。このような問題を解決するために、種々の手法が開発されている。特許文献1には、背景差分の例が開示されている。
The background difference has a problem that a portion that is originally a background may be erroneously detected as a moving object. For example, a local brightness change due to a change in the lighting environment, or a local background change such as a tree swing or a water surface change may be erroneously detected as a moving object. Various methods have been developed to solve such problems.
背景差分に用いられる手法として、背景モデルを用いる手法がある。背景モデルを生成する方法には、統計情報を利用した背景モデリングを行う手法と、空間情報を利用した背景モデリングを行う手法との主に二つの手法に分けられる。統計情報を利用した背景モデリングを行う手法では、画像に含まれる画素値の時間的な変化を統計モデル化し、空間情報を利用した背景モデリングを行う手法では、画像中の注目画素及びその周辺領域での画素値の分布パターンをモデル化する。いずれの手法でも、モデルから外れた部分を動体として検出することができる。 As a method used for background difference, there is a method using a background model. There are mainly two methods for generating a background model: a method for performing background modeling using statistical information and a method for performing background modeling using spatial information. In the method of performing background modeling using statistical information, the temporal change of the pixel value included in the image is statistically modeled. In the method of performing background modeling using spatial information, the pixel of interest in the image and its surrounding area are used. The distribution pattern of the pixel values is modeled. In any of the methods, a portion outside the model can be detected as a moving object.
統計情報を利用した背景モデルを用いる手法では、局所的な背景の変化に対してはある程度ロバスト性を確保することができる。一方で、局所的な明るさ変動が動体として誤検出されるという問題がある。特に、カメラにおいて露出又はホワイトバランス等の調整により明るさを自動で補正する場合に、誤検出が増加する。また、空間情報を利用した背景モデルを用いる手法では、局所的な背景の変化に加えて、局所的な明るさ変動に対してもある程度ロバスト性を確保することが可能であり、統計情報を利用した背景モデルを用いる手法に比べて誤検出率が低い傾向がある。一方で、周辺領域の設定に応じて処理の精度及び速度が変動するので、パラメータの調整が困難であるという問題がある。 In the method using a background model using statistical information, a certain degree of robustness can be secured against local background changes. On the other hand, there is a problem that local brightness fluctuations are erroneously detected as moving objects. In particular, erroneous detection increases when the camera automatically corrects brightness by adjusting exposure or white balance. In addition, the method using a background model that uses spatial information can ensure a certain degree of robustness against local brightness fluctuations in addition to local background changes, and uses statistical information. There is a tendency that the false detection rate is lower than the method using the background model. On the other hand, since the accuracy and speed of processing vary according to the setting of the peripheral region, there is a problem that it is difficult to adjust parameters.
統計情報を利用した背景モデルを用いる手法で局所的な明るさ変動が動体として誤検出される問題は、カメラでの明るさの補正を行わないようにすることにより、短期間の間は回避することができる。しかしながら、昼夜を通してカメラを稼働させた場合等、長時間に亘って動体の検出を行う場合は、明るさの補正を行わない状態では画像の明るさが大きく変化し、正常な画像を取得することができなくなる。この結果、動体検出が困難になるという問題がある。 The problem that local brightness fluctuations are erroneously detected as moving objects by using a background model that uses statistical information is avoided for a short period of time by not correcting the brightness of the camera. be able to. However, when moving objects are detected for a long period of time, such as when the camera is operated throughout the day and night, the brightness of the image changes greatly when the brightness is not corrected, and a normal image is acquired. Can not be. As a result, there is a problem that it is difficult to detect moving objects.
本発明は、斯かる事情に鑑みてなされたものであって、その目的とするところは、局所的な明るさ変動に起因する誤検出を抑制することができるコンピュータプログラム、動体検出方法及び動体検出装置を提供することにある。 The present invention has been made in view of such circumstances, and an object of the present invention is to provide a computer program, a moving object detection method, and a moving object detection capable of suppressing erroneous detection due to local brightness fluctuations. To provide an apparatus.
本発明に係るコンピュータプログラムは、コンピュータに、画像に写された動体を検出させるコンピュータプログラムにおいて、動体を検出する処理の対象となる処理対象画像を記憶するコンピュータに、前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行う明るさ補正ステップと、明るさ補正を行った後の処理対象画像に対して、動体検出を行うステップとを含む処理を実行させることを特徴とする。 The computer program according to the present invention is a computer program for causing a computer to detect a moving object in an image. In a computer program for storing a processing target image to be processed for detecting a moving object, the brightness in the processing target image is stored. Including a brightness correction step for performing brightness correction to match the distribution of brightness with the brightness distribution in a specific reference image, and a step for performing moving object detection on the processing target image after performing the brightness correction. Is executed.
本発明に係るコンピュータプログラムは、前記明るさ補正ステップは、前記参照画像及び前記処理対象画像に含まれる各画素の明るさの違いに基づいて、前記処理対象画像での各画素の明るさを前記参照画像での各画素の明るさへ変換するように、各画素の色を表す複数の数値を補正するための補正関数を画素別に生成する補正関数生成ステップと、前記処理対象画像に含まれる各画素の色を表す複数の数値から、各画素について生成した前記補正関数により、明るさが補正された色を表す複数の数値を計算するステップとを含むことを特徴とする。 In the computer program according to the present invention, in the brightness correction step, the brightness of each pixel in the processing target image is determined based on a difference in brightness of each pixel included in the reference image and the processing target image. A correction function generating step for generating, for each pixel, a correction function for correcting a plurality of numerical values representing the color of each pixel so as to convert to the brightness of each pixel in the reference image; and each of the processing target images And calculating a plurality of numerical values representing colors whose brightness has been corrected by the correction function generated for each pixel from a plurality of numerical values representing the color of the pixel.
本発明に係るコンピュータプログラムは、前記補正関数生成ステップは、前記処理対象画像に含まれる各画素のグレースケール値にエッジ保存平滑化を施した平滑化グレースケール値を計算するステップと、前記参照画像及び前記処理対象画像に含まれる各画素の平滑化グレースケール値の比を、前記参照画像での平滑化グレースケール値を前記処理対象画像での平滑化グレースケール値で除算することによって計算するステップと、前記比が1以下である画素について、前記処理対象画像での色を表す各数値をinputlmg(x,y)、明るさが補正された色を表す各数値をoutputlmg(x,y)、前記比をratio(x、y)として、outputlmg(x,y)=inputlmg(x,y)*ratio(x、y)で表される前記補正関数を生成するステップと、前記比が1を超過する画素について、前記参照画像での平滑化グレースケール値をreferenceMap(x,y)、前記処理対象画像での平滑化グレースケール値をinputMap(x,y)、色を表す各数値が取り得る最大値をmaxとして、outputlmg(x,y)=inputlmg(x,y)*rate+offset、rate=(max−referenceMap(x,y))/(max−inputMap(x,y))、及びoffset=referenceMap(x,y)−rate*inputMap(x,y)で表される前記補正関数を生成するステップとを含むことを特徴とする。 In the computer program according to the present invention, the correction function generating step calculates a smoothed grayscale value obtained by performing edge preserving smoothing on a grayscale value of each pixel included in the processing target image; and the reference image And a ratio of smoothed grayscale values of each pixel included in the processing target image by dividing the smoothed grayscale value in the reference image by the smoothing grayscale value in the processing target image And for each pixel whose ratio is 1 or less, each numerical value representing the color in the processing target image is inputmg (x, y), each numerical value representing the color whose brightness is corrected is outputlmg (x, y), When the ratio is ratio (x, y), output mg (x, y) = input mg (x, y) * ratio (x, y) A step of generating the correction function represented, and a smoothed grayscale value in the reference image as a reference grayscale value in the reference image and a smoothed grayscale in the processing target image with respect to the pixels whose ratio exceeds 1 The value is inputMap (x, y), and the maximum value that each numerical value representing the color can take is max. Outputmg (x, y) = inputlmg (x, y) * rate + offset, rate = (max−referenceMap (x, y) ) / (Max-inputMap (x, y)) and generating the correction function represented by offset = referenceMap (x, y) -rate * inputMap (x, y). .
本発明に係るコンピュータプログラムは、前記参照画像は、統計情報を利用した背景モデルを用いた背景差分により特定されることを特徴とする。 The computer program according to the present invention is characterized in that the reference image is specified by a background difference using a background model using statistical information.
本発明に係る動体検出方法は、演算部及び記憶部を備えるコンピュータにより、画像に写された動体を検出する動体検出方法において、動体を検出する処理の対象となる処理対象画像を前記記憶部に記憶するステップと、前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行うステップと、明るさ補正を行った後の処理対象画像に対して、動体検出を行うステップとを含むことを特徴とする。 A moving object detection method according to the present invention is a moving object detection method in which a computer including a calculation unit and a storage unit detects a moving object copied in an image. In the moving object detection method, a processing target image to be processed is detected in the storage unit. A step of storing, a step of performing a brightness correction to match a brightness distribution in the processing target image with a brightness distribution in a specific reference image, and a processing target image after performing the brightness correction And moving object detection.
本発明に係る動体検出装置は、画像に写された動体を検出する動体検出装置において、動体を検出する処理の対象となる処理対象画像を記憶する記憶部と、前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行う明るさ補正部と、明るさ補正を行った後の処理対象画像に対して、動体検出を行う動体検出部とを備えることを特徴とする。 The moving object detection device according to the present invention is a moving object detection device that detects a moving object that is captured in an image, and a storage unit that stores a processing target image that is a target of processing for detecting the moving object, and brightness within the processing target image. A brightness correction unit that performs brightness correction that matches the distribution of brightness with a brightness distribution in a specific reference image, and a moving object detection unit that performs moving object detection on the processing target image after performing the brightness correction. It is characterized by providing.
本発明においては、動体検出装置は、処理対象画像に対して、明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行い、その後に動体検出を行う。局所的な明るさの変化が減少した処理対象画像から動体検出を行うことによって、局所的な明るさ変動が動体として誤検出されることが抑制される。 In the present invention, the moving object detection device performs brightness correction on the processing target image to match the brightness distribution with the brightness distribution in a specific reference image, and then performs moving object detection. By performing the moving object detection from the processing target image in which the local brightness change is reduced, it is possible to suppress the erroneous detection of the local brightness fluctuation as the moving object.
また、本発明においては、動体検出装置は、明るさ補正を行う際に、参照画像及び処理対象画像に含まれる各画素の明るさの違いに基づいて、各画素の色を表す複数の数値を補正するための補正関数を画素別に生成し、補正関数を用いて、各画素の色を表す複数の数値を補正する。画素別に、参照画像及び処理対象画像の明るさの違いに基づいて画素の色が補正されることにより、明るさの分布を参照画像に合わせるように処理対象画像内の明るさの分布が補正される。 Further, in the present invention, when performing the brightness correction, the moving object detection device calculates a plurality of numerical values representing the color of each pixel based on the difference in brightness of each pixel included in the reference image and the processing target image. A correction function for correction is generated for each pixel, and a plurality of numerical values representing the color of each pixel are corrected using the correction function. For each pixel, the brightness distribution in the processing target image is corrected so that the brightness distribution matches the reference image by correcting the color of the pixel based on the difference in brightness between the reference image and the processing target image. The
また、本発明においては、動体検出装置は、補正関数を生成する際に、各画素のグレースケール値にエッジ保存平滑化を施した平滑化グレースケール値を計算し、参照画像及び処理対象画像の平滑化グレースケール値の比を計算し、計算した比が1以下であるか又は1を超過するかに応じて、画素別に補正関数を生成する。エッジ保存平滑化により、ノイズが除去される。平滑化グレースケール値の比が1を超過する場合でも補正関数が線形になるように、平滑化グレースケール値の比の値に応じて補正関数を分けて生成することにより、明るさ補正による白飛びの発生が防止される。 Further, in the present invention, when generating the correction function, the moving object detection device calculates a smoothed grayscale value obtained by performing edge preserving smoothing on the grayscale value of each pixel, and calculates the reference image and the processing target image. A ratio of the smoothed gray scale values is calculated, and a correction function is generated for each pixel depending on whether the calculated ratio is 1 or less or exceeds 1. Noise is removed by edge preserving smoothing. Even when the ratio of the smoothed gray scale value exceeds 1, the correction function is generated separately according to the value of the smoothed gray scale value ratio so that the correction function is linear. The occurrence of flying is prevented.
また、本発明においては、動体検出装置は、動画に含まれる画像の中から、統計情報を利用した背景モデルを用いた背景差分による差分値に基づいて、初期の動体が含まれていない基準画像となる参照画像を特定することができる。 Further, in the present invention, the moving object detection device includes a reference image that does not include an initial moving object based on a difference value based on a background difference using a background model that uses statistical information from among images included in a moving image. Can be identified.
本発明にあっては、動体の誤検出が確実に減少し、また、長時間に亘って動体の検出を行う場合であっても動体検出を継続することが可能となる等、優れた効果を奏する。 In the present invention, it is possible to reliably reduce the false detection of moving objects, and to provide excellent effects such as enabling the detection of moving objects even when moving objects are detected over a long period of time. Play.
以下本発明をその実施の形態を示す図面に基づき具体的に説明する。
図1は、画像を撮影し、撮影画像から動体検出を行うカメラシステムの構成例を示す模式図である。カメラシステムは、撮影を行うカメラ2と、動体検出を行う動体検出装置1とを備えている。カメラ2は動体検出装置1に接続されている。例えば、カメラ2は監視カメラである。カメラ2は、カメラ2の外部を連続的に撮影した動画、又はカメラ2の外部を繰り返し撮影した複数の静止画の形で画像を作成し、作成した画像を動体検出装置1へ入力する。
Hereinafter, the present invention will be specifically described with reference to the drawings showing embodiments thereof.
FIG. 1 is a schematic diagram illustrating a configuration example of a camera system that captures an image and detects a moving object from the captured image. The camera system includes a
図2は、動体検出装置1の機能構成を示す機能ブロック図である。動体検出装置1は、情報処理を行う処理部11と、インタフェース部14と、記憶部15とを備えている。インタフェース部14は、カメラ2に接続されている。カメラ2から入力された画像は、インタフェース部14で受け付けられ、記憶部15に記憶される。画像はビットマップデータ等の所定のフォーマットの電子データとしてカメラ2で作成され、記憶部15に記憶される。画像は複数の画素から構成されており、画像を表す電子データには、各画素の色を表す複数の数値である画素値が含まれている。例えば、各画素の色は、R(赤)G(緑)B(青)夫々の明度の組み合わせで表されている。記憶部15には、少なくとも、動体検出のために参照される参照画像151と、カメラ2から入力された入力画像152とが記憶される。入力画像152は、処理対象画像に対応する。
FIG. 2 is a functional block diagram showing a functional configuration of the moving
処理部11は、画像の明るさ補正を行う明るさ補正部12と、明るさ補正された画像から動体を検出する動体検出部13とを備えている。明るさ補正部12は、画像のグレースケール値を計算するグレースケール値計算部121と、グレースケール値の平滑化を行う平滑化部122と、参照画像151と入力画像152との間でグレースケール値を比較する比較部123と、明るさを補正するための補正関数を生成する補正関数生成部124と、明るさ補正の計算を行う補正計算部125とを有している。動体検出部13は、背景モデル生成部131と、入力画像152から動体の候補を検出する動体候補検出部132と、動体の候補の中から動体を特定する動体特定部133とを有している。
The
動体検出装置1は、サーバ装置又はパーソナルコンピュータ等のコンピュータで構成されている。図3は、動体検出装置1の構成例を示すブロック図である。動体検出装置1は、演算を行うCPU(Central Processing Unit )101と、RAM(Random Access Memory)102と、光ディスク等の記録媒体3から情報を読み取るドライブ部103と、不揮発性記憶部104と、インタフェース部14とを備えている。CPU101は演算部に対応する。例えば、不揮発性記憶部104はハードディスク又は不揮発性の半導体メモリである。CPU101は、記録媒体3に記録されたコンピュータプログラム31をドライブ部103に読み取らせ、読み取ったコンピュータプログラム31を不揮発性記憶部104に記憶させる。コンピュータプログラム31は、動体検出装置1の外部からダウンロードされてもよく、予め不揮発性記憶部104に記憶されていてもよい。CPU101は、必要に応じてコンピュータプログラム31を不揮発性記憶部104からRAM102へロードし、ロードしたコンピュータプログラム31に従って、各種の処理を実行する。CPU101がコンピュータプログラム31に従った処理を実行することにより、処理部11が実現される。記憶部15は、RAM102及び不揮発性記憶部104から構成される。図中には、参照画像151及び入力画像152が不揮発性記憶部104に記憶された例を示したが、参照画像151及び入力画像152はRAM102に記憶されてもよい。なお、処理部11の一部又は全部は、ソフトウェアを用いた処理によって実現されるのではなく、ハードウェアによって構成されていてもよい。
The moving
以下に、動体検出装置1の動作を説明する。図4は、動体検出装置1が実行する処理の手順を示すフローチャートである。CPU101は、コンピュータプログラム31に基づいて以下の処理を実行する。カメラ2から動体検出装置1へ画像が入力され(S1)、動体検出装置1は、参照画像151、及びカメラ2から入力された入力画像152を記憶部15に記憶する(S2)。カメラ2から入力される画像は、カメラ2で撮影された動画の最新の部分、又はカメラ2で撮影された最新の静止画である。参照画像151は、背景のみが写されていると期待され得る画像である。例えば、参照画像151は、カメラ2で撮影された動画の最初の1フレームの画像、又は予め作成された画像である。入力画像152は、例えば、入力された動画に含まれる1フレームの画像、又は入力された静止画である。S1では、CPU101は、入力画像152を不揮発性記憶部104及びRAM102に記憶し、予め不揮発性記憶部104に記憶されている参照画像151を読み出してRAM102に記憶する。CPU101は、入力画像152内の明るさの分布を参照画像151内の明るさの分布に合わせるように入力画像152の明るさ補正を行い(S3)、次に、明るさ補正を行った後の入力画像152から動体検出を行う(S4)。S3の明るさ補正の処理は明るさ補正部12に対応し、S4の動体検出の処理は動体検出部13に対応する。
Below, operation | movement of the moving
図5は、S3の明るさ補正の処理の詳細な手順を示すフローチャートである。図6は、参照画像151の例を示す模式図であり、図7は、入力画像152の例を示す模式図である。図6に示す参照画像151及び図7に示す入力画像152は、同じ室内を撮影した画像である。図6に示す参照画像151に比べて、図7に示す入力画像152では局所的に明るさが変動している。CPU101は、入力画像152に含まれる各画素のグレースケール値を計算する(S31)。グレースケール値は、各画素の明暗を表す値である。グレースケール値が8ビットで表される場合は、グレースケール値は0〜255のいずれかの値となる。グレースケール値は、各画素の色を表す複数の画素値から所定の方法で計算される。例えば、CPU101は、画素毎に記録されているRGBの明度の値から、所定の計算式を用いてグレースケール値を計算する。
FIG. 5 is a flowchart showing a detailed procedure of the brightness correction process in S3. FIG. 6 is a schematic diagram illustrating an example of the
CPU101は、次に、入力画像152の各画素のグレースケール値に対して、エッジ保存平滑化を行う(S32)。入力画像152の各画素のグレースケール値にエッジ保存平滑化を施した平滑化グレースケール値が計算される。CPU101は、所定のフィルタを用いて、エッジ保存平滑化の計算を行う。エッジ保存平滑化により、入力画像152内のエッジが保存されながらも、明るさの分布が平滑化され、ノイズが除去される。参照画像151の各画素の平滑化グレースケール値は、予め計算されて不揮発性記憶部104に記憶されている。CPU101は、参照画像151の各画素の平滑化グレースケール値を不揮発性記憶部104から読み出してRAM102に記憶する。なお、CPU101は、S31で参照画像151の各画素のグレースケール値をも計算し、S32で参照画像151の各画素の平滑化グレースケール値をも計算してもよい。
Next, the
CPU101は、次に、参照画像151及び入力画像152に含まれる各画素の平滑化グレースケール値の比を計算する(S33)。具体的には、参照画像151の平滑化グレースケール値を入力画像152の平滑化グレースケール値で除算した値を計算する。画像内での画素の位置を(x,y)で表し、参照画像151の平滑化グレースケール値をreferenceMap(x,y)とし、入力画像152の平滑化グレースケール値をinputMap(x,y)とする。計算される比の値ratio(x、y)は、ratio(x、y)=referenceMap(x,y)/inputMap(x,y)である。
Next, the
CPU101は、次に、入力画像152に含まれる複数の画素から一の画素を選択する(S34)。CPU101は、次に、選択した画素についてS33で計算した平滑化グレースケール値の比ratio(x、y)が1以下であるか否かを判定する(S35)。平滑化グレースケール値の比が1以下である場合(S35:YES)、CPU101は、平滑化グレースケール値の比が1以下であることに応じた、画素の色を補正するための補正関数を生成する(S36)。入力画像152での画素値をinputlmg(x,y)とし、補正後の画素値をoutputlmg(x,y)とする。平滑化グレースケール値の比が1以下である場合の補正関数は、inputlmg(x,y)=0、outputlmg(x,y)=0とした二次元座標系上の点(0,0)と、inputlmg(x,y)=inputMap(x,y)、outputlmg(x,y)=referenceMap(x,y)とした点(inputMap(x,y),referenceMap(x,y))とを通る線形関数とする。S36では、CPU101は、下記の(1)式で表される補正関数を生成する。
outputlmg(x,y)=inputlmg(x,y)*ratio(x、y) …(1)
Next, the
outputlmg (x, y) = inputlmg (x, y) * ratio (x, y) (1)
平滑化グレースケール値の比ratio(x,y)が1を超過する場合(S35:NO)、CPU101は、平滑化グレースケール値の比が1を超過することに応じた補正関数を生成する(S37)。画素値が取り得る最大値をmaxとする。平滑化グレースケール値の比が1を超過する場合の補正関数は、点(inputMap(x,y),referenceMap(x,y))と、inputlmg(x,y)=max、outputlmg(x,y)=maxとした点(max,max)とを通る線形関数とする。画素値が8ビットで表される場合は、max=255となる。S37では、CPU101は、下記の(2)式〜(4)式で表される補正関数を生成する。
outputlmg(x,y)=inputlmg(x,y)*rate+offset …(2)
rate=(max−referenceMap(x,y))/(max−inputMap(x,y)) …(3)
offset=referenceMap(x,y)−rate*inputMap(x,y) …(4)
When the ratio ratio (x, y) of the smoothed gray scale value exceeds 1 (S35: NO), the
outputmg (x, y) = inputmg (x, y) * rate + offset (2)
rate = (max-referenceMap (x, y)) / (max-inputMap (x, y)) (3)
offset = referenceMap (x, y) -rate * inputMap (x, y) (4)
図8及び図9は、補正関数の例を示す特性図である。図8は、平滑化グレースケール値の比ratio(x、y)が1以下の場合の補正関数を示し、図9は、平滑化グレースケール値の比が1を超過する場合の補正関数を示す。図8及び図9には、補正関数を実線で示し、二次元座標系上の点(0,0)及び(max,max)を結ぶ傾き1の直線を破線で示している。平滑化グレースケール値の比が1以下の場合でも、1を超過する場合でも、補正関数は線形関数であり、(inputMap(x,y),referenceMap(x,y))を通る。また、補正関数の傾きは1以下になっている。平滑化グレースケール値の比が1である場合に、補正関数の傾きは1となる。何れの補正関数も、入力画像152での画素の明るさを参照画像151での明るさに合わせるように画素値を補正するための関数になっている。
8 and 9 are characteristic diagrams showing examples of the correction function. FIG. 8 shows a correction function when the ratio ratio (x, y) of the smoothed gray scale values is 1 or less, and FIG. 9 shows a correction function when the ratio of the smoothed gray scale values exceeds 1. . In FIGS. 8 and 9, the correction function is indicated by a solid line, and a straight line having a
平滑化グレースケール値の比が1を超過する場合は、補正関数を(1)式のように点(0,0)を通る線形関数にすると、補正前の値inputlmg(x,y)がmaxに達しない内に補正後の値outputlmg(x,y)がmaxに達するようになる。即ち、補正関数は非線形となり、明るさ補正によって白飛びが発生する虞がある。図9に示す如く、平滑化グレースケール値の比が1を超過する場合でも補正関数が線形になるように、平滑化グレースケール値の比の値に応じて補正関数を分けて生成することにより、明るさ補正による白飛びの発生が防止される。 When the ratio of the smoothed gray scale values exceeds 1, if the correction function is a linear function passing through the point (0, 0) as shown in the equation (1), the value inputmg (x, y) before correction is max. The corrected value outputlmg (x, y) reaches max before the value reaches the maximum value. That is, the correction function becomes non-linear, and there is a possibility that whiteout occurs due to brightness correction. As shown in FIG. 9, by generating the correction function separately according to the value of the smoothed grayscale value ratio so that the correction function becomes linear even when the ratio of the smoothed grayscale value exceeds 1. The occurrence of overexposure due to brightness correction is prevented.
S36又はS37が終了した後は、CPU101は、生成した補正関数を用いて、入力画像152での画素値から、明るさが補正された色を表す画素値を計算する(S38)。S38では、CPU101は、補正関数中のinputlmg(x,y)に画素値を代入し、補正後の画素値outputlmg(x,y)を計算する。画素の色を表す複数の画素値の夫々について、同一の補正関数を用いて、補正後の画素値outputlmg(x,y)が計算される。例えば、RGBの明度の値の夫々について、同一の補正関数により、明るさが補正された明度の値が計算される。なお、画素の色を表す複数の画素値が取り得る範囲が異なる場合は、(3)式中のmaxの値を画素値が取り得る範囲に応じた値にしてその他は同一な補正関数により、補正後の画素値が計算される。S38により、入力画像152での画素の明るさを参照画像151での明るさに合わせるように画素の色を表す各画素値が補正される。CPU101は、計算した補正後の各画素値を記憶部15に記憶する。
After S <b> 36 or S <b> 37 ends, the
CPU101は、次に、S34〜S38の処理が未処理の画素があるか否かを判定する(S39)。未処理の画素がある場合は(S39:YES)、CPU101は、処理をS34へ戻し、未処理の画素の中から一の画素を選択する。入力画像152内の全ての画素について補正後の色を表す画素値が計算されることにより、入力画像152内の明るさの分布を参照画像151内の明るさの分布に合わせるように明るさ補正が行われる。入力画像152内の全ての画素について補正後の画素値が記憶されることにより、明るさ補正された入力画像152が記憶部15に記憶される。未処理の画素が無い場合は(S39:NO)、CPU101は、S3の明るさ補正の処理を終了する。なお、CPU101は、一旦各画素について補正関数を生成してから、各画素について補正後の画素値を計算する処理を行ってもよい。S31の処理はグレースケール値計算部121に対応し、S32の処理は平滑化部122に対応し、S33の処理は比較部に対応し、S34〜S37の処理は補正関数生成部124に対応し、S38の処理は補正計算部125に対応する。
Next, the
図10は、S4の動体検出の処理の詳細な手順を示すフローチャートである。図11は、動体を写した入力画像152の例を示す模式図である。図11に示す入力画像152には、図6に示す参照画像151に写された背景に加えて、人である動体が写っている。CPU101は、明るさ補正が行われた画像に基づき、統計情報を利用した背景モデリングにより、背景差分に用いるための背景モデルを生成する(S41)。不揮発性記憶部104には、背景を写しており明るさ補正が行われた複数の画像が記憶されており、CPU101は、これらの複数の画像を読み出し、読み出した複数の画像に基づいて、統計情報を利用した背景モデリングを行う。背景モデルの基となる複数の画像には、過去に入力され明るさ補正が行われた複数の入力画像152が含まれる。背景モデルの基となる複数の画像には、参照画像151が含まれていてもよい。例えば、CPU101は、明るさ補正が行われた過去の入力画像152中で背景に対応する部分の画素値の変動を統計処理して、背景モデルを生成する。なお、S41では、CPU101は、予め生成されて記憶されている背景モデルを読み出してもよく、予め生成されている背景モデルを更新してもよい。
FIG. 10 is a flowchart showing a detailed procedure of the moving object detection process of S4. FIG. 11 is a schematic diagram illustrating an example of the
CPU101は、次に、背景差分により、明るさ補正が行われた入力画像152から動体候補を検出する(S42)。S42では、CPU101は、背景モデルと明るさ補正が行われた入力画像152とを比較し、画素値が背景モデルと異なっている画素を抽出し、抽出した画素が含まれる領域を動体候補として検出する。例えば、CPU101は、背景モデルにおいて画素値の平均及び標準偏差を用いて各画素について定められた許容範囲内に画素値が含まれていない場合に、画素値が背景モデルと異なっているとする。S42では、CPU101は、画素値が背景モデルと異なっている画素を含んだ領域を矩形枠で囲み、入力画像152中で矩形枠で囲んだ領域を動体候補としてラベリングする。S42では、動体候補が検出されないこともあり、複数の動体候補が検出されることもある。
Next, the
CPU101は、次に、動体候補があるか否かを判定する(S43)。動体候補がある場合は(S43:YES)、CPU101は、一の動体候補を選択する(S44)。CPU101は、次に、選択した動体候補の矩形枠の入力画像152内でのサイズが所定範囲内であるか否かを判定する(S45)。矩形枠のサイズの上限値及び下限値が予め定められており、矩形枠のサイズが下限値以上かつ上限値以下である場合に、CPU101は、動体候補の矩形枠のサイズが所定範囲内であると判定する。矩形枠のサイズの上限値及び下限値は、入力画像152に写り得る動体の適切なサイズに合わせて予め定められている。上限値及び下限値は、予め不揮発性記憶部104に記憶されているか、又はコンピュータプログラム31に記録されている。
Next, the
動体候補の矩形枠のサイズが所定範囲内であった場合は(S45:YES)、CPU101は、入力画像152中で矩形枠に囲まれた領域を動体であると特定する(S46)。CPU101は、動体であると特定した領域を示す情報を入力画像152に関連付けて不揮発性記憶部104に記憶する。動体候補の矩形枠のサイズが所定範囲から外れている場合(S45:NO)、又はS46が終了した後は、CPU101は、処理をS43へ戻し、未処理の動体候補があるか否かを判定する。
When the size of the rectangular frame of the moving object candidate is within the predetermined range (S45: YES), the
S43で動体候補が無い場合は(S43:NO)、S4の動体検出の処理を終了する。最終的に、動体が全く検出されないこともあり、複数の動体が検出されることもある。S41の処理は背景モデル生成部131に対応し、S42の処理は動体候補検出部132に対応し、S43〜S46の処理は動体特定部133に対応する。なお、CPU101は、S43の処理の後で、背景モデルを更新し、不揮発性記憶部104に記憶してもよい。S4の動体検出の処理が終了した後は、動体検出装置1は処理を終了する。
If there is no moving object candidate in S43 (S43: NO), the moving object detection process in S4 is terminated. Finally, a moving object may not be detected at all, and a plurality of moving objects may be detected. The process of S41 corresponds to the background
図12及び図13は、動体の検出例を示す模式図である。図12には、図11に示す入力画像152から明るさ補正を行わずに動体を検出した例を示している。図13には、本実施形態により、図11に示す入力画像152から明るさ補正を行った後に動体を検出した例を示している。図12に示した例では、局所的に明るさが変動した部分が動体として誤検出されている。図13に示した例では、局所的に明るさが変動した部分が誤検出されておらず、画像内に写っている動体が矩形枠に囲まれて特定されている。
12 and 13 are schematic diagrams showing examples of moving object detection. FIG. 12 illustrates an example in which a moving object is detected from the
カメラ2から画像が入力される都度、動体検出装置1はS1〜S4の処理を実行する。例えば、カメラ2で撮影された動画の一フレームが入力される都度、動体検出装置1はS1〜S4の処理を実行する。処理で利用される参照画像151は同一であってもよく、時間経過に応じて参照画像151が変更されてもよい。なお、動体検出装置1は、画像が入力される都度処理を実行するのではなく、その他のタイミングで処理を実行してもよい。例えば、動体検出装置1は、入力された画像を記憶部15に記憶しておき、所定量の画像が記憶された場合、処理の開始の指示を受け付けた場合、又は定期的に、記憶された画像の夫々についてS3及びS4の処理を実行してもよい。
Each time an image is input from the
動体検出装置1での動体の検出結果は、他の装置での処理に利用される。例えば、動体が検出された場合に、カメラ2が撮影する動画の録画を開始する処理が行われる。また、例えば、動体が検出された場合に、警報を発する処理が行われる。また、例えば、動体が検出された場合に、接客用ロボットが接客を開始する処理が行われる。
The detection result of the moving object in the moving
以上詳述した如く、本実施形態においては、動体検出装置1は、入力画像152の明るさ補正を行い、その後に背景差分による動体検出を行う。統計情報を利用した背景モデルを用いた背景差分により、局所的な背景の変化に対してロバスト性のある動体検出を行うことができる。即ち、樹木の揺動等の局所的な背景の変化が動体として誤検出されることが抑制される。また、入力画像152内の明るさの分布を参照画像151内の明るさの分布に合わせるように明るさ補正を行うことで、入力画像152内では、参照画像151に比べた局所的な明るさの変化が減少する。局所的な明るさの変化が減少した入力画像152から動体検出を行うことにより、局所的な明るさ変動に対してロバスト性のある動体検出を行うことができる。即ち、局所的な明るさ変動が動体として誤検出されることが抑制される。従って、図13に示すように、動体の誤検出が確実に減少する。
As described above in detail, in the present embodiment, the moving
局所的な明るさ変動に起因する誤検出が抑制されるので、カメラ2で露出又はホワイトバランス等の調整により明るさの補正を行った場合でも、誤検出が抑制される。このため、長時間に亘って動体の検出を行う場合であっても、正常な画像を取得することが可能となり、動体検出を継続することが可能となる。
Since erroneous detection due to local brightness fluctuations is suppressed, erroneous detection is suppressed even when the
なお、本実施形態においては、カメラ2で作成した画像から動体を検出する形態を示したが、動体検出装置1は、カメラでの撮影以外の方法で作成した画像から動体を検出する形態であってもよい。また、動体検出装置1は、動画に含まれる1フレーム目の画像を参照画像151として設定する他に、動画に含まれる全フレームの内で、統計情報を利用した背景モデルを用いた背景差分による差分値が最も小さい画像を、初期の動体が含まれていない基準画像となる参照画像151として特定することも可能である。また、本実施形態においては、カラー画像から動体を検出する形態を示したが、動体検出装置1は、単色画像から動体を検出する形態であってもよい。また、本実施形態においては、動体検出装置1とカメラ2とが分離した形態を示したが、動体検出装置1とカメラ2とは一体であってもよい。例えば、一体となった動体検出装置1及びカメラ2をスマートフォンで構成してもよい。
In the present embodiment, a mode in which a moving object is detected from an image created by the
1 動体検出装置
101 CPU
102 RAM
104 不揮発性記憶部
11 処理部
12 明るさ補正部
13 動体検出部
15 記憶部
151 参照画像
152 入力画像
2 カメラ
3 記録媒体
31 コンピュータプログラム
1 Moving
102 RAM
DESCRIPTION OF
Claims (6)
動体を検出する処理の対象となる処理対象画像を記憶するコンピュータに、
前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行う明るさ補正ステップと、
明るさ補正を行った後の処理対象画像に対して、動体検出を行うステップと
を含む処理を実行させることを特徴とするコンピュータプログラム。 In a computer program that causes a computer to detect a moving object in an image,
In a computer that stores a processing target image that is a target of processing for detecting a moving object,
A brightness correction step for performing brightness correction to match the brightness distribution in the processing target image with the brightness distribution in a specific reference image;
A computer program for executing a process including a step of performing moving object detection on a processing target image after performing brightness correction.
前記参照画像及び前記処理対象画像に含まれる各画素の明るさの違いに基づいて、前記処理対象画像での各画素の明るさを前記参照画像での各画素の明るさへ変換するように、各画素の色を表す複数の数値を補正するための補正関数を画素別に生成する補正関数生成ステップと、
前記処理対象画像に含まれる各画素の色を表す複数の数値から、各画素について生成した前記補正関数により、明るさが補正された色を表す複数の数値を計算するステップと
を含むことを特徴とする請求項1に記載のコンピュータプログラム。 The brightness correction step includes
Based on the difference in brightness of each pixel included in the reference image and the processing target image, so as to convert the brightness of each pixel in the processing target image to the brightness of each pixel in the reference image, A correction function generation step for generating, for each pixel, a correction function for correcting a plurality of numerical values representing the color of each pixel;
Calculating a plurality of numerical values representing colors whose brightness has been corrected by the correction function generated for each pixel from a plurality of numerical values representing the color of each pixel included in the processing target image. The computer program according to claim 1.
前記処理対象画像に含まれる各画素のグレースケール値にエッジ保存平滑化を施した平滑化グレースケール値を計算するステップと、
前記参照画像及び前記処理対象画像に含まれる各画素の平滑化グレースケール値の比を、前記参照画像での平滑化グレースケール値を前記処理対象画像での平滑化グレースケール値で除算することによって計算するステップと、
前記比が1以下である画素について、前記処理対象画像での色を表す各数値をinputlmg(x,y)、明るさが補正された色を表す各数値をoutputlmg(x,y)、前記比をratio(x、y)として、下記の(1)式で表される前記補正関数を生成するステップと、
outputlmg(x,y)=inputlmg(x,y)*ratio(x、y) …(1)
前記比が1を超過する画素について、前記参照画像での平滑化グレースケール値をreferenceMap(x,y)、前記処理対象画像での平滑化グレースケール値をinputMap(x,y)、色を表す各数値が取り得る最大値をmaxとして、下記の(2)式〜(4)式で表される前記補正関数を生成するステップと、
outputlmg(x,y)=inputlmg(x,y)*rate+offset …(2)
rate=(max−referenceMap(x,y))/(max−inputMap(x,y)) …(3)
offset=referenceMap(x,y)−rate*inputMap(x,y) …(4)
を含むことを特徴とする請求項2に記載のコンピュータプログラム。 The correction function generation step includes:
Calculating a smoothed grayscale value obtained by performing edge preservation smoothing on the grayscale value of each pixel included in the processing target image;
By dividing the ratio of the smoothed grayscale value of each pixel included in the reference image and the processing target image by dividing the smoothing grayscale value in the reference image by the smoothing grayscale value in the processing target image A calculating step;
For pixels with a ratio of 1 or less, each numerical value representing a color in the processing target image is inputmg (x, y), each numerical value representing a color whose brightness is corrected is outputlmg (x, y), and the ratio A ratio (x, y), and generating the correction function represented by the following equation (1):
outputlmg (x, y) = inputlmg (x, y) * ratio (x, y) (1)
For pixels with the ratio exceeding 1, the smoothed grayscale value in the reference image is represented by referenceMap (x, y), the smoothed grayscale value in the processing target image is represented by inputMap (x, y), and the color is represented. A step of generating the correction function represented by the following formulas (2) to (4), where max is a maximum value that each numerical value can take;
outputmg (x, y) = inputmg (x, y) * rate + offset (2)
rate = (max-referenceMap (x, y)) / (max-inputMap (x, y)) (3)
offset = referenceMap (x, y) -rate * inputMap (x, y) (4)
The computer program according to claim 2, comprising:
動体を検出する処理の対象となる処理対象画像を前記記憶部に記憶するステップと、
前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行うステップと、
明るさ補正を行った後の処理対象画像に対して、動体検出を行うステップと
を含むことを特徴とする動体検出方法。 In a moving object detection method for detecting a moving object copied in an image by a computer including a calculation unit and a storage unit,
Storing a processing target image to be a target of processing for detecting a moving object in the storage unit;
Performing brightness correction to match the brightness distribution in the processing target image with the brightness distribution in a specific reference image;
A moving object detection method comprising: performing a moving object detection on a processing target image after performing brightness correction.
動体を検出する処理の対象となる処理対象画像を記憶する記憶部と、
前記処理対象画像内の明るさの分布を特定の参照画像内の明るさの分布に合わせる明るさ補正を行う明るさ補正部と、
明るさ補正を行った後の処理対象画像に対して、動体検出を行う動体検出部と
を備えることを特徴とする動体検出装置。 In a moving object detection apparatus for detecting a moving object shown in an image,
A storage unit that stores a processing target image that is a target of processing for detecting a moving object;
A brightness correction unit that performs brightness correction to match the brightness distribution in the processing target image with the brightness distribution in a specific reference image;
A moving object detection device comprising: a moving object detection unit configured to detect a moving object with respect to a processing target image after performing brightness correction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016194392A JP6743633B2 (en) | 2016-09-30 | 2016-09-30 | Computer program, moving body detection method, and moving body detection device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016194392A JP6743633B2 (en) | 2016-09-30 | 2016-09-30 | Computer program, moving body detection method, and moving body detection device |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2018055621A true JP2018055621A (en) | 2018-04-05 |
JP6743633B2 JP6743633B2 (en) | 2020-08-19 |
Family
ID=61836850
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2016194392A Active JP6743633B2 (en) | 2016-09-30 | 2016-09-30 | Computer program, moving body detection method, and moving body detection device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6743633B2 (en) |
-
2016
- 2016-09-30 JP JP2016194392A patent/JP6743633B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP6743633B2 (en) | 2020-08-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6961797B2 (en) | Methods and devices for blurring preview photos and storage media | |
KR101036787B1 (en) | Motion vector calculation method, hand-movement correction device using the method, imaging device, and motion picture generation device | |
CN108668093B (en) | HDR image generation method and device | |
US8508605B2 (en) | Method and apparatus for image stabilization | |
JP6499188B2 (en) | How to convert a saturated image to a non-saturated image | |
JP6074254B2 (en) | Image processing apparatus and control method thereof | |
WO2014012364A1 (en) | Method and device for correcting multi-exposure motion image | |
JP2012089929A (en) | Object detection apparatus, object detection method, monitoring camera system and program | |
AU2016225841A1 (en) | Predicting accuracy of object recognition in a stitched image | |
KR20180102639A (en) | Image processing apparatus, image processing method, image processing program, and storage medium | |
JP2008259161A (en) | Target tracing device | |
US11457158B2 (en) | Location estimation device, location estimation method, and program recording medium | |
JP6178646B2 (en) | Imaging apparatus and image shake correction processing method | |
JP4628851B2 (en) | Object detection method and object detection apparatus | |
JP2021111929A (en) | Imaging device, control method of imaging device, and program | |
JP2011145766A (en) | Image processing apparatus, image display system, and image processing method | |
CN111445411A (en) | Image denoising method and device, computer equipment and storage medium | |
JP6743633B2 (en) | Computer program, moving body detection method, and moving body detection device | |
JP2019020839A (en) | Image processing apparatus, image processing method and program | |
JP6378496B2 (en) | Image processing apparatus, control method, and recording medium | |
JP2009258770A (en) | Image processing method, image processor, image processing program, and imaging device | |
JP6541416B2 (en) | IMAGE PROCESSING APPARATUS, IMAGE PROCESSING METHOD, PROGRAM, AND STORAGE MEDIUM | |
JP2018160024A (en) | Image processing device, image processing method and program | |
JP2015076676A (en) | Image processing apparatus, image processing method, and program | |
JP2013246601A (en) | Image process device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190729 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20200526 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20200610 |
|
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: 20200630 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200713 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6743633 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |