Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

negative value of cv::Mat

I observe that when the Mat data,which were loaded from a picture, transform negative value to zero after subtracting by a number.But I don't need this transform,what should i do ?pleace. The codes are as follows.

include<iostream>

include<opencv2 core="" core.hpp="">

include<opencv2 highgui="" highgui.hpp="">

include<opencv2 imgproc="" imgproc.hpp="">

using namespace std; using namespace cv; int main() {

    Mat M;
Point2i p;
M = imread("D:\\Documents\\Desktop\\Face data\\AR1\\001\\AR001-1.tif", 1);
cvtColor(M, M, CV_BGR2GRAY);
M = M - 300;
cout << M << endl;

  waitKey(0);
system("pause");

}

click to hide/show revision 2
None

updated 2018-03-27 03:18:54 -0600

berak gravatar image

negative value of cv::Mat

I observe that when the Mat data,which were loaded from a picture, transform negative value to zero after subtracting by a number.But I don't need this transform,what should i do ?pleace. The codes are as follows.

include<iostream>

include<opencv2 core="" core.hpp="">

include<opencv2 highgui="" highgui.hpp="">

include<opencv2 imgproc="" imgproc.hpp="">

#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
int main()
{

{
     Mat M;
 Point2i p;
 M = imread("D:\\Documents\\Desktop\\Face data\\AR1\\001\\AR001-1.tif", 1);
 cvtColor(M, M, CV_BGR2GRAY);
 M = M - 300;
 cout << M << endl;

   waitKey(0);
 system("pause");
}

}

negative value of cv::Mat

I observe that when the Mat data,which were loaded from a picture, transform negative value to zero after subtracting by a number.But I don't need this transform,what should i do ?pleace. The codes are as follows.

#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
int main()
{

        Mat M;
    Point2i p;
    M = imread("D:\\Documents\\Desktop\\Face data\\AR1\\001\\AR001-1.tif", 1);
    cvtColor(M, M, CV_BGR2GRAY);
    M = M - 300;
    cout << M << endl;

      waitKey(0);
    system("pause");
}