Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::GuiCV Class Reference

Gui based on OpenCV is a simple windowing environment... More...

#include <Gui/GuiCV.hh>

+ Inheritance diagram for BIAS::GuiCV:
+ Collaboration diagram for BIAS::GuiCV:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
virtual bool CheckForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured More...
 
virtual bool CheckForEvent (char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible More...
 
virtual char CheckForKeyEvent ()
 checks if any key is pressed and returns it returns -1 if no key is pressed More...
 
virtual bool CheckForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 return true if mouse button is pressed or released, false else see WaitForMouseButtonEvent for detailed description More...
 
bool Closed ()
 returns true if window is closed by user via x button More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
virtual int DestroyWindow ()
 stops the main loop and closes the window More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
virtual void GetFactorOffset (int &xoffset, int &yoffset, int &factor)
 gets offset and factor for mouse position mouse position in (e.g. More...
 
int GetMouseX ()
 
int GetMouseY ()
 
std::string GetTitle ()
 
 GuiCV (bool ShowMousePos=true)
 
 GuiCV (const std::string &Title, bool ShowMousePos=true)
 
 GuiCV (const GuiCV &gui)
 
long int Name2DebugLevel (const std::string &name) const
 looks up a debuglevel in the internal map, returns 0 if not found More...
 
long int NewDebugLevel (const std::string &name)
 creates a new debuglevel More...
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
virtual void SetFactorOffset (int xoffset, int yoffset, int factor)
 sets offset and factor for mouse position mouse position in (e.g. More...
 
virtual void SetTitle (std::string const &Title)
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
virtual int ShowImage (ImageBase &image, float min=0.0, float max=255.0)
 shows/updates the image shown in window. More...
 
virtual int ShowImage (PyramidImage< unsigned char > &pim)
 
virtual int ShowImage (PyramidImage< float > &pim)
 
virtual void WaitForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent More...
 
virtual char WaitForKeyEvent ()
 waits until a key is pressed and returns it tested More...
 
virtual void WaitForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits until any mouse button is pressed or released More...
 
virtual ~GuiCV ()
 

Static Public Member Functions

static long int GetGlobalDebugLevel ()
 
static void SetGlobalDebugLevel (long int lev)
 

Protected Member Functions

long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
template<class PixelType >
int ConvertToUC_ (Image< PixelType > &image, float min, float max)
 
int CreateIplImageShared (const BIAS::ImageBase *p_src, IplImage *&p_dest)
 
virtual void Init_ (bool ShowMousePos)
 Set up thread and stuff. More...
 
void MouseCallback (int event, int x, int y, int flags)
 
virtual int ShowConvertedImage_ (Image< unsigned char > &image)
 Does the real update of the image shown in window. Must be overloaded. More...
 
bool TestImage_ (Image< unsigned char > &image)
 test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size More...
 

Static Protected Member Functions

static void StaticMouseCallback (int event, int x, int y, int flags, void *param)
 

Protected Attributes

long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
Image< unsigned char > CurrentImage_
 
int Factor_
 
unsigned int Height_
 
IplImage * IplImage_
 
int IsPyramid_
 
char KeyBuffer_
 
int MouseButtonPressed_
 
int MouseButtonPressX_
 
int MouseButtonPressY_
 
int MouseButtonReleased_
 
int MouseButtonReleaseX_
 
int MouseButtonReleaseY_
 
int MousePosX_
 
int MousePosY_
 
unsigned int nChannels_
 
ImageBase OrigPicture_
 This is the original representation of the picture. More...
 
unsigned int Pyramid0Height_
 
unsigned int Pyramid0Width_
 
unsigned int PyramidLevels_
 
bool ShowMouse_
 
std::string Title_
 
unsigned int Width_
 if the following 3 variables are set , Buffer_ is already allocated More...
 
bool WindowCreated_
 
int XOffset_
 
int YOffset_
 

Static Protected Attributes

static std::ostream _zDebugStream
 
static bool BaseInitialized_ =false
 
static long int GlobalDebugLevel = 0
 
static pthread_mutex_t MouseButtonMutex_
 

Detailed Description

Gui based on OpenCV is a simple windowing environment...

Usage:

Examples:
ExamplePtGreyHiresColor.cpp.

Definition at line 53 of file GuiCV.hh.

Constructor & Destructor Documentation

GuiCV::GuiCV ( bool  ShowMousePos = true)

Definition at line 44 of file GuiCV.cpp.

References IplImage_.

GuiCV::GuiCV ( const std::string &  Title,
bool  ShowMousePos = true 
)

Definition at line 49 of file GuiCV.cpp.

References IplImage_.

GuiCV::GuiCV ( const GuiCV gui)

Definition at line 54 of file GuiCV.cpp.

References IplImage_.

GuiCV::~GuiCV ( )
virtual

Definition at line 59 of file GuiCV.cpp.

References DestroyWindow(), IplImage_, and BIAS::GuiBase::WindowCreated_.

Member Function Documentation

void BIAS::Debug::AddDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::AddDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 362 of file Debug.hh.

bool GuiBase::CheckForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

as above but does return immediate with true if event occured

Definition at line 296 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), and BIAS::GuiBase::CheckForMouseButtonEvent().

bool GuiBase::CheckForEvent ( char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible

Definition at line 331 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), and BIAS::GuiBase::CheckForMouseButtonEvent().

char GuiCV::CheckForKeyEvent ( )
virtual

checks if any key is pressed and returns it returns -1 if no key is pressed

Author
Felix Woelk

Reimplemented from BIAS::GuiBase.

Examples:
ExamplePtGreyHiresColor.cpp.

Definition at line 96 of file GuiCV.cpp.

bool GuiBase::CheckForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited
bool BIAS::GuiBase::Closed ( )
inlineinherited

returns true if window is closed by user via x button

Author
woelk 05/2003

Definition at line 164 of file GuiBase.hh.

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

template<class PixelType >
int GuiBase::ConvertToUC_ ( Image< PixelType > &  image,
float  min,
float  max 
)
protectedinherited
int GuiCV::CreateIplImageShared ( const BIAS::ImageBase p_src,
IplImage *&  p_dest 
)
protected
bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const
inlineinherited
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const
inlineinherited

Definition at line 350 of file Debug.hh.

int GuiCV::DestroyWindow ( )
virtual

stops the main loop and closes the window

Reimplemented from BIAS::GuiBase.

Definition at line 89 of file GuiCV.cpp.

References BIAS::GuiBase::Title_, and BIAS::GuiBase::WindowCreated_.

Referenced by SetTitle(), and ~GuiCV().

int BIAS::Debug::GetDebugLevel ( ) const
inlineinherited
std::ostream& BIAS::Debug::GetDebugStream ( ) const
inlineinherited

Definition at line 405 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const
inlineinherited

Definition at line 414 of file Debug.hh.

void GuiBase::GetFactorOffset ( int &  xoffset,
int &  yoffset,
int &  factor 
)
virtualinherited

gets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 130 of file GuiBase.cpp.

References BIAS::GuiBase::Factor_, BIAS::GuiBase::XOffset_, and BIAS::GuiBase::YOffset_.

static long int BIAS::Debug::GetGlobalDebugLevel ( )
inlinestaticinherited

Definition at line 431 of file Debug.hh.

int BIAS::GuiBase::GetMouseX ( )
inlineinherited

Definition at line 115 of file GuiBase.hh.

int BIAS::GuiBase::GetMouseY ( )
inlineinherited

Definition at line 116 of file GuiBase.hh.

std::string BIAS::GuiBase::GetTitle ( )
inlineinherited

Definition at line 89 of file GuiBase.hh.

void GuiBase::Init_ ( bool  ShowMousePos)
protectedvirtualinherited
void GuiCV::MouseCallback ( int  event,
int  x,
int  y,
int  flags 
)
protected
long int BIAS::Debug::Name2DebugLevel ( const std::string &  name) const
inlineinherited

looks up a debuglevel in the internal map, returns 0 if not found

Author
woelk 09/2006

Definition at line 454 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name)
inlineinherited
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

Definition at line 383 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv)
inlineinherited

