andrewssobral / bgslibrary

A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT
MIT License
2.19k stars 743 forks source link

Demo core dump on Ubuntu #7

Closed Winawer closed 10 years ago

Winawer commented 10 years ago

Clean install of opencv 2.4.9 on an Ubuntu 14.04 VM, bgslibrary builds fine but the demos immediately dump core.

winawer@ubuntu:~/Downloads/bgslibrary/build$ ./bgs_demo vtest2.avi
Using OpenCV 2.4.9
Openning: vtest2.avi
FrameDifferenceBGS()
OpenCV Error: Null pointer (Invalid pointer to file storage) in cvWriteInt, file    /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp, line 2964
terminate called after throwing an instance of 'cv::Exception'
what():  /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp:2964: error: (-27) Invalid pointer to file storage in function cvWriteInt

and

winawer@ubuntu:~/Downloads/bgslibrary/build$ ./bgs -uf=true -fn vtest2.avi
-----------------------------------------
Background Subtraction Library v1.9.1     
http://code.google.com/p/bgslibrary       
by:                                       
Andrews Sobral (andrewssobral@gmail.com)  
-----------------------------------------
Using OpenCV version 2.4.9
VideoAnalysis()
VideoCapture()
FrameProcessor()
OpenCV Error: Null pointer (Invalid pointer to file storage) in cvWriteString, file    /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp, line 2980
std::exception:/home/winawer/Downloads/opencv- 2.4.9/modules/core/src/persistence.cpp:2980: error: (-27) Invalid pointer to file storage in  function cvWriteString

Repeated the test with other videos, including the one in the repo (video.avi). Same thing. OpenCV demos and helloworlds run fine, so I don't think it's an OpenCV issue. Compiled the code in the README as well, got the same problem:

winawer@ubuntu:~/Downloads/bgslibrary/build$ ./test
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
FrameDifferenceBGS()
select timeout
 OpenCV Error: Null pointer (Invalid pointer to file storage) in cvWriteInt, file /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp, line 2964
 terminate called after throwing an instance of 'cv::Exception'
 what():  /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp:2964: error: (-27) Invalid pointer to file storage in function cvWriteInt
 Aborted (core dumped)
Winawer commented 10 years ago

Bah, never mind, I'm clearly doing something wrong. The batch files run correctly, though I can't yet see what the difference is.

Answeror commented 10 years ago

You need config folder in your current working directory.

cmaria4 commented 9 years ago

I have the same problem: OpenCV Error: Null Pointer (Invalid pointer to file storage) in cvWriteString file, C:\builds\2_4_PackSlave-win32-vc12-shared\opencv\modules\core\src\persistence.cpp, line 2980 How can I fix it? The .exe file does not run!

andrewssobral commented 9 years ago

Hi @cmaria4 , you need to create a config folder in your current working directory (as @Answeror says)

mraxilus commented 8 years ago

Shouldn't that be added to the readme then? I had the same problem.