Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv and memory issues

int a*;

a = malloc(3*sizeof(int)); a[0]=1; a[1]=2; a[2]=3; M = cv::Mat(3,1,CV_32S , a);

cout<< "correct answer:"<<endl; cout="" &lt;&lt;="" m="" &lt;&lt;="" endl;="" free(a);="" cout&lt;&lt;"problem:"&lt;<endl;="" cout&lt;<m&lt;<endl;<="" p="">

This program results to: correct answer: [1; 2; 3] problem: [4; 0; 24411984]

WHY??????

Opencv and memory issues

int a*;

a*;

a = malloc(3*sizeof(int)); a[0]=1; a[1]=2; a[2]=3; M = cv::Mat(3,1,CV_32S , a);

a);

cout<< "correct answer:"<<endl; cout="" &lt;&lt;="" <<="" m="" &lt;&lt;="" <<="" endl;="" free(a);="" cout&lt;&lt;"problem:"&lt;<endl;="" cout&lt;<m&lt;<endl;<="" p="">

This program results to: correct answer: [1; 2; 3] problem: [4; 0; 24411984]

WHY??????

cout<<"problem:"<<endl;="" cout<<m<<endl;="" this="" program="" results="" to:="" correct="" answer:="" [1;="" 2;="" 3]="" problem:="" [4;="" 0;="" 24411984]="" why??????="" <="" pre="">

Opencv and memory issues

int a*;

`int a*;

a = malloc(3*sizeof(int)); a[0]=1; a[1]=2; a[2]=3; M = cv::Mat(3,1,CV_32S , a); a);

cout<< "correct answer:"<<endl; cout="" <<="" &lt;&lt;="" m="" <<="" &lt;&lt;="" endl;="" free(a);="" cout<<"problem:"<<endl;="" cout<<m<<endl;="" this="" program="" results="" to:="" correct="" answer:="" [1;="" 2;="" 3]="" problem:="" [4;="" 0;="" 24411984]="" why??????="" <="" pre="">

cout&lt;&lt;"problem:"&lt;<endl;="" cout&lt;<m&lt;<endl;<="" p="">

This program results to: correct answer: [1; 2; 3] problem: [4; 0; 24411984]

WHY??????`

Opencv and memory issues

`int a*;

int a*;
  

a = malloc(3*sizeof(int)); a[0]=1; a[1]=2; a[2]=3; M = cv::Mat(3,1,CV_32S , a);

a);

cout<< "correct answer:"<<endl; cout="" &lt;&lt;="" m="" &lt;&lt;="" endl;="" free(a);="" cout&lt;&lt;"problem:"&lt;<endl;="" cout&lt;<m&lt;<endl;<="" p=""> answer:"<<endl; cout << M << endl; free(a); cout<<"problem:"<<endl;

cout<<M<<endl; This program results to: correct answer: [1; 2; 3] problem: [4; 0; 24411984]

24411984]

WHY??????`

Opencv and memory issues

int a*;

a = malloc(3*sizeof(int));
a[0]=1; a[1]=2; a[2]=3;
M = cv::Mat(3,1,CV_32S , a);

cout<< "correct answer:"<<endl;
cout << M << endl;
free(a);
cout<<"problem:"<<endl;

cout<<M<<endl;

This program results to: correct answer: [1; 2; 2;

3]
problem:
[4;
0;
 24411984]

WHY??????`

Opencv and memory issues

int a*;

a = malloc(3*sizeof(int));
a[0]=1; a[1]=2; a[2]=3;
M = cv::Mat(3,1,CV_32S , a);

cout<< "correct answer:"<<endl;
cout << M << endl;
free(a);
cout<<"problem:"<<endl;

cout<<M<<endl;

This program results to: correct answer: [1; 2;to:

correct answer:
[1;
2;

3]
problem:
[4;
0;
 24411984]

WHY??????`

Opencv and memory issues

int a*;

a = malloc(3*sizeof(int));
a[0]=1; a[1]=2; a[2]=3;
M = cv::Mat(3,1,CV_32S , a);

cout<< "correct answer:"<<endl;
cout << M << endl;
free(a);
cout<<"problem:"<<endl;

cout<<M<<endl;

This program results to:

correct answer:
[1;
2;
 3]
problem:
[4;
0;
 24411984]

WHY??????`