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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:21:08+00:00 2026-06-13T23:21:08+00:00

Am working on a project that takes Images or Preview Images from the Camera

  • 0

Am working on a project that takes Images or Preview Images from the Camera then I must calculate the average count of Blue in the image, I already took the image from the camera rapidly (As Preview Images).
the image format is NV21 (really am not expert in image formats, so I don’t why they use it)

and this is how I read images from the Camera Preview Callback

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

        Camera.Parameters parameters = camera.getParameters();
        Size size = parameters.getPreviewSize();
        YuvImage image = new YuvImage(data, ImageFormat.NV21, size.width,
                size.height, null);
        Rect rectangle = new Rect();
        rectangle.bottom = size.height;
        rectangle.top = 0;
        rectangle.left = 0;
        rectangle.right = size.width;
        ByteArrayOutputStream out2 = new ByteArrayOutputStream();
        image.compressToJpeg(rectangle, 100, out2);

        byte[] d = out2.toByteArray();
        Bitmap bitmap = BitmapFactory.decodeByteArray(d, 0, d.length);
    }

and as you see I have Bitmap now, and I was planning to read determine blue color in image, by reading the Bitmap pixels and then process Pixel by Pixel, but co-workers says that way is heavy and slow in some case and not accurate, and I must get the color blue in the image as matrix from hardware it self, and am not sure where to start with it (btw my co-workers works on iOS version), any help will be appreciated.

  • 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-13T23:21:09+00:00Added an answer on June 13, 2026 at 11:21 pm

    If you are using opencv for android you can have a simple native call (JNICALL) passing the bitmap to the function as jbyte* , then in the function convert it to BGR using
    Mat myuv ,mbgra;
    cvtColor(myuv, mbgra, CV_YUV420sp2BGR, 4);

    then split the matrix mbgra , after this finding no of blue pixel is a binary mask operation on the splitted matrix’s, since its native and you are not going to look into each pixel by pixel it might be fast.

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

Sidebar

Related Questions

I'm working on a web project that takes the results from a survey type
I have a fully working Setup project within Visual Studio 2008 that takes inputs
The project I am working on at the moment basically takes in an image
I'm working on a project that has me approximating text rendered as an image
I'm working on a project that screen scrapes a list of departure times from
I am working on a project that takes a delimited set of data of
I'm working on a project that will require me to take various .vbproj and
I have a working project that Im amending, it crashes after trying to use
I'm working on project that lets users choose some scientific authors and columnists and
Im working on a project that has an implementation of JOSSO in place. We

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.