【OpenCV学习】金字塔图像分割

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
void f( IplImage* src, IplImage* dst )
{
    CvMemStorage* storage = cvCreateMemStorage(0);
    CvSeq* comp = NULL;
    cvPyrSegmentation( src, dst, storage, &comp, 4, 200, 50 );
    cvReleaseMemStorage( &storage );
}
int main(int argc, char** argv)
{
    // Load the image from the given file name.
    char *filename="lena.jpg";
    IplImage *dst,*src = /blog.armyourlife.info/cvLoadImage(filename,1);
    if(!src)
    {
        printf("Couldn't seem to Open %s, sorry/n",filename);
        return -1;
    }
   
    dst = cvCreateImage( cvGetSize(src), src->depth, src->nChannels);
    f( src, dst);
    // Create a named window with a the name of the file.
    cvNamedWindow( filename, 1 );
    // Show the image in the named window
    cvShowImage( filename, dst );
    // Press any key to exit.
    cvWaitKey(0);
    // Clean up and don’t be piggies
    cvDestroyWindow( filename );
    cvReleaseImage( &src );
    cvReleaseImage( &dst );
    return 0;
}

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/


               作者:gnuhpc
               出处:http://www.cnblogs.com/gnuhpc/
               除非另有声明,本网站采用知识共享“署名 2.5 中国大陆”许可协议授权。


分享到:

原文地址:https://www.cnblogs.com/gnuhpc/p/2787606.html