Being able to use multiple-cores or threads is dependent on the process. This is not AppNap or OS X causing the change.
opencv_traincascade, may be resource constrained after a few moments and thus reduced to queuing up tasks as it waits for disk access or another limited resource.
In this case you may need to switch to a different build of OpenCV:
Note that opencv_traincascade application can use TBB for multi-threading. To use it in multicore mode OpenCV must be built with TBB.
Installing OpenCV with TBB via
brew install opencv --with-tbb