Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <tuw_artoolkitplus/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 }