Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

resize() will reallocate your dst image, if the src depth is not the same, so using CV_64F is a bad idea. maybe the (much simpler) :

Size dst_siz(orig_bw.cols/cv::pow((double)2,itr_scale-1),orig_bw.rows/pow((double)2,itr_scale-1));
Mat imdist_scaled;
resize(orig_bw, imdist_scaled, dst_siz, 0, 0, INTER_CUBIC);

which unfortunately leads it to be a blank white image.

imshow() assumes floating point images to be in the [0..1] range, while CV_8U images are in [0..255], so any value larger than 1 will be white.

you can apply a scaling factor with convertTo():

imdist_scaled.convertTo(imdist_scaled, CV_64FC1, 1.0/255);

and then your image will look ok, with imshow(), but you have to carefully read the original code, and see, if scaling down the image to [0..1] is legit for the further calculation !!

again, maybe it's better, to only scale a local copy for viewing:

imshow("win", img/255);