I have image stream from my AVCaptureVideoDataOutputSampleBufferDelegate
method:
- (void)captureOutput:(AVCaptureOutput )captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection )connection;
Then I want to take sampleBuffer
and provide it for C++ openalrp
library to recognize which takes image bytes or raw pixel data. What function should I use and how to convert sampleBuffer
to suitable input type, std::vector<char>
or unsigned char* pixelData
?
From alpr.h
file:
// 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);