# Revision history [back]

### Smoothing out edges - Converting an 8UC4 Mat to a 32FC4 Mat

I want to smooth out the edges of an object I'm extracting from by using the following lines of code from a StackOverflow question:

cv::namedWindow("result");
whole_image.convertTo(whole_image,CV_32FC3,1.0/255.0);
cv::resize(whole_image,whole_image,img.size());
img.convertTo(img,CV_32FC3,1.0/255.0);

Mat bg=Mat(img.size(),CV_32FC3);
bg=Scalar(1.0,1.0,1.0);

Mat img_gray;
cv::cvtColor(img,img_gray,cv::COLOR_BGR2GRAY);

cv::waitKey(0);


However, I am running into this assertion failure here:

OpenCV Error: Assertion failed (((((sizeof(size_t)<<28)|0x8442211) >> ((traits::Depth<_Tp>::value) & ((1 << 3) - 1))*4) & 15) == elemSize1()) in cv::Mat::at


I traced the problem down to something similar to this line:

whole_image.convertTo(whole_image,CV_32FC3,1.0/255.0);


From using the code from a StackOverflow.com answer, I noticed that the type of image I loaded is 8UC4.

How can I convert an 8UC4 Mat to 32FC4?