示例#1
0
文件: Dialog.cpp 项目: ch3n2k/rss
void CHistogramDlg::set_histogram(std::vector<int> &h)
{
	if( h.size() != 256 )
		throw rss::Exception("Histogram size mismatch.");

	// a private copy of histogram
	hist_value_.resize( h.size(), 0 );

	for( size_t i = 0; i < h.size(); i++ ) {
		hist_value_[i] = h[i];
	}

	compute_attributes();
}
示例#2
0
    void frontier_detector::compute_frontiers(const point_xy_t &seed, algo_t algo ){//{{{
        // try running the algo
        switch(algo) {
            case WFD : // Wavefront Frontier Detection
                compute_frontiers_WFD( seed ) ;
                break;
            case FFD : // Fast Frontier Detection
                throw  std::runtime_error("Fast Frontier Detection is not imlemented yet");
                break;
            default : // Unknown  algorithm
                throw  std::runtime_error("Unknown algorithm for frontier detection");
                break;
        }

        // compute the frontiers attributes
        compute_attributes( seed );

        // sort the frontiers attributes by the size criteria
        std::sort( attributes.begin(), attributes.end(), std::greater<f_attributes>() ); // descending order

    }//}}}