artoolkitplus_draw.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2013 by Markus Bader *
3  * markus.bader@tuwien.ac.at *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
22 #include <opencv2/imgproc/imgproc.hpp>
23 
25  char text[0xFF];
26  cv::Point a, b, c;
27  cv::Scalar green(0, 255, 0);
28  cv::Scalar green2(0, 200, 0);
29  cv::Scalar red(0, 0, 255);
30  cv::Scalar blue(255, 0, 0);
31  int fondFace = cv::FONT_HERSHEY_SCRIPT_SIMPLEX;
32 
33  std::vector<ARToolKitPlus::ARTag2D>::const_iterator artag;
34  for (artag = arTags2D_.begin(); artag != arTags2D_.end(); artag++) {
35  cv::Scalar lineColour = green;
36  if (artag->id < 0) lineColour = red;
37  a = cv::Point(artag->vertex[3][0], artag->vertex[3][1]);
38  if (artag->belongsToPattern != ARToolKitPlus::ARTag2D::NO_PATTERN) {
39  a = cv::Point(artag->vertex[0][0], artag->vertex[0][1]);
40  b = cv::Point(artag->vertex[2][0], artag->vertex[2][1]);
41  cv::line(img, a, b, lineColour, 1);
42  a = cv::Point(artag->vertex[1][0], artag->vertex[1][1]);
43  b = cv::Point(artag->vertex[3][0], artag->vertex[3][1]);
44  cv::line(img, a, b, lineColour, 1);
45  } else {
46  for (int v = 0; v < 4; v++) {
47  b = cv::Point(artag->vertex[v][0], artag->vertex[v][1]);
48  cv::line(img, a, b, lineColour, 1);
49  a = b;
50  }
51  }
52  sprintf(text, "%i", artag->id);
53  cv::putText(img, text, cv::Point(artag->pos[0], artag->pos[1]), fondFace, 0.2, green);
54  }
55 }
std::vector< ARToolKitPlus::ARTag2D > arTags2D_
Definition: artoolkitplus.h:98
static const int NO_PATTERN
Definition: artoolkitplus.h:46
void generateDebugImage(cv::Mat &img)


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun Sep 4 2016 03:24:33