Commit 537f8e08 张东亮

ocr程序到不开问题

1 个父辈 4ee377f3
...@@ -430,25 +430,6 @@ namespace BLL ...@@ -430,25 +430,6 @@ namespace BLL
if (algro) if (algro)
{ {
codeOcr=PaddleOCRHelper.StartTest("..\\ocr.jpg"); codeOcr=PaddleOCRHelper.StartTest("..\\ocr.jpg");
if(string.IsNullOrEmpty(codeOcr))
{
#region ocrr文字提取开始
//ocr匹配调用
var resp = namedPipeClient.Request("..\\ocr.jpg");
//ocr结果
var lp = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
double maxbox = 0;
foreach (var l in lp)
{
var boxa = l.CalculateArea(l.BoxPoints);
if (boxa > maxbox)
{
maxbox = boxa;
codeOcr = l.Text;
}
}
#endregion ocr文字提取结束
}
} }
else else
{ {
......
...@@ -17,7 +17,7 @@ namespace BLL ...@@ -17,7 +17,7 @@ namespace BLL
{ {
public class PaddleOCRHelper public class PaddleOCRHelper
{ {
static string baseUrl = ConfigHelper.Config.Get("PaddleServiceBase", "http://192.168.101.12:8090/paddle/getOcr"); static string baseUrl = ConfigHelper.Config.Get("PaddleServiceBase", "http://localhost:8090/paddle/getOcr");
/// <summary> /// <summary>
/// 开始检测 /// 开始检测
/// </summary> /// </summary>
...@@ -30,8 +30,19 @@ namespace BLL ...@@ -30,8 +30,19 @@ namespace BLL
string ocr = ""; string ocr = "";
if (!AppIsRun()) if (!AppIsRun())
{ {
var onnxexe = ".\\paddle\\paddleOCR.exe"; try
Process.Start(onnxexe); {
var paddle = "paddleOCR.exe";
Process process = new Process();
process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = paddle;
process.StartInfo.WorkingDirectory = ".\\paddle";
process.Start();
}
catch (Exception ex)
{
LogNet.log.Error("打开paddleOCR失败", ex);
}
} }
if(AppIsRun()) if(AppIsRun())
{ {
......
...@@ -220,21 +220,6 @@ namespace SmartScan ...@@ -220,21 +220,6 @@ namespace SmartScan
if (algro) if (algro)
{ {
codeOcrs = PaddleOCRHelper.StartTest("..\\ocrt.jpg"); codeOcrs = PaddleOCRHelper.StartTest("..\\ocrt.jpg");
if(string.IsNullOrEmpty(codeOcrs))
{
var resp = Common.mateEdit.namedPipeClient.Request("..\\ocrt.jpg");
var lp = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
double maxbox = 0;
foreach (var l in lp)
{
var boxa = l.CalculateArea(l.BoxPoints);
if (boxa > maxbox)
{
maxbox = boxa;
codeOcrs = l.Text;
}
}
}
} }
else else
{ {
......
...@@ -45,9 +45,19 @@ namespace SmartScan ...@@ -45,9 +45,19 @@ namespace SmartScan
var onnxexe = "onnx\\OcrLiteOnnxForm.exe"; var onnxexe = "onnx\\OcrLiteOnnxForm.exe";
Process.Start(onnxexe); Process process1 = Process.Start(onnxexe);
var paddle = ".\\paddle\\paddleOCR.exe"; try
Process.Start(paddle); {
var paddle = "paddleOCR.exe";
Process process = new Process();
process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = paddle;
process.StartInfo.WorkingDirectory = ".\\paddle";
process.Start();
}catch (Exception ex)
{
}
......
...@@ -17,6 +17,7 @@ namespace DeviceLibrary ...@@ -17,6 +17,7 @@ namespace DeviceLibrary
{ {
Result result = new Result(); Result result = new Result();
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
result.data = PaddleOCRHelper.StartCPlusOcr(imgPath);
//if (string.IsNullOrEmpty(ver)) //if (string.IsNullOrEmpty(ver))
//{ //{
// result.data = PaddleOCRHelper.StartCPlusOcr(imgPath); // result.data = PaddleOCRHelper.StartCPlusOcr(imgPath);
...@@ -24,7 +25,7 @@ namespace DeviceLibrary ...@@ -24,7 +25,7 @@ namespace DeviceLibrary
//else //else
//if (ver.ToLower().Equals("python")) //if (ver.ToLower().Equals("python"))
//{ //{
result.data = PaddleOCRHelper.StartPythonOcr(imgPath); // result.data = PaddleOCRHelper.StartPythonOcr(imgPath);
//} //}
//else if(ver.ToLower().Equals("cplus")) //else if(ver.ToLower().Equals("cplus"))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!