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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:54:14+00:00 2026-05-19T21:54:14+00:00

My iphone application captures the realtime data from camera using AVFoundation’s AVCaptureSession. I’m able

  • 0

My iphone application captures the realtime data from camera using AVFoundation’s AVCaptureSession. I’m able to access that data in it’s delegate method in runtime and create an image out of it. It can be CGImage, UIImage or just raw data (CMSampleBufferRef).

What I’m trying to do is to calculate luminance, brightness of that data (image). Or it can be some other value that can indicate me how bright the input light is.

Is there any standard way to get this value? Perhaps using OpenGL.

Thanks in advance.

  • 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-05-19T21:54:15+00:00Added an answer on May 19, 2026 at 9:54 pm

    Just convert your image to YUV format and calculate the average of luma channel. Color conversion is a typical operation and any decent image processing framework supports it. For example, OpenCV (you said OpenGL, but that really doesn’t have anything to do with image processing, I’m assuming you meant OpenCV) has CvtColor.

    If you don’t have such a framework handy but have access to the pixel intensities, you can use the equation:

    Y' = 0.299*R + 0.587*G + 0.144*B
    

    to get the luma channel, and then calculate the average. R, G and B represent the red, green and blue channels respectively.

    EDIT

    Note that it is possible that your camera will compensate for bright/dark scenes by modifying its aperture. This is camera-dependent, but I think most cameras do this — otherwise your pictures can end up either saturated (pure white) or plain black — in either case, useless. Human eyes actually do the same thing.

    The downside is that’s it’s hard to tell whether you are in a dark or light environment just by looking at an image. In that case, you may have to go beyond the image and query the camera. In theory, you can do this either directly through a driver (unlikely) or perhaps by looking at the image metadata (e.g. with JPEG, there’s EXIF).

    Lastly, you haven’t said what it is exactly you want to know the brightness of. If it’s the overall scene, then average will be good enough. If it’s some part of the scene, you may have to do something a bit smarter. Let us know if that’s the case.

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

Sidebar

Related Questions

I am developing an iPhone application that persists data to a SQLite3 database. For
I am developing iPhone application and In that application I've one TableViewController , and
When an iPhone application manages its own preferences, rather than using a bundle, it
I'm building an iPhone application that talks to a Ruby on Rails backend. The
I have created an iPhone application based on an OpenGL view. Now I would
I have worked on iPhone application but not aware of the formalities to submit
i am developing a iphone application in a view-based project,(not navigation) however i would
In NYTimes iPhone application, one bar exist in between table header and navigation bar
In my iPhone application I have a table view. When user taps any row,
I am writing an iPhone application, and need to save the state of my

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.