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. Image distortion, how to?
Forum Updated to NodeBB v4.3 + New Features

Image distortion, how to?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 3.5k 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.
  • deleted57D Offline
    deleted57D Offline
    deleted57
    wrote on last edited by
    #1

    Hi all

    What could be the best way using Qt classes for distort an image in the following mode?

    !http://3.bp.blogspot.com/-i_EeoQluuU8/T7FsWDsbKfI/AAAAAAAAB7U/f1pQjXHwYps/s600/geometric+distortion+pincushion+barrel.png(Image distortion)!

    Thank you

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tilsitt
      wrote on last edited by
      #2

      Hi,

      What do you mean exactly? Do you want to display a distorted representation of an image (in a widget, or in OpenGL), or do you want to load an image, apply a distortion and save the result in a new file?

      1 Reply Last reply
      0
      • deleted57D Offline
        deleted57D Offline
        deleted57
        wrote on last edited by
        #3

        Hi

        I want to display a distorted representation of an image in a widget.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #4

          Ok, IMHO the best way is to draw a textured quad in an OpenGL context (QWindow or QGLWidget depending on your Qt version and your application design) and to use a fragment shader to "distort" texture coordinates.

          1 Reply Last reply
          0
          • deleted57D Offline
            deleted57D Offline
            deleted57
            wrote on last edited by
            #5

            Use OpenGL is the only way to reach such result? There is no another way making it but involving standard Qt classes only?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tilsitt
              wrote on last edited by
              #6

              Qt OpenGL classes are standard Qt classes too ;). More seriously, there is "this example":http://qt-project.org/doc/qt-5.1/qtwidgets/painting-deform.html which is using QPainterPath to achieve something similar with text, but I never used it so I'm not sure it will really be what you want.

              1 Reply Last reply
              0
              • deleted57D Offline
                deleted57D Offline
                deleted57
                wrote on last edited by
                #7

                Well, in my understanding (that can be wrong) Qt act like a wrapper over OpenGL libraries that already have to be "supported" by the system. In my case I would to hav a code "system independent" if possible obviously (what happen if the code run in a very old system where OpenGL are not supported?). About the example you pointed I had already checked it but, basically, it make a pixet to pixel operation to create len effect. In my original question on the contrary, I would to know if Qt already provide some feature to obtain such image distortion in an easy way. If not possible I need to develop my own alghoritm (or looking for a ready made). Is just for avoid to reinvent the wheel. ;)

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tilsitt
                  wrote on last edited by
                  #8

                  OpenGL implements shaders since version 2.0, so an old system where it is not supported should be very very old. But if you care about that, you're right, you should use QPainter functionalities but, unfortunately, AFAIK there is no easy way. Wheel isn't invented yet, you can do it ;).

                  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