寻找白板上的便签条

问题来源:http://answers.opencv.org/question/162480/contour-detection-for-gray-stickers-on-white-background/
题目的大概意思就是这样的白板,寻找上面的各种便签条。
我找到了橘色的,结果是这样

代码是这样
    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);

此外,我认为在白色的板子上面找白色的便签条真不是个好的想法,不知道你有什么想法?




原文地址:https://www.cnblogs.com/jsxyhelu/p/7090077.html