kylemcdonald / ofxCv

Alternative approach to interfacing with OpenCv from openFrameworks.
Other
658 stars 276 forks source link

Helpers.h fails to build without std:: namespace #233

Closed chuckleplant closed 6 years ago

chuckleplant commented 7 years ago

https://github.com/kylemcdonald/ofxCv/blob/b316c6314ba5b7dc29b5c0e1718124362e9fb024/libs/ofxCv/include/ofxCv/Helpers.h#L139

I'm on windows, visual studio 2015. This line may be missing std::vector?

chuckleplant commented 7 years ago

I'm not tracking this repo just using source, hope this helps if it's an actual issue. These are the changes I had to make to fix my build:

--------------- addons/ofxCv/libs/ofxCv/include/ofxCv/Helpers.h ---------------
index 53e6355..a1d837d 100644
@@ -134,11 +134,11 @@ namespace ofxCv {
        box.x = findFirst(colMat, 255);
        box.width = findLast(colMat, 255);
        box.width -= box.x;
    }

-   float weightedAverageAngle(const vector<cv::Vec4i>& lines);
+   float weightedAverageAngle(const std::vector<cv::Vec4i>& lines);

    // (nearest point) to the two given lines
    template <class T>
    cv::Point3_<T> intersectLineLine(cv::Point3_<T> lineStart1, cv::Point3_<T> lineEnd1, cv::Point3_<T> lineStart2, cv::Point3_<T> lineEnd2) {
        cv::Point3_<T> v1(lineEnd1 - lineStart1), v2(lineEnd2 - lineStart2);
@@ -190,11 +190,11 @@ namespace ofxCv {
        for(int i=0;i<n;i++){int j=q[i];if(!p[j+ic2]&&!p[j+ic1]&&!p[j+ib1]&&p[j+ia2]&&p[j+ib3]){p[j]=0;}}
        for(int i=0;i<n;i++){int j=q[i];if(!p[j+ib1]&&!p[j+ia1]&&!p[j+ia2]&&p[j+ic2]&&p[j+ib3]){p[j]=0;}}
    }

    // given a vector of lines, this function will find the average angle
-   float weightedAverageAngle(const vector<cv::Vec4i>& lines);
+   float weightedAverageAngle(const std::vector<cv::Vec4i>& lines);

    // finds the average angle of hough lines, unrotates by that amount and
    // returns the average rotation. you can supply your own thresholded image
    // for hough lines, or let it run canny detection for you.
    template <class S, class T, class D>

------------- addons/ofxCv/libs/ofxCv/include/ofxCv/ObjectFinder.h -------------
index db2733b..1c43701 100644
@@ -27,11 +27,11 @@
 namespace ofxCv {
    class ObjectFinder {
    public:

        ObjectFinder();
-       void setup(string cascadeFilename);
+       void setup(std::string cascadeFilename);
        template <class T> 
        void update(T& img) {
            update(toCv(img));
        }
        void update(cv::Mat img);

--------------- addons/ofxCv/libs/ofxCv/include/ofxCv/Tracker.h ---------------
index b1ce13b..ca293ff 100644
@@ -110,12 +110,12 @@ namespace ofxCv {
    };

    template <class T>
    class Tracker {
    protected:      
-       vector<TrackedObject<T> > previous, current;
-       vector<unsigned int> currentLabels, previousLabels, newLabels, deadLabels;
+       std::vector<TrackedObject<T> > previous, current;
+       std::vector<unsigned int> currentLabels, previousLabels, newLabels, deadLabels;
        std::map<unsigned int, TrackedObject<T>*> previousLabelMap, currentLabelMap;

        unsigned int persistence, curLabel;
        float maximumDistance;
        unsigned int getNewLabel() {
@@ -258,11 +258,11 @@ namespace ofxCv {
    const std::vector<unsigned int>& Tracker<T>::getNewLabels() const {
        return newLabels;
    }

    template <class T>
-   const vector<unsigned int>& Tracker<T>::getDeadLabels() const {
+   const std::vector<unsigned int>& Tracker<T>::getDeadLabels() const {
        return deadLabels;
    }

    template <class T>
    unsigned int Tracker<T>::getLabelFromIndex(unsigned int i) const {
kylemcdonald commented 6 years ago

i think this should be fixed now.