code-iai / iai_kinect2

Tools for using the Kinect One (Kinect v2) in ROS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

viewer - mutex lock

PetropoulakisPanagiotis opened this issue · comments

Hi,
in viewer.cpp in imageViewer(and cloudViewer) function, local var color points in the same data as color class member var. Prior call putText function, depth is converted to image(by dispDepth) and then color and depthDisp used in the combine function. If thread(imageViewer) swapped with a thread that handles callbacks there might occure some issuses. For example, if imageViewer thread call dispDepth function, then thread stopped(and may a callback thread read a new color and depth image), afterwards the imageViewer thread will call combine but with different color image. In conclustion, dispDepth and combine will handle frames with different time stamps.
One solution is to clone color and depth class members in local variables.