Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ReelCounter
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2671fba1
由
SK
编写于
2019-04-02 16:44:34 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
查找内接圆
1 个父辈
fcc459f9
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
279 行增加
和
114 行删除
AccImage/ImageUtil.cs
Demo/MainForm.cs
Demo/MainForm.designer.cs
AccImage/ImageUtil.cs
查看文件 @
2671fba
...
@@ -3,6 +3,7 @@ using OpenCvSharp.Blob;
...
@@ -3,6 +3,7 @@ using OpenCvSharp.Blob;
using
OpenCvSharp.Extensions
;
using
OpenCvSharp.Extensions
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.Drawing.Imaging
;
using
System.Linq
;
using
System.Linq
;
...
@@ -528,68 +529,68 @@ namespace Acc.Img
...
@@ -528,68 +529,68 @@ namespace Acc.Img
// //全局二值化
// //全局二值化
// Cv2.Threshold(dst, dst, 0, 255, ThresholdTypes.Binary);
// Cv2.Threshold(dst, dst, 0, 255, ThresholdTypes.Binary);
//}
//}
if
(
selectB
)
//if (selectB)
{
if
(
thresh
==
-
1
)
{
//自动局部二值化
Binarizer
.
Sauvola
(
dst
,
dst
,
21
,
0.2
,
32
);
}
else
{
//全局二值化
if
(
pngB
)
{
Cv2
.
Threshold
(
dst
,
dst
,
70
,
255
,
ThresholdTypes
.
Binary
);
}
else
{
Cv2
.
Threshold
(
dst
,
dst
,
0
,
255
,
ThresholdTypes
.
Binary
);
}
}
if
(
inv
)
{
if
(
pngB
)
{
Cv2
.
Threshold
(
dst
,
dst
,
70
,
150
,
ThresholdTypes
.
BinaryInv
);
}
else
{
Cv2
.
Threshold
(
dst
,
dst
,
0
,
150
,
ThresholdTypes
.
BinaryInv
);
}
}
}
else
{
if
(
pngB
)
{
Cv2
.
Threshold
(
dst
,
dst
,
70
,
255
,
ThresholdTypes
.
Binary
);
Cv2
.
Threshold
(
dst
,
dst
,
0
,
150
,
ThresholdTypes
.
BinaryInv
);
}
else
{
Cv2
.
Threshold
(
dst
,
dst
,
0
,
255
,
ThresholdTypes
.
Binary
);
Cv2
.
Threshold
(
dst
,
dst
,
0
,
150
,
ThresholdTypes
.
BinaryInv
);
}
}
//if (thresh == -1)
//{
//{
// //自动局部二值化
// if (thresh == -1)
// Binarizer.Sauvola(dst, dst, 21, 0.2, 32);
// {
// //自动局部二值化
// Binarizer.Sauvola(dst, dst, 21, 0.2, 32);
// }
// else
// {
// //全局二值化
// if (pngB)
// {
// Cv2.Threshold(dst, dst, 70, 255, ThresholdTypes.Binary);
// }
// else
// {
// Cv2.Threshold(dst, dst, 0, 255, ThresholdTypes.Binary);
// }
// }
// if (inv)
// {
// if (pngB)
// {
// Cv2.Threshold(dst, dst, 70, 150, ThresholdTypes.BinaryInv);
// }
// else
// {
// Cv2.Threshold(dst, dst, 0, 150, ThresholdTypes.BinaryInv);
// }
// }
//}
//}
//else
//else
//{
//{
// //全局二值化
// if (pngB)
// Cv2.Threshold(dst, dst, 0, 255, ThresholdTypes.Binary);
// {
//}
// Cv2.Threshold(dst, dst, 70, 255, ThresholdTypes.Binary);
//if (inv)
// Cv2.Threshold(dst, dst, 0, 150, ThresholdTypes.BinaryInv);
//{
// }
// Cv2.Threshold(dst, dst, 0, thresh, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
// else
// {
// Cv2.Threshold(dst, dst, 0, 255, ThresholdTypes.Binary);
// Cv2.Threshold(dst, dst, 0, 150, ThresholdTypes.BinaryInv);
// }
//}
//}
if
(
thresh
==
-
1
)
{
//自动局部二值化
Binarizer
.
Sauvola
(
dst
,
dst
,
21
,
0.2
,
32
);
}
else
{
//全局二值化
Cv2
.
Threshold
(
dst
,
dst
,
0
,
255
,
ThresholdTypes
.
Otsu
);
}
if
(
inv
)
{
Cv2
.
Threshold
(
dst
,
dst
,
0
,
thresh
,
ThresholdTypes
.
BinaryInv
|
ThresholdTypes
.
Otsu
);
}
return
dst
;
return
dst
;
}
}
...
@@ -749,5 +750,189 @@ namespace Acc.Img
...
@@ -749,5 +750,189 @@ namespace Acc.Img
bmp
.
UnlockBits
(
bmpData
);
bmp
.
UnlockBits
(
bmpData
);
return
bmp
;
return
bmp
;
}
}
private
static
List
<
OpenCvSharp
.
Point
>
findContourPoints
(
CvBlob
blob
)
{
CvContourChainCode
contour
=
blob
.
Contour
;
List
<
OpenCvSharp
.
Point
>
contourPoints
=
new
List
<
OpenCvSharp
.
Point
>();
contourPoints
.
Add
(
contour
.
StartingPoint
);
int
x
=
contour
.
StartingPoint
.
X
;
int
y
=
contour
.
StartingPoint
.
Y
;
foreach
(
CvChainCode
cc
in
contour
.
ChainCode
)
{
x
+=
CvBlobConst
.
ChainCodeMoves
[(
int
)
cc
][
0
];
y
+=
CvBlobConst
.
ChainCodeMoves
[(
int
)
cc
][
1
];
contourPoints
.
Add
(
new
OpenCvSharp
.
Point
(
x
,
y
));
}
return
contourPoints
;
}
private
static
CvBlob
findMarkBlob
(
List
<
CvBlob
>
blobList
,
int
markX
=
-
1
,
int
markY
=
-
1
,
int
thresh
=
-
1
,
bool
inv
=
true
)
{
int
blobCount
=
blobList
.
Count
;
int
selectIndex
=
blobCount
/
2
;
if
(
markX
!=
-
1
&&
markY
!=
-
1
)
{
//查找标记的Blob
int
markIndex
=
-
1
;
for
(
int
i
=
0
;
i
<
blobCount
;
i
++)
{
CvBlob
blob
=
blobList
[
i
];
if
(
blob
.
Rect
.
Contains
(
new
OpenCvSharp
.
Point
(
markX
,
markY
)))
{
if
(
markIndex
==
-
1
||
blobList
[
i
].
Area
<
blobList
[
markIndex
].
Area
)
{
markIndex
=
i
;
}
}
}
if
(
markIndex
!=
-
1
)
{
CvBlob
markBlob
=
blobList
[
markIndex
];
return
markBlob
;
}
}
return
null
;
}
public
static
Image
Mark
(
Image
image
,
int
markX
=
-
1
,
int
markY
=
-
1
,
int
thresh
=
-
1
,
bool
inv
=
true
)
{
Mat
imageMat
=
BitmapConverter
.
ToMat
(
new
Bitmap
(
image
));
List
<
CvBlob
>
blobList
=
GetBlobs
(
imageMat
,
thresh
,
inv
);
//TODO:查找标记Blob,这里可遍历blobList,对BlobHasItem结果为1的blob进行标记,查找最小的内接半径
CvBlob
markBlob
=
findMarkBlob
(
blobList
,
markX
,
markY
,
thresh
,
inv
);
if
(
markBlob
!=
null
)
{
OpenCvSharp
.
Point
center
=
new
OpenCvSharp
.
Point
()
;
double
r
=
0
;
findCircle
(
markBlob
,
out
center
,
out
r
);
Cv2
.
Circle
(
imageMat
,
center
,
(
int
)
r
,
Scalar
.
Red
);
Console
.
WriteLine
(
""
+
r
);
int
markArea
=
markBlob
.
Area
;
int
totalCount
=
0
;
foreach
(
CvBlob
blob
in
blobList
)
{
int
count
=
BlobHasItem
(
markArea
,
blob
);
totalCount
=
totalCount
+
count
;
if
(
count
==
1
)
{
//单个Blob
blob
.
Contour
.
Render
(
imageMat
,
Scalar
.
Green
);
}
else
if
(
count
>
0
&&
count
<
100
)
{
//查找对大一点的Blob的内接圆数量,进行标记
Stopwatch
sw
=
new
Stopwatch
();
sw
.
Start
();
List
<
OpenCvSharp
.
Point
>
centers
=
markBlobInImage
(
blob
,
r
);
foreach
(
OpenCvSharp
.
Point
c
in
centers
)
{
Cv2
.
Circle
(
imageMat
,
c
,
(
int
)
r
,
Scalar
.
Red
);
}
sw
.
Stop
();
Console
.
WriteLine
(
"耗时:"
+
sw
.
ElapsedMilliseconds
+
" ms 数量:"
+
centers
.
Count
);
}
}
}
return
BitmapConverter
.
ToBitmap
(
imageMat
);
}
/// <summary>
/// 查找Blob包含多少个指定半径的圆
/// </summary>
/// <param name="blob"></param>
/// <param name="radius">指定半径</param>
/// <returns>找到的圆的中心点列表,一个中心点为一个圆</returns>
private
static
List
<
OpenCvSharp
.
Point
>
markBlobInImage
(
CvBlob
blob
,
double
radius
)
{
List
<
OpenCvSharp
.
Point
>
centers
=
new
List
<
OpenCvSharp
.
Point
>();
List
<
OpenCvSharp
.
Point
>
contourPoints
=
findContourPoints
(
blob
);
CvContourPolygon
polygon
=
blob
.
Contour
.
ConvertToPolygon
();
//从左向右,从上到下遍历
int
x
=
blob
.
MinX
;
while
(
x
<=
blob
.
MaxX
)
{
int
y
=
blob
.
MinY
;
while
(
y
<=
blob
.
MaxY
)
{
//当前的遍历的点
OpenCvSharp
.
Point
currentPoint
=
new
OpenCvSharp
.
Point
(
x
,
y
);
double
distance
=
Cv2
.
PointPolygonTest
(
contourPoints
,
currentPoint
,
true
);
//TODO: 内轮廓也需要判断
if
(
distance
>=
radius
)
{
//当前点到轮廓的最小距离大于半径时,判断是否与其他圆相交,如果相交,忽略这个点
bool
valid
=
true
;
foreach
(
OpenCvSharp
.
Point
c
in
centers
)
{
double
dis
=
currentPoint
.
DistanceTo
(
c
);
if
(
dis
<
2
*
radius
)
{
valid
=
false
;
break
;
}
}
if
(
valid
)
{
//找到一个,从当前点向下偏移一个半径的距离
y
=
(
int
)(
y
+
radius
);
Console
.
WriteLine
(
""
+
x
+
", "
+
y
+
" dis="
+
distance
+
" "
);
centers
.
Add
(
currentPoint
);
}
else
{
//与其他圆相交,忽略,继续下一个点
y
++;
}
}
else
{
//当前点到轮廓的最小距离小于半径,继续下一个点
y
++;
}
}
x
++;
}
return
centers
;
}
/// <summary>
/// 查找Blob最大的内接圆
/// </summary>
/// <param name="blob"></param>
/// <param name="centerPoint"></param>
/// <param name="r"></param>
private
static
void
findCircle
(
CvBlob
blob
,
out
OpenCvSharp
.
Point
centerPoint
,
out
double
r
)
{
//TODO: 需要进行修改,找多个,这里只找了一个
List
<
OpenCvSharp
.
Point
>
contourPoints
=
findContourPoints
(
blob
);
OpenCvSharp
.
Point
center
=
new
OpenCvSharp
.
Point
(-
1
,-
1
);
double
ridus
=
0
;
for
(
int
x
=
blob
.
MinX
;
x
<
blob
.
MaxX
;
x
++)
{
for
(
int
y
=
blob
.
MinY
;
y
<
blob
.
MaxY
;
y
++)
{
OpenCvSharp
.
Point
currentPoint
=
new
OpenCvSharp
.
Point
(
x
,
y
);
double
minDistance
=
-
1
;
foreach
(
OpenCvSharp
.
Point
p
in
contourPoints
)
{
double
distance
=
currentPoint
.
DistanceTo
(
p
);
if
(
distance
<
minDistance
||
minDistance
==
-
1
)
{
minDistance
=
distance
;
}
}
if
(
minDistance
>
ridus
)
{
ridus
=
minDistance
;
center
=
currentPoint
;
}
}
}
centerPoint
=
center
;
r
=
ridus
;
}
}
}
}
}
Demo/MainForm.cs
查看文件 @
2671fba
...
@@ -69,7 +69,7 @@ namespace Acc.Demo
...
@@ -69,7 +69,7 @@ namespace Acc.Demo
{
{
theshValue
=
int
.
Parse
(
textBoxThesh
.
Text
);
theshValue
=
int
.
Parse
(
textBoxThesh
.
Text
);
}
}
Image
result
=
ImageUtil
.
Threshhold
(
orginalImage
,
theshValue
);
Image
result
=
ImageUtil
.
Threshhold
(
orginalImage
,
theshValue
,
false
);
imageBox
.
Image
=
result
;
imageBox
.
Image
=
result
;
}
}
...
@@ -158,9 +158,8 @@ namespace Acc.Demo
...
@@ -158,9 +158,8 @@ namespace Acc.Demo
theshValue
=
int
.
Parse
(
textBoxThesh
.
Text
);
theshValue
=
int
.
Parse
(
textBoxThesh
.
Text
);
}
}
ImageUtil
.
selectB
=
true
;
ImageUtil
.
selectB
=
true
;
int
feature
=
ImageUtil
.
GetItemFeature
(
orginalImage
,
markX
,
markY
,
theshValue
);
Image
image
=
ImageUtil
.
Mark
(
orginalImage
,
markX
,
markY
,
theshValue
);
labelFeature
.
Text
=
"特征值:"
+
feature
+
""
;
imageBox
.
Image
=
image
;
textBoxFeature
.
Text
=
feature
+
""
;
}
}
private
void
保存当前图片
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
private
void
保存当前图片
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
...
...
Demo/MainForm.designer.cs
查看文件 @
2671fba
...
@@ -63,49 +63,48 @@
...
@@ -63,49 +63,48 @@
this
.
计数
ToolStripMenuItem
,
this
.
计数
ToolStripMenuItem
,
this
.
保存当前图片
ToolStripMenuItem
});
this
.
保存当前图片
ToolStripMenuItem
});
this
.
contextMenuStrip
.
Name
=
"contextMenuStrip"
;
this
.
contextMenuStrip
.
Name
=
"contextMenuStrip"
;
this
.
contextMenuStrip
.
Size
=
new
System
.
Drawing
.
Size
(
1
69
,
124
);
this
.
contextMenuStrip
.
Size
=
new
System
.
Drawing
.
Size
(
1
81
,
136
);
//
//
// 打开图片ToolStripMenuItem
// 打开图片ToolStripMenuItem
//
//
this
.
打开图片
ToolStripMenuItem
.
Name
=
"打开图片ToolStripMenuItem"
;
this
.
打开图片
ToolStripMenuItem
.
Name
=
"打开图片ToolStripMenuItem"
;
this
.
打开图片
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
68
,
24
);
this
.
打开图片
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
48
,
22
);
this
.
打开图片
ToolStripMenuItem
.
Text
=
"打开图片"
;
this
.
打开图片
ToolStripMenuItem
.
Text
=
"打开图片"
;
this
.
打开图片
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
打开图片
ToolStripMenuItem_Click
);
this
.
打开图片
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
打开图片
ToolStripMenuItem_Click
);
//
//
// 原图ToolStripMenuItem
// 原图ToolStripMenuItem
//
//
this
.
原图
ToolStripMenuItem
.
Name
=
"原图ToolStripMenuItem"
;
this
.
原图
ToolStripMenuItem
.
Name
=
"原图ToolStripMenuItem"
;
this
.
原图
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
68
,
24
);
this
.
原图
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
48
,
22
);
this
.
原图
ToolStripMenuItem
.
Text
=
"重新加载"
;
this
.
原图
ToolStripMenuItem
.
Text
=
"重新加载"
;
this
.
原图
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
原图
ToolStripMenuItem_Click
);
this
.
原图
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
原图
ToolStripMenuItem_Click
);
//
//
// 元件特征ToolStripMenuItem
// 元件特征ToolStripMenuItem
//
//
this
.
元件特征
ToolStripMenuItem
.
Name
=
"元件特征ToolStripMenuItem"
;
this
.
元件特征
ToolStripMenuItem
.
Name
=
"元件特征ToolStripMenuItem"
;
this
.
元件特征
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
68
,
24
);
this
.
元件特征
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
22
);
this
.
元件特征
ToolStripMenuItem
.
Text
=
"
获取元件特征
"
;
this
.
元件特征
ToolStripMenuItem
.
Text
=
"
标记记数
"
;
this
.
元件特征
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
元件特征
ToolStripMenuItem_Click
);
this
.
元件特征
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
元件特征
ToolStripMenuItem_Click
);
//
//
// 计数ToolStripMenuItem
// 计数ToolStripMenuItem
//
//
this
.
计数
ToolStripMenuItem
.
Name
=
"计数ToolStripMenuItem"
;
this
.
计数
ToolStripMenuItem
.
Name
=
"计数ToolStripMenuItem"
;
this
.
计数
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
68
,
24
);
this
.
计数
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
48
,
22
);
this
.
计数
ToolStripMenuItem
.
Text
=
"计数"
;
this
.
计数
ToolStripMenuItem
.
Text
=
"计数"
;
this
.
计数
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
计数
ToolStripMenuItem_Click
);
this
.
计数
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
计数
ToolStripMenuItem_Click
);
//
//
// 保存当前图片ToolStripMenuItem
// 保存当前图片ToolStripMenuItem
//
//
this
.
保存当前图片
ToolStripMenuItem
.
Name
=
"保存当前图片ToolStripMenuItem"
;
this
.
保存当前图片
ToolStripMenuItem
.
Name
=
"保存当前图片ToolStripMenuItem"
;
this
.
保存当前图片
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
68
,
24
);
this
.
保存当前图片
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
48
,
22
);
this
.
保存当前图片
ToolStripMenuItem
.
Text
=
"保存当前图片"
;
this
.
保存当前图片
ToolStripMenuItem
.
Text
=
"保存当前图片"
;
this
.
保存当前图片
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
保存当前图片
ToolStripMenuItem_Click
);
this
.
保存当前图片
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
保存当前图片
ToolStripMenuItem_Click
);
//
//
// buttonOpen
// buttonOpen
//
//
this
.
buttonOpen
.
Location
=
new
System
.
Drawing
.
Point
(
17
,
11
);
this
.
buttonOpen
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
9
);
this
.
buttonOpen
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
buttonOpen
.
Name
=
"buttonOpen"
;
this
.
buttonOpen
.
Name
=
"buttonOpen"
;
this
.
buttonOpen
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
29
);
this
.
buttonOpen
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
buttonOpen
.
TabIndex
=
1
;
this
.
buttonOpen
.
TabIndex
=
1
;
this
.
buttonOpen
.
Text
=
"打开"
;
this
.
buttonOpen
.
Text
=
"打开"
;
this
.
buttonOpen
.
UseVisualStyleBackColor
=
true
;
this
.
buttonOpen
.
UseVisualStyleBackColor
=
true
;
...
@@ -113,10 +112,9 @@
...
@@ -113,10 +112,9 @@
//
//
// buttonCount
// buttonCount
//
//
this
.
buttonCount
.
Location
=
new
System
.
Drawing
.
Point
(
140
,
11
);
this
.
buttonCount
.
Location
=
new
System
.
Drawing
.
Point
(
105
,
9
);
this
.
buttonCount
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
buttonCount
.
Name
=
"buttonCount"
;
this
.
buttonCount
.
Name
=
"buttonCount"
;
this
.
buttonCount
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
29
);
this
.
buttonCount
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
buttonCount
.
TabIndex
=
2
;
this
.
buttonCount
.
TabIndex
=
2
;
this
.
buttonCount
.
Text
=
"计数"
;
this
.
buttonCount
.
Text
=
"计数"
;
this
.
buttonCount
.
UseVisualStyleBackColor
=
true
;
this
.
buttonCount
.
UseVisualStyleBackColor
=
true
;
...
@@ -124,37 +122,31 @@
...
@@ -124,37 +122,31 @@
//
//
// buttonThesh
// buttonThesh
//
//
this
.
buttonThesh
.
Location
=
new
System
.
Drawing
.
Point
(
500
,
16
);
this
.
buttonThesh
.
Location
=
new
System
.
Drawing
.
Point
(
375
,
13
);
this
.
buttonThesh
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
buttonThesh
.
Name
=
"buttonThesh"
;
this
.
buttonThesh
.
Name
=
"buttonThesh"
;
this
.
buttonThesh
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
29
);
this
.
buttonThesh
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
buttonThesh
.
TabIndex
=
3
;
this
.
buttonThesh
.
TabIndex
=
3
;
this
.
buttonThesh
.
Text
=
"二值化"
;
this
.
buttonThesh
.
Text
=
"二值化"
;
this
.
buttonThesh
.
UseVisualStyleBackColor
=
true
;
this
.
buttonThesh
.
UseVisualStyleBackColor
=
true
;
this
.
buttonThesh
.
Visible
=
false
;
this
.
buttonThesh
.
Click
+=
new
System
.
EventHandler
(
this
.
buttonThesh_Click
);
this
.
buttonThesh
.
Click
+=
new
System
.
EventHandler
(
this
.
buttonThesh_Click
);
//
//
// textBoxThesh
// textBoxThesh
//
//
this
.
textBoxThesh
.
Location
=
new
System
.
Drawing
.
Point
(
359
,
16
);
this
.
textBoxThesh
.
Location
=
new
System
.
Drawing
.
Point
(
269
,
13
);
this
.
textBoxThesh
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBoxThesh
.
Name
=
"textBoxThesh"
;
this
.
textBoxThesh
.
Name
=
"textBoxThesh"
;
this
.
textBoxThesh
.
Size
=
new
System
.
Drawing
.
Size
(
60
,
25
);
this
.
textBoxThesh
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
21
);
this
.
textBoxThesh
.
TabIndex
=
4
;
this
.
textBoxThesh
.
TabIndex
=
4
;
this
.
textBoxThesh
.
Text
=
"70"
;
this
.
textBoxThesh
.
Text
=
"70"
;
this
.
textBoxThesh
.
Visible
=
false
;
//
//
// checkBoxAutoThresh
// checkBoxAutoThresh
//
//
this
.
checkBoxAutoThresh
.
AutoSize
=
true
;
this
.
checkBoxAutoThresh
.
AutoSize
=
true
;
this
.
checkBoxAutoThresh
.
Location
=
new
System
.
Drawing
.
Point
(
428
,
21
);
this
.
checkBoxAutoThresh
.
Location
=
new
System
.
Drawing
.
Point
(
321
,
17
);
this
.
checkBoxAutoThresh
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
checkBoxAutoThresh
.
Name
=
"checkBoxAutoThresh"
;
this
.
checkBoxAutoThresh
.
Name
=
"checkBoxAutoThresh"
;
this
.
checkBoxAutoThresh
.
Size
=
new
System
.
Drawing
.
Size
(
59
,
19
);
this
.
checkBoxAutoThresh
.
Size
=
new
System
.
Drawing
.
Size
(
48
,
16
);
this
.
checkBoxAutoThresh
.
TabIndex
=
5
;
this
.
checkBoxAutoThresh
.
TabIndex
=
5
;
this
.
checkBoxAutoThresh
.
Text
=
"自动"
;
this
.
checkBoxAutoThresh
.
Text
=
"自动"
;
this
.
checkBoxAutoThresh
.
UseVisualStyleBackColor
=
true
;
this
.
checkBoxAutoThresh
.
UseVisualStyleBackColor
=
true
;
this
.
checkBoxAutoThresh
.
Visible
=
false
;
this
.
checkBoxAutoThresh
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
checkBoxAutoThresh_CheckedChanged
);
this
.
checkBoxAutoThresh
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
checkBoxAutoThresh_CheckedChanged
);
//
//
// panel1
// panel1
...
@@ -166,20 +158,18 @@
...
@@ -166,20 +158,18 @@
this
.
panel1
.
Controls
.
Add
(
this
.
labelImageName
);
this
.
panel1
.
Controls
.
Add
(
this
.
labelImageName
);
this
.
panel1
.
Controls
.
Add
(
this
.
labelCount
);
this
.
panel1
.
Controls
.
Add
(
this
.
labelCount
);
this
.
panel1
.
Controls
.
Add
(
this
.
labelTime
);
this
.
panel1
.
Controls
.
Add
(
this
.
labelTime
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(-
1
,
514
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(-
1
,
411
);
this
.
panel1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
853
,
28
);
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
640
,
23
);
this
.
panel1
.
TabIndex
=
7
;
this
.
panel1
.
TabIndex
=
7
;
//
//
// labelFeature
// labelFeature
//
//
this
.
labelFeature
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
labelFeature
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
labelFeature
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelFeature
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelFeature
.
Location
=
new
System
.
Drawing
.
Point
(
140
,
1
);
this
.
labelFeature
.
Location
=
new
System
.
Drawing
.
Point
(
105
,
1
);
this
.
labelFeature
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
labelFeature
.
Name
=
"labelFeature"
;
this
.
labelFeature
.
Name
=
"labelFeature"
;
this
.
labelFeature
.
Size
=
new
System
.
Drawing
.
Size
(
1
59
,
28
);
this
.
labelFeature
.
Size
=
new
System
.
Drawing
.
Size
(
1
19
,
22
);
this
.
labelFeature
.
TabIndex
=
3
;
this
.
labelFeature
.
TabIndex
=
3
;
this
.
labelFeature
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
this
.
labelFeature
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
//
...
@@ -188,10 +178,9 @@
...
@@ -188,10 +178,9 @@
this
.
labelImageName
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
this
.
labelImageName
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
labelImageName
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelImageName
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelImageName
.
Location
=
new
System
.
Drawing
.
Point
(
297
,
1
);
this
.
labelImageName
.
Location
=
new
System
.
Drawing
.
Point
(
223
,
1
);
this
.
labelImageName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
labelImageName
.
Name
=
"labelImageName"
;
this
.
labelImageName
.
Name
=
"labelImageName"
;
this
.
labelImageName
.
Size
=
new
System
.
Drawing
.
Size
(
423
,
28
);
this
.
labelImageName
.
Size
=
new
System
.
Drawing
.
Size
(
317
,
22
);
this
.
labelImageName
.
TabIndex
=
2
;
this
.
labelImageName
.
TabIndex
=
2
;
this
.
labelImageName
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
this
.
labelImageName
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
//
...
@@ -200,9 +189,8 @@
...
@@ -200,9 +189,8 @@
this
.
labelCount
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
labelCount
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
labelCount
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelCount
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelCount
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
1
);
this
.
labelCount
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
1
);
this
.
labelCount
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
labelCount
.
Name
=
"labelCount"
;
this
.
labelCount
.
Name
=
"labelCount"
;
this
.
labelCount
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
28
);
this
.
labelCount
.
Size
=
new
System
.
Drawing
.
Size
(
1
08
,
22
);
this
.
labelCount
.
TabIndex
=
1
;
this
.
labelCount
.
TabIndex
=
1
;
this
.
labelCount
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
this
.
labelCount
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
//
...
@@ -210,33 +198,28 @@
...
@@ -210,33 +198,28 @@
//
//
this
.
labelTime
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
labelTime
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
labelTime
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelTime
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
Fixed3D
;
this
.
labelTime
.
Location
=
new
System
.
Drawing
.
Point
(
720
,
1
);
this
.
labelTime
.
Location
=
new
System
.
Drawing
.
Point
(
540
,
1
);
this
.
labelTime
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
labelTime
.
Name
=
"labelTime"
;
this
.
labelTime
.
Name
=
"labelTime"
;
this
.
labelTime
.
Size
=
new
System
.
Drawing
.
Size
(
129
,
28
);
this
.
labelTime
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
22
);
this
.
labelTime
.
TabIndex
=
0
;
this
.
labelTime
.
TabIndex
=
0
;
this
.
labelTime
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
this
.
labelTime
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
//
// textBoxFeature
// textBoxFeature
//
//
this
.
textBoxFeature
.
Location
=
new
System
.
Drawing
.
Point
(
741
,
20
);
this
.
textBoxFeature
.
Location
=
new
System
.
Drawing
.
Point
(
556
,
16
);
this
.
textBoxFeature
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBoxFeature
.
Name
=
"textBoxFeature"
;
this
.
textBoxFeature
.
Name
=
"textBoxFeature"
;
this
.
textBoxFeature
.
Size
=
new
System
.
Drawing
.
Size
(
60
,
25
);
this
.
textBoxFeature
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
21
);
this
.
textBoxFeature
.
TabIndex
=
8
;
this
.
textBoxFeature
.
TabIndex
=
8
;
this
.
textBoxFeature
.
Text
=
"200"
;
this
.
textBoxFeature
.
Text
=
"200"
;
this
.
textBoxFeature
.
Visible
=
false
;
//
//
// label1
// label1
//
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
631
,
24
);
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
473
,
19
);
this
.
label1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
82
,
15
);
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
65
,
12
);
this
.
label1
.
TabIndex
=
9
;
this
.
label1
.
TabIndex
=
9
;
this
.
label1
.
Text
=
"元件特征:"
;
this
.
label1
.
Text
=
"元件特征:"
;
this
.
label1
.
Visible
=
false
;
//
//
// imageBox
// imageBox
//
//
...
@@ -244,18 +227,17 @@
...
@@ -244,18 +227,17 @@
this
.
imageBox
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
this
.
imageBox
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
imageBox
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
52
);
this
.
imageBox
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
42
);
this
.
imageBox
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
imageBox
.
Name
=
"imageBox"
;
this
.
imageBox
.
Name
=
"imageBox"
;
this
.
imageBox
.
Size
=
new
System
.
Drawing
.
Size
(
817
,
458
);
this
.
imageBox
.
Size
=
new
System
.
Drawing
.
Size
(
614
,
367
);
this
.
imageBox
.
TabIndex
=
0
;
this
.
imageBox
.
TabIndex
=
0
;
this
.
imageBox
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
imageBox_MouseDown
);
this
.
imageBox
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
imageBox_MouseDown
);
//
//
// MainForm
// MainForm
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
8F
,
15
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
851
,
544
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
638
,
435
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
textBoxFeature
);
this
.
Controls
.
Add
(
this
.
textBoxFeature
);
this
.
Controls
.
Add
(
this
.
panel1
);
this
.
Controls
.
Add
(
this
.
panel1
);
...
@@ -266,7 +248,6 @@
...
@@ -266,7 +248,6 @@
this
.
Controls
.
Add
(
this
.
buttonOpen
);
this
.
Controls
.
Add
(
this
.
buttonOpen
);
this
.
Controls
.
Add
(
this
.
imageBox
);
this
.
Controls
.
Add
(
this
.
imageBox
);
this
.
Icon
=
((
System
.
Drawing
.
Icon
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Icon
=
((
System
.
Drawing
.
Icon
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
Name
=
"MainForm"
;
this
.
Name
=
"MainForm"
;
this
.
Text
=
"上海锐驰点料系统"
;
this
.
Text
=
"上海锐驰点料系统"
;
this
.
contextMenuStrip
.
ResumeLayout
(
false
);
this
.
contextMenuStrip
.
ResumeLayout
(
false
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论