pyrUp only for doubling size?

asked 2013-12-11 03:07:50 -0600

patrice079 gravatar image

updated 2013-12-11 03:08:21 -0600

Hi,

I'am a bit confused that it seems that the following doesn't work:

cv::Mat in_d(this->results[n].shape(1),this->results[n].shape(0),CV_32FC1,this->results[n].data());
cv::Mat tmp_dcv(in_d.cols*pow(2,n), in_d.rows*pow(2,n),CV_32FC1);
cv::pyrUp(in_d, tmp_dcv, cv::Size(in_d.cols*pow(2,n), in_d.rows*pow(2,n)) );

Could it be that I'am only able to double the image size by using the default Size parameter? If the parameter Size passed is not equivalent to the doubled size of the input but to 2^n, OpenCV throws an errror:

OpenCV Error: Assertion failed (std::abs(dsize.width - ssize.width*2) == dsize.width % 2 && 
std::abs(dsize.height - ssize.height*2) == dsize.height % 2) in pyrUp_, file ./install/opencv-
2.4.7/modules/imgproc/src/pyramids.cpp, line 330 terminate called after throwing an instance of 
'cv::Exception' what():  ./install/opencv-2.4.7/modules/imgproc/src/pyramids.cpp:330: error: (-215) 
std::abs(dsize.width - ssize.width*2) == dsize.width % 2 && std::abs(dsize.height - ssize.height*2) 
== dsize.height % 2 in function pyrUp_

Many thanks for help

edit retag flag offensive close merge delete

Comments

3

yes, pyramids only work in powers of 2

berak gravatar imageberak ( 2013-12-11 03:22:01 -0600 )edit
1

Guess this can be closed down, unless you are not satisfied with the answer?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-11 08:27:16 -0600 )edit