Example #1
0
Val minVal(Image &image, Point &p, Domain& domain)
{
  typename Image::Domain dom( p*2, p*2 + Point::diagonal(1));
  Val v=image(p*2);
  for(typename Image::Domain::ConstIterator it=dom.begin(), itend=dom.end();
      it != itend;
      ++it)
    if (  domain.isInside(*it)&&  image( *it) < v) v=image(*it);
  
  return v;    
} 
Example #2
0
Val meanVal(Image &image, Point &p, Domain& domain)
{
  typename Image::Domain dom( p*2, p*2 + Point::diagonal(1));
  int v=0;
  int nb=0;
  for(typename Image::Domain::ConstIterator it=dom.begin(), itend=dom.end();
      it != itend;
      ++it)
    if ( domain.isInside(*it) )
      {
	nb++;
	v+=image(*it);
      }
  return static_cast<unsigned char>( v/nb );
} 
Example #3
0
int display_image(const Image& image, Viewer& viewer) 
{
	BOOST_CONCEPT_ASSERT(( CConstImage<Image> ));
	BOOST_STATIC_ASSERT(( boost::is_same<typename Image::Value, bool>::value ));

	typedef typename DigitalSetSelector<typename Image::Domain, BIG_DS | LOW_VAR_DS | HIGH_ITER_DS | HIGH_BEL_DS>::Type DigitalSet;
	const typename Image::Domain domain = image.domain();
	DigitalSet registered_set(domain);

	typename Image::Domain::Size displayed = 0;
	for (typename Image::Domain::Iterator iter=domain.begin(), iter_end=domain.end(); iter!=iter_end; iter++)
	{
		const typename Image::Domain::Point& point = *iter;
		if (!image(point)) continue;
		registered_set.insertNew(*iter);
		displayed++;
	}
	trace.info() << "display " << displayed << " points (" << static_cast<int>(100.*displayed/domain.size()) << "%)" << endl;

	viewer << registered_set;
}