环境:
#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;