Hi,
I'm having a weird problem with the Dense-Inverse-Search (DIS) optical flow implementation. Certain resolutions are causing a 'Segmentation fault (core dumped)' condition. The resolution of my video stream varies from 210 x 36 up to 750 x 144 between datasets. In example, if I run 720 x 144, no problems. 724 x 144, no problems. 725 x 144, Segmentation fault. However, larger resolutions, such as the 1024 x 436 used in the original DIS-flow paper, do not pose a problem. Is there some undocumented requirement for aspect ratio? Or minimum number of rows?
Any help would be greatly appreciated.
Original Git pull request for DIS-flow: https://github.com/opencv/opencv_contrib/pull/708
OpenCV API Class Reference for DISOpticalFlow(): http://docs.opencv.org/trunk/da/d06/classcv_1_1optflow_1_1DISOpticalFlow.html#acd51f535caa5b72f6cafdbf19c3ba3a7abcbe57b0bacfd6ae830e5fc940a47401
Minimalist code to reproduce problem:
void run_dis_minimalist()
{
cv::RNG rng;
cv::Ptr<cv::optflow::DISOpticalFlow> dense_inverse_search = cv::optflow::createOptFlow_DIS(2);
cv::setNumThreads(4);
// This works.
cv::Size image_size = cv::Size(720, 144);
// This doesn't work.
// cv::Size image_size = cv::Size(750, 144);
const int MAXIMUM_ITERATIONS = 1001;
for (int iteration = 0; iteration < MAXIMUM_ITERATIONS; iteration++)
{
std::cout << "iteration = " << iteration << std::endl;
cv::Mat frame_0 = cv::Mat::zeros(image_size, CV_8UC1);
cv::Mat frame_1 = cv::Mat::zeros(image_size, CV_8UC1);
cv::Mat flow_frame = cv::Mat::zeros(image_size, CV_32FC2);
dense_inverse_search->calc(frame_0, frame_1, flow_frame);
}
}
OpenCV build details (newest Git repository as of this time):
General configuration for OpenCV 3.2.0-dev =====================================
Version control: 3.2.0-583-gfe4555e-dirty
Extra modules:
Location (extra): /scratch/opencv_contrib/modules
Version control (extra): 3.2.0-231-gdea8d5f
Platform:
Timestamp: 2017-05-17T03:20:52Z
Host: Linux 4.8.0-51-generic x86_64
CMake: 3.5.1
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2 SSE3 SSSE3
requested: SSSE3
Dispatched code generation: SSE4_1 FP16 AVX AVX2
requested: SSE4_1 AVX FP16 AVX2
SSE4_1 (0 files): + SSE4_1
FP16 (0 files): + SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (1 files): + SSE4_1 POPCNT SSE4_2 AVX
AVX2 (1 files): + SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 5.4.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so gtk-x11-2.0 gdk-x11-2.0 pangocairo-1.0 atk-1.0 cairo gdk_pixbuf-2.0 gio-2.0 pangoft2-1.0 pango-1.0 gobject-2.0 glib-2.0 fontconfig gthread-2.0 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg /usr/lib/libopenblas.so freetype harfbuzz dl m pthread rt
3rdparty dependencies: tbb
OpenCV modules:
To be built: core flann imgproc ml objdetect phase_unwrapping photo plot reg surface_matching video xphoto bgsegm dnn face freetype fuzzy imgcodecs shape videoio xobjdetect highgui superres ts bioinspired dpm features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python3
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz cnn_3dobj cvv dnn_modern hdf matlab sfm
GUI:
QT: NO
GTK+ 2.x: YES (ver 2.24.30)
GThread : YES (ver 2.48.2)
GtkGlExt: NO
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
WEBP: build (ver encoder: 0x020e)
PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES
avcodec: YES (ver 56.60.100)
avformat: YES (ver 56.40.101)
avutil: YES (ver 54.31.100)
swscale: YES (ver 3.1.101)
avresample: NO
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
Aravis SDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
gPhoto2: NO
Parallel framework: TBB (ver 4.4 interface 9003)
Other third-party libraries:
Use Intel IPP: 2017.0.2 [2017.0.2]
at: /scratch/opencv/build/3rdparty/ippicv/ippicv_lnx
Use Intel IPP IW: prebuilt binaries (2017.0.2)
Use Intel IPP Async: NO
Use VA: NO
Use Intel VA-API/OpenCL: NO
Use Lapack: YES (/usr/lib/libopenblas.so)
Use Eigen: NO
Use Cuda: NO
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
OpenCL: <Dynamic loading of OpenCL library>
Include path: /scratch/opencv/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.12)
Python 3:
Interpreter: /usr/bin/python3 (ver 3.5.2)
Libraries: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.11.0)
packages path: lib/python3.5/dist-packages
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: /usr/bin/doxygen (ver 1.8.11)
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: /usr/local
cvconfig.h is in: /scratch/opencv/build
-----------------------------------------------------------------