Conversion of C API to C++ API problem [closed]
I have the following lines of code in C API :
IplImage *imdist_scaled = cvCreateImage(cvSize(orig_bw->width/pow((double)2,itr_scale-1), orig_bw->height/pow((double)2,itr_scale-1)), IPL_DEPTH_64F, 1); cvResize(orig_bw, imdist_scaled,CV_INTER_CUBIC);
And I've converted it into C++ API as :
Mat imdist_scaled(Size(orig_bw.cols/cv::pow((double)2, itr_scale-1), orig_bw.rows/pow((double)2, itr_scale-1)), CV_64F, 1); resize(orig_bw, imdist_scaled, imdist_scaled.size(), 0, 0, INTER_CUBIC); // INTER_CUBIC imdist_scaled.convertTo(imdist_scaled, CV_64FC1); // if not done, then it shows error in later steps // depth == 5 || 6 check error in pow function
In first case, when I try to show the image to the screen (imdist_scaled) - it shows me resized image. But in the second case, when I do the same, it shows a blank white image.
When I check the output without using convertTo command, then it works but in the later steps it says depth error, and thus I've converted it to 64F depth, which unfortunately leads it to be a blank white image.
Also note that I've verified orig_bw.cols, orig_bw.rows etc. have correct outputs.
Here orig_bw is a sample image I'm taking.
Why would that be?
https://stackoverflow.com/a/12851341
https://stackoverflow.com/a/12851341