修改ai插件架构判断

This commit is contained in:
sufang 2024-08-28 15:27:27 +08:00
parent 8434075039
commit 04047b7f7d
4 changed files with 22 additions and 0 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-photo-viewer (1.3.0.3-ok22.33) nile; urgency=medium
* BUG号
* 需求号:无
* 其他改动说明修改ai插件架构判断
* 影响域:无
-- sufang <sufang@kylinos.cn> Wed, 28 Aug 2024 15:22:54 +0800
kylin-photo-viewer (1.3.0.3-ok22.32) nile; urgency=medium kylin-photo-viewer (1.3.0.3-ok22.32) nile; urgency=medium
* BUG号 * BUG号

View File

@ -30,8 +30,15 @@ LIBS += -lopencv_core \
-lopencv_dnn \ -lopencv_dnn \
#onnxruntime #onnxruntime
contains(QMAKE_HOST.arch, x86_64){
INCLUDEPATH += /usr/local/include/onnxruntime INCLUDEPATH += /usr/local/include/onnxruntime
LIBS += -L/usr/local/lib -lonnxruntime LIBS += -L/usr/local/lib -lonnxruntime
}
contains(QMAKE_HOST.arch, aarch64){
INCLUDEPATH += /usr/local/include/onnxruntime
LIBS += -L/usr/local/lib -lonnxruntime
}
INCLUDEPATH += /usr/include/kylin_image_codec/ INCLUDEPATH += /usr/include/kylin_image_codec/
#LIBS += -L/usr/lib -lkylinimagecodec #LIBS += -L/usr/lib -lkylinimagecodec

View File

@ -33,6 +33,7 @@ void PhotoViewerPlugin::matToTransparent()
qDebug() << "Please input RGB image."; qDebug() << "Please input RGB image.";
return; return;
} }
#if !defined(__loongarch64)
// 调整图像大小为模型期望的尺寸 // 调整图像大小为模型期望的尺寸
int inputWidth = 512; int inputWidth = 512;
int inputHeight = 512; int inputHeight = 512;
@ -85,6 +86,9 @@ void PhotoViewerPlugin::matToTransparent()
cv::resize(matte_np, matte_resized, cv::Size(m_origMattingMat.cols, m_origMattingMat.rows), 0, 0, cv::INTER_LINEAR); cv::resize(matte_np, matte_resized, cv::Size(m_origMattingMat.cols, m_origMattingMat.rows), 0, 0, cv::INTER_LINEAR);
// 将抠图结果中背景部分设置为透明色 // 将抠图结果中背景部分设置为透明色
matte_resized.convertTo(m_transparentMat, CV_8U, 255); // 将灰度图像转换为 8 位图像 matte_resized.convertTo(m_transparentMat, CV_8U, 255); // 将灰度图像转换为 8 位图像
#else
return;
#endif
} }
QString PhotoViewerPlugin::startMatting(QString origImagePath, uint b, uint g, uint r, uint a) QString PhotoViewerPlugin::startMatting(QString origImagePath, uint b, uint g, uint r, uint a)

View File

@ -13,7 +13,9 @@
#include <opencv4/opencv2/imgcodecs.hpp> #include <opencv4/opencv2/imgcodecs.hpp>
#include <opencv4/opencv2/imgproc.hpp> #include <opencv4/opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#if !defined(__loongarch64)
#include <onnxruntime/onnxruntime_cxx_api.h> #include <onnxruntime/onnxruntime_cxx_api.h>
#endif
#include "kylinimagecodec.h" #include "kylinimagecodec.h"
using namespace cv; using namespace cv;
using namespace std; using namespace std;