【问题标题】:How to scale from CVImageBufferRef -- or -- why didn't setPixelBufferAttributes work?如何从 CVImageBufferRef 缩放 - 或 - 为什么 setPixelBufferAttributes 不起作用?
【发布时间】:2014-12-09 21:00:31
【问题描述】:

我正在通过QTCaptureDecompressedVideoOutput 从相机(Macbook Air,OSX 10.9.5)捕获视频并对其进行处理,但我需要缩放传入的图像。无论出于何种原因,传回给我的图像不是我的大小设置像素缓冲区属性时请求:

   [mVideoOutput setPixelBufferAttributes:
       [NSDictionary dictionaryWithObjectsAndKeys:
            [NSNumber numberWithDouble:width], (id)kCVPixelBufferWidthKey,
            [NSNumber numberWithDouble:height], (id)kCVPixelBufferHeightKey,
            [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB], (id)kCVPixelBufferPixelFormatTypeKey,
            nil]];

我得到的图片尺寸是我请求的两倍。

将图像缩小到一半大小的最有效方法是什么?

甚至更好....

为什么 setPixelBufferAttributes 不能正常工作?

【问题讨论】:

    标签: objective-c cocoa core-graphics nsimage quartz-core


    【解决方案1】:

    似乎setPixelBufferAttributes 在第一次请求时被忽略了,所以在从相机接收到图像时的回调中,我检查大小并在不正确时再次发出请求。这似乎已经解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2011-12-16
      • 1970-01-01
      • 2020-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      相关资源
      最近更新 更多