subtract method replace negative values with zeros
I am doing subtraction of grayscale images. i want to keep negative values. but subtract method in opencv replace negative values with zeros. User Mat types are CV_32S, CV_32F.
public double corr2(Mat img1, Mat img2){
Mat grayImg1,grayImg2;
grayImg1=new Mat(300,300,CV_32S);
grayImg2=new Mat(300,300,CV_32S);
Imgproc.cvtColor(img1,grayImg1,COLOR_RGB2GRAY);
Imgproc.cvtColor(img2,grayImg2,COLOR_RGB2GRAY);
Scalar img1mean=Core.mean(grayImg1);
Scalar img2mean=Core.mean(grayImg2);
Core.subtract(grayImg1,img1mean,grayImg1);
what is the input type ? (of img1 and img2) ?