如何将 UIImage 与 ARToolKitPlus 结合使用? (UIImage 到 CVImageBufferRef 转换)
我有两种检测 AR 标记的算法(ARToolKit 和 Infi)。我让他们在 iPhone 上实时检测标记。在这个阶段我想比较他们的速度和准确性。我想准备一系列图像并测试它们的识别能力。 我可以使用 infi 做到这一点,但我无法将 ARToolKit 与 UIImage 一起使用。
ARToolKit 使用 CVImageBuffer 来识别标记:
- (Marker *)detectMarkerInImageBuffer:(CVImageBufferRef)imageBuffer {
/*We lock the buffer and get the address of the first pixel*/
CVPixelBufferLockBaseAddress(imageBuffer,0);
unsigned char *baseAddress = (unsigned char *) CVPixelBufferGetBaseAddress(imageBuffer);
tracker->calc(baseAddress);
如何使用/转换 UIImage 来实现 baseAddress,以便我可以将其发送到 tracker->calc ?
使用 infi,我首先从缓冲区创建 IplImage 或将 UIImage 转换为 IplImage然后在这两种情况下:
Buffer* buffer = new Buffer();
buffer->setBuffer( (unsigned char *) iplImg->imageData, iplImg->width, iplImg->height);
I have two algorithms, that detects AR markers (ARToolKit and Infi). I have them working on iPhone in real time detecting markers. At this stage i would like to compare their speed and accuracy. I would like to prepare a series of images and test recognition on them.
I can do that with infi, but i can't manage to use ARToolKit with UIImage.
ARToolKit uses CVImageBuffer to recognize markers:
- (Marker *)detectMarkerInImageBuffer:(CVImageBufferRef)imageBuffer {
/*We lock the buffer and get the address of the first pixel*/
CVPixelBufferLockBaseAddress(imageBuffer,0);
unsigned char *baseAddress = (unsigned char *) CVPixelBufferGetBaseAddress(imageBuffer);
tracker->calc(baseAddress);
How can I use/convert UIImage to achieve baseAddress, so i can send it to tracker->calc ?
With infi I first create IplImage from buffer or convert UIImage to IplImage and then in both cases:
Buffer* buffer = new Buffer();
buffer->setBuffer( (unsigned char *) iplImg->imageData, iplImg->width, iplImg->height);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这里找到了答案:如何将 UIImage 数组导出为电影?
这就是我正在寻找的
I found an answer here: How do I export UIImage array as a movie?
That is what i was looking for