personalrobotics / apriltags

ROS wrapper for the Apriltags visual fiducial tracker
BSD 2-Clause "Simplified" License
39 stars 37 forks source link

Problems with ROS Kinetic and OpenCV3 #24

Open rshanor opened 8 years ago

rshanor commented 8 years ago

error

psigen commented 8 years ago

Thanks for the report. I think this is actually the upstream apriltags-cpp library, which actually does the detections (this is just a ROS wrapper node).

Could you file this same report over there? https://github.com/swatbotics/apriltags-cpp We can crosslink the issues and close them together.

rshanor commented 8 years ago

For sure.

ClintLiddick commented 8 years ago

https://github.com/swatbotics/apriltags-cpp/issues/9

ashish-kb commented 7 years ago

for apriltags-cpp with ros-kinetic and opencv3, we need to do the following: 1) In apritags-cpp/CMakeLists.txt , make the following change pkg_search_module(OPENCV REQUIRED opencv>=2.3 opencv-2.3.1) to pkg_search_module(OPENCV REQUIRED opencv>=2.3 opencv-2.3.1 opencv-3.1.0-dev) and then that apriltags-cpp should work.

After that for apriltags, we need to do catkin_make_isolated that will give some more errors those can be solved adding these in apriltags/src/apriltags.cpp

include <opencv2/highgui.hpp>

include <opencv2/calib3d.hpp>

kubark42 commented 7 years ago

I had problems compiling and simply including

#include <opencv2/highgui.hpp> #include <opencv2/calib3d.hpp>

seemed to fix the compiling problem for me.

I haven't investigated whether my 16.04 system was linking against OpenCV 2 or 3, but in general considering how much more prevalent OCV3 is, it makes sense to target that specifically.

Nope, this didn't work at all. I followed the full directions above and was able to compile and run apriltags-cpp, but actually running roslaunch apriltags apriltags.launch, connecting to a camera, and then subscribing to the detector topic crashes (stack trace in https://github.com/swatbotics/apriltags-cpp/issues/9).

ashish-kb commented 7 years ago

Are you using this https://github.com/personalrobotics/apriltags-cpp ???

kubark42 commented 7 years ago

@ashish-kb yes, as per your instructions and the bug report I linked to. apriltags-cpp works great, the ROS wrapper does not. I'm 99% certain it's a result of build issues with OpenCV 2 and OpenCV 3.

YuehChuan commented 7 years ago

Hi, I felt the usage of apriltags in ros is not well documented yet. So I tried to manage here/ https://github.com/xenobot-dev/apriltags_ros welcome comments :)

dmcconachie commented 7 years ago

I can confirm that @ashish-kb 's suggestion a few posts up (and #28) allowed everything to compile for me on Ubuntu 16.04 with ROS Kinetic with two tweaks; I added opencv-3.2.0-dev, not 3.1.0, and I also needed to add an include for <map> inside of apriltags-ccp's include/AprilTypes.h file.

I will follow up once I've actually tried running things.

dmcconachie commented 7 years ago

I can confirm that using the kinect2.launch file, I am able to visualize the detection image and the markers that are exported, for whatever reason when I set viewer to true, the window that appears doesn't show any actual data; but that has the potential to be my computer, it intermittently has a similar problem with Matlab for example.

Edit: The typical solution to resolve the issues on my computer did not fix the AprilTags viewer; I suspect that there is a missing "give opencv some time to draw" call somewhere, or something.

hejia-zhang commented 4 years ago

I'm using ROS Melodic and OpenCV3.4.6. The problem I have is everytime the detector detects a tag, it crashes with the error message:

OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == 1 && ((1 << type0) & fixedDepthMask) != 0)) in create, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp, line 2402
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:2402: error: (-215) mtype == type0 || (CV_MAT_CN(mtype) == 1 && ((1 << type0) & fixedDepthMask) != 0) in function create

[apriltags-1] process has died [pid 27627, exit code -6, cmd /home/hejia/ros/ros_ws/devel/lib/apriltags/apriltags ~image:=/usb_cam/image_rect ~camera_info:=/usb_cam/camera_info ~marker_array:=/apriltags/marker_array ~detections:=/apriltags/detections __name:=apriltags __log:=/home/hejia/.ros/log/f58e83e0-28f3-11ea-921b-503eaa967cfb/apriltags-1.log].
log file: /home/hejia/.ros/log/f58e83e0-28f3-11ea-921b-503eaa967cfb/apriltags-1*.log