Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting MATLAB surf plots with colorbars results in corrupted png files using opengl hardware renderer

When I export a 2D surface plot with a colorbar from MATLAB to a png file, it results in corrupted images when I use the opengl hardware renderer, as seen here:

corrupted surface plot png export from MATLAB

Everything else is working fine. But after I created one figure with a colorbar, all other surface plots that I export to png files are corrupted, even if they don't contain any colorbars.

opengl info in MATLAB gives the following output:

    Version         = 3.0 Mesa 10.1.0
    Vendor          = Intel Open Source Technology Center
    Renderer        = Mesa DRI Intel(R) Haswell Desktop 
    MaxTextureSize  = 8192
    Visual          = 0x20 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
    Software        = false
    # of Extensions = 190

    Driver Bug Workarounds:
    OpenGLBitmapZbufferBug    = 0
    OpenGLWobbleTesselatorBug = 0
    OpenGLLineSmoothingBug    = 0
    OpenGLClippedImageBug     = 0
    OpenGLEraseModeBug        = 0

I tried all these OpenGL workarounds but nothing helped.

Has anybody an idea how to resolve this issue?

My system:

  • Kernel: 3.13.0-24-generic 64 bit
  • Prozessor: Intel Haswell i7 4770K
  • Graphics: Intel HD 4000
  • MATLAB version: R2013b

On my colleague's computer, which is exactly the same, but has a different OS (debian wheezy) this problem is not appearing. On his computer opengl info gives:

    Version         = 2.1 Mesa 8.0.5
    Vendor          = VMware, Inc.
    Renderer        = Gallium 0.4 on llvmpipe (LLVM 0x209)
    MaxTextureSize  = 4096
    Visual          = 0xfc (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
    Software        = false
    # of Extensions = 143

    Driver Bug Workarounds:
    OpenGLBitmapZbufferBug    = 0
    OpenGLWobbleTesselatorBug = 0
    OpenGLLineSmoothingBug    = 0
    OpenGLClippedImageBug     = 0
    OpenGLEraseModeBug        = 0

Could it be that in his case it works because Gallium/llvmpipe is a software renderer in reality?

What's the problem with the colorbar?

like image 692
GriffinPeterson Avatar asked May 08 '14 11:05

GriffinPeterson


1 Answers

Unfortunately, MATLAB isn't fantastic when it comes to standardisation, the problem with colour map is that when saved or not used with something other than MATLAB, the encoded image isn't saved or generated for easy use for other applications because MATLAB optimises the mapping for MATLAB applications only, if I do find an example that can help you I'll edit my answer but I hope this sheds some light on your problem.

Otherwise its matlabs fault and it isn't saving images correctly.

like image 97
Pariah Avatar answered Oct 03 '22 18:10

Pariah