当前位置: 首页>>代码示例>>C#>>正文


C# Mat.Equals方法代码示例

本文整理汇总了C#中Mat.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Mat.Equals方法的具体用法?C# Mat.Equals怎么用?C# Mat.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mat的用法示例。


在下文中一共展示了Mat.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestMatEquals

      public void TestMatEquals()
      {
         Mat m1 = new Mat(640, 320, DepthType.Cv8U, 3);
         m1.SetTo(new MCvScalar(1, 2, 3));
         Mat m2 = new Mat(640, 320, DepthType.Cv8U, 3);
         m2.SetTo(new MCvScalar(1, 2, 3));
         
         EmguAssert.IsTrue(m1.Equals(m2));

      }
开发者ID:reidblomquist,项目名称:emgucv,代码行数:10,代码来源:AutoTestMat.cs

示例2: TestFileStorage2

      public void TestFileStorage2()
      {
         Mat m = new Mat(40, 30, DepthType.Cv8U, 3);
         
         using (ScalarArray lower = new ScalarArray(new MCvScalar(0, 0, 0)))
         using (ScalarArray higher = new ScalarArray(new MCvScalar(255, 255, 255)))
            CvInvoke.Randu(m, lower, higher );

         int intValue = 10;
         float floatValue = 213.993f;
         double doubleValue = 32.314;

         using (FileStorage fs = new FileStorage(".xml", FileStorage.Mode.Write | FileStorage.Mode.Memory))
         {
            fs.Write(m, "m");
            fs.Write(intValue, "int");
            fs.Write(floatValue, "float");
            fs.Write(doubleValue, "double");
            string s = fs.ReleaseAndGetString();

            using (FileStorage fs2 = new FileStorage(s, FileStorage.Mode.Read | FileStorage.Mode.Memory))
            {
               
               using (FileNode node = fs2.GetFirstTopLevelNode())
               {
                  Mat m2 = new Mat();
                  node.ReadMat(m2);
                  EmguAssert.IsTrue(m.Equals(m2));
               }

               using (FileNode node = fs2.GetNode("m"))
               {
                  Mat m2 = new Mat();
                  node.ReadMat(m2);
                  EmguAssert.IsTrue(m.Equals(m2));
               }

               using (FileNode node = fs2.GetNode("int"))
               {
                  EmguAssert.IsTrue(intValue.Equals(node.ReadInt()));   
               }

               using (FileNode node = fs2.GetNode("float"))
               {
                  EmguAssert.IsTrue(floatValue.Equals(node.ReadFloat()));
               }

               using (FileNode node = fs2.GetNode("double"))
               {
                  EmguAssert.IsTrue(doubleValue.Equals(node.ReadDouble()));
               }
            }
         }
      }
开发者ID:Delaley,项目名称:emgucv,代码行数:54,代码来源:AutoTestVarious.cs

示例3: TestRuntimeSerialize

      public void TestRuntimeSerialize()
      {
         Mat img = new Mat(100, 80, DepthType.Cv8U, 3);

         using (MemoryStream ms = new MemoryStream())
         {
            //img.SetRandNormal(new MCvScalar(100, 100, 100), new MCvScalar(50, 50, 50));
            //img.SerializationCompressionRatio = 9;
            CvInvoke.SetIdentity(img, new MCvScalar(1, 2, 3));
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
                formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            formatter.Serialize(ms, img);
            Byte[] bytes = ms.GetBuffer();

            using (MemoryStream ms2 = new MemoryStream(bytes))
            {
               Object o = formatter.Deserialize(ms2);
               Mat img2 = (Mat)o;
               EmguAssert.IsTrue(img.Equals(img2));
            }
         }
      }
开发者ID:reidblomquist,项目名称:emgucv,代码行数:22,代码来源:AutoTestMat.cs

示例4: TestCudaUploadDownload

      public void TestCudaUploadDownload()
      {
         if (!CudaInvoke.HasCuda)
            return;

         Mat m = new Mat(new Size(480, 320), DepthType.Cv8U, 3);
         CvInvoke.Randu(m, new MCvScalar(), new MCvScalar(255, 255, 255) );

         #region test for async download & upload
         Stream stream = new Stream();
         GpuMat gm1 = new GpuMat();
         gm1.Upload(m, stream);

         Mat m2 = new Mat();
         gm1.Download(m2, stream);

         stream.WaitForCompletion();
         EmguAssert.IsTrue(m.Equals(m2));
         #endregion

         #region test for blocking download & upload
         GpuMat gm2 = new GpuMat();
         gm2.Upload(m);
         Mat m3 = new Mat();
         gm2.Download(m3);
         EmguAssert.IsTrue(m.Equals(m3));
         #endregion
      }
开发者ID:neutmute,项目名称:emgucv,代码行数:28,代码来源:AutoTestCuda.cs


注:本文中的Mat.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。