Ask Your Question

Hemu's profile - activity

2013-08-05 13:13:10 -0600 commented question Runtime error with opencv_createsamples

I tried it with two other images but the same result. However, the problem was solved using DieHard (a software for error resistant memory allocation). The problem is that I had used the program two months ago without any error but now I am unable to understand the reason of the error.

2013-07-26 13:31:40 -0600 received badge  Editor (source)
2013-07-26 06:43:19 -0600 asked a question Runtime error with opencv_createsamples

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 Ubuntu 12.04. I tried again by installing a newer version of Opencv. But I am still getting the same error while using opencv_createsamples.

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 ...
(more)