opencv:视频稳定模块示例因任何具有不同错误的视频而失败
opencv: video stabilization module sample failing for any video with different errors
运行 任何视频的视频稳定模块样本,由于不同的错误而失败尝试了不同的文件,但总是失败:
[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
根据 opencv installation guide 我必须安装所需的软件包 ffmpeg。我已经这样做了,但是没有写的是我必须像这样将 use_ffmpeg 标志设置为是的 cmake opencv
cmake -D USE_FFMPEG=YES .
现在一切正常,除了生成的视频中的声音无法正常工作。
运行 任何视频的视频稳定模块样本,由于不同的错误而失败尝试了不同的文件,但总是失败:
[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
根据 opencv installation guide 我必须安装所需的软件包 ffmpeg。我已经这样做了,但是没有写的是我必须像这样将 use_ffmpeg 标志设置为是的 cmake opencv
cmake -D USE_FFMPEG=YES .
现在一切正常,除了生成的视频中的声音无法正常工作。