37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using Matrox.MatroxImagingLibrary;
|
|
using VisionCommon;
|
|
|
|
namespace MilPattern {
|
|
internal class MilMorphology {
|
|
public static void Morphology(MIL_ID srcImage, MIL_ID dstImage, eMorphologyType morphologyType, int iteration) {
|
|
if (morphologyType == eMorphologyType.Open) {
|
|
MorphOpen(srcImage, dstImage, iteration);
|
|
}
|
|
else if (morphologyType == eMorphologyType.Close) {
|
|
MorphClose(srcImage, dstImage, iteration);
|
|
}
|
|
else if (morphologyType == eMorphologyType.Erode) {
|
|
MorphErode(srcImage, dstImage, iteration);
|
|
}
|
|
else {
|
|
MorphDilate(srcImage, dstImage, iteration);
|
|
}
|
|
}
|
|
|
|
private static void MorphOpen(MIL_ID srcImage, MIL_ID dstImage, int iteration) {
|
|
MIL.MimOpen(srcImage, dstImage, iteration, MIL.M_BINARY);
|
|
//MIL.MimMorphic(srcImage, dstImage, MIL.M_3X3_RECT, MIL.M_AREA_OPEN, iteration, procMode);
|
|
}
|
|
private static void MorphClose(MIL_ID srcImage, MIL_ID dstImage, int iteration) {
|
|
MIL.MimClose(srcImage, dstImage, iteration, MIL.M_BINARY);
|
|
}
|
|
|
|
private static void MorphErode(MIL_ID srcImage, MIL_ID dstImage, int iteration) {
|
|
MIL.MimErode(srcImage, dstImage, iteration, MIL.M_BINARY);
|
|
}
|
|
|
|
private static void MorphDilate(MIL_ID srcImage, MIL_ID dstImage, int iteration) {
|
|
MIL.MimDilate(srcImage, dstImage, iteration, MIL.M_BINARY);
|
|
}
|
|
}
|
|
} |