Ask Your Question

Owen1991's profile - activity

2017-05-01 20:36:13 -0600 received badge  Supporter (source)
2017-05-01 20:35:32 -0600 commented answer Opencv Face detection show different result between win and linux

Thanks for your reply . I figured this out at Friday. I think two sever had two different reason . First reason: two server have different folder path. Throw FileNotFound cause I copied file path from anthor server then loaded a null path. Second one I'm not sure why. certainly file path not null. After recompile Opencv and replace all .so file . It's just worked fine. And thanks for your help. wish you have a nice day.

2017-05-01 20:25:33 -0600 received badge  Scholar (source)
2017-04-27 07:11:06 -0600 asked a question Opencv Face detection show different result between win and linux

I'm coding at Win10. and run the project at Linux. It's worked fine at win10 env, and got some problem with Linux system (centos 7). and got same problem in 2 different linux server. env: java8 + opencv2.4.13 + tomcat8.

1.Throw exception when runing cvtColor() in Linux. like this:

Mat image = Highgui.imread(inputimg);  //Only have 1 channel in Linux. and the same pic have 3 channels in win.
Imgproc.cvtColor(image, image , Imgproc.COLOR_RGB2GRAY); //throw exception at this line

It's throwing this:

throws java.io.FileNotFoundException]: CvException [org.opencv.core.CvException: cv::Exception: /home/qh/opencv/opencv-2.4.13/modules/imgproc/src/color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cvtColor]
CvException [org.opencv.core.CvException: cv::Exception: /home/qh/opencv/opencv-2.4.13/modules/imgproc/src/color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cvtColor

The same picture. have 3 channels in windows. only have 1 channel in Linux.(I print Mat.channels() in java. It shows only 1 channel in linux. ). (scn means count of image channels in c++ source code. and COLOR_RGB2GRAY need input image file have 3 or 4 channels. )

2.Then I delete cvtColor() from my code. now it look like this. and got anthor situation.

Mat image = Highgui.imread(inputimg);
        CascadeClassifier faceDetector =  new CascadeClassifier(dataxml);
        MatOfRect faceDetections = new MatOfRect();
        faceDetector.detectMultiScale(image, faceDetections);

I'm using the same code , same picture. And the program can correctly detect faces in windows. but always detect 0 faces in linux.

Why same code , same picture got different result.