v4r_artoolkitplus_draw.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2013 by Markus Bader                                    *
00003  *   markus.bader@tuwien.ac.at                                             *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <v4r_artoolkitplus/v4r_artoolkitplus.h>
00022 
00023 void ARToolKitPlusNode::generateDebugImage(cv::Mat &img) {
00024     char text[0xFF];
00025     cv::Point a, b, c;
00026     cv::Scalar green(0, 255, 0);
00027     cv::Scalar green2(0, 200, 0);
00028     cv::Scalar red(0, 0, 255);
00029     cv::Scalar blue(255, 0, 0);
00030     int fondFace = cv::FONT_HERSHEY_SCRIPT_SIMPLEX;
00031 
00032     std::vector<ARToolKitPlus::ARTag2D>::const_iterator artag;
00033     for (artag = arTags2D_.begin(); artag != arTags2D_.end(); artag++) {
00034         cv::Scalar lineColour = green;
00035         if (artag->id < 0) lineColour = red;
00036         a = cv::Point(artag->vertex[3][0], artag->vertex[3][1]);
00037         if (artag->belongsToPattern != ARToolKitPlus::ARTag2D::NO_PATTERN) {
00038             a = cv::Point(artag->vertex[0][0], artag->vertex[0][1]);
00039             b = cv::Point(artag->vertex[2][0], artag->vertex[2][1]);
00040             cv::line(img, a, b, lineColour, 1);
00041             a = cv::Point(artag->vertex[1][0], artag->vertex[1][1]);
00042             b = cv::Point(artag->vertex[3][0], artag->vertex[3][1]);
00043             cv::line(img, a, b, lineColour, 1);
00044         } else {
00045           for (int v = 0; v < 4; v++) {
00046               b = cv::Point(artag->vertex[v][0], artag->vertex[v][1]);
00047               cv::line(img, a, b, lineColour, 1);
00048               a = b;
00049           }
00050         }
00051         sprintf(text, "%i", artag->id);
00052         cv::putText(img, text, cv::Point(artag->pos[0], artag->pos[1]), fondFace, 0.2, green);
00053     }
00054 }


v4r_artoolkitplus
Author(s): Markus Bader
autogenerated on Wed Aug 26 2015 16:41:53