Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0)之间有什么区别?_Ios_Swift_Yuv_Cvpixelbuffer - Fatal编程技术网

Ios CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0)之间有什么区别?

Ios CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0)之间有什么区别?,ios,swift,yuv,cvpixelbuffer,Ios,Swift,Yuv,Cvpixelbuffer,CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0),CVPixelBufferGetHeight(pixelbuffer)和CVPixelBufferGetHeightOfPlane(pixelbuffer,0) 我搜索维基,它说: As with most Y′UV formats, there are as many Y′ values as there are pixels. 它并没

CVPixelBufferGetWidth(pixelbuffer)
CVPixelBufferGetWidthOfPlane(pixelbuffer,0)
CVPixelBufferGetHeight(pixelbuffer)和
CVPixelBufferGetHeightOfPlane(pixelbuffer,0)

我搜索维基,它说:

As with most Y′UV formats, there are as many Y′ values as there are pixels.
它并没有说y的值对于所有格式都是相等的图像宽度

所以如果

CVPixelBufferGetWidth(pixelbuffer) == CVPixelBufferGetWidthOfPlane(pixelbuffer, 0)


并非所有像素缓冲区都是平面的(即,与YUV缓冲区一样,包含多个数据平面)。在决定使用哪个函数查询宽度/高度之前,请检查您的函数是否正确。(当然,如果从始终是平面的源获取缓冲区,则可以安全地跳过该检查。)


docs for注意到,当传递非平面缓冲区时,它总是返回零。在这种情况下,返回值(对于平面0)不应等于。如果像素缓冲区是平面的,则在iOS平台中为
CVPixelBufferGetWidth(pixelbuffer)==CVPixelBufferGetWidthOfPlane(pixelbuffer,0)
CVPixelBufferGetHeight(pixelbuffer) == CVPixelBufferGetHeightOfPlane(pixelbuffer, 0)