我已经在这个网站上搜索过查找图像中的面部。但没有运气。我正在使用以下代码 -
private static final int MAX_FACES = 10;
private static final String IMAGE_FN = "/storage/sdcard0/DCIM/Camera/image.jpg";
private Bitmap background_image;
FaceDetector face_detector;
private FaceDetector.Face faces[];
private int face_count;
BitmapFactory.Options bitmap_options = new BitmapFactory.Options();
bitmap_options.inPreferredConfig = Bitmap.Config.RGB_565;
background_image = BitmapFactory.decodeFile(IMAGE_FN, bitmap_options);
int width = background_image.getWidth();
int height = background_image.getHeight();
face_detector = new FaceDetector( width, height, MAX_FACES);
faces = new FaceDetector.Face[MAX_FACES];
face_count = 0;
face_count = face_detector.findFaces(background_image, faces);
但是,我仍然无法在图像中获得正确的脸部数量。 谁能找到代码中的缺陷?或者你认为它应该工作吗?