opencv :: morphological operations

 

Morphological operations 
    on operation - Open 
    Closed Operation - Close 
    morphological gradient - Morphological Gradient 
    overcap - top hat 
    black hat - black hat 


on operation - Open 
    expansion after the first etching
    Can remove small objects, the object is assumed that the foreground color, the background is black 

and closing operation - Close 
    after expansion, the first etching (BIN2)
    Small holes can be filled (fill hole), assuming that the object is the foreground color, the background is black 
morphological gradient
- Morphological Gradient expanded minus corrosion
    Also known as basic gradient (Other further comprising - an internal gradient, the gradient directions) 

top cap - top hat 
    overcap is a difference image between the original image and the opening operation 


black hat 
    black hat image is a difference image and the source image and closing operations of

 

int main(int argc, char** argv) {

    Mat src, dst;
    src = imread(STRPAHT2);
    if (!src.data) {
        printf("could not load image...\n");
    }
    
    Mat kernel = getStructuringElement(MORPH_RECT, Size(11, 11), Point(-1, -1));

    //CV_MOP_OPEN / CV_MOP_CLOSE / CV_MOP_GRADIENT / CV_MOP_TOPHAT / CV_MOP_BLACKHAT 形态学操作类型
    morphologyEx(src, dst, CV_MOP_OPEN, kernel);

    char output_title[] = "morphology demo";
    namedWindow(output_title, CV_WINDOW_AUTOSIZE);
    imshow(output_title, dst);

    waitKey(0);
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/osbreak/p/11464644.html