summaryrefslogtreecommitdiff
path: root/rotord/src/cvimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/cvimage.cpp')
-rw-r--r--rotord/src/cvimage.cpp11
1 files changed, 11 insertions, 0 deletions
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];
+
+ }
}