Note that the freenect_registration struct contains several pointers.
You'll have to do a deeper copy to save the following:
uint16_t* raw_to_mm_shift;
int32_t* depth_to_rgb_shift;
int32_t (*registration_table)[2];
(which are, incidentally, the fields that you care about more.) Each
struct's actual size can be found in freenect_copy_registration() in
registration.c where the field is malloc()'d.
> The second part, done at a later time, takes one PGM file and the
> regdump.dat and attempts to produce some processed data (a PGM with mm
> values, and an x,y,z ASCII file).
>
> I load the raw PGM and the regdump.dat file produced above, but when I call
> 'freenect_apply_registration(&dev, PGMdata, wz);', it wants a pointer to a
> 'freenect_device', not a 'freenect_registration'. So, it seems I need to
> dump the freenect device into the regdump.dat file in addition to the
> registration, but I'm not sure how.
That function uses the freenect_device solely to get at the
freenect_registration contained therein.
> I can't find an inverse function for this: thisDevice =
> freenect_copy_registration( f_dev );
>
> And this might be a basic C issue, but I'm not sure how to write out f_dev,
> since it is a pointer to a complex structure, and I don't know how to
> determine the full size of that structure.
Just copy freenect_apply_registration (it's not public API anyway) and
change it so you pass it the freenect_registration* instead of it
pulling it out of the device on the first line.
-Drew