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

Example for deinterlacing interlaced images

Author
ischiller
/*
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 ExampleDeInterlace.cpp
@relates DeInterlace
@brief Example for deinterlacing interlaced images
@ingroup g_examples
@author ischiller
*/
#include <Filter/DeInterlace.hh>
#include <Base/Image/ImageIO.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Debug/TimeMeasure.hh>
using namespace BIAS;
using namespace std;
#define type 1
#if type == 1
#define StorageType unsigned char
#define OutputImageType unsigned char
#else
#define StorageType float
#define OutputImageType float
#endif
int main(int argc, char *argv[])
{
TimeMeasure Timer1;
// set parameters
deinterlace.SetUseEvenLines(true);
deinterlace.SetDownSamplingByTwo(false);
if (argc<5){
cerr << argv[0] << " src dst useEvenLines(bool) dodownsamplingbytwo(bool)\n";
return -2;
}
#if type == 1
if (ImageIO::ImportImage(argv[1], im)!=0){
#else
if (ImageIO::Load(argv[1], ucim)!=0){
#endif
BIASERR("error loading image "<<argv[1]);
return -1;
} else {
cerr << "read "<<argv[1]<<endl;
}
#if type != 1
BIASERR("error converting image "<<argv[1]);
}
#endif
Timer1.Start();
deinterlace.SetUseEvenLines( 0!=atoi(argv[3]) );
deinterlace.SetDownSamplingByTwo( 0!=atoi(argv[4]) );
deinterlace.Filter(im, dst);
Timer1.Stop();
//int res =
//ImageIO::Save(argv[2], dst);
ImageIO::Save(argv[2], dst);
Timer1.Print();
return 0;
}