Tabnine Logo
Frame$Builder.setBitmap
Code IndexAdd Tabnine to your IDE (free)

How to use
setBitmap
method
in
com.google.android.gms.vision.Frame$Builder

Best Java code snippets using com.google.android.gms.vision.Frame$Builder.setBitmap (Showing top 5 results out of 315)

origin: googlesamples/android-vision

Frame frame = new Frame.Builder().setBitmap(bitmap).build();
SparseArray<Face> faces = safeDetector.detect(frame);
origin: aryarohit07/GlideFaceDetectionTransformation

/**
 * Calculates a point (focus point) in the bitmap, around which cropping needs to be performed.
 *
 * @param bitmap           Bitmap in which faces are to be detected.
 * @param centerOfAllFaces To store the center point.
 */
private void detectFace(Bitmap bitmap, PointF centerOfAllFaces) {
  FaceDetector faceDetector = GlideFaceDetector.getFaceDetector();
  if (!faceDetector.isOperational()) {
    centerOfAllFaces.set(bitmap.getWidth() / 2, bitmap.getHeight() / 2); // center crop
    return;
  }
  Frame frame = new Frame.Builder().setBitmap(bitmap).build();
  SparseArray<Face> faces = faceDetector.detect(frame);
  final int totalFaces = faces.size();
  if (totalFaces > 0) {
    float sumX = 0f;
    float sumY = 0f;
    for (int i = 0; i < totalFaces; i++) {
      PointF faceCenter = new PointF();
      getFaceCenter(faces.get(faces.keyAt(i)), faceCenter);
      sumX = sumX + faceCenter.x;
      sumY = sumY + faceCenter.y;
    }
    centerOfAllFaces.set(sumX / totalFaces, sumY / totalFaces);
    return;
  }
  centerOfAllFaces.set(bitmap.getWidth() / 2, bitmap.getHeight() / 2); // center crop
}
origin: aryarohit07/PicassoFaceDetectionTransformation

/**
 * Calculates a point (focus point) in the bitmap, around which cropping needs to be performed.
 *
 * @param bitmap           Bitmap in which faces are to be detected.
 * @param centerOfAllFaces To store the center point.
 */
private void detectFace(Bitmap bitmap, PointF centerOfAllFaces) {
  FaceDetector faceDetector = PicassoFaceDetector.getFaceDetector();
  if (!faceDetector.isOperational()) {
    centerOfAllFaces.set(bitmap.getWidth() / 2, bitmap.getHeight() / 2); // center crop
    return;
  }
  Frame frame = new Frame.Builder().setBitmap(bitmap).build();
  SparseArray<Face> faces = faceDetector.detect(frame);
  final int totalFaces = faces.size();
  if (totalFaces > 0) {
    float sumX = 0f;
    float sumY = 0f;
    for (int i = 0; i < totalFaces; i++) {
      PointF faceCenter = new PointF();
      getFaceCenter(faces.get(faces.keyAt(i)), faceCenter);
      sumX = sumX + faceCenter.x;
      sumY = sumY + faceCenter.y;
    }
    centerOfAllFaces.set(sumX / totalFaces, sumY / totalFaces);
    return;
  }
  centerOfAllFaces.set(bitmap.getWidth() / 2, bitmap.getHeight() / 2); // center crop
}
origin: komamitsu/Android-OCRSample

Frame frame = new Frame.Builder().setBitmap(bitmap).build();
SparseArray<TextBlock> origTextBlocks = textRecognizer.detect(frame);
List<TextBlock> textBlocks = new ArrayList<>();
origin: PaulTR/AndroidDemoProjects

public void setBitmap( Bitmap bitmap ) {
  mBitmap = bitmap;
  FaceDetector detector = new FaceDetector.Builder( getContext() )
      .setTrackingEnabled(true)
      .setLandmarkType(FaceDetector.ALL_LANDMARKS)
      .setMode(FaceDetector.ACCURATE_MODE)
      .build();
  if (!detector.isOperational()) {
    //Handle contingency
  } else {
    Frame frame = new Frame.Builder().setBitmap(bitmap).build();
    mFaces = detector.detect(frame);
    detector.release();
  }
  logFaceData();
  invalidate();
}
com.google.android.gms.visionFrame$BuildersetBitmap

Popular methods of Frame$Builder

  • <init>
  • build
  • setId
  • setImageData
  • setRotation
  • setTimestampMillis

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Table (org.hibernate.mapping)
    A relational table
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now