Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Brightness, Contrast, WhiteBalance, Exposure, Focus and Sharpness of AVCaptureSession?

I am doing a MAC App in swift,i was able to preview camera on NSView now i want to change brightness/contrast/white-balance and all camera related settings.

I am using AVFoundation framework to preview the camera and i have slider to change the values , How can i change all those setting with user values.

How this AVFondations link with IOKit.. I found one UVCCamera controls link to change Manual camera control, can i use this format???

and in one more site i found that

'IOKit -- Low-level framework for communicating with the kernel and hardware. Apple advises not to use this framework directly and will reject it from the AppStore.'

Thanks

like image 448
iosLearner Avatar asked Oct 31 '22 12:10

iosLearner


1 Answers

If you want to change attributes of already captured images, it seems like you need to look into the CIFilter class, which is related to changing images. See https://developer.apple.com/documentation/coreimage/cifilter/filter_parameter_keys, where it documents filter parameters such as:

  • kCIInputSharpnessKey A key for a scalar value (NSNumber) that specifies the amount of sharpening to apply.
  • ...
  • kCIInputIntensityKey — A key for a scalar value (NSNumber) that specifies an intensity value.
  • kCIInputEVKey — A key for a scalar value (NSNumber) that specifies how many F-stops brighter or darker the image should be.
  • ...
  • kCIInputBrightnessKey — A key for a scalar value (NSNumber) that specifies a brightness level.

On the same page, there are also some links to related code samples doing some of this stuff.

Hopefully this will get you on the way to changing the settings you want to change. If you are building an user interface, you might also want to look into the Core Imaging stuff, where they have separate Core Image Views for addition into your own applications.

like image 114
holroy Avatar answered Nov 08 '22 11:11

holroy