1 | initial version |
There are some problems with cvtColor and convertTo.
you should try like this :
Mat outImg =imread("f:/lib/opencv/samples/data/lena.jpg",IMREAD_GRAYSCALE);
Mat gaborOut, outAsFloat, gaborImage;
outImg.convertTo( outAsFloat, CV_32F);
Mat gaborKernel = getGaborKernel(cv::Size(30, 30), 1, 0, 1, 0.02);
filter2D(outAsFloat, gaborOut, CV_32F, gaborKernel);
double xmin[4],xmax[4];
minMaxIdx(gaborOut,xmin,xmax);
gaborOut.convertTo(gaborImage, CV_8U, 1.0 / 255.0);
imshow("1-problem", gaborImage);
gaborOut.convertTo(gaborImage, CV_8U, 255.0/(xmax[0]-xmin[0]),-255*xmin[0] /(xmax[0] -xmin[0]));
imshow("2-CV_8U", gaborImage);
waitKey(0);
2 | No.2 Revision |
There are some problems with cvtColor and convertTo.
you should try like this :
Mat outImg =imread("f:/lib/opencv/samples/data/lena.jpg",IMREAD_GRAYSCALE);
Mat gaborOut, outAsFloat, gaborImage;
outImg.convertTo( outAsFloat, CV_32F);
Mat gaborKernel = getGaborKernel(cv::Size(30, 30), 1, 0, 1, 0.02);
filter2D(outAsFloat, gaborOut, CV_32F, gaborKernel);
double xmin[4],xmax[4];
minMaxIdx(gaborOut,xmin,xmax);
gaborOut.convertTo(gaborImage, CV_8U, 1.0 / 255.0);
imshow("1-problem", gaborImage);
gaborOut.convertTo(gaborImage, CV_8U, 255.0/(xmax[0]-xmin[0]),-255*xmin[0] /(xmax[0] -xmin[0]));
imshow("2-CV_8U", gaborImage);
waitKey(0);