ViSP
2.10.0
|
#include <vpAR.h>
Public Types | |
enum | vpImageType { grayImage, colorImage } |
enum | vpSimulatorViewType { INTERNAL, EXTERNAL } |
Public Member Functions | |
virtual | ~vpAR () |
void | initInternalViewer (const unsigned int width, const unsigned int height, vpImageType type=grayImage) |
void | setImage (vpImage< unsigned char > &I) |
void | setImage (vpImage< vpRGBa > &I) |
virtual void | mainLoop () |
virtual void | initInternalViewer (const unsigned int nlig, const unsigned int ncol) |
void | initExternalViewer (const unsigned int nlig, const unsigned int ncol) |
void | initApplication (void *(*start_routine)(void *)) |
void | initApplication (void *(*start_routine)(void *), void *data) |
void | initMainApplication () |
void | closeMainApplication () |
unsigned int | getInternalWidth () const |
unsigned int | getInternalHeight () const |
void | addObject (SoSeparator *newObject, const vpHomogeneousMatrix &fMo) |
void | redraw () |
void | load (const char *file_name) |
void | load (const char *iv_filename, const vpHomogeneousMatrix &fMo) |
void | save (const char *name, bool binary=false) |
void | addAbsoluteFrame (float zoom=1) |
void | addFrame (const vpHomogeneousMatrix &fMo, float zoom=1) |
void | setZoomFactor (const float zoom) |
void | setCameraPosition (vpHomogeneousMatrix &cMf) |
void | getCameraPosition (vpHomogeneousMatrix &_cMf) |
void | moveInternalCamera (vpHomogeneousMatrix &cMf) |
void | setInternalCameraParameters (vpCameraParameters &cam) |
void | setExternalCameraParameters (vpCameraParameters &cam) |
void | getExternalCameraPosition (vpHomogeneousMatrix &cMf) |
void | getInternalImage (vpImage< unsigned char > &I) |
void | getInternalImage (vpImage< vpRGBa > &I) |
void | changeZoomFactor (const float zoom, const int index) |
void | write (const char *fileName) |
unsigned char * | getBufferedOffScreenRenderer () |
void | getSizeInternalView (int &width, int &height) |
void | getCameraParameters (vpCameraParameters &cam) |
Public Attributes | |
vpImageType | typeImage |
GLubyte * | image_background |
unsigned char * | bufferView |
int | get |
Protected Member Functions | |
void | init () |
void | kill () |
void | initSoApplication () |
void | initSceneGraph () |
void | addObject (SoSeparator *object, const vpHomogeneousMatrix &fMo, SoSeparator *root) |
void | offScreenRendering (vpSimulatorViewType view=vpSimulator::EXTERNAL, int *width=NULL, int *height=NULL) |
Protected Attributes | |
HWND | mainWindow |
bool | mainWindowInitialized |
vpViewer * | internalView |
vpViewer * | externalView |
SbThread * | mainThread |
unsigned int | internal_width |
unsigned int | internal_height |
unsigned int | external_width |
unsigned int | external_height |
SoSeparator * | scene |
SoSeparator * | internalRoot |
SoSeparator * | externalRoot |
SoPerspectiveCamera * | internalCamera |
SoPerspectiveCamera * | externalCamera |
SoTransform * | internalCameraPosition |
SoTransform * | extrenalCameraPosition |
SoSeparator * | internalCameraObject |
float | zoomFactor |
bool | cameraPositionInitialized |
vpHomogeneousMatrix | cMf |
vpCameraParameters | internalCameraParameters |
vpCameraParameters | externalCameraParameters |
SbTime * | realtime |
SoOffscreenRenderer * | offScreenRenderer |
Implementation of an augmented reality viewer.
This class can be used to display an image behind the internal view of the simulator used for augmented reality application.
The code below shows how to use the class.
|
inherited |
Enumerator | |
---|---|
grayImage | |
colorImage |
Definition at line 131 of file vpSimulator.h.
|
inherited |
Enumerator | |
---|---|
INTERNAL | |
EXTERNAL |
Definition at line 274 of file vpSimulator.h.
|
virtual |
Basic Destructor that calls the kill() method of the vpSimulator class.
Definition at line 79 of file vpAR.cpp.
References vpSimulator::kill().
|
inherited |
Add the representation of the absolute frame.
zoom | : Zoom factor. |
Definition at line 778 of file vpSimulator.cpp.
References vpSimulator::scene.
|
inherited |
Add the representation of a frame.
Add the representation of a frame.
fMo | : desired position of the frame |
zoom | : Zoom factor. |
Definition at line 758 of file vpSimulator.cpp.
References vpSimulator::addObject(), and vpSimulator::externalRoot.
|
protectedinherited |
Add a new object in the scene graph ad a given location.
Add an object in a sub scene graph.
object | : pointer toward the new object |
fMo | : position of the object wrt the reference frame |
root | : pointer toward the subscene graph |
Definition at line 850 of file vpSimulator.cpp.
Referenced by vpSimulator::addFrame(), vpSimulator::addObject(), and vpSimulator::load().
|
inherited |
Add a new object in the scene graph ad a given location.
Add a new object in the scene graph.
newObject | : pointer toward the new object |
fMo | : position of the object wrt the reference frame |
Definition at line 825 of file vpSimulator.cpp.
References vpSimulator::addObject(), vpSimulator::scene, and vpERROR_TRACE.
|
inherited |
Change the zoom factor associated to the child given by index. In order to create multiple zoom factor for multiple object to display, objects loaded the load() function, you have to know the index of the scale object associated to.
Usually, if you define the main zoom factor (for example for the frames) and then load two differents objects, You can change the zoom factor of all the objects using: changeZoomFactor(newZoom, 0)
If you want to change the zoom factor of the first object, use changeZoomFactor(newZoom, 1)
And for the second object, use changeZoomFactor(newZoom, 3)
zoomFactor | : the new zoom use to specify the apparent size of the object |
index | : the index of the Scale object to modify (see comments) |
Definition at line 464 of file vpSimulator.cpp.
References vpSimulator::scene.
|
inherited |
performed some thread destruction in the main program thread should be locate at the end of the main program
Definition at line 933 of file vpSimulator.cpp.
|
inlineinherited |
get the image corresponding to the internal view
Definition at line 290 of file vpSimulator.h.
|
inlineinherited |
get the intrinsic parameters of the camera
Definition at line 299 of file vpSimulator.h.
|
inlineinherited |
get the camera position (from an homogeneous matrix)
Definition at line 256 of file vpSimulator.h.
|
inherited |
get the external camera position
Definition at line 577 of file vpSimulator.cpp.
References vpSimulator::externalCamera, and vpHomogeneousMatrix::inverse().
|
inlineinherited |
Return the height of the internal view.
Definition at line 186 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw().
|
inherited |
get an Image of the internal view
Make a copy of the current internal view
I | : destination image |
Definition at line 1086 of file vpSimulator.cpp.
References vpImage< Type >::bitmap, vpSimulator::bufferView, vpSimulator::internal_height, vpSimulator::internal_width, vpImage< Type >::resize(), and vpImageConvert::RGBToGrey().
get an Image of the internal view
Make a copy of the current internal view
I | : destination image |
Definition at line 1072 of file vpSimulator.cpp.
References vpImage< Type >::bitmap, vpSimulator::bufferView, vpSimulator::internal_height, vpSimulator::internal_width, vpImage< Type >::resize(), and vpImageConvert::RGBToRGBa().
|
inlineinherited |
Return the width of the internal view.
Definition at line 180 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw().
|
inherited |
get the size of the internal view
Definition at line 1059 of file vpSimulator.cpp.
|
protectedinherited |
perform some initialization
Definition at line 274 of file vpSimulator.cpp.
References vpSimulator::bufferView, vpSimulator::cameraPositionInitialized, vpSimulator::external_height, vpSimulator::external_width, vpSimulator::externalCamera, vpSimulator::externalRoot, vpSimulator::externalView, vpSimulator::extrenalCameraPosition, vpSimulator::grayImage, vpSimulator::image_background, vpSimulator::internal_height, vpSimulator::internal_width, vpSimulator::internalCamera, vpSimulator::internalCameraObject, vpSimulator::internalCameraPosition, vpSimulator::internalRoot, vpSimulator::internalView, vpSimulator::mainThread, vpSimulator::mainWindow, vpSimulator::mainWindowInitialized, vpSimulator::offScreenRenderer, vpSimulator::realtime, vpSimulator::scene, vpSimulator::typeImage, and vpSimulator::zoomFactor.
Referenced by vpSimulator::vpSimulator().
|
inherited |
begin the main program
init the main program thread
Definition at line 900 of file vpSimulator.cpp.
References vpSimulator::mainThread.
|
inherited |
Set the function used for the simulation loop and the data to pass to this function. As the data are represented using a generic pointer, care should be taken to ensure there is no memory corruption.
start_routine | : A pointer to the function used as a main simulation loop for the simulation. |
data | : The data to pass to the main loop. |
Definition at line 916 of file vpSimulator.cpp.
References vpSimulator::mainThread.
|
inherited |
initialize the external view
Definition at line 509 of file vpSimulator.cpp.
References vpSimulator::external_height, vpSimulator::external_width, vpSimulator::externalRoot, vpViewer::externalView, vpSimulator::externalView, vpSimulator::initSceneGraph(), vpSimulator::initSoApplication(), vpSimulator::mainWindow, vpSimulator::mainWindowInitialized, and vpViewer::resize().
|
virtualinherited |
initialize the camera view
Definition at line 472 of file vpSimulator.cpp.
References vpSimulator::bufferView, vpSimulator::initSceneGraph(), vpSimulator::initSoApplication(), vpSimulator::internal_height, vpSimulator::internal_width, vpSimulator::internalRoot, vpViewer::internalView, vpSimulator::internalView, vpSimulator::mainWindow, vpSimulator::mainWindowInitialized, and vpViewer::resize().
Referenced by initInternalViewer().
void vpAR::initInternalViewer | ( | const unsigned int | width, |
const unsigned int | height, | ||
vpImageType | type = grayImage |
||
) |
Initialisation of the internal view of the simulator.
width | : Width of the internal view. |
height | : Height of the internal view. |
type | : Type of background image ie gray scaled or color. |
Definition at line 93 of file vpAR.cpp.
References vpSimulator::grayImage, vpSimulator::image_background, vpSimulator::initInternalViewer(), vpSimulator::internal_height, vpSimulator::internal_width, and vpSimulator::typeImage.
|
inherited |
perform some initialization in the main program thread
performed some initialization in the main program thread should be locate at the beginning of the main program
Definition at line 924 of file vpSimulator.cpp.
References vpTime::wait().
|
protectedinherited |
initialize the scene graph
Definition at line 361 of file vpSimulator.cpp.
References vpSimulator::externalCamera, vpSimulator::externalRoot, vpSimulator::internalCamera, vpSimulator::internalCameraObject, vpSimulator::internalCameraPosition, vpSimulator::internalRoot, vpSimulator::realtime, vpSimulator::scene, and vpSimulator::zoomFactor.
Referenced by vpSimulator::initExternalViewer(), and vpSimulator::initInternalViewer().
|
protectedinherited |
open the SoGui application
Definition at line 354 of file vpSimulator.cpp.
References vpSimulator::mainWindow, and vpSimulator::mainWindowInitialized.
Referenced by vpSimulator::initExternalViewer(), and vpSimulator::initInternalViewer().
|
protectedinherited |
perform some destruction
Definition at line 314 of file vpSimulator.cpp.
References vpSimulator::bufferView, vpSimulator::externalView, vpSimulator::image_background, and vpSimulator::internalView.
Referenced by ~vpAR(), and vpSimulator::~vpSimulator().
|
inherited |
load an iv file
loading the virtual scene
Definition at line 707 of file vpSimulator.cpp.
References vpSimulator::scene, vpERROR_TRACE, and vpSimulator::zoomFactor.
|
inherited |
load an iv file, set the location of this scene
Add a new object in the scene graph.
iv_filename | : name of.iv file to load |
fMo | : position of the object wrt the reference frame |
Definition at line 789 of file vpSimulator.cpp.
References vpSimulator::addObject(), and vpERROR_TRACE.
|
virtualinherited |
activate the mainloop
Definition at line 684 of file vpSimulator.cpp.
References vpSimulator::mainWindowInitialized, vpERROR_TRACE, and vpTime::wait().
|
inherited |
modify the position of the camera in the scene graph
Definition at line 618 of file vpSimulator.cpp.
References vpSimulator::internalCamera, vpSimulator::internalCameraPosition, and vpHomogeneousMatrix::inverse().
Referenced by vpSimulator::redraw().
|
protectedinherited |
Definition at line 954 of file vpSimulator.cpp.
References vpSimulator::INTERNAL, vpSimulator::offScreenRenderer, and vpERROR_TRACE.
|
inherited |
display the scene (handle with care)
this function MUST NOT be called from a thread where the vpSimulator and its mainloop are not
Definition at line 653 of file vpSimulator.cpp.
References vpSimulator::cMf, vpSimulator::externalView, vpSimulator::internalView, and vpSimulator::moveInternalCamera().
|
inherited |
save the scene in an iv file
Definition at line 738 of file vpSimulator.cpp.
References vpSimulator::scene.
|
inherited |
set the camera position (from an homogeneous matrix)
Definition at line 612 of file vpSimulator.cpp.
References vpSimulator::cameraPositionInitialized, and vpSimulator::cMf.
|
inherited |
set external camera parameters
Definition at line 557 of file vpSimulator.cpp.
References vpSimulator::external_height, vpSimulator::external_width, vpSimulator::externalCamera, vpSimulator::externalCameraParameters, vpCameraParameters::get_px(), and vpCameraParameters::get_py().
void vpAR::setImage | ( | vpImage< unsigned char > & | I | ) |
Set the background image and turn it to deal with the frame of OpenGL.
I | : Gray scaled image for the background. |
Definition at line 127 of file vpAR.cpp.
References vpException::dimensionError, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpSimulator::image_background, vpSimulator::internal_height, vpSimulator::internal_width, and vpERROR_TRACE.
Set the background image and turn it to deal with the frame of OpenGL.
I | : Color image for the background. |
Definition at line 157 of file vpAR.cpp.
References vpException::dimensionError, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpSimulator::image_background, vpSimulator::internal_height, vpSimulator::internal_width, and vpERROR_TRACE.
|
inherited |
set internal camera parameters
Definition at line 538 of file vpSimulator.cpp.
References vpCameraParameters::get_px(), vpCameraParameters::get_py(), vpSimulator::internal_height, vpSimulator::internal_width, vpSimulator::internalCamera, and vpSimulator::internalCameraParameters.
|
inherited |
set the size of the camera/frame
Define the zoom factor used to define the size of the objects (frame, camera, ...)
zoom | zoom factor of the objects. By default, 1. |
Definition at line 430 of file vpSimulator.cpp.
References vpSimulator::scene, and vpSimulator::zoomFactor.
|
inherited |
Definition at line 1030 of file vpSimulator.cpp.
References vpSimulator::bufferView, vpSimulator::internal_height, vpSimulator::internal_width, vpTRACE, and vpImageIo::write().
|
inherited |
image of the internal view
Definition at line 284 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw(), vpSimulator::getInternalImage(), vpSimulator::init(), vpSimulator::initInternalViewer(), vpSimulator::kill(), and vpSimulator::write().
|
protectedinherited |
Definition at line 244 of file vpSimulator.h.
Referenced by vpSimulator::init(), and vpSimulator::setCameraPosition().
|
protectedinherited |
internal camera position
Definition at line 246 of file vpSimulator.h.
Referenced by vpSimulator::redraw(), and vpSimulator::setCameraPosition().
|
protectedinherited |
Definition at line 172 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initExternalViewer(), and vpSimulator::setExternalCameraParameters().
|
protectedinherited |
Definition at line 171 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initExternalViewer(), and vpSimulator::setExternalCameraParameters().
|
protectedinherited |
external camera
Definition at line 200 of file vpSimulator.h.
Referenced by vpSimulator::getExternalCameraPosition(), vpSimulator::init(), vpSimulator::initSceneGraph(), and vpSimulator::setExternalCameraParameters().
|
protectedinherited |
internal camera parameters
Definition at line 250 of file vpSimulator.h.
Referenced by vpSimulator::setExternalCameraParameters().
|
protectedinherited |
root node of the external view
Definition at line 195 of file vpSimulator.h.
Referenced by vpSimulator::addFrame(), vpSimulator::init(), vpSimulator::initExternalViewer(), and vpSimulator::initSceneGraph().
|
protectedinherited |
view from an external camera
Definition at line 145 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initExternalViewer(), vpSimulator::kill(), and vpSimulator::redraw().
|
protectedinherited |
external camera position
Definition at line 206 of file vpSimulator.h.
Referenced by vpSimulator::init().
|
inherited |
Flag to protect the read and write of the framebuffer (between the simulator and the viewer).
Definition at line 287 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw().
|
inherited |
Definition at line 137 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw(), vpSimulator::init(), initInternalViewer(), vpSimulator::kill(), and setImage().
|
protectedinherited |
Definition at line 170 of file vpSimulator.h.
Referenced by vpSimulator::getInternalImage(), vpSimulator::init(), vpSimulator::initInternalViewer(), initInternalViewer(), setImage(), vpSimulator::setInternalCameraParameters(), and vpSimulator::write().
|
protectedinherited |
Definition at line 169 of file vpSimulator.h.
Referenced by vpSimulator::getInternalImage(), vpSimulator::init(), vpSimulator::initInternalViewer(), initInternalViewer(), setImage(), vpSimulator::setInternalCameraParameters(), and vpSimulator::write().
|
protectedinherited |
internal camera
Definition at line 198 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initSceneGraph(), vpSimulator::moveInternalCamera(), and vpSimulator::setInternalCameraParameters().
|
protectedinherited |
representation of the camera in the external view
Definition at line 209 of file vpSimulator.h.
Referenced by vpSimulator::init(), and vpSimulator::initSceneGraph().
|
protectedinherited |
internal camera parameters
Definition at line 248 of file vpSimulator.h.
Referenced by vpSimulator::setInternalCameraParameters().
|
protectedinherited |
internal camera position
Definition at line 203 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initSceneGraph(), and vpSimulator::moveInternalCamera().
|
protectedinherited |
root node of the internal view
Definition at line 193 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initInternalViewer(), and vpSimulator::initSceneGraph().
|
protectedinherited |
view from the camera
Definition at line 143 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initInternalViewer(), vpSimulator::kill(), and vpSimulator::redraw().
|
protectedinherited |
thread with the main program
Definition at line 155 of file vpSimulator.h.
Referenced by vpSimulator::init(), and vpSimulator::initApplication().
|
protectedinherited |
main Widget
Definition at line 118 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initExternalViewer(), vpSimulator::initInternalViewer(), and vpSimulator::initSoApplication().
|
protectedinherited |
Definition at line 125 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initExternalViewer(), vpSimulator::initInternalViewer(), vpSimulator::initSoApplication(), and vpSimulator::mainLoop().
|
protectedinherited |
Definition at line 278 of file vpSimulator.h.
Referenced by vpSimulator::init(), and vpSimulator::offScreenRendering().
|
protectedinherited |
Definition at line 277 of file vpSimulator.h.
Referenced by vpSimulator::init(), and vpSimulator::initSceneGraph().
|
protectedinherited |
root node of the scene : contains everything except stuff specific to each view
Definition at line 191 of file vpSimulator.h.
Referenced by vpSimulator::addAbsoluteFrame(), vpSimulator::addObject(), vpSimulator::changeZoomFactor(), vpSimulator::init(), vpSimulator::initSceneGraph(), vpSimulator::load(), vpSimulator::save(), and vpSimulator::setZoomFactor().
|
inherited |
Definition at line 135 of file vpSimulator.h.
Referenced by vpViewer::actualRedraw(), vpSimulator::init(), and initInternalViewer().
|
protectedinherited |
Definition at line 240 of file vpSimulator.h.
Referenced by vpSimulator::init(), vpSimulator::initSceneGraph(), vpSimulator::load(), and vpSimulator::setZoomFactor().