how to get a mask of an image so that i can use it in the inpainting function

asked 2018-12-19 11:39:55 -0500

Allaye gravatar image

updated 2018-12-19 11:42:57 -0500

berak gravatar image

i want my mask to be black obviously and the red line which is my region of interest to be white so that i can use it inside the inpainting function...! am having this code but it not working

 cv::inRange(img, cv::Scalar(0, 100, 220), cv::Scalar(10, 255, 255), lower);
    cv::inRange(img, cv::Scalar(0, 10, 100), cv::Scalar(255, 255, 255), upper);
threshold(mask, mask,10,255, CV_THRESH_BINARY); inpaint(img, mask, inpainted,3,CV_INPAINT_TELEA);

can someone help me..

image description)

edit retag flag offensive close merge delete


i edited your post, assuming, it's the same image as in your last question

but in the long run, please spare us duplicates of the same topic, thank you !

berak gravatar imageberak ( 2018-12-19 11:43:31 -0500 )edit

yes pls, this is the input image

Allaye gravatar imageAllaye ( 2018-12-19 11:44:38 -0500 )edit

sorry, but none of the code above makes sense. neither lower or upper are ever used, you probably don't need a threshold on something binary either, and your mask is still empty.

berak gravatar imageberak ( 2018-12-20 03:13:51 -0500 )edit