48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace VisionCommon {
|
|
public enum eMorphologyType {
|
|
None,
|
|
Open,
|
|
Close,
|
|
Dilate,
|
|
Erode
|
|
}
|
|
|
|
public class MorphologyParam : ICloneCopy<MorphologyParam> {
|
|
public bool Enabled { get; set; } = false;
|
|
|
|
public List<eMorphologyType> Types { get; set; } = new List<eMorphologyType>();
|
|
public List<int> RepeatCounts { get; set; } = new List<int>();
|
|
|
|
public MorphologyParam Clone() {
|
|
return ((ICloneable)this).Clone() as MorphologyParam;
|
|
}
|
|
|
|
public void CopyTo(MorphologyParam target) {
|
|
target.Enabled = this.Enabled;
|
|
target.Types = this.Types.ConvertAll(s => s);
|
|
target.RepeatCounts = this.RepeatCounts.ConvertAll(s => s);
|
|
}
|
|
|
|
object ICloneable.Clone() {
|
|
var cloneObj = new MorphologyParam();
|
|
CopyTo(cloneObj);
|
|
return cloneObj;
|
|
}
|
|
|
|
public bool IsAllZero() {
|
|
int cnt = 0;
|
|
foreach (var count in RepeatCounts) {
|
|
cnt = cnt + count;
|
|
}
|
|
if (cnt == 0) {
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |