opencv on mbed

Dependencies:   mbed

Committer:
joeverbout
Date:
Thu Mar 31 21:16:38 2016 +0000
Revision:
0:ea44dc9ed014
OpenCV on mbed attempt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeverbout 0:ea44dc9ed014 1 /*M///////////////////////////////////////////////////////////////////////////////////////
joeverbout 0:ea44dc9ed014 2 //
joeverbout 0:ea44dc9ed014 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
joeverbout 0:ea44dc9ed014 4 //
joeverbout 0:ea44dc9ed014 5 // By downloading, copying, installing or using the software you agree to this license.
joeverbout 0:ea44dc9ed014 6 // If you do not agree to this license, do not download, install,
joeverbout 0:ea44dc9ed014 7 // copy or use the software.
joeverbout 0:ea44dc9ed014 8 //
joeverbout 0:ea44dc9ed014 9 //
joeverbout 0:ea44dc9ed014 10 // License Agreement
joeverbout 0:ea44dc9ed014 11 // For Open Source Computer Vision Library
joeverbout 0:ea44dc9ed014 12 //
joeverbout 0:ea44dc9ed014 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
joeverbout 0:ea44dc9ed014 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
joeverbout 0:ea44dc9ed014 15 // Third party copyrights are property of their respective owners.
joeverbout 0:ea44dc9ed014 16 //
joeverbout 0:ea44dc9ed014 17 // Redistribution and use in source and binary forms, with or without modification,
joeverbout 0:ea44dc9ed014 18 // are permitted provided that the following conditions are met:
joeverbout 0:ea44dc9ed014 19 //
joeverbout 0:ea44dc9ed014 20 // * Redistribution's of source code must retain the above copyright notice,
joeverbout 0:ea44dc9ed014 21 // this list of conditions and the following disclaimer.
joeverbout 0:ea44dc9ed014 22 //
joeverbout 0:ea44dc9ed014 23 // * Redistribution's in binary form must reproduce the above copyright notice,
joeverbout 0:ea44dc9ed014 24 // this list of conditions and the following disclaimer in the documentation
joeverbout 0:ea44dc9ed014 25 // and/or other materials provided with the distribution.
joeverbout 0:ea44dc9ed014 26 //
joeverbout 0:ea44dc9ed014 27 // * The name of the copyright holders may not be used to endorse or promote products
joeverbout 0:ea44dc9ed014 28 // derived from this software without specific prior written permission.
joeverbout 0:ea44dc9ed014 29 //
joeverbout 0:ea44dc9ed014 30 // This software is provided by the copyright holders and contributors "as is" and
joeverbout 0:ea44dc9ed014 31 // any express or implied warranties, including, but not limited to, the implied
joeverbout 0:ea44dc9ed014 32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
joeverbout 0:ea44dc9ed014 33 // In no event shall the Intel Corporation or contributors be liable for any direct,
joeverbout 0:ea44dc9ed014 34 // indirect, incidental, special, exemplary, or consequential damages
joeverbout 0:ea44dc9ed014 35 // (including, but not limited to, procurement of substitute goods or services;
joeverbout 0:ea44dc9ed014 36 // loss of use, data, or profits; or business interruption) however caused
joeverbout 0:ea44dc9ed014 37 // and on any theory of liability, whether in contract, strict liability,
joeverbout 0:ea44dc9ed014 38 // or tort (including negligence or otherwise) arising in any way out of
joeverbout 0:ea44dc9ed014 39 // the use of this software, even if advised of the possibility of such damage.
joeverbout 0:ea44dc9ed014 40 //
joeverbout 0:ea44dc9ed014 41 //M*/
joeverbout 0:ea44dc9ed014 42
joeverbout 0:ea44dc9ed014 43 #ifndef _OPENCV_MINIFLANN_HPP_
joeverbout 0:ea44dc9ed014 44 #define _OPENCV_MINIFLANN_HPP_
joeverbout 0:ea44dc9ed014 45
joeverbout 0:ea44dc9ed014 46 #include "opencv2/core.hpp"
joeverbout 0:ea44dc9ed014 47 #include "opencv2/flann/defines.h"
joeverbout 0:ea44dc9ed014 48
joeverbout 0:ea44dc9ed014 49 namespace cv
joeverbout 0:ea44dc9ed014 50 {
joeverbout 0:ea44dc9ed014 51
joeverbout 0:ea44dc9ed014 52 namespace flann
joeverbout 0:ea44dc9ed014 53 {
joeverbout 0:ea44dc9ed014 54
joeverbout 0:ea44dc9ed014 55 struct CV_EXPORTS IndexParams
joeverbout 0:ea44dc9ed014 56 {
joeverbout 0:ea44dc9ed014 57 IndexParams();
joeverbout 0:ea44dc9ed014 58 ~IndexParams();
joeverbout 0:ea44dc9ed014 59
joeverbout 0:ea44dc9ed014 60 String getString(const String& key, const String& defaultVal=String()) const;
joeverbout 0:ea44dc9ed014 61 int getInt(const String& key, int defaultVal=-1) const;
joeverbout 0:ea44dc9ed014 62 double getDouble(const String& key, double defaultVal=-1) const;
joeverbout 0:ea44dc9ed014 63
joeverbout 0:ea44dc9ed014 64 void setString(const String& key, const String& value);
joeverbout 0:ea44dc9ed014 65 void setInt(const String& key, int value);
joeverbout 0:ea44dc9ed014 66 void setDouble(const String& key, double value);
joeverbout 0:ea44dc9ed014 67 void setFloat(const String& key, float value);
joeverbout 0:ea44dc9ed014 68 void setBool(const String& key, bool value);
joeverbout 0:ea44dc9ed014 69 void setAlgorithm(int value);
joeverbout 0:ea44dc9ed014 70
joeverbout 0:ea44dc9ed014 71 void getAll(std::vector<String>& names,
joeverbout 0:ea44dc9ed014 72 std::vector<int>& types,
joeverbout 0:ea44dc9ed014 73 std::vector<String>& strValues,
joeverbout 0:ea44dc9ed014 74 std::vector<double>& numValues) const;
joeverbout 0:ea44dc9ed014 75
joeverbout 0:ea44dc9ed014 76 void* params;
joeverbout 0:ea44dc9ed014 77 };
joeverbout 0:ea44dc9ed014 78
joeverbout 0:ea44dc9ed014 79 struct CV_EXPORTS KDTreeIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 80 {
joeverbout 0:ea44dc9ed014 81 KDTreeIndexParams(int trees=4);
joeverbout 0:ea44dc9ed014 82 };
joeverbout 0:ea44dc9ed014 83
joeverbout 0:ea44dc9ed014 84 struct CV_EXPORTS LinearIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 85 {
joeverbout 0:ea44dc9ed014 86 LinearIndexParams();
joeverbout 0:ea44dc9ed014 87 };
joeverbout 0:ea44dc9ed014 88
joeverbout 0:ea44dc9ed014 89 struct CV_EXPORTS CompositeIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 90 {
joeverbout 0:ea44dc9ed014 91 CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11,
joeverbout 0:ea44dc9ed014 92 cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
joeverbout 0:ea44dc9ed014 93 };
joeverbout 0:ea44dc9ed014 94
joeverbout 0:ea44dc9ed014 95 struct CV_EXPORTS AutotunedIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 96 {
joeverbout 0:ea44dc9ed014 97 AutotunedIndexParams(float target_precision = 0.8f, float build_weight = 0.01f,
joeverbout 0:ea44dc9ed014 98 float memory_weight = 0, float sample_fraction = 0.1f);
joeverbout 0:ea44dc9ed014 99 };
joeverbout 0:ea44dc9ed014 100
joeverbout 0:ea44dc9ed014 101 struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 102 {
joeverbout 0:ea44dc9ed014 103 HierarchicalClusteringIndexParams(int branching = 32,
joeverbout 0:ea44dc9ed014 104 cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 );
joeverbout 0:ea44dc9ed014 105 };
joeverbout 0:ea44dc9ed014 106
joeverbout 0:ea44dc9ed014 107 struct CV_EXPORTS KMeansIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 108 {
joeverbout 0:ea44dc9ed014 109 KMeansIndexParams(int branching = 32, int iterations = 11,
joeverbout 0:ea44dc9ed014 110 cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
joeverbout 0:ea44dc9ed014 111 };
joeverbout 0:ea44dc9ed014 112
joeverbout 0:ea44dc9ed014 113 struct CV_EXPORTS LshIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 114 {
joeverbout 0:ea44dc9ed014 115 LshIndexParams(int table_number, int key_size, int multi_probe_level);
joeverbout 0:ea44dc9ed014 116 };
joeverbout 0:ea44dc9ed014 117
joeverbout 0:ea44dc9ed014 118 struct CV_EXPORTS SavedIndexParams : public IndexParams
joeverbout 0:ea44dc9ed014 119 {
joeverbout 0:ea44dc9ed014 120 SavedIndexParams(const String& filename);
joeverbout 0:ea44dc9ed014 121 };
joeverbout 0:ea44dc9ed014 122
joeverbout 0:ea44dc9ed014 123 struct CV_EXPORTS SearchParams : public IndexParams
joeverbout 0:ea44dc9ed014 124 {
joeverbout 0:ea44dc9ed014 125 SearchParams( int checks = 32, float eps = 0, bool sorted = true );
joeverbout 0:ea44dc9ed014 126 };
joeverbout 0:ea44dc9ed014 127
joeverbout 0:ea44dc9ed014 128 class CV_EXPORTS_W Index
joeverbout 0:ea44dc9ed014 129 {
joeverbout 0:ea44dc9ed014 130 public:
joeverbout 0:ea44dc9ed014 131 CV_WRAP Index();
joeverbout 0:ea44dc9ed014 132 CV_WRAP Index(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
joeverbout 0:ea44dc9ed014 133 virtual ~Index();
joeverbout 0:ea44dc9ed014 134
joeverbout 0:ea44dc9ed014 135 CV_WRAP virtual void build(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
joeverbout 0:ea44dc9ed014 136 CV_WRAP virtual void knnSearch(InputArray query, OutputArray indices,
joeverbout 0:ea44dc9ed014 137 OutputArray dists, int knn, const SearchParams& params=SearchParams());
joeverbout 0:ea44dc9ed014 138
joeverbout 0:ea44dc9ed014 139 CV_WRAP virtual int radiusSearch(InputArray query, OutputArray indices,
joeverbout 0:ea44dc9ed014 140 OutputArray dists, double radius, int maxResults,
joeverbout 0:ea44dc9ed014 141 const SearchParams& params=SearchParams());
joeverbout 0:ea44dc9ed014 142
joeverbout 0:ea44dc9ed014 143 CV_WRAP virtual void save(const String& filename) const;
joeverbout 0:ea44dc9ed014 144 CV_WRAP virtual bool load(InputArray features, const String& filename);
joeverbout 0:ea44dc9ed014 145 CV_WRAP virtual void release();
joeverbout 0:ea44dc9ed014 146 CV_WRAP cvflann::flann_distance_t getDistance() const;
joeverbout 0:ea44dc9ed014 147 CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const;
joeverbout 0:ea44dc9ed014 148
joeverbout 0:ea44dc9ed014 149 protected:
joeverbout 0:ea44dc9ed014 150 cvflann::flann_distance_t distType;
joeverbout 0:ea44dc9ed014 151 cvflann::flann_algorithm_t algo;
joeverbout 0:ea44dc9ed014 152 int featureType;
joeverbout 0:ea44dc9ed014 153 void* index;
joeverbout 0:ea44dc9ed014 154 };
joeverbout 0:ea44dc9ed014 155
joeverbout 0:ea44dc9ed014 156 } } // namespace cv::flann
joeverbout 0:ea44dc9ed014 157
joeverbout 0:ea44dc9ed014 158 #endif
joeverbout 0:ea44dc9ed014 159