/// <summary> /// /// </summary> /// <param name="fileNames">A set of filenames storing the trained detectors (models). Each file contains one model. /// See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/.</param> /// <param name="classNames">A set of trained models names. If it’s empty then the name of each model will be /// constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat".</param> public virtual bool Load(IEnumerable <string> fileNames, IEnumerable <string> classNames) { ThrowIfDisposed(); if (fileNames == null) { throw new ArgumentNullException(nameof(fileNames)); } if (classNames == null) { throw new ArgumentNullException(nameof(classNames)); } using (var fn = new StringArrayAddress(fileNames)) using (var cn = new StringArrayAddress(classNames)) { return(NativeMethods.objdetect_LatentSvmDetector_load( ptr, fn.Pointer, fn.Dim1Length, cn.Pointer, cn.Dim1Length) != 0); } }
/// <summary> /// Creates the HOG descriptor and detector. /// </summary> /// <param name="fileNames">A set of filenames storing the trained detectors (models). Each file contains one model. /// See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/.</param> /// <param name="classNames">A set of trained models names. If it’s empty then the name of each model will be /// constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat".</param> public LatentSvmDetector(IEnumerable <string> fileNames, IEnumerable <string> classNames) : this() { ThrowIfDisposed(); if (fileNames == null) { throw new ArgumentNullException(nameof(fileNames)); } if (classNames == null) { throw new ArgumentNullException(nameof(classNames)); } using (var fn = new StringArrayAddress(fileNames)) using (var cn = new StringArrayAddress(classNames)) { var res = NativeMethods.objdetect_LatentSvmDetector_load( ptr, fn.Pointer, fn.Dim1Length, cn.Pointer, cn.Dim1Length) != 0; GC.KeepAlive(this); } }
/// <summary> /// /// </summary> /// <param name="fileNames">A set of filenames storing the trained detectors (models). Each file contains one model. /// See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/.</param> /// <param name="classNames">A set of trained models names. If it’s empty then the name of each model will be /// constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat".</param> public virtual bool Load(IEnumerable<string> fileNames, IEnumerable<string> classNames) { if (disposed) throw new ObjectDisposedException("LatentSvmDetector"); if (fileNames == null) throw new ArgumentNullException("fileNames"); if (classNames == null) throw new ArgumentNullException("classNames"); using (var fn = new StringArrayAddress(fileNames)) using (var cn = new StringArrayAddress(classNames)) { return NativeMethods.objdetect_LatentSvmDetector_load( ptr, fn.Pointer, fn.Dim1Length, cn.Pointer, cn.Dim1Length) != 0; } }