Ask Your Question

Egnatius's profile - activity

2013-11-09 00:44:45 -0600 asked a question kalman sample code problem

Hi, just trying the openCV kalman.cpp

my computer crashes at this line because of reading forbidden memory:

KF.transitionMatrix = *(Mat_<float>(2, 2) << 1, 1, 0, 1);

And I don't understand why this cause a violating read.

the program works (in a sense) after I changed it to use "at" function to modify each element separately. It works "in a sense" because it now crashes after I hit ESC,q or Q. And the only line of code after that is return 0. I'm not a CS student but what makes a program crash when returning?

And if use memcpy to do it, it will crash after several (about 10) times I restart the Kalman process by pressing any key other than ESC, q, Q.

My computer seems to have problems with all kinds of sample codes even if I follow the instruction carefully, does anybody know any probable cause?

2012-09-20 23:39:06 -0600 received badge  Student (source)
2012-09-20 19:42:50 -0600 commented question Issue with cv2DRotationMatrix

It seems to work perfect after switching from 2.4.2 to 2.4.0.

2012-09-20 17:05:49 -0600 asked a question Issue with cv2DRotationMatrix

My code with cv2DRotationMatrix() compiles but always terminates with status -1073741515

I've tried many codes on the internet and in books but still the same.

I can't figure out where went wrong.

My code:

int main() {

IplImage *image, *image2;
CvMat *transmat;
CvPoint2D32f center;
double angle = 45.0;
double scale = 0.6;
image = cvLoadImage("lena.jpg",CV_LOAD_IMAGE_UNCHANGED);
if(!image){
    printf("Image open failed. Shutting down\n");
    system("PAUSE");
    return -1;
}
transmat = cvCreateMat(2,3,CV_32FC1);
image2 = cvCloneImage(image);
center.x = image->width/2;
center.y = image->height/2;

cv2DRotationMatrix(center,angle,scale,transmat);
cvWarpAffine(image, image2, transmat,image->nSize);
cvShowImage("Original",image);
cvShowImage("Rotated",image2);
cvWaitKey(0);
cvDestroyWindow("Original");
cvDestroyWindow("Rotated");
cvReleaseImage(&image);
cvReleaseImage(&image2);
cvReleaseMat(&transmat);
system("PAUSE");
return 0;

}

I'm using Code::Blocks under Win7.