feat: 重新规划ui布局;增加左右红外以及rgb相机可视化
This commit is contained in:
@@ -19,10 +19,16 @@
|
||||
|
||||
// Image format
|
||||
#define PIXEL_FORMAT_12BIT_GRAY 0x010C0001
|
||||
#define PIXEL_FORMAT_MONO16 0x01100005 // Mono16 format (legacy)
|
||||
#define PIXEL_FORMAT_MONO16_LEFT 0x01100006 // Mono16 format for left IR camera
|
||||
#define PIXEL_FORMAT_MONO16_RIGHT 0x01100007 // Mono16 format for right IR camera
|
||||
#define PIXEL_FORMAT_MJPEG 0x02180001 // MJPEG format for RGB camera
|
||||
|
||||
// Image dimensions
|
||||
#define IMAGE_WIDTH 1224
|
||||
#define IMAGE_HEIGHT 1024
|
||||
#define RGB_WIDTH 1920
|
||||
#define RGB_HEIGHT 1080
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -105,39 +111,54 @@ public:
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void imageReceived(const QImage &image, uint32_t blockId);
|
||||
void depthDataReceived(const QByteArray &depthData, uint32_t blockId);
|
||||
void leftImageReceived(const QByteArray &jpegData, uint32_t blockId); // 左红外图像(JPEG)
|
||||
void rightImageReceived(const QByteArray &jpegData, uint32_t blockId); // 右红外图像(JPEG)
|
||||
void rgbImageReceived(const QByteArray &jpegData, uint32_t blockId); // RGB图像(MJPEG)
|
||||
void pointCloudDataReceived(const QByteArray &cloudData, uint32_t blockId);
|
||||
void parseError(const QString &error);
|
||||
|
||||
// 兼容旧代码
|
||||
void imageReceived(const QImage &image, uint32_t blockId);
|
||||
void depthDataReceived(const QByteArray &depthData, uint32_t blockId);
|
||||
|
||||
private:
|
||||
// 每种数据流的独立接收状态
|
||||
struct StreamState {
|
||||
bool isReceiving;
|
||||
uint32_t blockId;
|
||||
QByteArray dataBuffer;
|
||||
size_t expectedSize;
|
||||
size_t receivedSize;
|
||||
int packetCount;
|
||||
|
||||
// 图像特有信息
|
||||
uint32_t imageWidth;
|
||||
uint32_t imageHeight;
|
||||
uint32_t pixelFormat;
|
||||
|
||||
StreamState() : isReceiving(false), blockId(0), expectedSize(0),
|
||||
receivedSize(0), packetCount(0), imageWidth(0),
|
||||
imageHeight(0), pixelFormat(0) {}
|
||||
};
|
||||
|
||||
void handleLeaderPacket(const uint8_t *data, size_t size);
|
||||
void handlePayloadPacket(const uint8_t *data, size_t size);
|
||||
void handleTrailerPacket(const uint8_t *data, size_t size);
|
||||
|
||||
void processImageData();
|
||||
void processDepthData();
|
||||
void processPointCloudData();
|
||||
void processImageData(StreamState *state);
|
||||
void processDepthData(StreamState *state);
|
||||
void processPointCloudData(StreamState *state);
|
||||
|
||||
private:
|
||||
// Reception state
|
||||
bool m_isReceiving;
|
||||
int m_dataType; // 0=unknown, 1=image, 3=depth, 4=pointcloud
|
||||
uint32_t m_currentBlockId;
|
||||
|
||||
// Data buffer
|
||||
QByteArray m_dataBuffer;
|
||||
size_t m_expectedSize;
|
||||
size_t m_receivedSize;
|
||||
|
||||
// Image info
|
||||
uint32_t m_imageWidth;
|
||||
uint32_t m_imageHeight;
|
||||
uint32_t m_pixelFormat;
|
||||
// 为每种数据类型维护独立的状态
|
||||
StreamState m_leftIRState; // 左红外
|
||||
StreamState m_rightIRState; // 右红外
|
||||
StreamState m_rgbState; // RGB
|
||||
StreamState m_depthState; // 深度数据
|
||||
StreamState m_pointCloudState; // 点云数据
|
||||
|
||||
// Statistics
|
||||
uint32_t m_lastBlockId;
|
||||
int m_packetCount;
|
||||
int m_imageSequence;
|
||||
|
||||
// Async processing control
|
||||
QAtomicInt m_imageProcessingCount;
|
||||
|
||||
@@ -49,6 +49,10 @@ private:
|
||||
std::vector<float> m_vertices;
|
||||
int m_pointCount;
|
||||
|
||||
// 固定的点云中心点(避免抖动)
|
||||
QVector3D m_fixedCenter;
|
||||
bool m_centerInitialized;
|
||||
|
||||
// 相机参数
|
||||
QMatrix4x4 m_projection;
|
||||
QMatrix4x4 m_view;
|
||||
|
||||
Reference in New Issue
Block a user