I am trying to create samples for cascade classifier training using opencv_createsamples. I used the following command:
./OpenCV-2.4.1/build/bin/opencv_createsamples -vec lab_object.vec -img symbol.jpg -bg bg_lab.txt -num 1000 -maxidev 30 -maxxangle 0.2616 -maxyangle 0.2616 -maxzangle 3.1417 -w 24 -h 24 -show
But I am getting the following output on the console along with the error:
Info file name: (NULL)
Img file name: symbol.jpg
Vec file name: lab_object.vec
BG file name: bg_lab.txt
Num: 1000
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 30
Max x angle: 0.2616
Max y angle: 0.2616
Max z angle: 3.1417
Show samples: TRUE
Scale: 4
Width: 24
Height: 24
Create training samples from single image applying distortions...
*** glibc detected *** ./OpenCV-2.4.1/build/bin/opencv_createsamples: free(): corrupted unsorted chunks: 0x09237e90 ***
*** glibc detected *** ./OpenCV-2.4.1/build/bin/opencv_createsamples: malloc(): memory corruption: 0x0923ad00 ***
I am using OpenCV-2.4.1on OpenCV-2.4.1 on Ubuntu 12.04.
I installed a newer version of Opencv on Ubuntu 12.04. But I am still getting the same error.
I have also used valgrind to check if there is any problem with memory allocation and deallocation. I got the following result (I do not know how to interpret the result):
==14471== Invalid write of size 1
==14471== at 0x402C6C3: strcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14471== by 0x804B3C5: icvCreateBackgroundData(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804B4DA: icvInitBackgroundReaders(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804F938: cvCreateTrainingSamples(char const*, char const*, int, int, char const*, int, int, int, double, double, double, int$
==14471== by 0x804AE58: main (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== Address 0x76e80d8 is 0 bytes after a block of size 11,520 alloc'd
==14471== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14471== by 0x414F598: cv::fastMalloc(unsigned int) (in /home/hemu/opencv/build/lib/libopencv_core.so.2.9.0)
==14471== by 0x414F66A: cvAlloc (in /home/hemu/opencv/build/lib/libopencv_core.so.2.9.0)
==14471== by 0x804B2F9: icvCreateBackgroundData(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804B4DA: icvInitBackgroundReaders(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804F938: cvCreateTrainingSamples(char const*, char const*, int, int, char const*, int, int, int, double, double, double, int$
==14471== by 0x804AE58: main (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471==
==14471== Invalid write of size 1
==14471== at 0x402C6E8: strcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14471== by 0x804B3C5: icvCreateBackgroundData(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804B4DA: icvInitBackgroundReaders(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804F938: cvCreateTrainingSamples(char const*, char const*, int, int, char const*, int, int, int, double, double, double, int$
==14471== by 0x804AE58: main (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== Address 0x76e80eb is not stack'd, malloc'd or (recently) free'd
--14471-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--14471-- si_code=1; Faulting address: 0x6CE4EA60; sp: 0x62a62e64
valgrind: the 'impossible' happened:
Killed by fatal signal
==14471== at 0x3804BB1B: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
sched status:
running_tid=1
Thread 1: status = VgTs_Runnable
==14471== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14471== by 0x414F598: cv::fastMalloc(unsigned int) (in /home/hemu/opencv/build/lib/libopencv_core.so.2.9.0)
==14471== by 0x414F66A: cvAlloc (in /home/hemu/opencv/build/lib/libopencv_core.so.2.9.0)
==14471== by 0x804B4F8: icvInitBackgroundReaders(char const*, CvSize) (in /home/hemu/opencv/build/bin/opencv_createsamples)
==14471== by 0x804F938: cvCreateTrainingSamples(char const*, char const*, int, int, char const*, int, int, int, double, double, double, int$
==14471== by 0x804AE58: main (in /home/hemu/opencv/build/bin/opencv_createsamples)