• Open Source Computer Vision Library

Talk:首页

Wikipedia,自由的百科全书

请教高手,如何去除不需要的白色区域,下面是代码,希望有高手可以帮我写出代码,非常感谢! 我使用的是opencv1.0和VS2008

  1. include "cv.h"
  2. include "highgui.h"

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

   IplImage* pImg; 
   
   if( argc == 1 && (pImg = cvLoadImage( "135.jpg", 0 )));
    IplImage* dst = cvCreateImage( cvGetSize(pImg), pImg->depth,1);
    cvSmooth(pImg,dst,CV_GAUSSIAN,3,3);
    
    IplImage* dstt = cvCreateImage( cvGetSize(dst), dst->depth,1);
    cvThreshold(dst,dstt,145,255,CV_THRESH_BINARY);
 cvSaveImage( "135-gray-smooth-T145.jpg", dstt);
   {
       cvNamedWindow( "Image", 1 );
       cvShowImage( "Image",dstt);
            cvWaitKey(0); 

       cvDestroyWindow( "Image" );
       cvReleaseImage( &dstt); 
       return 0;
   }

   return -1;

}

Views
Personal tools