Ask Your Question

opencv_createsamples.exe entry point problem with XP

asked 2013-01-16 11:14:52 -0600

Jean-François Côté gravatar image

updated 2013-01-17 07:37:27 -0600

Hello everyone,

I'm currently on a project about pattern detection in video so we are curently using traincascade to get a Cascade classifier XML file. The project started on my computer (Windows 7 64 bits) so I compiled openCV using CMake with the WITH_TBB option set to true. I compiled everything in 32 bits (x86)

Works very well and used the apps very often with a lot of configuration without problem.

Then, another collegue gets into the project so I copied my whole directory of work with already compiled stuff(.exe of the opencv apps, dll, positive samples, etc) on his computer which is Windows XP 32 bits.

opencv_Traincascade.exe works very well on his computer but everytime he start opencv_createsmaples.exe with any parameters, he get this message:

The procedure entry point InitializeCriticalSectionEx could not be located in the dynamic link library KERNEL32.dll.

Does anyone has any idea what is causing that? Is there a configuration when I compile in Visual Studio 2010 that could fix this problem in XP? Or in the CMake? Do I need to recompile the .exe on each different machine that use it? (that would be insane!).


I just compile OpenCV (2.4.3) on the Windows XP machine with TBB using Visual Studio 2010. Everything compile perfectly except that when we run the opencv_createsamples.exe, the same error occurs (see above). It only happens in Release mode, if we compile in debug, it works! So I'm starting to think that maybe it's a bug in the latest release. Is there some developer over here that can check this out? Since the error is only happening in debug, I can't debug the code to see where it fail and I don't know the code enough to know where critical section are use. Also, like I said before, the opencv_traincascade.exe is working perfectly. Any idea?


After compiling without TBB and discovering that everything is working, we decided to validate if the problem is the TBB.dll itself or the usage of TBB by OpenCV. We just checked TBB.dll and TBB_debug.dll with "Dependancy Walker" and they are ok on their own (nothing in red, no call to InitializeCriticalSectionEx.dll). Seems the problem is the use of TBB by OpenCV. Here is the image of the "Dependency Walker" on the opencv_createsamplesd.exe (debug) and the opencv_createsample.exe (release) when compiled WITH_TBB in CMake. Hope it helps!

In debug, everything is ok Depends in debug

In release, problem! Depends in release


edit retag flag offensive close merge delete


Please see the attached picture. Any windows XP user that could try to see if they got the same thing?

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-21 07:29:47 -0600 )edit

4 answers

Sort by » oldest newest most voted

answered 2013-03-07 14:33:28 -0600

arkeon gravatar image

Hello I had the same problem and found that InitializeCriticalSectionEx is used only in last versions of TBB.

Here my solutions : 1 - use a previous version of TBB 2 - replace all InitializeCriticalSectionEx by InitializeCriticalSection and remove the 2 last functions parameter in the TBB sources, then compile TBB and OpenCV, this should be ok.

edit flag offensive delete link more


You are right. I have found this while working with EmguCV developper. Since it's shipped with TBB, it will need to create a separate setup for windows XP support with TBB 4.0 instead of TBB 4.1

Jean-François Côté gravatar imageJean-François Côté ( 2013-03-28 08:49:15 -0600 )edit

answered 2013-01-16 22:28:03 -0600

OpenCV does not use this function directly. It looks like a part of TBB or some other external library. Are you sure, that you use right TBB libraries on Windows XP?

edit flag offensive delete link more



We just try compiling without TBB and the problem dissapear. I will try with another version of TBB and come back to update my question. We checked with "Dependency Walker" and found that only in release, opencv_feature2D243.dll who use TBB.dll also needs kernel32.dll with the InitializeCriticalSectionEx. In debug, everything is ok... So I don't know if the problem come from a bad call to TBB in OpenCV or an bug in TBB itself...

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-17 07:23:40 -0600 )edit

answered 2013-01-16 13:01:00 -0600

InitializeCriticalSectionEx function is supported since Windows Vista. There is no this function in Windows XP. You need to recompile your application on Windows XP or set target Windows version in project settings, if the option is available.

edit flag offensive delete link more


I'm curently trying to compile everything on the windows XP machine. After that, if the apps works on both machine I will be happy :)

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-16 13:17:43 -0600 )edit

I just compile everything on the Windows XP machine. Everything compiled great but there is the same problem, they show the exact same message so I'm starting to think it may be a bug in OpenCV

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-16 13:53:16 -0600 )edit

answered 2013-02-15 08:25:41 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

I am testing opencv in multiple systems. I'm finishing the tests on windows XP. The opencv failed using "CascadeClassifier.Load". What can cause this problem in this system?

edit flag offensive delete link more

Question Tools


Asked: 2013-01-16 11:14:52 -0600

Seen: 3,147 times

Last updated: Mar 07 '13