Project

General

Profile

BitmapToolkit Scol plugin
CameraInputAndroid-old.h
Go to the documentation of this file.
1#ifndef __BTK_CAMERAINPUT_ANDROID_H__
2#define __BTK_CAMERAINPUT_ANDROID_H__
3
4#include <opencv2/opencv.hpp>
5#include <vector>
6#include <utility>
7#include <boost/bind.hpp>
8#include "ICameraInput.h"
9
14{
15public:
16 static const int CAMERA_FACING_BACK;
17 static const int CAMERA_FACING_FRONT;
18 static const std::string android_package;
19 typedef std::vector<cv::Size> PreviewSizes;
20
21private:
22 bool mAutoUpdate;
23 bool mUpdated;
24 bool mIsOpen;
25 struct android_app* mApp;
26 int mNbEmptyFrames;
27 int mIndex;
28 cv::Size mSize;
29protected:
30 cv::Mat mFrameBuffer;
31 cv::Mat mFrameCached;
32 cv::Mat mFrameRGB;
33
35 {
36 jmethodID method;
37 jobject instance;
38 jclass clazz;
39 };
40
41 void initJava();
42 jmethodbox grabMethod(JNIEnv* env, const char* name, const char* signature);
43
44public:
47
48 void startPreview(int width, int height, int index, bool recordingHint);
49 void stopPreview();
50 void torchOn();
51 void torchOff();
52 bool isCameraOpened();
54 bool isPortrait();
55 bool isOpen();
56 bool setPreviewSize(int width, int height);
57 cv::Size getPreviewSize();
58 cv::Size getSize();
60 bool setFocusPoint(int x, int y);
61 cv::Mat grabFrame();
63};
64
69{
70private:
71 cv::Size mBufferSize;
73 bool mInitializing;
74public:
75
76 CameraInputAndroid(int index);
78
79 virtual bool Initialize();
80 virtual void Close();
81 virtual bool IsOpened();
82 virtual cv::Mat UpdateImage();
83
84 virtual int GetWidth();
85 virtual int GetHeight();
86 virtual void SetSize(int width, int height);
87
88 virtual bool TakeSnapshot(std::string path);
89 virtual void RenderToScreen();
90 virtual bool SetFocusPoint(int x, int y);
91 virtual void SetTorchState(bool state);
92};
93
94#endif
void startPreview(int width, int height, int index, bool recordingHint)
static const int CAMERA_FACING_FRONT
static const int CAMERA_FACING_BACK
std::vector< cv::Size > PreviewSizes
bool setPreviewSize(int width, int height)
jmethodbox grabMethod(JNIEnv *env, const char *name, const char *signature)
static const std::string android_package
Concrete implementation of ICameraInput using Android API.
virtual bool TakeSnapshot(std::string path)
virtual void SetSize(int width, int height)
virtual void SetTorchState(bool state)
virtual bool SetFocusPoint(int x, int y)
Interface for camera management. Concrete classes are written for Windows, Android and OpenCV native ...