Esempio n. 1
0
 /// <summary>
 /// Returns the algorithm string identifier.
 /// This string is used as top level xml/yml node tag when the object is saved to a file or string.
 /// </summary>
 /// <param name="algorithm">The algorithm</param>
 /// <returns>
 /// Returns the algorithm string identifier.
 /// This string is used as top level xml/yml node tag when the object is saved to a file or string.
 /// </returns>
 public static String GetDefaultName(this IAlgorithm algorithm)
 {
     using (CvString s = new CvString())
     {
         CvInvoke.cveAlgorithmGetDefaultName(algorithm.AlgorithmPtr, s);
         return(s.ToString());
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Closes the file and releases all the memory buffers
 /// Call this method after all I/O operations with the storage are finished. If the storage was
 /// opened for writing data and FileStorage.Mode.Write was specified
 /// </summary>
 /// <returns>The string that represent the text in the FileStorage</returns>
 public String ReleaseAndGetString()
 {
     using (CvString s = new CvString())
     {
         CvInvoke.cveFileStorageReleaseAndGetString(_ptr, s);
         return(s.ToString());
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Reads the string from the node
 /// </summary>
 /// <param name="defaultString">The default value if one is not found in the node.</param>
 /// <returns>The string from the node</returns>
 public String ReadString(String defaultString = null)
 {
     using (CvString s = new CvString())
         using (CvString ds = new CvString(defaultString))
         {
             CvInvoke.cveFileNodeReadString(_ptr, s, ds);
             return(s.ToString());
         }
 }
Esempio n. 4
0
 /// <summary>
 /// Returns the algorithm parameter
 /// </summary>
 /// <param name="algorithm">The algorithm</param>
 /// <param name="name">The name of the parameter</param>
 /// <returns>The value of the parameter</returns>
 public static String GetString(this IAlgorithm algorithm, String name)
 {
     using (CvString cs = new CvString(name))
         using (CvString result = new CvString())
         {
             CvInvoke.cveAlgorithmGetString(algorithm.AlgorithmPtr, cs, result);
             return(result.ToString());
         }
 }
Esempio n. 5
0
 /// <summary>
 /// Decodes QR code on a curved surface in image once it's found by the detect() method.
 /// </summary>
 /// <param name="img">grayscale or color (BGR) image containing QR code.</param>
 /// <param name="points">Quadrangle vertices found by detect() method (or some other algorithm).</param>
 /// <param name="straightQrcode">The optional output image containing rectified and binarized QR code</param>
 /// <returns>UTF8-encoded output string or empty string if the code cannot be decoded.</returns>
 public String DecodeCurved(IInputArray img, IInputArray points, IOutputArray straightQrcode = null)
 {
     using (InputArray iaImage = img.GetInputArray())
         using (InputArray iaPoints = points.GetInputArray())
             using (OutputArray oaStraightQrcode = straightQrcode == null ? OutputArray.GetEmpty() : straightQrcode.GetOutputArray())
                 using (CvString decodedInfo = new CvString())
                 {
                     CvInvoke.cveQRCodeDetectorDecodeCurved(_ptr, iaImage, iaPoints, decodedInfo, oaStraightQrcode);
                     return(decodedInfo.ToString());
                 }
 }
Esempio n. 6
0
 /// <summary>
 /// Get the list of parameter definitions
 /// </summary>
 /// <param name="algorithm">The algorithm to retrieve the parameter list from</param>
 /// <returns>The list of parameter definitions</returns>
 public static ParamDef[] GetParams(this IAlgorithm algorithm)
 {
     using (VectorOfCvString names = new VectorOfCvString())
         using (VectorOfInt types = new VectorOfInt())
             using (VectorOfCvString helps = new VectorOfCvString())
             {
                 CvInvoke.cveAlgorithmGetParams(algorithm.AlgorithmPtr, names, types, helps);
                 ParamDef[] results = new ParamDef[names.Size];
                 for (int i = 0; i < results.Length; i++)
                 {
                     ParamDef t = new ParamDef();
                     using (CvString n = names[i])
                         using (CvString h = helps[i])
                         {
                             t.Name = n.ToString();
                             t.Type = (ParamType)types[i];
                             t.Help = h.ToString();
                         }
                     results[i] = t;
                 }
                 return(results);
             }
 }
Esempio n. 7
0
 /// <summary>
 /// Convert the DepthType to a string that represent the OpenCL value type.
 /// </summary>
 /// <param name="depthType">The depth type</param>
 /// <param name="channels">The number of channels</param>
 /// <returns>A string the repsent the OpenCL value type</returns>
 public static String TypeToString(DepthType depthType, int channels = 1)
 {
    using (CvString str = new CvString())
    {
       oclTypeToString(CvInvoke.MakeType(depthType, channels), str);
       return str.ToString();
    }
 }
Esempio n. 8
0
 /// <summary>
 /// Closes the file and releases all the memory buffers
 /// Call this method after all I/O operations with the storage are finished. If the storage was
 /// opened for writing data and FileStorage.Mode.Write was specified
 /// </summary>
 /// <returns>The string that represent the text in the FileStorage</returns>
 public String ReleaseAndGetString()
 {
    using (CvString s = new CvString())
    {
       CvInvoke.cveFileStorageReleaseAndGetString(_ptr, s);
       return s.ToString();
    }
 }
Esempio n. 9
0
 public void TestUnicodeCvString()
 {
    String target = "测试.jpg";
    using (CvString s = new CvString(target))
    {
       String s2 = s.ToString();
       EmguAssert.IsTrue(s2.Equals(target));
    }
 }
Esempio n. 10
0
      public void TestCvString()
      {
         string s = "From ? to ?";

         using (CvString str = new CvString(s))
         {
            string s2 = str.ToString();
            EmguAssert.IsTrue(s.Equals(s2));
         }
      }
Esempio n. 11
0
 /// <summary>
 /// Reads the string from the node
 /// </summary>
 /// <returns>The string from the node</returns>
 public String ReadString(String defaultString = null)
 {
    using (CvString s = new CvString())
    using (CvString ds = new CvString(defaultString))
    {
       CvInvoke.cveFileNodeReadString(_ptr, s, ds);
       return s.ToString();
    }
 }