Ask Your Question

HorrorCV's profile - activity

2019-01-27 08:15:35 -0600 received badge  Famous Question (source)
2016-12-22 04:11:12 -0600 received badge  Notable Question (source)
2016-07-11 23:21:18 -0600 received badge  Popular Question (source)
2013-09-10 03:05:37 -0600 commented question cv::Mat convertion to double type

Thank you for the scaling factor. As for the double precision, apparently some openCV functions I want to use are made for the CV_32F type only. I am using the 2.4.1 version, but maybe it has been rectified after. The only remaining problem is about the display of the result (convertTo's first parameter).

2013-09-10 01:41:20 -0600 commented question cv::Mat convertion to double type

My program needs more accuracy (filtering, reduction by the average... this kind of operations). So the first thing I need is to use floating points. But the behavior I have, just by converting it, is unexpected. And since 32 = 8 x 4, why does it display half of my image?

2013-09-09 23:55:28 -0600 asked a question cv::Mat convertion to double type

Hi,

I am not really familiar with openCV, so I am probably using its functions wrong.

The code is as follows.

cv::Mat im0Bgr = cv::imread("colormapTest.png"); // 32x32 test image

cv::Mat im0BgrDouble;

im0Bgr.convertTo(im0BgrDouble, CV_32F);

// Then //

cv::namedWindow("Figure 1");

cv::namedWindow("Figure 2");

cv::imshow("Figure 1", im0Bgr);

cv::imshow("Figure 2", im0BgrDouble);

//... and destroyed just after

My original image is of type CV_8U. It is displayed correctly. My converted image is supposed to be in the range [0,1], while it is not ([0,255] instead). More than that, only the half top part is displayed, and the bottom half is displayed white, though the converted object contains some 0 there.

image description

Can someone point out where I am mistaken? I guess such a simple thing does not come from OpenCV. Thank you.