Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You have a race condition with cv_ptr_rgb.

You set this global variable in imageCallbackrgb and use it in imageCallbackdepth.

If the latter callback is called first you get your null-pointer error.

Check if cv_ptr_rgb has been set and only then use it.

You have a race condition with cv_ptr_rgb.

You set this global variable in imageCallbackrgb and use it in imageCallbackdepth.

If the latter callback is called first you get your null-pointer error.

Check if cv_ptr_rgb has been set and only then use it.

You could do it like this:

if (cv_ptr_rgb != NULL) addWeighted( cv_ptr_rgb->image, alpha, image8U, 0.5, 0.5, dst);