MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / Init

Method Init

Samples/NiHandTracker/NiSimpleViewer.cpp:115–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115XnStatus SimpleViewer::Init(int argc, char **argv)
116{
117 XnStatus rc;
118
119 rc = m_rContext.FindExistingNode(XN_NODE_TYPE_DEPTH, m_depth);
120 if (rc != XN_STATUS_OK)
121 {
122 printf("No depth node exists! Check your XML.");
123 return rc;
124 }
125
126 rc = m_rContext.FindExistingNode(XN_NODE_TYPE_IMAGE, m_image);
127 if (rc != XN_STATUS_OK)
128 {
129 printf("No image node exists! Check your XML.");
130 return rc;
131 }
132
133 m_depth.GetMetaData(m_depthMD);
134 m_image.GetMetaData(m_imageMD);
135
136 // Hybrid mode isn't supported in this sample
137 if (m_imageMD.FullXRes() != m_depthMD.FullXRes() || m_imageMD.FullYRes() != m_depthMD.FullYRes())
138 {
139 printf ("The device depth and image resolution must be equal!\n");
140 return 1;
141 }
142
143 // RGB is the only image format supported.
144 if (m_imageMD.PixelFormat() != XN_PIXEL_FORMAT_RGB24)
145 {
146 printf("The device image format must be RGB24\n");
147 return 1;
148 }
149
150 // Texture map init
151 m_nTexMapX = MIN_CHUNKS_SIZE(m_depthMD.FullXRes(), TEXTURE_SIZE);
152 m_nTexMapY = MIN_CHUNKS_SIZE(m_depthMD.FullYRes(), TEXTURE_SIZE);
153 m_pTexMap = new XnRGB24Pixel[m_nTexMapX * m_nTexMapY];
154
155 m_pDepthHist = new float[m_depth.GetDeviceMaxDepth() + 1];
156
157 return InitOpenGL(argc, argv);
158}
159
160XnStatus SimpleViewer::Run()
161{

Callers

nothing calls this directly

Calls 6

FindExistingNodeMethod · 0.80
FullXResMethod · 0.80
FullYResMethod · 0.80
GetMetaDataMethod · 0.45
PixelFormatMethod · 0.45
GetDeviceMaxDepthMethod · 0.45

Tested by

no test coverage detected