T OtsuThresholding<T>::computeThreshold(const VoxelMatrix<T>& voxelMatrix) const { const Vector<unsigned int> histogram = voxelMatrix.histogram( _firstBin, _binWidth, _numBins ); const int g = computeThreshold( histogram ); return _firstBin + g * _binWidth; }
Image::Image(const std::string& path, int flags, int tolerance) { cv::Mat mat = cv::imread(path, flags); mat.copyTo(*this); this->tolerance = tolerance; computeThreshold(); exposureTime = -1; };
void OtsuThresholding<T>::apply(VoxelMatrix<T>& voxelMatrix) { this->_threshold = computeThreshold( voxelMatrix ); Thresholding<T>::apply( voxelMatrix ); }
void OtsuThresholding<T>::apply(PixelMatrix<T>& pixelMatrix) { this->_threshold = computeThreshold( pixelMatrix ); Thresholding<T>::apply( pixelMatrix ); }
Image::Image(cv::Mat& mat, int tolerance) : cv::Mat(mat) { this->tolerance = tolerance; computeThreshold(); exposureTime = -1; };