public static int getFaceCount(String imgSrc) { Photo photo = null; try { photo = faceClient.detect(imgSrc).get(0); } catch (FaceClientException e) { e.printStackTrace(); } catch (FaceServerException e) { e.printStackTrace(); } if (photo != null && photo.getFaces() != null) { return photo.getFaces().size(); } else { return 0; } }
public static List<Face> getFaces(String imgSrc) { Photo photo = null; try { photo = faceClient.detect(imgSrc).get(0); } catch (FaceClientException e) { e.printStackTrace(); } catch (FaceServerException e) { e.printStackTrace(); } if (photo != null) { return photo.getFaces(); } else { return null; } }