【发布时间】:2023-04-04 06:58:01
【问题描述】:
我有来自我的AVCaptureVideoDataOutputSampleBufferDelegate 方法的图像流:
- (void)captureOutput:(AVCaptureOutput )captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection )connection;
然后我想把sampleBuffer 提供给C++ openalrp 库来识别哪个需要图像字节或原始像素数据。我应该使用什么函数以及如何将sampleBuffer 转换为合适的输入类型std::vector<char> 或unsigned char* pixelData?
来自alpr.h 文件:
// Recognize from an image on disk
AlprResults recognize(std::string filepath);
// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
AlprResults recognize(std::vector<char> imageBytes);
// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
AlprResults recognize(std::vector<char> imageBytes, std::vector<AlprRegionOfInterest> regionsOfInterest);
// Recognize from raw pixel data.
AlprResults recognize(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector<AlprRegionOfInterest> regionsOfInterest);
【问题讨论】:
标签: c++ ios avfoundation std openalpr