Skip to content

Commit b6dc247

Browse files
Use new depthCamera constructor (#80)
Supersedes #78
2 parents 7d1c3b9 + 1e856be commit b6dc247

File tree

1 file changed

+2
-50
lines changed

1 file changed

+2
-50
lines changed

ed_sensor_integration/test/test_furniture_fit.cpp

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -127,49 +127,6 @@ sensor_msgs::CameraInfo getDefaultCamInfo(const ImageResolution& resolution)
127127
return cam_info;
128128
}
129129

130-
/**
131-
* @brief setupRasterizer sets up the rasterizer
132-
* N.B.: shouldn't we move this somewhere else? It's being used more often
133-
* @param rasterizer
134-
*/
135-
void setupRasterizer(image_geometry::PinholeCameraModel& cam_model, geo::DepthCamera& rasterizer)
136-
{
137-
sensor_msgs::CameraInfo cam_info = getDefaultCamInfo({CAM_RESOLUTION_WIDTH, CAM_RESOLUTION_HEIGHT});
138-
cam_model.fromCameraInfo(cam_info);
139-
140-
rasterizer.setFocalLengths(cam_model.fx(), cam_model.fy());
141-
rasterizer.setOpticalCenter(cam_model.cx(), cam_model.cy());
142-
rasterizer.setOpticalTranslation(cam_model.Tx(), cam_model.Ty());
143-
}
144-
145-
146-
/**
147-
* @brief renderImage renders an rgbd image from a world model.
148-
* N.B.: copied from https://github.com/tue-robotics/fast_simulator/blob/master/src/Kinect.cpp
149-
* @param wm
150-
*/
151-
// ToDo: generalize
152-
void renderImage(const geo::DepthCamera& rasterizer, const geo::Pose3D& cam_pose, const ed::WorldModel& wm, cv::Mat& depth_image)
153-
{
154-
cv::Mat image(depth_image.rows, depth_image.cols, CV_8UC3, cv::Scalar(20, 20, 20));
155-
bool result = ed::renderWorldModel(wm, ed::ShowVolumes::NoVolumes, rasterizer, cam_pose.inverse(), depth_image, image);
156-
ROS_DEBUG_STREAM("\nRender result: " << result << "\n");
157-
158-
if (SHOW_DEBUG_IMAGES)
159-
{
160-
cv::namedWindow("Colored image", 1);
161-
cv::imshow("Colored image", image);
162-
std::cout << "Press any key to continue" << std::endl;
163-
cv::waitKey(0);
164-
cv::namedWindow("Depth image", 1);
165-
cv::imshow("Depth image", depth_image);
166-
std::cout << "Press any key to continue" << std::endl;
167-
cv::waitKey(0);
168-
cv::destroyAllWindows();
169-
}
170-
}
171-
172-
173130

174131
void moveFurnitureObject(const ed::UUID& id, const geo::Pose3D& new_pose, ed::WorldModel& wm)
175132
{
@@ -346,10 +303,7 @@ class TestSetup
346303
{
347304
sensor_msgs::CameraInfo cam_info = getDefaultCamInfo({CAM_RESOLUTION_WIDTH, CAM_RESOLUTION_HEIGHT});
348305
cam_model_.fromCameraInfo(cam_info);
349-
350-
rasterizer_.setFocalLengths(cam_model_.fx(), cam_model_.fy());
351-
rasterizer_.setOpticalCenter(cam_model_.cx(), cam_model_.cy());
352-
rasterizer_.setOpticalTranslation(cam_model_.Tx(), cam_model_.Ty());
306+
rasterizer_.initFromCamModel(cam_model_);
353307
}
354308

355309
void setupCamPose()
@@ -391,8 +345,7 @@ class TestSetup
391345
}
392346

393347
// ToDo: do or don't have as a member
394-
bool fitSupportingEntity(const rgbd::Image* image, const ed::UUID& entity_id,
395-
geo::Pose3D& new_pose) const
348+
bool fitSupportingEntity(const rgbd::Image* image, const ed::UUID& entity_id, geo::Pose3D& new_pose) const
396349
{
397350
// ToDo: create a function for this in the library
398351
// ToDo: does it make sense to provide RGBD data here or rather a more standard data type?
@@ -414,7 +367,6 @@ class TestSetup
414367
Fitter fitter_;
415368
geo::Pose3D cam_pose_;
416369
double max_yaw_change = degToRad(45.0);
417-
418370
};
419371

420372

0 commit comments

Comments
 (0)