9 #include <opencv2/highgui/highgui.hpp>
13 int main(
int argc,
char **argv) {
16 if (argc < 2 || argc > 7) {
17 std::cerr <<
"Usage: height_map_to_shape INPUT_IMAGE RESOLUTION [BLOCK_HEIGHT] [ORIGIN_X ORIGIN_Y]" <<
std::endl;
23 double resolution = 0.2;
25 resolution = atof(argv[2]);
28 double block_height = 1;
30 block_height = atof(argv[3]);
33 double origin_x = 0, origin_y = 0;
35 origin_x = atof(argv[4]);
36 origin_y = atof(argv[5]);
39 cv::Mat image = cv::imread(filename_img, cv::IMREAD_GRAYSCALE);
45 for(
int x = 0; x < image.cols; ++x) {
47 for(
int y = 0; y < image.rows; ++y) {
48 map[x][image.rows - y - 1] = block_height - (double)image.
at<
unsigned char>(y, x) / 255 * block_height;
60 geo::Pose3D transform(origin_x, origin_y, 0, 0, 0, 0);
64 shape.
setMesh(mesh_transformed);