Ask Your Question
1

HEAP; corruption or bug when detect face using cascade classifier

asked 2015-09-28 02:47:48 -0600

Aj-611 gravatar image

updated 2015-10-01 02:13:42 -0600

My program run perfectly when I convert data from buffer into Mat (program to run video from external camera with frame grabber card). But after I try to develop a program to detect face, it has triggered a breakpoint. My output window shows as follow:

/* HEAP[my.exe]: Invalid address specified to RtlValidateHeap ( 03EC0000, 03F10ED0) // these codes are changing every debug.

This may be due to a corruption of the heap, which indicates a bug in my.exe or any of the DLLs it has loaded.

This may also due to the user pressing F12 while ......

*/ 10/1/15

Since there is no problem with my code, I'd deleted it, to make sure a clean section for this question.

edit retag flag offensive close merge delete

Comments

just a blind guess:

"I convert data from buffer into Mat" - you have to be careful here, the Mat just does a shallow copy of the data pointer, once that goes out of scope (e.g. if you have some kind of callback function), it is dead.

try like this:

   Mat  m1(h,w,type, pointer); // shallow copy only !!
   Mat frame = m1.clone(); // our own copy of the data !
   // ... use frame..
berak gravatar imageberak ( 2015-09-28 02:55:24 -0600 )edit

I did that part, but it does not solve my problem sir.

Aj-611 gravatar imageAj-611 ( 2015-09-28 03:39:45 -0600 )edit

The cause - of a heap corruption in particular - can be extremely hard to find. My suggestion is that you start building a minimum example that crashes and one that does not crash. This doesn't mean the one that doesn't crash doesn't have the error. But at least you have a small piece of code you can debug/inspect and possibly post here.

boaz001 gravatar imageboaz001 ( 2015-09-28 04:44:13 -0600 )edit

please append code to question.

berak gravatar imageberak ( 2015-09-28 05:29:35 -0600 )edit

I had appended the code just now. Hope there is a solution.

Aj-611 gravatar imageAj-611 ( 2015-09-30 23:05:41 -0600 )edit

Nope. That's not me. Oh, but it my first time heard about 'nifty format' or '.nii'.

Aj-611 gravatar imageAj-611 ( 2015-09-30 23:26:06 -0600 )edit

^^ sorry, my bad, i confused nii and ni images, ignore !

berak gravatar imageberak ( 2015-09-30 23:37:56 -0600 )edit

hmm, staring hard at the code, and the {} braces do not match. is this really all of the code ?

(stráy } before the imshow())

berak gravatar imageberak ( 2015-09-30 23:45:03 -0600 )edit

Ugh.. sorry. I'd edited the code. There is no } before imshow().

Aj-611 gravatar imageAj-611 ( 2015-10-01 01:25:27 -0600 )edit

1 answer

Sort by » oldest newest most voted
3

answered 2015-10-01 02:09:18 -0600

Aj-611 gravatar image

Guys, finally. I found the answer!! Here the solution is:

Right click on Project > Properties > Configuration properties > C/C++ > Code Generation > Runtime library = select multi-threaded debug dll(/MDd).

Thanks @berak

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-09-28 02:47:48 -0600

Seen: 538 times

Last updated: Oct 01 '15