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

 

#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/archive/2012/11/25/2787606.html,如需转载请自行联系原作者
上一篇:【OpenCV学习】step的应用


下一篇:学习笔记: CSS3 鼠标悬停动画