CascadeClassifier with haarcascade apparently not working
Hi there,
First of all thanks for any help !!!
I am trying to detect the nose on a face Bitmap.
For the purpose I use a CascadeClassifier with haarcascade.
Here is the haarcascade: link text
Here is the code:
//Load image, convert into Bitmap, convert to grayscle
BitmapFactory.Options op = new BitmapFactory.Options();
op.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.face, op);
Bitmap.Config conf = Bitmap.Config.ARGB_8888;
bm=toGrayscale(bm);
// Initialize Mat and MatofRec
mat = new Mat();
rec = new MatOfRect();
//Load Bitmap into Map
ut.bitmapToMat(bm, mat);
mat.convertTo(mat2, CvType.CV_8U);
Log.e("","mat è " +Integer.toString(mat.width())+" "+ Integer.toString(mat.height())+" "+ Integer.toString(mat.type()));
//Create CascadeClassifier loading haarcascade from Android Resources
CascadeClassifier cc=
new CascadeClassifier("android.resource://com.example.test/raw/haarcascade_mcs_nose.xml");
//Call detectMultiScale
cc.detectMultiScale(mat2,rec,1.1,2,2,new Size(400,400),new Size(400,400));
outrec=rec.toArray();
But apparently something is not working.
The MatOfRect rec contains no Rect, indeed the Array outrec is empty: outrec.length=0.
What am I doing wrong?
Thanks a lot for any hint !!!
If this topic is solved, then please remove SOLVED from the title and mark an answer (might be your own answer) as "accepted.
@SR "New users must wait 2 days before answering their own question. You can post an answer tomorrow" This is why was not able to answer my own question. I will clean everything tomorrow. Thanks