File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ namespace ros_openpose
115
115
// K.at(5) = intrinsic.ppy
116
116
117
117
// our depth frame type is 16UC1 which has unsigned short as an underlying type
118
- auto depth = mDepthImageUsed .at <unsigned short >(static_cast <int >(pixelY), static_cast <int >(pixelX));
118
+ // auto depth = mDepthImageUsed.at<unsigned short>(static_cast<int>(pixelY), static_cast<int>(pixelX));
119
+ auto depth = mDepthImageUsed .at <float >(static_cast <int >(pixelY), static_cast <int >(pixelX));
119
120
120
121
// no need to proceed further if the depth is zero or less than zero
121
122
// the depth represents the distance of an object placed infront of the camera
Original file line number Diff line number Diff line change @@ -82,9 +82,10 @@ namespace ros_openpose
82
82
// however I found that it is only changing encoding.
83
83
// therefore in case of '16UC1' encoding (depth values are in millimeter),
84
84
// a manually conversion from millimeter to meter is required.
85
- mDepthImage = (depthMsg->encoding == sensor_msgs::image_encodings::TYPE_16UC1) ?
86
- depthPtr->image * 0 .001f : // convert to meter (SI units)
87
- depthPtr->image ; // no conversion needed
85
+ if (depthMsg->encoding == sensor_msgs::image_encodings::TYPE_16UC1)
86
+ depthPtr->image .convertTo (mDepthImage , CV_32FC1, 0 .001f ); // convert to meter (SI units)
87
+ else
88
+ mDepthImage = depthPtr->image ; // no conversion needed
88
89
}
89
90
catch (cv_bridge::Exception& e)
90
91
{
You can’t perform that action at this time.
0 commit comments