Surface
detect surface points in an image stack
Data Structures | Defines | Functions | Variables
surface_viewer.cpp File Reference

View a detected surface in an OpenGL/GLUT environment. More...

#include <config.h>
#include <cstdlib>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <iostream>
#include <sstream>
#include <vector>
#include <inttypes.h>
#include <jwsc/math/constants.h>
#include <jwsc/vector/vector.h>
#include <jwsc/vector/vector_math.h>
#include <jwsc/matrix/matrix.h>
#include <jwsc/matrix/matrix_math.h>
#include <jwsc/image/image.h>
#include <jwsc/image/image_io.h>
#include <jwsc/imgblock/surface.h>
#include <jwsc++/base/option.h>
#include <jwsc++/base/exception.h>
#include <jwsc++/graphics/camera.h>

Go to the source code of this file.

Data Structures

struct  Surface_viewer_modes
 Modes the viewer can be in. More...

Defines

#define REDBLUE   1
#define REDGREEN   2
#define REDCYAN   3
#define BLUERED   4
#define GREENRED   5
#define CYANRED   6
#define VIEW_WIDTH   800
#define VIEW_HEIGHT   800
#define APERTURE   60.0f
#define CLIP_NEAR   10.0f
#define CLIP_FAR   3000.0f
#define GLASSES_TYPE   REDCYAN
#define CAPTURE_FNAME   "capture.tiff"
#define PATCH_SIZE   2.0
#define SURFACE_SCALE   1.0
#define X_SCALE   1.0
#define Y_SCALE   1.0
#define Z_SCALE   1.4
#define SAMPLE_RATE   1.0

Functions

void init_modes ()
 Initialize the viewer modes.
void init_camera () throw (Arg_error)
 Initializes the camera to default values.
void reset ()
 Resets the state of the viewer.
void capture_view ()
 Capture the current view and write it as an image.
void render_world_axis ()
 Renders the 3D world axis.
void render_focal_plane ()
 Renders the focal plane.
void render_scene ()
 Renders the scene into the viewer.
void display_glut_anaglyph ()
 Display the model as an anaglyph (3D stereo pair).
void display_glut_regular ()
 Display the model under normal conditions.
void display_glut ()
 Display callback for the GLUT library.
void reshape_glut (int w, int h)
 Reshape callback for the GLUT library.
void keyboard_glut (unsigned char key, int a, int b)
 Keyboard callback for the GLUT library.
void main_menu_glut (int id)
 Main menu callback for the GLUT library.
void option_menu_glut (int id)
 Option submenu callback for the GLUT library.
void navigation_menu_glut (int id)
 Keyboard navigation submenu callback for the GLUT library.
void focal_length_menu_glut (int id)
 Focal length submenu callback for the GLUT library.
void init_glut (int argc, char **argv)
 Initializes the GLUT to default values.
void init_gl ()
 Initializes the GL to default values.
void print_usage (void)
 Prints the usage of the program.
void process_help_opt (void)
 Processes the 'help' program options.
void process_version_opt (void)
 Processes the 'version' program options.
void process_size_opt (const char *arg) throw (Arg_error)
 Processes the 'size' program options.
void process_glasses_opt (const char *arg) throw (Arg_error)
 Processes the 'glasses' program options.
void process_capture_opt (const char *arg) throw (Arg_error)
 Processes the 'capture' program options.
void process_surf_scale_opt (const char *arg) throw (Arg_error)
 Processes the 'surf-scale' program options.
void process_sample_rate_opt (const char *arg) throw (Arg_error)
 Processes the 'sample-rate' program options.
void process_patch_size_opt (const char *arg) throw (Arg_error)
 Processes the 'patch-size' program options.
void init_options ()
 Initialize the options.
void read_surface_data (const char *surface_fname) throw (Exception)
 Reads the surface to points and creates the surface patches.
int main (int argc, char **argv)
 Main function for surface-viewer.

Variables

Optionsopts = 0
 Program options.
uint32_t view_width = VIEW_WIDTH
 Width of the viewing window.
uint32_t view_height = VIEW_HEIGHT
 Height of the viewing window.
float aperture = APERTURE
 Viewing aperture.
float clip_near = CLIP_NEAR
 Near clipping plane.
float clip_far = CLIP_FAR
 Far clipping plane.
int glasses_type = GLASSES_TYPE
 Anaglyph glasses type.
const char * capture_fname = CAPTURE_FNAME
 Name of the file to write the captured view image to.
float surface_scale = SURFACE_SCALE
 Scale of the surface.
float surface_patch_size = PATCH_SIZE
 Size of the patch representing each surface point.
float x_scale = X_SCALE
 Number of X coordinate world units per column value in a surface point.
float y_scale = Y_SCALE
 Number of Y coordinate world units per row value in a surface point.
float z_scale = Z_SCALE
 Number of Z coordinate world units per image value in a surface point.
float sample_rate = SAMPLE_RATE
 Size of the patch representing each surface point. float patch_size = PATCH_SIZE;.
Stereo_camera_fcamera = 0
 3D viewing camera.
GLUquadric * quad_fill = 0
 Filled quadric.
list< Surface_patch_f * > * surface = 0
 Alternaria surface to compare with.
Vector_fpatch_offset = 0
 Average of all the surface patch positions.
struct Surface_viewer_modes modes

Detailed Description

View a detected surface in an OpenGL/GLUT environment.

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

Definition in file surface_viewer.cpp.


Define Documentation

#define REDBLUE   1

Definition at line 88 of file surface_viewer.cpp.

#define REDGREEN   2

Definition at line 89 of file surface_viewer.cpp.

#define REDCYAN   3

Definition at line 90 of file surface_viewer.cpp.

#define BLUERED   4

Definition at line 91 of file surface_viewer.cpp.

#define GREENRED   5

Definition at line 92 of file surface_viewer.cpp.

#define CYANRED   6

Definition at line 93 of file surface_viewer.cpp.

#define VIEW_WIDTH   800

Definition at line 96 of file surface_viewer.cpp.

#define VIEW_HEIGHT   800

Definition at line 97 of file surface_viewer.cpp.

#define APERTURE   60.0f

Definition at line 98 of file surface_viewer.cpp.

#define CLIP_NEAR   10.0f

Definition at line 99 of file surface_viewer.cpp.

#define CLIP_FAR   3000.0f

Definition at line 100 of file surface_viewer.cpp.

#define GLASSES_TYPE   REDCYAN

Definition at line 101 of file surface_viewer.cpp.

#define CAPTURE_FNAME   "capture.tiff"

Definition at line 102 of file surface_viewer.cpp.

#define PATCH_SIZE   2.0

Definition at line 103 of file surface_viewer.cpp.

#define SURFACE_SCALE   1.0

Definition at line 104 of file surface_viewer.cpp.

#define X_SCALE   1.0

Definition at line 105 of file surface_viewer.cpp.

#define Y_SCALE   1.0

Definition at line 106 of file surface_viewer.cpp.

#define Z_SCALE   1.4

Definition at line 107 of file surface_viewer.cpp.

#define SAMPLE_RATE   1.0

Definition at line 108 of file surface_viewer.cpp.


Function Documentation

void init_modes ( )

Initialize the viewer modes.

Definition at line 229 of file surface_viewer.cpp.

void init_camera ( ) throw (Arg_error)

Initializes the camera to default values.

Definition at line 242 of file surface_viewer.cpp.

void reset ( )

Resets the state of the viewer.

Definition at line 251 of file surface_viewer.cpp.

void capture_view ( )

Capture the current view and write it as an image.

Definition at line 260 of file surface_viewer.cpp.

void render_world_axis ( )

Renders the 3D world axis.

Definition at line 287 of file surface_viewer.cpp.

void render_focal_plane ( )

Renders the focal plane.

Definition at line 338 of file surface_viewer.cpp.

void render_scene ( )

Renders the scene into the viewer.

Definition at line 388 of file surface_viewer.cpp.

void display_glut_anaglyph ( )

Display the model as an anaglyph (3D stereo pair).

Reset the color mask.

Definition at line 435 of file surface_viewer.cpp.

void display_glut_regular ( )

Display the model under normal conditions.

Definition at line 540 of file surface_viewer.cpp.

void display_glut ( )

Display callback for the GLUT library.

Definition at line 573 of file surface_viewer.cpp.

void reshape_glut ( int  w,
int  h 
)

Reshape callback for the GLUT library.

Definition at line 594 of file surface_viewer.cpp.

void keyboard_glut ( unsigned char  key,
int  a,
int  b 
)

Keyboard callback for the GLUT library.

Definition at line 603 of file surface_viewer.cpp.

void main_menu_glut ( int  id)

Main menu callback for the GLUT library.

Definition at line 843 of file surface_viewer.cpp.

void option_menu_glut ( int  id)

Option submenu callback for the GLUT library.

Definition at line 861 of file surface_viewer.cpp.

void navigation_menu_glut ( int  id)

Keyboard navigation submenu callback for the GLUT library.

Definition at line 881 of file surface_viewer.cpp.

void focal_length_menu_glut ( int  id)

Focal length submenu callback for the GLUT library.

Definition at line 901 of file surface_viewer.cpp.

void init_glut ( int  argc,
char **  argv 
)

Initializes the GLUT to default values.

Definition at line 917 of file surface_viewer.cpp.

void init_gl ( )

Initializes the GL to default values.

Definition at line 954 of file surface_viewer.cpp.

void print_usage ( void  )

Prints the usage of the program.

Definition at line 988 of file surface_viewer.cpp.

void process_help_opt ( void  )

Processes the 'help' program options.

Definition at line 996 of file surface_viewer.cpp.

void process_version_opt ( void  )

Processes the 'version' program options.

Definition at line 1003 of file surface_viewer.cpp.

void process_size_opt ( const char *  arg) throw (Arg_error)

Processes the 'size' program options.

Definition at line 1010 of file surface_viewer.cpp.

void process_glasses_opt ( const char *  arg) throw (Arg_error)

Processes the 'glasses' program options.

Definition at line 1031 of file surface_viewer.cpp.

void process_capture_opt ( const char *  arg) throw (Arg_error)

Processes the 'capture' program options.

Definition at line 1056 of file surface_viewer.cpp.

void process_surf_scale_opt ( const char *  arg) throw (Arg_error)

Processes the 'surf-scale' program options.

Definition at line 1066 of file surface_viewer.cpp.

void process_sample_rate_opt ( const char *  arg) throw (Arg_error)

Processes the 'sample-rate' program options.

Definition at line 1083 of file surface_viewer.cpp.

void process_patch_size_opt ( const char *  arg) throw (Arg_error)

Processes the 'patch-size' program options.

Definition at line 1097 of file surface_viewer.cpp.

void init_options ( )

Initialize the options.

Definition at line 1110 of file surface_viewer.cpp.

void read_surface_data ( const char *  surface_fname) throw (Exception)

Reads the surface to points and creates the surface patches.

Definition at line 1154 of file surface_viewer.cpp.

int main ( int  argc,
char **  argv 
)

Main function for surface-viewer.

Definition at line 1198 of file surface_viewer.cpp.


Variable Documentation

Options* opts = 0

Program options.

Definition at line 125 of file surface_viewer.cpp.

uint32_t view_width = VIEW_WIDTH

Width of the viewing window.

Definition at line 128 of file surface_viewer.cpp.

uint32_t view_height = VIEW_HEIGHT

Height of the viewing window.

Definition at line 131 of file surface_viewer.cpp.

float aperture = APERTURE

Viewing aperture.

Definition at line 134 of file surface_viewer.cpp.

float clip_near = CLIP_NEAR

Near clipping plane.

Definition at line 137 of file surface_viewer.cpp.

float clip_far = CLIP_FAR

Far clipping plane.

Definition at line 140 of file surface_viewer.cpp.

int glasses_type = GLASSES_TYPE

Anaglyph glasses type.

Definition at line 143 of file surface_viewer.cpp.

const char* capture_fname = CAPTURE_FNAME

Name of the file to write the captured view image to.

Definition at line 146 of file surface_viewer.cpp.

float surface_scale = SURFACE_SCALE

Scale of the surface.

Definition at line 149 of file surface_viewer.cpp.

float surface_patch_size = PATCH_SIZE

Size of the patch representing each surface point.

Definition at line 152 of file surface_viewer.cpp.

float x_scale = X_SCALE

Number of X coordinate world units per column value in a surface point.

Definition at line 158 of file surface_viewer.cpp.

float y_scale = Y_SCALE

Number of Y coordinate world units per row value in a surface point.

Definition at line 164 of file surface_viewer.cpp.

float z_scale = Z_SCALE

Number of Z coordinate world units per image value in a surface point.

Definition at line 170 of file surface_viewer.cpp.

float sample_rate = SAMPLE_RATE

Size of the patch representing each surface point. float patch_size = PATCH_SIZE;.

Sampling rate for the surface points.

Definition at line 177 of file surface_viewer.cpp.

3D viewing camera.

Definition at line 180 of file surface_viewer.cpp.

GLUquadric* quad_fill = 0

Filled quadric.

Definition at line 183 of file surface_viewer.cpp.

list<Surface_patch_f*>* surface = 0

Alternaria surface to compare with.

Definition at line 186 of file surface_viewer.cpp.

Average of all the surface patch positions.

Definition at line 189 of file surface_viewer.cpp.