feat: 重新规划ui布局;增加左右红外以及rgb相机可视化
This commit is contained in:
@@ -284,30 +284,29 @@ void PointCloudProcessor::processPointCloudData(const QByteArray &cloudData, uin
|
||||
const int16_t* cloudShort = reinterpret_cast<const int16_t*>(cloudData.constData());
|
||||
|
||||
if (isZOnly) {
|
||||
// Z-only格式:直接映射为平面点云(类似图像平面)
|
||||
// X对应列(左右翻转),Y对应行(上下翻转),Z是深度值
|
||||
// qDebug() << "[PointCloud] Processing Z-only format as planar mapping";
|
||||
|
||||
// Z-only格式:转换为正交投影(柱形)
|
||||
for (size_t i = 0; i < m_totalPoints; i++) {
|
||||
int row = i / m_imageWidth;
|
||||
int col = i % m_imageWidth;
|
||||
|
||||
// 直接映射:X=列(翻转),Y=行(翻转),Z=深度
|
||||
float x = static_cast<float>(m_imageWidth - 1 - col); // 左右翻转
|
||||
float y = static_cast<float>(m_imageHeight - 1 - row); // 上下翻转
|
||||
// 读取深度值(单位:毫米)
|
||||
float z = static_cast<float>(cloudShort[i]) * m_zScale;
|
||||
|
||||
cloud->points[i].x = x;
|
||||
cloud->points[i].y = y;
|
||||
// 正交投影:X、Y使用像素坐标(Y轴翻转以修正镜像)
|
||||
cloud->points[i].x = static_cast<float>(col);
|
||||
cloud->points[i].y = static_cast<float>(m_imageHeight - 1 - row);
|
||||
cloud->points[i].z = z;
|
||||
}
|
||||
} else {
|
||||
// XYZ格式:完整的三维坐标
|
||||
// qDebug() << "[PointCloud] Processing XYZ format";
|
||||
|
||||
// 转换为正交投影(柱形),使用像素坐标作为X、Y
|
||||
for (size_t i = 0; i < m_totalPoints; i++) {
|
||||
cloud->points[i].x = static_cast<float>(cloudShort[i * 3 + 0]) * m_zScale;
|
||||
cloud->points[i].y = static_cast<float>(cloudShort[i * 3 + 1]) * m_zScale;
|
||||
int row = i / m_imageWidth;
|
||||
int col = i % m_imageWidth;
|
||||
|
||||
// 正交投影:X、Y使用像素坐标(Y轴翻转以修正镜像),Z使用深度值
|
||||
cloud->points[i].x = static_cast<float>(col);
|
||||
cloud->points[i].y = static_cast<float>(m_imageHeight - 1 - row);
|
||||
cloud->points[i].z = static_cast<float>(cloudShort[i * 3 + 2]) * m_zScale;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user