Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt + OpenCV lib for IOS first configuration failed

Qt + OpenCV lib for IOS first configuration failed

Scheduled Pinned Locked Moved Solved Mobile and Embedded
24 Posts 4 Posters 5.0k 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.
  • K Offline
    K Offline
    kybernetes
    wrote on 8 Jul 2018, 14:56 last edited by
    #1

    hello

    I just started qt project with opencv framework for an ios program.

    i just believe i config opencv by cmake correctly and put opencv file in my documents in finder

    and i just try to add opencv to qt project by pri file

    0_1531061594572_Ekran Resmi 2018-07-08 17.52.37.png

    and this is my pri file inside

    0_1531061651179_Ekran Resmi 2018-07-08 17.53.45.png

    so there are 2 fail when i try to build project

    first one is opencv2/opencv.hpp file not found, i think is is about what is written in pri file but i dont know what i can write it there, i just take this part from a book

    second one is xcodebuild failed, and this is about xcode but xcode is fine i think

    can you give me a hint?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Jul 2018, 20:36 last edited by
      #2

      Hi,

      Xcodebuild failed because it couldn't find opencv.hpp. Did you check its exact location on your machine ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VRonin
        wrote on 8 Jul 2018, 21:27 last edited by
        #3

        does /usr/local/include/opencv2/opencv.hpp exist?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kybernetes
          wrote on 8 Jul 2018, 22:01 last edited by
          #4

          my user name kontrolog on computer and i told you i put opencv in document
          where is opencv.hpp

          it is there like below

          /Users/kontrolog/Documents/opencv/include/opencv2/opencv.hpp

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 8 Jul 2018, 22:11 last edited by
            #5

            Then why are you using a .pri file that points everything to /usr/local ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • K Offline
              K Offline
              kybernetes
              wrote on 8 Jul 2018, 22:38 last edited by
              #6

              i just copy from book.

              I dont know file system of mac, i download source code zip and put the file inside of the zip to document, and i made a file as name build inside the file opencv and build it. it is all taken from a book. Maybe i dont understand what i did.

              in the end i think cmake put the builded opencv files into build file, i just click configure and generate

              0_1531089263928_Ekran Resmi 2018-07-09 01.32.46.png

              i use cmake and it fills build file

              0_1531089116697_Ekran Resmi 2018-07-09 01.31.26.png

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 9 Jul 2018, 06:19 last edited by
                #7

                The filesystem layout follows to some extend the classic Unix style.

                From the looks of it, you are rather building OpenCV for the desktop.

                Why build from source since they seem to provide pre-built binaries for iOS ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • K Offline
                  K Offline
                  kybernetes
                  wrote on 9 Jul 2018, 07:25 last edited by
                  #8

                  i couldnt use it if i know how can i add it i was planning to work with it. as i told, i have a book and i am working on it it explain as like this. i write program same but framework adding is not i made it before.

                  i didnt understand steps. when i download prebuilt binaries for ios there is no explanation how to set up to my project. i am writing and make it again. please lead me to finish what i did. Now i began

                  1. I downloaded opencv ios pact. now it is in my download dir.

                  2. i press cmd+shift+h and make a dir which name is opencv

                  0_1531120900535_Ekran Resmi 2018-07-09 10.21.20.png

                  1. i put ios-pact zip file in this dir and extract it same place

                  0_1531120973004_Ekran Resmi 2018-07-09 10.22.33.png

                  1. now i open my qt project and connect opencv and qt once for test app. so i need a pri file or sthing. please tell me what i will do next to add opencv to my project.

                  After all i made it just once and i can use it if i know how i made it.

                  Best regards

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 9 Jul 2018, 21:37 last edited by
                    #9
                    LIBS += -F/path/to/opencv -framework opencv2
                    

                    -F is the equivalent of -L but for macOS/iOS frameworks.
                    -framework is the equivalent of -l but for macOS/iOS frameworks.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • K Offline
                      K Offline
                      kybernetes
                      wrote on 9 Jul 2018, 22:42 last edited by kybernetes 7 Sept 2018, 23:33
                      #10

                      am i understand right. i just wright "LIBS += -F/path/to/opencv -framework opencv2" to pri file and i will create pri file where and how can i add it to path or something what i dont know now :) i am sorry as you understand i just try to make a program with qt + opencv to my personal i phone. later i will convert it also android but the main idea is iphone now.

                      i am working on amin ahmadi tazehkandi's book it is not many information about ios part of programming and it is a little bit harder i think this must be the reason. maybe later mr. tazehkandi makes a unity education system for ios, i would like to be the first customer of it :)

                      https://www.amazon.com/Computer-Vision-OpenCV-multithreaded-cross-platform/dp/178847239X/ref=asap_bc?ie=UTF8

                      but i dont know to much. i think i need some push than i can go by myself.

                      0_1531179039958_Ekran Resmi 2018-07-10 02.30.25.png

                      what can i add main.cpp to work with opencv framework codes as you see in below
                      "Mat image = imread("/Users/kontrolog/Desktop/test1.png");"

                      0_1531179180025_Ekran Resmi 2018-07-10 02.31.08.png

                      thanks a lot.
                      Best regards.

                      J 1 Reply Last reply 10 Jul 2018, 04:41
                      0
                      • K kybernetes
                        9 Jul 2018, 22:42

                        am i understand right. i just wright "LIBS += -F/path/to/opencv -framework opencv2" to pri file and i will create pri file where and how can i add it to path or something what i dont know now :) i am sorry as you understand i just try to make a program with qt + opencv to my personal i phone. later i will convert it also android but the main idea is iphone now.

                        i am working on amin ahmadi tazehkandi's book it is not many information about ios part of programming and it is a little bit harder i think this must be the reason. maybe later mr. tazehkandi makes a unity education system for ios, i would like to be the first customer of it :)

                        https://www.amazon.com/Computer-Vision-OpenCV-multithreaded-cross-platform/dp/178847239X/ref=asap_bc?ie=UTF8

                        but i dont know to much. i think i need some push than i can go by myself.

                        0_1531179039958_Ekran Resmi 2018-07-10 02.30.25.png

                        what can i add main.cpp to work with opencv framework codes as you see in below
                        "Mat image = imread("/Users/kontrolog/Desktop/test1.png");"

                        0_1531179180025_Ekran Resmi 2018-07-10 02.31.08.png

                        thanks a lot.
                        Best regards.

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 10 Jul 2018, 04:41 last edited by
                        #11

                        @kybernetes You need to include OpenCV header file(s) you need in your main.cpp

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

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kybernetes
                          wrote on 10 Jul 2018, 04:56 last edited by kybernetes 7 Oct 2018, 06:09
                          #12

                          how can i add it to my main.cpp

                          0_1531198471916_Ekran Resmi 2018-07-10 07.54.16.png

                          as you see when i tried to add by include there is no opencv or opencv2, i appears only opencl-c.h and it is not about me.

                          for example "Mat image = imread("/Users/kontrolog/Desktop/test1.png");" if i play this code, what i can add my main.cpp file and how.

                          0_1531200071406_Ekran Resmi 2018-07-10 08.21.03.png

                          0_1531199422381_Ekran Resmi 2018-07-10 08.10.09.png

                          as you see i put opencv2.framework file in opencv dir where is here "/Users/kontrolog/opencv/" and inside of it

                          and i put my pri file is also opencv dir

                          0_1531200014855_Ekran Resmi 2018-07-10 08.19.55.png

                          and inside of my pri file is i add headers line now and i make qmake again project file but it didnt work

                          0_1531200131763_Ekran Resmi 2018-07-10 08.21.46.png

                          and after it i cleared headers line in pri file and by right click on source add existing file

                          0_1531202820037_Ekran Resmi 2018-07-10 09.06.47.png

                          i add headers opencv.hpp file from that path "/Users/kontrolog/opencv/opencv2.framework/Versions/A/Headers"

                          but it also doesnt work and i take same error again.

                          0_1531202947341_Ekran Resmi 2018-07-10 09.08.53.png

                          best regards.

                          J 1 Reply Last reply 10 Jul 2018, 06:24
                          0
                          • K kybernetes
                            10 Jul 2018, 04:56

                            how can i add it to my main.cpp

                            0_1531198471916_Ekran Resmi 2018-07-10 07.54.16.png

                            as you see when i tried to add by include there is no opencv or opencv2, i appears only opencl-c.h and it is not about me.

                            for example "Mat image = imread("/Users/kontrolog/Desktop/test1.png");" if i play this code, what i can add my main.cpp file and how.

                            0_1531200071406_Ekran Resmi 2018-07-10 08.21.03.png

                            0_1531199422381_Ekran Resmi 2018-07-10 08.10.09.png

                            as you see i put opencv2.framework file in opencv dir where is here "/Users/kontrolog/opencv/" and inside of it

                            and i put my pri file is also opencv dir

                            0_1531200014855_Ekran Resmi 2018-07-10 08.19.55.png

                            and inside of my pri file is i add headers line now and i make qmake again project file but it didnt work

                            0_1531200131763_Ekran Resmi 2018-07-10 08.21.46.png

                            and after it i cleared headers line in pri file and by right click on source add existing file

                            0_1531202820037_Ekran Resmi 2018-07-10 09.06.47.png

                            i add headers opencv.hpp file from that path "/Users/kontrolog/opencv/opencv2.framework/Versions/A/Headers"

                            but it also doesnt work and i take same error again.

                            0_1531202947341_Ekran Resmi 2018-07-10 09.08.53.png

                            best regards.

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 10 Jul 2018, 06:24 last edited by
                            #13

                            @kybernetes You should NOT add header files from OpenCV via "Add Existing Files..."!
                            You just need to find out where needed header files are. To use Mat you need mat.hpp. It should be somewhere inside Headers directory, simply search for it.

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

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              kybernetes
                              wrote on 10 Jul 2018, 06:33 last edited by kybernetes 7 Oct 2018, 06:48
                              #14

                              i really thanks to trying help me but i dont know how to add it.

                              in my book there is a sample code. so i tried to add "opencv2/opencv.hpp" and writer used this hpp files for OSX, he first qmake the opencv source file than add his program. in my problem it is not for MacOSX for IOS and i download ios pack from opencv website so i couldnt add my project the framework or header files as you see. i think opencv.hpp header is enough for Mat function because of the book. But i can find mat.hpp file it doesnt matter. after i find the file what should i do how can i add header file to my project by not being right click add existing file.

                              should i copy the mat.hpp file inside from framework and paste to my project file?

                              i really didnt understand how can i add file and this basic program work on ios simulator :)

                              thanks.

                              0_1531204199142_Ekran Resmi 2018-07-10 09.29.31.png

                              i couldnt find mat.hpp file inside of opencv dir. but i find opencv.hpp and copy paste to my project file than i build it.

                              0_1531205231607_Ekran Resmi 2018-07-10 09.47.00.png

                              ios simulator is worked but it gives an error lite this and i didnt see the picture, program is now worked.

                              0_1531205306990_Ekran Resmi 2018-07-10 09.48.14.png

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 10 Jul 2018, 06:57 last edited by
                                #15

                                As the error suggest, imshow's backend is not implemented for iOS but that's something you'd have to look with the OpenCV folks.

                                On a side note, if you want to show something with your Qt application then QCoreApplication is not the right tool as it doesn't start any graphical backend. It's for command line tools.

                                On a side note, loading a file from your main machine Desktop folder also won't work on your device as the file won't be accessible.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                1
                                • K Offline
                                  K Offline
                                  kybernetes
                                  wrote on 10 Jul 2018, 07:02 last edited by
                                  #16

                                  about error suggest, i just download opencv ios pack from opencv website as i told so i didnt understand that.

                                  side note 1: i will change QCoreApplication, i just copied the sample code from the book.

                                  Side note 2: i thought also as you, i think if i show a picture i should add it to my project file at least. maybe this can be a solution for access the photo

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 10 Jul 2018, 07:12 last edited by
                                    #17

                                    Building OpenCV for iOS by hand or using their pre-built package won't change anything: the highgui doesn't seem to have backend for iOS.

                                    What exact book are you using ?
                                    What are you going to use OpenCV for exactly ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      kybernetes
                                      wrote on 10 Jul 2018, 07:21 last edited by kybernetes 7 Oct 2018, 07:22
                                      #18

                                      this is the book which i use

                                      https://www.amazon.com/Computer-Vision-OpenCV-multithreaded-cross-platform/dp/178847239X/ref=asap_bc?ie=UTF8

                                      and i want to use it just because of fast and useful about image proccesing.

                                      İmage processing is not to much i just want to reach my phone's photo lib, choose photo, crop, rotate and contras it. than make its size smaller but not much effect photo than upload my webserver. that is all i want to. I want to use qml for pages.

                                      Maybe opencv is too much for my needs but i just dont want to effect photo too much when i resize its size.

                                      if you advice any other solution i can give up opencv now :) for ios and android at least

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on 10 Jul 2018, 22:02 last edited by
                                        #19

                                        Why not use QImage ?

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • K Offline
                                          K Offline
                                          kybernetes
                                          wrote on 11 Jul 2018, 06:40 last edited by kybernetes 7 Nov 2018, 07:05
                                          #20

                                          at the and i will. as i say i was trying to study step by step from book, and i like study from book now the problem how can i use QImage how i can reach file system, how i crop as i want and how i resize etc...

                                          where can i learn, i check but not use too much time, there is no qt ios book or there is not a unity education. so how can i learn proffesional and ask only the necessary question.

                                          you are so helpful and thank you for that but as you know it is impossible to ask everthing to you, and i am write a game for ios and android before 2 years ago i am not an expert, i have to take help every step of the program to learn good and make a good program.

                                          Now i will use QImage we can think that, and i need to use qml to make apperiance more usefull for app.

                                          i am asking Qml + QImage + IOS + Android for documantation. I need take photo from iphone photo library, crop it, rotate it, change contras and upload webserver, at this time program has to be flexible for all phones, apperiance has to be same iphone 4 5 6 7 8 10 or android device and it was hard to do 2 years ago when i was trying to write a game.

                                          Thanks. please give me an advice than, and i will ask any other problems here.
                                          Best regards.

                                          J 1 Reply Last reply 11 Jul 2018, 07:09
                                          0

                                          3/24

                                          8 Jul 2018, 21:27

                                          21 unread
                                          • Login

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