Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convertTo from CV_32f to CV_8U

I want to do a bilateral filter and my image has to be type CV_8UC1/C3 for this.

To convert it would appear I have to use convertTo, but this is simply not working.

This is what I am doing:

Mat Temp= Mat(CurrentMat.size(),CV_8U); CurrentMat.convertTo(Temp,CV_8UC3); Mat Result=Temp.clone(); qDebug()<<cv_8uc1&lt;<cv_8uc3; qdebug()&lt;&lt;"type"&lt;<temp.type()&lt;<result.type()&lt;<currentmat.type();="" qdebug()&lt;&lt;"data"&lt;<result.data&lt;<currentmat.data;<="" p="">

bilateralFilter ( CurrentMat, Result, 5, 15, 15 );

Via the output I can clearly see that the type of Temp is 24 and not 0 or 16 which it should become.

Appreciated.

click to hide/show revision 2
No.2 Revision

convertTo from CV_32f to CV_8U

I want to do a bilateral filter and my image has to be type CV_8UC1/C3 for this.

To convert it would appear I have to use convertTo, but this is simply not working.

This is what I am doing:

Mat Temp= Mat(CurrentMat.size(),CV_8U);
CurrentMat.convertTo(Temp,CV_8UC3);
Mat Result=Temp.clone();
qDebug()<<CV_8UC1<<CV_8UC3;
qDebug()<<"Type"<<Temp.type()<<Result.type()<<CurrentMat.type();
qDebug()<<"Data"<<Result.data<<CurrentMat.data;  CurrentMat.convertTo(Temp,CV_8UC3);
    Mat Result=Temp.clone();
    qDebug()<<cv_8uc1&lt;<cv_8uc3; qdebug()&lt;&lt;"type"&lt;<temp.type()&lt;<result.type()&lt;<currentmat.type();="" qdebug()&lt;&lt;"data"&lt;<result.data&lt;<currentmat.data;<="" p="">
 

bilateralFilter ( CurrentMat, Result, 5, 15, 15 );

);

Via the output I can clearly see that the type of Temp is 24 and not 0 or 16 which it should become.

Appreciated.

convertTo from CV_32f to CV_8U

I want to do a bilateral filter and my image has to be type CV_8UC1/C3 for this.

To convert it would appear I have to use convertTo, but this is simply not working.

This is what I am doing:

Mat Temp= Mat(CurrentMat.size(),CV_8U);
CurrentMat.convertTo(Temp,CV_8UC3);
Mat Result=Temp.clone();
qDebug()<<CV_8UC1<<CV_8UC3;
qDebug()<<"Type"<<Temp.type()<<Result.type()<<CurrentMat.type();
qDebug()<<"Data"<<Result.data<<CurrentMat.data;     
bilateralFilter ( CurrentMat, Result, 5, 15, 15 );

Via the output I can clearly see that the type of Temp is 24 and not 0 or 16 which it should become.

Appreciated.

convertTo from CV_32f to CV_8U

I want to do a bilateral filter and my image has to be type CV_8UC1/C3 for this.

To convert it would appear I have to use convertTo, but this is simply not working.

This is what I am doing:

Mat Temp= Mat(CurrentMat.size(),CV_8U);
CurrentMat.convertTo(Temp,CV_8UC3);
Mat Result=Temp.clone();
qDebug()<<CV_8UC1<<CV_8UC3;
qDebug()<<"Type"<<Temp.type()<<Result.type()<<CurrentMat.type();
qDebug()<<"Data"<<Result.data<<CurrentMat.data;     
bilateralFilter ( CurrentMat, Result, 5, 15, 15 );

Via the output I can clearly see that the type of Temp is 24 and not 0 or 16 which it should become.

Appreciated.