mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 22:26:35 +00:00
Add support for A8 remote control to opi_rtsp test app
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <QDebug>
|
||||
#include <QVector>
|
||||
#include "aienginegimbalcontrol.h"
|
||||
|
||||
|
||||
AiEngineGimbalControl::AiEngineGimbalControl(QObject *parent)
|
||||
: QObject{parent}
|
||||
{}
|
||||
@@ -37,6 +38,10 @@ AiEngineRectangle AiEngineGimbalControl::getGroupCoordinates(QVector<AiEngineObj
|
||||
|
||||
void AiEngineGimbalControl::inferenceResultSlot(AiEngineInferenceResult result)
|
||||
{
|
||||
if (result.objects.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We got list of all recognized objects, but at least for now we will zoom to all objects at
|
||||
// once and not for each invidually. Got minimal coordinates which contains the all objects.
|
||||
AiEngineRectangle groupRect = getGroupCoordinates(result.objects);
|
||||
@@ -46,4 +51,20 @@ void AiEngineGimbalControl::inferenceResultSlot(AiEngineInferenceResult result)
|
||||
groupRect.left *= 2;
|
||||
groupRect.bottom *= 2;
|
||||
groupRect.right *= 2;
|
||||
|
||||
if (groupRect.top > 720 || groupRect.bottom > 720) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (groupRect.left > 1280 || groupRect.right > 1280) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((groupRect.bottom <= groupRect.top) || (groupRect.right <= groupRect.left)) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "TUOMAS!! Zooming to square" << groupRect.top << "x" << groupRect.left << "and" << groupRect.bottom << "x" << groupRect.right;
|
||||
|
||||
mRemoteControl.sendData(groupRect.top, groupRect.left, groupRect.left, groupRect.right);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user