Definition at line 369 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 376 of file Debug.hh.

void BIAS::Debug::SetDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 325 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os)
inlineinherited

Definition at line 398 of file Debug.hh.

void GuiBase::SetFactorOffset ( int  xoffset,
int  yoffset,
int  factor 
)
virtualinherited

sets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 123 of file GuiBase.cpp.

References BIAS::GuiBase::Factor_, BIAS::GuiBase::XOffset_, and BIAS::GuiBase::YOffset_.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev)
inlinestaticinherited

Definition at line 424 of file Debug.hh.

void GuiCV::SetTitle ( std::string const &  Title)
virtual
int GuiCV::ShowConvertedImage_ ( Image< unsigned char > &  image)
protectedvirtual
void BIAS::Debug::ShowDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

prints all internally known debuglevels

Author
woelk 09/2006

Definition at line 496 of file Debug.hh.

int GuiBase::ShowImage ( ImageBase image,
float  min = 0.0,
float  max = 255.0 
)
virtualinherited
int GuiBase::ShowImage ( PyramidImage< unsigned char > &  pim)
virtualinherited
int GuiBase::ShowImage ( PyramidImage< float > &  pim)
virtualinherited
void GuiCV::StaticMouseCallback ( int  event,
int  x,
int  y,
int  flags,
void *  param 
)
staticprotected

Definition at line 215 of file GuiCV.cpp.

References MouseCallback().

