I’m using opencv2 c++ interface.
I want to understand how convert color from Scalar to float. I have a matrix like this:
d = Mat(src.rows, src.cols, CV_32F);
and I want to fill some part of it with a color represented in a Scalar with RGB 255 value:
for(int i=0; i<src.cols*src.rows; i++)
if (some_condition)
// fill it with red
d.at<float>(i/src.cols, i%src.cols) =? Scalar(255,0,0);
For converting some elements of a
floatcv::Mat check this method of cv::Mat classhttp://opencv.willowgarage.com/documentation/cpp/basic_structures.html
You should define a mask that defines which parts of your matrix satisfy the condition of your
if statement.