Project

General

Profile

BitmapToolkit Scol plugin
ArFaceMarker_patch.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/*
26 Toolkit based on OpenCV library
27 First version : dec 2010
28 Author : Bastien BOURINEAU
29*/
30
31#ifndef __BTK_FACEMARKER_H__
32#define __BTK_FACEMARKER_H__
33
34#include "Prerequisites.h"
35#include <vector>
36#include <iostream>
37#include <opencv2/opencv.hpp>
38#include "opencv2/features2d/features2d.hpp"
39#include "cameraparameters.h"
40#include "marker.h"
41
46typedef struct model_struct FLANDMARK_Model;
47
48class ArFaceMarker : public aruco::Marker
49{
50public:
51 std::vector<cv::Point2f> m_lastCorner;
52 bool m_bInitialized;
53
56 ArFaceMarker(unsigned int mid);
57
61
64 void calculateFeaturedExtrinsics(float markerSize, aruco::CameraParameters& camParams, bool setYPerperdicular=true) throw(cv::Exception);
65
66 void SetImage(const cv::Mat image, std::vector<cv::Rect> objRects);
67
68 bool detectMotionFlow(cv::Mat &frame);
69
70private:
71 unsigned int m_maxFeatures;
72 cv::Mat m_image;
73 cv::Rect m_ObjRect;
74 cv::Mat m_prevFrame;
75 std::vector<std::vector<cv::Mat> > m_patches;
76 std::vector<cv::Point2f> m_pcorners;
77 std::vector<cv::Point2f> m_ObjPoints;
78 std::vector<bool> m_lastFound;
79 std::vector<cv::Point2f> m_prevFramePoints;
80 std::vector<cv::Mat> m_prevPyr;
81 std::vector<cv::Mat> m_nextPyr;
82 unsigned int m_nbInitFrames;
83 unsigned int m_initFrames;
84 unsigned int m_minInliners;
85 float m_matchScale;
86
87 bool GetCorners(std::vector<cv::Point2f> trainPoints, std::vector<cv::Point2f> framePoints);
88 cv::Point3f UnProjectPoint(cv::Point2f pt, cv::Point2f offset, float width, float height, float radius);
89
90 void GeneratePatches(const cv::Mat image, std::vector<cv::Point2f> points, int patchSize);
91 void GeneratePatches(const cv::Mat image, std::vector<cv::Rect> objRects);
92
93 cv::Rect scaleRect(cv::Rect& rect);
94 cv::Point2f scalePoint2f(cv::Point2f& pt);
95 cv::Rect unscaleRect(cv::Rect& rect);
96 cv::Point2f unscalePoint2f(cv::Point2f& pt);
97
98};
99
100#endif
struct model_struct FLANDMARK_Model
This class represents a marker. It is a vector of the fours corners ot the marker.
void SetImage(const cv::Mat image, std::vector< cv::Rect > objRects)
std::vector< cv::Point2f > m_lastCorner
void calculateFeaturedExtrinsics(float markerSize, aruco::CameraParameters &camParams, bool setYPerperdicular=true)
bool detectMotionFlow(cv::Mat &frame)
std::vector< cv::Point2f > GetCorners()
Definition ArMarker.cpp:325