I am using OpenCV 2.2 on MS Visual C++ 2010 on Windows 7. 32 bit application.
I am trying to make the following matrix. [-1 0 1].
I try
cv::Mat Kernel = cv::Mat::zeros(1, 3, CV_8S );
Kernel.data[0] = -1;
Kernel.data[2] = 1;
I get [255 0 1].
I get the same result regardless of what I replace CV_8S with.
Can anyone see what I am doing wrong?
Thanks,
Peter
the data member of
cv::Matis in factuchar*and notchar*regardless of the actual matrix type (i.e.CV_8U), I guess you print the values by iterating overkernel.datawithout casting data fromuchar*tochar*(or checking them with watch without doing the same) and that why you cant see negative number.Additionally, you have a nicer syntax to achieve the same