diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 2d2d53e..ac99081 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -1178,7 +1178,7 @@ public: virtual ~Transform() {} static Transform *make(QString str, QObject *parent); /*!< \brief Make a transform from a string. */ - static QSharedPointer fromAlgorithm(const QString &algorithm, bool preprocess=true); /*!< \brief Retrieve an algorithm's transform. If preprocess is true, attaches a stream transform as the root of the algorithm*/ + static QSharedPointer fromAlgorithm(const QString &algorithm, bool preprocess=false); /*!< \brief Retrieve an algorithm's transform. If preprocess is true, attaches a stream transform as the root of the algorithm*/ static QSharedPointer fromComparison(const QString &algorithm); virtual Transform *clone() const; /*!< \brief Copy the transform. */ diff --git a/openbr/plugins/cvt.cpp b/openbr/plugins/cvt.cpp index 362ca0c..e247ab7 100644 --- a/openbr/plugins/cvt.cpp +++ b/openbr/plugins/cvt.cpp @@ -115,7 +115,18 @@ class ScaleTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { - resize(src, dst, Size(src.m().cols*scaleFactor,src.m().rows*scaleFactor)); + resize(src, dst, Size(src.m().cols*scaleFactor,src.m().rows*scaleFactor)); + + QList rects = src.file.rects(); + for (int i=0; i points = src.file.points(); + for (int i=0; i #include + #include "openbr_internal.h" #include "openbr/core/common.h" @@ -164,7 +165,7 @@ class RndSampleTransform : public UntrainableMetaTransform void project(const TemplateList &src, TemplateList &dst) const { foreach(const Template &t, src) { - QPointF point = t.file.points()[0]; + QPointF point = t.file.points()[pointIndex]; QRectF region(point.x()-sampleRadius, point.y()-sampleRadius, sampleRadius*2, sampleRadius*2); if (region.x() < 0 || @@ -184,6 +185,7 @@ class RndSampleTransform : public UntrainableMetaTransform labelCount << 0; while (std::accumulate(labelCount.begin(),labelCount.end(),0.0) < (sampleOverlapBands.size()-1)*samplesPerOverlapBand) { + float x = rand() % (sampleFactor*sampleRadius) + region.x() - sampleFactor/2*sampleRadius; float y = rand() % (sampleFactor*sampleRadius) + region.y() - sampleFactor/2*sampleRadius; @@ -192,13 +194,13 @@ class RndSampleTransform : public UntrainableMetaTransform QRectF negativeLocation = QRectF(x, y, sampleRadius*2, sampleRadius*2); - float overlap = QtUtils::overlap(region, negativeLocation); + float overlap = pow(QtUtils::overlap(region, negativeLocation),overlapPower); for (int k = 0; k= sampleOverlapBands.at(k) && overlap < sampleOverlapBands.at(k+1) && labelCount[k] < samplesPerOverlapBand) { Mat m(t.m(),OpenCVUtils::toRect(negativeLocation)); dst.append(Template(t.file, m)); - float label = classification ? 0 : pow(overlap,overlapPower); + float label = classification ? 0 : overlap; dst.last().file.set(inputVariable, label); labelCount[k]++; } diff --git a/share/openbr/cmake/FindLibLinear.cmake b/share/openbr/cmake/FindLibLinear.cmake index 795f4dc..d3ff954 100644 --- a/share/openbr/cmake/FindLibLinear.cmake +++ b/share/openbr/cmake/FindLibLinear.cmake @@ -1,6 +1,5 @@ find_path(LibLinear_DIR linear.h ${CMAKE_SOURCE_DIR}/3rdparty/*) -message(${LibLinear_DIR}) mark_as_advanced(LibLinear_DIR) include_directories(${LibLinear_DIR}) include_directories(${LibLinear_DIR}/blas)