Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleIplImageDisplay.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 /**
27  @example ExampleIplImageDisplay.cpp
28  @relates Image
29  @brief OpenCV/IPL image format acces and display
30  @ingroup g_examples
31  @author Woetzel
32 */
33 
34 #include <iostream>
35 #include <string>
36 
37 // BIAS
38 #include <Base/Image/Image.hh>
39 #include <Base/Image/ImageIO.hh>
40 
41 using namespace std;
42 using namespace BIAS;
43 
44 int main( int argc, char** argv )
45 {
46  //
47  // load image (prerquisit):
48  //
49  bool darttestNoGui=false;
50  bool darttestGui=false;
51  int delay=2000;
52  string filename( BIAS_TESTS_DATA "r4.jpg" );
53  if (argc>=2) {
54  if ((strcmp(argv[1],"-darttest")==0)
55  || (strcmp(argv[1],"-darttestnogui")==0) )
56  {
57  darttestNoGui=true;
58  std::cout<<"started dart test (no gui): "<<argv[0]<<std::endl;
59  } else if (strcmp(argv[1],"-darttestgui")==0) {
60  darttestGui=true;
61  delay=500; // msec is enough for test
62  std::cout<<"started dart test (with gui): "<<argv[0]<<std::endl;
63  }
64  };
65  // user specified an image to work with:
66  if (!darttestNoGui && !darttestGui && (argc>1)) filename=argv[1];
67  // laod an image to work with
69  if (BIAS::ImageIO::Load(filename, img) !=0){
70  cout<<"error loading image "<<filename<<endl;
71  return -1;
72  };
73  cout<<"loaded image with dim: "<<img.GetWidth()<<"x"<<img.GetHeight()<<endl;
74 
75 
76  //
77  // major test: the Display routine:
78  //
79  if (!darttestNoGui) {
80  img.Display("Display", true, true, true, delay );
81  }
82 
83  return 0;
84 }
int Display(const std::string &DestWin, const bool &autoresize, const bool &moveToTopLeft, const bool &waitForKey, const unsigned int &delayMsec=DEFAULT_Display_delay, const float &scale=DEFAULT_32to8_scale, const bool &allowAlphaWindow=false) const
OpenCV onscreen popup display, very useful for fast debugging. (JW)
Definition: ImageBase.cpp:1414
unsigned int GetWidth() const
Definition: ImageBase.hh:312
unsigned int GetHeight() const
Definition: ImageBase.hh:319
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
Definition: ImageIO.cpp:141