fix repeat char bug
This commit is contained in:
@@ -11,7 +11,7 @@ int main()
|
||||
const std::wstring detModelPath = L".\\DetectionModel.onnx";
|
||||
const std::wstring recModelPath = L".\\RecognitionModel-EN.onnx";
|
||||
const std::wstring recModelWithChnPath = L".\\RecognitionModel_EN+CH_SIM.onnx";
|
||||
const std::string imagePath = "..\\..\\vin.jpg";
|
||||
const std::string imagePath = "..\\..\\vin-err.jpg";
|
||||
|
||||
//Init Config
|
||||
uns::G_OCRConfig.SetGPUUsage(uns::OCRConfig::GPUUsage::CPUOnly);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "OCRCharset.h"
|
||||
#include "OCRConfig.h"
|
||||
#include <iostream>
|
||||
#pragma warning(disable:6262)
|
||||
|
||||
std::map<int, std::wstring> uns::OCRCharset::en_charmap =
|
||||
@@ -6860,11 +6861,15 @@ std::wstring uns::OCRCharset::GetString(const std::vector<int>& indexs)
|
||||
}
|
||||
if ((charset_ptr == nullptr))
|
||||
return L"";
|
||||
int last_index = 0;
|
||||
std::wstring result;
|
||||
for (const auto& index : indexs)
|
||||
{
|
||||
if (charset_ptr->find(index) == charset_ptr->end())
|
||||
continue;
|
||||
if (last_index == index)
|
||||
continue;
|
||||
last_index = index;
|
||||
if (index == 0) //Ignore 0 (Invalidate Value)
|
||||
continue;
|
||||
result += (*charset_ptr)[index];
|
||||
|
||||
@@ -6861,11 +6861,15 @@ std::wstring uns::OCRCharset::GetString(const std::vector<int>& indexs)
|
||||
}
|
||||
if ((charset_ptr == nullptr))
|
||||
return L"";
|
||||
int last_index = 0;
|
||||
std::wstring result;
|
||||
for (const auto& index : indexs)
|
||||
{
|
||||
if (charset_ptr->find(index) == charset_ptr->end())
|
||||
continue;
|
||||
if (last_index == index)
|
||||
continue;
|
||||
last_index = index;
|
||||
if (index == 0) //Ignore 0 (Invalidate Value)
|
||||
continue;
|
||||
result += (*charset_ptr)[index];
|
||||
|
||||
Reference in New Issue
Block a user