Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.Sample.ImageUploader.V4.5
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Kivii.Client.Sample.ImageUploader.V4.5
Commits
3ea03e07
Commit
3ea03e07
authored
May 11, 2024
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
d8359e4a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
18 deletions
+25
-18
VideoSourcePlayer.Designer.cs
Src/Controls/VideoSourcePlayer.Designer.cs
+7
-6
VideoSourcePlayer.cs
Src/Controls/VideoSourcePlayer.cs
+3
-3
FrmMain.cs
Src/FrmMain.cs
+15
-9
No files found.
Src/Controls/VideoSourcePlayer.Designer.cs
View file @
3ea03e07
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
partial
class
VideoSourcePlayer
partial
class
VideoSourcePlayer
{
{
/// <summary>
/// <summary>
///
必需的设计器变量。
///
Required designer variable.
/// </summary>
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// <summary>
///
清理所有正在使用的资源。
///
Clean up any resources being used.
/// </summary>
/// </summary>
/// <param name="disposing">
如果应释放托管资源,为 true;否则为 false。
</param>
/// <param name="disposing">
true if managed resources should be disposed; otherwise, false.
</param>
protected
override
void
Dispose
(
bool
disposing
)
protected
override
void
Dispose
(
bool
disposing
)
{
{
if
(
disposing
&&
(
components
!=
null
))
if
(
disposing
&&
(
components
!=
null
))
...
@@ -20,11 +20,11 @@
...
@@ -20,11 +20,11 @@
base
.
Dispose
(
disposing
);
base
.
Dispose
(
disposing
);
}
}
#
region
组件设计器生成的代码
#
region
Component
Designer
generated
code
/// <summary>
/// <summary>
///
设计器支持所需的方法 - 不要修改
///
Required method for Designer support - do not modify
///
使用代码编辑器修改此方法的内容。
///
the contents of this method with the code editor.
/// </summary>
/// </summary>
private
void
InitializeComponent
()
private
void
InitializeComponent
()
{
{
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
this
.
Paint
+=
new
System
.
Windows
.
Forms
.
PaintEventHandler
(
this
.
VideoSourcePlayer_Paint
);
this
.
Paint
+=
new
System
.
Windows
.
Forms
.
PaintEventHandler
(
this
.
VideoSourcePlayer_Paint
);
this
.
ParentChanged
+=
new
System
.
EventHandler
(
this
.
VideoSourcePlayer_ParentChanged
);
this
.
ParentChanged
+=
new
System
.
EventHandler
(
this
.
VideoSourcePlayer_ParentChanged
);
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
}
#
endregion
#
endregion
...
...
Src/Controls/VideoSourcePlayer.cs
View file @
3ea03e07
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Data
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
Kivii.Sample.ImageUploader.Controls
namespace
Kivii.Sample.ImageUploader.Controls
{
{
using
Imaging.Filters
;
using
Imaging.Filters
;
using
Kivii.Imaging
;
using
Kivii.Imaging
;
using
Math.Geometry
;
using
Math.Geometry
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.Drawing.Imaging
;
using
System.Windows.Forms
;
using
Video
;
using
Video
;
using
Point
=
System
.
Drawing
.
Point
;
using
Point
=
System
.
Drawing
.
Point
;
...
...
Src/FrmMain.cs
View file @
3ea03e07
...
@@ -185,8 +185,9 @@ namespace Kivii.Sample.ImageUploader
...
@@ -185,8 +185,9 @@ namespace Kivii.Sample.ImageUploader
{
{
// add all devices to combo
// add all devices to combo
cameraQuantity
=
videoDevices
.
Count
;
cameraQuantity
=
videoDevices
.
Count
;
videoDevice
=
new
VideoCaptureDevice
(
videoDevices
[
currentCameraIndex
].
MonikerString
);
gbCamView
.
Text
=
videoDevices
[
currentCameraIndex
].
Name
;
gbCamView
.
Text
=
videoDevices
[
currentCameraIndex
].
Name
;
videoDevice
=
new
VideoCaptureDevice
(
videoDevices
[
currentCameraIndex
].
MonikerString
);
enumeratedSupportedFrameSizes
(
videoDevice
);
enumeratedSupportedFrameSizes
(
videoDevice
);
}
}
else
else
...
@@ -231,17 +232,21 @@ namespace Kivii.Sample.ImageUploader
...
@@ -231,17 +232,21 @@ namespace Kivii.Sample.ImageUploader
cbxResolution
.
Items
.
Clear
();
cbxResolution
.
Items
.
Clear
();
try
try
{
{
// 获取摄像头支持的分辨率列表
//videoCapabilities = videoDevice.VideoCapabilities;
videoCapabilities
=
videoDevice
.
VideoCapabilities
;
List
<
VideoCapabilities
>
tmpVideoCapalilities
=
new
List
<
VideoCapabilities
>();
// 遍历分辨率列表,并添加到下拉框中
// 遍历分辨率列表,并添加到下拉框中
foreach
(
VideoCapabilities
capabil
ity
in
v
ideoCapabilities
)
foreach
(
VideoCapabilities
capabil
ty
in
videoDevice
.
V
ideoCapabilities
)
{
{
cbxResolution
.
Items
.
Add
(
string
.
Format
(
"{0} x {1}"
,
//if (capabilty.FrameSize.Width > 1024) continue;
capability
.
FrameSize
.
Width
,
capability
.
FrameSize
.
Height
));
tmpVideoCapalilities
.
Add
(
capabilty
);
cbxResolution
.
Items
.
Add
(
string
.
Format
(
"{0} x {1}"
,
capabilty
.
FrameSize
.
Width
,
capabilty
.
FrameSize
.
Height
));
}
}
// 获取摄像头支持的分辨率列表
videoCapabilities
=
tmpVideoCapalilities
.
ToArray
();
// 如果没有支持的分辨率,则添加 "Not supported"
// 如果没有支持的分辨率,则添加 "Not supported"
if
(
cbxResolution
.
Items
.
Count
==
0
)
if
(
videoCapabilities
.
Length
==
0
)
{
{
cbxResolution
.
Items
.
Add
(
"Not supported"
);
cbxResolution
.
Items
.
Add
(
"Not supported"
);
}
}
...
@@ -263,13 +268,13 @@ namespace Kivii.Sample.ImageUploader
...
@@ -263,13 +268,13 @@ namespace Kivii.Sample.ImageUploader
else
else
{
{
if
(
videoDevice
==
null
)
return
;
if
(
videoDevice
==
null
)
return
;
tbxReportId
.
Focus
();
if
((
videoCapabilities
!=
null
)
&&
(
videoCapabilities
.
Length
!=
0
))
if
((
videoCapabilities
!=
null
)
&&
(
videoCapabilities
.
Length
!=
0
))
{
{
videoDevice
.
VideoResolution
=
videoCapabilities
[
selectedIndex
];
videoDevice
.
VideoResolution
=
videoCapabilities
[
selectedIndex
];
}
}
vspCamView
.
VideoSource
=
videoDevice
;
vspCamView
.
VideoSource
=
videoDevice
;
vspCamView
.
Start
();
vspCamView
.
Start
();
tbxReportId
.
Focus
();
}
}
}
}
...
@@ -485,12 +490,12 @@ namespace Kivii.Sample.ImageUploader
...
@@ -485,12 +490,12 @@ namespace Kivii.Sample.ImageUploader
{
{
initFormCtlEnable
(
false
);
initFormCtlEnable
(
false
);
setDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
);
setDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
);
Thread
.
Sleep
(
100
);
if
(
videoDevice
==
null
)
initCameras
();
if
(
videoDevice
==
null
)
initCameras
();
if
(
videoDevice
==
null
)
if
(
videoDevice
==
null
)
{
{
return
;
return
;
}
}
Thread
.
Sleep
(
100
);
// 默认选择第一个分辨率
// 默认选择第一个分辨率
cbxResolution
.
SelectedIndex
=
0
;
cbxResolution
.
SelectedIndex
=
0
;
},
true
);
},
true
);
...
@@ -533,6 +538,7 @@ namespace Kivii.Sample.ImageUploader
...
@@ -533,6 +538,7 @@ namespace Kivii.Sample.ImageUploader
private
void
cbxResolution_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
private
void
cbxResolution_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
{
disconnect
();
disconnect
();
Thread
.
Sleep
(
100
);
if
(
cbxResolution
.
SelectedIndex
>=
0
)
connect
(
cbxResolution
.
SelectedIndex
);
if
(
cbxResolution
.
SelectedIndex
>=
0
)
connect
(
cbxResolution
.
SelectedIndex
);
}
}
...
...
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