Tag: 相机

使用SpriteKit相机节点防止位置偏移

我注意到了centerOnNode:方法如图所示, – (void)centerOnNode:(SKNode *)node { cameraOffset = [node.scene convertPoint:node.position fromNode:node.parent]; node.parent.position = CGPointMake(node.parent.position.x – cameraOffset.x, node.parent.position.y – cameraOffset.y); } 极大地影响了子节点的相对定位。 只要此方法运行,子节点确实似乎受到影响。 下图显示了NO移动的逻辑,然后左移和稍移: 我画了一个浅蓝色的框来估计看起来path正在引用的物理体而不是更新的帧。 您所看到的线条和圆圈代表我用于寻路的两种方法。 带点的线只是我正在做的射线testing,看看绿线上的光线是否与方形物理体相交。 您在顶部看到的单点是使用GameplayKit来构build避开黑色方块作为障碍的path。 我正在努力想办法避免摄像机的重新定位,从而影响到现场儿童的定位。 仅供参考 :我已经通过移动字符而不是相机testing了寻路,它完美地工作(如下所示) 显然,相机偏移是问题。 如果有人能告诉我该怎么做,以保持相机的移动和寻路的精度,我将不胜感激。

如何连接Wifi Camera ios

我需要一些帮助,在我的项目中,我需要获取由wifi摄像头捕获的图像 。 我需要使用IPAddress与相机连接并获取这些图像。 我对这个话题是全新的,所以请给我build议 1)如何使用IPAddress与WiFi摄像头连接 2)如何自动获取拍摄的照片 提前致谢…

用UIImagePickerController iOS圆形裁剪相机?

我正在使用cameraSourcetypes的UIImagePickerController。 但我注意到有一个圆形的收割机,而有一个圆形收割机,带有“移动和缩放” 在iOS本地联系人应用程序中,有一个带有“移动和缩放”标题的圆形裁剪器。 但与我使用UIImagePickerController相机源types,我有一个没有标题的方形裁剪。 请build议一些图书馆或代码 这是用户select用相机拍照时的iOS本地应用程序屏幕截图。 我想要 谢谢

AVCaptureStillImageOutput永远不会调用完成处理程序

以下代码不起作用。 怎么了? AVCaptureDevice * videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput * videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil]; AVCaptureSession * captureSession = [[AVCaptureSession alloc] init]; captureSession.sessionPreset = AVCaptureSessionPresetMedium; if (![captureSession canAddInput:videoInput]) NSLog(@"Can't add input"); [captureSession addInput:videoInput]; self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init]; [self.stillImageOutput setOutputSettings:@{AVVideoCodecKey:AVVideoCodecJPEG}]; if (![captureSession canAddOutput:videoInput]) NSLog(@"Can't add output"); [captureSession addOutput:self.stillImageOutput]; [self.stillImageOutput captureStillImageAsynchronouslyFromConnection:[self.stillImageOutput.connections lastObject] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) […]

BSMachError授权访问摄像头

这对我来说是一个谜,我希望你能帮助我… 我已经做了一个应用程序,已经有一个QR扫描仪,当我的iPhone上一个全新的安装访问它后面显示一个警报。 问题是相机图像冻结,我无法扫描任何QR码… 一旦我再次从xcode运行应用程序,这个问题就消失了… 这是在控制台中打印的内容: _BSMachError:端口13403; (os / kern)无效的能力(0x14)“无法插入COPY_SEND” 请注意,我已经添加NSCameraUsageDescription Info.plist。 谢谢你的帮助! 更新:我已经尝试添加NSPhotoLibraryUsageDescription和其他类似的权限Info.plist文件,以及将本地化本地开发区域从EN更改为美国(解决scheme读取其他线程),但仍然没有运气… 更新#2: 我昨天创build了一个新项目 ,重复使用相同的代码和“QR-scanner view”工作得很好! 问题:这可能是某种forms的转换相关问题吗? 该项目是在Swift 2.2中创build的,并且刚刚转换为Swift 3的新语法。 这是我能想到的唯一真正的区别 很高兴听到您对此事的想法!

如何使用UIImagePickerControllerDelegate在viewDidLoad上启动相机?

我有一个新的iOS应用程序在Swift中,我试图在应用程序启动后立即显示相机。 在我的视图控制器中,我有一个UIView对象,我试图用相机来填充。 我的视图控制器中的代码在viewDidLoad方法中调用UIImagePickerController ,但没有任何反应。 这里是代码,任何想法为什么没有发生? 这个代码是不是应该在应用程序启动时打开相机? import UIKit class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { let imagePicker = UIImagePickerController() @IBOutlet weak var imageViewer: UIImageView! override func viewDidLoad() { super.viewDidLoad() if UIImagePickerController.isCameraDeviceAvailable( UIImagePickerControllerCameraDevice.Front) { imagePicker.delegate = self imagePicker.sourceType = UIImagePickerControllerSourceType.Camera presentViewController(imagePicker, animated: true, completion: nil) } else { println("no front camera available") } // Do any additional […]

从相机胶卷的图像创buildvideo – iOS sdk

我已经使用以下代码从图像创buildvideo。 此代码工作正常时,我从相机胶卷从网上下载或从屏幕截图中select的图像,但从相机显示放大在电影中select的图像。 我不知道相机的图像有什么问题。 任何人都可以请帮我解决这个问题。 -(IBAction)createV:(id)sender { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *videoOutputPath = [documentsDirectory stringByAppendingPathComponent:@"test_output.mp4"]; CGSize imageSize = [DatabaseAccess getusersetsize]; double nospf =[[[NSUserDefaults standardUserDefaults] valueForKey:@"duration"] intValue]; NSUInteger fps = 10; NSMutableArray *imageArray;// = [DatabaseAccess getimagelist:@"select imgname from tbl_userimage"]; NSArray* imagePaths = [DatabaseAccess getimagelist:@"select imgname,strftime('%d-%m-%Y', tdate) as tdate from tbl_userimage"]; imageArray = [[NSMutableArray alloc] initWithCapacity:imagePaths.count]; […]

iOS应用程序相机访问被拒绝iOS 9.1(黑屏)** **

我想在我的应用程序访问相机。我正在尝试下面的代码。 if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = YES; picker.sourceType = UIImagePickerControllerSourceTypeCamera; if(isIOS8SystemVersion) { [[NSOperationQueue mainQueue] addOperationWithBlock:^{ [self presentViewController:picker animated:YES completion:NULL]; }]; } else { [self presentViewController:picker animated:YES completion:NULL]; } } 这个代码完美的工作在我的其他应用程序。但在这个应用程序,它不要求相机的权限或显示在设置 – >隐私 – >相机。 该应用程序提示使用该位置,但不显示相机或照片的任何内容。 出现黑屏,如果直接使用相机代码而没有进行条件检查,则无法拍照。

在Swift中逐像素地应用视觉效果

我有一个大学的任务来创build视觉效果,并将其应用于通过设备相机捕获的video帧。 我目前可以得到的图像和显示,但不能改变像素的颜色值。 我将示例缓冲区转换为imageRefvariables,如果将其转换为UIImage,则一切正常。 但是现在我想让imageRef逐个像素地改变其颜色的值,在这个例子中改变为负面的颜色(我必须做更复杂的东西,所以我不能使用CIFilters),但是当我执行它所撞见的评论部分访问不好。 import UIKit import AVFoundation class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate { let captureSession = AVCaptureSession() var previewLayer : AVCaptureVideoPreviewLayer? var captureDevice : AVCaptureDevice? @IBOutlet weak var cameraView: UIImageView! override func viewDidLoad() { super.viewDidLoad() captureSession.sessionPreset = AVCaptureSessionPresetMedium let devices = AVCaptureDevice.devices() for device in devices { if device.hasMediaType(AVMediaTypeVideo) && device.position == AVCaptureDevicePosition.Back { if […]

AVFoundation相机预览图层不起作用

所以,我试图用AVFoundation实现一个摄像头。 我想我做的一切都是正确的。 这是我正在做的 创build会话 获取videotypes的设备 通过设备循环让相机在后面 使用#3中提到的设备获取设备input并将其添加到会话中 创build一个AVCaptureStillImageOutputtypes的输出 设置输出设置并将其添加到会话中 从我的观点2得到一个CALayer(下面将解释我的意思是视图2) 创build一个AVCaptureVideoPreviewLayer的实例 将它添加到#7中提到的层 开始运行会话 所以我有两个意见一个在另一个。 最上面的是视图1,下面的是视图2.视图1应该提供自定义的摄像头控件。 这里是代码: self.session = [[AVCaptureSession alloc]init]; [self.session setSessionPreset:AVCaptureSessionPresetHigh]; NSArray *devices = [[NSArray alloc]init]; devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; for (AVCaptureDevice *device in devices){ if([device position] == AVCaptureDevicePositionBack){ self.device = device; break; } } NSError *error; self.input = [[AVCaptureDeviceInput alloc]initWithDevice:self.device error:&error]; if([self.session canAddInput:self.input]){ […]