Ask Your Question

Revision history [back]

pyrUp only for doubling size?

Hi,

I'am a bit confuse 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

pyrUp only for doubling size?

Hi,

I'am a bit confuse 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