Blender  V3.3
detect.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2011 libmv authors.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to
7 ** deal in the Software without restriction, including without limitation the
8 ** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 ** sell copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included in
13 ** all copies or substantial portions of the Software.
14 **
15 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 ** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 ** IN THE SOFTWARE.
22 **
23 ****************************************************************************/
24 
25 #ifndef LIBMV_SIMPLE_PIPELINE_DETECT_H_
26 #define LIBMV_SIMPLE_PIPELINE_DETECT_H_
27 
28 #include <iostream>
29 #include <vector>
30 
31 #include "libmv/base/vector.h"
32 #include "libmv/image/image.h"
33 
34 namespace libmv {
35 
36 typedef unsigned char ubyte;
37 
38 // A Feature is the 2D location of a detected feature in an image.
39 struct Feature {
40  Feature(float x, float y) : x(x), y(y) {}
41  Feature(float x, float y, float score, float size)
42  : x(x), y(y), score(score), size(size) {}
43 
44  // Position of the feature in pixels from top-left corner.
45  // Note: Libmv detector might eventually support subpixel precision.
46  float x, y;
47 
48  // An estimate of how well the feature will be tracked.
49  //
50  // Absolute values totally depends on particular detector type
51  // used for detection. It's only guaranteed that features with
52  // higher score from the same Detect() result will be tracked better.
53  float score;
54 
55  // An approximate feature size in pixels.
56  //
57  // If the feature is approximately a 5x5 square region, then size will be 5.
58  // It can be used as an initial pattern size to track the feature.
59  float size;
60 };
61 
62 struct DetectOptions {
63  DetectOptions();
64 
65  // TODO(sergey): Write descriptions to each of algorithms.
66  enum DetectorType {
70  };
72 
73  // Margin in pixels from the image boundary.
74  // No features will be detected within the margin.
75  int margin;
76 
77  // Minimal distance between detected features.
79 
80  // Minimum score to add a feature. Only used by FAST detector.
81  //
82  // TODO(sergey): Write more detailed documentation about which
83  // units this value is measured in and so on.
85 
86  // Maximum count to detect. Only used by MORAVEC detector.
88 
89  // Find only features similar to this pattern. Only used by MORAVEC detector.
90  //
91  // This is an image patch denoted in byte array with dimensions of 16px by
92  // 16px used to filter features by similarity to this patch.
93  unsigned char* moravec_pattern;
94 
95  // Threshold value of the Harris function to add new featrue
96  // to the result.
98 };
99 
100 // Detect features on a given image using given detector options.
101 //
102 // Image could have 1-4 channels, it'll be converted to a grayscale
103 // by the detector function if needed.
104 void Detect(const FloatImage& image,
105  const DetectOptions& options,
106  vector<Feature>* detected_features);
107 
108 std::ostream& operator<<(std::ostream& os, const Feature& feature);
109 
110 } // namespace libmv
111 
112 #endif
3D array (row, column, channel).
Definition: array_nd.h:325
CCL_NAMESPACE_BEGIN struct Options options
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
void Detect(const FloatImage &image, const DetectOptions &options, vector< Feature > *detected_features)
Definition: detect.cc:340
std::ostream & operator<<(std::ostream &os, const CameraIntrinsics &intrinsics)
A human-readable representation of the camera intrinsic parameters.
unsigned char ubyte
Definition: detect.h:36
unsigned char * moravec_pattern
Definition: detect.h:93
DetectorType type
Definition: detect.h:71
double harris_threshold
Definition: detect.h:97
int fast_min_trackness
Definition: detect.h:84
Feature(float x, float y)
Definition: detect.h:40
float size
Definition: detect.h:59
float score
Definition: detect.h:53
Feature(float x, float y, float score, float size)
Definition: detect.h:41
float x
Definition: detect.h:46
float y
Definition: detect.h:46