1 /* 2 * libdvs.h - abstract header for DVS (Digital Video Stabilizer) 3 * 4 * Copyright (c) 2014-2016 Intel Corporation 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * Author: Zong Wei <wei.zong (at) intel.com> 19 */ 20 21 #ifndef _LIB_DVS_HPP 22 #define _LIB_DVS_HPP 23 24 #include <stdio.h> 25 26 #if (defined __linux__) 27 #define DVSAPI __attribute__((visibility("default"))) 28 #endif 29 30 typedef struct DvsData 31 { 32 cv::UMat data; 33 34 virtual ~DvsData () {}; 35 } DvsData; 36 37 38 typedef struct DvsResult 39 { 40 int frame_id; 41 bool valid; 42 int frame_width; 43 int frame_height; 44 double proj_mat[3][3]; 45 46 DvsResult(): frame_id(-1), valid(false) 47 {}; 48 } DvsResult; 49 50 51 typedef struct DvsConfig 52 { 53 bool use_ocl; //ture:ocl path; false:cpu path; 54 int frame_width; 55 int frame_height; 56 int radius; 57 float stdev; 58 int features; 59 double minDistance; 60 61 DvsConfig() 62 { 63 use_ocl = true; 64 frame_width = 1; 65 frame_height = 1; 66 radius = 15; 67 stdev = 10.0f; 68 features = 1000; 69 minDistance = 15.0f; 70 } 71 } DvsConfig; 72 73 typedef struct DvsInterface 74 { 75 virtual ~DvsInterface() {} 76 /// initialize model from memory 77 virtual int init(int width, int height, bool twoPass) = 0; 78 79 /// set detection parameters, if config = NULL, default parameters will be used 80 virtual void setConfig(DvsConfig* config) = 0; 81 82 /// release memory 83 virtual void release() = 0; 84 85 /// apply homography estimation to an input image 86 /// @param frame input 8-bit single channel UMAT image (color image must be transferred to gray-scale) 87 /// @param result output homography estimation result of the input image 88 virtual void nextStabilizedMotion(DvsData* frame, DvsResult* result) = 0; 89 90 } DvsInterface; 91 92 extern "C" DVSAPI DvsInterface* getDigitalVideoStabilizer(void); 93 94 #endif 95 96 97