Skip to content

Commit

Permalink
Merge pull request OpenPTV#5 from yosefm/fb_submission
Browse files Browse the repository at this point in the history
First actual code in the common base. Contains useful tools for tracking and sequencing, and has potential to highly increase code quality compared to 3d-ptv. See discussion here:
https://groups.google.com/forum/?hl=en&fromgroups=#!topic/openptv/b_T8DvOYt88
  • Loading branch information
yosefm committed Mar 13, 2013
2 parents f6737df + ea0d70c commit efe353f
Show file tree
Hide file tree
Showing 12 changed files with 1,413 additions and 0 deletions.
30 changes: 30 additions & 0 deletions liboptv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Makefile
Makefile.in

aclocal.m4
autom4te.cache/
build-aux/

config.h
config.h.in
config.log
config.status
configure
libtool
m4/

src/.deps/
src/.libs/
src/Makefile
src/Makefile.in
src/liboptv.la
src/*.lo
src/*.o

tests/.deps/
tests/.libs/
tests/check_fb
tests/*.o

stamp-h1
3 changes: 3 additions & 0 deletions liboptv/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUBDIRS = src . tests
pkginclude_HEADERS = include/*

43 changes: 43 additions & 0 deletions liboptv/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Process this file with autoconf to produce a configure script.

# Prelude.
AC_PREREQ([2.59])
AC_INIT([optv], [0.1-dev], [openptv AT googlegroups.com])

# unique source file --- primitive safety check
AC_CONFIG_SRCDIR([.])
AC_CONFIG_MACRO_DIR([m4])

# place to put some extra build scripts installed
AC_CONFIG_AUX_DIR([build-aux])

# fairly severe build strictness
# change foreign to gnu or gnits to comply with gnu standards
AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.9.6])

# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL

# Checks for libraries.

# The testing framework Check.
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_MALLOC

# Output files
AC_CONFIG_HEADERS([config.h])

AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile])

AC_OUTPUT
99 changes: 99 additions & 0 deletions liboptv/include/tracking_frame_buf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
Definition for the tracking frame buffers. Each frame holds target information
for all cameras, correspondence information and path links information.
*/

#ifndef TRACKING_FRAME_BUF_H
#define TRACKING_FRAME_BUF_H

#define POSI 80
#define STR_MAX_LEN 255

typedef struct
{
int pnr;
double x, y;
int n, nx, ny, sumg;
int tnr;
}
target;

int compare_targets(target *t1, target *t2);
int read_targets(target buffer[], char* file_base, int frame_num);
int write_targets(target buffer[], int num_targets, char* file_base, \
int frame_num);

typedef struct
{
int nr;
int p[4];
}
corres;

int compare_corres(corres *c1, corres *c2);
#define CORRES_NONE -1

typedef double coord_t;
typedef float fitness_t;

typedef struct Pstruct
{
coord_t x[3]; /*coordinates*/
int prev, next; /*pointer to prev or next link*/
int prio; /*Prority of link is used for differen levels*/
fitness_t decis[POSI]; /*Bin for decision critera of possible links to next dataset*/
fitness_t finaldecis; /*final decision critera by which the link was established*/
int linkdecis[POSI]; /* pointer of possible links to next data set*/
int inlist; /* Counter of number of possible links to next data set*/
} P;

int compare_path_info(P *p1, P *p2);
void register_link_candidate(P *self, fitness_t fitness, int cand);
#define PREV_NONE -1
#define NEXT_NONE -2
#define PRIO_DEFAULT 2
void reset_links(P *self);

int read_path_frame(corres *cor_buf, P *path_buf, \
char *corres_file_base, char *linkage_file_base,
char *prio_file_base, int frame_num);
int write_path_frame(corres *cor_buf, P *path_buf, int num_parts,\
char *corres_file_base, char *linkage_file_base,
char *prio_file_base, int frame_num);

typedef struct {
P *path_info;
corres *correspond;
target **targets;
int num_cams, max_targets;
int num_parts; /* Number of 3D particles in the correspondence buffer */
int *num_targets; /* Pointer to array of 2D particle counts per image. */
} frame;

void frame_init(frame *new_frame, int num_cams, int max_targets);
void free_frame(frame *self);
int read_frame(frame *self, char *corres_file_base, char *linkage_file_base,
char *prio_file_base, char **target_file_base, int frame_num);
int write_frame(frame *self, char *corres_file_base, char *linkage_file_base,
char *prio_file_base, char **target_file_base, int frame_num);


typedef struct {
/* _ring_vec is the underlying double-size vector, buf is the pointer to
the start of the ring. */
frame **buf, **_ring_vec;
int buf_len, num_cams;
char *corres_file_base, *linkage_file_base, *prio_file_base;
char **target_file_base;
} framebuf;

void fb_init(framebuf *new_buf, int buf_len, int num_cams, int max_targets,\
char *corres_file_base, char* linkage_file_base, char *prio_file_base,
char **target_file_base);
void fb_free(framebuf *self);
void fb_next(framebuf *self);
void fb_prev(framebuf *self);
int fb_read_frame_at_end(framebuf *self, int frame_num, int read_links);
int fb_write_frame_from_start(framebuf *self, int frame_num);

#endif
6 changes: 6 additions & 0 deletions liboptv/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
lib_LTLIBRARIES = liboptv.la

liboptv_la_SOURCES = tracking_frame_buf.c ../include/tracking_frame_buf.h
liboptv_la_CFLAGS = -I../include/

Loading

0 comments on commit efe353f

Please sign in to comment.