Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  • make sure, you image is actually loaded. this is your actual problem here !
  • cvtColor() will complain, if it was fed an invalid/empty image, the other functions is your java pipeline unfortunately won't , so removing the cvtColor line will just suppress the problem, not solve it.

so, please check your resources, carefully:

Mat image = Highgui.imread(inputimg); 
if (image.empty()) {
      // path problem, image not read. throw some error. 
}

CascadeClassifier faceDetector =  new CascadeClassifier(dataxml);
if (faceDetector.empty()) {
       // path to xml is broken, throw error !
}
  • make sure, you image is actually loaded. this is your actual problem here !
  • cvtColor() will complain, if it was fed an invalid/empty image, the other functions is your java pipeline unfortunately won't , so removing the cvtColor line will just suppress the problem, not solve it.

so, please check your resources, carefully:

Mat image = Highgui.imread(inputimg); 
if (image.empty()) {
      // path problem, image not read. throw some error. 
}

CascadeClassifier faceDetector =  new CascadeClassifier(dataxml);
if (faceDetector.empty()) {
       // path to xml is broken, throw error !
}