I want to get brightness information from my iPhone camera.

Asked 2 years ago, Updated 2 years ago, 96 views

I'd like to create an app that counts the number of moves (the number of push-ups) using real-time images from iPhone cameras.

It's hard to find a way to handle brightness information, so I'd appreciate it if you could let me know.

swift swift5 camera

2022-09-30 19:29

1 Answers

https://qiita.com/koogawa/items/e0b3862c0fbdf97b579f
Can't I do this?

The screen brightness can be obtained as follows:

Objective-C:

CGFloat brightness=[UISscreen mainScreen].brightness;

Returns a value between 0.0 and 1.0.The more numbers you have, the brighter it becomes.

By the way, this is the case for Swift.
Swift:

var brightness:CGFloat=UISscreen.main.brightness

Screen brightness = surrounding brightness, so if the brightness is high, it is possible to judge that the user is in a bright place.
However, some users have fixed screen brightness, so this standard is not always true.

That's right.


2022-09-30 19:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.