diff options
Diffstat (limited to 'SD-VBS/benchmarks/mser/src/matlab/old/mexutils.c')
| -rwxr-xr-x | SD-VBS/benchmarks/mser/src/matlab/old/mexutils.c | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/SD-VBS/benchmarks/mser/src/matlab/old/mexutils.c b/SD-VBS/benchmarks/mser/src/matlab/old/mexutils.c deleted file mode 100755 index 0fc664b..0000000 --- a/SD-VBS/benchmarks/mser/src/matlab/old/mexutils.c +++ /dev/null | |||
| @@ -1,111 +0,0 @@ | |||
| 1 | /* file: mexutils.c | ||
| 2 | ** author: Andrea Vedaldi | ||
| 3 | ** description: Utility functions to write MEX files. | ||
| 4 | **/ | ||
| 5 | |||
| 6 | #include"mex.h" | ||
| 7 | |||
| 8 | #undef M_PI | ||
| 9 | #define M_PI 3.14159265358979 | ||
| 10 | |||
| 11 | /** @brief Is scalar? | ||
| 12 | ** | ||
| 13 | ** @return @c true if the array @a A is a scalar. | ||
| 14 | **/ | ||
| 15 | int | ||
| 16 | uIsScalar(const mxArray* A) | ||
| 17 | { | ||
| 18 | return | ||
| 19 | !mxIsComplex(A) && | ||
| 20 | mxGetNumberOfDimensions(A) == 2 && | ||
| 21 | mxGetM(A) == 1 && | ||
| 22 | mxGetN(A) == 1 ; | ||
| 23 | } | ||
| 24 | |||
| 25 | /** @brief Is real scalar? | ||
| 26 | ** | ||
| 27 | ** @return @c true if the array @a A is a real scalar. | ||
| 28 | **/ | ||
| 29 | int | ||
| 30 | uIsRealScalar(const mxArray* A) | ||
| 31 | { | ||
| 32 | return | ||
| 33 | mxIsDouble(A) && | ||
| 34 | !mxIsComplex(A) && | ||
| 35 | mxGetNumberOfDimensions(A) == 2 && | ||
| 36 | mxGetM(A) == 1 && | ||
| 37 | mxGetN(A) == 1 ; | ||
| 38 | } | ||
| 39 | |||
| 40 | /** @brief Is real matrix? | ||
| 41 | ** | ||
| 42 | ** The function checks wether the argument @a A is a real matrix. In | ||
| 43 | ** addition, if @a M >= 0, it checks wether the number of rows is | ||
| 44 | ** equal to @a M and, if @a N >= 0, if the number of columns is equal | ||
| 45 | ** to @a N. | ||
| 46 | ** | ||
| 47 | ** @param M number of rows. | ||
| 48 | ** @param N number of columns. | ||
| 49 | ** @return @c true if the array is a real matrix with the specified format. | ||
| 50 | **/ | ||
| 51 | int | ||
| 52 | uIsRealMatrix(const mxArray* A, int M, int N) | ||
| 53 | { | ||
| 54 | return | ||
| 55 | mxIsDouble(A) && | ||
| 56 | !mxIsComplex(A) && | ||
| 57 | mxGetNumberOfDimensions(A) == 2 && | ||
| 58 | ((M>=0)?(mxGetM(A) == M):1) && | ||
| 59 | ((N>=0)?(mxGetN(A) == N):1) ; | ||
| 60 | } | ||
| 61 | |||
| 62 | /** @brief Is real vector? | ||
| 63 | ** | ||
| 64 | ** The function checks wether the argument @a V is a real vector. By | ||
| 65 | ** definiton, a matrix is a vector if one of its dimension is one. | ||
| 66 | ** In addition, if @a D >= 0, it checks wether the dimension of the | ||
| 67 | ** vecotr is equal to @a D. | ||
| 68 | ** | ||
| 69 | ** @param D lenght of the vector. | ||
| 70 | ** @return @c true if the array is a real vector of the specified dimension. | ||
| 71 | **/ | ||
| 72 | int | ||
| 73 | uIsRealVector(const mxArray* V, int D) | ||
| 74 | { | ||
| 75 | int M = mxGetM(V) ; | ||
| 76 | int N = mxGetN(V) ; | ||
| 77 | int is_vector = (N == 1) || (M == 1) ; | ||
| 78 | |||
| 79 | return | ||
| 80 | mxIsDouble(V) && | ||
| 81 | !mxIsComplex(V) && | ||
| 82 | mxGetNumberOfDimensions(V) == 2 && | ||
| 83 | is_vector && | ||
| 84 | ( D < 0 || N == D || M == D) ; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | /** @brief Is a string? | ||
| 89 | ** | ||
| 90 | ** The function checks wether the array @a S is a string. If | ||
| 91 | ** @a L is non-negative, it also check wether the strign has | ||
| 92 | ** length @a L. | ||
| 93 | ** | ||
| 94 | ** @return @a c true if S is a string of the specified length. | ||
| 95 | **/ | ||
| 96 | int | ||
| 97 | uIsString(const mxArray* S, int L) | ||
| 98 | { | ||
| 99 | int M = mxGetM(S) ; | ||
| 100 | int N = mxGetN(S) ; | ||
| 101 | |||
| 102 | return | ||
| 103 | mxIsChar(S) && | ||
| 104 | M == 1 && | ||
| 105 | (L < 0 || N == L) ; | ||
| 106 | } | ||
| 107 | |||
| 108 | /** | ||
| 109 | ** | ||
| 110 | **/ | ||
| 111 | |||
