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?