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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:26:33+00:00 2026-06-08T20:26:33+00:00

Im currently working on a program which applies edge detection to an area of

  • 0

Im currently working on a program which applies edge detection to an area of the preview frame. I have used previewcallback and got my cropped bitmap, have converted to grayscale using the following method.

int height1=120;
int width2=120;

            final Bitmap resizedBitmap = Bitmap.createBitmap(bmp, 260, 15, 
                    width2, height1);
            try {
                int bWidth = resizedBitmap.getWidth();
                int bHeight = resizedBitmap.getHeight();
                int[] pixels = new int[bWidth * bHeight];
                resizedBitmap.getPixels(pixels, 0, bWidth, 0, 0, bWidth, bHeight);
                for (int y = 0; y < bHeight; y++){
                    for (int x = 0; x < bWidth; x++){
                        int index = y * bWidth + x;
                        int R = (pixels[index] >> 16) & 0xff;     //bitwise shifting
                        int G = (pixels[index] >> 8) & 0xff;
                        int B = pixels[index] & 0xff;
                        int gray = (int) (.299 * R + .587 * G + .114 * B);
                    }
                }

I am very new to this, and would like to know whether gray is a 2D array of 120×120 pixels, or whether the value of gray is just being overwritten for each loop.

Apologies if this is very basic

  • 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-08T20:26:35+00:00Added an answer on June 8, 2026 at 8:26 pm

    Well, maybe I’m missing something, but as far as I can see gray is overwritten. You’d need something like

    int[][] gray = new int[width][height];
    // start loop
    

    In the Loop:

    gray[x][y] = ...;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python program that I am currently working on which is working
I'm currently working on a program for a C course in which I have
I'm am currently working on a program in java which requires adding a small
I'm working a program which renders a dynamic high resolution voxel landscape. Currently I
In the program I'm currently working on, my table has a Create_Timestamp column, which
I am currently working on a program which accepts a user input through the
I am working with a consulting group on a program which currently uses a
I'm currently working on a Win32 program which requires a main window containing many
I am currently working on a project with which I need to program up
I'm currently working on a tracking program which tracks hundreds of users at once,

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.