Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.GimbalAI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.GimbalAI
Commits
6d894e9e
Commit
6d894e9e
authored
Oct 09, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 安全框
2. 轴移动方向
parent
8c9bee4e
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
475 additions
and
59 deletions
+475
-59
VIZ.GimbalAI.Client/App.xaml.cs
+2
-2
VIZ.GimbalAI.Client/config/config.ini
+10
-2
VIZ.GimbalAI.Connection/UDP/Gimbal/Provider/GimbalCenterAxisProvider.cs
+5
-7
VIZ.GimbalAI.Connection/app.config
+5
-1
VIZ.GimbalAI.Domain/Model/Algorithm/AlgorithmAutoSetting.cs
+31
-0
VIZ.GimbalAI.Domain/Model/Gimbal/GimbalControlModel.cs
+16
-0
VIZ.GimbalAI.Domain/app.config
+5
-1
VIZ.GimbalAI.Module.Resource/Icons/left_right_32x32.png
+0
-0
VIZ.GimbalAI.Module.Resource/Style/ComboBox/ComboBox_AlgorithmScene.xaml
+1
-1
VIZ.GimbalAI.Module.Resource/VIZ.GimbalAI.Module.Resource.csproj
+4
-0
VIZ.GimbalAI.Module/ControlView/View/ControlView.xaml
+95
-4
VIZ.GimbalAI.Module/ControlView/ViewModel/ControlViewModel.cs
+121
-5
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
+10
-4
VIZ.GimbalAI.Module/MainView/View/MainView.xaml.cs
+5
-0
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
+10
-0
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitConfig.cs
+26
-22
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
+1
-1
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
+86
-0
VIZ.GimbalAI.Storage/Ini/Config/AlgorithmConfig.cs
+20
-1
VIZ.GimbalAI.Storage/Ini/Config/GimbalConfig.cs
+8
-6
VIZ.GimbalAI.Storage/VIZ.GimbalAI.Storage.csproj
+3
-0
VIZ.GimbalAI.Storage/packages.config
+1
-0
VIZ.GimbalAI.UdpTestTool/App.config
+5
-1
VIZ.GimbalAI.UnitTest/app.config
+5
-1
No files found.
VIZ.GimbalAI.Client/App.xaml.cs
View file @
6d894e9e
...
@@ -22,8 +22,8 @@ namespace VIZ.GimbalAI.Client
...
@@ -22,8 +22,8 @@ namespace VIZ.GimbalAI.Client
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
// 初始化 LiteDB
// 初始化 LiteDB
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
// 初始化
中心轴
// 初始化
配置
//AppSetup.AppendSetup(new AppSetup_InitCenterAxis
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitConfig
());
// 初始化 NDI
// 初始化 NDI
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
// 初始化 UDP
// 初始化 UDP
...
...
VIZ.GimbalAI.Client/config/config.ini
View file @
6d894e9e
...
@@ -17,8 +17,8 @@ CLIENT_CONSOLE_LOG_MAX_LINE=500
...
@@ -17,8 +17,8 @@ CLIENT_CONSOLE_LOG_MAX_LINE=500
; ============================================================
; ============================================================
[UDP]
[UDP]
;客户端UDP绑定IP
;客户端UDP绑定IP
CLIENT_BINDING_IP
=
192.168.0.124
;
CLIENT_BINDING_IP=192.168.0.124
;
CLIENT_BINDING_IP=127.0.0.1
CLIENT_BINDING_IP
=
127.0.0.1
;CLIENT_BINDING_IP=192.168.88.242
;CLIENT_BINDING_IP=192.168.88.242
;客户端UDP绑定端口
;客户端UDP绑定端口
CLIENT_BINDING_PORT
=
8000
CLIENT_BINDING_PORT
=
8000
...
@@ -50,6 +50,14 @@ ALGORITHM_SETUP_PATH=C:\Users\admin\Desktop\object_tracker\main.py
...
@@ -50,6 +50,14 @@ ALGORITHM_SETUP_PATH=C:\Users\admin\Desktop\object_tracker\main.py
;算法命令行窗口显示样式
;算法命令行窗口显示样式
;Normal | Hidden | Minimized | Maximized
;Normal | Hidden | Minimized | Maximized
ALGORITHM_CMD_WINDOW_STYLE
=
Minimized
ALGORITHM_CMD_WINDOW_STYLE
=
Minimized
;算法安全框宽度
;ALGORITHM_SAVE_WIDTH=1600
ALGORITHM_SAVE_WIDTH
=
400
;算法安全框高度
;ALGORITHM_SAVE_HEIGHT=900
ALGORITHM_SAVE_HEIGHT
=
300
;算法安全框颜色
ALGORITHM_SAVE_COLOR
=
#FF0000FF
; ============================================================
; ============================================================
; === Gimbal ===
; === Gimbal ===
; ============================================================
; ============================================================
...
...
VIZ.GimbalAI.Connection/UDP/Gimbal/Provider/GimbalCenterAxisProvider.cs
View file @
6d894e9e
...
@@ -5,6 +5,7 @@ using System.Text;
...
@@ -5,6 +5,7 @@ using System.Text;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Connection
;
using
VIZ.Framework.Connection
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Domain
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.GimbalAI.Storage
;
using
VIZ.GimbalAI.Storage
;
...
@@ -22,11 +23,6 @@ namespace VIZ.GimbalAI.Connection
...
@@ -22,11 +23,6 @@ namespace VIZ.GimbalAI.Connection
public
string
Signal
{
get
;
}
=
GimbalPackageSignal
.
center_axis
;
public
string
Signal
{
get
;
}
=
GimbalPackageSignal
.
center_axis
;
/// <summary>
/// <summary>
/// 云台中心轴移动速度
/// </summary>
private
static
readonly
double
GIMBAL_CENTER_AXIS_SPEED
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
double
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_SPEED
);
/// <summary>
/// 执行
/// 执行
/// </summary>
/// </summary>
/// <param name="packageInfo">包信息</param>
/// <param name="packageInfo">包信息</param>
...
@@ -42,11 +38,13 @@ namespace VIZ.GimbalAI.Connection
...
@@ -42,11 +38,13 @@ namespace VIZ.GimbalAI.Connection
if
(
package
.
h
!=
0
&&
(
Math
.
Abs
(
package
.
h
)
<
10000
))
if
(
package
.
h
!=
0
&&
(
Math
.
Abs
(
package
.
h
)
<
10000
))
{
{
x
+=
-
ApplicationDomainEx
.
GimbalControlModel
.
TargetKeepSymbolHelperX
.
GetSymbol
(
package
.
h
)
*
GIMBAL_CENTER_AXIS_SPEED
;
int
symbol
=
ApplicationDomainEx
.
GimbalControlModel
.
HorizontalRockerDirection
==
RockerDirection
.
Forward
?
-
1
:
1
;
x
+=
symbol
*
ApplicationDomainEx
.
GimbalControlModel
.
TargetKeepSymbolHelperX
.
GetSymbol
(
package
.
h
)
*
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
;
}
}
if
(
package
.
v
!=
0
&&
(
Math
.
Abs
(
package
.
v
)
<
10000
))
if
(
package
.
v
!=
0
&&
(
Math
.
Abs
(
package
.
v
)
<
10000
))
{
{
y
+=
-
ApplicationDomainEx
.
GimbalControlModel
.
TargetKeepSymbolHelperY
.
GetSymbol
(
package
.
v
)
*
GIMBAL_CENTER_AXIS_SPEED
;
int
symbol
=
ApplicationDomainEx
.
GimbalControlModel
.
VerticalRockerDirection
==
RockerDirection
.
Forward
?
-
1
:
1
;
y
+=
symbol
*
ApplicationDomainEx
.
GimbalControlModel
.
TargetKeepSymbolHelperY
.
GetSymbol
(
package
.
v
)
*
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
;
}
}
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
...
...
VIZ.GimbalAI.Connection/app.config
View file @
6d894e9e
...
@@ -4,7 +4,11 @@
...
@@ -4,7 +4,11 @@
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.4.1"
newVersion
=
"4.0.4.1"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Memory"
publicKeyToken
=
"cc7b13ffcd2ddd51"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.1.1"
newVersion
=
"4.0.1.1"
/>
</
dependentAssembly
>
</
dependentAssembly
>
</
assemblyBinding
>
</
assemblyBinding
>
</
runtime
>
</
runtime
>
...
...
VIZ.GimbalAI.Domain/Model/Algorithm/AlgorithmAutoSetting.cs
View file @
6d894e9e
...
@@ -4,6 +4,7 @@ using System.Linq;
...
@@ -4,6 +4,7 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Domain
;
namespace
VIZ.GimbalAI.Domain
namespace
VIZ.GimbalAI.Domain
{
{
...
@@ -21,6 +22,8 @@ namespace VIZ.GimbalAI.Domain
...
@@ -21,6 +22,8 @@ namespace VIZ.GimbalAI.Domain
this
.
Classes
=
new
List
<
AlgorithmClassModel
>();
this
.
Classes
=
new
List
<
AlgorithmClassModel
>();
this
.
Classes
.
Add
(
new
AlgorithmClassModel
{
IsChecked
=
true
,
Label
=
"person"
,
Value
=
0
});
this
.
Classes
.
Add
(
new
AlgorithmClassModel
{
IsChecked
=
true
,
Label
=
"person"
,
Value
=
0
});
this
.
Classes
.
Add
(
new
AlgorithmClassModel
{
IsChecked
=
true
,
Label
=
"bus"
,
Value
=
5
});
this
.
Classes
.
Add
(
new
AlgorithmClassModel
{
IsChecked
=
true
,
Label
=
"bus"
,
Value
=
5
});
}
}
#
region
Scene
--
场景
#
region
Scene
--
场景
...
@@ -64,5 +67,33 @@ namespace VIZ.GimbalAI.Domain
...
@@ -64,5 +67,33 @@ namespace VIZ.GimbalAI.Domain
}
}
#
endregion
#
endregion
#
region
SaveWidth
--
安全宽度
private
int
saveWidth
;
/// <summary>
/// 安全宽度
/// </summary>
public
int
SaveWidth
{
get
{
return
saveWidth
;
}
set
{
saveWidth
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SaveWidth
));
}
}
#
endregion
#
region
SaveHeight
--
安全高度
private
int
saveHeight
;
/// <summary>
/// 安全高度
/// </summary>
public
int
SaveHeight
{
get
{
return
saveHeight
;
}
set
{
saveHeight
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SaveHeight
));
}
}
#
endregion
}
}
}
}
VIZ.GimbalAI.Domain/Model/Gimbal/GimbalControlModel.cs
View file @
6d894e9e
...
@@ -4,6 +4,7 @@ using System.Linq;
...
@@ -4,6 +4,7 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Domain
;
namespace
VIZ.GimbalAI.Domain
namespace
VIZ.GimbalAI.Domain
{
{
...
@@ -43,6 +44,21 @@ namespace VIZ.GimbalAI.Domain
...
@@ -43,6 +44,21 @@ namespace VIZ.GimbalAI.Domain
public
KeepSymbolHelper
TargetKeepSymbolHelperY
{
get
;
private
set
;
}
=
new
KeepSymbolHelper
(
3
,
2
);
public
KeepSymbolHelper
TargetKeepSymbolHelperY
{
get
;
private
set
;
}
=
new
KeepSymbolHelper
(
3
,
2
);
/// <summary>
/// <summary>
/// 操作杆水平移动方向
/// </summary>
public
RockerDirection
HorizontalRockerDirection
{
get
;
set
;
}
=
RockerDirection
.
Forward
;
/// <summary>
/// 操作杆垂直移动方向
/// </summary>
public
RockerDirection
VerticalRockerDirection
{
get
;
set
;
}
=
RockerDirection
.
Forward
;
/// <summary>
/// 中心轴移动速度
/// </summary>
public
int
CenterAxisSpeed
{
get
;
set
;
}
=
3
;
/// <summary>
/// 更新中心轴
/// 更新中心轴
/// </summary>
/// </summary>
/// <returns>中心轴是否有变化</returns>
/// <returns>中心轴是否有变化</returns>
...
...
VIZ.GimbalAI.Domain/app.config
View file @
6d894e9e
...
@@ -4,7 +4,11 @@
...
@@ -4,7 +4,11 @@
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.4.1"
newVersion
=
"4.0.4.1"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Memory"
publicKeyToken
=
"cc7b13ffcd2ddd51"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.1.1"
newVersion
=
"4.0.1.1"
/>
</
dependentAssembly
>
</
dependentAssembly
>
</
assemblyBinding
>
</
assemblyBinding
>
</
runtime
>
</
runtime
>
...
...
VIZ.GimbalAI.Module.Resource/Icons/left_right_32x32.png
0 → 100644
View file @
6d894e9e
475 Bytes
VIZ.GimbalAI.Module.Resource/Style/ComboBox/ComboBox_AlgorithmScene.xaml
View file @
6d894e9e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left"></ContentPresenter>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left"></ContentPresenter>
<Image Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
<Image Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
Width="
20" Height="20
" Opacity="0.7"
Width="
14" Height="14
" Opacity="0.7"
Source="/VIZ.GimbalAI.Module.Resource;component/Icons/down_24x24.png"></Image>
Source="/VIZ.GimbalAI.Module.Resource;component/Icons/down_24x24.png"></Image>
</Grid>
</Grid>
</Border>
</Border>
...
...
VIZ.GimbalAI.Module.Resource/VIZ.GimbalAI.Module.Resource.csproj
View file @
6d894e9e
...
@@ -146,5 +146,8 @@
...
@@ -146,5 +146,8 @@
<Name>VIZ.GimbalAI.Common.Resource</Name>
<Name>VIZ.GimbalAI.Common.Resource</Name>
</ProjectReference>
</ProjectReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\left_right_32x32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
VIZ.GimbalAI.Module/ControlView/View/ControlView.xaml
View file @
6d894e9e
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:VIZ.GimbalAI.Module"
xmlns:local="clr-namespace:VIZ.GimbalAI.Module"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:converter="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:converter="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
d:DataContext="{d:DesignInstance Type=local:ControlViewModel}"
d:DataContext="{d:DesignInstance Type=local:ControlViewModel}"
mc:Ignorable="d" x:Name="uc"
mc:Ignorable="d" x:Name="uc"
d:DesignHeight="800" d:DesignWidth="300">
d:DesignHeight="800" d:DesignWidth="300">
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
<Grid>
<Grid>
<Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="300"></RowDefinition>
</Grid.RowDefinitions>
</Grid.RowDefinitions>
<Grid IsEnabled="{Binding Path=IsEnabled,Mode=OneWay}">
<Grid IsEnabled="{Binding Path=IsEnabled,Mode=OneWay}">
<Grid.RowDefinitions>
<Grid.RowDefinitions>
...
@@ -113,9 +115,98 @@
...
@@ -113,9 +115,98 @@
</Border>
</Border>
</Grid>
</Grid>
<!-- 控制台输出 -->
<!-- 参数设置 -->
<!--<Border Grid.Row="1">
<Grid Grid.Row="1">
<local:ConsoleView></local:ConsoleView>
<Grid.RowDefinitions>
</Border>-->
<RowDefinition Height="3*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 构图轴 -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderBrush="#ff33333b" BorderThickness="1" Background="#22ffffff" Grid.ColumnSpan="2">
<TextBlock Text="构图轴摇杆移动方向" Foreground="White" Opacity="0.7" FontSize="18"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"></TextBlock>
</Border>
<!-- 水平 -->
<Image Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Width="26" Height="26"
Source="/VIZ.GimbalAI.Module.Resource;component/Icons/left_right_32x32.png"></Image>
<ComboBox Grid.Row="1" Grid.Column="1" Height="30" VerticalAlignment="Center" Margin="0,0,10,0"
Style="{StaticResource ComboBox_AlgorithmScene}"
ItemsSource="{Binding Path=RockerDirectionItems}" Foreground="White" FontSize="18"
SelectedValue="{Binding Path=HorizontalRockerDirection,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Description}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- 垂直 -->
<Image Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" Width="26" Height="26"
Source="/VIZ.GimbalAI.Module.Resource;component/Icons/left_right_32x32.png" RenderTransformOrigin="0.5 0.5">
<Image.RenderTransform>
<RotateTransform Angle="90"></RotateTransform>
</Image.RenderTransform>
</Image>
<ComboBox Grid.Row="2" Grid.Column="1" Height="30" VerticalAlignment="Center" Margin="0,0,10,0"
Style="{StaticResource ComboBox_AlgorithmScene}"
ItemsSource="{Binding Path=RockerDirectionItems}" Foreground="White" FontSize="18"
SelectedValue="{Binding Path=VerticalRockerDirection,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Description}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- 速度 -->
<TextBlock Text="速度" Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="White" FontSize="16"></TextBlock>
<common:NumberBox Grid.Row="3" Grid.Column="1" IsShowUpAndDownButton="False" Height="30"
Foreground="White" FontSize="16" BorderBrush="#99FFFFFF"
MinValue="1" MaxValue="10" Margin="0,0,10,0"
Value="{Binding Path=CenterAxisSpeed,Mode=TwoWay}"></common:NumberBox>
</Grid>
<!-- 安全框 -->
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderBrush="#ff33333b" BorderThickness="1" Background="#22ffffff" Grid.ColumnSpan="2">
<TextBlock Text="安全框" Foreground="White" Opacity="0.7" FontSize="18"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"></TextBlock>
</Border>
<!-- 宽度 -->
<TextBlock Text="宽度" Grid.Row="1" FontSize="16" Foreground="White"
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<common:NumberBox Grid.Column="1" Grid.Row="1" IsShowUpAndDownButton="False" Foreground="White"
BorderBrush="#99FFFFFF" FontSize="16" MinValue="100" MaxValue="1920" Interval="1"
Height="30" Margin="0,0,10,0"
Value="{Binding Path=AlgorithmSaveWidth,Mode=TwoWay}"></common:NumberBox>
<!-- 高度 -->
<TextBlock Text="高度" Grid.Row="2" FontSize="16" Foreground="White"
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<common:NumberBox Grid.Column="1" Grid.Row="2" IsShowUpAndDownButton="False" Foreground="White"
BorderBrush="#99FFFFFF" FontSize="16" MinValue="100" MaxValue="1080" Interval="1"
Height="30" Margin="0,0,10,0"
Value="{Binding Path=AlgorithmSaveHeight,Mode=TwoWay}"></common:NumberBox>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>
</UserControl>
VIZ.GimbalAI.Module/ControlView/ViewModel/ControlViewModel.cs
View file @
6d894e9e
...
@@ -8,6 +8,8 @@ using VIZ.GimbalAI.Connection;
...
@@ -8,6 +8,8 @@ using VIZ.GimbalAI.Connection;
using
VIZ.GimbalAI.Domain.Message
;
using
VIZ.GimbalAI.Domain.Message
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.Framework.Connection
;
using
VIZ.Framework.Connection
;
using
VIZ.Framework.Domain
;
using
VIZ.GimbalAI.Storage
;
namespace
VIZ.GimbalAI.Module
namespace
VIZ.GimbalAI.Module
{
{
...
@@ -29,11 +31,6 @@ namespace VIZ.GimbalAI.Module
...
@@ -29,11 +31,6 @@ namespace VIZ.GimbalAI.Module
// 初始化消息
// 初始化消息
this
.
InitMessage
();
this
.
InitMessage
();
// TODO: 正式删除
// 切换自动模式
//this.ChangeAutoMode();
//this.IsEnabled = true;
}
}
/// <summary>
/// <summary>
...
@@ -52,6 +49,14 @@ namespace VIZ.GimbalAI.Module
...
@@ -52,6 +49,14 @@ namespace VIZ.GimbalAI.Module
this
.
AlgorithmSceneItems
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Scenes
;
this
.
AlgorithmSceneItems
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Scenes
;
this
.
AlgorithmScene
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Scene
;
this
.
AlgorithmScene
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Scene
;
this
.
AlgorithmClassItems
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Classes
;
this
.
AlgorithmClassItems
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
Classes
;
this
.
RockerDirectionItems
=
EnumHelper
.
GetEnumModels
<
RockerDirection
>();
this
.
horizontalRockerDirection
=
this
.
RockerDirectionItems
.
FirstOrDefault
(
p
=>
(
RockerDirection
)
p
.
Key
==
ApplicationDomainEx
.
GimbalControlModel
.
HorizontalRockerDirection
);
this
.
verticalRockerDirection
=
this
.
RockerDirectionItems
.
FirstOrDefault
(
p
=>
(
RockerDirection
)
p
.
Key
==
ApplicationDomainEx
.
GimbalControlModel
.
VerticalRockerDirection
);
this
.
CenterAxisSpeed
=
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
;
this
.
AlgorithmSaveWidth
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
;
this
.
algorithmSaveHeight
=
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
;
}
}
/// <summary>
/// <summary>
...
@@ -232,6 +237,117 @@ namespace VIZ.GimbalAI.Module
...
@@ -232,6 +237,117 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
VerticalRockerDirection
--
垂直摇杆方向
private
EnumModel
verticalRockerDirection
;
/// <summary>
/// 垂直摇杆方向
/// <see cref="RockerDirection"/>
/// </summary>
public
EnumModel
VerticalRockerDirection
{
get
{
return
verticalRockerDirection
;
}
set
{
verticalRockerDirection
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
VerticalRockerDirection
));
ApplicationDomainEx
.
GimbalControlModel
.
VerticalRockerDirection
=
(
RockerDirection
)
value
.
Key
;
}
}
#
endregion
#
region
HorizontalRockerDirection
--
水平摇杆方向
private
EnumModel
horizontalRockerDirection
;
/// <summary>
/// 水平摇杆方向
/// <see cref="RockerDirection"/>
/// </summary>
public
EnumModel
HorizontalRockerDirection
{
get
{
return
horizontalRockerDirection
;
}
set
{
horizontalRockerDirection
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
HorizontalRockerDirection
));
ApplicationDomainEx
.
GimbalControlModel
.
HorizontalRockerDirection
=
(
RockerDirection
)
value
.
Key
;
}
}
#
endregion
#
region
RockerDirectionItems
--
摇杆方向列表
private
List
<
EnumModel
>
rockerDirectionItems
;
/// <summary>
/// 摇杆方向列表
/// </summary>
public
List
<
EnumModel
>
RockerDirectionItems
{
get
{
return
rockerDirectionItems
;
}
set
{
rockerDirectionItems
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
RockerDirectionItems
));
}
}
#
endregion
#
region
CenterAxisSpeed
--
中心轴移动速度
private
double
centerAxisSpeed
;
/// <summary>
/// 中心轴移动速度
/// </summary>
public
double
CenterAxisSpeed
{
get
{
return
centerAxisSpeed
;
}
set
{
centerAxisSpeed
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
CenterAxisSpeed
));
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
=
(
int
)
value
;
}
}
#
endregion
#
region
AlgorithmSaveWidth
--
算法安全框宽度
private
double
algorithmSaveWidth
;
/// <summary>
/// 算法安全框宽度
/// </summary>
public
double
AlgorithmSaveWidth
{
get
{
return
algorithmSaveWidth
;
}
set
{
algorithmSaveWidth
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AlgorithmSaveWidth
));
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
=
(
int
)
value
;
}
}
#
endregion
#
region
AlgorithmSaveHeight
--
算法安全框高度
private
double
algorithmSaveHeight
;
/// <summary>
/// 算法安全框高度
/// </summary>
public
double
AlgorithmSaveHeight
{
get
{
return
algorithmSaveHeight
;
}
set
{
algorithmSaveHeight
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AlgorithmSaveHeight
));
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
=
(
int
)
value
;
}
}
#
endregion
// ==============================================================================================
// ==============================================================================================
// === Command ===
// === Command ===
// ==============================================================================================
// ==============================================================================================
...
...
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
View file @
6d894e9e
...
@@ -41,15 +41,20 @@
...
@@ -41,15 +41,20 @@
<TextBlock Text="智能云台跟拍系统" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="36" Foreground="White" ></TextBlock>
<TextBlock Text="智能云台跟拍系统" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="36" Foreground="White" ></TextBlock>
<common:DebugBorder Margin="20,0,20,10">
<common:DebugBorder Margin="20,0,20,10">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="调试信息 --" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="算法FPS:" FontSize="20" Foreground="Red" Margin="0,0,10,0"
<TextBlock Text="算法FPS:" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Path=AlgorithmFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="{Binding Path=AlgorithmFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red"
<Button Width="120" Height="30" Margin="10,0,10,0" Content="重启算法"
Margin="0,0,10,0" VerticalAlignment="Center"></TextBlock>
<Button Width="80" Height="30" Margin="10,0,10,0" Content="重启算法" VerticalAlignment="Center"
IsEnabled="{Binding Path=IsRestartAlgorithmEnabled,Mode=OneWay}"
IsEnabled="{Binding Path=IsRestartAlgorithmEnabled,Mode=OneWay}"
Command="{Binding Path=RestartAlgorithmCommand,Mode=OneWay}"></Button>
Command="{Binding Path=RestartAlgorithmCommand,Mode=OneWay}"></Button>
</StackPanel>
</StackPanel>
</common:DebugBorder>
</common:DebugBorder>
</StackPanel>
</StackPanel>
<Border Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<common:ShowMessageControl Foreground="White" Background="#66FFFFFF"
MessageKey="{x:Static Member=module:MainView.MAIN_VIEW_TOP_MESSAGE_KEY}"></common:ShowMessageControl>
</Border>
<Border HorizontalAlignment="Right" VerticalAlignment="Center" Height="50" Width="240" Background="#22ffffff" Grid.Column="1" Margin="0,0,30,0">
<Border HorizontalAlignment="Right" VerticalAlignment="Center" Height="50" Width="240" Background="#22ffffff" Grid.Column="1" Margin="0,0,30,0">
<TextBlock Text="{Binding Path=StatusMessage,Mode=OneWay}"
<TextBlock Text="{Binding Path=StatusMessage,Mode=OneWay}"
Foreground="{Binding Path=StatusMessageBrush,Mode=OneWay}"
Foreground="{Binding Path=StatusMessageBrush,Mode=OneWay}"
...
@@ -71,5 +76,6 @@
...
@@ -71,5 +76,6 @@
<!-- 控制区域 -->
<!-- 控制区域 -->
<module:ControlView Grid.Row="1" Grid.Column="2"></module:ControlView>
<module:ControlView Grid.Row="1" Grid.Column="2"></module:ControlView>
<!-- 底栏 -->
<!-- 底栏 -->
</Grid>
</Grid>
</UserControl>
</UserControl>
VIZ.GimbalAI.Module/MainView/View/MainView.xaml.cs
View file @
6d894e9e
...
@@ -30,5 +30,10 @@ namespace VIZ.GimbalAI.Module
...
@@ -30,5 +30,10 @@ namespace VIZ.GimbalAI.Module
WPFHelper
.
BindingViewModel
(
this
,
new
MainViewModel
());
WPFHelper
.
BindingViewModel
(
this
,
new
MainViewModel
());
}
}
/// <summary>
/// 主视图头部消息键
/// </summary>
public
const
string
MAIN_VIEW_TOP_MESSAGE_KEY
=
"MAIN_VIEW_TOP_MESSAGE_KEY"
;
}
}
}
}
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
View file @
6d894e9e
...
@@ -320,6 +320,15 @@ namespace VIZ.GimbalAI.Module
...
@@ -320,6 +320,15 @@ namespace VIZ.GimbalAI.Module
/// </summary>
/// </summary>
private
void
RestartAlgorithm
()
private
void
RestartAlgorithm
()
{
{
ShowMessage
msg
=
new
ShowMessage
();
msg
.
MessageKey
=
MainView
.
MAIN_VIEW_TOP_MESSAGE_KEY
;
msg
.
Message
=
$"请在安全框范围内操作!"
;
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
return
;
// ===============================================
this
.
IsRestartAlgorithmEnabled
=
false
;
this
.
IsRestartAlgorithmEnabled
=
false
;
this
.
AlgorithmController
.
Restart
();
this
.
AlgorithmController
.
Restart
();
}
}
...
@@ -383,6 +392,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -383,6 +392,7 @@ namespace VIZ.GimbalAI.Module
}
}
#
endregion
#
endregion
// ======================================================================================
// ======================================================================================
// === Private Function ===
// === Private Function ===
// ======================================================================================
// ======================================================================================
...
...
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitC
enterAxis
.cs
→
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitC
onfig
.cs
View file @
6d894e9e
...
@@ -8,23 +8,24 @@ using VIZ.GimbalAI.Domain;
...
@@ -8,23 +8,24 @@ using VIZ.GimbalAI.Domain;
using
VIZ.GimbalAI.Connection
;
using
VIZ.GimbalAI.Connection
;
using
VIZ.GimbalAI.Storage
;
using
VIZ.GimbalAI.Storage
;
using
VIZ.Framework.Module
;
using
VIZ.Framework.Module
;
using
VIZ.Framework.Domain
;
namespace
VIZ.GimbalAI.Module
namespace
VIZ.GimbalAI.Module
{
{
/// <summary>
/// <summary>
/// 应用程序启动 -- 初始化
中心轴
/// 应用程序启动 -- 初始化
配置
/// </summary>
/// </summary>
public
class
AppSetup_InitC
enterAxis
:
AppSetupBase
public
class
AppSetup_InitC
onfig
:
AppSetupBase
{
{
/// <summary>
/// <summary>
/// 日志
/// 日志
/// </summary>
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitC
enterAxis
));
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitC
onfig
));
/// <summary>
/// <summary>
/// 描述
/// 描述
/// </summary>
/// </summary>
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化
中心轴
"
;
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化
配置
"
;
/// <summary>
/// <summary>
/// 执行启动
/// 执行启动
...
@@ -33,13 +34,17 @@ namespace VIZ.GimbalAI.Module
...
@@ -33,13 +34,17 @@ namespace VIZ.GimbalAI.Module
/// <returns>是否成功执行</returns>
/// <returns>是否成功执行</returns>
public
override
bool
Setup
(
AppSetupContext
context
)
public
override
bool
Setup
(
AppSetupContext
context
)
{
{
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
);
// 算法安全框
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
);
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
AlgorithmConfig
,
int
>(
p
=>
p
.
ALGORITHM_SAVE_WIDTH
);
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
AlgorithmConfig
,
int
>(
p
=>
p
.
ALGORITHM_SAVE_HEIGHT
);
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitCenterAxis.Setup"
,
30
,
()
=>
// 控制轴方向
{
ApplicationDomainEx
.
GimbalControlModel
.
HorizontalRockerDirection
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
string
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_HORIZONTAL_DIRECTION
)
==
RockerDirection
.
Forward
.
ToString
()
?
RockerDirection
.
Forward
:
RockerDirection
.
Backward
;
this
.
WriteCenterAxis
();
ApplicationDomainEx
.
GimbalControlModel
.
VerticalRockerDirection
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
string
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_VERTICAL_DIRECTION
)
==
RockerDirection
.
Forward
.
ToString
()
?
RockerDirection
.
Forward
:
RockerDirection
.
Backward
;
});
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_SPEED
);
// 注册参数保存循环
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitConfig.saveIniConfig"
,
60
,
this
.
saveIniConfig
);
return
true
;
return
true
;
}
}
...
@@ -50,23 +55,22 @@ namespace VIZ.GimbalAI.Module
...
@@ -50,23 +55,22 @@ namespace VIZ.GimbalAI.Module
/// <param name="context">应用程序启动上下文</param>
/// <param name="context">应用程序启动上下文</param>
public
override
void
Shutdown
(
AppSetupContext
context
)
public
override
void
Shutdown
(
AppSetupContext
context
)
{
{
this
.
WriteCenterAxis
();
this
.
saveIniConfig
();
}
}
/// <summary>
/// <summary>
///
写入中心轴值
///
保存Ini配置
/// </summary>
/// </summary>
private
void
WriteCenterAxis
()
private
void
saveIniConfig
()
{
{
try
// 算法安全框
{
ApplicationDomainEx
.
IniStorage
.
SetValue
<
AlgorithmConfig
>(
p
=>
p
.
ALGORITHM_SAVE_WIDTH
,
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
,
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
AlgorithmConfig
>(
p
=>
p
.
ALGORITHM_SAVE_HEIGHT
,
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
,
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
);
}
// 控制轴方向
catch
(
Exception
ex
)
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_HORIZONTAL_DIRECTION
,
ApplicationDomainEx
.
GimbalControlModel
.
HorizontalRockerDirection
);
{
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_VERTICAL_DIRECTION
,
ApplicationDomainEx
.
GimbalControlModel
.
VerticalRockerDirection
);
log
.
Error
(
ex
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_SPEED
,
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisSpeed
);
}
}
}
}
}
}
}
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
View file @
6d894e9e
...
@@ -215,7 +215,7 @@
...
@@ -215,7 +215,7 @@
</Compile>
</Compile>
<Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitC
enterAxis
.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitC
onfig
.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitNDI.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitNDI.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" />
...
...
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
View file @
6d894e9e
...
@@ -19,6 +19,7 @@ using OpenCvSharp.Extensions;
...
@@ -19,6 +19,7 @@ using OpenCvSharp.Extensions;
using
SharpDX.Mathematics.Interop
;
using
SharpDX.Mathematics.Interop
;
using
VIZ.Framework.Storage
;
using
VIZ.Framework.Storage
;
using
System.Windows.Interop
;
using
System.Windows.Interop
;
using
System.Web.UI.WebControls
;
namespace
VIZ.GimbalAI.Module
namespace
VIZ.GimbalAI.Module
{
{
...
@@ -46,6 +47,11 @@ namespace VIZ.GimbalAI.Module
...
@@ -46,6 +47,11 @@ namespace VIZ.GimbalAI.Module
}
}
/// <summary>
/// <summary>
/// 算法安全框颜色
/// </summary>
private
readonly
static
RawColor4
ALGORITHM_SAVE_COLOR
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
AlgorithmConfig
,
RawColor4
>(
p
=>
p
.
ALGORITHM_SAVE_COLOR
);
/// <summary>
/// 初始化NDI
/// 初始化NDI
/// </summary>
/// </summary>
private
void
InitNDI
()
private
void
InitNDI
()
...
@@ -82,11 +88,27 @@ namespace VIZ.GimbalAI.Module
...
@@ -82,11 +88,27 @@ namespace VIZ.GimbalAI.Module
this
.
centerAxisPlugin
=
new
CenterAxisPlugin
(
view
.
videoControl
);
this
.
centerAxisPlugin
=
new
CenterAxisPlugin
(
view
.
videoControl
);
view
.
videoControl
.
AttachPlugin
(
this
.
centerAxisPlugin
);
view
.
videoControl
.
AttachPlugin
(
this
.
centerAxisPlugin
);
// 裁切插件 -- 用于显示安全框
this
.
clipBoxPlugin
=
new
ClipBoxPlugin
(
view
.
videoControl
);
view
.
videoControl
.
AttachPlugin
(
this
.
clipBoxPlugin
);
// 更新中心轴
CenterAxisInfo
centerAxisInfo
=
new
CenterAxisInfo
();
CenterAxisInfo
centerAxisInfo
=
new
CenterAxisInfo
();
centerAxisInfo
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
centerAxisInfo
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
centerAxisInfo
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
centerAxisInfo
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
centerAxisInfo
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
);
centerAxisInfo
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
);
this
.
centerAxisPlugin
.
Update
(
centerAxisInfo
);
this
.
centerAxisPlugin
.
Update
(
centerAxisInfo
);
// 更新安全框
ClipBoxInfo
clipBoxInfo
=
new
ClipBoxInfo
();
float
left
=
(
1920
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
)
/
2f
;
float
top
=
(
1080
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
)
/
2f
;
float
right
=
left
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
;
float
bottom
=
top
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
;
clipBoxInfo
.
SrcRect
=
new
RawRectangleF
(
left
,
top
,
right
,
bottom
);
clipBoxInfo
.
DrawingBorderWidth
=
4
;
clipBoxInfo
.
DrawingBorderColor
=
ALGORITHM_SAVE_COLOR
;
this
.
clipBoxPlugin
.
Update
(
clipBoxInfo
);
}
}
/// <summary>
/// <summary>
...
@@ -138,6 +160,11 @@ namespace VIZ.GimbalAI.Module
...
@@ -138,6 +160,11 @@ namespace VIZ.GimbalAI.Module
private
CenterAxisPlugin
centerAxisPlugin
;
private
CenterAxisPlugin
centerAxisPlugin
;
/// <summary>
/// <summary>
/// 裁切框插件 -- 用于显示安全框
/// </summary>
private
ClipBoxPlugin
clipBoxPlugin
;
/// <summary>
/// 算法矩形框宽度(单位:像素)
/// 算法矩形框宽度(单位:像素)
/// </summary>
/// </summary>
private
readonly
int
VIDEO_TRACKING_BOX_BORDER_WIDTH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_TRACKING_BOX_BORDER_WIDTH
);
private
readonly
int
VIDEO_TRACKING_BOX_BORDER_WIDTH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_TRACKING_BOX_BORDER_WIDTH
);
...
@@ -421,6 +448,9 @@ namespace VIZ.GimbalAI.Module
...
@@ -421,6 +448,9 @@ namespace VIZ.GimbalAI.Module
// 更新视频
// 更新视频
view
.
videoControl
.
UpdateVideoFrame
(
e
.
Frame
);
view
.
videoControl
.
UpdateVideoFrame
(
e
.
Frame
);
// 更新安全框
this
.
UpdateSaveRect
(
view
);
// 更新中心轴
// 更新中心轴
this
.
UpdateCenterAxis
(
view
);
this
.
UpdateCenterAxis
(
view
);
}
}
...
@@ -448,6 +478,23 @@ namespace VIZ.GimbalAI.Module
...
@@ -448,6 +478,23 @@ namespace VIZ.GimbalAI.Module
}
}
/// <summary>
/// <summary>
/// 更新安全框
/// </summary>
/// <param name="view">视图</param>
private
void
UpdateSaveRect
(
VideoView
view
)
{
ClipBoxInfo
clipBoxInfo
=
new
ClipBoxInfo
();
float
left
=
(
1920
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
)
/
2f
;
float
top
=
(
1080
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
)
/
2f
;
float
right
=
left
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
;
float
bottom
=
top
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
;
clipBoxInfo
.
SrcRect
=
new
RawRectangleF
(
left
,
top
,
right
,
bottom
);
clipBoxInfo
.
DrawingBorderWidth
=
4
;
clipBoxInfo
.
DrawingBorderColor
=
ALGORITHM_SAVE_COLOR
;
view
.
videoControl
.
UpdateClipBox
(
clipBoxInfo
);
}
/// <summary>
/// 处理视频点击跟踪框事件
/// 处理视频点击跟踪框事件
/// </summary>
/// </summary>
private
void
TrackingBoxPlugin_TrackingBoxClick
(
object
sender
,
TrackingBoxClickEventArgs
e
)
private
void
TrackingBoxPlugin_TrackingBoxClick
(
object
sender
,
TrackingBoxClickEventArgs
e
)
...
@@ -455,6 +502,10 @@ namespace VIZ.GimbalAI.Module
...
@@ -455,6 +502,10 @@ namespace VIZ.GimbalAI.Module
if
(!
this
.
IsRectangleClickTrigger
||
e
.
HitTrackingBoxInfo
==
null
)
if
(!
this
.
IsRectangleClickTrigger
||
e
.
HitTrackingBoxInfo
==
null
)
return
;
return
;
// 在安全框范围外点击不生效
if
(!
this
.
checkIsInSaveRect
(
e
.
HitTrackingBoxInfo
.
SrcRect
))
return
;
// 向算法发送 UDP 消息
// 向算法发送 UDP 消息
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
if
(
manager
==
null
)
if
(
manager
==
null
)
...
@@ -487,6 +538,10 @@ namespace VIZ.GimbalAI.Module
...
@@ -487,6 +538,10 @@ namespace VIZ.GimbalAI.Module
if
(!
this
.
IsRectangleFrameSelectionTrigger
)
if
(!
this
.
IsRectangleFrameSelectionTrigger
)
return
;
return
;
// 在安全框范围外点击不生效
if
(!
this
.
checkIsInSaveRect
(
e
.
SrcRect
))
return
;
// 向算法发送 UDP 消息
// 向算法发送 UDP 消息
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
if
(
manager
==
null
)
if
(
manager
==
null
)
...
@@ -495,5 +550,36 @@ namespace VIZ.GimbalAI.Module
...
@@ -495,5 +550,36 @@ namespace VIZ.GimbalAI.Module
List
<
float
>
roi
=
new
List
<
float
>
{
e
.
SrcRect
.
Left
,
e
.
SrcRect
.
Top
,
e
.
SrcRect
.
Right
-
e
.
SrcRect
.
Left
,
e
.
SrcRect
.
Bottom
-
e
.
SrcRect
.
Top
};
List
<
float
>
roi
=
new
List
<
float
>
{
e
.
SrcRect
.
Left
,
e
.
SrcRect
.
Top
,
e
.
SrcRect
.
Right
-
e
.
SrcRect
.
Left
,
e
.
SrcRect
.
Bottom
-
e
.
SrcRect
.
Top
};
AlgorithmSender
.
ManualDetect
(
manager
,
roi
);
AlgorithmSender
.
ManualDetect
(
manager
,
roi
);
}
}
/// <summary>
/// 校验是否是在安全框范围内
/// </summary>
/// <param name="rect">矩形区域</param>
/// <returns>是否是在安全框范围内</returns>
private
bool
checkIsInSaveRect
(
RawRectangleF
rect
)
{
// 在安全框范围外点击不生效
float
center_x
=
rect
.
Left
+
(
rect
.
Right
-
rect
.
Left
)
/
2f
;
float
center_y
=
rect
.
Top
+
(
rect
.
Bottom
-
rect
.
Top
)
/
2f
;
float
left
=
(
1920
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
)
/
2f
;
float
top
=
(
1080
-
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
)
/
2f
;
float
right
=
left
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveWidth
;
float
bottom
=
top
+
ApplicationDomainEx
.
AlgorithmAutoSetting
.
SaveHeight
;
// 不处理在安全框以外的数据
if
(
center_x
<
left
||
center_x
>
right
||
center_y
<
top
||
center_y
>
bottom
)
{
ShowMessage
msg
=
new
ShowMessage
();
msg
.
MessageKey
=
MainView
.
MAIN_VIEW_TOP_MESSAGE_KEY
;
msg
.
Message
=
$"请在安全框范围内操作!"
;
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
return
false
;
}
return
true
;
}
}
}
}
}
VIZ.GimbalAI.Storage/Ini/Config/AlgorithmConfig.cs
View file @
6d894e9e
using
System
;
using
SharpDX.Mathematics.Interop
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -29,5 +30,23 @@ namespace VIZ.GimbalAI.Storage
...
@@ -29,5 +30,23 @@ namespace VIZ.GimbalAI.Storage
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"Minimized"
)]
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"Minimized"
)]
public
string
ALGORITHM_CMD_WINDOW_STYLE
{
get
;
set
;
}
public
string
ALGORITHM_CMD_WINDOW_STYLE
{
get
;
set
;
}
/// <summary>
/// 算法安全框宽度
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"1600"
,
Type
=
typeof
(
int
))]
public
string
ALGORITHM_SAVE_WIDTH
{
get
;
set
;
}
/// <summary>
/// 算法安全框高度
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"900"
,
Type
=
typeof
(
int
))]
public
string
ALGORITHM_SAVE_HEIGHT
{
get
;
set
;
}
/// <summary>
/// 算法安全框颜色
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"#FF0000FF"
,
Type
=
typeof
(
RawColor4
))]
public
string
ALGORITHM_SAVE_COLOR
{
get
;
set
;
}
}
}
}
}
VIZ.GimbalAI.Storage/Ini/Config/GimbalConfig.cs
View file @
6d894e9e
...
@@ -31,15 +31,17 @@ namespace VIZ.GimbalAI.Storage
...
@@ -31,15 +31,17 @@ namespace VIZ.GimbalAI.Storage
public
string
GIMBAL_CENTER_AXIS_SPEED
{
get
;
set
;
}
public
string
GIMBAL_CENTER_AXIS_SPEED
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 云台中心轴X位置
/// 云台中心轴水平移动方向 Forward | Backward
/// <see cref="VIZ.Framework.Domain.RockerDirection"/>
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"
960"
,
Type
=
typeof
(
int
))]
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"
Forward"
,
Type
=
typeof
(
string
))]
public
string
GIMBAL_CENTER_AXIS_
X
{
get
;
set
;
}
public
string
GIMBAL_CENTER_AXIS_
HORIZONTAL_DIRECTION
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 云台中心轴Y位置
/// 云台中心轴垂直移动方向 Forward | Backward
/// <see cref="VIZ.Framework.Domain.RockerDirection"/>
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"
540"
,
Type
=
typeof
(
int
))]
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"
Forward"
,
Type
=
typeof
(
string
))]
public
string
GIMBAL_CENTER_AXIS_
Y
{
get
;
set
;
}
public
string
GIMBAL_CENTER_AXIS_
VERTICAL_DIRECTION
{
get
;
set
;
}
}
}
}
}
VIZ.GimbalAI.Storage/VIZ.GimbalAI.Storage.csproj
View file @
6d894e9e
...
@@ -88,6 +88,9 @@
...
@@ -88,6 +88,9 @@
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.0.0\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.0.0\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
...
...
VIZ.GimbalAI.Storage/packages.config
View file @
6d894e9e
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<
package
id
=
"Microsoft.Bcl.HashCode"
version
=
"1.0.0"
targetFramework
=
"net48"
/>
<
package
id
=
"Microsoft.Bcl.HashCode"
version
=
"1.0.0"
targetFramework
=
"net48"
/>
<
package
id
=
"Microsoft.CSharp"
version
=
"4.3.0"
targetFramework
=
"net48"
/>
<
package
id
=
"Microsoft.CSharp"
version
=
"4.3.0"
targetFramework
=
"net48"
/>
<
package
id
=
"Portable.BouncyCastle"
version
=
"1.8.9"
targetFramework
=
"net48"
/>
<
package
id
=
"Portable.BouncyCastle"
version
=
"1.8.9"
targetFramework
=
"net48"
/>
<
package
id
=
"SharpDX"
version
=
"4.2.0"
targetFramework
=
"net48"
/>
<
package
id
=
"SharpZipLib"
version
=
"1.3.3"
targetFramework
=
"net48"
/>
<
package
id
=
"SharpZipLib"
version
=
"1.3.3"
targetFramework
=
"net48"
/>
<
package
id
=
"System.Buffers"
version
=
"4.4.0"
targetFramework
=
"net48"
/>
<
package
id
=
"System.Buffers"
version
=
"4.4.0"
targetFramework
=
"net48"
/>
<
package
id
=
"System.Memory"
version
=
"4.5.0"
targetFramework
=
"net48"
/>
<
package
id
=
"System.Memory"
version
=
"4.5.0"
targetFramework
=
"net48"
/>
...
...
VIZ.GimbalAI.UdpTestTool/App.config
View file @
6d894e9e
...
@@ -7,7 +7,11 @@
...
@@ -7,7 +7,11 @@
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.4.1"
newVersion
=
"4.0.4.1"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Memory"
publicKeyToken
=
"cc7b13ffcd2ddd51"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.1.1"
newVersion
=
"4.0.1.1"
/>
</
dependentAssembly
>
</
dependentAssembly
>
</
assemblyBinding
>
</
assemblyBinding
>
</
runtime
>
</
runtime
>
...
...
VIZ.GimbalAI.UnitTest/app.config
View file @
6d894e9e
...
@@ -4,7 +4,11 @@
...
@@ -4,7 +4,11 @@
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.4.1"
newVersion
=
"4.0.4.1"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Memory"
publicKeyToken
=
"cc7b13ffcd2ddd51"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.1.1"
newVersion
=
"4.0.1.1"
/>
</
dependentAssembly
>
</
dependentAssembly
>
</
assemblyBinding
>
</
assemblyBinding
>
</
runtime
>
</
runtime
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment