【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/

posted @ 2012-11-25 15:25  gnuhpc  阅读(2949)  评论(0编辑  收藏  举报