Exemple #1
0
int main()
{
    for(auto file : files)
    {
        if(shouldCheck(file))
        {
            auto transformed = transformFile(file);
            std::cout << transformed << std::endl;
        }
    }
    return 0;
}
KinectViewer::KinectStreamer::KinectStreamer(USBContext& context,int cameraIndex)
#endif
	:camera(0),frameSaver(0),
	 projector(0),
	 projectorTransform(Vrui::OGTransform::identity),
	 enabled(true)
	{
	#if PLAYBACK
	/* Open the given frame files: */
	camera=new KinectPlayback(depthFrameFileName,colorFrameFileName);
	std::string serialNumber="B00367608415043B";
	#else
	/* Attach to and open the Kinect camera: */
	camera=new KinectCamera(context,cameraIndex);
	camera->open();
	
	/* Get the camera's serial number to load the proper calibration matrices: */
	std::string serialNumber=camera->getSerialNumber();
	#endif
	
	/* Create a Kinect projector with the proper calibration matrices: */
	std::string calibrationFileName="CameraCalibrationMatrices-";
	calibrationFileName.append(serialNumber);
	calibrationFileName.append(".dat");
	projector=new KinectProjector(calibrationFileName.c_str());
	
	/* Read the camera's model space transformation: */
	std::string transformFileName="ProjectorTransform-";
	transformFileName.append(serialNumber);
	transformFileName.append(".txt");
	Misc::File transformFile(transformFileName.c_str(),"rt");
	char transform[1024];
	transformFile.gets(transform,sizeof(transform));
	projectorTransform=Misc::ValueCoder<Vrui::OGTransform>::decode(transform,transform+strlen(transform),0);
	
	/* Start streaming: */
	camera->startStreaming(new Misc::VoidMethodCall<const FrameBuffer&,KinectViewer::KinectStreamer>(this,&KinectViewer::KinectStreamer::colorStreamingCallback),new Misc::VoidMethodCall<const FrameBuffer&,KinectViewer::KinectStreamer>(this,&KinectViewer::KinectStreamer::depthStreamingCallback));
	}