/*
* This file is part of robotreality
*
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
* http://opensource.cit-ec.de/projects/robotreality
*
* This file may be licensed under the terms of the
* GNU General Public License Version 3 (the ``GPL''),
* or (at your option) any later version.
*
* Software distributed under the License is distributed
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the GPL for the specific language
* governing rights and limitations.
*
* You should have received a copy of the GPL along with this
* program. If not, go to http://www.gnu.org/licenses/gpl.html
* or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology.
* The Excellence Cluster EXC 277 is a grant of the Deutsche
* Forschungsgemeinschaft (DFG) in the context of the German
* Excellence Initiative.
*
*/

#ifndef _RGB_IMAGE_FILTER_H_
#define _RGB_IMAGE_FILTER_H_ 
#include "cv.h"
#include <vector>
#include <stdio.h>
#include <iostream>

using namespace std;
using namespace cv;

#include "ConfigOptions.h"


class RGBImageFilter {
	
public:
	RGBImageFilter(ConfigOptions *cfg);
	bool colorclass_add_pixel(int colorclass, int r, int g, int b);
	bool colorclass_remove(int colorclass, int index);
	bool colorclass_clear();

	void filter_image(Mat *image, Mat *output, Mat *pf_out);
	void filter_image_slow(Mat *image, Mat *output);
	int  *get_lookuptable(){ return colorsample_lookup; }
	
	

private:
	bool colorclass_insert(int,int r, int g, int b);
	inline int get_distance(int r, int g, int b, int r2, int g2, int b2);
	void lookuptable_update();

	int *colorsample_lookup;
	ConfigOptions *cfg;
	
	
};

#endif