Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi, I am beginner in OpenCV, so i download it and just for an example copied from the internet Background detection code, and i have only one error

include<opencv2/opencv.hpp>

include<iostream>

include<vector>

int main(int argc, char *argv[])

{

cv::Mat frame;
cv::Mat back;
cv::Mat fore;
cv::VideoCapture cap(0);
cv::BackgroundSubtractorMOG2 bg;
bg.set("nmixtures" , 3);
bg.set("bShadowDetection", false);

std::vector<std::vector<cv::Point> > contours;

cv::namedWindow("Frame");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;
    bg.operator ()(frame, fore);
    bg.getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());
    cv::findContours(fore, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
    cv::drawContours(frame, contours, -1, cv::Scalar(0, 0, 255), 2);
    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    if (cv::waitKey(30) >= 0) break;
}
return 0;

}

error : error C3861: normHamming: identifier not found c:\program files\opencv\build\include\opencv2\features2d\features2d.hpp

click to hide/show revision 2
No.2 Revision

updated 2015-04-14 09:50:18 -0600

berak gravatar image

Hi, I am beginner in OpenCV, so i download it and just for an example copied from the internet Background detection code, and i have only one error

include
<opencv2/opencv.hpp>

include<iostream>

include<vector>

#include <opencv2/opencv.hpp> #include <iostream> #include <vector> int main(int argc, char *argv[])

{

*argv[])

{

    cv::Mat frame;
 cv::Mat back;
 cv::Mat fore;
 cv::VideoCapture cap(0);
 cv::BackgroundSubtractorMOG2 bg;
 bg.set("nmixtures" , 3);
 bg.set("bShadowDetection", false);

 std::vector<std::vector<cv::Point> > contours;

 cv::namedWindow("Frame");
 cv::namedWindow("Background");

 for (;;)
 {
     cap >> frame;
     bg.operator ()(frame, fore);
     bg.getBackgroundImage(back);
     cv::erode(fore, fore, cv::Mat());
     cv::dilate(fore, fore, cv::Mat());
     cv::findContours(fore, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
     cv::drawContours(frame, contours, -1, cv::Scalar(0, 0, 255), 2);
     cv::imshow("Frame", frame);
     cv::imshow("Background", back);
     if (cv::waitKey(30) >= 0) break;
 }
 return 0;

}

} error : error C3861: normHamming: identifier not found c:\program files\opencv\build\include\opencv2\features2d\features2d.hpp

files\opencv\build\include\opencv2\features2d\features2d.hpp

Hi, I am beginner in OpenCV, so i download it and just for an example copied from the internet Background detection code, and i have only one error

#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>


int main(int argc, char *argv[])

{

    cv::Mat frame;
    cv::Mat back;
    cv::Mat fore;
    cv::VideoCapture cap(0);
    cv::BackgroundSubtractorMOG2 bg;
    bg.set("nmixtures" , 3);
    bg.set("bShadowDetection", false);

    std::vector<std::vector<cv::Point> > contours;

    cv::namedWindow("Frame");
    cv::namedWindow("Background");

    for (;;)
    {
        cap >> frame;
        bg.operator ()(frame, fore);
        bg.getBackgroundImage(back);
        cv::erode(fore, fore, cv::Mat());
        cv::dilate(fore, fore, cv::Mat());
        cv::findContours(fore, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
        cv::drawContours(frame, contours, -1, cv::Scalar(0, 0, 255), 2);
        cv::imshow("Frame", frame);
        cv::imshow("Background", back);
        if (cv::waitKey(30) >= 0) break;
    }
    return 0;
}


error : error C3861: normHamming: identifier not found  c:\program files\opencv\build\include\opencv2\features2d\features2d.hpp