OpenCV multiply scalar and a Matrix
- by jarjarbinks
Hi,
I am trying to find the easiest way to add, subtract a scalar value with a opencv 2.0 cv::Mat class.
Most of the existing function allows only matrix-matrix and matrix-scalar operations.
I am looking for a scalar-matrix operations.
I am doing it currently by creating a temporary matrix with the same scalar value and doing required arithmetic operation. Example below..
Mat M(Size(100,100), CV_8U);
Mat temp = Mat::ones(100, 100, CV_8U)*255;
M = temp-M;
But I think there should be better/easier ways to do it.
Any suggestions ?