Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

6 changed files with 14 additions and 32 deletions

3
.gitignore vendored
View File

@ -360,5 +360,4 @@ MigrationBackup/
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/Marking.OCR.Service/images
FodyWeavers.xsd

View File

@ -22,7 +22,7 @@ namespace Marking.OCR.Service.Controllers
}
/// <summary>
/// 获取模板截图定位点坐标信息
/// 获取模板截图定位点坐标信息
/// </summary>
/// <returns></returns>
[HttpGet("position")]
@ -31,17 +31,17 @@ namespace Marking.OCR.Service.Controllers
using var src = await _imageHelper.DownloadImageAsync(position.ImageUrl);
if (src == null)
{
throw Oops.Oh("图片加载失败!");
throw Oops.Oh("图片加载失败!");
}
// 调整图片大小
// 调整图片大小
Cv2.Resize(src, src, new Size(position.ImageWidth, position.ImageHeight));
//_imageHelper.Show(src);
// 裁剪图片
// 裁剪图片
using var img_roi = new Mat(src, new Rect(position.X, position.Y, position.Width, position.Height));
//_imageHelper.Show(img_roi);
// 转换灰度图片
// 转换灰度图片
Cv2.CvtColor(img_roi, img_roi, ColorConversionCodes.BGR2GRAY);
//_imageHelper.Show(img_roi);
@ -50,11 +50,11 @@ namespace Marking.OCR.Service.Controllers
var locationPoints = _imageHelper.FindLocationPoint(imgHandle, false);
if (!locationPoints.Any())
{
throw Oops.Oh("框选范围未找到定位点,请重新框选!");
throw Oops.Oh("框选范围未找到定位点,请重新框选!");
}
if (locationPoints.Count() > 1)
{
throw Oops.Oh("框选范围识别到多个定位点,请重新框选!");
throw Oops.Oh("框选范围识别到多个定位点,请重新框选!");
}
var locationPoint = locationPoints.FirstOrDefault();

View File

@ -1,12 +1,9 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
#FROM dotnet/aspnet:8.0
FROM noripi10/ubuntu22-dotnet8-opencv4.8.0:latest
FROM dotnet/aspnet:8.0
WORKDIR /app
ENV ASPNETCORE_HTTP_PORTS=80
EXPOSE 80
COPY . .

View File

@ -6,26 +6,13 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Remove="images\**" />
<Content Remove="images\**" />
<EmbeddedResource Remove="images\**" />
<None Remove="images\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Marking.WebExtensions" Version="1.2.1.4" />
<PackageReference Include="OpenCvSharp4" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4_.runtime.ubuntu.20.04-x64" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4" Version="4.9.0.20240103" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.9.0.20240103" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.9.0.20240103" />
<PackageReference Include="OpenCvSharp4_.runtime.ubuntu.20.04-x64" Version="4.9.0.20240103" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<None Update="Dockerfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -4,7 +4,6 @@ using Qwit;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddQwitPack();
builder.Services.AddControllers(options =>

View File

@ -1,7 +1,7 @@
version: "3"
services:
ocr-service:
admin-api:
image: ${REGISTRY:-harbor.w.23544.com:8843}/marking/marking.ocr.service:${TAG:-latest}
hostname: marking
environment: