扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
你好!
创新互联主要从事网站设计、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务雨城,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
“在光线暗”的环境中拍照时不能按下不能拍照快门--- 相机无法对焦时,快门是不会启动的。
除了采用夜间模式、打开闪光灯、打开对焦辅助灯外,还可以采取下列措施,提高对焦成功率:
1、提高ISO值(比如提高为ISO400、800、1600甚至更高)。
ISO数值的大小是数码相机对光线反应的敏感程度测量值,通常以ISO数值表示,数值越大表示感光性越强,数值越小表示感光性越弱。
在室内光线不足或拍摄夜景时,使用高ISO值能使对焦成功率大为增加。但照片的噪点也会相应增加。
2、如果环境光源偏暗,即可增加曝光值(如调整为+1EV、+2EV)以突显画面的清晰度。
数码相机在拍摄的过程中,如果按下半截快门,液晶屏上就会显示和最终效果图差不多的图片,对焦,曝光一起启动。这个时候的曝光,正是最终图片的曝光度。
图片如果明显偏亮或偏暗,说明相机的自动测光准确度有较大偏差,要强制进行曝光补偿,不过有的时候,拍摄时显示的亮度与实际拍摄结果有一定出入。
数码相机可以在拍摄后立即浏览画面,此时,可以更加准确地看到拍摄出来的画面的明暗程度,不会再有出入。如果拍摄结果明显偏亮或偏暗,则要重新拍摄,强制进行曝光补偿。
另外,关于相机锁定焦点的操作也要注意:
拍摄时,应该先半按下快门,不要松手,将取景屏里的锁焦框对焦拍摄的焦点(比如人物的脸部),待取景屏里的锁焦框一下收小变绿色或相机发出“嘀”一声,就表明焦点已经锁定,此时再加力完全按下快门就行了。
拍照时,还必须保证持机的稳定,机身的抖动也会致使照片失焦而模糊。
可以实现的,二维码包含的信息是由你控制的,对这两个二维码做不同标示,扫描时根据这个标示做个判断就可以实现
打开相机:
[cpp] view plain copy
//先设定sourceType为相机,然后判断相机是否可用(ipod)没相机,不可用将sourceType设定为相片库
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
// if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
// sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// }
//sourceType = UIImagePickerControllerSourceTypeCamera; //照相机
//sourceType = UIImagePickerControllerSourceTypePhotoLibrary; //图片库
//sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; //保存的相片
UIImagePickerController *picker = [[UIImagePickerController alloc] init];//初始化
picker.delegate = self;
picker.allowsEditing = YES;//设置可编辑
picker.sourceType = sourceType;
[self presentModalViewController:picker animated:YES];//进入照相界面
[picker release];
打开相册:(区分pad和iphone)
for iphone:
[cpp] view plain copy
UIImagePickerController *pickerImage = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
pickerImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//pickerImage.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
pickerImage.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:pickerImage.sourceType];
}
pickerImage.delegate = self;
pickerImage.allowsEditing = NO;
[self presentModalViewController:pickerImage animated:YES];
[pickerImage release];
for ipad:
[cpp] view plain copy
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; //保存的相片
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;//是否允许编辑
picker.sourceType = sourceType;
/*
如果从一个导航按钮处呈现,使用:
presentPopoverFromBarButtonItem:permittedArrowDirections:animated:;
如果要从一个视图出呈现,使用:
presentPopoverFromRect:inView:permittedArrowDirections:animated:
如果设备旋转以后,位置定位错误需要在父视图控制器的下面方法里面重新定位:
didRotateFromInterfaceOrientation:(在这个方法体里面重新设置rect)
然后再次调用:
- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
*/
//UIPopoverController只能在ipad设备上面使用;作用是用于显示临时内容,特点是总是显示在当前视图最前端,当单击界面的其他地方时自动消失。
UIPopoverController *popover = [[UIPopoverController alloc]initWithContentViewController:picker];
self.imagePicker = popover;
//permittedArrowDirections 设置箭头方向
[self.imagePicker presentPopoverFromRect:CGRectMake(0, 0, 300, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[picker release];
[popover release];
点击相册中的图片 货照相机照完后点击use 后触发的方法
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary
*)info
点击cancel 调用的方法
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
if (is_ios7) {
AVAuthorizationStatus authstatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (authstatus ==AVAuthorizationStatusRestricted || authstatus ==AVAuthorizationStatusDenied) //用户关闭了权限
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请在设备的设置-隐私-相机中允许访问相机。" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
return;
}
ALAuthorizationStatus author = [ALAssetsLibrary authorizationStatus];
if (author == kCLAuthorizationStatusRestricted || author ==kCLAuthorizationStatusDenied)//用户关闭了权限
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请在设备的设置-隐私-照片中允许访问照片。" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
return;
}
}
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
//相册是可以用模拟器打开
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsEditing = YES;
[self presentViewController:picker animated:YES completion:nil];
}else{
UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"Error" message:@"没有相册" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];
[alter show];
}
}else{
[MBProgressHUD showMessag:@"无法打开相机" toView:Main_WINDOW];
NSLog(@"模拟器无法打开相机");
}
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流