
題目的大概意思就是這樣的白板,尋找上面的各種便簽條。
我找到了橘色的,結果是這樣

代碼是這樣
? ? Mat?src?=?imread("gray-stickers.png");
????Mat?temp;
????vector<Mat>?planes;
????cvtColor(src,src,COLOR_BGR2HSV);
????split(src,planes);
????//open?method
????Mat?element?=?getStructuringElement(MORPH_RECT,cv::Size(33,33));
????cv::morphologyEx(planes[1],temp,MORPH_OPEN,element);
????//threshold
????threshold(temp,temp,100,255,THRESH_OTSU);//yeah!find?the?orange
? ? imwrite("oragne-stickers-result.png",temp);
此外,我認為在白色的板子上面找白色的便簽條真不是個好的想法,不知道你有什么想法?
來自為知筆記(Wiz)