Search This Blog

Friday, April 1, 2011

Accessing IplImage element of type IPL_DEPTH_16S in OpenCV - Stack Overflow

I wrote a little program in C to explain how pointers work:

Accessing IplImage element of type IPL_DEPTH_16S in OpenCV - Stack Overflow:

int main(){
char * pointer;

printf('%zu \n', sizeof(char));
printf('%zu \n', sizeof(signed short));
printf('%zu \n', sizeof(signed int));
printf('%zu \n', sizeof(float));

printf('%p \n',((char*)(pointer) + 10 * 5));
printf('%p \n',((signed short*)(pointer)) + 10 * 5);
printf('%p\n',(((signed int*)(pointer)) + 10 * 5));
printf('%p\n',((float*)(pointer)) + 10 * 5);
}

1
2
4
4
0x7fff5fc01084
0x7fff5fc010b6
0x7fff5fc0111a
0x7fff5fc0111a"

No comments: