Skip to content
Snippets Groups Projects
Commit e0ca7801 authored by d.kilic's avatar d.kilic Committed by d.kilic
Browse files

Delete obsolete brightFilter and contrastFilter

parent da81156e
No related branches found
No related tags found
1 merge request!71Delete obsolete brightFilter and contrastFilter
Pipeline #28388 passed
......@@ -282,8 +282,6 @@ target_sources(petrack_core PRIVATE
include/autoCalib.h
include/filter.h
include/brightContrastFilter.h
include/brightFilter.h
include/contrastFilter.h
include/blurFilter.h
include/borderFilter.h
include/backgroundFilter.h
......@@ -335,8 +333,6 @@ target_sources(petrack_core PRIVATE
src/autoCalib.cpp
src/filter.cpp
src/brightContrastFilter.cpp
src/brightFilter.cpp
src/contrastFilter.cpp
src/blurFilter.cpp
src/borderFilter.cpp
src/backgroundFilter.cpp
......
/*
* PeTrack - Software for tracking pedestrians movement in videos
* Copyright (C) 2010-2020 Forschungszentrum Jülich GmbH,
* Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand,
* Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BRIGHTFILTER_H
#define BRIGHTFILTER_H
#include "filter.h"
class BrightFilter : public Filter
{
private:
Parameter mB;
public:
BrightFilter();
#ifndef STEREO_DISABLED
IplImage* act(IplImage *img, IplImage *res);
#endif
// bool changed();
Parameter *getBrightness();
};
#endif
/*
* PeTrack - Software for tracking pedestrians movement in videos
* Copyright (C) 2010-2020 Forschungszentrum Jülich GmbH,
* Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand,
* Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CONTRASTFILTER_H
#define CONTRASTFILTER_H
#include "filter.h"
#include "helper.h"
class ContrastFilter : public Filter
{
private:
Parameter mC;
public:
ContrastFilter();
#ifndef STEREO_DISABLED
IplImage* act(IplImage *img, IplImage *res);
#endif
// bool changed();
Parameter *getContrast();
};
#endif
/*
* PeTrack - Software for tracking pedestrians movement in videos
* Copyright (C) 2010-2020 Forschungszentrum Jülich GmbH,
* Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand,
* Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "brightFilter.h"
BrightFilter::BrightFilter()
:Filter()
{
mB.setMinimum(0.);
mB.setMaximum(255.);
mB.setValue(0.);
mB.setFilter(this);
}
#ifndef STEREO_DISABLED
IplImage* BrightFilter::act(IplImage *img, IplImage *res)
{
int x, y;
// Pointer to the data information in the IplImage
unsigned char *dataIn = (unsigned char *) img->imageData;
unsigned char *dataOut = (unsigned char *) res->imageData;
// int channels = img->nChannels;
// set poiner to value before array, because ++i is more effective than i++
--dataIn; --dataOut;
// Contrast factor
float b = mB.getValue();
float fac = (255.-b)/255.;
// cout << CHAR_MIN << " " << CHAR_MAX<<endl
// leider oft von -128..127, so dass umwandlung in unsigned char bei berechung noetig
// This loop is optimized so it has to calculate the least amount of indexes
// Optimizing the access to the pointer data is useless (no difference in performance when tested)
for (y = 0; y < img->height; ++y)
{
for (x = 0; x < img->width; ++x)
{
*(++dataOut) = (char) (*(++dataIn) * fac + b);
*(++dataOut) = (char) (*(++dataIn) * fac + b);
*(++dataOut) = (char) (*(++dataIn) * fac + b);
// so wuerde man durchschleifen
// *(++dataOut) = *(++dataIn);
// *(++dataOut) = *(++dataIn);
// *(++dataOut) = *(++dataIn);
// dataIn+=channels; // es wird von 3 kanaelen ausgegenagen
}
}
// // parameter was used, so it is now set to unchanged
// // also enabling/disabling will be reset
// mC.setChanged(false);
// Filter::setUnchanged();
return res;
}
// bool BrightFilter::changed()
// {
// return Filter::changed() || mB.changed();
// }
#endif
Parameter* BrightFilter::getBrightness()
{
return &mB;
}
/*
* PeTrack - Software for tracking pedestrians movement in videos
* Copyright (C) 2010-2020 Forschungszentrum Jülich GmbH,
* Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand,
* Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "contrastFilter.h"
ContrastFilter::ContrastFilter()
:Filter()
{
mC.setMinimum(0.);
mC.setMaximum(255.);
mC.setValue(0.);
mC.setFilter(this);
}
#ifndef STEREO_DISABLED
IplImage* ContrastFilter::act(IplImage *img, IplImage *res)
{
int x, y;
float val;
// Pointer to the data information in the IplImage
// using (unsigned char *) garantees values 0..255 (mingw under windows results -128..127 for char)
unsigned char *dataIn = (unsigned char *) img->imageData;
unsigned char *dataOut = (unsigned char *) res->imageData;
// int channels = img->nChannels;
// set poiner to value before array, because ++i is more effective than i++
--dataIn; --dataOut;
// Contrast factor
float fac = 256./(256.-mC.getValue());
// This loop is optimized so it has to calculate the least amount of indexes
// Optimizing the access to the pointer data is useless (no difference in performance when tested)
// int maxval = -1000;
// int minval = 1000;
// for (y = 0; y < img->height; ++y)
// {
// for (x = 0; x < img->width; ++x)
// {
// if (*(dataIn+x+y*img->width) > maxval)
// maxval = *(dataIn+x+y*img->width);
// if (*(dataIn+x+y*img->width) < minval)
// minval = *(dataIn+x+y*img->width);
// }
// }
// cout << minval << " " <<maxval <<endl;
for (y = 0; y < img->height; ++y)
{
for (x = 0; x < img->width; ++x)
{
val = (*(++dataIn)-128) * fac; // (signed char) to move to -128..127
*(++dataOut) = (unsigned char) MAX(MIN(val+128, 255), 0);
val = (*(++dataIn)-128) * fac;
*(++dataOut) = (unsigned char) MAX(MIN(val+128, 255), 0);
val = (*(++dataIn)-128) * fac;
*(++dataOut) = (unsigned char) MAX(MIN(val+128, 255), 0);
// so wuerde man durchschleifen
// *(++dataOut) = *(++dataIn);
// *(++dataOut) = *(++dataIn);
// *(++dataOut) = *(++dataIn);
// dataIn+=channels; // es wird von 3 kanaelen ausgegenagen
}
}
return res;
}
#endif
Parameter* ContrastFilter::getContrast()
{
return &mC;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment