/// <summary> /// Saves the image to the specified file. The image format is chosen depending on the filename extension, see cvLoadImage. Only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use cvCvtScale and cvCvtColor to convert it before saving, or use universal cvSave to save the image to XML or YAML format /// </summary> /// <param name="filename">The name of the file to be saved to</param> /// <param name="image">The image to be saved</param> /// <param name="parameters">The parameters</param> /// <returns>true if success</returns> public static bool Imwrite(String filename, IInputArray image, params KeyValuePair <CvEnum.ImwriteFlags, int>[] parameters) { using (Util.VectorOfInt vec = new Util.VectorOfInt()) { PushParameters(vec, parameters); using (CvString s = new CvString(filename)) using (InputArray iaImage = image.GetInputArray()) { #if !(__IOS__ || __ANDROID__ || NETFX_CORE || NETSTANDARD1_4) bool containsUnicode = (s.Length != filename.Length); if (containsUnicode && (Emgu.Util.Platform.OperationSystem != OS.MacOSX) && (Emgu.Util.Platform.OperationSystem != OS.Linux)) { //Handle unicode in Windows platform //Work around for Open CV ticket: //https://github.com/Itseez/opencv/issues/4292 //https://github.com/Itseez/opencv/issues/4866 System.IO.FileInfo fi = new System.IO.FileInfo(filename); using (VectorOfByte vb = new VectorOfByte()) { CvInvoke.Imencode(fi.Extension, image, vb, parameters); byte[] arr = vb.ToArray(); System.IO.File.WriteAllBytes(filename, arr); return(true); } } else #endif return(cveImwrite(s, iaImage, vec)); } } }
/// <summary> /// Save multiple images to a specified file (e.g. ".tiff" that support multiple images). /// </summary> /// <param name="filename">Name of the file.</param> /// <param name="images">Images to be saved.</param> /// <param name="parameters">The parameters</param> /// <returns>true if success</returns> public static bool Imwritemulti(String filename, IInputArrayOfArrays images, params KeyValuePair <CvEnum.ImwriteFlags, int>[] parameters) { using (CvString strFilename = new CvString(filename)) using (Util.VectorOfInt vec = new Util.VectorOfInt()) using (InputArray iaImages = images.GetInputArray()) { PushParameters(vec, parameters); return(cveImwritemulti(strFilename, iaImages, vec)); } }
/// <summary> /// Create the standard vector of VectorOfInt /// </summary> public VectorOfVectorOfInt(int[][] values) : this() { using (VectorOfInt v = new VectorOfInt()) { for (int i = 0; i < values.Length; i++) { v.Push(values[i]); Push(v); v.Clear(); } } }
/// <summary> /// Saves the image to the specified file. The image format is chosen depending on the filename extension, see cvLoadImage. Only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use cvCvtScale and cvCvtColor to convert it before saving, or use universal cvSave to save the image to XML or YAML format /// </summary> /// <param name="filename">The name of the file to be saved to</param> /// <param name="image">The image to be saved</param> /// <param name="parameters">The parameters</param> /// <returns>true if success</returns> public static bool Imwrite(String filename, IInputArray image, params int[] parameters) { using (Util.VectorOfInt vec = new Util.VectorOfInt()) { if (parameters.Length > 0) { vec.Push(parameters); } using (CvString s = new CvString(filename)) using (InputArray iaImage = image.GetInputArray()) return(cveImwrite(s, iaImage, vec)); } }
/// <summary> /// Convert the standard vector to arrays of int /// </summary> /// <returns>Arrays of int</returns> public int[][] ToArrayOfArray() { int size = Size; int[][] res = new int[size][]; for (int i = 0; i < size; i++) { using (VectorOfInt v = this[i]) { res[i] = v.ToArray(); } } return(res); }
/// <summary> /// Push a value into the standard vector /// </summary> /// <param name="value">The value to be pushed to the vector</param> public void Push(VectorOfInt value) { VectorOfVectorOfIntPush(_ptr, value.Ptr); }
public DebuggerProxy(VectorOfInt v) { _v = v; }
/// <summary> /// Push multiple values from the other vector into this vector /// </summary> /// <param name="other">The other vector, from which the values will be pushed to the current vector</param> public void Push(VectorOfInt other) { VectorOfIntPushVector(_ptr, other); }