Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. XML file whose path is specified in qrc file is not loaded
QtWS25 Last Chance

XML file whose path is specified in qrc file is not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 629 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aaron Kim
    wrote on last edited by
    #1
    CascadeClassifier faceClassifier;
    CascadeClassifier eyeClassifier;
    Q_ASSERT(faceClassifier.load(":/resources/haarcascade_frontalface_default.xml"));
    Q_ASSERT(eyeClassifier.load(":/resources/haarcascade_eye.xml"));
    

    This is a simple OpenCV code and load() function is blocked by Q_ASSERT. (which means it can not find the xml file)

    <!DOCTYPE RCC><RCC version="1.0">
    <qresource>
      <file>resources/icon.ico</file>
      <file>resources/MaestroTimes.ttf</file>
      <file>resources/haarcascade_eye.xml</file>
      <file>resources/haarcascade_frontalface_default.xml</file>
    </qresource>
    </RCC>
    

    This is the qrc file

    0_1539497012101_capture.PNG

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      What XML parser are you using ?
      The Qt one ?

      Also please show code for
      faceClassifier.load

      for test, please delete whole build folder so tmp files are 100% surely deleted.
      then rebuild all.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aaron Kim
        wrote on last edited by Aaron Kim
        #3

        @mrjj CascadeClassifier::load is not a function I made, but a function in OpenCV module.
        I tried deleting the build folder, but it doesn't work either

        jsulmJ 1 Reply Last reply
        0
        • A Aaron Kim

          @mrjj CascadeClassifier::load is not a function I made, but a function in OpenCV module.
          I tried deleting the build folder, but it doesn't work either

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Aaron-Kim Does OpenCV know anything about Qt resource files? If not this can't work. You will need to copy the XML file from the resource to some temporary location.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3
          • A Offline
            A Offline
            Aaron Kim
            wrote on last edited by
            #5

            @jsulm Yes I guess that OpenCV does not support it. thanks!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved