OmniGCardConverter Class Reference

#include <OmniGCardConverter.hh>

List of all members.


Detailed Description

Uses OpenGL, OpenCV, Cg, shaders, and other technologies to perform a conversion from an omnidirectional image to a panoramic one.

Definition at line 47 of file OmniGCardConverter.hh.

Public Member Functions

 OmniGCardConverter (double min_radius, double max_radius, double omni_center_x, double omni_center_y, unsigned int video_width, unsigned int video_height, char *program_name="omnigcardconverter_hardware", char *vertex_program_file_name="data/shaders/vertex_shader.cg", char *vertex_program_name="vertex_shader_main", char *fragment_program_file_name="data/shaders/pixel_shader.cg", char *fragment_program_name="pixel_shader_main", bool flipped_mode=false)
 Constructor.
virtual ~OmniGCardConverter ()
void angle_type_conversion (const OmniAngle< double > &in_double_interval, OmniAngle< int > &out_int_interval)
 Convert an OmniAngle object from its <double> version ot its <int>.
IplImage * omni2pano (IplImage *omni_frame, const OmniAngle< double > &IN_interval)
 Conversion between omni frame and panoramic one.
IplImage * omni2pano (IplImage *omni_frame, const OmniAngle< int > &IN_interval)
 Conversion between omni frame and panoramic one.
void pano2omni_xy (CvPoint *pano_point, double theta_start, CvPoint *omni_point)
 Converts a panoimage xy coord to a omniimage xy coord.
double get_min_radius ()
double get_max_radius ()
double get_omni_center_x ()
double get_omni_center_y ()
bool is_initialized ()
 Specify whether the class is initialized or not.

Static Public Member Functions

static bool check_for_3d_gcard_availability ()
 Check whether the graphic card is shader-compatible or not.

Private Member Functions

int get_texturized_video_size (int video_width, int video_height)
 Given a video format size, i.e.
void gl_paint (float slide=0.0f)
 OpenGL paint procedure.

Static Private Member Functions

static int check_for_cg_error (const char *situation, char *prg_name, CGcontext cg_ctx)
 Check if Cg APIs return errors.

Private Attributes

double _min_radius
double _max_radius
int _pano_width
 Width of the pano image.
int _pano_height
 Height of the pano image.
double _omni_center_x
double _omni_center_y
unsigned int _video_height
 The real video height in input.
unsigned int _video_width
unsigned int _hw_video_width
 The hardware width used to process the frame.
unsigned int _hw_video_height
 The hardware height used to process the frame.
bool _flipped_mode
 Should be the final panoramic image be flipped?
bool _initialized
 Specify whether the class is initialized or not.
CGcontext _cg_context
 Cg API and structs.
CGprofile _cg_vertex_profile
CGprofile _cg_fragment_profile
CGprogram _cg_vertex_program
CGprogram _cg_fragment_program
CGparameter _cg_vertex_param_min_radius_on_max_radius
CGparameter _cg_fragment_param_omni_tex
CGparameter _cg_fragment_param_center_x
CGparameter _cg_fragment_param_center_y
CGparameter _cg_fragment_param_width_on_height
CGparameter _cg_fragment_param_slide
char * _program_name
char * _vertex_program_file_name
char * _vertex_program_name
char * _fragment_program_file_name
char * _fragment_program_name
Display * _dpy
Window _win


Constructor & Destructor Documentation

OmniGCardConverter::OmniGCardConverter ( double  min_radius,
double  max_radius,
double  omni_center_x,
double  omni_center_y,
unsigned int  video_width,
unsigned int  video_height,
char *  program_name = "omnigcardconverter_hardware",
char *  vertex_program_file_name = "data/shaders/vertex_shader.cg",
char *  vertex_program_name = "vertex_shader_main",
char *  fragment_program_file_name = "data/shaders/pixel_shader.cg",
char *  fragment_program_name = "pixel_shader_main",
bool  flipped_mode = false 
)

Parameters:
min_radius Minimum radius to consider in an omnidirectional Image. This is done to avoid the super-definition of the pixels near the center.
max_radius The same as min_radius but for the external side.
omni_center_x The x-coordinate that represent the center of the omnidirectional image. It may differ from the normal image center.
omni_center_y The y-coordinate that represent the center of the omnidirectional image. It may differ from the normal image center.
video_width Image width
video_height Image height
program_name In a shader context it's the name of the program that will be uploaded to the GPU (graphic processing unit).
vertex_program_file_name Vertex program path
vertex_program_name Name of the Vertex shader program.
fragment_program_file_name Pixel shader program path.
fragment_program_name Name of the Pixel shader program.
flipped_mode Should the result panoramic image be flipped? This option is useful for special omnidirectional images and flipped mirrors.
See also:
http://developer.nvidia.com/object/cg_toolkit.html

Definition at line 118 of file OmniGCardConverter.cpp.

References _cg_context, _cg_fragment_param_center_x, _cg_fragment_param_center_y, _cg_fragment_param_omni_tex, _cg_fragment_param_slide, _cg_fragment_param_width_on_height, _cg_fragment_profile, _cg_fragment_program, _cg_vertex_param_min_radius_on_max_radius, _cg_vertex_profile, _cg_vertex_program, _dpy, _fragment_program_file_name, _fragment_program_name, _hw_video_height, _hw_video_width, _initialized, _max_radius, _min_radius, _omni_center_x, _omni_center_y, _pano_height, _pano_width, _program_name, _vertex_program_file_name, _vertex_program_name, _video_height, _video_width, _win, check_for_cg_error(), DEBUG_PRINT, get_texturized_video_size(), glx_init(), NULL, and wgl_init().

Here is the call graph for this function:

OmniGCardConverter::~OmniGCardConverter (  )  [virtual]

Definition at line 281 of file OmniGCardConverter.cpp.

References _dpy, _fragment_program_file_name, _fragment_program_name, _program_name, _vertex_program_file_name, _vertex_program_name, glx_deinit(), and wgl_deinit().

Here is the call graph for this function:


Member Function Documentation

void OmniGCardConverter::angle_type_conversion ( const OmniAngle< double > &  in_double_interval,
OmniAngle< int > &  out_int_interval 
)

Parameters:
in_double_interval Input angle.
out_int_interval Output converted angle.

Definition at line 33 of file OmniGCardConverter.cpp.

References _max_radius, _min_radius, _pano_width, OmniAngle< TypeT >::angle_end, OmniAngle< TypeT >::angle_start, is_initialized(), and OmniAngle< TypeT >::range.

Here is the call graph for this function:

bool OmniGCardConverter::check_for_3d_gcard_availability (  )  [static]

Can be used even without instantiate the class. Static method.

Returns:
true on success.

Definition at line 442 of file OmniGCardConverter.cpp.

References check_for_cg_error(), DEBUG_PRINT, glx_deinit(), glx_init(), NULL, wgl_deinit(), and wgl_init().

Referenced by DialogOptions::OnGcardUseClick().

Here is the call graph for this function:

Here is the caller graph for this function:

int OmniGCardConverter::check_for_cg_error ( const char *  situation,
char *  prg_name,
CGcontext  cg_ctx 
) [static, private]

Returns:
0 on ok, -1 on error

Definition at line 318 of file OmniGCardConverter.cpp.

References DEBUG_PRINT.

Referenced by check_for_3d_gcard_availability(), and OmniGCardConverter().

Here is the caller graph for this function:

double OmniGCardConverter::get_max_radius (  ) 

Definition at line 355 of file OmniGCardConverter.cpp.

References _max_radius.

double OmniGCardConverter::get_min_radius (  ) 

Definition at line 350 of file OmniGCardConverter.cpp.

References _min_radius.

double OmniGCardConverter::get_omni_center_x (  ) 

Definition at line 365 of file OmniGCardConverter.cpp.

References _omni_center_x.

double OmniGCardConverter::get_omni_center_y (  ) 

Definition at line 360 of file OmniGCardConverter.cpp.

References _omni_center_y.

int OmniGCardConverter::get_texturized_video_size ( int  video_width,
int  video_height 
) [private]

640x480, it returns 1024 as the higher next-power-of-two between 640 -> [1024] and 480 -> [512]. The final video size taken will be 1024x1024, this because of graphic card textures performances.

Definition at line 336 of file OmniGCardConverter.cpp.

Referenced by OmniGCardConverter().

Here is the caller graph for this function:

void OmniGCardConverter::gl_paint ( float  slide = 0.0f  )  [private]

Parameters:
slide Sliding parameter from 0. The pano image changes its bytes in a cyclic fashion.

Definition at line 375 of file OmniGCardConverter.cpp.

References _cg_fragment_param_center_x, _cg_fragment_param_center_y, _cg_fragment_param_omni_tex, _cg_fragment_param_slide, _cg_fragment_profile, _cg_fragment_program, _cg_vertex_profile, and _cg_vertex_program.

Referenced by omni2pano().

Here is the caller graph for this function:

bool OmniGCardConverter::is_initialized (  ) 

Definition at line 370 of file OmniGCardConverter.cpp.

References _initialized.

Referenced by angle_type_conversion(), StreamerCtrlThread::initializeOmniStuff(), and ReceiverCtrlThread::initializeOmniStuff().

Here is the caller graph for this function:

IplImage * OmniGCardConverter::omni2pano ( IplImage *  omni_frame,
const OmniAngle< int > &  IN_interval 
)

The great thing about this template is that you can overload as many time as you want this function, without change the main template.

Parameters:
omni_frame Frame of an omnidirectional image you want to convert to panoramic one.
IN_interval part of angle you want to convert to panoramic. It can also be specified as a 360 degree angle.

Definition at line 78 of file OmniGCardConverter.cpp.

References _flipped_mode, _pano_height, _pano_width, _video_height, _video_width, OmniAngle< TypeT >::angle_start, gl_paint(), and OmniAngle< TypeT >::range.

Here is the call graph for this function:

IplImage * OmniGCardConverter::omni2pano ( IplImage *  omni_frame,
const OmniAngle< double > &  IN_interval 
)

The great thing about this template is that you can overload as many time as you want this function, without change the main template.

Parameters:
omni_frame Frame of an omnidirectional image you want to convert to panoramic one.
IN_interval part of angle you want to convert to panoramic. It can also be specified as a 360 degree angle.
Note:
This is not used right now. It will return a NULL.

Definition at line 420 of file OmniGCardConverter.cpp.

References DEBUG_PRINT, and NULL.

void OmniGCardConverter::pano2omni_xy ( CvPoint *  pano_point,
double  theta_start,
CvPoint *  omni_point 
)

This function is useful if you want to pass from a omni2pano's image point with a start_angle theta back to the point of the original omni image.

Parameters:
pano_point The point in the panoramic image we want to convert.
theta_start The angle of the point.
omni_point The resulting point.
Note:
Often this function does not return the *exact* point.
Bug:
Should be revised and tested more.

Definition at line 427 of file OmniGCardConverter.cpp.

References _max_radius, _min_radius, _omni_center_x, and _omni_center_y.


Member Data Documentation

CGcontext OmniGCardConverter::_cg_context [private]

See also:
http://developer.nvidia.com/object/cg_toolkit.html

Definition at line 204 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_fragment_param_center_x [private]

Definition at line 209 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_fragment_param_center_y [private]

Definition at line 210 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_fragment_param_omni_tex [private]

Definition at line 208 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_fragment_param_slide [private]

Definition at line 212 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_fragment_param_width_on_height [private]

Definition at line 211 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().

CGprofile OmniGCardConverter::_cg_fragment_profile [private]

Definition at line 205 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGprogram OmniGCardConverter::_cg_fragment_program [private]

Definition at line 206 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGparameter OmniGCardConverter::_cg_vertex_param_min_radius_on_max_radius [private]

Definition at line 207 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().

CGprofile OmniGCardConverter::_cg_vertex_profile [private]

Definition at line 205 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

CGprogram OmniGCardConverter::_cg_vertex_program [private]

Definition at line 206 of file OmniGCardConverter.hh.

Referenced by gl_paint(), and OmniGCardConverter().

Display* OmniGCardConverter::_dpy [private]

Definition at line 228 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

bool OmniGCardConverter::_flipped_mode [private]

Definition at line 195 of file OmniGCardConverter.hh.

Referenced by omni2pano().

char* OmniGCardConverter::_fragment_program_file_name [private]

Definition at line 217 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

char* OmniGCardConverter::_fragment_program_name [private]

Definition at line 218 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

unsigned int OmniGCardConverter::_hw_video_height [private]

It should be a power of 2, as for the OpenGL textures.

Definition at line 192 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().

unsigned int OmniGCardConverter::_hw_video_width [private]

It should be a power of 2, as for the OpenGL textures.

Definition at line 189 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().

bool OmniGCardConverter::_initialized [private]

Definition at line 198 of file OmniGCardConverter.hh.

Referenced by is_initialized(), and OmniGCardConverter().

double OmniGCardConverter::_max_radius [private]

Definition at line 173 of file OmniGCardConverter.hh.

Referenced by angle_type_conversion(), get_max_radius(), OmniGCardConverter(), and pano2omni_xy().

double OmniGCardConverter::_min_radius [private]

Definition at line 172 of file OmniGCardConverter.hh.

Referenced by angle_type_conversion(), get_min_radius(), OmniGCardConverter(), and pano2omni_xy().

double OmniGCardConverter::_omni_center_x [private]

Definition at line 181 of file OmniGCardConverter.hh.

Referenced by get_omni_center_x(), OmniGCardConverter(), and pano2omni_xy().

double OmniGCardConverter::_omni_center_y [private]

Definition at line 182 of file OmniGCardConverter.hh.

Referenced by get_omni_center_y(), OmniGCardConverter(), and pano2omni_xy().

int OmniGCardConverter::_pano_height [private]

Definition at line 179 of file OmniGCardConverter.hh.

Referenced by omni2pano(), and OmniGCardConverter().

int OmniGCardConverter::_pano_width [private]

Definition at line 176 of file OmniGCardConverter.hh.

Referenced by angle_type_conversion(), omni2pano(), and OmniGCardConverter().

char* OmniGCardConverter::_program_name [private]

Definition at line 214 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

char* OmniGCardConverter::_vertex_program_file_name [private]

Definition at line 215 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

char* OmniGCardConverter::_vertex_program_name [private]

Definition at line 216 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter(), and ~OmniGCardConverter().

unsigned int OmniGCardConverter::_video_height [private]

Definition at line 185 of file OmniGCardConverter.hh.

Referenced by omni2pano(), and OmniGCardConverter().

unsigned int OmniGCardConverter::_video_width [private]

Definition at line 186 of file OmniGCardConverter.hh.

Referenced by omni2pano(), and OmniGCardConverter().

Window OmniGCardConverter::_win [private]

Definition at line 229 of file OmniGCardConverter.hh.

Referenced by OmniGCardConverter().


The documentation for this class was generated from the following files:
Generated on Tue Dec 26 10:37:53 2006 for Omnimeeting by  doxygen 1.4.7