// Thresholding.cpp
// Chris Pocock 2014

#include "Thresholding.h"

Thresholding::Thresholding() {

	// Default class variable
	threshold_sens = 14;

	// Trackbar upper limit
	max_threshold_sens = 50;
}

Thresholding::~Thresholding() {
}

// Thresholds and input image and returns the result
Mat Thresholding::threshold(Mat &input){

	Mat result;
	cv::threshold(input,result,threshold_sens,255,THRESH_BINARY);
	return result;
}

// Create trackbar for live parameter tweaking
void Thresholding::setupUi(){

		namedWindow( "Thresholding", CV_WINDOW_AUTOSIZE );
		moveWindow("Thresholding", 0, 550);

		createTrackbar( "Threshold Sensitivity", "Thresholding",
				&threshold_sens,max_threshold_sens);
}
