增加3D检测算法

This commit is contained in:
moco 2024-11-04 22:11:00 +08:00
parent cc6859e814
commit aad93c08e7
4 changed files with 308 additions and 245 deletions

File diff suppressed because it is too large Load Diff

View File

@ -132,19 +132,4 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hWindowControlHeight.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value />
</metadata>
<metadata name="hWindowControlGray.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value />
</metadata>
</root>

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PanSight3DForm
{
public static class GzLinearDetection
{
//public static float[][] bufferC; // x y z 重新
public static int[][] CheckAlg(float[] buffer, int WLength, int channels, int HLength)
{
int length = WLength * channels;
//bufferC = new float[HLength][];
float[][] bufferZ3 = new float[HLength][];
for (int j = 0; j < HLength; j++)
{
//bufferC[j] = new float[length];
bufferZ3[j] = new float[WLength];
//for (int i = 0, k = 2; i < length; i++, k += 3)
//{
// bufferC[j][i] = buffer[i + j * length];
//}
for (int i = 0, k = 2; k < length; i++, k += 3)
{
if (k + j * length < buffer.Length)
{
bufferZ3[j][i] = buffer[k + j * length];
}
}
}
return DefectDetectMX(bufferZ3,WLength, HLength);
}
private static int[][] DefectDetectMX(float[][] bufferZ3, int WLength, int HLength)
{
int[][] defLocZ;
defLocZ = new int[HLength][];
for (int j = 0; j < HLength; j++)
{
defLocZ[j] = new int[WLength + 2];
int nr = 1;
for (int i = 1; i < WLength; i++)
{
if (bufferZ3[j][i] != 0)
{
defLocZ[j][nr] = i;
nr++;
}
}
defLocZ[j][0] = nr - 1;
defLocZ[j][nr + 1] = -1;
}
return defLocZ;
}
}
}

View File

@ -105,6 +105,7 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="GzLinearDetection.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="DetectForm1.resx">