What is the correct syntax for "mu.get_m00"? [closed]

asked 2018-02-04 06:28:40 -0600

Marko5280 gravatar image

updated 2018-02-04 08:32:10 -0600

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) {}
    }
}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by eshirima
close date 2018-02-05 07:18:42.108541

Comments

mu.m00, mu.m01 ...

if (mu.m00 > 100.0) {}
LBerger gravatar imageLBerger ( 2018-02-04 07:27:50 -0600 )edit

learn to love the docs

berak gravatar imageberak ( 2018-02-04 09:07:02 -0600 )edit