1 | initial version |
"It does not work." -- no wonder. well, almost everything is wrong in you current attempt.
if your Mat is of type 8UC1(single channel), initializing it with a 3 channel Scalar(0,255,0) does not make any sense (only the 1st 0 will be used.)
you must access it as: M.at<uchar>(y,x)
, not as M.at<double>()
if your Mat has a single row only, it must be M.at<uchar>(0,i)
, using 1 as index is already out of bounds.
" i need to access and change the value one by one." -- this is clearly an anti-pattern in opencv. 99% of all cases can be solved faster and more safe by using a high-level builtin function. try to learn opencv, not to defeat it.