use of org.reactnative.camera.utils.ImageDimensions in project react-native-camera by react-native-community.
the class RNCameraView method onFacesDetected.
public void onFacesDetected(SparseArray<Face> facesReported, int sourceWidth, int sourceHeight, int sourceRotation) {
if (!mShouldDetectFaces) {
return;
}
SparseArray<Face> facesDetected = facesReported == null ? new SparseArray<Face>() : facesReported;
ImageDimensions dimensions = new ImageDimensions(sourceWidth, sourceHeight, sourceRotation, getFacing());
RNCameraViewHelper.emitFacesDetectedEvent(this, facesDetected, dimensions);
}
use of org.reactnative.camera.utils.ImageDimensions in project react-native-camera by react-native-community.
the class RNFrameFactory method buildFrame.
public static RNFrame buildFrame(byte[] bitmapData, int width, int height, int rotation) {
Frame.Builder builder = new Frame.Builder();
ByteBuffer byteBuffer = ByteBuffer.wrap(bitmapData);
builder.setImageData(byteBuffer, width, height, ImageFormat.NV21);
switch(rotation) {
case 90:
builder.setRotation(Frame.ROTATION_90);
break;
case 180:
builder.setRotation(Frame.ROTATION_180);
break;
case 270:
builder.setRotation(Frame.ROTATION_270);
break;
default:
builder.setRotation(Frame.ROTATION_0);
}
ImageDimensions dimensions = new ImageDimensions(width, height, rotation);
return new RNFrame(builder.build(), dimensions);
}
use of org.reactnative.camera.utils.ImageDimensions in project react-native-camera by lwansbrough.
the class RNFrameFactory method buildFrame.
public static RNFrame buildFrame(byte[] bitmapData, int width, int height, int rotation) {
ByteBuffer byteBuffer = ByteBuffer.wrap(bitmapData);
ImageDimensions dimensions = new ImageDimensions(width, height, rotation);
InputImage image = InputImage.fromByteBuffer(byteBuffer, width, height, rotation, InputImage.IMAGE_FORMAT_NV21);
return new RNFrame(image, dimensions);
}
use of org.reactnative.camera.utils.ImageDimensions in project react-native-camera by react-native-community.
the class RNCameraView method onTextRecognized.
@Override
public void onTextRecognized(SparseArray<TextBlock> textBlocks, int sourceWidth, int sourceHeight, int sourceRotation) {
if (!mShouldRecognizeText) {
return;
}
SparseArray<TextBlock> textBlocksDetected = textBlocks == null ? new SparseArray<TextBlock>() : textBlocks;
ImageDimensions dimensions = new ImageDimensions(sourceWidth, sourceHeight, sourceRotation, getFacing());
RNCameraViewHelper.emitTextRecognizedEvent(this, textBlocksDetected, dimensions);
}
use of org.reactnative.camera.utils.ImageDimensions in project react-native-camera by react-native-community.
the class RNFrameFactory method buildFrame.
public static RNFrame buildFrame(Bitmap bitmap) {
Frame.Builder builder = new Frame.Builder();
builder.setBitmap(bitmap);
ImageDimensions dimensions = new ImageDimensions(bitmap.getWidth(), bitmap.getHeight());
return new RNFrame(builder.build(), dimensions);
}
Aggregations