小编Gan*_*Gan的帖子

CGImageRef访问像素数据的更快方法?

我当前的方法是:

CGDataProviderRef provider = CGImageGetDataProvider(imageRef);
imageData.rawData = CGDataProviderCopyData(provider);
imageData.imageData = (UInt8 *) CFDataGetBytePtr(imageData.rawData);
Run Code Online (Sandbox Code Playgroud)

我每秒只能得到约30帧。我知道性能下降的一部分是复制数据,如果我可以访问字节流而不让它自动为我创建副本,那将是很好的。

我试图让它尽可能快地处理CGImageRefs,有没有更快的方法?

这是我的工作解决方案片段:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application
    //timer = [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 //2000.0
    //                                         target:self
    //                                       selector:@selector(timerLogic)
    //                                       userInfo:nil
    //                                        repeats:YES];
    leagueGameState = [LeagueGameState new];

    [self updateWindowList];
    lastTime = CACurrentMediaTime();






    // Create a capture session
    mSession = [[AVCaptureSession alloc] init];

    // Set the session preset as you wish
    mSession.sessionPreset = AVCaptureSessionPresetMedium;

    // If you're on a multi-display system and you …
Run Code Online (Sandbox Code Playgroud)

video-capture objective-c video-processing cgimageref

4
推荐指数
1
解决办法
897
查看次数