use of org.reactnative.facedetector.RNFrame in project react-native-camera by react-native-community.
the class FileFaceDetectionAsyncTask method doInBackground.
@Override
protected SparseArray<Face> doInBackground(Void... voids) {
if (isCancelled()) {
return null;
}
mRNFaceDetector = detectorForOptions(mOptions, mContext);
Bitmap bitmap = BitmapFactory.decodeFile(mPath);
mWidth = bitmap.getWidth();
mHeight = bitmap.getHeight();
try {
ExifInterface exif = new ExifInterface(mPath);
mOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
} catch (IOException e) {
Log.e(ERROR_TAG, "Reading orientation from file `" + mPath + "` failed.", e);
}
RNFrame frame = RNFrameFactory.buildFrame(bitmap);
return mRNFaceDetector.detect(frame);
}
Aggregations