Ask Your Question

Revision history [back]

You are screwing around with OpenCV smartpointers and explicitly defined pointers. This is where it goes wrong. Let OpenCV handle the memory management and change the code to

#include <opencv2 opencv.hpp="">

using namespace cv;

int main(int argc, char *argv[])
{
    int size = 512;
    cv::vector<Point> x;
    Mat m(1, size, CV_8U, Scalar(128));
    findNonZero(m, x);
}

You are screwing around with OpenCV smartpointers and explicitly defined pointers. This is where it goes wrong. Let OpenCV handle the memory management and change the code to

#include <opencv2 opencv.hpp="">

#include <opencv2/opencv.hpp>

using namespace cv;

int main(int argc, char *argv[])
{
    int size = 512;
    cv::vector<Point> x;
    Mat m(1, size, CV_8U, Scalar(128));
    findNonZero(m, x);
}

You are screwing around with OpenCV smartpointers and explicitly defined pointers. This is where it goes wrong. Let OpenCV handle the memory management and change the code to

#include <opencv2/opencv.hpp>

using namespace cv;
using namespace std;

int main(int argc, char *argv[])
{
    int size = 512;
    cv::vector<Point> vector<Point> x;
    Mat m(1, size, CV_8U, Scalar(128));
    findNonZero(m, x);
}