24 #include <tuw_artoolkitplus/TransformArrayStamped.h> 27 #include <opencv2/highgui/highgui.hpp> 38 printf (
"%s", nStr );
43 n_ ( n ), n_param_ (
"~" ), callback_counter_ ( 0 ), imageTransport_ ( n_ ), logger_ (
NULL ), param_() {
66 if ( undist_iterations == 1 ) {
73 ARCamera (
const sensor_msgs::CameraInfoConstPtr& _camer_info,
int _undist_iterations,
bool _input_distorted ) {
77 if ( _input_distorted ) {
79 this->fc[0] = (
ARFloat ) _camer_info->K[0];
80 this->fc[1] = (
ARFloat ) _camer_info->K[4];
81 this->cc[0] = (
ARFloat ) _camer_info->K[2];
82 this->cc[1] = (
ARFloat ) _camer_info->K[5];
84 undist_iterations = _undist_iterations;
86 this->kc[0] = (
ARFloat ) _camer_info->D[0];
87 this->kc[1] = (
ARFloat ) _camer_info->D[1];
88 this->kc[2] = (
ARFloat ) _camer_info->D[2];
89 this->kc[3] = (
ARFloat ) _camer_info->D[3];
90 this->kc[4] = (
ARFloat ) _camer_info->D[4];
95 this->fc[0] = (
ARFloat ) _camer_info->P[0];
96 this->fc[1] = (
ARFloat ) _camer_info->P[5];
97 this->cc[0] = (
ARFloat ) _camer_info->P[2];
98 this->cc[1] = (
ARFloat ) _camer_info->P[6];
100 undist_iterations = 1;
102 for (
int i = 0; i < 6; i++ )
111 xsize = _camer_info->width;
112 ysize = _camer_info->height;
114 for (
int i = 0; i < 3; i++ )
115 for (
int j = 0; j < 4; j++ )
124 if ( _input_distorted ==
false ) {
130 for (
int i = 0; i < 4; i++ )
182 if (
param_.border_width > 0 ) {
189 if (
param_.edge_threshold > 0 ) {
223 if (
param_.border_width > 0 ) {
230 if (
param_.edge_threshold > 0 ) {
263 ROS_ERROR (
"cv_bridge exception: %s", e.what() );
275 for (
int i = 0; i <
arTags2D_.size(); i++ ) {
294 if ( singleMarker.
id == multiMarker.
patt_id ) {
307 if (
param_.show_camera_image ) {
309 cvtColor ( img->image, img_debug, CV_GRAY2BGR );
311 cv::imshow (
param_.
node_name + std::string (
" - debug" ), img_debug );
332 for (
int r = 0; r < 3; r++ ) {
336 pose[r][3] = p[r+12];
345 for ( std::vector<ARToolKitPlus::ARTag2D>::iterator arTag =
arTags2D_.begin(); arTag !=
arTags2D_.end(); arTag++ ) {
350 sprintf ( frame,
"t%i", arTag->id );
353 sprintf ( frame,
"t%i", arTag->id );
356 if (
param_.plausibility_check ) {
357 double roll, pitch, yaw,
z;
359 pose[1][0], pose[1][1], pose[1][2],
360 pose[2][0], pose[2][1], pose[2][2]);
362 R.
getRPY(roll, pitch, yaw);
365 if (std::isnan(roll) || std::isnan(pitch) || std::isnan(yaw))
369 if (
param_.plausibility_correction ) {
383 if (
param_.show_camera_image ) {
CameraSubscriber subscribeCamera(const std::string &base_topic, uint32_t queue_size, const CameraSubscriber::Callback &callback, const ros::VoidPtr &tracked_object=ros::VoidPtr(), const TransportHints &transport_hints=TransportHints())
ARCamera(const sensor_msgs::CameraInfoConstPtr &_camer_info, int _undist_iterations, bool _input_distorted)
std::string resolve(const std::string &prefix, const std::string &frame_name)
void artLog(const char *nStr)
Passes a simple string to the implementing instance.
CvImagePtr cvtColor(const CvImageConstPtr &source, const std::string &encoding)
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
CvImagePtr toCvCopy(const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string())
ARFileGrabber camera("dump_%02d.raw", CAM_W, CAM_H, 4)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
TFSIMD_FORCE_INLINE const tfScalar & z() const