TuttleOFX
1
|
00001 #ifndef _TERRY_GEOMETRY_SUBIMAGE_HPP_ 00002 #define _TERRY_GEOMETRY_SUBIMAGE_HPP_ 00003 00004 #include <boost/gil/image_view.hpp> 00005 00006 #include <terry/math/Rect.hpp> 00007 00008 namespace terry { 00009 using namespace boost::gil; 00010 00011 template <typename View, typename T> 00012 inline View subimage_view( const View& src, const Rect<T>& region ) 00013 { 00014 return View( region.x2-region.x1, region.y2-region.y1, src.xy_at(region.x1, region.y1) ); 00015 } 00016 00017 } 00018 00019 #endif