Return to Snippet

Revision: 31677
at September 10, 2010 13:39 by browny


Initial Code
void showMaskPart(const IplImage* src, const IplImage* mask, IplImage* result)
{
    /* src is the source image which you want to mask
     * mask is a single channel binary image as a mask
     * result is the image with the same size, depth, channel with src
     */

    cvZero(result);
    
    CvSize sz = cvSize(src->width, src->height);	
    IplImage* refImg = cvCreateImage(sz, src->depth, src->nChannels);
    cvZero(refImg);

    cvOr(src, refImg, result, mask);

    cvReleaseImage(&refImg);
	
}

Initial URL


Initial Description
利用一張影像當做遮罩,只顯示來源影像的一部分!

Initial Title
[OpenCV] Use a image to mask another image

Initial Tags


Initial Language
C++