Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8323689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:47:52+00:00 2026-06-08T23:47:52+00:00

Hi my face detection thread is working too slow, I call this thread from

  • 0

Hi my face detection thread is working too slow,
I call this thread from onPreviewFrame only if the thread is not working else i just skip the call and after the thread detect face i call onDraw inside the view to draw rectangle

    public void run() {
        FaceDetector faceDetector = new FaceDetector(bitmapImg.getWidth(), bitmapImg.getHeight(), 1);
        numOfFacesDetected = faceDetector.findFaces(bitmapImg, detectedFaces);

        if (numOfFacesDetected != 0) {
            detectedFaces.getMidPoint(eyesMidPoint);
            eyesDistance = detectedFaces.eyesDistance();

            handler.post(new Runnable() {
                public void run() {
                    mPrev.invalidate();
                    // turn off thread lock
                }
            });

            mPrev.setEyesDistance(eyesDistance);
            mPrev.setEyesMidPoint(eyesMidPoint);
        }

        isThreadWorking = false;
    }


public void onPreviewFrame(byte[] yuv, Camera camera) {

if (isThreadWorking)
return;

    isThreadWorking = true;
    ByteBuffer bbuffer = ByteBuffer.wrap(yuv);
    bbuffer.get(grayBuff_, 0, bufflen_);

    detectThread = new FaceDetectThread(handler);
    detectThread.setBuffer(grayBuff_);
    detectThread.start();

my questions is maybe because am working with bitmap and not gray scale it’s taking too long ? how can i improve the speed ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:47:53+00:00Added an answer on June 8, 2026 at 11:47 pm

    The FaceDetector API is not really made to process frames in a live preview. It’s way to slow for that.

    If you are running on a fairly new device, a better option is to use the FaceDetectionListener API in Android 14+. It is very fast and can be used to create an overlay on a preview SurfaceHolder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a face detection and recognition software...i succeeded in detecting the
Following a tutorial from iTunes U on how to do face detection (the tutorial
I am working for a project at school regarding face detection, based on a
I am using the code available in this website: http://nashruddin.com/OpenCV_Face_Detection to do face detection.
Now that face detection is possible with ios 5, i am just wondering is
I am working on a project that needs to do face detection on a
I am trying to do some Face Recognition (not detection) stuff using OpenCV. I
I found out opencv sample face detection example for android but it is detecting
I face some problems when I am trying to remove rows from a table
In face-configs.xml, <navigation-rule> <from-view-id>/login.jspx</from-view-id> <navigation-case> <from-outcome>failure</from-outcome> <to-view-id>/login.jspx?Error=InvalidUser</to-view-id> <redirect /> </navigation-case> </navigation-rule> When Login return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.