记录 关于Video——stitching的问题

本文档探讨了使用OpenCV进行视频拼接时遇到的帧跟踪问题。在跟踪关键帧的过程中,注意到在特定条件下,关键帧的保存出现错误,导致后续关键帧与前一帧相同。代码中涉及了特征点检测、光流估计和homography矩阵计算等步骤,问题可能出现在这些环节。目前定位到问题发生于`frames.push_back(nextFrame)`之后,需要进一步检查代码逻辑以找出原因。
摘要由CSDN通过智能技术生成

环境:

#include <android/log.h>
#define TAG "myDemo-jni" // 閺夆晜鐟ら柌婊堝及椤栨繂娈伴悗瑙勭煯缁犵喖鎯冮崙銕闁汇劌瀚悥锝囨嫚閿燂拷
#define LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,TAG,__VA_ARGS__) // 閻庤鐭粻鐑睴GD缂侇偉顕ч悗锟�
//__android_log_print(ANDROID_LOG_INFO, "Loaded cascade classifier false", "Loaded cascade classifier false");


//鐠嬪啰鏁pencv鎼达拷
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include <opencv2/features2d/features2d.hpp> 
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/legacy/legacy.hpp>


//鐠嬪啰鏁lfeat鎼达拷
//extern "C" {
//#include <vl/generic.h>
//#include <vl/dsift.h>
//#include <vl/sift.h>
//}


//鐠嬪啰鏁ら崗鏈电铂鎼达拷
#include "Image.h"
#include "ImageFeature.h"
#include "feasTracking_fast.h"
//#include "ImageProcessing.h"
#include "project.h"
#include "BPFlow.h"
#include "vl_imwbackward.h"
#include "mosaicAll_inpainting.h"
#include "detectObject.h"
//鐠嬪啰鏁ら崗鏈电铂鎼达拷
#include <vector>
#include <math.h>
//#include <windows.h>
#include <stdio.h>


//鐠嬪啰鏁ら懛顏勭箒閸愭瑧娈戞径瀛樻瀮娴狅拷
#include "basic_function.h"
#include "computeDisp_.h"
//#include "face_detect.h"


using namespace std;
using namespace cv;


//vector<Mat> Keyframes;
//vector<Mat> H_ ;
extern string sensorPath_;


///#define OPEN_FROM_FILE
#define LOAD_FRAME


//const char *faceCascadeFilename = sensorPath_+"//"+"lbpcascade_frontalface.xml";
//const string faceCascadeFilename = sensorPath_+"//"+"lbpcascade_frontalface.xml";
//const char* video_addr = "videos\\2.avi";
const int resize_factor = 1;  
const double PI = 3.14159265; 
const bool try_use_gpu = true;
//float ratio = 0.5;


//Mat key_frame1, key_frame2;
//Mat H1, H2,H_temp,mid,ref_,mask,mos;
//vector<Mat> homography;
//int fuse_width =40,limit=2;


//Mat mid;
//Mat ,ref_;


Point motionFlow(vector<Point2f> &prev_points, vector<Point2f> &cur_points)
{
int sum_x = 0, sum_y = 0;
int ave_x, ave_y;
int sz = cur_points.size();
for (int i=0; i<cur_points.size(); i++)
{
sum_x += (cur_points[i].x - prev_points[i].x);
sum_y += (cur_points[i].y - prev_points[i].y);
}
ave_x = sum_x/sz;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值