failing when charging a particular PNG image

Help
2011-10-31
2013-06-03
  • Daniel Molina
    Daniel Molina
    2011-10-31

    I cannot charge the IDL image "avhrr.png'

    The code is very simple:

    image = READ_PNG('/usr/local/rsi/idl/examples/data/avhrr.png')
    % Compiled module: READ_PNG.
    % Compiled module: READ_PNG.
    Segmentation fault

     
  • Which version of GDL are you using?
    With the current CVS version I get:

    GDL> image = READ_PNG('/EXPORT/idl/idl81/examples/data/avhrr.png')
    % Compiled module: READ_PNG.
    % Compiled module: READ_PNG.
    GDL> help, image
    IMAGE           BYTE      = Array

    Sylwester

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    Idem for the TIFF image examples.tif:

    GDL> image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    % Compiled module: READ_TIFF.
    Orientation and planarconfig may not be accurate.
    Segmentation fault

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    I'm using a CVS version since ~8 days ago

     
  • GDL> image = READ_PNG('/EXPORT/idl/idl81/examples/data/examples.tif')
    % Compiled module: READ_PNG.
    % Compiled module: READ_PNG.
    GDL> help, image
    IMAGE           BYTE      = Array

    Could you post here a backtrace? i.e.:
    $ gdb gdl
    (gdb) run
    GDL> image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    (gdb) bt

    Sylwester

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    Of course:

    $ gdb gdl
    GNU gdb (GDB) 7.1-ubuntu
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i486-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>…
    Reading symbols from /home/lluvia/My_Programs/bin/gdl…(no debugging symbols found)…done.
    (gdb) image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    Undefined command: "image".  Try "help".
    (gdb) run
    Starting program: /home/lluvia/My_Programs/bin/gdl

      GDL - GNU Data Language, Version 0.9.1 CVS

    - For basic information type HELP,/INFO
    - Default library routine search path used (GDL_PATH/IDL_PATH env. var. not set):
      +/home/lluvia/My_Programs/share/gnudatalanguage/lib
    - Please report bugs, feature or help requests and patches at:
      http://sourceforge.net/projects/gnudatalanguage/

    %** You have access to files in the Metodi_Immagini directory **
    % Compiled module: LOADIMAGE.
    % Compiled module: SHOWIMAGE.
    % Compiled module: DISPLAYIMAGE.
    GDL> image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    % Compiled module: READ_TIFF.

    Orientation and planarconfig may not be accurate.

    Program received signal SIGSEGV, Segmentation fault.
    0x0884e396 in lib::magick_readindexes(EnvT*) ()
    (gdb) bt
    #0  0x0884e396 in lib::magick_readindexes(EnvT*) ()
    #1  0x0890018d in FCALL_LIBNode::Eval() ()
    #2  0x088f3320 in ASSIGN_REPLACENode::Run() ()
    #3  0x08162fb6 in GDLInterpreter::statement(ProgNode*) ()
    #4  0x0816bce2 in GDLInterpreter::function_call(ProgNode*) ()
    #5  0x08169af4 in GDLInterpreter::tmp_expr(ProgNode*) ()
    #6  0x088f3261 in ASSIGN_REPLACENode::Run() ()
    #7  0x08162fb6 in GDLInterpreter::statement(ProgNode*) ()
    #8  0x08163960 in GDLInterpreter::interactive(ProgNode*) ()
    #9  0x08782f3d in DInterpreter::ExecuteLine(std::istream*, unsigned long long) ()
    #10 0x08784584 in DInterpreter::InterpreterLoop(std::string const&, std::vector<std::string, std::allocator<std::string> >&, std::string const&) ()
    #11 0x089125a7 in main ()
    (gdb)

     
  • Thanks!
    And could you repeat it having compiled GDL with debugging symbols? :), i.e.:

    make clean
    CXXFLAGS="$CXXFLAGS -g -O0" ./configure …
    make

    or if using CMake:
    make clean
    cmake … -DCMAKE_BUILD_TYPE=Debug
    make

    Sylwester

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    Here!:

    $ gdb gdl
    GNU gdb (GDB) 7.1-ubuntu
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i486-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>…
    Reading symbols from /home/lluvia/My_Programs/bin/gdl…done.
    (gdb) run
    Starting program: /home/lluvia/My_Programs/bin/gdl

      GDL - GNU Data Language, Version 0.9.1 CVS

    - For basic information type HELP,/INFO
    - Default library routine search path used (GDL_PATH/IDL_PATH env. var. not set):
      +/home/lluvia/My_Programs/share/gnudatalanguage/lib
    - Please report bugs, feature or help requests and patches at:
      http://sourceforge.net/projects/gnudatalanguage/

    %** You have access to files in the Metodi_Immagini directory **
    % Compiled module: LOADIMAGE.
    % Compiled module: SHOWIMAGE.
    % Compiled module: DISPLAYIMAGE.
    GDL> image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    % Compiled module: READ_TIFF.

    Orientation and planarconfig may not be accurate.

    Program received signal SIGSEGV, Segmentation fault.
    0x086c03b1 in lib::magick_readindexes (e=0x8c144a8)
        at /home/lluvia/Compiling/gdl/src/magick_cl.cpp:394
    394     (*bImage)= index;
    (gdb) bt
    #0  0x086c03b1 in lib::magick_readindexes (e=0x8c144a8)
        at /home/lluvia/Compiling/gdl/src/magick_cl.cpp:394
    #1  0x0877039c in FCALL_LIBNode::Eval (this=0x8bfe0e0)
        at /home/lluvia/Compiling/gdl/src/prognodeexpr.cpp:1950
    #2  0x087629d1 in ASSIGN_REPLACENode::Run (this=0x8c0ee20)
        at /home/lluvia/Compiling/gdl/src/prognode.cpp:675
    #3  0x0817b314 in GDLInterpreter::statement (this=0xbffff620, _t=0x8bf4d18)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:96
    #4  0x0817c11f in GDLInterpreter::call_fun (this=0xbffff620, _t=0x8bf4d18)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:625
    #5  0x08188f1c in GDLInterpreter::function_call (this=0xbffff620, _t=0x8bf1998)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:6234
    #6  0x08180697 in GDLInterpreter::tmp_expr (this=0xbffff620, _t=0x8c059a0)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:2674
    #7  0x08762b00 in ASSIGN_REPLACENode::Run (this=0x8bf7088)
        at /home/lluvia/Compiling/gdl/src/prognode.cpp:690
    #8  0x0817b314 in GDLInterpreter::statement (this=0xbffff620, _t=0x8bf7088)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:96
    #9  0x0817b254 in GDLInterpreter::interactive (this=0xbffff620, _t=0x8bf7088)
        at /home/lluvia/Compiling/gdl/src/GDLInterpreter.cpp:39
    #10 0x085fc9bb in DInterpreter::ExecuteLine (this=0xbffff620, in=0x0, lineOffset=0)
        at /home/lluvia/Compiling/gdl/src/dinterpreter.cpp:937
    #11 0x085fe27c in DInterpreter::InterpreterLoop (this=0xbffff620, startup=…, batch_files=…,
        statement=…) at /home/lluvia/Compiling/gdl/src/dinterpreter.cpp:1393
    #12 0x08781b97 in main (argc=1, argv=0xbffff864) at /home/lluvia/Compiling/gdl/src/gdl.cpp:281

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    I think that it is happening when images have only one channel and not 3, also with JPEGs.

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    > lluvia> I think that it is happening when images have only one channel and not 3, also with JPEGs.

    However africavlc.png seems an exception.

     
  • Thanks a lot!

    After inserting in line 392 of src/magick_cl.cpp:
    cerr << "rows=" << rows << " columns=" << columns << " index=" << index << endl;

    I get:
    GDL> image = READ_TIFF('/EXPORT/idl/idl81/examples/data/examples.tif')
    % Compiled module: READ_TIFF.
    Orientation and planarconfig may not be accurate.
    rows=150 columns=375 index=0x17a0bc0

    Could you check what's printed on your machine?
    S.

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    GDL> image = READ_TIFF('/usr/local/rsi/idl/examples/data/examples.tif')
    % Compiled module: READ_TIFF.
    Orientation and planarconfig may not be accurate.
    rows=150 columns=375 index=0
    Segmentation fault

     
  • Can you open this image with display? i.e.
    $ display /usr/local/rsi/idl/examples/data/avhrr.png

     
  • Daniel Molina
    Daniel Molina
    2011-10-31

    Yes, I can.

    Btw, I think that the match here is: those photos which has palette: index=NULL
    but it doesn't happens if it has no palette.

     
  • Daniel Molina
    Daniel Molina
    2011-11-07

    Hi slayoo,

    Which version of ImageMagick do you have?
    Maybe if I install the same one I have no that problem.

    Regards

     
  • $ Magick++-config -version
    6.5.2 Q16

    Perhaps there might also be some issue regarding ImageMagick vs. GraphicsMagick compatibility?

    Regards,
    Sylwester

     
  • Daniel Molina
    Daniel Molina
    2011-11-16

    Now, with applied patches to 0.92 version, I have a better experience loading photos.

    But, for example, displaying this one doesn't work for me

    (Image: http://upload.wikimedia.org/wikipedia/commons/6/64/Gnu_meditate_levitate.png)

    GDL> image=READ_PNG('/home/lluvia/Gnu_meditate_levitate.png')
    GDL> tv, image, true=1

    I see a collage of gray lines, where you can recognize some forms of the original image.

    When I had time I'll check it better which is the pattern which fails among other images.

     
  • Daniel Molina
    Daniel Molina
    2011-11-16

    I had the same results for this example with a CVS version.

     
  • Alain C.
    Alain C.
    2011-11-16

    Thanks for the clear example. For me the situation is clear: this peculiar PNG file is a  cube (you can see it via "HELP"), but TV can manage only  cubes today. We are not ready ! Help welcome. (it is clear I don't know how to manage a  cube as an image !)

    Another point is that its seems that READ_PNG need to be called 2 times to load image when not compiled before … (we have to solve that)

     
  • Daniel Molina
    Daniel Molina
    2011-12-09

    I have two more problems related with obtaining info from images. (Sorry, but I usually work with the default IDL images; it would be good to have a representative selection of images that we can use for testing)

    1.

    known_format = query_image(!DIR + '/examples/data/endocell.jpg', image_info)
    print, image_info.has_palette
           1

    should be 0

    2.

    known_format = query_image(!DIR + '/examples/data/africavlc.png', image_info)
    GDL> print, image_info.channels
                 4

    It should be 1

     
  • Daniel Molina
    Daniel Molina
    2011-12-17

    For the representation of 4-dim images, I think that ignoring last dimension does an acceptable work. Something such as

    TV, image, /true

    Maybe a filtering like this could be stay in the inners of GDL until a better solution.

     
  • Daniel Molina
    Daniel Molina
    2012-01-31

    I read in IDL documentation:

    Although IDL uses the RGB color system  internally, color tables can be specified to TVLCT using any of the
    following color systems: RGB (Red, Green, Blue), HLS (Hue, Lightness, Saturation), and HSV (Hue, Saturation, Value). Alpha 
    values may also be used when using the second form of the command.

    Maybe that it is useful for managing transparencies.