Problem running main components

Asked

Viewed 16 times

1

Hello, I’m running an algorithm for sorting objects in an image. At the present moment I need to determine the coordinates of the center of the obejto to calculate the diameter and apply compactness.

The part of the code that does that is:

cv::Point encontraCentros(const vector<Point> contornos, const vector<Point> &centros)
{

    //Faz um buffer usado pela PCA
    int tam = static_cast<int>(contornos.size());
    Mat dados_contornos = Mat(tam, 2, CV_64FC1);

    for (int i = 0; i < dados_contornos.rows; ++i)
    {
        dados_contornos.at<double>(i, 0) = contornos[i].x;
        dados_contornos.at<double>(i, 1) = contornos[i].y;
    }

    //Executa PCA
    PCA pca_analysis(dados_contornos, Mat(), PCA::DATA_AS_ROW);

    //Armazena o centro do objeto
    Point centros = Point(static_cast<int>(pca_analysis.mean.at<double>(0, 0)),
                          static_cast<int>(pca_analysis.mean.at<double>(0, 1)));

    return centros;
}

However codeBlocks gives the following error:

declaration of 'cv::Point centers' Hadows a Parameter

Does anyone have any idea what that might be?

  • There is already a parameter called centros within the function, and you are declaring a new variable with the same name.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.