c++ - Deconstructing Mat_<INT64> in opencv fails -


my program crashes strangely on 32bit windows. vs2010 gives me error when function return:

windows has triggered breakpoint in mat_test.exe.this may due corruption of heap, indicates bug in mat_test.exe or of dlls has loaded.this may due user pressing f12 while mat_test.exe has focus. output window may have more diagnostic information.

if change int64 signed int, works well. have opencv? opencv's mat_ support int64 datatype?

#include <opencv.hpp> #include <stdio.h>  using namespace cv; using namespace std;  typedef signed __int64 int64; typedef unsigned char byte;   mat imgcpy(mat &ori_image); mat imgcpy(mat &ori_image){     mat img;     mat_<float> img_;      mat img_copy;     img_copy.create(8,8,cv_8u);     for(int i=0;i<8;i++)         for(int j=0;j<8;j++)             img_copy.at<byte>(i,j)=1;     cout<<img_copy<<endl;        const size sz(9,9);     mat_<float> scores(sz,0);     mat_<int64> tig1 = mat_<int64>::zeros(sz), tig2 = mat_<int64>::zeros(sz);     mat_<int64> tig4 = mat_<int64>::zeros(sz), tig8 = mat_<int64>::zeros(sz);     mat_<byte> row1 = mat_<byte>::zeros(sz),row2 = mat_<byte>::zeros(sz);     mat_<byte> row4 = mat_<byte>::zeros(sz),row8 = mat_<byte>::zeros(sz);     //cout << tig1 << endl << endl;     (int y=1;y<=8;y++)     {         //byte* g = img_copy.ptr<byte>(y-1);         int64* t1 = tig1.ptr<int64>(y); // binary tig of current row         int64* t2 = tig2.ptr<int64>(y);         int64* t4 = tig4.ptr<int64>(y);         int64* t8 = tig8.ptr<int64>(y);         int64* tu1 = tig1.ptr<int64>(y-1); // binary tig of upper row         int64* tu2 = tig2.ptr<int64>(y-1);         int64* tu4 = tig4.ptr<int64>(y-1);         int64* tu8 = tig8.ptr<int64>(y-1);         byte* r1 = row1.ptr<byte>(y);         byte* r2 = row2.ptr<byte>(y);         byte* r4 = row4.ptr<byte>(y);         byte* r8 = row8.ptr<byte>(y);         float *s = scores.ptr<float>(y);         (int x=1;x<=8;x++)         {             //cout<<g[x-1];             //byte g = 1;//g[x-1];             //r1[x] = (r1[x-1] << 1) | ((g >> 4) & 1);             //r2[x] = (r2[x-1] << 1) | ((g >> 5) & 1);             //r4[x] = (r4[x-1] << 1) | ((g >> 6) & 1);             //r8[x] = (r8[x-1] << 1) | ((g >> 7) & 1);             t1[x] = (tu1[x] << 8) | r1[x];             t2[x] = (tu2[x] << 8) | r2[x];             t4[x] = (tu4[x] << 8) | r4[x];             t8[x] = (tu8[x] << 8) | r8[x];             //cout<<tig1<<endl<<"\n";             //cout<<tig2<<endl<<"\n";             //cout<<tig4<<endl<<"\n";             //cout<<tig8<<endl<<"\n";             //cout<<row1<<endl<<"\n";             //cout<<row2<<endl<<"\n";             //cout<<row4<<endl<<"\n";             //cout<<row8<<endl<<"\n";             //s[x] = dot(t1[x], t2[x], t4[x], t8[x]);             //t1[x]=1;             //t2[x]=1;             //t4[x]=1;             //t8[x]=1;             s[x]=y;          }     }     cout<<scores<<endl<<endl;      //cout<< scores(rect(8,8,2,2)) <<endl<<endl;     scores(rect(7,7,2,2)).copyto(img);     cout<<img<<endl<<endl;     return img; } int main(){      mat img;     mat ori_img;      img = imgcpy(ori_img);     return 0;  } 

i had similar problem when vector destructor called, besides working on different computer. problem library. copied compiled library files computer. , visual stduio versions different. may cause problem, build opencv compiler.

when visual studio version changes c runtime library version changes. because of this, code can crush @ runtime. when compiled opencv visual studio, problem solved , yours hope.


Comments