# Revision history [back]

If you know that testing is for sure a number, you can use stof

If you know that testing is for sure a number, you can use stof. Because you have a vector (1x256), you can create a vector of floats (CV_32F) and then use the Mat constructor that is having as parameter the vector; or use the same syntax as you used: cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());

If you know that testing is for sure a number, you can use stof. Because you have a vector (1x256), you can create a vector of floats (CV_32F) and then use the Mat constructor that is having as parameter the vector; or use the same syntax as you used: cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());used:

cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());


If you know that testing is for sure a number, you can use stof. Because you have a vector (1x256), you can create a vector of floats (CV_32F) and then use the Mat constructor that is having as parameter the vector; or use the same syntax as you used:

cv::Mat cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());


If you know that testing is for sure a number, you can use stof. Because you have a vector (1x256), you can create a vector of floats (CV_32F) and then use the Mat constructor that is having as parameter the vector; or use the same syntax as you used:

cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());


better explanation:

std::vector<int> values;
for(int d=0;d<256;d++)
{
//testing += '0' + pixelValueArray[d];
values.push_back(stoi('0' + pixelValueArray[d], NULL, 2));
}
cv::Mat data(1,ATTRIBUTES,CV_32F,values.data());


If you know that testing is for sure a number, you can use stof. Because you have a vector (1x256), you can create a vector of floats (CV_32F) and then use the Mat constructor that is having as parameter the vector; or use the same syntax as you used:

cv::Mat data(1,ATTRIBUTES,CV_32F,vecOfFloats.data());


better explanation:

std::vector<int> values;
for(int d=0;d<256;d++)
{
//testing += '0' + pixelValueArray[d];
values.push_back(stoi('0' + pixelValueArray[d], NULL, 2));
}
cv::Mat data(1,ATTRIBUTES,CV_32F,values.data());