51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#include "DetectPresenter.h"
|
|
|
|
#include <algorithm>
|
|
|
|
QString DetectPresenter::GetAlgoVersion()
|
|
{
|
|
return QStringLiteral("停车引导预留算法接口 版本0.1");
|
|
}
|
|
|
|
int DetectPresenter::DetectParkingSpaceGuide(const QImage& frame,
|
|
const RsCloudData& cloud,
|
|
const VrAlgorithmParams& algorithmParams,
|
|
DetectionResult& result)
|
|
{
|
|
result = DetectionResult();
|
|
result.cameraIndex = 1;
|
|
result.errorCode = 0;
|
|
result.image = frame;
|
|
|
|
if (result.image.isNull()) {
|
|
result.image = QImage(960, 540, QImage::Format_RGB32);
|
|
result.image.fill(QColor(34, 37, 43));
|
|
}
|
|
|
|
const VrParkingSpaceGuideParam& p = algorithmParams.guideParam;
|
|
const double cloudScale = cloud.empty() ? 1.0 : std::min<double>(2.0, 1.0 + cloud.size() / 1000.0);
|
|
|
|
ParkingSpaceGuidePosition position;
|
|
position.x = 0.0;
|
|
position.y = p.targetStopOffset;
|
|
position.z = 0.0;
|
|
position.roll = 0.0;
|
|
position.pitch = 0.0;
|
|
position.yaw = 0.0;
|
|
result.positions.push_back(position);
|
|
|
|
ParkingSpaceGuideInfo info;
|
|
info.hasException = false;
|
|
info.distance = p.targetStopOffset * cloudScale;
|
|
info.lateralOffset = 0.0;
|
|
info.angle = 0.0;
|
|
info.aircraftSpeed = 0.0;
|
|
info.confidence = p.confidenceThreshold;
|
|
info.guideStateCode = 0;
|
|
info.guideText = QStringLiteral("预留算法接口");
|
|
result.parkingSpaceInfoList.push_back(info);
|
|
result.message = QStringLiteral("停车引导预留算法接口");
|
|
|
|
return 0;
|
|
}
|