Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Have a careful look at the documentation. The data type of the minIdx and maxIdx has to be a Point when using a Mat input. Therefore, your code will work if modified as follows:

void main(void)
{
    cv::Mat array1D = cv::Mat(1, 800, CV_32FC1, cv::Scalar(0));
    double minVal;
    double maxVal;
    Point minIdx;
    Point maxIdx;
    // ....
    // putting an image projection to array1D and I can draw and view it's histogram
    // ....
    cv::minMaxLoc(array1D, &minVal, &maxVal, &minIdx, &maxIdx);
}

As you're using a "one-dimensional" matrix, just discard the returned y-coordinates of the Points and use the x-coordinates

Have a careful look at the documentation. The data type of the minIdx and maxIdx has to be a Point when using a Mat input. Therefore, your code will work if modified as follows:

void main(void)
{
    cv::Mat array1D = cv::Mat(1, 800, CV_32FC1, cv::Scalar(0));
    double minVal;
    double maxVal;
    Point minIdx;
    Point maxIdx;
    // ....
    // putting an image projection to array1D and I can draw and view it's histogram
    // ....
    cv::minMaxLoc(array1D, &minVal, &maxVal, &minIdx, &maxIdx);
}

As you're using a "one-dimensional" one-row matrix, just discard the returned y-coordinates of the Points and use the x-coordinates