Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I COMPLETELY agree. Especially as the function doesn't even expose the mapping from the indexes it generates to the pixel coordinates in the source image. The function as it is right now, it's useful for little more than just computing a voronoi (where you don't really care about who was the seed as much as that to identify its watershed).

And now it's 2014 and the opencv website is still down... lol

Anyhow, this will invert your mapping if cannot edit the source

std::vector<cv::Vec2i> label_to_index;
label_to_index.push_back(-1);
    for (int row = 0; row < background.rows; ++row)
        for (int col = 0; col < background.cols; ++col)
            if(background.at<uchar>(row,col)==0)
                label_to_index.push_back(cv::Vec2i(row,col));