96 lines
2.2 KiB
C++
96 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include <QDialog>
|
|
#include <QNetworkRequest>
|
|
#include <QNetworkReply>
|
|
#include <QNetworkAccessManager>
|
|
#include <QImage>
|
|
#include <Qthread>
|
|
#include <QDir>
|
|
//#include <QLabel>
|
|
#include <QFileDialog>
|
|
|
|
#include <iostream>
|
|
#include "ui_DepthCamera.h"
|
|
#include "AppSettings.h"
|
|
|
|
#include <fstream>
|
|
#include <opencv2/opencv.hpp>
|
|
#include <libobsensor/ObSensor.hpp>
|
|
#include "libobsensor/hpp/Utils.hpp"
|
|
typedef void(*func)();
|
|
|
|
class DepthCameraOperation :public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
DepthCameraOperation();
|
|
~DepthCameraOperation();
|
|
|
|
QImage m_colorImage;
|
|
QImage m_depthImage;
|
|
void setCallback(void(*func)());
|
|
bool getRecordStatus() const { return record; }
|
|
|
|
void setCaptureInterval(int captureIntervalSeconds);
|
|
|
|
private:
|
|
ob::Pipeline* m_pipe;
|
|
cv::Mat frame;
|
|
|
|
func m_func;
|
|
|
|
void saveDepthFrame(const std::shared_ptr<ob::DepthFrame> depthFrame, const uint32_t frameIndex, std::string fileNamePrefix_);
|
|
void saveColorFrame(const std::shared_ptr<ob::ColorFrame> colorFrame, const uint32_t frameIndex, std::string fileNamePrefix_);
|
|
void printImuValue(OBFloat3D obFloat3d, uint64_t index, uint64_t timeStampUs, float temperature, OBFrameType type, const std::string& unitStr);
|
|
void saveImuData(std::ofstream& imuFile, const std::shared_ptr<ob::AccelFrame>& accelFrame, const std::shared_ptr<ob::GyroFrame>& gyroFrame);
|
|
|
|
bool record;
|
|
|
|
int m_captureIntervalMilliseconds;
|
|
|
|
public slots:
|
|
void OpenDepthCamera();
|
|
void OpenDepthCamera_callback();//不使用信号而使用回调函数来通知界面刷新视频
|
|
void CloseDepthCamera();
|
|
|
|
signals:
|
|
void PlotSignal();
|
|
|
|
void CamOpenedSignal();
|
|
void CamClosedSignal();
|
|
};
|
|
|
|
class DepthCameraWindow : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
DepthCameraWindow(QWidget* parent = nullptr);
|
|
~DepthCameraWindow();
|
|
|
|
DepthCameraOperation* m_DepthCameraOperation;
|
|
|
|
void setDataFolder(QString dir);
|
|
void setCaptureInterval(int captureIntervalSeconds);
|
|
|
|
public Q_SLOTS:
|
|
void openDepthCamera();
|
|
void onCamOpened();
|
|
void closeDepthCamera();
|
|
void onCamClosed();
|
|
|
|
void onSelectDataFolder();
|
|
|
|
signals:
|
|
void openDepthCameraSignal();
|
|
void PlotDepthImageSignal();
|
|
void DepthCamClosedSignal();
|
|
|
|
private:
|
|
Ui::DepthCameraClass ui;
|
|
QThread* m_DepthCameraThread;
|
|
|
|
};
|