Ask Your Question

Revision history [back]

Don't you have a method to retrieve size of the array list in Java? Here is how its done in C++:

    std::vector<cv::Vec4i> hierarchy;
    std::vector<std::vector<cv::Point> > contours;
    cv::Mat frame = something;
    cv::findContours(frame, contoursInt, hierarchyObj, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);

    for (unsigned int n = 0; n < contours.size(); n++)
    {
        int numOfPixels = countoursInt[n].size();
    }

numOfPixels has the number of pixels of each contour. Just do the equivalent in Java.