gpt4 book ai didi

iphone - iPhone 5S IOS 7 中的前置摄像头问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:14 27 4
gpt4 key购买 nike

我在带有前置摄像头输出的 iPhone 5S 上遇到问题, session 分辨率与后置摄像头相同。 (AVCaptureSessionPreset352x288) 和 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange 设置为 kCVPixelBufferPixelFormatTypeKey。我在苹果论坛上发现了一些关于确切问题的讨论,这里是链接:https://discussions.apple.com/message/23079639#23079639

问题是什么?请帮忙。

良好的输出,后置摄像头。

Printing description of imageBuffer:
<CVPixelBuffer 0xd5e2f30 width=352 height=288 pixelFormat=420v iosurface=0xd80e724 planes=2>
<Plane 0 width=352 height=288 bytesPerRow=352>
<Plane 1 width=176 height=144 bytesPerRow=352>
<attributes=<CFBasicHash 0xd5c3710 [0x3bf18ad0]>{type = immutable dict, count = 1,
entries =>
1 : <CFString 0x3bf971b4 [0x3bf18ad0]>{contents = "PixelFormatDescription"} = <CFBasicHash 0xb9fce0 [0x3bf18ad0]>{type = immutable dict, count = 7,
entries =>
0 : <CFString 0x3bf97164 [0x3bf18ad0]>{contents = "IOSurfaceCoreAnimationCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
2 : <CFString 0x3bf97194 [0x3bf18ad0]>{contents = "OpenGLESCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
3 : <CFString 0x3bf972c4 [0x3bf18ad0]>{contents = "ContainsAlpha"} = <CFBoolean 0x3bf18e88 [0x3bf18ad0]>{value = false}
5 : <CFString 0x3bf97184 [0x3bf18ad0]>{contents = "IOSurfaceOpenGLESFBOCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
7 : <CFString 0x3bf972d4 [0x3bf18ad0]>{contents = "Planes"} = <CFArray 0xb24830 [0x3bf18ad0]>{type = mutable-small, count = 2, values = (
0 : <CFBasicHash 0xb99420 [0x3bf18ad0]>{type = mutable dict, count = 3,
entries =>
0 : <CFString 0x3bf973b4 [0x3bf18ad0]>{contents = "FillExtendedPixelsCallback"} = <CFData 0xba06a0 [0x3bf18ad0]>{length = 12, capacity = 12, bytes = 0x00000000917cbb3100000000}
1 : <CFString 0x3bf97334 [0x3bf18ad0]>{contents = "BlackBlock"} = <CFData 0xb9deb0 [0x3bf18ad0]>{length = 1, capacity = 1, bytes = 0x10}
2 : <CFString 0x3bf97324 [0x3bf18ad0]>{contents = "BitsPerBlock"} = <CFNumber 0xb277e0 [0x3bf18ad0]>{value = +8, type = kCFNumberSInt32Type}
}

1 : <CFBasicHash 0xba0e50 [0x3bf18ad0]>{type = mutable dict, count = 5,
entries =>
0 : <CFString 0x3bf97334 [0x3bf18ad0]>{contents = "BlackBlock"} = <CFData 0xb9c550 [0x3bf18ad0]>{length = 2, capacity = 2, bytes = 0x8080}
2 : <CFString 0x3bf97344 [0x3bf18ad0]>{contents = "HorizontalSubsampling"} = <CFNumber 0xc0f720 [0x3bf18ad0]>{value = +2, type = kCFNumberSInt32Type}
4 : <CFString 0x3bf97324 [0x3bf18ad0]>{contents = "BitsPerBlock"} = <CFNumber 0xba0e80 [0x3bf18ad0]>{value = +16, type = kCFNumberSInt32Type}
5 : <CFString 0x3bf973b4 [0x3bf18ad0]>{contents = "FillExtendedPixelsCallback"} = <CFData 0xba16d0 [0x3bf18ad0]>{length = 12, capacity = 12, bytes = 0x00000000817bbb3100000000}
6 : <CFString 0x3bf97354 [0x3bf18ad0]>{contents = "VerticalSubsampling"} = <CFNumber 0xc0f720 [0x3bf18ad0]>{value = +2, type = kCFNumberSInt32Type}
}

)}
8 : <CFString 0x3bf97294 [0x3bf18ad0]>{contents = "PixelFormat"} = <CFNumber 0xb7acf0 [0x3bf18ad0]>{value = +875704438, type = kCFNumberSInt32Type}
12 : <CFString 0x3bf97174 [0x3bf18ad0]>{contents = "IOSurfaceOpenGLESTextureCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
}

}
propagatedAttachments=<CFBasicHash 0x126e2130 [0x3bf18ad0]>{type = mutable dict, count = 4,
entries =>
1 : <CFString 0x3bf70edc [0x3bf18ad0]>{contents = "MetadataDictionary"} = <CFBasicHash 0xd5da1a0 [0x3bf18ad0]>{type = mutable dict, count = 7,
entries =>
0 : <CFString 0x3bf70f4c [0x3bf18ad0]>{contents = "SNR"} = <CFNumber 0xd5da1d0 [0x3bf18ad0]>{value = +33.11550123401803347178, type = kCFNumberFloat64Type}
2 : <CFString 0x3bf70ddc [0x3bf18ad0]>{contents = "sensorDGain"} = <CFNumber 0xd58def0 [0x3bf18ad0]>{value = +256, type = kCFNumberSInt32Type}
3 : <CFString 0x3bf70f3c [0x3bf18ad0]>{contents = "SensorID"} = <CFNumber 0x126f7b40 [0x3bf18ad0]>{value = +356, type = kCFNumberSInt32Type}
6 : <CFString 0x3bf7054c [0x3bf18ad0]>{contents = "ExposureTime"} = <CFNumber 0xd5d83d0 [0x3bf18ad0]>{value = +0.03332500000000000046, type = kCFNumberFloat64Type}
7 : <CFString 0x3bf70dec [0x3bf18ad0]>{contents = "ispDGain"} = <CFNumber 0xd54d620 [0x3bf18ad0]>{value = +273, type = kCFNumberSInt32Type}
11 : <CFString 0x3bf7017c [0x3bf18ad0]>{contents = "AGC"} = <CFNumber 0xd5e21f0 [0x3bf18ad0]>{value = +780, type = kCFNumberSInt32Type}
12 : <CFString 0x3bf7114c [0x3bf18ad0]>{contents = "AEAverage"} = <CFNumber 0xd5e27a0 [0x3bf18ad0]>{value = +126, type = kCFNumberSInt32Type}
}

3 : <CFString 0x3bf96f54 [0x3bf18ad0]>{contents = "CVImageBufferYCbCrMatrix"} = <CFString 0xd5c34b0 [0x3bf18ad0]>{contents = "ITU_R_601_4"}
5 : <CFString 0x3bf96f94 [0x3bf18ad0]>{contents = "CVImageBufferColorPrimaries"} = <CFString 0x126bced0 [0x3bf18ad0]>{contents = "ITU_R_709_2"}
6 : <CFString 0x3bf96fd4 [0x3bf18ad0]>{contents = "CVImageBufferTransferFunction"} = <CFString 0xd58dfa0 [0x3bf18ad0]>{contents = "ITU_R_709_2"}
}
nonPropagatedAttachments=<CFBasicHash 0x126e2100 [0x3bf18ad0]>{type = mutable dict, count = 0,
entries =>
}
>

输出不好,前置摄像头。

Printing description of imageBuffer:
<CVPixelBuffer 0x12638980 width=352 height=288 pixelFormat=420v iosurface=0xd80e724 planes=2>
<Plane 0 width=352 height=288 bytesPerRow=384>
<Plane 1 width=176 height=144 bytesPerRow=384>
<attributes=<CFBasicHash 0x12638bb0 [0x3bf18ad0]>{type = immutable dict, count = 1,
entries =>
1 : <CFString 0x3bf971b4 [0x3bf18ad0]>{contents = "PixelFormatDescription"} = <CFBasicHash 0xb9fce0 [0x3bf18ad0]>{type = immutable dict, count = 7,
entries =>
0 : <CFString 0x3bf97164 [0x3bf18ad0]>{contents = "IOSurfaceCoreAnimationCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
2 : <CFString 0x3bf97194 [0x3bf18ad0]>{contents = "OpenGLESCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
3 : <CFString 0x3bf972c4 [0x3bf18ad0]>{contents = "ContainsAlpha"} = <CFBoolean 0x3bf18e88 [0x3bf18ad0]>{value = false}
5 : <CFString 0x3bf97184 [0x3bf18ad0]>{contents = "IOSurfaceOpenGLESFBOCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
7 : <CFString 0x3bf972d4 [0x3bf18ad0]>{contents = "Planes"} = <CFArray 0xb24830 [0x3bf18ad0]>{type = mutable-small, count = 2, values = (
0 : <CFBasicHash 0xb99420 [0x3bf18ad0]>{type = mutable dict, count = 3,
entries =>
0 : <CFString 0x3bf973b4 [0x3bf18ad0]>{contents = "FillExtendedPixelsCallback"} = <CFData 0xba06a0 [0x3bf18ad0]>{length = 12, capacity = 12, bytes = 0x00000000917cbb3100000000}
1 : <CFString 0x3bf97334 [0x3bf18ad0]>{contents = "BlackBlock"} = <CFData 0xb9deb0 [0x3bf18ad0]>{length = 1, capacity = 1, bytes = 0x10}
2 : <CFString 0x3bf97324 [0x3bf18ad0]>{contents = "BitsPerBlock"} = <CFNumber 0xb277e0 [0x3bf18ad0]>{value = +8, type = kCFNumberSInt32Type}
}

1 : <CFBasicHash 0xba0e50 [0x3bf18ad0]>{type = mutable dict, count = 5,
entries =>
0 : <CFString 0x3bf97334 [0x3bf18ad0]>{contents = "BlackBlock"} = <CFData 0xb9c550 [0x3bf18ad0]>{length = 2, capacity = 2, bytes = 0x8080}
2 : <CFString 0x3bf97344 [0x3bf18ad0]>{contents = "HorizontalSubsampling"} = <CFNumber 0xc0f720 [0x3bf18ad0]>{value = +2, type = kCFNumberSInt32Type}
4 : <CFString 0x3bf97324 [0x3bf18ad0]>{contents = "BitsPerBlock"} = <CFNumber 0xba0e80 [0x3bf18ad0]>{value = +16, type = kCFNumberSInt32Type}
5 : <CFString 0x3bf973b4 [0x3bf18ad0]>{contents = "FillExtendedPixelsCallback"} = <CFData 0xba16d0 [0x3bf18ad0]>{length = 12, capacity = 12, bytes = 0x00000000817bbb3100000000}
6 : <CFString 0x3bf97354 [0x3bf18ad0]>{contents = "VerticalSubsampling"} = <CFNumber 0xc0f720 [0x3bf18ad0]>{value = +2, type = kCFNumberSInt32Type}
}

)}
8 : <CFString 0x3bf97294 [0x3bf18ad0]>{contents = "PixelFormat"} = <CFNumber 0xb7acf0 [0x3bf18ad0]>{value = +875704438, type = kCFNumberSInt32Type}
12 : <CFString 0x3bf97174 [0x3bf18ad0]>{contents = "IOSurfaceOpenGLESTextureCompatibility"} = <CFBoolean 0x3bf18e80 [0x3bf18ad0]>{value = true}
}

}
propagatedAttachments=<CFBasicHash 0x12638c10 [0x3bf18ad0]>{type = mutable dict, count = 4,
entries =>
1 : <CFString 0x3bf70edc [0x3bf18ad0]>{contents = "MetadataDictionary"} = <CFBasicHash 0x12638650 [0x3bf18ad0]>{type = mutable dict, count = 7,
entries =>
0 : <CFString 0x3bf70f4c [0x3bf18ad0]>{contents = "SNR"} = <CFNumber 0x126367e0 [0x3bf18ad0]>{value = +34.16280207318401096472, type = kCFNumberFloat64Type}
2 : <CFString 0x3bf70ddc [0x3bf18ad0]>{contents = "sensorDGain"} = <CFNumber 0x12633120 [0x3bf18ad0]>{value = +256, type = kCFNumberSInt32Type}
3 : <CFString 0x3bf70f3c [0x3bf18ad0]>{contents = "SensorID"} = <CFNumber 0x126360c0 [0x3bf18ad0]>{value = +38754, type = kCFNumberSInt32Type}
6 : <CFString 0x3bf7054c [0x3bf18ad0]>{contents = "ExposureTime"} = <CFNumber 0x12636440 [0x3bf18ad0]>{value = +0.02999900000000000136, type = kCFNumberFloat64Type}
7 : <CFString 0x3bf70dec [0x3bf18ad0]>{contents = "ispDGain"} = <CFNumber 0x12630f20 [0x3bf18ad0]>{value = +260, type = kCFNumberSInt32Type}
11 : <CFString 0x3bf7017c [0x3bf18ad0]>{contents = "AGC"} = <CFNumber 0xd580830 [0x3bf18ad0]>{value = +1803, type = kCFNumberSInt32Type}
12 : <CFString 0x3bf7114c [0x3bf18ad0]>{contents = "AEAverage"} = <CFNumber 0x12635ae0 [0x3bf18ad0]>{value = +176, type = kCFNumberSInt32Type}
}

3 : <CFString 0x3bf96f54 [0x3bf18ad0]>{contents = "CVImageBufferYCbCrMatrix"} = <CFString 0x126383d0 [0x3bf18ad0]>{contents = "ITU_R_601_4"}
5 : <CFString 0x3bf96f94 [0x3bf18ad0]>{contents = "CVImageBufferColorPrimaries"} = <CFString 0x12632d90 [0x3bf18ad0]>{contents = "ITU_R_709_2"}
6 : <CFString 0x3bf96fd4 [0x3bf18ad0]>{contents = "CVImageBufferTransferFunction"} = <CFString 0x126372c0 [0x3bf18ad0]>{contents = "ITU_R_709_2"}
}
nonPropagatedAttachments=<CFBasicHash 0x12638be0 [0x3bf18ad0]>{type = mutable dict, count = 0,
entries =>
}
>

最佳答案

正如 Spectravideo328 所提到的,每行的字节数与图像的宽度不同。因此,您需要将有效数据从源层复制到目标缓冲区,跳过额外的填充。这意味着对于每一行(等于图像的“高度”)复制第一个“宽度”字节数。

关于iphone - iPhone 5S IOS 7 中的前置摄像头问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19496391/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com