ios - How to produce AVFoundation Camera Images as bright as those taken with the native camera? -


i've played autofocus, , autoexposure, autowhitebalance, , lowlightboost, still can camera images display bright viewed/captured using native iphone 5 camera.

not sure i'm doing wrong. below main function sets auto camera features when screen pressed. autofocus works. not sure if auto exposure, white balance, , lowlightboost working supposed because dark items viewed don't brighten native camera. of code below taken avcam example posted on iosdev center site.

thanks in advance!

- (ibaction)focusandexposetap:(uigesturerecognizer *)gesturerecognizer {     cgpoint devicepoint = [(avcapturevideopreviewlayer *)[[self previewview] layer] capturedevicepointofinterestforpoint:[gesturerecognizer locationinview:[gesturerecognizer view]]];     [self focuswithmode:avcapturefocusmodeautofocus exposewithmode:avcaptureexposuremodeautoexpose whitebalancewithmode:avcapturewhitebalancemodecontinuousautowhitebalance atdevicepoint:devicepoint monitorsubjectareachange:yes]; }  - (void)focuswithmode:(avcapturefocusmode)focusmode exposewithmode:(avcaptureexposuremode)exposuremode whitebalancewithmode:(avcapturewhitebalancemode)whitebalancemode atdevicepoint:(cgpoint)point monitorsubjectareachange:(bool)monitorsubjectareachange{ dispatch_async([self sessionqueue], ^{     avcapturedevice *device = [[self videodeviceinput] device];     nserror *error = nil;     if ([device lockforconfiguration:&error])     {         if ([device isfocuspointofinterestsupported] && [device isfocusmodesupported:focusmode])         {             [device setfocusmode:focusmode];             [device setfocuspointofinterest:point];         }         nslog(@"pre-exposure mode support?: %hhd", [device isexposurepointofinterestsupported]);         if ([device isexposurepointofinterestsupported] && [device isexposuremodesupported:exposuremode])         {             [device setexposuremode:exposuremode];             [device setexposurepointofinterest:point];         }         nslog(@"pre-white balance mode support? %hhd", [device iswhitebalancemodesupported:whitebalancemode]);         if ([device iswhitebalancemodesupported:whitebalancemode])         {             [device setwhitebalancemode:whitebalancemode];         }         nslog(@"pre low light mode: %hhd", [device islowlightboostsupported]);         if ([device islowlightboostsupported]){             [device setautomaticallyenableslowlightboostwhenavailable:yes];         }         [device setsubjectareachangemonitoringenabled:monitorsubjectareachange];         [device unlockforconfiguration];     }     else     {         nslog(@"%@", error);     } }); } 

my guess problem lies on avcaptureexposuremode. can refer thread here, ios 7 not support avcaptureexposuremodeautoexpose on devices. consequently, exposurepointofinterest not set on desired point.

your program not enter following snippet of code (you can check yourself):

if ([device isexposurepointofinterestsupported] && [device isexposuremodesupported:exposuremode])         {             [device setexposuremode:exposuremode];             [device setexposurepointofinterest:point];         } 

if want have auto expose functionality, can using avcaptureexposuremodecontinuousautoexpose set exposure @ point. listen (key-value observe kvo) isadjustingexposure property of avcapturedevice know when exposure finishes adjusting. does, setexposuremode avcaptureexposuremodelocked.

please let me know if doesn't help, otherwise may accept , upvote answer :)


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -