书上的例子运行不出来,有谁可以解答下阿

#include <cv.h>
#include <highgui.h>
#include <math.h>
#include  <stdio.h>
IplImage *Igray=0, *It = 0, *Iat;
int main( int argc, char** argv )
{
    char*  filename1="C://Program Files (x86)//OpenCV//LearningOpenCV_Code//LearningOpenCV_Code//HandOutdoorSunColor.jpg";
 if(argc != 7){return -1;          }
     //Command line
     double threshold = (double)atof("100");
     int threshold_type = atoi("0") ?
              CV_THRESH_BINARY : CV_THRESH_BINARY_INV;
     int adaptive_method = atoi("0") ?
              CV_ADAPTIVE_THRESH_MEAN_C : CV_ADAPTIVE_THRESH_GAUSSIAN_C;
     int block_size = atoi("100");
     double offset = (double)atof("100");
     //Read in gray image
     if((Igray = cvLoadImage( filename1, CV_LOAD_IMAGE_GRAYSCALE)) == 0){
          return     -1;}
     // Create the grayscale output images
     It = cvCreateImage(cvSize(Igray->width,Igray->height),
                          IPL_DEPTH_8U, 1);
     Iat = cvCreateImage(cvSize(Igray->width,Igray->height),
                          IPL_DEPTH_8U, 1);
     //Threshold
     cvThreshold(Igray,It,threshold,255,threshold_type);
     cvAdaptiveThreshold(Igray, Iat, 255, adaptive_method,
                          threshold_type, block_size, offset);
     //PUT UP 2 WINDOWS
     cvNamedWindow("Raw",1);
     cvNamedWindow("Threshold",1);
     cvNamedWindow("Adaptive Threshold",1);
     //Show the results
     cvShowImage("Raw",Igray);
     cvShowImage("Threshold",It);
     cvShowImage("Adaptive Threshold",Iat);
     cvWaitKey(0);
     //Clean up
     cvReleaseImage(&Igray);
     cvReleaseImage(&It);
     cvReleaseImage(&Iat);
   cvDestroyWindow("Raw");
   cvDestroyWindow("Threshold");
   cvDestroyWindow("Adaptive Threshold");
   return(0);
}

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值