MLKitVision 프레임워크 참조
VisionImage
시각적 감지에 사용되는 이미지 또는 이미지 버퍼입니다.
-
이미지의 표시 방향입니다. 기본값은 .up
입니다.
선언
Swift
var orientation: Int32 { get set }
-
지정된 이미지로 VisionImage
객체를 초기화합니다.
매개변수
image
|
시각적 감지에 사용하는 이미지입니다. 주어진 이미지는 회전해야
imageOrientation 속성이 .up 로 설정됩니다. UIImage 에 NULL이 아닌 CGImage 가 있어야 합니다.
속성
|
반환 값
지정된 이미지가 있는 VisionImage
인스턴스
-
지정된 이미지 버퍼를 사용하여 VisionImage
객체를 초기화합니다. 성능을 개선하기 위해
다음으로 초기화할 때 이 클래스의 인스턴스 수와 수를 최소화하는 것이 좋습니다.
CMSampleBufferRef
선언
Swift
init(buffer sampleBuffer: CMSampleBuffer)
매개변수
sampleBuffer
|
시각적 감지에 사용하는 이미지 버퍼입니다. 버퍼는 다음을 기반으로 해야 합니다.
픽셀 버퍼 (압축 데이터 아님)를 사용하며, 픽셀 형식은 다음 중 하나여야 합니다.
- kCVPixelFormatType_32BGRA
- kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
실제로: 휴대전화 카메라의 동영상 출력에서는 작동하지만 다른 출력에서는 작동하지 않습니다.
CMSampleBufferRef 의 임의 소스입니다.
|
반환 값
지정된 이미지 버퍼가 있는 VisionImage
인스턴스
-
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-22(UTC)
[null,null,["최종 업데이트: 2024-08-22(UTC)"],[[["`VisionImage` is an object used for vision detection tasks, accepting images or image buffers as input."],["It's crucial to set the `imageOrientation` property of input `UIImage` to `.up` before initialization to ensure proper orientation."],["When using `CMSampleBufferRef` for initialization, ensure it's a pixel buffer with a supported pixel format like `kCVPixelFormatType_32BGRA` for optimal performance."],["For `CMSampleBufferRef` inputs, compatibility is primarily with phone camera output, not arbitrary buffer sources."],["Direct initialization using `init()` is unavailable; utilize `init(image:)` or `init(buffer:)` instead."]]],["`VisionImage` is a class for vision detection using images or image buffers. It has a settable `orientation` property, defaulting to `.up`. It initializes with either an `image`, requiring a rotated image with an `.up` orientation and a non-NULL `CGImage`, or a `CMSampleBuffer` image buffer with specified pixel formats. When using `CMSampleBufferRef`, minimize instance lifespan. Direct initialization using `init()` is unavailable.\n"]]