使用opencv旋转图像时出现错误:windows has triggered a breakpoint in test.ext
来源:互联网 发布:仿电商微信小程序源码 编辑:程序博客网 时间:2024/05/16 15:15
出现错误时会出现下面的对话框:
出现这种问题,在一些博客中谈到两个原因:1. 访问已被释放的内存;2. 再次释放已被释放的内存;详情可以看博客:http://www.cppblog.com/wangjia184/archive/2008/03/27/45520.html
但是我遇到的问题是:访问了没有申请的空间,并在结束时释放了这些空间。
部分代码如下:
{Mat tempPlane = Mat::zeros(size,CV_8UC1);Point planeOrigin(size.width/2,size.height/2);uchar *ptempPlane = tempPlane.ptr<uchar>(0);int tempWidth = size.width,tempHeight = size.height;for(int i=0,numFrontPixel = coord.size();i<numFrontPixel;i++){//求旋转后的前景像素到目标面板中位置的映射double a = coord.at(i).x, b = coord.at(i).y;double c = sqrt(a*a+b*b);double tempx = c*cos(atan2(b,a) + angle),tempy = c*sin(atan2(b,a) + angle);double planex = planeOrigin.x + tempx , planey = planeOrigin.y - tempy;int px = planex>0.0 ? floor(planex+0.5) : ceil(planex - 0.5),py = planey>0.0 ? floor(planey+0.5) : ceil(planey - 0.5);if(px < tempWidth && px >= 0 && py>=0 && py < tempHeight) //判断是否超界,若有越界赋值,会出现析构错误*(ptempPlane + py*tempWidth + px) = 255;}...........................}
这里是使用opencv进行图像绕中心旋转的部分代码。出问题主要是之前if语句写错了。
if(planex < tempWidth && planex >= 0 && planey>=0 && planey < tempHeight) //判断是否超界,若有越界赋值,会出现析构错误
这里是使用opencv进行图像绕中心旋转的部分代码。出问题主要是之前if语句写错了。
导致赋值越界了,但是这里编译器并不提示出错。等程序跳出外面的大括号的时候临时变量tempPlane被析构,没有申请的单元也被析
构,而出现了这样的错误。
这种错误也可以认为是已经被释放的空间,再次被释放。
1 0
- 使用opencv旋转图像时出现错误:windows has triggered a breakpoint in test.ext
- Windows has triggered a breakpoint in ***.exe.
- Windows has triggered a breakpoint
- Windows has triggered a breakpoint
- Windows has triggered a breakpoint in xxxxx.exe
- Windows has triggered a breakpoint in xxxxx.exe.
- 解决 Windows has triggered a breakpoint in Linkage.exe问题
- Windows has triggered a breakpoint in xxx.exe
- Windows has triggered a breakpoint in xxx.exe
- Windows has triggered a breakpoint in XXX.exe.
- vs2010 遇 “堆损坏”问题: 无编译错误,提示:Windows has triggered a breakpoint in **.exe....
- Error:.exe has triggered a breakpoint.
- Windows has trigger a breakpoint
- 使用Ext.Window时出现No center region defined in BorderLayout错误的愿原因
- IAR调试cc2540 时 出现The stack plug-in failed to set a breakpoint on "main". 解决方法
- opencv Mat读取图像元素时出现越界错误
- opencv中关于图像图像处理时出现Bad argument (Array should be the cvMat or IplImage) in unknown function ……错误的解决办法
- IAR调试出现the stack plug-in failed to set a breakpoint on "main"
- CSS3初步
- Opencv学习笔记(九)光流法
- Java加密技术(四)——非对称加密算法RSA
- oracle 表更新的一次奇异经历(二)
- android.os.NetworkOnMainThreadException异常解决
- 使用opencv旋转图像时出现错误:windows has triggered a breakpoint in test.ext
- Android 系列 6.18实现AutoCompleteTextView
- 手机端滚动加载下一页
- Maven的SrpingMVC+Mybatis打包文件不全
- [leetcode]343. Integer Break
- android传感器
- 微信小程序helloworld结构
- xp系统升级win7系统教程
- 人工智能观察