From ba2831c3a456e860761978cb848f38d825b4c128 Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 7 Oct 2013 06:19:14 -0700 Subject: refacoring --- rotord/src/cvimage.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'rotord/src/cvimage.cpp') diff --git a/rotord/src/cvimage.cpp b/rotord/src/cvimage.cpp index 0bf30a6..74a21dd 100644 --- a/rotord/src/cvimage.cpp +++ b/rotord/src/cvimage.cpp @@ -200,4 +200,15 @@ namespace Rotor { other->rgb=rgb/amount; return other; } + cv::Mat& Image::get_mipmap(int level){ + if (mipmaps.find(level)!=mipmaps.end()) return mipmaps[level]; + //levels start at 1 + int nw=max(1.0,w/pow(2,level)); + int nh=max(1.0,h/pow(2,level)); + cv::Mat mip;; + cv::resize(rgb,mip,cv::Size(nw,nh),0,0,cv::INTER_AREA ); + mipmaps[level]=mip; + return mipmaps[level]; + + } } -- cgit v1.2.3