opencv:视频稳定模块示例失败,因为任何视频都有不同的错误

时间:2015-09-03 08:51:11

标签: opencv opencv3.0

使用任何视频运行视频稳定模块示例,因不同的错误而失败,尝试使用不同的文件,并且总是失败:

[theATeamMBP:ghooo]~/Projects/opencv/samples/cpp$ ./cpp-example-videostab ~/Documents/My\ Movie.mp4 -q
frame count (rough): 5
first pass: estimating motions.x..
motion estimation time: 0.539 sec
motion stabilization time: 0.000 sec
estimated trim ratio: 0.001953
processing frames.......................Segmentation fault: 11
[theATeamMBP:ghooo]~/Projects/opencv/samples/cpp$ ./cpp-example-videostab ~/Documents/My\ Movie.mp4 -q
frame count (rough): 5
first pass: estimating motions.x..
motion estimation time: 0.544 sec
motion stabilization time: 0.000 sec
estimated trim ratio: 0.001953
processing frames.......................OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/ghooo/Projects/opencv/modules/core/src/matrix.cpp, line 494
error: /Users/ghooo/Projects/opencv/modules/core/src/matrix.cpp:494: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

[theATeamMBP:ghooo]~/Projects/opencv/samples/cpp$ ./cpp-example-videostab ~/Documents/My\ Movie.mp4 -q
frame count (rough): 5
first pass: estimating motions.x..
motion estimation time: 0.534 sec
motion stabilization time: 0.000 sec
estimated trim ratio: 0.001953
processing frames.......................cpp-example-videostab(5838,0x7fff726a3300) malloc: *** mach_vm_map(size=4464468642439168) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
OpenCV Error: Insufficient memory (Failed to allocate 4464468642436064 bytes) in OutOfMemoryError, file /Users/ghooo/Projects/opencv/modules/core/src/alloc.cpp, line 52
OpenCV Error: Assertion failed (u != 0) in create, file /Users/ghooo/Projects/opencv/modules/core/src/matrix.cpp, line 410
error: /Users/ghooo/Projects/opencv/modules/core/src/matrix.cpp:410: error: (-215) u != 0 in function create

1 个答案:

答案 0 :(得分:1)

根据opencv installation guide我必须安装所需的软件包ffmpeg。我已经这样做了,但是没有写的是我必须将use_ffmpeg标志设置为yes的ccke opencv像这样 cmake -D USE_FFMPEG=YES .

现在一切正常,除了生成的视频中的声音仍无法正常工作。