forked from TheFrenchLeaf/Bundler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSifterUtil.h
82 lines (62 loc) · 2.41 KB
/
SifterUtil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright (c) 2008-2010 Noah Snavely (snavely (at) cs.cornell.edu)
* and the University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
/* SifterUtil.h */
/* Various utility routines */
#ifndef ___sifter_util_h___
#define ___sifter_util_h___
#include "image.h"
#ifndef WIN32
#include <ext/hash_map>
#include <ext/hash_set>
#else
#include <hash_map>
#include <hash_set>
#endif
img_t *RescaleImage(img_t *img, double scale);
img_t *RescaleImage(img_t *img, int max_dim, double &scale);
void GetRotationFromSpherical(double theta, double phi, double *R);
/* Normalize a patch for mean and variance (in place) */
void NormalizePatchMeanVariance(int w, int h, double *patch);
/* Return the intersection of two int vectors */
std::vector<int> GetVectorIntersection(const std::vector<int> &v1,
const std::vector<int> &v2);
/* Returns true if the intersection of two int vectors is non empty*/
bool VectorIntersectionNonEmpty(const std::vector<int> &v1,
const std::vector<int> &v2);
std::vector<std::pair<int, int> >
GetArrayIntersectionSorted(int m, int n, const int *a1, const int *a2);
std::vector<std::pair<int, int> >
GetArrayIntersectionUnsorted(int m, int n, const int *a1, const int *a2);
double gain(double g, double x);
void choose(int n, int k, int *arr);
void generate_permutation(int n, int *arr);
void Tokenize(const std::string &str,
std::vector<std::string> &tokens,
const std::string &delimiters);
bool FileExists(const char *filename);
void ConvertRGBtoLAB(double r, double g, double b,
double &L, double &A, double &B);
void ConvertLABtoRGB(double L, double A, double B,
double &r, double &g, double &b);
extern double RGBtoLAB[9];
extern double RGBtoLAB_4x4[16];
extern double LABtoRGB[9];
#ifndef WIN32
typedef __gnu_cxx::hash_set<int> HashSetInt;
#else
typedef stdext::hash_set<int> HashSetInt;
#endif
#endif /* __sifter_util_h__ */