Project

General

Profile

BitmapToolkit Scol plugin
ArMarker.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25#ifndef __BTK_ARMARKER_H__
26#define __BTK_ARMARKER_H__
27
28#include <aruco.h>
29#include "Prerequisites.h"
30#include "BitmapToolkitThread.h"
31#include "ArDetector.h"
32
33
34//keep for now, most of used shared_mutex and some other are C++17 only
35#include <boost/thread/thread.hpp>
36
37class ArMarker : public aruco::Marker
38{
39public:
47protected:
48 boost::mutex markerMutex;
49 boost::mutex killMutex;
50 boost::mutex m_thread_lock;
56 float m_size;
58private:
59 //cv::Mat m_lastFrame;
60 //cv::Mat m_lastColor;
61
62 aruco::CameraParameters m_lastCamParam;
63 bool m_lastReverse;
64 MarkerType m_type;
65
66public :
67 /* Constructor with assigned value */
68 ArMarker(unsigned int nid, float markerSize = -1, MarkerType type = AR_ARUCO_MARKER);
69 //ArMarker(std::string path, unsigned int id, float markerSize=-1, bool border = false, unsigned int maxFeatures = 600);
70 //ArMarker(cv::Mat image, unsigned int id, float markerSize=-1, bool border = false, unsigned int maxFeatures = 600);
71 //ArMarker(const std::string path, unsigned int id, float markerSize=-1, unsigned int maxFeatures = 600);
72 //ArMarker(unsigned int id, float markerSize, int type);
73
74 /* Destructor */
75 virtual ~ArMarker();
76
77 /* Create bitmap with marker's id */
78 cv::Mat GetMarkerBitmap(int size);
79
80 void SetPosition(Vector3 pos);
81 //void SetCorners(std::vector<cv::Point2d> cor);
82 void SetPixelPosition(Vector3 pixelpos);
83 void SetOrientation(BtQuaternion orientation);
84 void Draw(cv::Mat image);
85 void SetCoords(std::vector<cv::Point2f> coords);
86
90 std::vector<cv::Point2f> GetCorners();
91
92 void SetSize(float size);
93 float GetSize();
94
95 unsigned int GetID();
97
98 void SetVisible(bool visible);
99 bool IsVisible();
100
101 /* Detect marker's position in picture */
102 void Update(ArCameraParam& camparam, aruco::Marker& marker, bool reverse);
103
104 //void Update(cv::Mat frame, cv::Mat color, aruco::CameraParameters& camparam, bool reverse);
105 //void Update(const cv::Mat &frameDescriptors, const std::vector<cv::KeyPoint> &frameKeypoints, aruco::CameraParameters& camparam, bool reverse);
106 //void DetectFeaturedThread();
107
108 //void SetImage(const cv::Mat image, cv::Rect objRect);
109 //void SetImage(const cv::Mat image, std::vector<cv::Rect> objRects);
110
111 //bool GetWarpedMarker(cv::Mat &image);
112 void rotateXAxis(cv::Mat& rotation);
113protected :
114
115private :
116 /* Default constructor */
117 ArMarker();
118};
119
120#endif
Vector3 GetPosition()
Definition ArMarker.cpp:72
boost::mutex markerMutex
Definition ArMarker.h:48
Vector3 GetPixelPosition()
Definition ArMarker.cpp:78
Vector3 m_pixel_pos
Definition ArMarker.h:52
bool IsVisible()
Definition ArMarker.cpp:106
boost::mutex m_thread_lock
Definition ArMarker.h:50
unsigned int GetID()
Definition ArMarker.cpp:90
boost::mutex killMutex
Definition ArMarker.h:49
void rotateXAxis(cv::Mat &rotation)
Definition ArMarker.cpp:308
BtQuaternion m_orientation
Definition ArMarker.h:53
void SetPixelPosition(Vector3 pixelpos)
Definition ArMarker.cpp:62
void Update(ArCameraParam &camparam, aruco::Marker &marker, bool reverse)
Definition ArMarker.cpp:167
Vector3 m_pos
Definition ArMarker.h:51
@ AR_ARUCO_MARKER
Definition ArMarker.h:42
@ AR_ARTK_FFT_MARKER
Definition ArMarker.h:45
@ AR_FACE_MARKER
Definition ArMarker.h:44
@ AR_FFT_MARKER
Definition ArMarker.h:43
void Draw(cv::Mat image)
Definition ArMarker.cpp:125
void SetSize(float size)
Definition ArMarker.cpp:113
void SetPosition(Vector3 pos)
Definition ArMarker.cpp:57
void SetOrientation(BtQuaternion orientation)
Definition ArMarker.cpp:67
bool m_needUpdate
Definition ArMarker.h:55
float m_size
Definition ArMarker.h:56
float GetSize()
Definition ArMarker.cpp:119
void SetCoords(std::vector< cv::Point2f > coords)
Definition ArMarker.cpp:158
bool m_bUpdating
Definition ArMarker.h:57
cv::Mat GetMarkerBitmap(int size)
Definition ArMarker.cpp:47
virtual ~ArMarker()
Definition ArMarker.cpp:43
bool m_visible
Definition ArMarker.h:54
std::vector< cv::Point2f > GetCorners()
Definition ArMarker.cpp:325
BtQuaternion GetOrientation()
Definition ArMarker.cpp:84
void SetVisible(bool visible)
Definition ArMarker.cpp:100
MarkerType GetType()
Definition ArMarker.cpp:95