Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8075a22

Browse files
authored
Merge pull request #56 from basti35/master
Query the step size of the depth_image from the image_encodings.
2 parents 124be23 + cb0d2f9 commit 8075a22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

camera_handler/src/CameraHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void CameraHandler::handleSimulation(){
170170
depth_msg.height=resol[1]; //Set the height of the image
171171
depth_msg.is_bigendian=0;
172172
depth_msg.encoding=sensor_msgs::image_encodings::TYPE_32FC1;
173-
depth_msg.step=depth_msg.width*sizeof(simFloat);
173+
depth_msg.step=depth_msg.width*sensor_msgs::image_encodings::bitDepth(depth_msg.encoding)/8;
174174
depth_msg.data.resize(depth_msg.height*depth_msg.step);
175175
const simFloat* depth_buf = simGetVisionSensorDepthBuffer(_associatedObjectID);
176176
simFloat* depth_img = reinterpret_cast<simFloat*>(depth_msg.data.data());

0 commit comments

Comments
 (0)