File: KinectStreamImpl.h

package info (click to toggle)
openni2 2.2.0.33%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 22,216 kB
  • sloc: cpp: 111,197; ansic: 35,511; sh: 10,542; python: 1,313; java: 952; makefile: 575; xml: 12
file content (82 lines) | stat: -rw-r--r-- 1,979 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef _KINECT_STREAM_IMPL_H_
#define _KINECT_STREAM_IMPL_H_

#include "BaseKinectStream.h"
#include <Shlobj.h>
#include "NuiApi.h"
#include "XnList.h"

struct INuiSensor;

namespace kinect_device {
class KinectStreamImpl
{
public:
	KinectStreamImpl(INuiSensor * pNuiSensor, OniSensorType sensorType);
	
	virtual ~KinectStreamImpl();
	
	void addStream(BaseKinectStream* stream);
	
	void removeStream(BaseKinectStream* stream);	

	unsigned int getStreamCount();

	void setVideoMode(OniVideoMode* videoMode);
	
	OniStatus virtual start();

	void virtual stop();

	bool	isRunning() { return m_running; }

	OniSensorType getSensorType () { return m_sensorType; }

	void setSensorType(OniSensorType sensorType);
	
	void mainLoop();

	OniStatus setAutoWhiteBalance(BOOL val);

	OniStatus getAutoWhitBalance(BOOL *val);

	OniStatus setAutoExposure(BOOL val);

	OniStatus getAutoExposure(BOOL *val);
	
	OniImageRegistrationMode getImageRegistrationMode() const { return m_imageRegistrationMode; }

	void setImageRegistrationMode(OniImageRegistrationMode mode) { m_imageRegistrationMode = mode; }

	OniStatus convertDepthToColorCoordinates(oni::driver::StreamBase* colorStream, 
								int depthX, int depthY, OniDepthPixel depthZ, int* pColorX, int* pColorY);

	static NUI_IMAGE_RESOLUTION getNuiImagResolution(int resolutionX, int resolutionY);

	INuiSensor* getNuiSensor() { return m_pNuiSensor; } // Need review: not sure if it is a good idea to expose this.
	
private:
		
	void setDefaultVideoMode();
	
	NUI_IMAGE_TYPE getNuiImageType();

	static XN_THREAD_PROC threadFunc(XN_THREAD_PARAM pThreadParam);

	xnl::List<BaseKinectStream*> m_streamList;

	OniImageRegistrationMode m_imageRegistrationMode;

	// Thread
	INuiSensor* m_pNuiSensor;
	OniSensorType m_sensorType;
	bool		 m_running;
	HANDLE       m_hStreamHandle;
	HANDLE       m_hNextFrameEvent;
	OniVideoMode m_videoMode;
	
	XN_THREAD_HANDLE m_threadHandle;	
};
} // namespace kinect_device

#endif //_KINECT_STREAM_IMPL_H_