Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
CarerayImage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d35469d2
由
刘韬
编写于
2024-01-23 14:05:34 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
f2dde140
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
56 行增加
和
9 行删除
CarerayImage/XrayImage.cs
CarerayImage/eyemLib.cs
CarerayImage_Test/Form1.cs
CarerayImage/XrayImage.cs
查看文件 @
d35469d
...
...
@@ -24,17 +24,35 @@ namespace Asa
static
IntPtr
hModelIDs
=
IntPtr
.
Zero
;
static
XrayImage
()
{
if
(!
Directory
.
Exists
(
"CountTemplate"
))
Directory
.
CreateDirectory
(
"CountTemplate"
);
var
flag
=
eyemInitModel
(
"CountTemplate"
,
out
hModelIDs
);
if
(
flag
!=
0
)
{
throw
new
Exception
(
"eyemInitModel:"
+
flag
+
","
+
hModelIDs
);
}
AlgoIndex
.
Clear
();
AlgoIndex
.
Add
(
"NONE"
,
-
1
);
for
(
int
i
=
0
;
i
<
sOptions
.
Length
;
i
++)
{
AlgoIndex
.
Add
(
sOptions
[
i
],
i
);
}
if
(!
Directory
.
Exists
(
"CountTemplate"
))
Directory
.
CreateDirectory
(
"CountTemplate"
);
var
flag
=
eyemInitModel
(
"CountTemplate"
,
out
hModelIDs
);
if
(
flag
!=
0
)
{
if
(!
ReloadEyemlib
())
throw
new
Exception
(
"eyemInitModel:"
+
flag
+
","
+
hModelIDs
);
}
}
/// <summary>
/// 重载eyemLib.dll
/// </summary>
[
HandleProcessCorruptedStateExceptions
]
public
static
bool
ReloadEyemlib
()
{
if
(
hModelIDs
!=
IntPtr
.
Zero
)
{
eyemReleaseModel
(
ref
hModelIDs
);
hModelIDs
=
IntPtr
.
Zero
;
}
UnloadModule
(
"eyemLib.dll"
);
Thread
.
Sleep
(
10
);
LoadLibrary
(
"eyemLib.dll"
);
return
ReloadTpl
()==
0
;
}
/// <summary>
/// 算法名称对索引应序号
...
...
@@ -364,7 +382,11 @@ namespace Asa
count
=
ipReelNum
;
if
(
n
==
0
)
BmpDstImg
=
eyemCvtToBitmap
(
tpDstImg
);
eyemImageFree
(
ref
tpDstImg
);
//if (n != 0)
// ReloadEyemlib();
return
n
;
}
...
...
@@ -435,6 +457,8 @@ namespace Asa
eyemImageFree
(
ref
tpDstImg
);
eyemImageFree
(
ref
eyem
);
count
=
ipReelNum
;
//if(n!=0)
// ReloadEyemlib();
return
true
;
}
...
...
@@ -468,9 +492,11 @@ namespace Asa
int
result
=
-
1
;
try
{
Debug
.
WriteLine
(
"hModelIDs:"
+
hModelIDs
);
eyemReleaseModel
(
ref
hModelIDs
);
if
(
hModelIDs
!=
IntPtr
.
Zero
)
{
Debug
.
WriteLine
(
"hModelIDs:"
+
hModelIDs
);
eyemReleaseModel
(
ref
hModelIDs
);
}
result
=
eyemInitModel
(
"CountTemplate"
,
out
hModelIDs
);
return
result
;
}
...
...
CarerayImage/eyemLib.cs
查看文件 @
d35469d
using
Microsoft.Win32.SafeHandles
;
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
...
...
@@ -357,5 +358,24 @@ namespace Asa
float
fY
;
// Y坐标
float
fR
;
// 半径
}
[
DllImport
(
"kernel32"
,
SetLastError
=
true
)]
static
extern
bool
FreeLibrary
(
IntPtr
hModule
);
[
DllImport
(
"kernel32"
,
SetLastError
=
true
)]
static
extern
bool
FreeLibraryAndExitThread
(
IntPtr
hModule
,
uint
dwExitCode
);
public
static
void
UnloadModule
(
string
moduleName
)
{
foreach
(
ProcessModule
mod
in
Process
.
GetCurrentProcess
().
Modules
)
{
if
(
mod
.
ModuleName
==
moduleName
)
{
FreeLibrary
(
mod
.
BaseAddress
);
//FreeLibraryAndExitThread(mod.BaseAddress,0);
}
}
}
[
DllImport
(
"kernel32.dll"
)]
public
extern
static
IntPtr
LoadLibrary
(
string
path
);
}
}
CarerayImage_Test/Form1.cs
查看文件 @
d35469d
...
...
@@ -157,6 +157,7 @@ namespace CarerayImage_Test
private
void
button9_Click
(
object
sender
,
EventArgs
e
)
{
//xrayImage.ReloadEyemlib();
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
eyemLib
.
EyemImage
eyemImage
=
xrayImage
.
GetRawBufferHandle
();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论