3

I've been trying to grab still images from the ARDrone in the Free Flight example app that came from the SDK and I can't seem to find a clean way to do it. The SDK and the app are too heavily intertwined for me to grab the Open GL texture. Any ideas?

slezadav
  • 6,104
  • 7
  • 40
  • 61
Artem
  • 261
  • 2
  • 7

2 Answers2

0

If you're happy to not go directly through the SDK or the FreeFlight app, check out felixge's node.js client for interacting with the AR Drone: https://github.com/felixge/node-ar-drone

He has a useful PNG stream example. You can run this and then get the pictures on your localhost.

(The main downside here is that you won't be able to control the drone with your iphone app etc, but will have to send flight commands through node.js. This can actually be an advantage depending on what you'd like to do.)

embirico
  • 208
  • 3
  • 7
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

Add the above UIView Category and just use

UIImage *image = [self.view screenshot];
Luke
  • 3,375
  • 2
  • 22
  • 22