Fully working OPI5 and Azaion AI object recognition

This commit is contained in:
Your Name
2024-07-03 14:03:00 +03:00
parent 831aeda21d
commit 2d94fd576f
9 changed files with 249 additions and 16 deletions
+16 -2
View File
@@ -2,8 +2,12 @@
#include <opencv2/highgui.hpp>
#include "aiengine.h"
#include "aiengineinference.h"
#include "src-onnx/aiengineinferenceonnx.h"
#ifdef OPI5_BUILD
#include "src-opi5/aiengineinferenceopi5.h"
#else
#include "src-onnx/aiengineinferenceonnx.h"
#endif
AiEngine::AiEngine(QString modelPath, QObject *parent)
: QObject{parent}
@@ -11,8 +15,13 @@ AiEngine::AiEngine(QString modelPath, QObject *parent)
mRtspListener = new AiEngineRtspListener(this);
connect(mRtspListener, &AiEngineRtspListener::frameReceived, this, &AiEngine::frameReceivedSlot);
#ifdef OPI5_BUILD
mInference = new AiEngineInferenceOpi5(modelPath);
#else
mInference = new AiEngineInferenceOnnx(modelPath);
#endif
QThread *inferenceThread = new QThread(this);
mInference = new AiEngineInferenceOnnx(modelPath);
mInference->moveToThread(inferenceThread);
connect(mInference, &AiEngineInference::resultsReady, this, &AiEngine::inferenceResultsReceivedSlot, Qt::QueuedConnection);
connect(this, &AiEngine::inferenceFrame, mInference, &AiEngineInference::performInferenceSlot, Qt::QueuedConnection);
@@ -36,7 +45,12 @@ void AiEngine::inferenceResultsReceivedSlot(AiEngineInferenceResult results)
{
(void)results;
qDebug() << "AiEngine got inference results in thread: " << QThread::currentThreadId();
cv::imshow("Received Frame", results.frame);
//#ifndef OPI5_BUILD
//cv::imshow("Received Frame", results.frame);
//#endif
}