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 7719607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:27:28+00:00 2026-06-01T03:27:28+00:00

I am doing a Face Recognition project for my final year. I have to

  • 0

I am doing a Face Recognition project for my final year. I have to do face Recognition on Android using Local Binary Pattern(LBP).

I searched a lot on the internet for codes for face recognition using LBP in java, but couldn’t find anything implementable on android. So now I am forced to writing it all, and I am a kind of a newbie to android as well as image processing.

I have found out a way to capture images from the camera.

public class CameraCapture extends Activity {

protected boolean _taken = true;
File sdImageMainDirectory;

protected static final String PHOTO_TAKEN = "photo_taken";

@Override
public void onCreate(Bundle savedInstanceState) {

    try {

        super.onCreate(savedInstanceState);         
                File root = new File(Environment
                        .getExternalStorageDirectory()
                        + File.separator + "myDir" + File.separator);
                root.mkdirs();
                sdImageMainDirectory = new File(root, "myPicName");


            startCameraActivity();
        }
     catch (Exception e) {
        finish();
        Toast.makeText(this, "Error occured. Please try again later.",
                Toast.LENGTH_SHORT).show();
    }

}

protected void startCameraActivity() {

    Uri outputFileUri = Uri.fromFile(sdImageMainDirectory);

    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

    startActivityForResult(intent, 0);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (resultCode) {
    case 0:
        finish();
        break;

    case -1:

        try {
            StoreImage(this, Uri.parse(data.toURI()),
                    sdImageMainDirectory);
        } catch (Exception e) {
            e.printStackTrace();
        }

        finish();
        startActivity(new Intent("com.piit.lbp.form.LBPFORMADD"));

    }

}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState.getBoolean(CameraCapture.PHOTO_TAKEN)) {
        _taken = true;
    }
}

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(CameraCapture.PHOTO_TAKEN, _taken);
}

    public static void StoreImage(Context mContext, Uri imageLoc, File imageDir) {
    Bitmap bm = null;

    try {
        bm = Media.getBitmap(mContext.getContentResolver(), imageLoc);
        bmGray = toGrayScale(bm);
        FileOutputStream out = new FileOutputStream(imageDir);
        bm.compress(Bitmap.CompressFormat.JPEG, 100, out);
        bm.recycle();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

Question : What is the “Bitmap bm” – like RGB_565, or something else ?? and how many bits.

Before compressing bitmap to jpeg I call a RGB to Grayscale method with the following code

public static Bitmap toGrayscale(Bitmap bmpOriginal)
{        
    int width, height;
    height = bmpOriginal.getHeight();
    width = bmpOriginal.getWidth();    

    Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
    Canvas c = new Canvas(bmpGrayscale);
    Paint paint = new Paint();
    ColorMatrix cm = new ColorMatrix();
    cm.setSaturation(0);
    ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
    paint.setColorFilter(f);
    c.drawBitmap(bmpOriginal, 0, 0, paint);
    return bmpGrayscale;
}

And then I wish to use bmGray for applying LBP operator.
Question : When you convert to Grayscale using ColorMatrix, is it 8bits per pixel ??

Cos I want to convert bmGray to Byte Array and want to extract only 1 byte at a time. And also I want to know if can convert the grayscale image to a 2d matrix of pixel values, I know that it is already a 2d matrix of pixel values, but how can i work on it.. like selecting the pixel above and below the current pixel. ??

  • 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-01T03:27:29+00:00Added an answer on June 1, 2026 at 3:27 am

    for the CameraPicture this applies:

    If setPreviewFormat(int) is never called, the default will be the
    YCbCr_420_SP (NV21) format.
    http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFormat%28int%29

    Bitmap bmp you can configure like:

    Bitmap bmp = Bitmap.createBitmap(frameWidth, frameHeight, Bitmap.Config.ARGB_8888); //or RGB_565 if you prefer.
    

    for accessing bmp data I only found something like this: http://upload.wikimedia.org/wikipedia/commons/c/c4/BMPfileFormat.png

    hope it helps

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

Sidebar

Related Questions

I am doing a face recognition project on face recognition based on neural network.It
I am doing a project on face recognition.To test a face we need to
Here is a question that I have to face a lot when doing the
I'm working on a face recognition project and I am having problems when projecting
I was interested in doing a proyect about face-recognition (to make use of SIMD
I am doing a project that recognize human face from camera. Here is the
I am doing HCI (Human Computer Interaction) using face tracking. I am trying to
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some jquery animation. I have certain divs set up with an attribute of

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.