Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Pointer to image producing different results

I'm doing the following:

  image = image.clone(); // ensure continuous memory
  double *im = (double *) calloc(image.total() *image.elemSize(), sizeof (double));
  im = (double *)image.data;

What I thought this was doing was giving me a pointer to the image data, however when i print out the memory in a debugger I get different values after I add the same offset to both (i.e. x/100 image.data+100 != x/100 im+100).

Is my pointing not doing what I think it is and if so why?

Pointer to image producing different results

I'm doing the following:

  image = image.clone(); // ensure continuous memory
  double *im = (double *) calloc(image.total() *image.elemSize(), sizeof (double));
  im = (double *)image.data;

What I thought this was doing was giving me a pointer to the image data, however when i print out the memory in a debugger I get different values after I add the same offset to both (i.e. x/100 image.data+100 != x/100 im+100).

Is my pointing not doing what I think it is and if so why?

The reason I'm doing this is because I'm trying to port some mex stuff, and the whole function relies on a pointer to an rgb image and address offsetting.