2015-06-14 65 views

回答

3

的想法是使用fillPoly()填充旋轉-矩形內的所有像素/多邊形至0,255否則:

Mat mask = cv::Mat(img.size(), CV_8UC1, Scalar(255));  // suppose img is your image Mat 

vector<vector<Point>> pts = { { pt1, pt2, pt3, pt4 } }; 
fillPoly(mask, pts, Scalar(0));       // <- do it here 
+0

非常感謝! – Apastrix