我一直在尝试从来自 SDK 的 Free Flight 示例应用程序中的 ARDrone 中获取静止图像,但我似乎找不到一种干净的方法来做到这一点。SDK 和应用程序过于紧密地交织在一起,我无法获取 Open GL 纹理。有任何想法吗?
问问题
508 次
2 回答
0
如果您很高兴不直接通过 SDK 或 FreeFlight 应用程序,请查看 felixge 的 node.js 客户端以与 AR Drone 进行交互:https ://github.com/felixge/node-ar-drone
他有一个有用的PNG 流示例。您可以运行它,然后在本地主机上获取图片。
(这里的主要缺点是您将无法使用您的 iphone 应用程序等控制无人机,但必须通过 node.js 发送飞行命令。这实际上可能是一个优势,具体取决于您想要做什么.)
于 2012-12-21T16:19:09.587 回答
0
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface UIView (Screenshot)
- (UIImage *)screenshot;
@end
#import "UIView+Screenshot.h"
@implementation UIView (Screenshot)
- (UIImage *)screenshot
{
UIGraphicsBeginImageContext(self.bounds.size);
[[UIColor clearColor] setFill];
[[UIBezierPath bezierPathWithRect:self.bounds] fill];
CGContextRef ctx = UIGraphicsGetCurrentContext();
[self.layer renderInContext:ctx];
UIImage *anImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return anImage;
}
@end
添加上面的 UIView 类别并使用
UIImage *image = [self.view screenshot];
于 2011-09-02T06:03:20.570 回答