ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Command Line mapstitch issue

asked 2013-09-08 01:03:20 -0500

Devasena Inupakutika gravatar image

updated 2014-01-28 17:17:52 -0500

ngrennan gravatar image


I am attempting to merge already created and saved maps of two rooms of my lab and getting below error although the two rooms are connected through door passage as is evident from the pgm files of rooms attached herewith. c8ae7f36-1871-11e3-9ee8-efc69eb7ec00.png e4b01bea-1871-11e3-8097-4cce4b2fd663.png

turtlebot@ubuntu:~/fuerte_workspace/sandbox/mapstitch$ bin/mapstitch -o testmerge.pgm -d 1.0 robo_lab2.pgm robo_lab2p2.pgm
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/buildd/ros-fuerte-opencv2-2.4.2-1precise-20130312-1306/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/buildd/ros-fuerte-opencv2-2.4.2-1precise-20130312-1306/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat

Aborted (core dumped)

I followed few ways as discussed in stackoverflow related to this OpenCV error which could be datatype mismatch or differences in Opencv C or C++ API's but didn't work.

Could anyone please let me know what could be the issue and reason for this error ?

edit retag flag offensive close merge delete


If you consider that the proposed solution is the correct one, you should mark the answer as correct to close the question. Thanks.

Jose Luis gravatar image Jose Luis  ( 2014-06-27 07:57:09 -0500 )edit

Done! Thanks!

Devasena Inupakutika gravatar image Devasena Inupakutika  ( 2014-06-27 08:25:43 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-05-26 01:54:50 -0500

Jose Luis gravatar image

updated 2014-06-25 05:55:30 -0500

Hi Devasena,

I have the same problem. I am attempting to combine two maps, but always I get the same response: "Segmentation fault (core dumped)"

I have tried with .pgm and .png maps with different weights but the result is the same.

The commands that I have tried are:

bin/mapstitch -o map_result.pgm map_part1.pgm map_part2.pgm bin/mapstitch -o map_result.pgm -d 1.0 map_part1.pgm map_part2.pgm

bin/mapstitch -o map_result.pgm map_part1.png map_part2.png bin/mapstitch -o map_result.png map_part1.png map_part2.png [with different map sizes] ....

Have you obtained some good result?

I have found the solution. The correct command to run the mapstitch (offline) is:

bin/mapstitch -o mapResult.pgm -d 3 map_1.pgm map_2.pgm

In this case, i want to merge map_1.pgm with map_2.pgm, and save the merged map in mapReult.pgm. The target distance to match the detected points is 3. You can choose your own distance for your needs.

If the desired distance is small for the current images, sometimes the program returns a Core Dumped error. This is not debugged in the code source.

I have added the corrections to manage the error in the source in GitHub.

If you want to see how the program has matched both images (see the features points in the images), you need to add -v (verbose) before the -o.

I hope that this help to the users.

edit flag offensive delete link more


It didnt work for me, Input pgm's size is 2048 x 2048. and i am getting Segmentation fault. And it is working fine if both image are same or without any rotation.

bvbdort gravatar image bvbdort  ( 2014-08-15 05:45:52 -0500 )edit

answered 2015-12-15 01:50:41 -0500

quentin gravatar image


When I try to run the system offline, with the command indicated above, I get this error:

bash: bin/mapstitch: No such file or directory

Does somebody know what I have done wrong? (I am using Indigo devel)

Thank you!

edit flag offensive delete link more


The package that you can find in GitHub as master or indigo, are not really the version that appear in the menu... The last commit was made 2 years ago. Also you can see the CMakelists and manifest are totally deprecated for Indigo. The latest versions of ROS use package.xml instead of manifest.

Jose Luis gravatar image Jose Luis  ( 2015-12-17 07:55:18 -0500 )edit

Try with the thesis_output branch...

Jose Luis gravatar image Jose Luis  ( 2015-12-17 07:59:46 -0500 )edit

I also tried the thesis_output which gives the same error...

quentin gravatar image quentin  ( 2015-12-17 21:14:16 -0500 )edit

Hi, I am getting the same error. But I couldn't figure it out. Please help!! I downloaded the github mapstitch zip file and that's all. What should I do now??

zeynasip gravatar image zeynasip  ( 2020-11-19 07:33:37 -0500 )edit

Question Tools

1 follower


Asked: 2013-09-08 01:03:20 -0500

Seen: 746 times

Last updated: Dec 15 '15