🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.video
Class Video
- java.lang.Object
-
- org.opencv.video.Video
-
public class Video extends java.lang.Object
-
-
フィールドの要約
フィールド Modifier and Type Field Description static intMOTION_AFFINEstatic intMOTION_EUCLIDEANstatic intMOTION_HOMOGRAPHYstatic intMOTION_TRANSLATIONstatic intOPTFLOW_FARNEBACK_GAUSSIANstatic intOPTFLOW_LK_GET_MIN_EIGENVALSstatic intOPTFLOW_USE_INITIAL_FLOWstatic intTrackerSamplerCSC_MODE_DETECTstatic intTrackerSamplerCSC_MODE_INIT_NEGstatic intTrackerSamplerCSC_MODE_INIT_POSstatic intTrackerSamplerCSC_MODE_TRACK_NEGstatic intTrackerSamplerCSC_MODE_TRACK_POS
-
コンストラクタの要約
コンストラクタ Constructor Description Video()
-
メソッドの要約
すべてのメソッド 静的メソッド 具象メソッド Modifier and Type Method Description static intbuildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel)Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.static intbuildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives)Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.static intbuildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder)Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.static intbuildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder)Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.static intbuildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage)Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.static voidcalcOpticalFlowFarneback​(Mat prev, Mat next, Mat flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)Computes a dense optical flow using the Gunnar Farneback's algorithm.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static voidcalcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.static RotatedRectCamShift​(Mat probImage, Rect window, TermCriteria criteria)Finds an object center, size, and orientation.static doublecomputeECC​(Mat templateImage, Mat inputImage)Computes the Enhanced Correlation Coefficient (ECC) value between two images The Enhanced Correlation Coefficient (ECC) is a normalized measure of similarity between two images CITE: EP08.static doublecomputeECC​(Mat templateImage, Mat inputImage, Mat inputMask)Computes the Enhanced Correlation Coefficient (ECC) value between two images The Enhanced Correlation Coefficient (ECC) is a normalized measure of similarity between two images CITE: EP08.static BackgroundSubtractorKNNcreateBackgroundSubtractorKNN()Creates KNN Background Subtractor whether a pixel is close to that sample.static BackgroundSubtractorKNNcreateBackgroundSubtractorKNN​(int history)Creates KNN Background Subtractorstatic BackgroundSubtractorKNNcreateBackgroundSubtractorKNN​(int history, double dist2Threshold)Creates KNN Background Subtractorstatic BackgroundSubtractorKNNcreateBackgroundSubtractorKNN​(int history, double dist2Threshold, boolean detectShadows)Creates KNN Background Subtractorstatic BackgroundSubtractorMOG2createBackgroundSubtractorMOG2()Creates MOG2 Background Subtractor to decide whether a pixel is well described by the background model.static BackgroundSubtractorMOG2createBackgroundSubtractorMOG2​(int history)Creates MOG2 Background Subtractorstatic BackgroundSubtractorMOG2createBackgroundSubtractorMOG2​(int history, double varThreshold)Creates MOG2 Background Subtractorstatic BackgroundSubtractorMOG2createBackgroundSubtractorMOG2​(int history, double varThreshold, boolean detectShadows)Creates MOG2 Background Subtractorstatic doublefindTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix)static doublefindTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType)static doublefindTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria)static doublefindTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria, Mat inputMask)static doublefindTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria, Mat inputMask, int gaussFiltSize)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 .static doublefindTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08.static doublefindTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08.static doublefindTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams, Mat referenceMask)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08.static doublefindTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams, Mat referenceMask, Mat sampleMask)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08.static doublefindTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images.static doublefindTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images.static doublefindTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType, TermCriteria criteria)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images.static doublefindTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType, TermCriteria criteria, int gaussFiltSize)Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images.static intmeanShift​(Mat probImage, Rect window, TermCriteria criteria)Finds an object on a back projection image.static MatreadOpticalFlow​(java.lang.String path)Read a .flo filestatic booleanwriteOpticalFlow​(java.lang.String path, Mat flow)Write a .flo to disk
-
-
-
フィールドの詳細
-
OPTFLOW_USE_INITIAL_FLOW
public static final int OPTFLOW_USE_INITIAL_FLOW
- 関連項目:
- Constant Field Values
-
OPTFLOW_LK_GET_MIN_EIGENVALS
public static final int OPTFLOW_LK_GET_MIN_EIGENVALS
- 関連項目:
- Constant Field Values
-
OPTFLOW_FARNEBACK_GAUSSIAN
public static final int OPTFLOW_FARNEBACK_GAUSSIAN
- 関連項目:
- Constant Field Values
-
MOTION_TRANSLATION
public static final int MOTION_TRANSLATION
- 関連項目:
- Constant Field Values
-
MOTION_EUCLIDEAN
public static final int MOTION_EUCLIDEAN
- 関連項目:
- Constant Field Values
-
MOTION_AFFINE
public static final int MOTION_AFFINE
- 関連項目:
- Constant Field Values
-
MOTION_HOMOGRAPHY
public static final int MOTION_HOMOGRAPHY
- 関連項目:
- Constant Field Values
-
TrackerSamplerCSC_MODE_INIT_POS
public static final int TrackerSamplerCSC_MODE_INIT_POS
- 関連項目:
- Constant Field Values
-
TrackerSamplerCSC_MODE_INIT_NEG
public static final int TrackerSamplerCSC_MODE_INIT_NEG
- 関連項目:
- Constant Field Values
-
TrackerSamplerCSC_MODE_TRACK_POS
public static final int TrackerSamplerCSC_MODE_TRACK_POS
- 関連項目:
- Constant Field Values
-
TrackerSamplerCSC_MODE_TRACK_NEG
public static final int TrackerSamplerCSC_MODE_TRACK_NEG
- 関連項目:
- Constant Field Values
-
TrackerSamplerCSC_MODE_DETECT
public static final int TrackerSamplerCSC_MODE_DETECT
- 関連項目:
- Constant Field Values
-
-
メソッドの詳細
-
createBackgroundSubtractorMOG2
public static BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2​(int history, double varThreshold, boolean detectShadows)
Creates MOG2 Background Subtractor- 引数:
history- ヒストリの長さ。varThreshold- ピクセルが背景モデルによって十分に表現されているかを判定するための、ピクセルとモデル間の二乗マハラノビス距離に対するしきい値。この引数は背景の更新には影響しない。detectShadows- true の場合、アルゴリズムは影を検出してマーキングする。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorMOG2
public static BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2​(int history, double varThreshold)
Creates MOG2 Background Subtractor- 引数:
history- ヒストリの長さ。varThreshold- ピクセルが背景モデルによって十分に表現されているかを判定するための、ピクセルとモデル間の二乗マハラノビス距離に対するしきい値。この引数は背景の更新には影響しない。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorMOG2
public static BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2​(int history)
Creates MOG2 Background Subtractor- 引数:
history- 履歴の長さ。ピクセルが背景モデルによって十分に表現されているかを判定する。この引数は背景の更新には影響しない。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorMOG2
public static BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2()
Creates MOG2 Background Subtractor to decide whether a pixel is well described by the background model. This parameter does not affect the background update. speed a bit, so if you do not need this feature, set the parameter to false.- 戻り値:
- 自動生成
-
createBackgroundSubtractorKNN
public static BackgroundSubtractorKNN createBackgroundSubtractorKNN​(int history, double dist2Threshold, boolean detectShadows)
Creates KNN Background Subtractor- 引数:
history- ヒストリの長さ。dist2Threshold- ピクセルがそのサンプルに近いかを判定するための、ピクセルとサンプル間の二乗距離に対するしきい値。この引数は背景の更新には影響しない。detectShadows- true の場合、アルゴリズムは影を検出してマーキングする。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorKNN
public static BackgroundSubtractorKNN createBackgroundSubtractorKNN​(int history, double dist2Threshold)
Creates KNN Background Subtractor- 引数:
history- ヒストリの長さ。dist2Threshold- ピクセルがそのサンプルに近いかを判定するための、ピクセルとサンプル間の二乗距離に対するしきい値。この引数は背景の更新には影響しない。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorKNN
public static BackgroundSubtractorKNN createBackgroundSubtractorKNN​(int history)
Creates KNN Background Subtractor- 引数:
history- 履歴の長さ。ピクセルがそのサンプルに近いかを判定する。この引数は背景の更新には影響しない。速度が若干低下するため、この機能が不要な場合は引数を false に設定する。- 戻り値:
- 自動生成
-
createBackgroundSubtractorKNN
public static BackgroundSubtractorKNN createBackgroundSubtractorKNN()
Creates KNN Background Subtractor whether a pixel is close to that sample. This parameter does not affect the background update. speed a bit, so if you do not need this feature, set the parameter to false.- 戻り値:
- 自動生成
-
CamShift
public static RotatedRect CamShift​(Mat probImage, Rect window, TermCriteria criteria)
Finds an object center, size, and orientation.- 引数:
probImage- 対象物体のヒストグラムのバックプロジェクション。calcBackProject を参照。window- 初期探索ウィンドウ。criteria- Stop criteria for the underlying meanShift. returns (in old interfaces) Number of iterations CAMSHIFT took to converge The function implements the CAMSHIFT object tracking algorithm CITE: Bradski98 . First, it finds an object center using meanShift and then adjusts the window size and finds the optimal rotation. The function returns the rotated rectangle structure that includes the object position, size, and orientation. The next position of the search window can be obtained with RotatedRect::boundingRect() See the OpenCV sample camshiftdemo.c that tracks colored objects. 覚え書き:- (Python) camshift トラッキングアルゴリズムを説明するサンプルは opencv_source_code/samples/python/snippets/camshift.py にある
- 戻り値:
- 自動生成
-
meanShift
public static int meanShift​(Mat probImage, Rect window, TermCriteria criteria)
Finds an object on a back projection image.- 引数:
probImage- 対象物体のヒストグラムのバックプロジェクション。詳細は calcBackProject を参照。window- 初期探索ウィンドウ。criteria- 反復探索アルゴリズムの停止条件。戻り値 : CAMSHIFT が収束するまでに要した反復回数。この関数は反復的な物体探索アルゴリズムを実装する。入力として物体のバックプロジェクションと初期位置を受け取る。バックプロジェクション画像のウィンドウ内の質量中心を計算し、探索ウィンドウの中心を質量中心へ移動させる。この手順は、指定された反復回数 criteria.maxCount に達するか、ウィンドウ中心の移動量が criteria.epsilon 未満になるまで繰り返される。このアルゴリズムは CamShift の内部で使用されるが、CamShift とは異なり、探索中に探索ウィンドウのサイズや向きは変化しない。calcBackProject の出力をそのままこの関数に渡せばよい。ただし、バックプロジェクションを事前にフィルタリングしてノイズを除去すると、より良い結果が得られる。例えば、findContours で連結成分を取得し、面積が小さい輪郭 ( contourArea ) を除外し、残った輪郭を drawContours で描画することでこれを行える。- 戻り値:
- 自動生成
-
buildOpticalFlowPyramid
public static int buildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage)
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.- 引数:
img- 8ビットの入力画像。pyramid- 出力ピラミッド。winSize- オプティカルフローアルゴリズムのウィンドウサイズ。calcOpticalFlowPyrLK の winSize 引数以上でなければならない。ピラミッド各レベルに必要なパディングを計算するために用いられる。maxLevel- 0始まりの最大ピラミッドレベル番号。withDerivatives- 各ピラミッドレベルの勾配を事前計算する場合に設定する。勾配なしでピラミッドが構築された場合、calcOpticalFlowPyrLK が内部で計算する。pyrBorder- ピラミッド層に対する境界モード。derivBorder- 勾配に対する境界モード。tryReuseInputImage- 可能であれば入力画像のROIをピラミッドに入れる。データのコピーを強制するには false を渡せばよい。- 戻り値:
- 構築されるピラミッドのレベル数。maxLevel より少なくなる場合がある。
-
buildOpticalFlowPyramid
public static int buildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder)
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.- 引数:
img- 8ビットの入力画像。pyramid- 出力ピラミッド。winSize- オプティカルフローアルゴリズムのウィンドウサイズ。calcOpticalFlowPyrLK の winSize 引数以上でなければならない。ピラミッド各レベルに必要なパディングを計算するために用いられる。maxLevel- 0始まりの最大ピラミッドレベル番号。withDerivatives- 各ピラミッドレベルの勾配を事前計算する場合に設定する。勾配なしでピラミッドが構築された場合、calcOpticalFlowPyrLK が内部で計算する。pyrBorder- ピラミッド層に対する境界モード。derivBorder- 勾配に対する境界モード。データのコピーを強制するため。- 戻り値:
- 構築されるピラミッドのレベル数。maxLevel より少なくなる場合がある。
-
buildOpticalFlowPyramid
public static int buildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder)
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.- 引数:
img- 8ビットの入力画像。pyramid- 出力ピラミッド。winSize- オプティカルフローアルゴリズムのウィンドウサイズ。calcOpticalFlowPyrLK の winSize 引数以上でなければならない。ピラミッド各レベルに必要なパディングを計算するために用いられる。maxLevel- 0始まりの最大ピラミッドレベル番号。withDerivatives- 各ピラミッドレベルの勾配を事前計算する場合に設定する。勾配なしでピラミッドが構築された場合、calcOpticalFlowPyrLK が内部で計算する。pyrBorder- ピラミッド層に対する境界モード。データのコピーを強制するため。- 戻り値:
- 構築されるピラミッドのレベル数。maxLevel より少なくなる場合がある。
-
buildOpticalFlowPyramid
public static int buildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives)
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.- 引数:
img- 8ビットの入力画像。pyramid- 出力ピラミッド。winSize- オプティカルフローアルゴリズムのウィンドウサイズ。calcOpticalFlowPyrLK の winSize 引数以上でなければならない。ピラミッド各レベルに必要なパディングを計算するために用いられる。maxLevel- 0始まりの最大ピラミッドレベル番号。withDerivatives- 各ピラミッドレベルの勾配を事前計算する場合に設定する。勾配なしでピラミッドが構築された場合、calcOpticalFlowPyrLK が内部で計算する。データのコピーを強制するため。- 戻り値:
- 構築されるピラミッドのレベル数。maxLevel より少なくなる場合がある。
-
buildOpticalFlowPyramid
public static int buildOpticalFlowPyramid​(Mat img, java.util.List<Mat> pyramid, Size winSize, int maxLevel)
Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.- 引数:
img- 8ビットの入力画像。pyramid- 出力ピラミッド。winSize- オプティカルフローアルゴリズムのウィンドウサイズ。calcOpticalFlowPyrLK の winSize 引数以上でなければならない。ピラミッド各レベルに必要なパディングを計算するために用いられる。maxLevel- 0始まりの最大ピラミッドレベル番号。勾配なしで構築された場合、calcOpticalFlowPyrLK が内部で計算する。データのコピーを強制するため。- 戻り値:
- 構築されるピラミッドのレベル数。maxLevel より少なくなる場合がある。
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- 誤差の出力ベクトル。各要素には対応する特徴の誤差が設定される。誤差尺度の種類は flags 引数で設定できる。フローが見つからなかった場合、誤差は定義されない(そのような場合を判別するには status 引数を使用する)。winSize- 各ピラミッドレベルにおける探索ウィンドウのサイズ。maxLevel- 0始まりの最大ピラミッドレベル番号。0に設定するとピラミッドは使用されない(単一レベル)。1に設定すると2レベル使用され、以下同様。入力としてピラミッドが渡された場合、アルゴリズムはピラミッドが持つレベル数まで使用するが、maxLevel を超えることはない。criteria- 反復探索アルゴリズムの終了条件を指定する引数(指定した最大反復回数 criteria.maxCount に達したとき、または探索ウィンドウの移動量が criteria.epsilon 未満になったとき)。flags- operation flags:- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
minEigThreshold- the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in CITE: Bouguet00), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost. The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See CITE: Bouguet00 . The function is parallelized with the TBB library. 覚え書き: Some examples:- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- 誤差の出力ベクトル。各要素には対応する特徴の誤差が設定される。誤差尺度の種類は flags 引数で設定できる。フローが見つからなかった場合、誤差は定義されない(そのような場合を判別するには status 引数を使用する)。winSize- 各ピラミッドレベルにおける探索ウィンドウのサイズ。maxLevel- 0始まりの最大ピラミッドレベル番号。0に設定するとピラミッドは使用されない(単一レベル)。1に設定すると2レベル使用され、以下同様。入力としてピラミッドが渡された場合、アルゴリズムはピラミッドが持つレベル数まで使用するが、maxLevel を超えることはない。criteria- 反復探索アルゴリズムの終了条件を指定する引数(指定した最大反復回数 criteria.maxCount に達したとき、または探索ウィンドウの移動量が criteria.epsilon 未満になったとき)。flags- operation flags:- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- 誤差の出力ベクトル。各要素には対応する特徴の誤差が設定される。誤差尺度の種類は flags 引数で設定できる。フローが見つからなかった場合、誤差は定義されない(そのような場合を判別するには status 引数を使用する)。winSize- 各ピラミッドレベルにおける探索ウィンドウのサイズ。maxLevel- 0始まりの最大ピラミッドレベル番号。0に設定するとピラミッドは使用されない(単一レベル)。1に設定すると2レベル使用され、以下同様。入力としてピラミッドが渡された場合、アルゴリズムはピラミッドが持つレベル数まで使用するが、maxLevel を超えることはない。criteria- parameter, specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- 誤差の出力ベクトル。各要素には対応する特徴の誤差が設定される。誤差尺度の種類は flags 引数で設定できる。フローが見つからなかった場合、誤差は定義されない(そのような場合を判別するには status 引数を使用する)。winSize- 各ピラミッドレベルにおける探索ウィンドウのサイズ。maxLevel- 0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel. (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- 誤差の出力ベクトル。各要素には対応する特徴の誤差が設定される。誤差尺度の種類は flags 引数で設定できる。フローが見つからなかった場合、誤差は定義されない(そのような場合を判別するには status 引数を使用する)。winSize- size of the search window at each pyramid level. level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel. (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowPyrLK
public static void calcOpticalFlowPyrLK​(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)
Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.- 引数:
prevImg- 1枚目の8ビット入力画像、または buildOpticalFlowPyramid で構築されたピラミッド。nextImg- prevImg と同じサイズ・同じ型の2枚目の入力画像またはピラミッド。prevPts- フローを求める対象となる2D点のベクトル。点の座標は単精度浮動小数点数でなければならない。nextPts- 入力特徴の2枚目の画像における新しい計算位置を格納する2D点(単精度浮動小数点座標)の出力ベクトル。OPTFLOW_USE_INITIAL_FLOW フラグが渡された場合、このベクトルは入力と同じサイズでなければならない。status- 出力ステータスベクトル(unsigned char型)。対応する特徴のフローが見つかった場合は各要素が1に設定され、そうでない場合は0に設定される。err- output vector of errors; each element of the vector is set to an error for the corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't found then the error is not defined (use the status parameter to find such cases). level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel. (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.- OPTFLOW_USE_INITIAL_FLOW は nextPts に格納された初期推定値を使用する。フラグがセットされていない場合は prevPts が nextPts にコピーされ、それが初期推定値とみなされる。
- OPTFLOW_LK_GET_MIN_EIGENVALS 誤差尺度として最小固有値を使用する(minEigThreshold の説明を参照)。このフラグが設定されていない場合は、元の点と移動後の点周辺のパッチ間のL1距離をウィンドウ内のピクセル数で割った値が誤差尺度として使用される。
- Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/lkdemo.cpp にある
- (Python) Lucas-Kanade オプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/lk_track.py にある
- (Python) ホモグラフィマッチングに Lucas-Kanade トラッカーを使った例は opencv_source_code/samples/python/lk_homography.py にある
-
calcOpticalFlowFarneback
public static void calcOpticalFlowFarneback​(Mat prev, Mat next, Mat flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
Computes a dense optical flow using the Gunnar Farneback's algorithm.- 引数:
prev- 1枚目の8ビットシングルチャンネル入力画像。next- prev と同じサイズ・同じ型の2枚目の入力画像。flow- prev と同じサイズで型が CV_32FC2 の計算されたフロー画像。pyr_scale- 各画像に対してピラミッドを構築する際の画像スケール(<1)を指定する引数。pyr_scale=0.5 は古典的なピラミッドを意味し、各次の層が前の層の半分の大きさになる。levels- 初期画像を含むピラミッド層の数。levels=1 は追加の層を作成せず、元の画像のみを使用することを意味する。winsize- 平均化ウィンドウのサイズ。値を大きくするとアルゴリズムの画像ノイズに対するロバスト性が増し、高速な動きを検出できる可能性が高まるが、動きベクトル場はよりぼやける。iterations- アルゴリズムが各ピラミッドレベルで行う反復回数。poly_n- 各ピクセルで多項式展開を求める際に用いるピクセル近傍のサイズ。値を大きくすると画像がより滑らかな曲面で近似され、アルゴリズムがよりロバストになり動きベクトル場はよりぼやける。一般的には poly_n =5 または 7 とする。poly_sigma- 多項式展開の基礎として用いる導関数を平滑化するためのガウシアンの標準偏差。poly_n=5 の場合は poly_sigma=1.1 を、poly_n=7 の場合は poly_sigma=1.5 が良い値となる。flags- operation flags that can be a combination of the following:- OPTFLOW_USE_INITIAL_FLOW は入力フローを初期フロー近似として使用する。
- OPTFLOW_FARNEBACK_GAUSSIAN はオプティカルフロー推定に、同じサイズのボックスフィルタの代わりにガウシアン \(\texttt{winsize}\times\texttt{winsize}\) フィルタを使用する。通常このオプションは、速度は低下するものの、ボックスフィルタよりも正確なフローを与える。通常、ガウシアンウィンドウの winsize は、同等のロバスト性を得るためにより大きな値に設定すべきである。
- Gunnar Farneback が記述したオプティカルフローアルゴリズムを使った例は opencv_source_code/samples/cpp/fback.cpp にある
- (Python) Gunnar Farneback が記述したオプティカルフローアルゴリズムを使った例は opencv_source_code/samples/python/opt_flow.py にある
-
computeECC
public static double computeECC​(Mat templateImage, Mat inputImage, Mat inputMask)
Computes the Enhanced Correlation Coefficient (ECC) value between two images The Enhanced Correlation Coefficient (ECC) is a normalized measure of similarity between two images CITE: EP08. The result lies in the range [-1, 1], where 1 corresponds to perfect similarity (modulo affine shift and scale), 0 indicates no correlation, and -1 indicates perfect negative correlation. For single-channel images, the ECC is defined as: \( \mathrm{ECC}(I, T) = \frac{\sum_{x} (I(x) - \mu_I)(T(x) - \mu_T)} {\sqrt{\sum_{x} (I(x) - \mu_I)^2} \cdot \sqrt{\sum_{x} (T(x) - \mu_T)^2}} \) For multi-channel images (e.g., 3-channel RGB), the formula generalizes to: \( \mathrm{ECC}(I, T) = \frac{\sum_{x} \sum_{c=1}^{C} (I_c(x) - \mu_{I_c})(T_c(x) - \mu_{T_c})} {\sqrt{\sum_{x} \sum_{c=1}^{C} (I_c(x) - \mu_{I_c})^2} \cdot \sqrt{\sum_{x} \sum_{c=1}^{C} (T_c(x) - \mu_{T_c})^2}} \) Where:- \(I_c(x), T_c(x)\) は空間位置 \(x\) におけるチャンネル \(c\) の値、
- \(\mu_{I_c}, \mu_{T_c}\) は(指定された場合)マスク領域上におけるチャンネル \(c\) の平均値、
- \(C\) はチャンネル数(現在は 1 と 3 のみサポート)、
- 総和は画像領域内のすべてのピクセル \(x\) にわたって行われる(任意でマスクにより制限される)。
- 引数:
templateImage- 入力テンプレート画像。チャンネル数は1または3で、型は CV_8U, CV_16U, CV_32F, CV_64F のいずれかでなければならない。inputImage- テンプレートと比較される入力画像。templateImage と同じ型・同じチャンネル数でなければならない。inputMask- inputImage および templateImage における有効な関心領域を指定する省略可能なシングルチャンネルマスク。- 戻り値:
- [-1, 1] の範囲のECC類似度係数。SEE: findTransformECC
-
computeECC
public static double computeECC​(Mat templateImage, Mat inputImage)
Computes the Enhanced Correlation Coefficient (ECC) value between two images The Enhanced Correlation Coefficient (ECC) is a normalized measure of similarity between two images CITE: EP08. The result lies in the range [-1, 1], where 1 corresponds to perfect similarity (modulo affine shift and scale), 0 indicates no correlation, and -1 indicates perfect negative correlation. For single-channel images, the ECC is defined as: \( \mathrm{ECC}(I, T) = \frac{\sum_{x} (I(x) - \mu_I)(T(x) - \mu_T)} {\sqrt{\sum_{x} (I(x) - \mu_I)^2} \cdot \sqrt{\sum_{x} (T(x) - \mu_T)^2}} \) For multi-channel images (e.g., 3-channel RGB), the formula generalizes to: \( \mathrm{ECC}(I, T) = \frac{\sum_{x} \sum_{c=1}^{C} (I_c(x) - \mu_{I_c})(T_c(x) - \mu_{T_c})} {\sqrt{\sum_{x} \sum_{c=1}^{C} (I_c(x) - \mu_{I_c})^2} \cdot \sqrt{\sum_{x} \sum_{c=1}^{C} (T_c(x) - \mu_{T_c})^2}} \) Where:- \(I_c(x), T_c(x)\) は空間位置 \(x\) におけるチャンネル \(c\) の値、
- \(\mu_{I_c}, \mu_{T_c}\) は(指定された場合)マスク領域上におけるチャンネル \(c\) の平均値、
- \(C\) はチャンネル数(現在は 1 と 3 のみサポート)、
- 総和は画像領域内のすべてのピクセル \(x\) にわたって行われる(任意でマスクにより制限される)。
- 引数:
templateImage- 入力テンプレート画像。チャンネル数は1または3で、型は CV_8U, CV_16U, CV_32F, CV_64F のいずれかでなければならない。inputImage- テンプレートと比較される入力画像。templateImage と同じ型・同じチャンネル数でなければならない。- 戻り値:
- [-1, 1] の範囲のECC類似度係数。SEE: findTransformECC
-
findTransformECC
public static double findTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria, Mat inputMask, int gaussFiltSize)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 .- 引数:
templateImage- 1チャンネルまたは3チャンネルのテンプレート画像。CV_8U, CV_16U, CV_32F, CV_64F 型。inputImage- 最終的な warpMatrix で変形(ワープ)させることで templateImage に似た画像を得るための入力画像。templateImage と同じ型。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。motionType- parameter, specifying the type of motion:- MOTION_TRANSLATION は平行移動の動きモデルを設定する。warpMatrix は \(2\times 3\) で、最初の \(2\times 2\) の部分が単位行列、残りの2つの引数が推定される。
- MOTION_EUCLIDEAN はユークリッド(剛体)変換を動きモデルとして設定する。3つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_AFFINE はアフィン動きモデル(デフォルト)を設定する。6つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_HOMOGRAPHY はホモグラフィを動きモデルとして設定する。8個のパラメータが推定され、\
warpMatrix\は \(3\times 3\) となる。
criteria- ECCアルゴリズムの終了条件を指定するパラメータ。criteria.epsilon は2回の反復間における相関係数の増分のしきい値を定義する(criteria.epsilon を負の値にすると criteria.maxcount が唯一の終了条件となる)。デフォルト値は上の宣言に示されている。inputMask- inputImage の有効な値を示す、省略可能なシングルチャンネルのマスク。gaussFiltSize- ガウシアン平滑化フィルタのサイズを示す省略可能な値(デフォルト: 5)。この関数は ECC 基準(CITE: EP08)に関して最適な変換(warpMatrix)を推定する。すなわち \(\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\) であり、ここで \(\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\) である(ホモグラフィの場合、この式は同次座標で成り立つ)。戻り値は最終的な強調相関係数(enhanced correlation coefficient)であり、これはテンプレート画像と最終的に変形された入力画像との相関係数である。motionType = 0, 1, 2 で \(3\times 3\) 行列が与えられた場合、3行目は無視される。findHomography や estimateRigidTransform とは異なり、findTransformECC 関数は輝度の類似性に基づく領域ベースの位置合わせを実装している。本質的には、この関数は画像を大まかに位置合わせする初期変換を更新する。この情報が与えられない場合は、恒等ワープ(単位行列)が初期化として用いられる。画像が大きな移動・回転を伴う場合は、画像を大まかに位置合わせする初期変換が必要であることに注意する(例えば、画像がほぼ同じ内容を示すようにする単純なユークリッド変換・相似変換)。2枚目の画像で逆ワープを用いて1枚目に近い画像を得る、すなわち warpAffine または warpPerspective とともに WARP_INVERSE_MAP フラグを使用する。この関数の使用例を示す OpenCV のサンプル image_alignment.cpp も参照のこと。アルゴリズムが収束しない場合、この関数は例外をスローすることに注意する。SEE: computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECC
public static double findTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria, Mat inputMask)
-
findTransformECC
public static double findTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType, TermCriteria criteria)
-
findTransformECC
public static double findTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix, int motionType)
-
findTransformECC
public static double findTransformECC​(Mat templateImage, Mat inputImage, Mat warpMatrix)
-
findTransformECCWithMask
public static double findTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType, TermCriteria criteria, int gaussFiltSize)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images. This function extends findTransformECC() by adding a mask for the template image. The Enhanced Correlation Coefficient is evaluated only over pixels that are valid in both images: on each iteration inputMask is warped into the template frame and combined with templateMask, and only the intersection of these masks contributes to the objective function.- 引数:
templateImage- 1チャンネルまたは3チャンネルのテンプレート画像。CV_8U, CV_16U, CV_32F, CV_64F 型。inputImage- 最終的な warpMatrix で変形(ワープ)させることで templateImage に似た画像を得るための入力画像。templateImage と同じ型。templateMask- 位置合わせに使用する有効なピクセルを示す、templateImage 用のシングルチャンネル8ビットマスク。templateImage と同じサイズでなければならない。inputMask- 変形前の有効なピクセルを示す、inputImage 用のシングルチャンネル8ビットマスク。inputImage と同じサイズでなければならない。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。motionType- parameter, specifying the type of motion:- MOTION_TRANSLATION は平行移動の動きモデルを設定する。warpMatrix は \(2\times 3\) で、最初の \(2\times 2\) の部分が単位行列、残りの2つの引数が推定される。
- MOTION_EUCLIDEAN はユークリッド(剛体)変換を動きモデルとして設定する。3つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_AFFINE はアフィン動きモデル(デフォルト)を設定する。6つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_HOMOGRAPHY はホモグラフィを動きモデルとして設定する。8つの引数が推定され、warpMatrix は \(3\times 3\) である。
criteria- ECCアルゴリズムの終了条件を指定するパラメータ。criteria.epsilon は2回の反復間における相関係数の増分のしきい値を定義する(criteria.epsilon を負の値にすると criteria.maxcount が唯一の終了条件となる)。デフォルト値は上の宣言に示されている。gaussFiltSize- 位置合わせを計算する前に画像とマスクを平滑化するために使用するガウシアン平滑化フィルタのサイズ(デフォルト: 5)。SEE: findTransformECC, computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECCWithMask
public static double findTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType, TermCriteria criteria)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images. This function extends findTransformECC() by adding a mask for the template image. The Enhanced Correlation Coefficient is evaluated only over pixels that are valid in both images: on each iteration inputMask is warped into the template frame and combined with templateMask, and only the intersection of these masks contributes to the objective function.- 引数:
templateImage- 1チャンネルまたは3チャンネルのテンプレート画像。CV_8U, CV_16U, CV_32F, CV_64F 型。inputImage- 最終的な warpMatrix で変形(ワープ)させることで templateImage に似た画像を得るための入力画像。templateImage と同じ型。templateMask- 位置合わせに使用する有効なピクセルを示す、templateImage 用のシングルチャンネル8ビットマスク。templateImage と同じサイズでなければならない。inputMask- 変形前の有効なピクセルを示す、inputImage 用のシングルチャンネル8ビットマスク。inputImage と同じサイズでなければならない。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。motionType- parameter, specifying the type of motion:- MOTION_TRANSLATION は平行移動の動きモデルを設定する。warpMatrix は \(2\times 3\) で、最初の \(2\times 2\) の部分が単位行列、残りの2つの引数が推定される。
- MOTION_EUCLIDEAN はユークリッド(剛体)変換を動きモデルとして設定する。3つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_AFFINE はアフィン動きモデル(デフォルト)を設定する。6つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_HOMOGRAPHY はホモグラフィを動きモデルとして設定する。8つの引数が推定され、warpMatrix は \(3\times 3\) である。
criteria- ECCアルゴリズムの終了条件を指定するパラメータ。criteria.epsilon は2回の反復間における相関係数の増分のしきい値を定義する(criteria.epsilon を負の値にすると criteria.maxcount が唯一の終了条件となる)。デフォルト値は上の宣言に示されている。位置合わせを計算する前に(デフォルト: 5)。SEE: findTransformECC, computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECCWithMask
public static double findTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix, int motionType)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images. This function extends findTransformECC() by adding a mask for the template image. The Enhanced Correlation Coefficient is evaluated only over pixels that are valid in both images: on each iteration inputMask is warped into the template frame and combined with templateMask, and only the intersection of these masks contributes to the objective function.- 引数:
templateImage- 1チャンネルまたは3チャンネルのテンプレート画像。CV_8U, CV_16U, CV_32F, CV_64F 型。inputImage- 最終的な warpMatrix で変形(ワープ)させることで templateImage に似た画像を得るための入力画像。templateImage と同じ型。templateMask- 位置合わせに使用する有効なピクセルを示す、templateImage 用のシングルチャンネル8ビットマスク。templateImage と同じサイズでなければならない。inputMask- 変形前の有効なピクセルを示す、inputImage 用のシングルチャンネル8ビットマスク。inputImage と同じサイズでなければならない。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。motionType- parameter, specifying the type of motion:- MOTION_TRANSLATION は平行移動の動きモデルを設定する。warpMatrix は \(2\times 3\) で、最初の \(2\times 2\) の部分が単位行列、残りの2つの引数が推定される。
- MOTION_EUCLIDEAN はユークリッド(剛体)変換を動きモデルとして設定する。3つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_AFFINE はアフィン動きモデル(デフォルト)を設定する。6つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_HOMOGRAPHY はホモグラフィを動きモデルとして設定する。8つの引数が推定され、warpMatrix は \(3\times 3\) である。
- 戻り値:
- 自動生成
-
findTransformECCWithMask
public static double findTransformECCWithMask​(Mat templateImage, Mat inputImage, Mat templateMask, Mat inputMask, Mat warpMatrix)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08 using validity masks for both the template and the input images. This function extends findTransformECC() by adding a mask for the template image. The Enhanced Correlation Coefficient is evaluated only over pixels that are valid in both images: on each iteration inputMask is warped into the template frame and combined with templateMask, and only the intersection of these masks contributes to the objective function.- 引数:
templateImage- 1チャンネルまたは3チャンネルのテンプレート画像。CV_8U, CV_16U, CV_32F, CV_64F 型。inputImage- 最終的な warpMatrix で変形(ワープ)させることで templateImage に似た画像を得るための入力画像。templateImage と同じ型。templateMask- 位置合わせに使用する有効なピクセルを示す、templateImage 用のシングルチャンネル8ビットマスク。templateImage と同じサイズでなければならない。inputMask- 変形前の有効なピクセルを示す、inputImage 用のシングルチャンネル8ビットマスク。inputImage と同じサイズでなければならない。warpMatrix- floating-point \(2\times 3\) or \(3\times 3\) mapping matrix (warp).- MOTION_TRANSLATION は平行移動の動きモデルを設定する。warpMatrix は \(2\times 3\) で、最初の \(2\times 2\) の部分が単位行列、残りの2つの引数が推定される。
- MOTION_EUCLIDEAN はユークリッド(剛体)変換を動きモデルとして設定する。3つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_AFFINE はアフィン動きモデル(デフォルト)を設定する。6つの引数が推定され、warpMatrix は \(2\times 3\) である。
- MOTION_HOMOGRAPHY はホモグラフィを動きモデルとして設定する。8つの引数が推定され、warpMatrix は \(3\times 3\) である。
- 戻り値:
- 自動生成
-
findTransformECCMultiScale
public static double findTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams, Mat referenceMask, Mat sampleMask)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08. Uses pyramids.- 引数:
reference- シングルチャンネルの参照画像。CV_8U, CV_16U, CV_32F, CV_64F 型。sample- 最終的な warpMatrix でワープして reference に似た画像を得るためのサンプル画像。reference と同じ型。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。eccParams- アルゴリズムのパラメータのリスト。詳細は ECCParameters を参照。referenceMask- reference の有効な値を示す省略可能なシングルチャンネルマスク。sampleMask- sample の有効な値を示す省略可能なシングルチャンネルマスク。この関数は ECC 基準 (CITE: EP08) に関して最適な変換 (warpMatrix) を推定する。すなわち \(\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\) であり、ここで \(\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\) である(この式はホモグラフィの場合は同次座標で成り立つ)。戻り値は最終的な強調相関係数 (enhanced correlation coefficient)、すなわちテンプレート画像と最終的にワープされた入力画像との相関係数である。motionType =0、1、または 2 で \(3\times 3\) 行列が与えられた場合、3行目は無視される。findHomography や estimateRigidTransform とは異なり、関数 findTransformECCMultiScale は輝度の類似性に基づく領域ベースの位置合わせを実装している。本質的には、この関数は画像を大まかに位置合わせする初期変換を更新する。この情報が欠けている場合、恒等ワープ(単位行列)が初期化に使用される。画像が大きな並進・回転を受ける場合、画像を大まかに位置合わせする初期変換が必要である(例えば、ほぼ同じ画像内容を示す画像を許容する単純なユークリッド/相似変換)。2枚目の画像に逆ワープを使って1枚目に近い画像を得る、すなわち warpAffine または warpPerspective とともにフラグ WARP_INVERSE_MAP を使用すること。この関数の使い方を示す OpenCV のサンプル image_alignment.cpp も参照。アルゴリズムが収束しない場合、この関数は例外を投げることに注意。findTransformECC とは異なり、findTransformECCMultiScale はピラミッドを使用するため、関数がより安定し、より複雑なケースを正しく扱える。SEE: computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECCMultiScale
public static double findTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams, Mat referenceMask)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08. Uses pyramids.- 引数:
reference- シングルチャンネルの参照画像。CV_8U, CV_16U, CV_32F, CV_64F 型。sample- 最終的な warpMatrix でワープして reference に似た画像を得るためのサンプル画像。reference と同じ型。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。eccParams- アルゴリズムのパラメータのリスト。詳細は ECCParameters を参照。referenceMask- reference の有効な値を示す省略可能なシングルチャンネルマスク。この関数は ECC 基準 (CITE: EP08) に関して最適な変換 (warpMatrix) を推定する。すなわち \(\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\) であり、ここで \(\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\) である(この式はホモグラフィの場合は同次座標で成り立つ)。戻り値は最終的な強調相関係数 (enhanced correlation coefficient)、すなわちテンプレート画像と最終的にワープされた入力画像との相関係数である。motionType =0、1、または 2 で \(3\times 3\) 行列が与えられた場合、3行目は無視される。findHomography や estimateRigidTransform とは異なり、関数 findTransformECCMultiScale は輝度の類似性に基づく領域ベースの位置合わせを実装している。本質的には、この関数は画像を大まかに位置合わせする初期変換を更新する。この情報が欠けている場合、恒等ワープ(単位行列)が初期化に使用される。画像が大きな並進・回転を受ける場合、画像を大まかに位置合わせする初期変換が必要である(例えば、ほぼ同じ画像内容を示す画像を許容する単純なユークリッド/相似変換)。2枚目の画像に逆ワープを使って1枚目に近い画像を得る、すなわち warpAffine または warpPerspective とともにフラグ WARP_INVERSE_MAP を使用すること。この関数の使い方を示す OpenCV のサンプル image_alignment.cpp も参照。アルゴリズムが収束しない場合、この関数は例外を投げることに注意。findTransformECC とは異なり、findTransformECCMultiScale はピラミッドを使用するため、関数がより安定し、より複雑なケースを正しく扱える。SEE: computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECCMultiScale
public static double findTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix, ECCParameters eccParams)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08. Uses pyramids.- 引数:
reference- シングルチャンネルの参照画像。CV_8U, CV_16U, CV_32F, CV_64F 型。sample- 最終的な warpMatrix でワープして reference に似た画像を得るためのサンプル画像。reference と同じ型。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。eccParams- アルゴリズムのパラメータのリスト。詳細は ECCParameters を参照。この関数は ECC 基準 (CITE: EP08) に関して最適な変換 (warpMatrix) を推定する。すなわち \(\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\) であり、ここで \(\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\) である(この式はホモグラフィの場合は同次座標で成り立つ)。戻り値は最終的な強調相関係数 (enhanced correlation coefficient)、すなわちテンプレート画像と最終的にワープされた入力画像との相関係数である。motionType =0、1、または 2 で \(3\times 3\) 行列が与えられた場合、3行目は無視される。findHomography や estimateRigidTransform とは異なり、関数 findTransformECCMultiScale は輝度の類似性に基づく領域ベースの位置合わせを実装している。本質的には、この関数は画像を大まかに位置合わせする初期変換を更新する。この情報が欠けている場合、恒等ワープ(単位行列)が初期化に使用される。画像が大きな並進・回転を受ける場合、画像を大まかに位置合わせする初期変換が必要である(例えば、ほぼ同じ画像内容を示す画像を許容する単純なユークリッド/相似変換)。2枚目の画像に逆ワープを使って1枚目に近い画像を得る、すなわち warpAffine または warpPerspective とともにフラグ WARP_INVERSE_MAP を使用すること。この関数の使い方を示す OpenCV のサンプル image_alignment.cpp も参照。アルゴリズムが収束しない場合、この関数は例外を投げることに注意。findTransformECC とは異なり、findTransformECCMultiScale はピラミッドを使用するため、関数がより安定し、より複雑なケースを正しく扱える。SEE: computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
findTransformECCMultiScale
public static double findTransformECCMultiScale​(Mat reference, Mat sample, Mat warpMatrix)
Finds the geometric transform (warp) between two images in terms of the ECC criterion CITE: EP08. Uses pyramids.- 引数:
reference- シングルチャンネルの参照画像。CV_8U, CV_16U, CV_32F, CV_64F 型。sample- 最終的な warpMatrix でワープして reference に似た画像を得るためのサンプル画像。reference と同じ型。warpMatrix- 浮動小数点型の \(2\times 3\) または \(3\times 3\) のマッピング行列(ワープ)。この関数は ECC 基準 (CITE: EP08) に関して最適な変換 (warpMatrix) を推定する。すなわち \(\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\) であり、ここで \(\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\) である(この式はホモグラフィの場合は同次座標で成り立つ)。戻り値は最終的な強調相関係数 (enhanced correlation coefficient)、すなわちテンプレート画像と最終的にワープされた入力画像との相関係数である。motionType =0、1、または 2 で \(3\times 3\) 行列が与えられた場合、3行目は無視される。findHomography や estimateRigidTransform とは異なり、関数 findTransformECCMultiScale は輝度の類似性に基づく領域ベースの位置合わせを実装している。本質的には、この関数は画像を大まかに位置合わせする初期変換を更新する。この情報が欠けている場合、恒等ワープ(単位行列)が初期化に使用される。画像が大きな並進・回転を受ける場合、画像を大まかに位置合わせする初期変換が必要である(例えば、ほぼ同じ画像内容を示す画像を許容する単純なユークリッド/相似変換)。2枚目の画像に逆ワープを使って1枚目に近い画像を得る、すなわち warpAffine または warpPerspective とともにフラグ WARP_INVERSE_MAP を使用すること。この関数の使い方を示す OpenCV のサンプル image_alignment.cpp も参照。アルゴリズムが収束しない場合、この関数は例外を投げることに注意。findTransformECC とは異なり、findTransformECCMultiScale はピラミッドを使用するため、関数がより安定し、より複雑なケースを正しく扱える。SEE: computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography- 戻り値:
- 自動生成
-
readOpticalFlow
public static Mat readOpticalFlow​(java.lang.String path)
Read a .flo file- 引数:
path- 読み込むファイルへのパス。readOpticalFlow 関数はファイルからフロー場(flow field)を読み込み、それを1つの行列として返す。得られる Mat は CV_32FC2 型(浮動小数点、2チャンネル)である。第1チャンネルは水平方向のフロー(u)に、第2チャンネルは垂直方向(v)に対応する。- 戻り値:
- 自動生成
-
writeOpticalFlow
public static boolean writeOpticalFlow​(java.lang.String path, Mat flow)Write a .flo to disk- 引数:
path- 書き込むファイルへのパスflow- 保存するフロー場。この関数はフロー場をファイルに保存し、成功時に true、それ以外は false を返す。フロー場は2チャンネルの浮動小数点行列(CV_32FC2)でなければならない。第1チャンネルは水平方向のフロー(u)に、第2チャンネルは垂直方向(v)に対応する。- 戻り値:
- 自動生成
-
-