Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ar_track_alvar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.8.3)
project(ar_track_alvar)

add_compile_options(-std=c++14)

set(MSG_DEPS
ar_track_alvar_msgs
std_msgs
Expand Down
6 changes: 6 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/CvTestbed.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
#include "Alvar.h"
#include <vector>
#include <string>
#include <opencv2/core/version.hpp>
#if CV_VERSION_MAJOR < 4
#include "cv.h"
#include "highgui.h"
#else
#include <opencv2/opencv.hpp>
#include <opencv2/core/core_c.h>
#endif
#include "CaptureFactory.h"

using namespace alvar;
Expand Down
8 changes: 8 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/FileFormatUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@
*/

#include "Alvar.h"
#include "opencv2/core/version.hpp"
#if CV_VERSION_MAJOR < 4
#include "cv.h"
#else
#include "opencv2/opencv.hpp"
#include <opencv2/core/core_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/calib3d.hpp>
#endif
#include "tinyxml.h"

namespace alvar {
Expand Down
8 changes: 8 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/Kalman.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
*/

#include "Alvar.h"
#include "opencv2/core/version.hpp"
#if CV_VERSION_MAJOR < 4
#include "cxcore.h"
#include "cv.h"
#include "highgui.h"
#else
#include "opencv2/opencv.hpp"
#include "opencv2/core/core_c.h"
#endif

namespace alvar {

Expand Down
9 changes: 9 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/Marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@
#include "filter/kinect_filtering.h"
#include <Eigen/StdVector>

#if CV_VERSION_MAJOR < 4
#include "highgui.h"
#else
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#endif

namespace alvar {

//#define CV_RGB_(r,g,b) cvScalar((b), (g), (r), 0)

/**
* \brief Basic 2D \e Marker functionality.
*
Expand Down
3 changes: 3 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/MultiMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#include "FileFormat.h"
#include <tf/LinearMath/Vector3.h>
#include <Eigen/StdVector>
#if CV_VERSION_MAJOR < 4
#include "highgui.h"
#endif

namespace alvar {

Expand Down
7 changes: 7 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/Optimization.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
#define OPTIMIZATION_H

#include "Alvar.h"
#include <opencv2/core/version.hpp>
#if CV_VERSION_MAJOR < 4
#include <cxcore.h>
#include "highgui.h"
#else
#include <opencv2/opencv.hpp>
#include <opencv2/core/core_c.h>
#endif
//#include <float.h>


Expand Down
13 changes: 13 additions & 0 deletions ar_track_alvar/include/ar_track_alvar/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@
#include <iostream>
#include <iomanip>
#include <sstream>
#include <opencv2/core/version.hpp>
#if CV_VERSION_MAJOR < 4
#include <cxcore.h>
#include <cv.h>
#else
#include <opencv2/opencv.hpp>
#include <opencv2/core/core_c.h>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#endif
#include <cmath> //for abs
#include <map>
#include <opencv2/calib3d/calib3d_c.h> //Compatibility with OpenCV 3.x

#ifdef CV_RGB
#undef CV_RGB
#define CV_RGB(r,g,b) cvScalar((b), (g), (r), 0)
#endif

namespace alvar {

const double PI = 3.14159265;
Expand Down
4 changes: 4 additions & 0 deletions ar_track_alvar/nodes/FindMarkerBundles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,11 @@ void getPointCloudCallback (const sensor_msgs::PointCloud2ConstPtr &msg)
// GetMultiMarkersPoses expects an IplImage*, but as of ros groovy, cv_bridge gives
// us a cv::Mat. I'm too lazy to change to cv::Mat throughout right now, so I
// do this conversion here -jbinney
#if CV_VERSION_MAJOR < 4
IplImage ipl_image = cv_ptr_->image;
#else
IplImage ipl_image = cvIplImage(cv_ptr_->image);
#endif
GetMultiMarkerPoses(&ipl_image, cloud);

for (size_t i=0; i<marker_detector.markers->size(); i++)
Expand Down
4 changes: 4 additions & 0 deletions ar_track_alvar/nodes/FindMarkerBundlesNoKinect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ void getCapCallback (const sensor_msgs::ImageConstPtr & image_msg)
// GetMultiMarkersPoses expects an IplImage*, but as of ros groovy, cv_bridge gives
// us a cv::Mat. I'm too lazy to change to cv::Mat throughout right now, so I
// do this conversion here -jbinney
#if CV_VERSION_MAJOR < 4
IplImage ipl_image = cv_ptr_->image;
#else
IplImage ipl_image = cvIplImage(cv_ptr_->image);
#endif
GetMultiMarkerPoses(&ipl_image);

//Draw the observed markers that are visible and note which bundles have at least 1 marker seen
Expand Down
4 changes: 4 additions & 0 deletions ar_track_alvar/nodes/IndividualMarkers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ void getPointCloudCallback (const sensor_msgs::PointCloud2ConstPtr &msg)
// GetMultiMarkersPoses expects an IplImage*, but as of ros groovy, cv_bridge gives
// us a cv::Mat. I'm too lazy to change to cv::Mat throughout right now, so I
// do this conversion here -jbinney
#if CV_VERSION_MAJOR < 4
IplImage ipl_image = cv_ptr_->image;
#else
IplImage ipl_image = cvIplImage(cv_ptr_->image);
#endif


//Use the kinect to improve the pose
Expand Down
6 changes: 5 additions & 1 deletion ar_track_alvar/nodes/IndividualMarkersNoKinect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ void getCapCallback (const sensor_msgs::ImageConstPtr & image_msg)
// GetMultiMarkersPoses expects an IplImage*, but as of ros groovy, cv_bridge gives
// us a cv::Mat. I'm too lazy to change to cv::Mat throughout right now, so I
// do this conversion here -jbinney
#if CV_VERSION_MAJOR < 4
IplImage ipl_image = cv_ptr_->image;

#else
IplImage ipl_image = cvIplImage(cv_ptr_->image);
#endif
marker_detector.Detect(&ipl_image, cam, true, false, max_new_marker_error, max_track_error, CVSEQ, true);

arPoseMarkers_.markers.clear ();
for (size_t i=0; i<marker_detector.markers->size(); i++)
{
Expand Down
12 changes: 12 additions & 0 deletions ar_track_alvar/nodes/TrainMarkerBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ void getCapCallback (const sensor_msgs::ImageConstPtr & image_msg)
// GetMultiMarkersPoses expects an IplImage*, but as of ros groovy, cv_bridge gives
// us a cv::Mat. I'm too lazy to change to cv::Mat throughout right now, so I
// do this conversion here -jbinney
#if CV_VERSION_MAJOR < 4
IplImage ipl_image = cv_ptr_->image;
#else
IplImage ipl_image = cvIplImage(cv_ptr_->image);
#endif

//Get the estimated pose of the main marker using the whole bundle
static Pose bundlePose;
Expand Down Expand Up @@ -422,10 +426,18 @@ int main(int argc, char *argv[])
std::cout << "Please type commands with the openCV window selected" << std::endl;
std::cout << std::endl;

#if CV_VERSION_MAJOR < 4
cvNamedWindow("Command input window", CV_WINDOW_AUTOSIZE);
#else
cv::namedWindow("Command input window", cv::WINDOW_AUTOSIZE);
#endif

while(1){
#if CV_VERSION_MAJOR < 4
int key = cvWaitKey(20);
#else
int key = cv::waitKey(20);
#endif
if(key >= 0)
keyProcess(key);
ros::spinOnce();
Expand Down
Loading