32 #include <Filter/DeInterlace.hh>
33 #include <Filter/Median.hh>
34 #include <Base/Image/ImageIO.hh>
35 #include <Base/Image/ImageConvert.hh>
36 #include <Base/Debug/TimeMeasure.hh>
37 #include <Utils/Param.hh>
42 int ExtractNumbersFromRight(
const std::string & inStr,
43 int & number,
int& imgNum,
45 int & posR,
int& posLImg,
int& posRImg)
51 posLImg = posRImg = 0;
54 bool numericStarted=
false;
55 bool numericEnded=
false;
56 bool numericImgStarted =
false;
60 int current = inStr.size()-1;
61 while (!done && current>=0){
62 const char c=inStr[current];
75 if(!numericImgStarted && !numericEnded){
80 const int act =atoi(&c);
81 const int addAct = int(act*pow(10.0, exp10 ));
86 if(numericStarted && numericEnded){
87 if(!numericImgStarted){
88 numericImgStarted =
true;
91 const int act = atoi(&c);
92 const int addAct = int(act*pow(10.0, exp10Img));
101 if (numericStarted && !numericImgStarted){
106 if(numericImgStarted){
117 if (!numericStarted) {
127 int main(
int argc,
char *argv[]) {
141 cerr << argv[0] <<
"useEvenLines(bool) dodownsamplingbytwo(bool) src1 src2 ... \n";
146 for (
int countImgs = 0; countImgs < (argc-3); countImgs++) {
148 BIASERR(
"error loading image "<<argv[countImgs + 3]);
151 cerr <<
"read "<<argv[countImgs + 3]<<endl;
155 BIASERR(
"error converting image "<<argv[countImgs + 3]);
170 cout <<
"Done with deinterlacer" << endl;
173 int num, imgNum, posL, posR, posLImg, posRImg;
174 ExtractNumbersFromRight(argv[countImgs + 3], num, imgNum, posL, posR, posLImg, posRImg);
176 cout <<
"extracted num " << num <<
" imgNum " << imgNum <<
" posL " << posL <<
" posR " << posR <<
" posLImg " << posLImg <<
" posRImg " << posRImg << endl;
179 name <<
"deint-" << setw(4) << setfill(
'0') << num <<
".png";
Deinterlacer filter for images.
static int ConvertST(const BIAS::ImageBase &source, BIAS::ImageBase &dest, ImageBase::EStorageType targetST)
Function to convert the storage type of images e.g.
void SetUseEvenLines(bool bEvenLines=true)
Set if the even or odd lines in the images should be used.
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
void SetDownSamplingByTwo(bool bDoDownSamplingByTwo=true)
Set the downsampling factor while filter.
void SetDeInterlaceType(BIAS_DEINTERLACE_TYPE type)
Set the Type of deinterlacing e.g.
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...
(8bit) unsigned char image storage type
This is the base class for images in BIAS.
virtual int FilterColorImg(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
applies deinterlacing to each channel sperately