Skip to content

Commit 7ab5fd8

Browse files
committed
Merge branch 'master' of https://github.com/openptv/openptv
2 parents 75b0835 + 4115bc3 commit 7ab5fd8

File tree

14 files changed

+248
-79
lines changed

14 files changed

+248
-79
lines changed

.gitignore

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@
33
.pydevproject
44
.pydevproject.bak
55

6-
py_bind/optv/*.c
6+
.idea/
7+
.vscode/
8+
env/
79

8-
*.pyc
10+
py_bind/c_src
11+
py_bind/optv/*.c
12+
py_bind/dist
13+
py_bind/build
14+
py_bind/liboptv
915

1016
liboptv/config.h.in~
11-
1217
liboptv/tests/check_fb.trs
1318
liboptv/build
14-
py_bind/build
1519
*~
1620

21+
py_bind/optv/*.c
22+
py_bind/build
23+
*.pyc

.travis.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
language: c
2-
compiler:
3-
- clang
4-
- gcc
1+
language: python
52

63
before_install:
74
- sudo apt-get -qq update
8-
- sudo apt-get install -y cmake
9-
- sudo apt-get install -y check
105
- sudo apt-get install -y build-essential
116
- sudo apt-get install -y git
7+
- sudo apt install python-pip
8+
- pip install numpy
9+
- pip install cython
1210

1311
install: true
1412

1513
script:
16-
- cd liboptv
17-
- mkdir _build && cd _build
18-
- cmake ../
19-
- make
20-
- make verify
14+
- cd py_bind
15+
- python setup.py prepare
16+
- python setup.py install
17+
- cd test
18+
- pip install nose
19+
- nosetests

docker/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# A Dockerfile for an Ubuntu machine that can compile liboptv and the Cython extensions
2+
3+
FROM ubuntu:18.04
4+
5+
RUN apt-get update
6+
RUN apt-get --assume-yes install cmake
7+
RUN apt-get --assume-yes install g++
8+
RUN apt-get --assume-yes install python-pip
9+
RUN pip install virtualenv
10+
RUN virtualenv /env --python=`which python2`

docker/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Set up the Ubuntu container so we can develop the Cython code on it
2+
version: '3'
3+
services:
4+
optv-dev:
5+
image: ptv-ubuntu:1
6+
build: ./
7+
volumes:
8+
- ../:/src
9+
command: tail -f /dev/null
10+

liboptv/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ tests/.libs/
2727
tests/check_fb
2828
tests/*.o
2929

30+
CMakeCache.txt
31+
*.cmake
32+
CMakeFiles/
33+
install_manifest.txt
34+
*.so
3035
stamp-h1

liboptv/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmake_minimum_required(VERSION 2.8)
22
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
33
project(OpenPTV)
4-
enable_testing()
4+
# enable_testing()
55
add_subdirectory(src)
6-
add_subdirectory(tests)
6+
# add_subdirectory(tests)
77

88
INSTALL(DIRECTORY include/ DESTINATION include/optv/)
99

liboptv/include/vec_utils.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ doubles.
77

88
#include <math.h>
99

10-
#define EMPTY_CELL 0.0/0.0
10+
#ifdef NAN
11+
#define EMPTY_CELL NAN
12+
#else
13+
#if _MSC_VER <= 1500 // Visual C 2008 - for Python 2.7, or earlier
14+
#define MSVC_NAN_REQUIRED
15+
double return_nan(void);
16+
#define EMPTY_CELL return_nan()
17+
#else // More modern compilers or non Visual Studio
18+
#define EMPTY_CELL 0.0/0.0
19+
#endif
20+
#endif
21+
1122
#define is_empty(x) isnan(x)
1223
#define norm(x,y,z) sqrt((x)*(x) + (y)*(y) + (z)*(z))
1324

liboptv/src/orientation.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ double* orient (Calibration* cal_in, control_par *cpar, int nfix, vec3d fix[],
262262
double *P, *y, *yh, *Xbeta, *resi;
263263
vec3d glass_dir, tmp_vec, e1, e2;
264264

265+
double (*X)[NPAR];
266+
double (*Xh)[NPAR];
267+
265268
Calibration *cal;
266269

267270
/* small perturbation for translation/rotation in meters and in radians */
@@ -278,8 +281,8 @@ double* orient (Calibration* cal_in, control_par *cpar, int nfix, vec3d fix[],
278281
Xbeta = (double *) calloc(maxsize, sizeof(double));
279282
resi = (double *) calloc(maxsize, sizeof(double));
280283

281-
double (*X)[NPAR] = malloc(sizeof (*X) * maxsize);
282-
double (*Xh)[NPAR] = malloc(sizeof (*Xh) * maxsize);
284+
X = malloc(sizeof (*X) * maxsize);
285+
Xh = malloc(sizeof (*Xh) * maxsize);
283286

284287
for(i = 0; i < maxsize; i++) {
285288
for(j = 0; j < NPAR; j++) {
@@ -759,13 +762,13 @@ int read_man_ori_fix(vec3d fix4[4], char* calblock_filename,
759762
* Returns: pointer to a new orient_par structure.
760763
*/
761764
orient_par* read_orient_par(char *filename) {
765+
orient_par *ret;
762766
FILE * file = fopen(filename, "r");
763767
if (file == NULL) {
764768
printf("Could not open orientation parameters file %s.\n", filename);
765769
return NULL;
766770
}
767771

768-
orient_par *ret;
769772
ret = malloc(sizeof(orient_par));
770773

771774
if ( !(fscanf(file, "%d", &ret->useflag)==1) /* use every point or every other pt */

liboptv/src/parameters.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,14 @@ int compare_mm_np(mm_np *mm_np1, mm_np *mm_np2)
476476
* Returns: pointer to a new target_par structure.
477477
*/
478478
target_par* read_target_par(char *filename) {
479+
target_par *ret;
480+
479481
FILE * file = fopen(filename, "r");
480482
if (file == NULL) {
481483
printf("Could not open target recognition parameters file %s.\n", filename);
482484
return NULL;
483485
}
484486

485-
target_par *ret;
486487
ret = malloc(sizeof(target_par));
487488

488489
if ( !(fscanf(file, "%d", &ret->gvthres[0])==1) /* threshold for binarization 1.image */

liboptv/src/track.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include <stdlib.h>
3232
#include <stdio.h>
3333

34+
#define _USE_MATH_DEFINES
35+
#include <math.h>
36+
3437
/* internal-use defines, not needed by the outside world. */
3538
#define TR_UNUSED -1
3639

0 commit comments

Comments
 (0)