visageSDK
AndroidCameraCapture.h
1 #ifndef __AndroidCameraCapture_h__
2 #define __AndroidCameraCapture_h__
3 
4 #include <pthread.h>
5 #include <cerrno>
6 #include "vs_main.h"
7 
8 #define VISAGE_FRAMEGRABBER_FMT_RGB 0
9 #define VISAGE_FRAMEGRABBER_FMT_BGR 1
10 #define VISAGE_FRAMEGRABBER_FMT_LUMINANCE 2
11 #define VISAGE_FRAMEGRABBER_FMT_RGBA 3
12 #define VISAGE_FRAMEGRABBER_FMT_BGRA 4
13 
14 #define VISAGE_FRAMEGRABBER_ORIGIN_TL 0
15 #define VISAGE_FRAMEGRABBER_ORIGIN_BL 1
16 
17 namespace VisageSDK
18 {
19 
28 
29 public:
30 
31  bool frameArrived;
32 
37 
45  AndroidCameraCapture(int width, int height, int orientation=0, int flip = 0);
46 
51 
57  VsImage *GrabFrame(long &timeStamp);
58 
63  void WriteFrame(unsigned char *imageData);
64 
65  void WriteFrameYUV(unsigned char* imageData);
66 
67  void YUV_NV21_TO_RGB(unsigned char* yuv, VsImage* buff, int width, int height);
68 
69  int clamp(int x);
70 
71 
72 private:
73 
77  void YUV420toRGB(unsigned char* data, VsImage* buff, int width, int height);
78  void convertYUVtoARGB(int y, int u, int v, char *r, char *g, char *b);
79 
80  VsImage* buffer;
81  VsImage* bufferN;
82  VsImage* bufferT;
83  unsigned char *data;
84  int orientation;
85  int flip;
86  int pts;
87  int width, height;
88  pthread_mutex_t mutex;
89  pthread_cond_t cond;
90 };
91 
92 }
93 
94 #endif // __AndroidCameraCapture_h__
void WriteFrame(unsigned char *imageData)
Method for writing imageData to buffer object.
Namespace.
Definition: android_header.h:1
VsImage * GrabFrame(long &timeStamp)
This function is called periodically to get the new video frame to process.
AndroidCameraCapture demonstrates use of raw camera image input to track from Android camera...
Image store container.