Referenced by ShowConvertedImage_().

bool BIAS::GuiBase::TestImage_ ( Image< unsigned char > &  image)
inlineprotectedinherited

test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size

Definition at line 217 of file GuiBase.hh.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), and BIAS::ImageBase::GetWidth().

void GuiBase::WaitForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent

Definition at line 311 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), BIAS::GuiBase::CheckForMouseButtonEvent(), and BIAS::GuiBase::WindowCreated_.

char GuiCV::WaitForKeyEvent ( )
virtual

waits until a key is pressed and returns it tested

Author
Felix Woelk

Reimplemented from BIAS::GuiBase.

Definition at line 102 of file GuiCV.cpp.

void GuiCV::WaitForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

waits until any mouse button is pressed or released

Xpos and Ypos are set to the coordinates within the drawing area Pressed is set to true if the button was pressed and to false if the button was released Button is set to th mouse button no: 1 = left, 2 = middle, 3 = right

Reimplemented from BIAS::GuiBase.

Definition at line 108 of file GuiCV.cpp.

References BIAS::GuiBase::MouseButtonMutex_, BIAS::GuiBase::MouseButtonPressed_, BIAS::GuiBase::MouseButtonPressX_, BIAS::GuiBase::MouseButtonPressY_, BIAS::GuiBase::MouseButtonReleased_, BIAS::GuiBase::MouseButtonReleaseX_, BIAS::GuiBase::MouseButtonReleaseY_, and BIAS::GuiBase::WindowCreated_.

Member Data Documentation

long int BIAS::Debug::_liDebugLevel
protectedinherited

Definition at line 510 of file Debug.hh.

Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().

long int BIAS::Debug::_liNextDebugLevel
protectedinherited

new concept, debuglevel are managed here in the debug class

Definition at line 516 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::ostream BIAS::Debug::_zDebugStream
staticprotectedinherited

Definition at line 511 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

bool GuiBase::BaseInitialized_ =false
staticprotectedinherited

Definition at line 208 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

Image<unsigned char> BIAS::GuiCV::CurrentImage_
protected

Definition at line 71 of file GuiCV.hh.

Referenced by SetTitle(), and ShowConvertedImage_().

int BIAS::GuiBase::Factor_
protectedinherited
long int BIAS::Debug::GlobalDebugLevel = 0
staticprotectedinherited

Definition at line 513 of file Debug.hh.

unsigned int BIAS::GuiBase::Height_
protectedinherited

Definition at line 183 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

IplImage* BIAS::GuiCV::IplImage_
protected

Definition at line 70 of file GuiCV.hh.

Referenced by GuiCV(), ShowConvertedImage_(), and ~GuiCV().

int BIAS::GuiBase::IsPyramid_
protectedinherited

Definition at line 205 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

char BIAS::GuiBase::KeyBuffer_
protectedinherited
pthread_mutex_t GuiBase::MouseButtonMutex_
staticprotectedinherited
int BIAS::GuiBase::MouseButtonPressed_
protectedinherited
int BIAS::GuiBase::MouseButtonPressX_
protectedinherited
int BIAS::GuiBase::MouseButtonPressY_
protectedinherited
int BIAS::GuiBase::MouseButtonReleased_
protectedinherited
int BIAS::GuiBase::MouseButtonReleaseX_
protectedinherited
int BIAS::GuiBase::MouseButtonReleaseY_
protectedinherited
int BIAS::GuiBase::MousePosX_
protectedinherited

Definition at line 189 of file GuiBase.hh.

Referenced by MouseCallback().

int BIAS::GuiBase::MousePosY_
protectedinherited

Definition at line 190 of file GuiBase.hh.

Referenced by MouseCallback().

unsigned int BIAS::GuiBase::nChannels_
protectedinherited

Definition at line 184 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

ImageBase BIAS::GuiBase::OrigPicture_
protectedinherited

This is the original representation of the picture.

Definition at line 199 of file GuiBase.hh.

Referenced by BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Height_
protectedinherited

Definition at line 186 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Width_
protectedinherited

Definition at line 185 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::PyramidLevels_
protectedinherited

Definition at line 187 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

bool BIAS::GuiBase::ShowMouse_
protectedinherited

Definition at line 179 of file GuiBase.hh.

Referenced by BIAS::GuiBase::GuiBase(), and BIAS::GuiBase::Init_().

std::string BIAS::GuiBase::Title_
protectedinherited
unsigned int BIAS::GuiBase::Width_
protectedinherited

if the following 3 variables are set , Buffer_ is already allocated

Definition at line 182 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

bool BIAS::GuiBase::WindowCreated_
protectedinherited
int BIAS::GuiBase::XOffset_
protectedinherited
int BIAS::GuiBase::YOffset_
protectedinherited

The documentation for this class was generated from the following files: