Framework for ambient light level?
Framework for ambient light level?
- Subject: Framework for ambient light level?
- From: William Squires <email@hidden>
- Date: Thu, 24 Apr 2014 16:10:07 -0500
I'm looking for a way to determine the ambient light level for a program simulating an electronic circuit involving a solar cell (photovoltaic cell), where the output voltage will be set based on the measured ambient light level. It looks like recent iMac and MacBook Pro models have a way to brighten/dim the backlighting based on the ambient light level. The questions:
1) Is there a dedicated sensor for this, or is it using the front-facing FaceTime camera?
2) If there is a dedicated sensor (such as a CdS cell or photo-transistor), is there a way to get it's current measurement?
3) If not, how can I do the following
a) make a thread that
i) Captures a frame from the FaceTime camera
ii) Applies a grayscale filter (I'm guessing CoreImage probably already has this, if you have an NSImage)
iii) Averages all the pixels to come up with a (rough) gauge of ambient light level (as an unsigned byte) - preferably by using the graphics coprocessor to unload the task from the main CPU!
iv) Communicates this back to the main thread.
b) Grab the info from the above thread without violating the "non-main threads may not manipulate the UI" rule.
c) determine how long it takes the steps (a) above, so I can determine how often to execute step (b) for my simulation.
Anyway, TIA. BTW, this is for MacOS X 10.8 or later, not iOS. :)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden