Boring changes - contrib.

pull/1281/head
Roman Donchenko 11 years ago
parent 3bca57ac25
commit 34127ba80f
  1. 24
      modules/contrib/src/detection_based_tracker.cpp
  2. 6
      modules/contrib/src/facerec.cpp
  3. 6
      modules/contrib/src/featuretracker.cpp

@ -128,7 +128,7 @@ cv::DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(Detectio
stateThread(STATE_THREAD_STOPPED),
timeWhenDetectingThreadStartedWork(-1)
{
CV_Assert(!_detector.empty());
CV_Assert(_detector);
cascadeInThread = _detector;
@ -462,11 +462,11 @@ cv::DetectionBasedTracker::DetectionBasedTracker(cv::Ptr<IDetector> mainDetector
cascadeForTracking(trackingDetector)
{
CV_Assert( (params.maxTrackLifetime >= 0)
// && (!mainDetector.empty())
&& (!trackingDetector.empty()) );
// && mainDetector
&& trackingDetector );
if (!mainDetector.empty()) {
separateDetectionWork = new SeparateDetectionWork(*this, mainDetector);
if (mainDetector) {
separateDetectionWork.reset(new SeparateDetectionWork(*this, mainDetector));
}
weightsPositionsSmoothing.push_back(1);
@ -483,7 +483,7 @@ void DetectionBasedTracker::process(const Mat& imageGray)
{
CV_Assert(imageGray.type()==CV_8UC1);
if ( (!separateDetectionWork.empty()) && (!separateDetectionWork->isWorking()) ) {
if ( separateDetectionWork && !separateDetectionWork->isWorking() ) {
separateDetectionWork->run();
}
@ -501,7 +501,7 @@ void DetectionBasedTracker::process(const Mat& imageGray)
std::vector<Rect> rectsWhereRegions;
bool shouldHandleResult=false;
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
shouldHandleResult = separateDetectionWork->communicateWithDetectingThread(imageGray, rectsWhereRegions);
}
@ -589,7 +589,7 @@ void cv::DetectionBasedTracker::getObjects(std::vector<ExtObject>& result) const
bool cv::DetectionBasedTracker::run()
{
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
return separateDetectionWork->run();
}
return false;
@ -597,14 +597,14 @@ bool cv::DetectionBasedTracker::run()
void cv::DetectionBasedTracker::stop()
{
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
separateDetectionWork->stop();
}
}
void cv::DetectionBasedTracker::resetTracking()
{
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
separateDetectionWork->resetTracking();
}
trackedObjects.clear();
@ -876,11 +876,11 @@ bool cv::DetectionBasedTracker::setParameters(const Parameters& params)
return false;
}
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
separateDetectionWork->lock();
}
parameters=params;
if (!separateDetectionWork.empty()) {
if (separateDetectionWork) {
separateDetectionWork->unlock();
}
return true;

@ -851,18 +851,18 @@ int LBPH::predict(InputArray _src) const {
Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_components, double threshold)
{
return new Eigenfaces(num_components, threshold);
return makePtr<Eigenfaces>(num_components, threshold);
}
Ptr<FaceRecognizer> createFisherFaceRecognizer(int num_components, double threshold)
{
return new Fisherfaces(num_components, threshold);
return makePtr<Fisherfaces>(num_components, threshold);
}
Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius, int neighbors,
int grid_x, int grid_y, double threshold)
{
return new LBPH(radius, neighbors, grid_x, grid_y, threshold);
return makePtr<LBPH>(radius, neighbors, grid_x, grid_y, threshold);
}
CV_INIT_ALGORITHM(Eigenfaces, "FaceRecognizer.Eigenfaces",

@ -54,7 +54,7 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
{
case CvFeatureTrackerParams::SIFT:
dd = Algorithm::create<Feature2D>("Feature2D.SIFT");
if( dd.empty() )
if( !dd )
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without SIFT support");
dd->set("nOctaveLayers", 5);
dd->set("contrastThreshold", 0.04);
@ -62,7 +62,7 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
break;
case CvFeatureTrackerParams::SURF:
dd = Algorithm::create<Feature2D>("Feature2D.SURF");
if( dd.empty() )
if( !dd )
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without SURF support");
dd->set("hessianThreshold", 400);
dd->set("nOctaves", 3);
@ -73,7 +73,7 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
break;
}
matcher = new BFMatcher(NORM_L2);
matcher = makePtr<BFMatcher>(int(NORM_L2));
}
CvFeatureTracker::~CvFeatureTracker()

Loading…
Cancel
Save