Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
CarerayImage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 29168cb4
由
刘韬
编写于
2025-03-05 16:03:27 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
CountTemplateX
1 个父辈
31fa496f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
3 行删除
CarerayImage/NeoX.cs
CarerayImage/XrayImage.cs
dll/ConfigHelper.dll
dll/ConfigHelper.xml
CarerayImage/NeoX.cs
查看文件 @
29168cb
...
@@ -68,7 +68,7 @@ public static class NeoX
...
@@ -68,7 +68,7 @@ public static class NeoX
}
}
[
HandleProcessCorruptedStateExceptions
]
[
HandleProcessCorruptedStateExceptions
]
internal
static
bool
AlgoC
(
string
filename
,
int
shrinkOffset
,
int
Corner
,
string
type
,
out
int
count
,
out
Bitmap
bitmap
)
internal
static
bool
AlgoC
(
string
filename
,
string
templateFile
,
int
shrinkOffset
,
int
Corner
,
string
type
,
out
int
count
,
out
Bitmap
bitmap
)
{
{
var
d
=
new
NeoXData
();
var
d
=
new
NeoXData
();
...
@@ -76,6 +76,7 @@ public static class NeoX
...
@@ -76,6 +76,7 @@ public static class NeoX
d
.
outPath
=
Corner
+
"-Mark.png"
;
d
.
outPath
=
Corner
+
"-Mark.png"
;
d
.
shrinkOffset
=
shrinkOffset
;
d
.
shrinkOffset
=
shrinkOffset
;
d
.
Corner
=
Corner
;
d
.
Corner
=
Corner
;
d
.
temPath
=
templateFile
;
d
.
Algo
=
type
;
d
.
Algo
=
type
;
var
s
=
JsonConvert
.
SerializeObject
(
d
);
var
s
=
JsonConvert
.
SerializeObject
(
d
);
count
=
0
;
count
=
0
;
...
@@ -197,6 +198,8 @@ internal class NeoXData
...
@@ -197,6 +198,8 @@ internal class NeoXData
public
string
imgPath
;
public
string
imgPath
;
//输出图像路径
//输出图像路径
public
string
outPath
;
public
string
outPath
;
//输入模版路径
public
string
temPath
;
//算法名称
//算法名称
public
string
Algo
;
public
string
Algo
;
//剪裁像素
//剪裁像素
...
...
CarerayImage/XrayImage.cs
查看文件 @
29168cb
...
@@ -254,7 +254,10 @@ namespace Asa
...
@@ -254,7 +254,10 @@ namespace Asa
type
=
NeoX
.
ConverterType
(
type
,
true
);
type
=
NeoX
.
ConverterType
(
type
,
true
);
if
(
NeoX
.
HasNeox
()
&&
type
.
StartsWith
(
"ID"
))
if
(
NeoX
.
HasNeox
()
&&
type
.
StartsWith
(
"ID"
))
{
{
var
result
=
NeoX
.
AlgoC
(
path
,
ShrinkOffset
,
0
,
type
,
out
int
c
,
out
Bitmap
bitmap
);
var
tf
=
GetTemplateFile
(
path
);
if
(!
string
.
IsNullOrEmpty
(
tf
))
type
=
"ID_TYPE_T"
;
var
result
=
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
0
,
type
,
out
int
c
,
out
Bitmap
bitmap
);
count
=
new
int
[
4
]
{
c
,
0
,
0
,
0
};
count
=
new
int
[
4
]
{
c
,
0
,
0
,
0
};
BmpDstImg
=
bitmap
;
BmpDstImg
=
bitmap
;
return
result
?
0
:-
1
;
return
result
?
0
:-
1
;
...
@@ -272,6 +275,51 @@ namespace Asa
...
@@ -272,6 +275,51 @@ namespace Asa
eyemImageFree
(
ref
eyem
);
eyemImageFree
(
ref
eyem
);
return
n
;
return
n
;
}
}
private
static
string
GetTemplateFile
(
string
path
)
{
try
{
// 提取文件名中等于号前面的部分
string
fileName
=
Path
.
GetFileNameWithoutExtension
(
path
);
var
splitchar
=
ConfigHelper
.
Config
.
Get
(
"PN_Split_Char"
,
"-"
);
int
index
=
fileName
.
IndexOf
(
splitchar
);
// 找到等于号的位置
string
pn
;
if
(
index
!=
-
1
)
{
pn
=
fileName
.
Substring
(
0
,
index
);
// 截取等于号前面的部分
}
else
{
pn
=
fileName
;
// 如果没有等号,则直接使用整个文件名
}
// 拼接目标路径和文件名
string
directoryPath
=
CommonLib
.
GetPath
(
"CountTemplateX"
);
string
targetFile
=
$
"{pn}.png"
;
string
fullPath
=
Path
.
Combine
(
directoryPath
,
targetFile
);
string
subfullPath
=
Path
.
Combine
(
CommonLib
.
GetPath
(
"..\\CountTemplateX"
),
targetFile
);
// 检查目标文件是否存在
if
(
File
.
Exists
(
fullPath
))
{
return
fullPath
;
// 返回文件的完整路径
}
else
if
(
File
.
Exists
(
subfullPath
))
{
return
subfullPath
;
// 返回文件的完整路径
}
else
{
return
""
;
// 文件不存在,返回空
}
}
catch
(
Exception
ex
)
{
// 处理异常,如路径无法访问、文件名无效等
Console
.
WriteLine
(
$
"Error: {ex}"
);
return
""
;
}
}
[
HandleProcessCorruptedStateExceptions
]
[
HandleProcessCorruptedStateExceptions
]
public
static
int
GetLocalCountIrregular
(
EyemImage
eyem
,
int
ShrinkOffset
,
string
outfilename
,
string
type
,
out
int
[]
count
,
out
Bitmap
BmpDstImg
)
public
static
int
GetLocalCountIrregular
(
EyemImage
eyem
,
int
ShrinkOffset
,
string
outfilename
,
string
type
,
out
int
[]
count
,
out
Bitmap
BmpDstImg
)
...
@@ -329,7 +377,11 @@ namespace Asa
...
@@ -329,7 +377,11 @@ namespace Asa
int
Corner
=
ck
;
int
Corner
=
ck
;
try
try
{
{
NeoX
.
AlgoC
(
path
,
ShrinkOffset
,
Corner
+
1
,
ccdata
[
ck
],
out
int
c
,
out
Bitmap
bitmap
);
var
type1
=
ccdata
[
ck
];
var
tf
=
GetTemplateFile
(
path
);
if
(!
string
.
IsNullOrEmpty
(
tf
))
type1
=
"ID_TYPE_T"
;
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
Corner
+
1
,
type1
,
out
int
c
,
out
Bitmap
bitmap
);
lock
(
ccresult
)
lock
(
ccresult
)
{
{
ccresult
.
Add
(
Corner
,
(
c
,
bitmap
));
ccresult
.
Add
(
Corner
,
(
c
,
bitmap
));
...
...
dll/ConfigHelper.dll
查看文件 @
29168cb
此文件类型无法预览
dll/ConfigHelper.xml
查看文件 @
29168cb
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论