Browse Source

Fixed unit tests.

EMGUCV_3_4_1
Canming Huang 7 years ago
parent
commit
1b4a716db2
  1. 10
      Emgu.CV.Contrib/XFeatures2D/LATCH.cs
  2. 1104
      Emgu.CV.Test/AutoTestFeatures2d.cs
  3. 2
      Emgu.CV.Test/AutoTestOpenCL.cs
  4. 32
      Emgu.CV.Test/AutoTestVarious.cs
  5. 4
      Emgu.CV.Test/Emgu.CV.Test.csproj
  6. 2
      Emgu.CV/PInvoke/CvInvokeCore.cs
  7. 21
      Emgu.CV/PInvoke/CvInvokeImgproc.cs

10
Emgu.CV.Contrib/XFeatures2D/LATCH.cs

@ -54,11 +54,11 @@ namespace Emgu.CV.XFeatures2D
[DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)] [DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
internal extern static IntPtr cveLATCHCreate( internal extern static IntPtr cveLATCHCreate(
int bytes,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool rotationInvariance,
int halfSsdSize,
ref IntPtr extractor);
int bytes,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool rotationInvariance,
int halfSsdSize,
ref IntPtr extractor);
[DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)] [DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
internal extern static void cveLATCHRelease(ref IntPtr extractor); internal extern static void cveLATCHRelease(ref IntPtr extractor);

1104
Emgu.CV.Test/AutoTestFeatures2d.cs
File diff suppressed because it is too large
View File

2
Emgu.CV.Test/AutoTestOpenCL.cs

@ -92,7 +92,7 @@ __kernel void magnutude_filter_8u(
float shiftX = 100.5f; float shiftX = 100.5f;
float shiftY = -50.0f; float shiftY = -50.0f;
bool success = kernel.Create("shift", ps, buildOpts, errorMsg);
bool success = kernel.Create("myshift", ps, buildOpts, errorMsg);
EmguAssert.IsTrue(success, errorMsg.ToString()); EmguAssert.IsTrue(success, errorMsg.ToString());
int idx = 0; int idx = 0;
idx = kernel.Set(idx, image2d); idx = kernel.Set(idx, image2d);

32
Emgu.CV.Test/AutoTestVarious.cs

@ -3183,11 +3183,18 @@ namespace Emgu.CV.Test
String CaffeModelUrl = "http://dl.caffe.berkeleyvision.org/fcn8s-heavy-pascal.caffemodel"; String CaffeModelUrl = "http://dl.caffe.berkeleyvision.org/fcn8s-heavy-pascal.caffemodel";
Trace.WriteLine("downloading file from:" + CaffeModelUrl + " to: " + caffeModelFile); Trace.WriteLine("downloading file from:" + CaffeModelUrl + " to: " + caffeModelFile);
System.Net.WebClient downloadClient = new System.Net.WebClient(); System.Net.WebClient downloadClient = new System.Net.WebClient();
downloadClient.DownloadFile(CaffeModelUrl, caffeModelFile);
try
{
downloadClient.DownloadFile(CaffeModelUrl, caffeModelFile);
} catch
{
//delete file in case of failed download
File.Delete(caffeModelFile);
throw;
}
} }
Dnn.Net net = DnnInvoke.ReadNetFromCaffe("fcn8s-heavy-pascal.prototxt", caffeModelFile); Dnn.Net net = DnnInvoke.ReadNetFromCaffe("fcn8s-heavy-pascal.prototxt", caffeModelFile);
//using (Dnn.Importer importer = Dnn.Importer.CreateCaffeImporter("fcn8s-heavy-pascal.prototxt", caffeModelFile))
// importer.PopulateNet(net);
Mat img = EmguAssert.LoadMat("rgb.jpg"); Mat img = EmguAssert.LoadMat("rgb.jpg");
//FCN accepts 500x500 RGB-images //FCN accepts 500x500 RGB-images
@ -3245,7 +3252,15 @@ namespace Emgu.CV.Test
String googleNetUrl = "http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel"; String googleNetUrl = "http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel";
Trace.WriteLine("downloading file from:" + googleNetUrl + " to: " + googleNetFile); Trace.WriteLine("downloading file from:" + googleNetUrl + " to: " + googleNetFile);
System.Net.WebClient downloadClient = new System.Net.WebClient(); System.Net.WebClient downloadClient = new System.Net.WebClient();
downloadClient.DownloadFile(googleNetUrl, googleNetFile);
try
{
downloadClient.DownloadFile(googleNetUrl, googleNetFile);
} catch
{
//Delete the file in case of failed download.
File.Delete(googleNetFile);
throw;
}
} }
//using (Dnn.Importer importer = Dnn.Importer.CreateCaffeImporter("bvlc_googlenet.prototxt", googleNetFile)) //using (Dnn.Importer importer = Dnn.Importer.CreateCaffeImporter("bvlc_googlenet.prototxt", googleNetFile))
// importer.PopulateNet(net); // importer.PopulateNet(net);
@ -3279,7 +3294,14 @@ namespace Emgu.CV.Test
String fileUrl = url + fileName; String fileUrl = url + fileName;
Trace.WriteLine("downloading file from:" + fileUrl + " to: " + fileName); Trace.WriteLine("downloading file from:" + fileUrl + " to: " + fileName);
System.Net.WebClient downloadClient = new System.Net.WebClient(); System.Net.WebClient downloadClient = new System.Net.WebClient();
downloadClient.DownloadFile(fileUrl, fileName);
try
{
downloadClient.DownloadFile(fileUrl, fileName);
} catch
{
File.Delete(fileName);
throw;
}
} }
} }

