Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleIplImageDisplay.cpp

OpenCV/IPL image format acces and display

Author
Woetzel
/*
This file is part of the BIAS library (Basic ImageAlgorithmS).
Copyright (C) 2003-2009 (see file CONTACT for details)
Multimediale Systeme der Informationsverarbeitung
Institut fuer Informatik
Christian-Albrechts-Universitaet Kiel
BIAS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
BIAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BIAS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@example ExampleIplImageDisplay.cpp
@relates Image
@brief OpenCV/IPL image format acces and display
@ingroup g_examples
@author Woetzel
*/
#include <iostream>
#include <string>
// BIAS
#include <Base/Image/Image.hh>
#include <Base/Image/ImageIO.hh>
using namespace std;
using namespace BIAS;
int main( int argc, char** argv )
{
//
// load image (prerquisit):
//
bool darttestNoGui=false;
bool darttestGui=false;
int delay=2000;
string filename( BIAS_TESTS_DATA "r4.jpg" );
if (argc>=2) {
if ((strcmp(argv[1],"-darttest")==0)
|| (strcmp(argv[1],"-darttestnogui")==0) )
{
darttestNoGui=true;
std::cout<<"started dart test (no gui): "<<argv[0]<<std::endl;
} else if (strcmp(argv[1],"-darttestgui")==0) {
darttestGui=true;
delay=500; // msec is enough for test
std::cout<<"started dart test (with gui): "<<argv[0]<<std::endl;
}
};
// user specified an image to work with:
if (!darttestNoGui && !darttestGui && (argc>1)) filename=argv[1];
// laod an image to work with
if (BIAS::ImageIO::Load(filename, img) !=0){
cout<<"error loading image "<<filename<<endl;
return -1;
};
cout<<"loaded image with dim: "<<img.GetWidth()<<"x"<<img.GetHeight()<<endl;
//
// major test: the Display routine:
//
if (!darttestNoGui) {
img.Display("Display", true, true, true, delay );
}
return 0;
}