2

I was trying to add OpenCV XML file in the Qt resource file, but it's not working that's why I was given path of the file manually.

Angie Quijano
  • 4,167
  • 3
  • 25
  • 30
lucifer
  • 175
  • 14
  • Can you please elaborate a little? Show some code? What _not working_ means? I'm pretty sure that you **can** make this work, but without further information it's just a too broad question. – Miki Feb 02 '16 at 12:07
  • with using qt resource for image : qpm3.load(":/icons/1444766275_iWarning.png"); with out qt resource : String face_cascade_name = "/home/lucifer/lbpcascade_frontalface.xml"; String eyes_cascade_name = "/home/lucifer/haarcascade_eye_tree_eyeglasses.xml"; – lucifer Feb 04 '16 at 12:08

1 Answers1

2

When OpenCV reads a file, it will internally use the operating system's file open function fopen or similar, which cannot open QT resources https://stackoverflow.com/a/11155302/2079934. You should read the resource file with QFile and convert its contents to a std::string. Then, you can use OpenCV to parse the xml string https://stackoverflow.com/a/12729875/2079934.

Community
  • 1
  • 1
SpamBot
  • 1,438
  • 11
  • 28