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. Path finding on Image from Race Track
Forum Updated to NodeBB v4.3 + New Features

Path finding on Image from Race Track

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 2.8k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    samlion007
    wrote on last edited by
    #1

    hello everyone,

    I have a problem, I want to represent certain values ​​on the track.
    That means I should represent all values ​​of motorcyclist on the track.
    (Please see the picture) Does anyone might have an idea.
    I would be very grateful

    The track is approximately 5.6 Km
    The track has a starting point and end point
    For example, the first driver in 5 minutes has reached the half way.
    How can I mark on the image half distance
    I have tried by the color (QRgb colors, color = image.pixel (x, y) then if (qGreen == 0)) so that I can distinguish the track from the image.

    Thanks.!http://1.bp.blogspot.com/-j6UeoG2uHBk/UNeYQ79MsCI/AAAAAAAAPZ4/vki2UxLzpm8/s1600/Ruhrschleife2013.jpg (Rennstrecke)!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BlastDV
      wrote on last edited by
      #2

      Hi samlion007. Could you explain a little bit better what do you want to do?

      If you want to paint indicators over the track, you may want to use QGraphicsView in order to display a picture (that would be your track) and then draw stuff on it, like racers, checkpoints and the goal.

      (8) Just live your life blind like me (8)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        samlion007
        wrote on last edited by
        #3

        Hi BlastDV, thanks for your quick Answer,

        the Drawing should be automatically .

        here you are the Example:
        First Driver :
        he drives more then 10 Min. on this track and he has per second difference Velocity and difference gas consumption
        For example :
        1-Speed
        from 1 sec. to 120 secs. has Velocity 20 km/h
        from 121 sec. to 3 Min. has Velocity 50 km/h
        from 3 Min to 10 min. has Velocity 80 km/h
        2-Gas
        from 1 sec. to 120 secs. used Gas 30%
        from 121 sec. to 3 Min. used Gas 44%
        from 3 Min to 10 min. used Gas 70%

        I have 2d. Array with more then 500 Data
        so i have to put this Data on the trac instead of Motors.
        That mean the Image should show this data each meter .

        I have to write on the Trac G for Gas and S for Speed .

        thanks

        Please see this Photos!!http://s7.directupload.net/images/140715/96gtwwwg.jpg( Data-Analyser)!!http://s7.directupload.net/images/140715/utpcixrf.jpg(Trac Race)!

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BlastDV
          wrote on last edited by
          #4

          I'm not sure if I understand this well but.. Do you want to represent the best path to race trough the track? With gas-speed relation?

          I understand what you say about having diferent measures depending on the time. But what do you exactly want to draw? A path? marks?

          Or do you want to draw marks according to the 2d array? If so, what is your question? Is it about processing the data? Or is it about drawing it?

          (8) Just live your life blind like me (8)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            samlion007
            wrote on last edited by
            #5

            Hi BlastDv,

            sorry for my bad explanation.
            I want , that the Program draw the marks (G or S ) according to the 2d Array automatically on the trac.

            The Program reads each measures from 2d Array and put or draws the marks on the trac (not out of the Trac).

            Another example:
            the driver reaches 2 kilometer in 3 minutes (the whole route is 5.5 km).
            I want that the program marks measure of gas and speed on the track from 1 meter to 2 Km.

            thanks alot for your quick answer.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              BlastDV
              wrote on last edited by
              #6

              I see, now I understand a little bit better.

              If you want to draw marks over the track, try using QGraphicsView class, which can be perfectly used to draw a static picture (the track) and then put some other stuff on it, like your marks.

              If you don't know this class, I can tell you by experience that it is not that hard to use. It works with the concept of "scenes", so you'll have to create a scene first where to put the elements on. Think about this as a theater where you have to set a scene first (QGraphicsScene) and then show it in a theater (QGraphicsView).

              To define elements on the QGraphicsScene, you'll have to use primitives according to what you want to draw (in this case, that would be "letters", I think). You may want to check the "QGraphicsView":http://qt-project.org/doc/qt-4.8/qgraphicsview.html and the "QGraphicsScene":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html references.

              (8) Just live your life blind like me (8)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                samlion007
                wrote on last edited by
                #7

                HI,
                you are right, but i still have many Problems,
                First : how i can make the Picture as Background?
                Second , i can not use the same Scene for Image and for drawing , is that right ? because when i use QGraphicsScene to put an Image and use it agine for drawing , the Image is removed .
                About drawing on the Qgraphicsview ,can you tell me please exactly your Idee , how i can do that?

                do you mean that i have to create many RectF on the Trac?
                I try to do the Pictures as Background it does not work :
                Please see this :

                @QPixmap myPix;
                myPix.load("C:/Pictures/Race_trac.jpg");
                ui->setupUi(this);

                   scene = new QGraphicsScene(this);
                   scene->addPixmap(myPix);
                

                // This add only the Image to the Graphicsview ,
                // but when i use the scene againe ,the positon of the Image is not as before
                // ui->graphicsView->setScene(scene);

                   //I try to make the Image as Background it dose not work
                     ui->graphicsView->setBackgroundBrush(myPix);
                     ui->graphicsView->setCacheMode(QGraphicsView::CacheBackground);
                     ui->graphicsView->setAlignment(Qt::AlignCenter);
                    
                     
                  // do you mean i have to creat many REct like this and then add them to Graphicsview?
                 scene->setSceneRect(-50,-50, 0, 0);
                

                @

                thanks.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  BlastDV
                  wrote on last edited by
                  #8

                  You are not supossed to put your picture directly to the QGraphicsView but to the QGraphicsScene you are willing to use.

                  The QGraphicsScene::addPixMap() method will help you with that.

                  I did something like what you want once and I'm almost sure I never had to use setCachemode() or similars.

                  Please take your time to read the two references I gave you in the last post. Everything is in there, including what setSceneRect() is for.

                  (8) Just live your life blind like me (8)

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    samlion007
                    wrote on last edited by
                    #9

                    hi,

                    Iam trying now to creat many Rect on QGraphicsScene and then i will draw into the Rects so that drawing will be not outside of the trac , is this what you mean?

                    ok, i will try today to read the tow references.

                    regards

                    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