Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the correct syntax for "mu.get_00"?

This program hits an error at the line ...

if (mu.get_m00() > 100.0) {}

So, What is the correct syntax?

// ConsoleApplication 1-25-2018.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


/**
* file Smoothing.cpp
* brief Sample code for simple filters
* author OpenCV team
*/

#include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"

using namespace std;
using namespace cv;
Mat frame;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
vector<Point>  cont;

/**
* function main
*/
int main(int argc, char ** argv)
{
    Mat frame;
    frame = imread("lena.jpg");
    imshow("Lena.jpg", frame);
    waitKey();
    dilate(frame, frame, 1);
    imshow("dilate", frame);
    waitKey();
    findContours(frame, contours, hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);

    //for (MatOfPoint cont : contours)
    for (vector<Point>cont : contours);
    {
        Moments mu = moments(cont, false);
        if (mu.get_m00() > 100.0) {}
    }
}

What is the correct syntax for "mu.get_00"?

This program hits an error at the line ...

if (mu.get_m00() > 100.0) {}

So, What is the correct syntax?

// ConsoleApplication 1-25-2018.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


/**
* file Smoothing.cpp
* brief Sample code for simple filters
* author OpenCV team
*/

#include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"

using namespace std;
using namespace cv;
Mat frame;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
vector<Point>  cont;

/**
* function main
*/
int main(int argc, char ** argv)
{
    Mat frame;
    frame = imread("lena.jpg");
    imshow("Lena.jpg", frame);
    waitKey();
    dilate(frame, frame, 1);
    imshow("dilate", frame);
    waitKey();
    findContours(frame, contours, hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);

    //for (MatOfPoint cont : contours)
    for (vector<Point>cont : contours);
    {
        Moments mu = moments(cont, false);
        if (mu.get_m00() > 100.0) {}
    }
}

What is the correct syntax for "mu.get_00"?"mu.get_00"??

This program hits an error at the line ...

if (mu.get_m00() > 100.0) {}

So, What is the correct syntax?

// ConsoleApplication 1-25-2018.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


/**
* file Smoothing.cpp
* brief Sample code for simple filters
* author OpenCV team
*/

#include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"

using namespace std;
using namespace cv;
Mat frame;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
vector<Point>  cont;

/**
* function main
*/
int main(int argc, char ** argv)
{
    Mat frame;
    frame = imread("lena.jpg");
    imshow("Lena.jpg", frame);
    waitKey();
    dilate(frame, frame, 1);
    imshow("dilate", frame);
    waitKey();
    findContours(frame, contours, hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);

    //for (MatOfPoint cont : contours)
    for (vector<Point>cont : contours);
    {
        Moments mu = moments(cont, false);
        if (mu.get_m00() > 100.0) {}
    }
}