OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
楼主: zcube

opencv排错总结

  [复制链接]
发表于 2012-11-12 17:13:11 | 显示全部楼层

opencv排错总结

你好,我是一个新手菜鸟。最近在跑代码例子的时候老是遇到这么个问题,求助啊!
1>d:\\opencv\\opencv2.2\\include\\opencv2\\flann\\logger.h(66): warning C4996: \'fopen\': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          d:\\vs2010\\vc\\include\\stdio.h(234) : 参见“fopen”的声明
1>d:\\documents\\visual studio 2010\\projects\\test\\test\\test.cpp(21): error C2146: 语法错误: 缺少“;”(在标识符“filter”的前面)
1>d:\\documents\\visual studio 2010\\projects\\test\\test\\test.cpp(21): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\\documents\\visual studio 2010\\projects\\test\\test\\test.cpp(21): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>

我点击错误,所指的为CvFilter为无法识别的标示符,这究竟是什么错误?
完整代码例子如下:
#include "StdAfx.h"
#include "cv.h"
#include "highgui.h"
#include <math.h>

IplImage*  image[2] = { 0, 0 }, *image0 = 0, *image1 = 0;
CvSize size;

int  w0, h0,i;
int  threshold1, threshold2;
int  l,level = 4;
int sthreshold1, sthreshold2;
int  l_comp;
int block_size = 1000;
float  parameter;
double threshold;
double rezult, min_rezult;
CvFilter filter = CV_GAUSSIAN_5x5;
CvConnectedComp *cur_comp, min_comp;
CvSeq *comp;
CvMemStorage *storage;

CvPoint pt1, pt2;

void ON_SEGMENT(int a)
{   
    cvPyrSegmentation(image0, image1, storage, &comp,
                      level, threshold1+1, threshold2+1);

    /*l_comp = comp->total;

    i = 0;
    min_comp.value = cvScalarAll(0);
    while(i<l_comp)
    {
        cur_comp = (CvConnectedComp*)cvGetSeqElem ( comp, i );
        if(fabs(255- min_comp.value.val[0])>
           fabs(255- cur_comp->value.val[0]) &&
           fabs(min_comp.value.val[1])>
           fabs(cur_comp->value.val[1]) &&
           fabs(min_comp.value.val[2])>
           fabs(cur_comp->value.val[2]) )
           min_comp = *cur_comp;
        i++;
    }*/
    cvShowImage(&quot;Segmentation&quot;, image1);
}

int main( int argc, char** argv )
{
    char* filename = argc == 2 ? argv[1] : (char*)&quot;fruits.jpg&quot;;
        if( (image[0] = cvLoadImage( filename, 1)) == 0 )
        return -1;
    cvNamedWindow(&quot;Source&quot;, 0);
    cvShowImage(&quot;Source&quot;, image[0]);

    cvNamedWindow(&quot;Segmentation&quot;, 0);

    storage = cvCreateMemStorage ( block_size );

    image[0]->width &= -(1<<level);
    image[0]->height &= -(1<<level);

    image0 = cvCloneImage( image[0] );
    image1 = cvCloneImage( image[0] );
    // 对彩色图像进行分割
    l = 1;
    threshold1 =255;
    threshold2 =30;

    ON_SEGMENT(1);

sthreshold1 = cvCreateTrackbar(&quot;Threshold1&quot;, &quot;Segmentation&quot;, &threshold1, 255,
ON_SEGMENT);
sthreshold2 = cvCreateTrackbar(&quot;Threshold2&quot;, &quot;Segmentation&quot;,  &threshold2, 255,
ON_SEGMENT);

    cvShowImage(&quot;Segmentation&quot;, image1);
    cvWaitKey(0);

    cvDestroyWindow(&quot;Segmentation&quot;);
    cvDestroyWindow(&quot;Source&quot;);

    cvReleaseMemStorage(&storage );

    cvReleaseImage(&image[0]);
    cvReleaseImage(&image0);
    cvReleaseImage(&image1);

    return 0;
}
回复 支持 反对

使用道具 举报

发表于 2012-11-13 13:21:02 | 显示全部楼层

opencv排错总结

1>------ 已启动生成: 项目: op, 配置: Debug Win32 ------
1>生成启动时间为 2012/9/9 19:02:01。
1>InitializeBuildStatus:
1>  正在对“Debug\\op.unsuccessfulbuild”执行 Touch 任务。
1>ClCompile:
1>  main.cpp
1>e:\\5100822-1\\11\\op\\op\\main.cpp(1): fatal error C1083: 无法打开包括文件:“stdafx.h”: No such file or directory1>
1>生成失败。
1>
1>已用时间 00:00:00.36
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


刚配置完OpenCV,在VS2010下配置的,然后输入测试程序后显示如上错误提示,问题出在哪里啊?麻烦众位大神帮我看一下
现在的VS一般都需要添加:
#include &quot;stdafx.h&quot;
回复 支持 反对

使用道具 举报

发表于 2013-1-28 16:17:23 | 显示全部楼层

opencv排错总结

标记一下备用,总结的很好
回复 支持 反对

使用道具 举报

发表于 2013-3-18 15:44:01 | 显示全部楼层

opencv排错总结

1>------ 已启动生成: 项目: hello, 配置: Debug Win32 ------
1>正在编译资源清单...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>fatal error RC1109: error creating .\\Debug\\hello.exe.embed.manifest.res
1>项目 : error PRJ0002 : 错误的结果 1 (从“C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\bin\\rc.exe”返回)。
1>生成日志保存在“file://e:\\C++\\hello\\hello\\Debug\\BuildLog.htm”
1>hello - 1 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


我是初学者,想请问下这个是怎么回事?
回复 支持 反对

使用道具 举报

发表于 2013-5-22 10:09:48 | 显示全部楼层

opencv排错总结

写的很好!赞~~~
见识了  学习了!!!
回复 支持 反对

使用道具 举报

发表于 2013-6-7 14:20:21 | 显示全部楼层

opencv排错总结

彗星影院 乐享高清  [url:3jr2h3bu]http://www.hxfed.com[/url:3jr2h3bu]
回复 支持 反对

使用道具 举报

发表于 2013-9-12 00:36:43 | 显示全部楼层
学习了
回复 支持 反对

使用道具 举报

发表于 2013-9-27 21:17:42 | 显示全部楼层
很有用  多谢了
回复 支持 反对

使用道具 举报

发表于 2013-9-28 19:51:48 | 显示全部楼层
请问我的opencv能生成exe文件但不能执行是怎么回事
回复 支持 反对

使用道具 举报

发表于 2013-10-10 09:16:20 | 显示全部楼层
本人刚用openCV+vs2010,试用了一个USB摄像头视频采集程序,可是报“cvcam.h”不存在。我也知道不存在,于是下了一个“ccvcam。h”也在链接上加上了lib,可是最后还是没有用。求各位大神帮忙分析下。具体该怎么解决?百度上都没有确切答案!!谢谢!!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-4-29 05:44 , Processed in 0.009892 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表