Polyfit
fit a polynomial
Defines | Functions | Variables
polyfit.c File Reference

Polynomial fit. More...

#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <jwsc/base/error.h>
#include <jwsc/base/option.h>
#include <jwsc/vector/vector.h>
#include <jwsc/matrix/matrix.h>
#include <jwsc/matrix/matrix_io.h>
#include <jwsc/matrix/matrix_math.h>
#include <jwsc/stat/regress.h>

Go to the source code of this file.

Defines

#define NUM_OPTS_NO_ARG   2
#define NUM_OPTS_WITH_ARG   4
#define DEFAULT_SEED   289375
#define DEFAULT_SIGMA   1.0f
#define DEFAULT_DEGREE   1
#define DEFAULT_RANSAC_ENABLED   0
#define DEFAULT_RANSAC_N   0
#define DEFAULT_RANSAC_K   0
#define DEFAULT_RANSAC_T   0
#define DEFAULT_RANSAC_D   0

Functions

static void print_usage (void)
 Prints the usage of the program.
static Errorprocess_help_opt (void)
 Processes the 'help' program options.
static Errorprocess_version_opt (void)
 Processes the 'version' program options.
static Errorprocess_seed_opt (Option_arg arg)
 Processes the 'seed' program options.
static Errorprocess_sigma_opt (Option_arg arg)
 Processes the 'sigma' program options.
static Errorprocess_degree_opt (Option_arg arg)
 Processes the 'degree' program options.
static Errorprocess_ransac_opt (Option_arg arg)
 Processes the 'ransac' program options.
int main (int argc, const char **argv)
 Main function for the polyfit program.

Variables

static Option_no_arg opts_no_arg [NUM_OPTS_NO_ARG]
 Program options taking no argument.
static Option_with_arg opts_with_arg [NUM_OPTS_WITH_ARG]
 Program options taking an argument.
static uint32_t seed = DEFAULT_SEED
 Random seed.
static float sigma = DEFAULT_SIGMA
 Sigma for smoothing the image.
static uint32_t degree = DEFAULT_DEGREE
 Degree of the polynomial.
struct {
   uint8_t   enabled
   uint32_t   n
   uint32_t   k
   float   t
   uint32_t   d
ransac

Detailed Description

Polynomial fit.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file polyfit.c.


Define Documentation

#define NUM_OPTS_NO_ARG   2

Definition at line 113 of file polyfit.c.

#define NUM_OPTS_WITH_ARG   4

Definition at line 114 of file polyfit.c.

#define DEFAULT_SEED   289375

Definition at line 116 of file polyfit.c.

#define DEFAULT_SIGMA   1.0f

Definition at line 117 of file polyfit.c.

#define DEFAULT_DEGREE   1

Definition at line 118 of file polyfit.c.

#define DEFAULT_RANSAC_ENABLED   0

Definition at line 120 of file polyfit.c.

#define DEFAULT_RANSAC_N   0

Definition at line 121 of file polyfit.c.

#define DEFAULT_RANSAC_K   0

Definition at line 122 of file polyfit.c.

#define DEFAULT_RANSAC_T   0

Definition at line 123 of file polyfit.c.

#define DEFAULT_RANSAC_D   0

Definition at line 124 of file polyfit.c.


Function Documentation

static void print_usage ( void  ) [static]

Prints the usage of the program.

Definition at line 155 of file polyfit.c.

static Error* process_help_opt ( void  ) [static]

Processes the 'help' program options.

Definition at line 164 of file polyfit.c.

static Error* process_version_opt ( void  ) [static]

Processes the 'version' program options.

Definition at line 171 of file polyfit.c.

static Error* process_seed_opt ( Option_arg  arg) [static]

Processes the 'seed' program options.

Definition at line 178 of file polyfit.c.

static Error* process_sigma_opt ( Option_arg  arg) [static]

Processes the 'sigma' program options.

Definition at line 192 of file polyfit.c.

static Error* process_degree_opt ( Option_arg  arg) [static]

Processes the 'degree' program options.

Definition at line 206 of file polyfit.c.

static Error* process_ransac_opt ( Option_arg  arg) [static]

Processes the 'ransac' program options.

Definition at line 220 of file polyfit.c.

int main ( int  argc,
const char **  argv 
)

Main function for the polyfit program.

Definition at line 239 of file polyfit.c.


Variable Documentation

Option_no_arg opts_no_arg[NUM_OPTS_NO_ARG] [static]

Program options taking no argument.

Definition at line 128 of file polyfit.c.

Option_with_arg opts_with_arg[NUM_OPTS_WITH_ARG] [static]

Program options taking an argument.

Definition at line 131 of file polyfit.c.

uint32_t seed = DEFAULT_SEED [static]

Random seed.

Definition at line 134 of file polyfit.c.

float sigma = DEFAULT_SIGMA [static]

Sigma for smoothing the image.

Definition at line 137 of file polyfit.c.

uint32_t degree = DEFAULT_DEGREE [static]

Degree of the polynomial.

Definition at line 140 of file polyfit.c.

uint8_t enabled

Definition at line 145 of file polyfit.c.

uint32_t n

Definition at line 146 of file polyfit.c.

uint32_t k

Definition at line 147 of file polyfit.c.

float t

Definition at line 148 of file polyfit.c.

uint32_t d

Definition at line 149 of file polyfit.c.

struct { ... } ransac [static]