How to use xml file from Resources in VS [closed]

asked 2016-04-12 14:13:23 -0500

mackfrank gravatar image

updated 2016-04-12 14:18:56 -0500

I'm trying to publish my program so i put xml file to Resources (using IDE Resources Manager ). I dont now how to use it to create CascadeClassifier . This doesn't work :

String xmlFile = WindowsFormsApplication1.Properties.Resources.haarcascade_frontalface_alt;

CascadeClassifier faceDetector = new CascadeClassifier(xmlFile );
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2016-04-12 14:24:00.104881



just saying, opencv does not support c# at all (your problem is off-topic, if there's a forum for your 3rd party wrapper, please ask there)

berak gravatar imageberak ( 2016-04-12 14:23:01 -0500 )edit

ok sorry .

mackfrank gravatar imagemackfrank ( 2016-04-12 15:31:33 -0500 )edit

don't feel sorry.

the CascadeClassifier needs a real "File" to open, if your resources get compiled into the app, it probably won't work

berak gravatar imageberak ( 2016-04-13 02:31:04 -0500 )edit

Off-topic indeed, but I can confirm that if you copile the model into your app, that it does not work. When installing the app, you should let the installer export the model to the installation folder, which will be known on most systems, and then use that location to read it from inside your code.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-04-13 06:44:00 -0500 )edit