java - how to detect the number of face in an image picture -
I'm making an Android face detection app and it is always called when I run it on my device : "Sorry TakePic has stopped suddenly" Here is your code for face detection and I believe that this is the source of error: / P> Bitmap = MediaStore.Images. Media.getBitmap (CR, selected image); = (TextView) FindViewById (R.id.detect) to detect textView; What mistake could this code have with you? After The best practice in such cases is to inspect the logcat scene and find out the exception messages. To do that is where your code is breaking.
Bitmap maskBitmap = Bitmap.createBitmap (bitmap.getWidth (), bitmap.getHeight (), Bitmap.Config.RGB_565); Canvas C = new canvas (); C.setBitmap (maskBitmap); Paint P = new paint (); P.setFilterBitmap (true); // Perhaps probably not because there is no scaling c.drawbitmap (bitmap, 0,0, p); Bitmap.recycle (); DetectedFaces = New Phase Detector Face [NUMBER_OF_FACES]; FaceDetector = new FaceDetector (maskBitmap.getWidth (), maskBitmap.getHeight (), NUMBER_OF_FACES); NUMBER_OF_FACE_DETECTED = faceDetector.findFaces (Mask bitmap, detected); K.setImageBitmap (bitmap); Detect.setText (NUMBER_OF_FACE_DETECTED); Toast.makeText (MainActivity.this, selectedImage.toString (), Toast.LENGTH_LONG) .show ();
Comments
Post a Comment