运行openCV / samples / cpp / lkdemo.cpp时出错

时间:2015-06-26 16:42:50

标签: c++ opencv

我正在尝试运行基于OpenCV的Lucas kande代码:

OpenCV/samples/cpp/lkdemo.cpp

我正在使用

opencv 3.0 version 
Visual studio :2012
Platform: x64

我可以通过提供* .avi输入来运行代码。 我可以看到输出是一个相同的输入。 我看不到跟踪点/箭头。 我可以在我的控制台上看到以下消息:

This is a demo of Lukas-Kanade optical flow lkdemo(),
Using OpenCV version 3.0.0
It uses camera by default, but you can provide a path to video as an argument.

Hot keys:
        ESC - quit the program
        r - auto-initialize tracking
        c - delete all the points
        n - switch the "night" mode on/off
To add/remove a feature point click it

Corrupt JPEG data: 6 extraneous bytes before marker 0xdb
Corrupt JPEG data: 28 extraneous bytes before marker 0xdb
Corrupt JPEG data: 6 extraneous bytes before marker 0xdb
Corrupt JPEG data: 2 extraneous bytes before marker 0xdb
Corrupt JPEG data: 2905 extraneous bytes before marker 0xd5
Corrupt JPEG data: 1170 extraneous bytes before marker 0xd2

当我将任何一个输入作为r / c / n时,代码崩溃了。 谁能告诉我如何在屏幕上看到跟踪输出。

1 个答案:

答案 0 :(得分:0)

尝试使用代码"原样。"

namedWindow( "LK Demo", 1 );添加waitKey(1000);

之后

这样就变成了,

namedWindow( "LK Demo", 1 );    
waitKey(1000);     
setMouseCallback( "LK Demo", onMouse, 0 );

尝试建立之后。