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
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 638 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 14 Oct 2018, 06:03 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 14 Oct 2018, 08:20 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 15 Oct 2018, 05:06 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

        J 1 Reply Last reply 15 Oct 2018, 05:37
        0
        • A Aaron Kim
          15 Oct 2018, 05:06

          @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

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 15 Oct 2018, 05:37 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 16 Oct 2018, 01:04 last edited by
            #5

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

            1 Reply Last reply
            0

            5/5

            16 Oct 2018, 01:04

            • Login

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