float A[]={1,2,3,4};
CvMat *Mat1=cvCreateMat(2,2,CV_32FC1);
Mat1->data.fl = A;
cvNot(Mat1 , Mat1);
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
cout << CV_MAT_ELEM(*Mat1, float, i, j) << endl;
unsigned char B[]={1,2,3,4};
CvMat *Mat2=cvCreateMat(2,2,CV_8UC1);
Mat2->data.ptr = B;
cvNot(Mat2 , Mat2);
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
cout << CV_MAT_ELEM(*Mat2, unsigned char, i, j) << endl;
Here are 2 examples. The unsigned char should be easy to understand. You can use this to help.
cout << (int) CV_MAT_ELEM(*Mat2, unsigned char, i, j) << endl;
For the float this may help (if you can see why the results all negative you probably understand it).
http://en.wikipedia.org/wiki/Floating_point[
^]
See also
http://electronics.stackexchange.com/questions/9941/the-bitwise-complement-of-a-floating-point-numbers-binary-representation[
^]