Frames are now saved to the file, added FramesFileWriterReader class.

This commit is contained in:
JacekNaruniec
2017-01-14 18:48:27 +01:00
parent e068058868
commit e453d927d3
8 changed files with 202 additions and 14 deletions
@@ -0,0 +1,41 @@
#pragma once
#include <stdio.h>
#include <string>
#include <vector>
#include <chrono>
#include "utils.h"
class FramesFileWriterReader
{
public:
FramesFileWriterReader();
void openNewFileForWriting();
void openCurrentFileForReading();
// leave filename blank if you want the filename to be generated from the date
void setCurrentFilename(std::string filename = "");
void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors);
bool readFrame(std::vector<Point3s> &outPoints, std::vector<RGB> &outColors);
bool openedForWriting() { return m_bFileOpenedForWriting; }
bool openedForReading() { return m_bFileOpenedForReading; }
void closeFileIfOpened();
~FramesFileWriterReader();
private:
void resetTimer();
int getRecordingTimeMilliseconds();
FILE *m_pFileHandle = nullptr;
bool m_bFileOpenedForWriting = false;
bool m_bFileOpenedForReading = false;
std::string m_sFilename = "";
std::chrono::steady_clock::time_point recording_start_time;
};
+6 -1
View File
@@ -20,6 +20,7 @@
#include "calibration.h"
#include "utils.h"
#include "KinectCapture.h"
#include "framesFileWriterReader.h"
#include <thread>
#include <mutex>
@@ -54,7 +55,11 @@ private:
bool m_bShowDepth;
bool m_bFrameCompression;
int m_iCompressionLevel;
bool m_bCaptureToFile; // false if capture frames to memory
FramesFileWriterReader m_framesFileWriterReader;
SocketClient *m_pClientSocket;
std::vector<float> m_vBounds;