vision-camera-face-detection 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -197,7 +197,7 @@ class FaceHelper {
197
197
  return pixelBuffer
198
198
  }
199
199
 
200
- static func getImageFaceFromBuffer(from sampleBuffer: CMSampleBuffer?, rectImage: CGRect) -> UIImage? {
200
+ static func getImageFaceFromBuffer(from sampleBuffer: CMSampleBuffer?, rectImage: CGRect, orientation: UIImage.Orientation) -> UIImage? {
201
201
  guard let sampleBuffer = sampleBuffer else {
202
202
  print("Sample buffer is NULL.")
203
203
  return nil
@@ -212,7 +212,7 @@ class FaceHelper {
212
212
 
213
213
  if (!rectImage.isNull) {
214
214
  let imageRef: CGImage = cgImage.cropping(to: rectImage)!
215
- let imageCrop: UIImage = UIImage(cgImage: imageRef, scale: 0.5, orientation: .up)
215
+ let imageCrop: UIImage = UIImage(cgImage: imageRef, scale: 0.5, orientation: orientation)
216
216
  return imageCrop
217
217
  } else {
218
218
  return nil
@@ -267,7 +267,7 @@ public class VisionCameraFaceDetectionPlugin: FrameProcessorPlugin {
267
267
 
268
268
  let faces: [Face] = try faceDetector!.results(in: image)
269
269
  for face in faces {
270
- guard let imageCrop = FaceHelper.getImageFaceFromBuffer(from: frame.buffer, rectImage: face.frame) else {
270
+ guard let imageCrop = FaceHelper.getImageFaceFromBuffer(from: frame.buffer, rectImage: face.frame, orientation: orientation) else {
271
271
  return nil
272
272
  }
273
273
  guard let pixelBuffer = FaceHelper.uiImageToPixelBuffer(image: imageCrop, size: inputWidth) else {
@@ -291,6 +291,7 @@ public class VisionCameraFaceDetectionPlugin: FrameProcessorPlugin {
291
291
  } else {
292
292
  map["data"] = []
293
293
  }
294
+ map["base64"] = FaceHelper.convertImageToBase64(image: imageCrop)
294
295
 
295
296
  if runLandmarks {
296
297
  map["landmarks"] = processLandmarks(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vision-camera-face-detection",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Plugin Face Detection for Vision Camera 4",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.cjs",