资源简介
利用LK光流法跟踪ORB特征点,利用solvePnP计算相机姿态,并控制opengl里的相机,在特征点处画AR物体。

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace cv;
using namespace std;
VideoCapture cap(0);
static int resolution_width = 640;
static int resolution_height = 480;
static int num_track = 4;
double camD[9] = {618.526381968738 0 310.8963715614199
0 619.4548980786033 248.6374860176724
0 0 1};
double distCoeffD[5] = {0.09367405350511771 -0.08731677320554751 0.002823563134787144 -1.246739177460954e-005 -0.0469061739387372};
Mat camera_matrix = Mat(33CV_64FC1camD);
Mat distortion_coefficients = Mat(51CV_64FC1distCoeffD);
vector objP;
Mat objPM;
vector rv(3) tv(3);
Mat rvecm(rv)tvecm(tv);
Mat gray prevGray image frame;
vector points[2];
vector keypoints;
vector initPoints;
vector recoveryPoints;
vector projectedPoints;
vector goodfeatures;
bool initflag = true;
bool needToGetgf = false;
bool needtomap = false;
bool needtokeeptime = false;
const int MAX_COUNT = 500;
size_t trackingpoints = 0;
Mat initdescriptors;
string msg;
int baseLine;
Size textSize;
DWORD t1t2;
int framenum = 0;
TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS 30 0.01);
Size subPixWinSize(1010)winSize(2121);
static void help()
{
// print a welcome message and the OpenCV version
cout << “\n\n“
“\nUser: cc.\n“
“\nUsing OpenCV version “ << CV_VERSION << endl;
cout << “\nHot keys: \n“
“ Tracking: \n“
“\tESC - quit the program\n“
“\tg - get the good corners\n“
“\tc - delete all the points\n“
“\tm - choose four points to track and update camera pose then\n“
“\t\t(To add a tracking point please click that point)\n“
“ Generation: \n“
“\tESC - quit the program\n“
“\te - change the view mode\n“<< endl;
}
void on_mouse(int eventint xint yint flag void *param)
{
if(event==CV_EVENT_LBUTTONDOWN)
{
if(needtomap && points[1].size() {
for(size_t i = 0;i {
if(abs(goodfeatures[i].x-x)+abs(goodfeatures[i].y-y)<5)
{
points[1].push_back(goodfeatures[i]);
initPoints.push_back(keypoints[i]);
trackingpoints++;
break;
}
}
Mat temp;
image.copyTo(temp);
for(size_t i = 0; i < points[1].size(); i++ )
{
circle( temp points[1][i] 3 Scalar(00255) -1 8);
}
msg = format( “Resolution: %d * %d. Corner number: %d. Tracked points: %d“(int)cap.get(CV_CAP_PROP_frame_WIDTH)(int)cap.get(CV_CAP_PROP_frame_HEIGHT)goodfeatures.size()trackingpoints);
baseLine = 0;
textSize =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4756 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\cPTAM_2.0.vcxproj
文件 941 2015-09-18 16:35 cPTAM_2.0\cPTAM_2.0\cPTAM_2.0.vcxproj.filters
文件 164 2015-11-02 16:48 cPTAM_2.0\cPTAM_2.0\cPTAM_2.0.vcxproj.user
文件 720 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\cl.command.1.tlog
文件 33262 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\CL.read.1.tlog
文件 492 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\CL.write.1.tlog
文件 94 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.lastbuildstate
文件 2447 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.log
文件 720 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\cl.command.1.tlog
文件 33554 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\CL.read.1.tlog
文件 664 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\CL.write.1.tlog
文件 194 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\cPTAM_2.0.lastbuildstate
文件 2244 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\li
文件 5640 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\li
文件 648 2015-11-02 17:28 cPTAM_2.0\cPTAM_2.0\Debug\cPTAM_2.0.tlog\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
文件 2 2015-11-02 16:36 cPTAM_2.0\cPTAM_2.0\Debug\li
............此处省略108个文件信息
相关资源
- EPSON XP225 xp235 xp245打印机清零软件+教
- PID_AutoTune_v0.rar
- IAR FOR 430 破解工具
- 西门坡论坛pb框架 普通版 2.0 非常漂
- 条码字体barcode128
- DV泵加罗茨泵独立控制系统PID.smart
- Xamarin forms 手势事件
- 秒杀360加壳.rar
- 200smart单按钮启停.smart
- IAR For ARM 7.3最新注册机
- 郭天祥ARM9视频教程
- IAR7.20H破解机注册机
- IAR ARM 7.8破解
- IAR 7.80.4的安装包
- IAR for MSP430 v7.10.1 注册机
- IAR-Keygen-2019+附使用教程.zip
- IAR 7.3 注册机
- IAR For ARM V5.5 注册机
- IAR for ARM 7.40 破解
- IAR For ARM 7.4 破解
- Reparatory Effects of Nicotine on NMDA Recepto
- Histamine excites rat lateral vestibular nucle
- Diltiazem augmented pentobarbital-induced LORR
- LenovoTinkPad; Marker 5.01
- 根据硬件ID和程序ID生成注册码
- Fabrication and all-optical poling characteris
- Quartus II 15.0中仿真Altera三速以太网I
- Quartus II 15.0中仿真Altera三速以太网I
- stm32f103c8t6 4 oled.rar
- VirTest5.0.rar
评论
共有 条评论