mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
perf.更新企鹅数据识别接口,改用cv::Mat::data,优化性能
This commit is contained in:
@@ -12,7 +12,9 @@ extern "C" {
|
||||
void PENGUINAPI load_server(const char* server);
|
||||
void PENGUINAPI load_json(const char* stage_index, const char* hash_index);
|
||||
void PENGUINAPI load_templ(const char* itemId, const uint8_t* buffer, size_t size);
|
||||
void PENGUINAPI load_templ_with_data(const char* itemId, int rows, int cols, int type, void* data);
|
||||
PENGUINAPI_PORT const char* PENGUIN_CALL recognize(const uint8_t* buffer, size_t size);
|
||||
PENGUINAPI_PORT const char* PENGUIN_CALL recognize_with_data(int rows, int cols, int type, void* data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
BIN
3rdparty/lib/penguin-stats-recognize.lib
vendored
BIN
3rdparty/lib/penguin-stats-recognize.lib
vendored
Binary file not shown.
@@ -6,7 +6,7 @@
|
||||
#include <opencv2/opencv.hpp>
|
||||
namespace penguin
|
||||
{
|
||||
#include <penguin-stats-recognize/penguin_wasm.h>
|
||||
#include <penguin-stats-recognize/penguin.h>
|
||||
}
|
||||
|
||||
#include "AsstUtils.hpp"
|
||||
@@ -29,9 +29,7 @@ void asst::PenguinPack::set_language(const std::string& server)
|
||||
|
||||
std::string asst::PenguinPack::recognize(const cv::Mat image)
|
||||
{
|
||||
std::vector<uchar> buf;
|
||||
cv::imencode(".png", image, buf);
|
||||
return penguin::recognize(buf.data(), buf.size());
|
||||
return penguin::recognize_with_data(image.rows, image.cols, image.type(), image.data);
|
||||
}
|
||||
|
||||
bool asst::PenguinPack::load_json(const std::string& stage_path, const std::string& hash_path)
|
||||
@@ -86,10 +84,7 @@ bool asst::PenguinPack::load_templ(const std::string& item_id, const std::string
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<uchar> buf;
|
||||
cv::imencode(".png", image, buf);
|
||||
|
||||
penguin::load_templ(item_id.c_str(), buf.data(), buf.size());
|
||||
penguin::load_templ_with_data(item_id.c_str(), image.rows, image.cols, image.type(), image.data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user