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

/apriltag_detector node crashes after viewing an apriltag. Receive openCV error

asked 2018-01-16 18:47:25 -0600

dpoiesz gravatar image

updated 2018-01-16 20:19:25 -0600

The node /apriltag_detector will launch with no errors or warnings. I ssh into a Raspberry Pi and view the camera image with the package web_video_ server via the topic /tag_detection_image. Once I place an apriltag in view of the camera the apriltag_detector node crashes and gives this error:

OpenCV Error: Assertion failed (mtype == type0 || (((((mtype) & ((512 - 1) << 3)) >> 3) + 1) == 1 && ((1 << type0) & fixedDepthMask) != 0)) in create, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 2542 terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:2542: error: (-215) mtype == type0 || (((((mtype) & ((512 - 1) << 3)) >> 3) + 1) == 1 && ((1 << type0) & fixedDepthMask) != 0) in function create

[apriltag_detector-1] process has died [pid 2075, exit code -6, cmd /home/pi/catkin_ws/devel/lib/apriltags_ros/apriltag_detector_node image_rect:=usb_cam/image_raw camera_info:=usb_cam/camera_info __name:=apriltag_detector __log:=/home/pi/.ros/log/943615a2-fb0c-11e7-91d7-b827eb550879/apriltag_detector-1.log]. log file: /home/pi/.ros/log/943615a2-fb0c-11e7-91d7-b827eb550879/apriltag_detector-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

This node used to work before complications with calibrating the camera. I resolved the calibration problem and the camera is calibrated. Initially I thought I may have messed something up trying to fix the calibration problem but am now led to believe it may have happened after an update/upgrade.

My attempts to downgrade openCV3 using sudo apt-get failed. I thought of commenting out the line of code causing the error but the error list a temporary directory that no longer exists. Any thoughts or advice would be appreciated. Thank you in advance.

edit retag flag offensive close merge delete



We are also having the exact same problem. It works with the opencv-3.2 but not with the 3.3.1 thus we've deduced that it is due to the opencv update on ros but no solution yet

deksprime gravatar image deksprime  ( 2018-01-22 05:56:14 -0600 )edit

@deksprime, were you able to revert back to opencv-3.2? My attempts failed because the source was not available, could you share how you downgraded?

dpoiesz gravatar image dpoiesz  ( 2018-01-27 15:03:17 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-01-22 09:35:10 -0600

cagatay gravatar image

updated 2018-01-22 13:12:15 -0600


if you are using this repo , the pull request solved our problem but it is still not merged with master thus what you need to do is to change the code piece located inside getRelativeTransform method in file


  cv::Matx33f cameraMatrix(
                       fx, 0, px,
                       0, fy, py,
                       0,  0,  1);


  cv::Matx33d cameraMatrix(
                       fx, 0, px,
                       0, fy, py,
                       0,  0,  1);

Hope it helps

edit flag offensive delete link more


Thanks, can't wait to try it. I will let you know how it goes.

dpoiesz gravatar image dpoiesz  ( 2018-01-22 11:11:51 -0600 )edit

@cagatay, I changed the f to a d in but still get the same error. Did I miss a step?

dpoiesz gravatar image dpoiesz  ( 2018-01-27 14:56:02 -0600 )edit

Nevermind, I forgot to rebuild the workspace. Thank you very much for helping me!

dpoiesz gravatar image dpoiesz  ( 2018-01-27 15:09:03 -0600 )edit

Question Tools

1 follower


Asked: 2018-01-16 18:47:25 -0600

Seen: 907 times

Last updated: Jan 22 '18