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. open .tif images
Forum Updated to NodeBB v4.3 + New Features

open .tif images

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 5 Posters 7.2k Views 2 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.
  • N Offline
    N Offline
    navya.dubey
    wrote on last edited by
    #1

    I am working on raster images I have configured OpenCV in Qt creator now it is working fine when I am working with .png or .jpg images, but when I am trying to open .tif type rasters program crashes, after exploring different forums I came to know about a libtiff library in OpenCV, Now after including header files of that library it shows error that no such file or directory found, I searched for libtiff.dll file in the OpenCV-build folder but no such dll file was found.

    Please help.

    m.sueM 1 Reply Last reply
    0
    • N navya.dubey

      I am working on raster images I have configured OpenCV in Qt creator now it is working fine when I am working with .png or .jpg images, but when I am trying to open .tif type rasters program crashes, after exploring different forums I came to know about a libtiff library in OpenCV, Now after including header files of that library it shows error that no such file or directory found, I searched for libtiff.dll file in the OpenCV-build folder but no such dll file was found.

      Please help.

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi @navya.dubey

      OpenCV is not a part of Qt.

      On the other hand, I myself have no problems to read tif-files with OpenCV (on WINDOWS). I just need opencv core and imgcodecs and imageproc dlls.

      -Michael.

      1 Reply Last reply
      2
      • N Offline
        N Offline
        navya.dubey
        wrote on last edited by navya.dubey
        #3

        @m-sue could you please share the code to open .tif files in Qt , because I am facing some issues.

        m.sueM 1 Reply Last reply
        0
        • N navya.dubey

          @m-sue could you please share the code to open .tif files in Qt , because I am facing some issues.

          m.sueM Offline
          m.sueM Offline
          m.sue
          wrote on last edited by m.sue
          #4

          Hi @navya.dubey

          In Qt itself it is quite simple:

          	QImage qi;
          	if (!qi.load(szFileName)) {
          		//return error
          	}
          

          But you will need to distribute the tiff image plugin with your program (and make it available to your self while testing): ...\plugins\imageformats\qtiff.dll

          CAVEAT: Qt cannot read in 16-bit per color-channel images. That's why I use OpenCV at the moment.

          -Michael.

          N Crawl.WC 2 Replies Last reply
          3
          • m.sueM m.sue

            Hi @navya.dubey

            In Qt itself it is quite simple:

            	QImage qi;
            	if (!qi.load(szFileName)) {
            		//return error
            	}
            

            But you will need to distribute the tiff image plugin with your program (and make it available to your self while testing): ...\plugins\imageformats\qtiff.dll

            CAVEAT: Qt cannot read in 16-bit per color-channel images. That's why I use OpenCV at the moment.

            -Michael.

            N Offline
            N Offline
            navya.dubey
            wrote on last edited by navya.dubey
            #5

            @m.sue dear sir,
            don't you think I need to do some external configuration to work with .tif files? Because I am getting the following errors. Now these errors can occur due to the misunderstanding about how to use geotiff function
            0_1502876884275_Screenshot (9).png

            jsulmJ 1 Reply Last reply
            0
            • N navya.dubey

              @m.sue dear sir,
              don't you think I need to do some external configuration to work with .tif files? Because I am getting the following errors. Now these errors can occur due to the misunderstanding about how to use geotiff function
              0_1502876884275_Screenshot (9).png

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

              @navya.dubey Just change scanline to unsigned char* or do an explicit type cast to get rid of that error message.
              Regarding the crash: you should tell what exactly is happening (SIGSEGV?)and maybe post a stack trace.
              Ans as @m-sue already said your question is not related to Qt, it could be better to ask in an OpenCV forum.

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

              N 1 Reply Last reply
              0
              • jsulmJ jsulm

                @navya.dubey Just change scanline to unsigned char* or do an explicit type cast to get rid of that error message.
                Regarding the crash: you should tell what exactly is happening (SIGSEGV?)and maybe post a stack trace.
                Ans as @m-sue already said your question is not related to Qt, it could be better to ask in an OpenCV forum.

                N Offline
                N Offline
                navya.dubey
                wrote on last edited by
                #7

                @jsulm OK I'll ask my question on OpenCV forum, but could you please tell me that is there any inbuilt function in Qt to load .tiff files?

                jsulmJ artwawA 2 Replies Last reply
                0
                • N navya.dubey

                  @jsulm OK I'll ask my question on OpenCV forum, but could you please tell me that is there any inbuilt function in Qt to load .tiff files?

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

                  @navya.dubey Actually a standard Qt set-up should support tiff images out of the box. You should have qtiff.dll plugin in gcc_64/plugins/imageformats. If you have one and it is not working (QImage/QPixmap) then maybe the libtiff is missing. You can check that setting QT_DEBUG_PLUGINS variable before starting your app. Did you try to load your images using QImage?

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

                  1 Reply Last reply
                  1
                  • N navya.dubey

                    @jsulm OK I'll ask my question on OpenCV forum, but could you please tell me that is there any inbuilt function in Qt to load .tiff files?

                    artwawA Offline
                    artwawA Offline
                    artwaw
                    wrote on last edited by
                    #9

                    @navya.dubey The same as every other image format. Please refer to QImage, QPixmap and QPicture docs.

                    As for supported image format default ones are listed in QImageReader docs, TIFF is being read by 3rd party plugin - detailed info here.

                    For more information please re-read.

                    Kind Regards,
                    Artur

                    1 Reply Last reply
                    2
                    • m.sueM m.sue

                      Hi @navya.dubey

                      In Qt itself it is quite simple:

                      	QImage qi;
                      	if (!qi.load(szFileName)) {
                      		//return error
                      	}
                      

                      But you will need to distribute the tiff image plugin with your program (and make it available to your self while testing): ...\plugins\imageformats\qtiff.dll

                      CAVEAT: Qt cannot read in 16-bit per color-channel images. That's why I use OpenCV at the moment.

                      -Michael.

                      Crawl.WC Offline
                      Crawl.WC Offline
                      Crawl.W
                      wrote on last edited by
                      #10

                      @m.sue I am using QImage load a 16bit grayscale, and then invoke QImage::depth() but return 32, QImage::sizeInBytes() return a error val.That's what you said about "Qt cannot read in 16-bit per color-channel images"?Can you explain further why?Thank you.

                      jsulmJ 1 Reply Last reply
                      0
                      • Crawl.WC Crawl.W

                        @m.sue I am using QImage load a 16bit grayscale, and then invoke QImage::depth() but return 32, QImage::sizeInBytes() return a error val.That's what you said about "Qt cannot read in 16-bit per color-channel images"?Can you explain further why?Thank you.

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

                        @Crawl.W said in open .tif images:

                        Can you explain further why?

                        I guess because it is not implemented in Qt.

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

                        1 Reply Last reply
                        1

                        • Login

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