Skip to content

always loop question #6

@zisuina

Description

@zisuina

in texture.cpp a function named: Mat segmentTexture() has a loop question:
do
{
seedPoint.x=rng.uniform(0, texture.cols);
seedPoint.y=rng.uniform(0, texture.rows);
seed=texture.at(seedPoint.y, seedPoint.x);
}
while(mark.at(seedPoint.y, seedPoint.x) !=0 );
if this region are all 0, it will not end. So could add a conditon:

    int cout_num = 0;
    do
    {
        seedPoint.x=rng.uniform(0, texture.cols);
        seedPoint.y=rng.uniform(0, texture.rows);
        seed=texture.at<Vec4b>(seedPoint.y, seedPoint.x);
        cout_num++;

    }
    while(mark.at<uchar>(seedPoint.y, seedPoint.x) !=0 && cout_num <= 50);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions