求助C++高手解决问题

dongfangying2008 2009-05-22 09:44:02
#include "sift_includes.h"
#include "octavePyramid.cpp"
#include "gaussianWindow.cpp"
#include "orienter.cpp"
#include "edgeResponseFilter.cpp"
#include "localizer.cpp"
#include "visualizer.cpp"
#include "matcher.cpp"
#include "matchvisualizer.cpp"
#include "pcasift.cpp"
#include <time.h>
#include "octave.cpp"
#include "cv_type_converter.c"
int main(void)
{


// load image from disk
IplImage *left = cvLoadImage("5R.jpg", -1);
IplImage *right = cvLoadImage("5F.jpg", -1);


// convert image to normalized, floating point matrix
*****错误CvMat *left32 = cvCreateMat(left->height, left->width, CV_32FC1);
CvMat *right32 = cvCreateMat(right->height, right->width, CV_32FC1);
ipl8uc1_to_cv32fc1(left, left32);
ipl8uc1_to_cv32fc1(right, right32);
normalize32(left32);
normalize32(right32);


// create octave pyramid
printf("Creating pyramid...\t"); fflush(0);
octavePyramid *pyrleft = new octavePyramid(left32);
octavePyramid *pyrright = new octavePyramid(right32);
printf("done\n");


// localize points
printf("Localize points...\t"); fflush(0);
localizer *local = new localizer();
local->localize(pyrleft);
local->localize(pyrright);
printf("done\n");


// perform edge-response filtering on octave pyramid
printf("Edge-response filter...\t"); fflush(0);
edgeResponseFilter *edgefilter = new edgeResponseFilter();
edgefilter->filter(pyrright);
edgefilter->filter(pyrleft);
printf("done\n");


// assign orientation to interest points
printf("Assign orientation...\t"); fflush(0);
orienter *orient = new orienter();
orient->assign(pyrright);
orient->assign(pyrleft);
printf("done\n");


// create PCA-SIFT descriptors by feature extraction
printf("Creating PCA-SIFT descriptors...\t"); fflush(0);
pcasift *descript = new pcasift();
descript->createDescriptors(pyrleft);
descript->createDescriptors(pyrright);
printf("done\n");


// match
printf("Matching points...\t"); fflush(0);
matcher *match = new matcher(pyrleft, pyrright);
printf("done\n");


// visualize matches
matchvisualizer *mvis = new matchvisualizer(match, left, right, 1, MVIS_HORIZONTAL);
mvis->writeToDisk("match.png");
mvis->show("test");



return 0;
}
以上是程序代码,编译连接均通过,但运行出错误,unhandled exception in *.exe:0XC0000005 :Access violation 经调试错误指标停在*****错误处,劳请高手解决!
...全文
293 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongfangying2008 2009-05-24
  • 打赏
  • 举报
回复
大家辛苦了!问题解决了!多谢高手们的帮助!
yangkunhenry 2009-05-24
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 hikaliv 的回复:]
IplImage *left = cvLoadImage("5R.jpg", -1);
IplImage *right = cvLoadImage("5F.jpg", -1);

出了错,那么这两个函数应该返回为NULL,就是你调出来的那个0X00000000,也就是说,LOADIMAGE失败了。

失败的可能性,是图片的路径错误,或者其余参数错,或者函数自身出了问题(这个就得你自己来处理了)。

CvMat *right32 = cvCreateMat(right->height, right->width, CV_32FC1);

这个可能返回了一个空间的指…
[/Quote]
应该就是IplImage *left = cvLoadImage("5R.jpg", -1);
IplImage *right = cvLoadImage("5F.jpg", -1);
这个两个函数返回值的问题
光宇广贞 2009-05-24
  • 打赏
  • 举报
回复
IplImage *left = cvLoadImage("5R.jpg", -1);
IplImage *right = cvLoadImage("5F.jpg", -1);

出了错,那么这两个函数应该返回为NULL,就是你调出来的那个0X00000000,也就是说,LOADIMAGE失败了。

失败的可能性,是图片的路径错误,或者其余参数错,或者函数自身出了问题(这个就得你自己来处理了)。

CvMat *right32 = cvCreateMat(right->height, right->width, CV_32FC1);

这个可能返回了一个空间的指针,但是该指针所指空间未初始化,所以是0XCCCCCCCCC的内容,同理,这个是函数CVCREATEMAT的问题,这个,还是得你自己去处理。
goodname 2009-05-24
  • 打赏
  • 举报
回复
也可能是你的图片路径不合适
goodname 2009-05-24
  • 打赏
  • 举报
回复
cvLoadImage("5R.jpg", -1);

给出这个函数的原型来看看



你这个函数没有返回有效的指针
dongfangying2008 2009-05-24
  • 打赏
  • 举报
回复
调试left值为0x00000000,left32值为0xcccccccc,right值为0x00000000
dongfangying2008 2009-05-24
  • 打赏
  • 举报
回复
高手,具体怎么改啊?谢谢!
光宇广贞 2009-05-22
  • 打赏
  • 举报
回复
内存入侵……

把变量当成指针用了……
chenzhp 2009-05-22
  • 打赏
  • 举报
回复
指针是否为空?
cyldf 2009-05-22
  • 打赏
  • 举报
回复
应该是你调用IplImage *left = cvLoadImage("5R.jpg", -1);无效吧,debug的看看left有值有没有
lori227 2009-05-22
  • 打赏
  • 举报
回复
检查指针吧!

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