4
Emgu.CV.Test/Emgu.CV.Test.csproj

@ -37,7 +37,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\bin\</OutputPath>
<OutputPath>..\libs\</OutputPath>
<DefineConstants>TRACE;DEBUG;VS_TEST</DefineConstants> <DefineConstants>TRACE;DEBUG;VS_TEST</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -47,7 +47,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<OutputPath>..\libs\</OutputPath>
<DefineConstants>TRACE;VS_TEST</DefineConstants> <DefineConstants>TRACE;VS_TEST</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

2
Emgu.CV/PInvoke/CvInvokeCore.cs

@ -3046,7 +3046,7 @@ namespace Emgu.CV
/// <summary> /// <summary>
/// Get or set the number of threads that are used by parallelized OpenCV functions /// Get or set the number of threads that are used by parallelized OpenCV functions
/// </summary> /// </summary>
/// <remarks>When the argument is zero or negative, and at the beginning of the program, the number of threads is set to the number of processors in the system, as returned by the function omp_get_num_procs() from OpenMP runtime. </param></remarks>
/// <remarks>When the argument is zero or negative, and at the beginning of the program, the number of threads is set to the number of processors in the system, as returned by the function omp_get_num_procs() from OpenMP runtime. </remarks>
public static int NumThreads public static int NumThreads
{ {
get get

21
Emgu.CV/PInvoke/CvInvokeImgproc.cs

@ -1744,18 +1744,15 @@ namespace Emgu.CV
int minRadius = 0, int minRadius = 0,
int maxRadius = 0) int maxRadius = 0)
{ {
using (Mat circles = new Mat())
using (VectorOfPoint3D32F circles = new VectorOfPoint3D32F())
{ {
HoughCircles(image, circles, method, dp, minDist, param1, param2, minRadius, maxRadius); HoughCircles(image, circles, method, dp, minDist, param1, param2, minRadius, maxRadius);
Size s = circles.Size;
CircleF[] results = new CircleF[s.Width];
GCHandle handle = GCHandle.Alloc(results, GCHandleType.Pinned);
using (Mat tmp = new Mat(s.Height, s.Width, CV.CvEnum.DepthType.Cv32F, 3, handle.AddrOfPinnedObject(), sizeof(float) * 3))
MCvPoint3D32f[] circlePts = circles.ToArray();
CircleF[] results = new CircleF[circles.Size];
for (int i = 0; i < results.Length; i++)
{ {
circles.CopyTo(tmp);
results[i] = new CircleF(new PointF(circles[i].X, circles[i].Y), circles[i].Z);
} }
handle.Free();
return results; return results;
} }
} }
@ -1854,10 +1851,10 @@ namespace Emgu.CV
} }
[DllImport(ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)] [DllImport(ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cveMoments( private static extern void cveMoments(
IntPtr arr,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool binaryImage,
ref MCvMoments moments);
IntPtr arr,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool binaryImage,
ref MCvMoments moments);
/* /*
/// <summary> /// <summary>

Loading…
Cancel
Save