书上的例子运行不出来,有谁可以解答下阿
2011-05-14 22:46
513 查看
#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);
}
#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);
}
相关文章推荐
- Mule ESB 学习笔记(11)Web Service Proxy(这里是一个可以正常运行的例子)
- amq入门之运行书上例子
- 线程安全不安全的辅助理解,可以拿这个例子自己去运行看看
- 为什么myeclipse自带的tomcat可以运行 而重新安装的tomcat不能,运行出来显示404错误, not available
- 使用AndroidStudio直接运行无法启动,但是 Gradle Build 出来的安装包可以使用
- snmp++中的snmpGet例子,在ipv4下运行可以,ipv6下出错
- eclipse export出来的jar包不能正常工作 ,调试模式下可以正常运行
- QPropertyAnimation动画 可以运行的例子
- 可以运行的 JNDI 例子
- Netty笔记一(可以运行看到结果的简单例子)
- 今天我在IIS里发布网站,遇到了4个问题,将其解答发出来,顺便可以作为发布网站的一般检查步骤
- 简单的java扫雷程序,已运行成功。自己想出来的,有个问题很困惑有望高手能解答。
- 深入浅出cassandra 2 第一个可以运行的例子
- Netty笔记一(可以运行看到结果的简单例子)
- 用VS创建一个win32窗口,编译运行都可以,但那个窗口没有显示出来(孙鑫老师第一课问题)
- 小问题可能存在大问题,希望大神帮忙解答。Spark本地运行模式中单线程与多线程问题之setMaster("local")可以运行,但是设置成setMaster("local[3]")或setMaste
- 可以运行的Oracle Advanced Queue的例子
- 在学习jms,还没搞出来一个可以运行的东东,mark
- storm、jstorm调研系列 (三)-----jstorm 代码例子和解读(自己写的代码,可以运行)
- datanode 出来了,master:18088也可以啦 但是pi 运行不出来