Ask Your Question

decoz's profile - activity

2013-05-08 10:36:00 -0600 commented question cvGet2D error

I'm sorry.. cuz it's my first time to post question at opencv forum. , I can't post image or correctly boxed source code.

2013-05-08 10:23:46 -0600 commented question cvGet2D error

this is simple test code for gray image .. I tried it by opencv 2.2 and 2.45 but got same segmentation fault

void testProblem(IplImage *srcImg){ int width = srcImg->width; int height = srcImg->height;

CvMat *mat = cvCreateMat(height,width,CV_32SC1);

cvSet(mat,cvScalar(0));
for(int y=0;y<height;y++){
    for(int x=0;x<width;x++){
        double val1 = cvGet2D(srcImg,y,x).val[0];
        double val2 = cvGet2D(mat,y,x).val[0];
    }
}

}

2013-05-08 02:12:37 -0600 asked a question cvGet2D error

i think this two parts of code is independent to each of them.

CvMat *itgMap = cvCreateMat(gray->height + 1,gray->width + 1,CV_32SC1);

for(int> y=0;y<itgmap->height;y++)

for(int> x=0;x<itgmap->width;x++) {>

double pvalue = cvGet2D(gray,y-1,x-1).val[0]; // part1

double itg = cvGet2D(itgMap,y,x-1).val[0]; // part2

....... it makes segmentation fault error

but

for(int y=0;y<itgmap->height;y++)

for(int x=0;x<itgmap->width;x++) {

    double pvalue =  cvGet2D(gray,y-1,x-1).val[0];

this works ok .. and

for(int y=0;y<itgmap->height;y++)

for(int x=0;x<itgmap->width;x++) {

   double itg = cvGet2D(itgMap,y,x-1).val[0];

and it works well too..

only when both codes are enabled at same time, it makes segmentation faults but I can't see any relation of them.. how is it possible?