Skip to content

Instantly share code, notes, and snippets.

@hkhojasteh
Created January 30, 2019 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkhojasteh/dbd36d5f806dbd7c31626c1718dff2f5 to your computer and use it in GitHub Desktop.
Save hkhojasteh/dbd36d5f806dbd7c31626c1718dff2f5 to your computer and use it in GitHub Desktop.
Mat mask_hsv_yellow, mask_white, img_mask;
//Make target image by apply yellow and white mask
Scalar m = mean(img_gray);
cvtColor(img, mask_hsv_yellow, CV_BGR2HSV);
inRange(img_crop, Scalar(20, 85, 85), Scalar(30, 255, 255), mask_hsv_yellow);
inRange(img_gray, Scalar(m[0] + (255 - m[0]) / 3.5), Scalar(255), mask_white);
bitwise_or(mask_white, mask_hsv_yellow, img_mask);
GaussianBlur(img_mask, img_mask, cv::Size(5, 5), 0);
imshow("Mask", img_mask);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment