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.
1 | initial version |
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.
2 | retagged |
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.
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);
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 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;<br>
grayImg1,grayImg2;
grayImg1=new Mat(300,300,CV_32S);<br>
Mat(300,300,CV_32S);
grayImg2=new Mat(300,300,CV_32S);<br>
Mat(300,300,CV_32S);
Imgproc.cvtColor(img1,grayImg1,COLOR_RGB2GRAY);<br>
Imgproc.cvtColor(img1,grayImg1,COLOR_RGB2GRAY);
Imgproc.cvtColor(img2,grayImg2,COLOR_RGB2GRAY);<br>
Imgproc.cvtColor(img2,grayImg2,COLOR_RGB2GRAY);
Scalar img1mean=Core.mean(grayImg1); <br>
img1mean=Core.mean(grayImg1);
Scalar img2mean=Core.mean(grayImg2);<br>
img2mean=Core.mean(grayImg2);
Core.subtract(grayImg1,img1mean,grayImg1);
6 | retagged |
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);