Beispiel #1
0
void CameraHandler::SwitchToReadMode() {
	delete m_camera;
	cout << "Please enter the directory name of your recorded video: ";
	char dirName[150];
	cin >> dirName;
	FileHandler* fileHandler = FileHandler::Init();
	const char* videoSuperDirectoryName = "Video";
	char fullPath[150];
	fileHandler->GetPath(videoSuperDirectoryName, dirName, fullPath);

	m_camera = new CameraFromFile(fullPath);
	if (!m_camera->IsInitialized()) {
		cout << "Failed initializing read from file." << endl;
		delete fileHandler;
		exit(1);
	}
	delete fileHandler;
}
Beispiel #2
0
CameraHandler::CameraHandler()
{
	inputData_depth = new CAMERA_DEPTH_TYPE[m_params.m_width*m_params.m_height];
	inputData_rgb = new CAMERA_RGB_TYPE[m_params.m_width*m_params.m_height];
	
	if(isFromCamera) {
		char path[200] = {0};
		FileHandler* fileHandler = FileHandler::Init();
		fileHandler->GetPath("Video", "realTrial", path); // TODO: What is this real trial? You may want to get it from the user.

		// TODO: THE SOFTKINETIC CONSTRUCTOR MUST CHECK THAT IT CAN READ FROM THE SERVER.
		// OTHERWISE IT SHOULD RETURN FALSE.
		
		if (FALSE
		#ifdef BUILD_SOFTKINETIC
		    || (m_camera = new SoftKineticCamera()) && m_camera->IsInitialized() 
		#endif
		#ifdef BUILD_GIPCAM
		    || (m_camera = new GIPCam()) && m_camera->IsInitialized()
		#endif
		#ifdef BUILD_PRIMESENSE
		    || (m_camera = new PrimesenseCamera()) && m_camera->IsInitialized()
		#endif
		#ifdef BUILD_FROMFILE
		    || (m_camera = new CameraFromFile(path)) && m_camera->IsInitialized()
		#endif
		)
		{
			m_params = *(m_camera->GetParameters());
		}
		else {
			cout << "No camera found!" << endl;
			exit(1); // TODO CHANGE
		}
	}
}