VideoObjectTracking[video]
video 中の関心オブジェクトを検出し,動画のフレーム間でこれを追跡する.
VideoObjectTracking[objects]
objects が動画フレームからのものであると仮定して,これに対応しこれを追跡する.
VideoObjectTracking[…detector]
detector を使って入力中の関心オブジェクトを求める.
VideoObjectTracking
VideoObjectTracking[video]
video 中の関心オブジェクトを検出し,動画のフレーム間でこれを追跡する.
VideoObjectTracking[objects]
objects が動画フレームからのものであると仮定して,これに対応しこれを追跡する.
VideoObjectTracking[…detector]
detector を使って入力中の関心オブジェクトを求める.
詳細とオプション
- VideoObjectTrackingは可視化オブジェクト追跡としても知られるもので,可能であれば遮蔽を処理しながら,動画のフレーム中の一意的なオブジェクトを追跡する.追跡されるオブジェクトはトラックレットとしても知られている.
- 追跡はフレーム内のオブジェクトを自動検出することも,事前計算されたオブジェクト集合に対して行うこともできる.
- 結果は,ObjectTrackingDataオブジェクトで,各トラックレットの時間,ラベル,さまざまな特性を含んでいる.
- 次は,objects の可能な設定と対応する出力である.
-
{{pos11,pos12,…},…} 追跡点 kposij {{bbox11,bbox12,…},…} 追跡ボックス kbboxij {label1{bbox11,bbox12,…},…,…} 追跡ボックス {labeli,j}bbox {lmat1,…} ラベル行列 lmati内のセグメントのラベルを付け替える {t1obj1,…} 時間とオブジェクトのリスト - デフォルトで,オブジェクトはImageBoundingBoxesを使って検出される.次は,detector の可能な設定である.
-
f サポートされるオブジェクトを返す検出器関数 "concept" "Concept"実体で使われるような名前付きの概念 "word" WordDataで使われるような英単語 wordspec WordDataで使われるような単語の意味の指定 Entity[…] 任意の適切な実体 category1|category2|… categoryiのいずれか {pos1,pos2,…} 動画全体で最初のフレームに表示される pos1, …を追跡する - VideoObjectTracking[{image1,image2,…}]を使うことは,動画のフレーム間でオブジェクトを追跡することに等しい.
- 次は,使用可能なオプションである.
-
Method Automatic 使用する追跡メソッド TargetDevice Automatic 検出を行うターゲットデバイス - 次は,Methodオプションの可能な値である.
-
"OCSort" 観測中心のSORT(簡単,オンライン,リアルタイム)追跡.カルマン推定器を使ってオブジェクトの軌跡を予測する "RunningBuffer" オフラインメソッド.フレームのバッファを比較することでオブジェクトを関連付ける - ラベル行列を追跡するときは,遮蔽は処理されない.Method"RunningBuffer"を使うと遮蔽も追跡できる.
- Method->{"OCSort",subopt}のときは,次のサブオプションが指定できる.
-
"IOUThreshold" 0.2 境界ボックス間のIoU(intersection over union)の閾値 "OcclusionThreshold" 8 トラックレットの履歴が期限切れになるまで保存されるフレーム数 "OCMWeight" 0.2 移動する境界ボックスの方向性を考慮した観測中心の移動の重み "TimeStepORU" 3 トラックレットの再更新のために戻るトラックレット履歴の長さ - Method->{"RunningBuffer",subopt}のときは,次のサブオプションが指定できる.
-
"MaxCentroidDistance" Automatic 隣接フレームの重心間の最大距離 "OcclusionThreshold" 8 期限切れになるまで保存されるトラックレットの履歴のフレーム数 - 次は,費用行列の貢献を指定する,追加的な"RunningBuffer"サブオプションである.
-
"CentroidWeight" 0.5 成分または境界ボックス間の重心距離 "OverlapWeight" 1 成分または境界ボックスのオーバーラップ "SizeWeight" Automatic 成分または境界ボックスのサイズ
例題
すべて開く すべて閉じる例 (2)
v = \!\(\*VideoBox[""]\);HighlightVideo[v, VideoObjectTracking[v]]tracked = VideoObjectTracking[ \!\(\*VideoBox[""]\) -> FindFaces]VideoExtractFrames[#, Quantity[1, "Frames"]]& /@ tracked["SubVideo"]スコープ (8)
データ (5)
VideoObjectTracking[\!\(\*VideoBox[""]\)]images = {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]};VideoObjectTracking[images]boxes = IconizedObject[«boxes»];
boxes//ShortVideoObjectTracking[boxes]points = IconizedObject[«points»];
points[[ ;; 2]]VideoObjectTracking[points]v = \!\(\*VideoBox[""]\);ts = MorphologicalComponents[VideoFrameMap[Dilation[ColorNegate[#], 2]&, v], .5]data = VideoObjectTracking[ts]VideoGenerator[data["ColorizedImage"], Duration[v]]検出器 (3)
v = \!\(\*VideoBox[""]\);HighlightVideo[v, VideoObjectTracking[v]]HighlightVideo[v, VideoObjectTracking[v -> ImageBoundingBoxes]]HighlightVideo[v, VideoObjectTracking[v -> Entity["Concept", "Auto::p735c"]]]v = \!\(\*VideoBox[""]\);HighlightVideo[v, VideoObjectTracking[v -> FindFaces]]v = \!\(\*VideoBox[""]\);points = VideoObjectTracking[v -> {{366, 231}, {275, 225}}];
HighlightVideo[v, points]オプション (5)
Method (4)
"OCSort" (3)
OCSortでは,動きがカルマン推定器を使って予測される."OCMWeight"の値が高いほど,ボックスが予測された位置から遠ざかる際の費用も高くなる.
SeedRandom[1];
boxes = {Table[Rectangle[{i, i} * 5 + RandomReal[.1, 2]], {i, 0, 1, .03}],
Table[Rectangle[{i, 1 - i} * 5 + RandomReal[.1, 2]], {i, 0, 1, .03}]};formatBoxes = IconizedObject[«formatBoxes&»];
g = Graphics@formatBoxes[boxes]デフォルトで,軌跡の向きは非常に柔軟である.赤と青の2つのボックスが交わる領域で追跡の向きが突然変化するかもしれない点に注意のこと:
tracked = VideoObjectTracking[Transpose@boxes, Method -> "OCSort"]formatArrows = IconizedObject[«formatArrows&»];
Show[g, Graphics@formatArrows@tracked]"WeightOCM"の値を増すと突然の方向変換の可能性が減ずる:
new = VideoObjectTracking[Transpose@boxes, Method -> {"OCSort", "OCMWeight" -> 1}]Show[g, Graphics@formatArrows@new]"IOUThreshold"サブオプションは,ボックス間の和集合上における交点の閾値を,両者を潜在的に同じものと認識するために,指定する.
SeedRandom[1];
boxes = Drop[Table[{Rectangle[{i, i} * 5 + RandomReal[.1, 2]]}, {i, 0, 1, .05}], {9}];
formatBoxes = IconizedObject[«formatBoxes&»];
g = Graphics@formatBoxes[boxes]tracked = VideoObjectTracking[boxes,
Method -> {"OCSort", "IOUThreshold" -> 0.2}];formatArrows = IconizedObject[«formatArrows&»];
Show[g, Graphics[formatArrows@tracked]]new = VideoObjectTracking[boxes, Method -> {"OCSort", "IOUThreshold" -> 0.1}];Show[g, Graphics[formatArrows@new]]"OcclusionThreshold"サブオプションは(検出が上手くいかなかったり遮蔽があったりするために)一定時間消失するオブジェクトを扱う.
移動する境界ボックスがある問題を設定し,いくつかのフレームを軌跡から削除する:
SeedRandom[2];
boxes = Table[{Rectangle[{i, i} * 5 + RandomReal[.01, 2]]}, {i, 0, 1, .05}];
missingBoxes = boxes[[10 ;; 11]];
boxes = ReplacePart[boxes, {{10}, {11}} -> {}];formatBoxes = IconizedObject[«formatBoxes&»];
g = Graphics@formatBoxes[missingBoxes, boxes]遮蔽閾値がないと,オブジェクトは再び姿を表してもトラクレットに再度関連付けられることはない:
tracks = VideoObjectTracking[boxes, Method -> {"OCSort", "IOUThreshold" -> 0, "OcclusionThreshold" -> 0}]formatArrows = IconizedObject[«formatArrows&»];
Show[g, Graphics[formatArrows@tracks]]new = VideoObjectTracking[boxes, Method -> {"OCSort", "IOUThreshold" -> 0, "OcclusionThreshold" -> 2}]Show[g, Graphics[formatArrows@new]]"RunningBuffer" (1)
特定の時間インスタンスでオブジェクトが欠落している軌跡 (ピンクのボックス) を作成する:
boxes = {...};
missingBoxes = {...};
formatBoxes = IconizedObject[«formatBoxes&»];
g = Graphics@formatBoxes[missingBoxes, boxes]軌跡は"OcclusionThreshold"0ではリンクされない:
tracks = VideoObjectTracking[boxes, Method -> {"RunningBuffer", "OcclusionThreshold" -> 0}]formatArrows = IconizedObject[«formatArrows&»];
Show[g, Graphics[formatArrows@tracks]]より高いオクルージョン閾値を使ってオブジェクトの軌跡をリンクする:
tracks2 = VideoObjectTracking[boxes, Method -> {"RunningBuffer", "OcclusionThreshold" -> 2}]Show[g, Graphics[formatArrows@tracks2]]tracks3 = VideoObjectTracking[boxes, Method -> {"RunningBuffer", "OcclusionThreshold" -> 3}]Show[g, Graphics[formatArrows@tracks3]]TargetDevice (1)
デフォルトで,検出関数が指定されていなければ,検出はCPU上で行われる:
v = \!\(\*VideoBox[""]\);VideoObjectTracking[v]//AbsoluteTimingTargetDeviceオプションを"GPU"に設定してGPU上で検出を行う:
VideoObjectTracking[v, TargetDevice -> "GPU"]//AbsoluteTimingアプリケーション (13)
基本的な用法 (2)
video = \!\(\*VideoBox[""]\);boxes = ImageBoundingBoxes[video]動画中のオブジェクトをハイライトする.検出されたクラスですべてにラベルが付いている点に注意のこと:
HighlightVideo[video, boxes]trackedBoxes = VideoObjectTracking[boxes]検出され追跡されたオブジェクトを対応する指標でハイライトする:
HighlightVideo[video, trackedBoxes]video = \!\(\*VideoBox[""]\);createComponents = Composition[
MorphologicalComponents,
FillingTransform,
DeleteSmallComponents,
DeleteBorderComponents,
ColorNegate,
MorphologicalBinarize[#, 0.75]&
];matrices = VideoMapTimeSeries[createComponents[#Image]&, video]SlideShowVideo[TimeSeriesMap[Colorize, matrices]]trackedComponents =
VideoObjectTracking[matrices, Method -> "RunningBuffer"];SlideShowVideo[trackedComponents["ColorizedImage"]]オブジェクトを数える (3)
v = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[v]otd["Labels"]CountsBy[%, First]v = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[v -> Entity["Concept", "Auto::p735c"]]otd["Labels"]Max[%]v = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[v, Method -> {"OCSort", "OcclusionThreshold" -> 40}];otd["Labels"]CountsBy[%, First]追跡したオブジェクトを抽出する (1)
v = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[v, Method -> {"OCSort", "OcclusionThreshold" -> 10}];firstCar = First@otd["Labels"]otd[firstCar -> "SubVideo"]動きの軌跡を可視化する (1)
video = \!\(\*VideoBox[""]\);bboxes = ImageBoundingBoxes[video, TargetDevice -> "GPU"];
HighlightVideo[video, bboxes]otd = VideoObjectTracking[bboxes];
HighlightVideo[video, otd]ListLinePlot[DeleteMissing@#["Values"]& /@ otd["Position"]]tracks = Table[prev = {};TimeSeriesMap[(AppendTo[prev, #];Line@prev)&, DeleteMissing@pos], {pos, Values@otd["Position"]}];
HighlightVideo[video, tracks]野生生物の動画を解析する (4)
video = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[video, Method -> {...}];HighlightVideo[video, otd]video = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[video, Method -> {"OCSort", "OcclusionThreshold" -> 200, "IOUThreshold" -> {0.3, 0.1}, "WeightOCM" -> 0.05}];HighlightVideo[video, otd]video = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[video, Method -> {"OCSort", "OcclusionThreshold" -> 7, "IOUThreshold" -> {0.3, 0.1}, "WeightOCM" -> 0.3}];HighlightVideo[video, otd]video = \!\(\*VideoBox[""]\);pts = {...};
HighlightImage[VideoExtractFrames[video, Quantity[1, "Frames"]], pts]tracked = VideoObjectTracking[video -> pts]HighlightVideo[video, tracked]人間の動画を解析する (2)
video = Video@ResourceObject["Sample Video: Friends at the Beach"]data = VideoObjectTracking[video -> FindFaces]labels = Keys[ReverseSortBy[data["TimeInterval"], Abs @* Differences]][[ ;; 6]]ts = TimeSeries[data[labels]]ages = res = VideoMapList[(box |-> FacialFeatures[ImageTrim[#Image, box], "Age"]) /@ ts[#Time]&, video];Merge[ages, Median @* Flatten]//Nvideo = \!\(\*VideoBox[""]\);otd = VideoObjectTracking[video, Method -> {"OCSort", "OcclusionThreshold" -> 75, "OCMWeight" -> 0.1}];HighlightVideo[video, otd]\!\(\*VideoBox[""]\)subvideo = otd[{Entity["Concept", "Person::93r37"], 2} -> "SubVideo"]dat = otd[{Entity["Concept", "Person::93r37"], 2} -> "Position"];
positions = DeleteMissing[dat];ys = TimeSeriesMap[Last, positions]DateListPlot[ys]peaks = FindPeaks[TimeSeriesResample[ys]]Quantity[peaks["PathLength"] / First@Differences@extractLabelProperty["TimeInterval"], "Steps" / "Seconds"]DateListPlot[{ys, peaks}, ...]特性と関係 (1)
デフォルトで,オブジェクトの検出にはImageBoundingBoxesが使われる.Wolfram Neural Net Repository のYOLO V8ネットワークを使って検出する:
video = \!\(\*VideoBox[""]\);yolox = NetModel["YOLO V8 Detect Trained on MS-COCO Data"]labels = IconizedObject[«Labels»];
netevaluate[img_, detectionThreshold_ : .25, overlapThreshold_ : .5] := Module[{res, imgSize, isDetection, probableClasses, probableBoxes, h, w, max, scale, padding, nms, result}, (*define image dimensions*)imgSize = 640;
{w, h} = ImageDimensions[img];
(*get inference*)res = yolox[img];
(*filter by probability*)(*very small probability are thresholded*)isDetection = UnitStep[Max /@ res["ClassProb"] - detectionThreshold];
{probableClasses, probableBoxes} = Map[Pick[#, isDetection, 1]&, {res["ClassProb"], res["Boxes"]}];
If[Length[probableBoxes] == 0, Return[{}]];(*transform coordinates into rectangular boxes*)max = Max[{w, h}];
scale = max / imgSize;
padding = imgSize * (1 - {w, h} / max) / 2;probableBoxes = Apply[Rectangle[scale * ({#1 - #3 / 2, imgSize - #2 - #4 / 2} - padding), scale * ({#1 + #3 / 2, imgSize - #2 + #4 / 2} - padding)]&, probableBoxes, 2];(*gather the boxes of the same class and perform non-max suppression*)nms = ResourceFunction["NonMaximumSuppression"][probableBoxes -> Max /@ probableClasses, "Index", MaxOverlapFraction -> overlapThreshold];
GroupBy[Transpose[{probableBoxes[[nms]], labels[[Last @* Ordering /@ Part[probableClasses, nms]]]}], Last -> First]
];YOLO V8ネットワークを使ってオブジェクトを検出し,追跡する:
otd = VideoObjectTracking[video -> netevaluate]HighlightVideo[video, otd]おもしろい例題 (1)
video = \!\(\*VideoBox[""]\);findCentroid[frame_] := Point@Values@ComponentMeasurements[Binarize[frame, .5], "Centroid", CornerNeighbors -> False];
particles = VideoMapList[findCentroid[#Image]&, video];tracked = VideoObjectTracking[particles, Method -> {"RunningBuffer", "OcclusionThreshold" -> 4}];
positions = DeleteMissing /@ Values[tracked["Position"]];ListLinePlot[positions]ListLinePlot[#, ...]& /@ Select[positions, Length[#] > 70&]//Multicolumn関連するガイド
-
▪
- 動画処理 ▪
- 動画解析 ▪
- 動画計算機能の更新履歴
テキスト
Wolfram Research (2025), VideoObjectTracking, Wolfram言語関数, https://reference.wolfram.com/language/ref/VideoObjectTracking.html (2025年に更新).
CMS
Wolfram Language. 2025. "VideoObjectTracking." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/VideoObjectTracking.html.
APA
Wolfram Language. (2025). VideoObjectTracking. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoObjectTracking.html
BibTeX
@misc{reference.wolfram_2026_videoobjecttracking, author="Wolfram Research", title="{VideoObjectTracking}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/VideoObjectTracking.html}", note=[Accessed: 12-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_videoobjecttracking, organization={Wolfram Research}, title={VideoObjectTracking}, year={2025}, url={https://reference.wolfram.com/language/ref/VideoObjectTracking.html}, note=[Accessed: 12-November-2026]}