Arvind Seth
Arvind Seth

Reputation: 62

How to use flood fill for coloring a wall on Video Camera using OpenCV?

I need to fill wall paint with real time video camera using flood fill, the below code results in a white layer on the image:

(void) processImage:(cv::Mat&)image
{ 
    cv::Mat mask;
    cv::Point seed(100,200);  
    cvtColor(image, image, cv::COLOR_RGBA2RGB);

    cv::floodFill(image, mask, seed, cv::Scalar(255, 10, 20) ,0, cv::Scalar(2,2, 2), cv::Scalar(2,2, 2), 4 );
    cvtColor(image, image, cv::COLOR_RGB2RGBA);
}

Can anyone help me out?

Upvotes: 0

Views: 983

Answers (2)

Vishal Patel
Vishal Patel

Reputation: 507

You got converted image from mask

Try this

-(void) processImage:(cv::Mat&)image
{ 
    cv::Mat mask;
    cv::Point seed(100,200);  
    cvtColor(image, image, cv::COLOR_RGBA2RGB);

    cv::floodFill(image, mask, seed, cv::Scalar(255, 10, 20) ,0, cv::Scalar(2,2, 2), cv::Scalar(2,2, 2), 4 );
    // Now you will get converted image from 'mask'
}

Upvotes: 0

Arvind Seth
Arvind Seth

Reputation: 62

Solved!!.... Remove this conversion......

cvtColor(image, image, cv::COLOR_RGB2RGBA);

Upvotes: 1

Related Questions