0

Im using EMGUCV at Visual Studio 2017. I need to set a XML file to a cascadeClassifier like this:

CascadeClassifier cascadeClassifier = new CascadeClassifier(@"cascadeClassifier\haarcascade_frontalface_alt2.xml");

Doing this way I need to get a copy of XML file to my Release. So I discover the resource stuff by this question here. So I add the XML to my resource and tried to access it by:

CascadeClassifier cascadeClassifier = new CascadeClassifier(Properties.Resources.haarcascade_frontalface_alt2);

But this object resource is a string and the CascadeClassifier is expecting a filename, is there a way to do it?

dsicari
  • 590
  • 6
  • 13

1 Answers1

1

Well, according to the API documentation the construction takes in a filename (as you said), but the type of the filename can be a string (must be a string) so there should be no problem when you pass in a string from a resource file/dictionary: http://www.emgu.com/wiki/files/2.4.2/document/html/b5ce78f6-d5cc-a099-d1a8-25df92564f64.htm

Constructor is:

public CascadeClassifier(
    string fileName
)

See also this question/answer for an example (without resources used): How to load a CascadeClassifier using Emgu c#

Patric
  • 2,789
  • 9
  • 33
  • 60